2.2 KiB
2.2 KiB
PLAN: Shift Scheduling System
Enable dynamic shift assignment and scheduling directly from the Shift Calendar matrix.
1. Context & Objectives
The user wants to manage employee schedules from hr/shifts/calendar.
- "Assigning" a shift creates or updates an
AttendanceRecordas a scheduling placeholder. - Supports bulk assignment across a date range.
- Includes a Rest Day toggle.
- Allows choosing from Active Shifts.
2. Technical Strategy
Backend
- Endpoint: Implement
POST /hr/shifts/assigninShiftController. - Logic: Use
CarbonPeriodto iterate through dates andupdateOrCreateonAttendanceRecord.
Frontend
- Enhancement: Convert matrix cells into clickable triggers.
- Component: Integrate
CrudFormModalfor the scheduling form. - Data: The
calendarview must now provide a list of all activeavailable_shiftsfor the dropdown.
3. Task Breakdown
Phase 1: Backend Scaffolding
- Add
all_shiftsto the data returned byShiftController@calendar. - Implement
assignShiftmethod:- Validate:
employee_id,start_date,end_date,shift_id,is_rest_day. - Iteration logic for date ranges.
AttendanceRecord::updateOrCreateimplementation.
- Validate:
Phase 2: Frontend Interactivity
- Add Modal state transitions to
resources/js/pages/hr/shifts/calendar.tsx. - Implement
handleCellClickto pre-populate the assignment form. - Add
cursor-pointerand hover styles to the grid badges.
Phase 3: Scheduling Modal
- Configure
CrudFormModalwith:- Date Range (Start/End).
- Shift Switcher (Dropdown).
- Rest Day Toggle.
- Implement
handleFormSubmitand handle validation errors.
Phase 4: Verification
- Test assigning a shift to a 7-day range.
- Test marking a day as a Rest Day and verify it shows as
RD. - Verify that assigned shifts appear in the grid after a successful update.
4. Agent Assignments
| Agent | Task |
|---|---|
| Backend Specialist | Range assignment logic & Controller updates |
| Frontend Specialist | Calendar modal & Range selection UI |
| Quality Assurance | Gap verification between attendance & shifts |