From a2fbe9d49212c6a372c683db52fcf06627791815 Mon Sep 17 00:00:00 2001 From: A R R R Associates Date: Sun, 5 Jul 2026 20:50:50 +0530 Subject: [PATCH] Enhance employee portal with staff attendance overview --- .../templates/employees/portal_dashboard.html | 188 +++++++++++++++++- app/modules/employees/ui.py | 5 +- 2 files changed, 190 insertions(+), 3 deletions(-) diff --git a/app/modules/employees/templates/employees/portal_dashboard.html b/app/modules/employees/templates/employees/portal_dashboard.html index e8dc342..e539b0a 100644 --- a/app/modules/employees/templates/employees/portal_dashboard.html +++ b/app/modules/employees/templates/employees/portal_dashboard.html @@ -109,9 +109,66 @@

Today’s Attendance

-

{% if today_attendance %}Punch In: {{ today_attendance.punch_in_utc.strftime('%H:%M') if today_attendance.punch_in_utc else '-' }} · Punch Out: {{ today_attendance.punch_out_utc.strftime('%H:%M') if today_attendance.punch_out_utc else '-' }}{% else %}Attendance not marked for today.{% endif %}

+

+ {% if today_attendance %} + Punch In: {{ today_attendance.punch_in_local_at.strftime('%H:%M') if today_attendance.punch_in_local_at else (today_attendance.punch_in_utc.strftime('%H:%M UTC') if today_attendance.punch_in_utc else '-') }} · + Punch Out: {{ today_attendance.punch_out_local_at.strftime('%H:%M') if today_attendance.punch_out_local_at else (today_attendance.punch_out_utc.strftime('%H:%M UTC') if today_attendance.punch_out_utc else '-') }} + {% else %} + Attendance not marked for today. + {% endif %} +

+
+ Details +
+ +
+ Click Punch In/Punch Out. The app will ask you to allow location before submitting attendance. +
+ +
+
+ + + + + + + +
+ +
+ + + + + + + +
+
+ +
+
+

Recent Attendance

+ View all +
+
+ {% for row in attendance_rows or [] %} +
+
+ {{ row.attendance_date }} + {{ (row.status or '-').replace('_',' ').title() }} +
+
+ In: {{ row.punch_in_local_at.strftime('%H:%M') if row.punch_in_local_at else (row.punch_in_utc.strftime('%H:%M UTC') if row.punch_in_utc else '-') }} · + Out: {{ row.punch_out_local_at.strftime('%H:%M') if row.punch_out_local_at else (row.punch_out_utc.strftime('%H:%M UTC') if row.punch_out_utc else '-') }} · + Duration: {{ (row.work_duration_minutes ~ ' min') if row.work_duration_minutes else '-' }} +
+
+ {% else %} +
No recent attendance records found.
+ {% endfor %}
- Open
@@ -145,4 +202,131 @@

Your login is not linked to an employee master

Submit an employee link request or ask Firm Admin/Partner/Branch Manager to link your user account from Employee Master.

Request Employee Link
{% endif %} + + + + + {% endblock %} diff --git a/app/modules/employees/ui.py b/app/modules/employees/ui.py index 6cd840d..d041382 100644 --- a/app/modules/employees/ui.py +++ b/app/modules/employees/ui.py @@ -1,4 +1,4 @@ -from __future__ import annotations +from __future__ import annotations from pathlib import Path from io import BytesIO @@ -2498,6 +2498,7 @@ def employee_portal_dashboard(request: Request): employee=employee, pending_request=pending_request, today_attendance=get_today_attendance_for_user(db, current_user), + attendance_rows=list_own_attendance(db, current_user)[:7], leave_balances=list_own_leave_balances(db, current_user), leave_requests=list_own_leave_requests(db, current_user)[:5], offboarding_requests=list_own_offboarding_requests(db, current_user)[:5], @@ -2530,6 +2531,7 @@ def employee_self_attendance(request: Request): employee=employee, rows=rows, today_attendance=get_today_attendance_for_user(db, current_user), + attendance_rows=list_own_attendance(db, current_user)[:7], errors=[], ) finally: @@ -2884,3 +2886,4 @@ async def employee_registration_submit(request: Request): ) finally: db.close() +