Exemplo n.º 1
0
def index():
    role = g.user_data['role']
    logged_user_id = g.user_data['id']

    template = None
    context = {}

    if role == 'caregiver':
        children = users.get_caregivers_children(logged_user_id)
        template = 'index_caregiver.html'

        context.update({
            "firstname": g.user_data['firstname'],
            "role": role,
            "children": children
        })

    elif role == 'child':

        template = 'index_child.html'
        child = users.get_child_data(logged_user_id)
        child_points = points.get_child_points(child['id'])
        childs_tasks = tasks.get_tasks(logged_user_id)
        childs_prizes = prizes.get_prizes(logged_user_id)
        context = {
            'child': child,
            'child_points': child_points,
            'childs_tasks': childs_tasks,
            'childs_prizes': childs_prizes
        }

    messages = get_flashed_messages()

    return render_template(template, **context, messages=messages)
Exemplo n.º 2
0
def child(child_id):
    child = users.get_child_data(child_id)
    childs_tasks = tasks.get_tasks(child_id)
    childs_prizes = prizes.get_prizes(child_id)
    role = g.user_data['role']
    child_points = points.get_child_points(child['id'])
    info = bans.get_most_important_warn_ban(child_id).split(';')
    info_str = info[0]
    info_bck = info[1]

    context = {
        'child': child,
        'childs_tasks': childs_tasks,
        'childs_prizes': childs_prizes,
        'role': role,
        'child_points': child_points,
        'info_str': info_str,
        'info_bck': info_bck,
        "firstname": g.user_data['firstname']
    }

    messages = get_flashed_messages()

    return render_template('base/index_child.html',
                           **context,
                           messages=messages)
Exemplo n.º 3
0
def task_detail(child_id):
    child = users.get_child_data(child_id)
    childs_tasks = tasks.get_tasks(child_id)
    childs_points_history = points.get_points_history(child_id)
    role = g.user_data['role']
    child_points = points.get_child_points(child['id'])

    context = {'child': child,
               'childs_tasks': childs_tasks,
               'childs_points_history': childs_points_history,
               'role': role,
               'child_points': child_points
               }

    return render_template('tasks/task_detail.html', **context)
Exemplo n.º 4
0
def child(child_id):
    child = users.get_child_data(child_id)
    childs_tasks = tasks.get_tasks(child_id)
    childs_prizes = prizes.get_prizes(child_id)
    role = g.user_data['role']
    child_points = points.get_child_points(child['id'])

    context = {'child': child,
               'childs_tasks': childs_tasks,
               'childs_prizes': childs_prizes,
               'role': role,
               'child_points': child_points}

    messages = get_flashed_messages()

    return render_template('caregiver_panel.html', **context, messages=messages)