diff --git a/app.py b/app.py index 9aa1fe1..a7d7bce 100644 --- a/app.py +++ b/app.py @@ -5820,12 +5820,6 @@ def edit_employee(employee_index): last_name = request.form['last_name'].strip() title = request.form.get('title', '').strip() contract_id = request.form.get('contract_id', '1').strip() - stats = { - 'total_employees': 0, - 'employees_with_title': 0, - 'unique_titles': 0, - 'search_results': 0 - } # Validate required fields if not all([employee_id, first_name, last_name]): @@ -5844,7 +5838,7 @@ def edit_employee(employee_index): existing_employee = Employee.query.filter_by(id=employee_id_int).first() if existing_employee and existing_employee.index != employee.index: flash(f'Employee with ID {employee_id} already exists.', 'error') - return render_template('edit_employee.html', employee=employee, stats=stats) + return render_template('edit_employee.html', employee=employee) # Store original values for logging original_data = { @@ -5868,7 +5862,7 @@ def edit_employee(employee_index): try: logger_handler.logger.info(f"Admin user {session['username']} updated employee: {employee_index} - {first_name} {last_name}") except Exception as log_error: - print(f"⚠️ Logging error (non-critical): {log_error}") + print(f"Warning: Logging error (non-critical): {log_error}") flash(f'Employee "{first_name} {last_name}" updated successfully.', 'success') return redirect(url_for('employees')) diff --git a/templates/edit_employee.html b/templates/edit_employee.html index 685a9de..a8e6d27 100644 --- a/templates/edit_employee.html +++ b/templates/edit_employee.html @@ -1,374 +1,430 @@ -{% extends "base_authenticated.html" %} -{% set page_title = "Employee Management" %} +{% extends "base_authenticated.html" %} {% set page_title = "Edit Employee" %} +{% block title %}{{ page_title }}{% endblock %} {% block extra_head %} + + +{% endblock %} {% block content %}
- -

Employee Management

+ +

Edit Employee

- Manage employee records and view attendance statistics + Update employee information in the system

- -
- {% if session.user_role == 'admin' %} - - - Add Employee - - {% endif %} -
- -
-
-
- -
-
-

{{ stats.total_employees }}

-

Total Employees

-
-
- -
-
- -
-
-

{{ stats.employees_with_title }}

-

With Job Titles

-
-
- -
-
- -
-
-

{{ stats.unique_titles }}

-

Unique Job Titles

-
-
- - {% if search %} -
-
- -
-
-

{{ stats.search_results }}

-

Search Results

-
-
- {% endif %} -
- - -
-
-
- - - {% if search %} - - - - {% endif %} -
-
-
- - -
-
+ +
+

- {% if search %} - Search Results for "{{ search }}" - {% else %} - All Employees - {% endif %} + + Employee Information

-
- Showing {{ employees.items|length }} of {{ employees.total }} employees - {% if employees.pages > 1 %} - (Page {{ employees.page }} of {{ employees.pages }}) - {% endif %} + +
+

+ + Current Employee +

+

{{ employee.full_name }} (ID: {{ employee.id }})

-
- - - - - - - - - - - - - {% for employee in employees.items %} - - - - - - - - - - - - - - {% endfor %} - -
#Employee IDNameJob TitleContract IDActions
{{ loop.index + (employees.page - 1) * employees.per_page }} - {{ employee.id }} - -
-
- -
-
-

{{ employee.full_name }}

-

{{ employee.firstName }} {{ employee.lastName }}

-
-
-
- {% if employee.title %} - {{ employee.title }} - {% else %} - No Title - {% endif %} - - {{ employee.contractId }} - -
- - - - - {% if session.user_role == 'admin' %} - - - - - - {% endif %} -
-
-
+
+
+ +
+
+ + +
Must be a unique numeric identifier
+
- - {% if employees.pages > 1 %} -
- -
- {% endif %} +
+ + +
Default is 1 if not specified
+
+
- - {% if employees.total == 0 %} -
-
- -
-

- {% if search %} - No employees found for "{{ search }}" - {% else %} - No employees found - {% endif %} -

-

- {% if search %} - Try adjusting your search terms or view all employees. - {% else %} - Get started by adding your first employee. - {% endif %} -

-
- {% endif %} -
-
+ +
+
+ + +
- -
-{% endblock %} - -{% block extra_scripts %} +{% endblock %} {% block extra_scripts %} -{% endblock %} \ No newline at end of file +{% endblock %}