stc

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

commit f97882902e9f76e560e97afabb2711b55aac93fe
parent 6998067ab9788c802bf1f788df94e75f0e79404b
Author: Youth Employment Program Production <youthemployment22@gmail.com>
Date:   Tue, 23 Apr 2024 12:43:22 -0600

Bugfix: unique names for meetings bp. add messages to punchclock otheruser.html

Diffstat:
Mapp/meetings/__pycache__/routes.cpython-310.pyc | 0
Mapp/meetings/routes.py | 34+++++++++++++++++-----------------
Rapp/meetings/templates/dev.html -> app/meetings/templates/dev_meetings.html | 0
Rapp/meetings/templates/form.html -> app/meetings/templates/form_meetings.html | 0
Mapp/meetings/templates/meeting.html | 4++--
Mapp/meetings/templates/meetings.html | 4++--
Rapp/meetings/templates/new.html -> app/meetings/templates/new_meeting.html | 0
Dapp/meetings/templates/update.html | 32--------------------------------
Aapp/meetings/templates/update_meeting.html | 32++++++++++++++++++++++++++++++++
Rapp/meetings/templates/upload.html -> app/meetings/templates/upload_meeting_document.html | 0
Mapp/templates/dashboard/punchclock/otheruser.html | 8++++++++
11 files changed, 61 insertions(+), 53 deletions(-)

diff --git a/app/meetings/__pycache__/routes.cpython-310.pyc b/app/meetings/__pycache__/routes.cpython-310.pyc Binary files differ. diff --git a/app/meetings/routes.py b/app/meetings/routes.py @@ -57,13 +57,13 @@ def meetingSeed(): mongo.db.meeting_collection.delete_many({}) mongo.db.meeting_collection.insert_many(seeds) dev_meetings = mongo.db.meeting_collection.find() - return render_template('dev.html',dev_meetings=dev_meetings) + return render_template('dev_meetings.html',dev_meetings=dev_meetings) @bp.route('/meetings/dev',methods=["GET"]) @login_required def allMeetings(): dev_meetings = mongo.db.meeting_collection.find({}) - return render_template('dev.html',dev_meetings=dev_meetings) + return render_template('dev_meetings.html',dev_meetings=dev_meetings) ### END DEV ROUTES ### @@ -111,7 +111,7 @@ def meetings(): @bp.route('/meetings/past',methods=["GET"]) @login_required -def past(): +def past_meetings(): allOldMeetings = True pastMeetings = mongo.db.meeting_collection.aggregate( [ { @@ -135,7 +135,7 @@ def meeting(meeting_id): @bp.route('/meeting/new',methods=["GET","POST"]) @login_required -def new(): +def new_meeting(): form = NewMeeting() if form.validate_on_submit(): m_id = hashlib.sha256(os.urandom(16)).hexdigest() @@ -154,11 +154,11 @@ def new(): # if form.name.data != "": # new_meeting['meeting_name']=form.name.data - return render_template('new.html',form=form) + return render_template('new_meeting.html',form=form) @bp.route('/meeting/<meeting_id>/upload',methods=["GET","POST"]) @login_required -def upload(meeting_id): +def upload_meeting_document(meeting_id): try: meeting = fetch_meeting(meeting_id) except MeetingNotFoundError as e: @@ -169,22 +169,22 @@ def upload(meeting_id): if form.validate_on_submit(): flash("submitted") mongo.db.meeting_collection.update_one({'_id':meeting['_id']},{'$push':{'documents':'brennen'}}) - return redirect(url_for('meetings.upload',meeting_id=meeting['meeting_id'])) - return render_template('upload.html',meeting=meeting,form=form,upload=upload) + return redirect(url_for('meetings.upload_meeting_document',meeting_id=meeting['meeting_id'])) + return render_template('upload_meeting_document.html',meeting=meeting,form=form,upload=upload) @bp.route('/meeting/<meeting_id>/update',methods=["GET","POST"]) @login_required -def update(meeting_id): +def update_meeting(meeting_id): try: meeting = fetch_meeting(meeting_id) except MeetingNotFoundError as e: return render_template('error.html',error=e) else: - return render_template('update.html',meeting=meeting) + return render_template('update_meeting.html',meeting=meeting) @bp.route('/meeting/<meeting_id>/<update>',methods=["GET","POST"]) @login_required -def change(meeting_id,update): +def change_meeting(meeting_id,update): form = UpdateMeeting() try: meeting = fetch_meeting(meeting_id) @@ -196,25 +196,25 @@ def change(meeting_id,update): timestamp = datetime.datetime.combine(form.date.data,meeting['timestamp'].time()) mongo.db.meeting_collection.update_one({'meeting_id':meeting['meeting_id']},{'$set':{'timestamp':timestamp}}) flash("Updated Date from {} to {}".format(meeting['timestamp'],timestamp)) - return redirect(url_for('meetings.update',meeting_id=meeting['meeting_id'])) + return redirect(url_for('meetings.update_meeting',meeting_id=meeting['meeting_id'])) if update == "time": timestamp = datetime.datetime.combine(meeting['timestamp'].date(),form.time.data) mongo.db.meeting_collection.update_one({'meeting_id':meeting['meeting_id']},{'$set':{'timestamp':timestamp}}) flash("Updated Time from {} to {}".format(meeting['timestamp'],timestamp)) - return redirect(url_for('meetings.update',meeting_id=meeting['meeting_id'])) + return redirect(url_for('meetings.update_meeting',meeting_id=meeting['meeting_id'])) if update == "location": mongo.db.meeting_collection.update_one({'meeting_id':meeting['meeting_id']},{'$set':{'location':form.location.data}}) flash("Updated location from {} to {}".format(meeting['location'],form.location.data)) - return redirect(url_for('meetings.update',meeting_id=meeting['meeting_id'])) + return redirect(url_for('meetings.update_meeting',meeting_id=meeting['meeting_id'])) if update == "description": mongo.db.meeting_collection.update_one({'meeting_id':meeting['meeting_id']},{'$set':{'meeting_description':form.meeting_description.data}}) flash("Updated description to {}".format(form.meeting_description.data)) - return redirect(url_for('meetings.update',meeting_id=meeting['meeting_id'])) - return render_template('form.html',meeting=meeting,update=update,form=form) + return redirect(url_for('meetings.update_meeting',meeting_id=meeting['meeting_id'])) + return render_template('form_meetings.html',meeting=meeting,update=update,form=form) @bp.route('/meeting/<meeting_id>/remove',methods=["GET","POST"]) @login_required -def remove(meeting_id): +def remove_meeting(meeting_id): try: meeting = fetch_meeting(meeting_id) except MeetingNotFoundError as e: diff --git a/app/meetings/templates/dev.html b/app/meetings/templates/dev_meetings.html diff --git a/app/meetings/templates/form.html b/app/meetings/templates/form_meetings.html diff --git a/app/meetings/templates/meeting.html b/app/meetings/templates/meeting.html @@ -9,7 +9,7 @@ <h2 style="color:red;align:left">{{ meeting.timestamp.date() }}</h2><h3 style="align:right">{{ meeting.timestamp.time().isoformat(timespec='minutes') }}</h3> <a href="{{ meeting.location }}">@ {{ meeting.location }}</a> <div><p>{{ meeting.meeting_description }}</p></div> - <div><h4 href="color:red">Documents:</h4><a href="{{ url_for('meetings.upload',meeting_id=meeting['meeting_id']) }}">[upload]</a></div> + <div><h4 href="color:red">Documents:</h4><a href="{{ url_for('meetings.upload_meeting_document',meeting_id=meeting['meeting_id']) }}">[upload]</a></div> {% if meeting.documents %} {% for document in meeting['documents'] %} <div> @@ -17,7 +17,7 @@ </div> {% endfor %} {% endif %} - <a class="action-button" href="{{ url_for('meetings.update',meeting_id=meeting['meeting_id']) }}">modify</a> + <a class="action-button" href="{{ url_for('meetings.update_meeting',meeting_id=meeting['meeting_id']) }}">modify</a> </section> {% endif %} {% endblock %} diff --git a/app/meetings/templates/meetings.html b/app/meetings/templates/meetings.html @@ -40,10 +40,10 @@ <a href="{{ url_for('meetings.meeting',meeting_id=meeting['meeting_id']) }}"><div>{{ meeting.timestamp.date().isoformat() }} @ {{ meeting.timestamp.time().isoformat(timespec='minutes') }}</div>{% if allOldMeetings %}<div>{{meeting['meeting_description']}}</div>{% endif %}</a> </div> {%- endfor %} - {% if not allOldMeetings %}<a href="{{ url_for('meetings.past') }}"class="action-button">View older meetings</a>{% endif %} + {% if not allOldMeetings %}<a href="{{ url_for('meetings.past_meetings') }}"class="action-button">View older meetings</a>{% endif %} {% if allOldMeetings %}<a href="{{ url_for('meetings.meetings') }}"class="action-button">Back to meetings</a>{% endif %} </section> {% endif %} - <a href="{{ url_for('meetings.new') }}" class="action-button">Schedule Meeting</a> + <a href="{{ url_for('meetings.new_meeting') }}" class="action-button">Schedule Meeting</a> </section> {% endblock %} diff --git a/app/meetings/templates/new.html b/app/meetings/templates/new_meeting.html diff --git a/app/meetings/templates/update.html b/app/meetings/templates/update.html @@ -1,32 +0,0 @@ -{% extends 'base.html' %} - -{% block title %}{{ meeting.date }}Update Meeting{% endblock %} - -{% block content %} - {% with messages = get_flashed_messages() %} - {% if messages %} - {% for message in messages %} - <div id="messagebanner"><p>{{ message }}</p></div> - {% endfor %} - {% endif %} - {% endwith %} - {% if meeting %} - <section class="meeting"> - <a href="{{ url_for('meetings.meeting',meeting_id=meeting['meeting_id']) }}">back to meeting</a> - <div style="display:flex"><h2>Date: {{ meeting.timestamp.date() }}</h2><a href="{{url_for('meetings.change',meeting_id=meeting["meeting_id"],update="date")}}"style="color:red">change</a></div> - <div style="display:flex"><h3>Time: {{ meeting.timestamp.time().isoformat(timespec="minutes") }}</h3><a href="{{url_for('meetings.change',meeting_id=meeting['meeting_id'],update="time")}}"style="color:red">change</a></div> - <div style="display:flex"><h3>Location link: {{ meeting.location }}</h3><a href="{{url_for('meetings.change',meeting_id=meeting['meeting_id'],update="location")}}"style="color:red">change</a></div> - <div style="display:flex"><h3>Description: {{ meeting.meeting_destription }}</h3><a href="{{url_for('meetings.change',meeting_id=meeting['meeting_id'],update="description")}}"style="color:red">change</a></div> - <div style="display:flex"><h4 href="color:red">Documents:</h4><a href="{{ url_for('meetings.upload',meeting_id=meeting['meeting_id']) }}" style="color:red">[upload]</a></div> - {% if meeting.document %} - {% for document in meeting.document %} - <div> - <a href="">{{ document }}</a><a href=""style="color:red">remove</a> - </div> - {% endfor %} - {% endif %} - <a href="{{ url_for('meetings.meeting',meeting_id=meeting['meeting_id']) }}">back to meeting</a> - <a href="{{ url_for('meetings.remove',meeting_id=meeting['meeting_id']) }}">remove meeting</a> - </section> - {% endif %} -{% endblock %} diff --git a/app/meetings/templates/update_meeting.html b/app/meetings/templates/update_meeting.html @@ -0,0 +1,32 @@ +{% extends 'base.html' %} + +{% block title %}{{ meeting.date }}Update Meeting{% endblock %} + +{% block content %} + {% with messages = get_flashed_messages() %} + {% if messages %} + {% for message in messages %} + <div id="messagebanner"><p>{{ message }}</p></div> + {% endfor %} + {% endif %} + {% endwith %} + {% if meeting %} + <section class="meeting"> + <a href="{{ url_for('meetings.meeting',meeting_id=meeting['meeting_id']) }}">back to meeting</a> + <div style="display:flex"><h2>Date: {{ meeting.timestamp.date() }}</h2><a href="{{url_for('meetings.change_meeting',meeting_id=meeting["meeting_id"],update="date")}}"style="color:red">change</a></div> + <div style="display:flex"><h3>Time: {{ meeting.timestamp.time().isoformat(timespec="minutes") }}</h3><a href="{{url_for('meetings.change_meeting',meeting_id=meeting['meeting_id'],update="time")}}"style="color:red">change</a></div> + <div style="display:flex"><h3>Location link: {{ meeting.location }}</h3><a href="{{url_for('meetings.change_meeting',meeting_id=meeting['meeting_id'],update="location")}}"style="color:red">change</a></div> + <div style="display:flex"><h3>Description: {{ meeting.meeting_destription }}</h3><a href="{{url_for('meetings.change_meeting',meeting_id=meeting['meeting_id'],update="description")}}"style="color:red">change</a></div> + <div style="display:flex"><h4 href="color:red">Documents:</h4><a href="{{ url_for('meetings.upload_meeting_document',meeting_id=meeting['meeting_id']) }}" style="color:red">[upload]</a></div> + {% if meeting.document %} + {% for document in meeting.document %} + <div> + <a href="">{{ document }}</a><a href=""style="color:red">remove</a> + </div> + {% endfor %} + {% endif %} + <a href="{{ url_for('meetings.meeting',meeting_id=meeting['meeting_id']) }}">back to meeting</a> + <a href="{{ url_for('meetings.remove_meeting',meeting_id=meeting['meeting_id']) }}">remove meeting</a> + </section> + {% endif %} +{% endblock %} diff --git a/app/meetings/templates/upload.html b/app/meetings/templates/upload_meeting_document.html diff --git a/app/templates/dashboard/punchclock/otheruser.html b/app/templates/dashboard/punchclock/otheruser.html @@ -3,6 +3,14 @@ {% block title %}Clock In User{% endblock %} {% block content %} +{% with messages = get_flashed_messages() %} +{% if messages %} + {% for message in messages %} + <div id="messagebanner"><p>{{ message }}</p></div> + {% endfor %} +{% endif %} +{% endwith %} + <section class="hours-grid"> <h1 id="clock"></h1> <form action="" method="POST" novalidate>