Files
HRM-System/docs/PLAN-attendance-save-fix.md
2026-04-23 10:15:50 +08:00

1.4 KiB

PLAN: Fix Attendance Save Issues

This plan addresses the issue where clock_out (and clock_in) sometimes fails to persist when updating attendance records through the calendar interface.

User Review Required

Important

We will be loosening the backend validation for time fields. Instead of strictly requiring H:i (hours and minutes), we will allow H:i:s (hours, minutes, and seconds) to accommodate various browser behaviors with HTML5 time inputs.

Proposed Changes

Backend Specialists

[MODIFY] AttendanceRecordController.php

  • Change: Update validation rules in both store and update methods.
  • Details: Change date_format:H:i to a regex or multi-format check that allows both H:i and H:i:s.
  • Rationale: Standard HTML type="time" inputs may send seconds depending on the browser. Strict validation causes non-obvious failures.

Frontend Specialists

[MODIFY] calendar.tsx

  • Change: Ensure clock_in and clock_out are sent cleanly.
  • Details: Add more descriptive error handling if validation fails.

Verification Plan

Manual Verification

  • Update an attendance record with a specific time.
  • Verify that the grid updates and the database persists the new clock_out.
  • Test overnight shifts (cross-midnight).