Files
HRM-System/docs/PLAN-gps-warning-modal.md

2.2 KiB

Plan: Relax Geofencing Block to Warning Modal

Objective

Currently, the biometric attendance system enforces a strict GPS geofence, completely preventing employees from clocking in if they are outside their assigned branch radius. The goal of this task is to relax this restriction. If an employee is outside the radius, they should still be allowed to clock in, but they must first be presented with a modal warning them that they are clocking in off-site.

Scope

  • Modify the frontend attendance checking logic to remove the hard block for out-of-radius clock-ins.
  • Introduce a confirmation modal when the calculated distance exceeds the allowed branch radius.
  • Send the out-of-radius status to the backend (if not already being saved) so HR knows the clock-in was off-site.

Task Breakdown

Phase 1: Frontend Logic Modification

  • Locate the Geofence Validation Logic: Identify where the distance calculation is made and where the clock-in is currently being blocked (likely in view.tsx).
  • Implement State for Warning Modal: Add state variables to control the visibility of the out-of-radius warning modal.
  • Update the Clock-In Flow:
    • Calculate distance.
    • If within radius, proceed with clock-in directly.
    • If outside radius, set state to open the warning modal.

Phase 2: UI Implementation

  • Create Warning Modal:
    • Title: "Out of Branch Radius"
    • Body: Warn the user that they are currently detected outside their assigned branch radius. Do they wish to proceed with the off-site clock-in?
    • Buttons: "Cancel" (abort) and "Proceed Anyway" (submit).
  • Integrate Modal: Render the modal in the main biometric attendance view based on the state.

Phase 3: Backend Verification

  • Check Backend Validation: Ensure the backend endpoint that processes the clock-in does not have a hard-coded rejection for off-site clock-ins.

Agent Assignments

  • frontend-specialist: Handle the React/TSX modifications.
  • backend-specialist: Review the backend controller.

Verification Checklist

  • User within radius can clock in seamlessly.
  • User outside radius triggers the warning modal.
  • Clicking "Cancel" on the modal aborts the process.
  • Clicking "Proceed Anyway" successfully registers the clock-in.