Files
HRM-System/docs/PLAN-sync-attendance-records.md

2.5 KiB

PLAN: Sync to Attendance Records Overhaul

Target Files:

  • resources/js/pages/hr/biometric-attendance/index.tsx (Dashboard UI update)
  • app/Http/Controllers/BiometricAttendanceController.php (Verify bulk sync route & permission rules)

Goal

Overhaul the biometric sync UX by:

  1. Renaming the bulk action button to "Sync to Attendance Records".
  2. Adding a confirmation modal that appears before executing the bulk sync, allowing the user to confirm the sync and toggle the "Overwrite" option.
  3. Removing the individual row "Sync" action in the table, leaving only the "Details" action.

Tasks

Phase 1: Frontend Table Actions Cleanup

  • Remove individual row Sync action:
    • In resources/js/pages/hr/biometric-attendance/index.tsx, locate the actions array.
    • Delete the Sync action object so only the Details action remains.
    • Delete the unused handleSync function.

Phase 2: Bulk Sync Confirmation Modal

  • Implement Confirmation Dialog:
    • Add state variables isConfirmOpen (boolean) and overwrite (boolean) inside BiometricAttendance.
    • Create a custom modal/dialog inside the index template that opens when clicking "Sync to Attendance Records".
    • The dialog must display:
      • Title: "Sync to Attendance Records"
      • Warning message: "This will process all pending biometric logs and write them to the final attendance sheets."
      • Checkbox option: "Overwrite existing attendance records (Biometrics as source of truth)"
      • Buttons: "Cancel" (closes modal) and "Proceed Sync" (triggers POST request).
  • Update Button layout:
    • Rename the primary button text from "Pull Data & Sync" to "Sync to Attendance Records".
    • Remove the inline checkbox from the main header and place it strictly inside the confirmation modal.

Phase 3: Route & Request Payload Validation

  • Test the Inertia submission:
    • Verify that clicking "Proceed Sync" inside the modal correctly triggers the POST request to route('hr.biometric-attendance.sync-all') with the { overwrite } payload, then closes the modal on success.

Verification Checklist

  • UI Audit: Verify the button is named "Sync to Attendance Records".
  • Table Actions Audit: Check that the individual "Sync" button is gone from the table rows.
  • Confirmation Dialog Verification: Click the button, confirm the modal pops up, toggle "Overwrite", and verify the sync completes successfully when clicking "Proceed".