stc

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

commit 683b0b841b19c5f20259f14672556c750999b6e9
parent 2211ce5e2ba505e0dc3b993acca529f4e6834f71
Author: Brennen T. Mazur <brennen@madis.cool>
Date:   Fri,  3 Mar 2023 14:57:02 -0700

hours page is now user modular

Diffstat:
Mapp/routes.py | 8+++++---
Mapp/templates/base.html | 2+-
Mapp/templates/dashboard/punchclock/index.html | 2+-
Mapp/templates/dashboard/punchclock/widget.html | 2+-
4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/app/routes.py b/app/routes.py @@ -178,10 +178,12 @@ def vehicle_report(): return render_template ('admin/reports/vehicle_report.html', ORGNAME=OrganizationName) -@app.route("/hours")#modify to take userid ex. /hours<userid> for "admin" currently pulls from current_user... simply always pass username to hours(if possible set a default to current_user) +@app.route('/hours/<username>')#modify to take userid ex. /hours<userid> for "admin" currently pulls from current_user... simply always pass username to hours(if possible set a default to current_user) @login_required -def hours():#userid goes into call to db to get user[] -> then returns formatted table (punchclock/index.html - return render_template ('dashboard/punchclock/index.html',ORGNAME=OrganizationName) +def hours(username):#userid goes into call to db to get user[] -> then returns formatted table (punchclock/index.html + user = load_user(username) + hours = mongo.db.time_collection.find({'modified_by.0':user.username}) + return render_template ('dashboard/punchclock/index.html',user=user,ORGNAME=OrganizationName) # Don't really need this until additional functionality is added, not in current project scope #@app.route("/fleet") diff --git a/app/templates/base.html b/app/templates/base.html @@ -17,7 +17,7 @@ <!-- END logo --> <!-- BEGIN navigation/navi logic --> {% if current_user.is_authenticated %} - <!-- if userHasPermission(current_user.role) [admin] | if route is admin [dashboard] else [empty space]-->{% if current_user.role == "admin" %}<!-- Need to check for page location --> + <!-- if userHasPermission(current_user.role) [admin] | if route is admin [dashboard] else [empty space]-->{% if adminNav == True %} <a href="{{ url_for('admin') }}"><div id="navi">Admin</div></a> {% else %} <a href="{{ url_for('dashboard') }}"><div id="navi">Dashboard</div></a> diff --git a/app/templates/dashboard/punchclock/index.html b/app/templates/dashboard/punchclock/index.html @@ -4,7 +4,7 @@ {% block content %} <section class="hours-grid"> - <h3>{{ current_user.fname }} {{ current_user.lname }}</h3><!-- IF logged in user has permission allow this username section to be a dropdown for modifying user time sheets. --> + <h3>{{ user.fname }} {{ user.lname }}</h3><!-- IF logged in user has permission allow this username section to be a dropdown for modifying user time sheets. --> <h1 id="clock"></h1> <div><!-- abstract to payPeriod() --> <h6>$payperiod range</h6> diff --git a/app/templates/dashboard/punchclock/widget.html b/app/templates/dashboard/punchclock/widget.html @@ -25,6 +25,6 @@ <p>{ form.lunchBox() }} { form.lunchBox.label }}</p> <p>{ form.perdiumBox() }} { form.perdiumBox.label }}</p> --> - <button><a href="{{ url_for('hours') }}">Change Hours</a></button><!--routes to userhours.html--> + <button><a href="{{ url_for('hours',username=current_user.username) }}">Change Hours</a></button><!--routes to userhours.html--> <h2>{{ current_user.fname }} {{ current_user.lname }}</h2><!-- something like currenttime above --> </section>