stc

a simple time card webapp
git clone _git@git.brennen.work:stc.git
Log | Files | Refs | README

commit b8cdb9560a3dcbe82ed914a3aa6c126068391af1
parent 93f82d0f488ae8188003f707fb920c9bd7ed84b1
Author: Brennen T. Mazur <brennen@madis.cool>
Date:   Thu, 23 Feb 2023 11:01:33 -0700

added sorting for active and inactive users, linked in user widget

Diffstat:
Mapp/routes.py | 12++++++++++++
Aapp/templates/admin/users/active.html | 11+++++++++++
Aapp/templates/admin/users/inactive.html | 11+++++++++++
Dapp/templates/admin/users/inactiveusers.html | 27---------------------------
Mapp/templates/admin/users/widget.html | 6+++---
5 files changed, 37 insertions(+), 30 deletions(-)

diff --git a/app/routes.py b/app/routes.py @@ -148,6 +148,18 @@ def roles(): dashform = DashPermissionsForm() return render_template('admin/roles/updateroles.html',dashform=dashform,admnform=admnform,ORGNAME=OrganizationName) +@app.route("/admin/users/active") +@login_required +def activeusers(): + active = mongo.db.user_collection.find({'is_active':True}) + return render_template('admin/users/active.html',activeusers=active,ORGNAME=OrganizationName) + +@app.route("/admin/users/inactive") +@login_required +def inactiveusers(): + inactive = mongo.db.user_collection.find({'is_active':False}) + return render_template('admin/users/inactive.html',inactiveusers=inactive,ORGNAME=OrganizationName) + @app.route("/admin/newuser", methods=["GET","POST"]) @login_required def newuser(): diff --git a/app/templates/admin/users/active.html b/app/templates/admin/users/active.html @@ -0,0 +1,11 @@ +{% extends 'base.html' %} + +{% block title %}All Active Users{% endblock %} + +{% block content %} + {%- for user in activeusers %} + {%- print(user) %} + </br> + </br> + {%- endfor %} +{% endblock %} diff --git a/app/templates/admin/users/inactive.html b/app/templates/admin/users/inactive.html @@ -0,0 +1,11 @@ +{% extends 'base.html' %} + +{% block title %}All Inactive Users{% endblock %} + +{% block content %} + {%- for user in inactiveusers %} + {%- print(user) %} + </br> + </br> + {%- endfor %} +{% endblock %} diff --git a/app/templates/admin/users/inactiveusers.html b/app/templates/admin/users/inactiveusers.html @@ -1,27 +0,0 @@ -{% extends 'base.html' %} - -{% block title %}Add new Employee{% endblock %} - -{% block navigation %}<a id="navi" href="/admin"><div id="back"><Back</div></a>{% endblock %} - -{% block content %} - <form action="" method="post" novalidate> - {{ form.hidden_tag() }} - {% for error in form.errors %} - <span style="color:red;">[{{ error }}]</span> - {% endfor %} - {{ form.fname.label }}{{ form.fname() }}<br> - {{ form.mname.label }}{{ form.mname(size=1) }}<br> - {{ form.lname.label }}{{ form.lname() }}<br> - {{ form.birthday.label }}{{ form.birthday() }}<br> - {{ form.role.label }}{{ form.role() }}<br> - {{ form.address.label }}{{ form.address() }}<br> - {{ form.branch.label }}{{ form.branch() }}<br> - {{ form.phonenumber.label }}{{ form.phonenumber() }}<br> - {{ form.email.label }}{{ form.email() }}<br> - {{ form.payPeriod.label }}{{ form.payPeriod() }}<br> - {{ form.payValue.label }}{{ form.payValue() }}<br> - {{ form.setActive() }}{{ form.setActive.label }}<br> - {{ form.createNewUser() }} - </form> -{% endblock %} diff --git a/app/templates/admin/users/widget.html b/app/templates/admin/users/widget.html @@ -1,6 +1,6 @@ <section class="admin-sidebar"> <h3>Users</h3> - <input type="submit" value="Active"> <!--sends active tag to route changes available users in dropdown --> - <input type="submit" value="Inactive"> <!-- sends inactive tag to route for available users dropdown --> - <a href="{{ url_for('newuser') }}"><input type="submit" value="New"></a> <!-- separate newuser.html pg? --> + <a href="{{ url_for('activeusers') }}"><input type="submit" value="Active"></a> <!--sends active tag to route changes available users in dropdown --> + <a href="{{ url_for('inactiveusers') }}"><input type="submit" value="Inactive"></a> <!-- sends inactive tag to route for available users dropdown --> + <a href="{{ url_for('newuser') }}"><input type="submit" value="New"></a> <!-- separate newuser.html pg? --> </section>