Browse Source

Admin can select staffer

master
Doug Le Tough 2 years ago
parent
commit
28f4ce1af2
2 changed files with 26 additions and 1 deletions
  1. +14
    -1
      participate.py
  2. +12
    -0
      templates/staffsheet.html

+ 14
- 1
participate.py View File

@ -544,6 +544,17 @@ def turns_list():
########################################################################
# Staffs
########################################################################
def get_staffers():
try:
staffers = Tetawebapp_users.query(Tetawebapp_users.id > 1).all()
return staffers
except Exception as e:
print "[+] Error at get_staffers:"
print "------------------------------"
print "%s" % e.message
print "------------------------------"
return False
def get_staffs():
""" """
try:
@ -853,14 +864,16 @@ def logout():
@check_session
def staffsheet():
try:
is_admin = session['is_admin']
user_id = session['user_id']
if len(check_user_info()) == 0:
page = str(request.url_rule)
menu = get_menu(page)
turns = turns_list()
staffs = get_staffs()
staffers = get_staffers()
roles = get_roles()
return render_template('staffsheet.html', menu=menu, turns=turns, staffs=staffs, user_id=user_id, roles=roles, message='')
return render_template('staffsheet.html', menu=menu, turns=turns, staffs=staffs, staffers=staffers, user_id=user_id, is_admin=is_admin, roles=roles, message='')
else:
return account()
except AttributeError as e:


+ 12
- 0
templates/staffsheet.html View File

@ -68,6 +68,18 @@
{% endif %}
{% if user_id == sslot[0].user_id %}
<div class='sheet_user{{ num_slot }} {{ border }}' id='staff_{{ turn_id }}_{{ slot }}' onclick='javascript:clear_sheet(this, {{ turn_id }}, {{ slot }})'>{{ sslot[1] }}</div>
{% elif is_admin %}
<div class='sheet_user{{ num_slot }} {{ border }}'>
<select id='staff_{{ turn_id }}_{{ slot }}' onchange='javascript:select_user(this, {{ turn_id }}, {{ slot }})'>
{% for staffer in staffers %}
{% if staffer.name == sslot[1] %}
<option value='{{ staffer.id }}'>{{ staffer.name }}</option>
{% else %}
<option selected='selected' value='{{ staffer.id }}'>{{ staffer.name }}</option>
{% endif %}
{% endfor %}
</select>
</div>
{% else %}
<div class='sheet_user{{ num_slot }} {{ border }}' id='staff_{{ turn_id }}_{{ slot }}' style='cursor: text;'>{{ sslot[1] }}</div>
{% endif %}


Loading…
Cancel
Save