1.9 KiB
1.9 KiB
Add Semi-Monthly to Payroll Runs
Analysis & Context
The user discovered that they cannot select "Semi-Monthly" when generating a new Payroll Run in the hr/payroll-runs page.
Root cause analysis reveals that:
- The MySQL database table
payroll_runsrigidly defines thepayroll_frequencycolumn as anENUM('weekly', 'biweekly', 'monthly'). - The
PayrollRunController.phpheavily restricts the validation rules to strictly acceptin:weekly,biweekly,monthly. - The React frontend (
resources/js/Pages/hr/payroll-runs/index.tsx) hardcodes the Select dropdown items precisely to this list.
Proposed Changes
This will be a full-stack update specifically touching:
-
Database Migration
- Create a new migration file:
add_semi_monthly_to_payroll_frequency_enum.php. - Execute a raw database statement:
ALTER TABLE payroll_runs MODIFY COLUMN payroll_frequency ENUM('weekly', 'biweekly', 'semi-monthly', 'monthly') NOT NULL DEFAULT 'monthly';
- Create a new migration file:
-
Backend Controller
- File:
app/Http/Controllers/PayrollRunController.php - Modify the
$request->validate()rules inside thestoreandupdatemethods to natively acceptsemi-monthly. - Update the expected payload in the bulk CSV import logic if applicable.
- File:
-
Frontend React Component
- File:
resources/js/Pages/hr/payroll-runs/index.tsx - Modify the
CreateandEditfrontend modals to formally include{ label: 'Semi-Monthly', value: 'semi-monthly' }inside the Dropdown form payload.
- File:
Open Questions
- Do you want previous payroll runs that were wrongly filed as
biweeklyormonthlymigrated historically tosemi-monthlyas part of this operation, or just apply this capability moving forward?
Verification Plan
- Ensure the migration runs safely without dropping existing column data.
- Compile Vite.
- Test creating a sample Payroll Run using the new
Semi-Monthlydropdown and verify the DB accepts it!