diff --git a/app.py b/app.py index ea60c62..f1fe968 100644 --- a/app.py +++ b/app.py @@ -1,4 +1,5 @@ -from flask import Flask, request, render_template +from flask import Flask, request, render_template, session +from datetime import datetime import os from flask_sqlalchemy import SQLAlchemy @@ -31,6 +32,9 @@ def home(): @app.route('/assign-rights', methods=['POST']) def assign_rights(): + user = request.form.get('user') # Get the user from the form + timestamp = datetime.now() # Get the current timestamp + for person in ITPersonnel.query.all(): last_name = person.Last_Name privileges = request.form.get(f'privileges_{last_name}') @@ -40,6 +44,8 @@ def assign_rights(): person.Remarks = remarks db.session.commit() + print(f'Form submitted by {user} at {timestamp}') # Print the user and timestamp + return 'Rights assigned successfully' if __name__ == '__main__': diff --git a/templates/index.html b/templates/index.html index 6074ed1..c645da2 100644 --- a/templates/index.html +++ b/templates/index.html @@ -4,104 +4,119 @@ Assign Rights -
- Logo -

Texas Pipe & Supply IT Department SQL Server Personnel Right Assignments

+ +
+ Logo +

Texas Pipe & Supply IT Department SQL Server Personnel Right Assignments

+
+
+
+ + + + + + + + + + + + + + + + {% for person in personnel %} + + + + + + + + + + {% endfor %} + +
#Last NameFirst NamePositionEmailDatabase PrivilegesRemarks
{{ loop.index }}{{ person.Last_Name }}{{ person.First_Name }}{{ person.Position }}{{ person.Email }} + + + + +
+ +
+
+ + + + \ No newline at end of file