Files
kulakpos_web/walkthroughs/2026-05-12_78275e7a_Walkthrough__Overtime_Delegation_Implementation.md

43 lines
2.2 KiB
Markdown
Raw Permalink Normal View History

2026-05-14 11:55:22 +07:00
# Walkthrough - Overtime Delegation Implementation
I have implemented the Overtime Delegation feature, providing a full workflow for delegates to approve and execute overtime tasks assigned to them.
## Backend Changes
### Services and Logic
In `delegation-overtime-services.js`, I added the following functions:
- **`approveOvertimeDelegation`**: Handles delegate approval by saving their signature and updating the status to 2.
- **`updateActualIn`**: Records the actual start time and location (with radius validation) when the delegate starts the overtime.
- **`updateActualOut`**: Records the actual end time and location, and updates the status to 3 (Pending HR Staff Approval).
- **`getOvertimeDelegationHistoryEmployee`**: Enhanced to return all fields needed for the execution flow (signatures, actual times, etc.) and filter by statuses 1 through 6.
### API Routes
In `delegation-routes.js`, I registered the following endpoints:
- `POST /api/delegations/overtime/history/employeedelegate`
- `POST /api/delegations/overtime/approve`
- `POST /api/delegations/overtime/update-actual-in`
- `POST /api/delegations/overtime/update-actual-out`
## Frontend Changes
### New Screen
Created **`ListOvertimeDelegation.js`** in `screens/lembur_comp/`. This screen is based on the Attendance Delegation benchmark and includes:
- Date filtering for history.
- Status badges for easy tracking.
- **Approve Action**: Signature capture for delegates.
- **Execute In/Out Actions**: GPS location capture and radius validation.
- Details display including duration, planned times, and actual times.
### Navigation and UI Integration
- **`screens/index.js`**: Exported the new screen.
- **`App.js`**: Registered the `OVERTIME DELEGATION` route.
- **`Home.js`**: Added the "Overtime Delegate" menu item to the Employee Menus grid.
## Verification Results
- **Backend**: API endpoints are registered and logic follows the established pattern for attendance delegations.
- **Frontend**: The menu is visible on the Home screen and correctly navigates to the delegation list.
> [!NOTE]
> The "Overtime Delegate" menu item uses ID `21` for the module check. Ensure this ID is correctly configured in your master modules table if you want to control its visibility via the backend.