Files
HRM-System/docs/PLAN-hide-payroll-frequency.md

27 lines
1.7 KiB
Markdown

# Hide Payroll Frequency from UI
## Problem Context
The user requested to hide or remove the "Payroll Frequency" dropdown from the `/hr/payroll-runs` interface. Since different employees have different pay types (e.g., Daily, Monthly, Semi-Monthly) in the same run, having a single frequency field on the Payroll Run level is confusing and implies a conflict.
## Goal
Remove the `payroll_frequency` selection from the user interface and handle it automatically on the backend to prevent user confusion.
## Proposed Changes
### Frontend (React/Inertia)
#### [MODIFY] `resources/js/Pages/hr/payroll-runs/index.tsx`
- **Action:** Remove the `payroll_frequency` `Select` field from the Create Payroll Run modal.
- **Action:** Remove the `payroll_frequency` `Select` field from the Edit Payroll Run modal.
- **Action:** Remove the "Payroll Frequency" column from the main data table view (if it exists).
### Backend (Laravel)
#### [MODIFY] `app/Http/Controllers/PayrollRunController.php`
- **Action:** Update the `store` and `update` methods.
- **Action:** Remove `payroll_frequency` from the `$request->validate()` rules.
- **Action:** Dynamically inject a default `payroll_frequency = 'semi-monthly'` into the payload before creating or updating the `PayrollRun` model. Alternatively, dynamically calculate the frequency based on the days difference between `pay_period_start` and `pay_period_end`.
- **Action:** Remove `payroll_frequency` from the `export` CSV mapping and `fileImport` mapping to ensure consistency.
## Verification
- Generate a new payroll run via the UI and confirm the frequency dropdown is completely gone.
- Verify that validation still passes and the database record is created successfully with the default/calculated frequency.