Screens / Payroll
Payroll
Needs `payroll.manage` (the owner's; PAN-65, PAN-70, PAN-72, PAN-76, PAN-80, PAN-83). Tabs: Shifts, Pay runs, Employees, and on desktop Settings. Shifts: one week at a time (Monday to Sunday, no future weeks) with active employees plus inactive ones who have shifts that week, hours and estimated pay for hourly staff; open shifts show Open with End shift, and a week covered by a paid run reads as paid with View run. Log shift and the edit sheet check future times, a paid day and an overlap with that employee's shifts before saving. A shift with locked_reason payroll shows a lock and offers no edit or delete. Employees: Add employee and Edit (PAN-76: name, pay type and rate, role, dates), and Deactivate after a confirm. Pay runs: newest first. New pay run (Last week, This week, This month or custom dates; refused in the app when a run already covers part of the dates) shows the estimate the server returns from POST /v1/payroll-runs/preview and the open_shifts_count (PAN-80, PAN-83); the run is created with period_start, period_end and an optional frequency. A draft run can be deleted (PAN-72) after a confirm. Run detail lists each employee's hours, days worked, gross, deductions and net. Mark paid asks for Paid on (today by default, never in the future, not before the period starts) and adds the payroll expense. The payroll settings (salary proration, work days, standard hours per day, frequency) have their own page at /payroll/settings on a phone.
- App routes
/payroll- Access
- payroll.manage
- Screen code
lib/screens/payroll/payroll_page.dartlib/screens/payroll/payroll_controller.dartlib/screens/payroll/payroll_bindings.dartlib/screens/payroll/payroll_copy.dartlib/screens/payroll/payroll_drafts.dartlib/screens/payroll/widgets/shifts_table.dartlib/screens/payroll/widgets/employee_shifts_card.dartlib/screens/payroll/widgets/edit_shift_sheet.dartlib/screens/payroll/widgets/delete_shift_dialog.dartlib/screens/payroll/widgets/paid_week_banner.dartlib/screens/payroll/widgets/runs_list.dartlib/screens/payroll/widgets/run_detail.dartlib/screens/payroll/widgets/new_run_sheet.dartlib/screens/payroll/widgets/mark_paid_sheet.dartlib/screens/payroll/widgets/employees_list.dartlib/domain/payroll/payroll_rules.dartlib/domain/payroll/payroll_models.dartlib/data/repositories/payroll_repository.dartlib/core/navigation/nav_catalog.dartlib/screens/payroll/widgets/employee_sheet.dartlib/screens/payroll/widgets/deactivate_employee_dialog.dartlib/screens/payroll/widgets/delete_run_dialog.dartlib/screens/payroll/widgets/payroll_settings_form.dartlib/screens/payroll/widgets/log_shift_page.dart- Source
- elmermj/panly-app @ pre-staging-test (72aaffd)
API calls (15)
| Call | Why the screen makes it | Where in the app code |
|---|---|---|
GET /v1/employeesList employees |
Every page (limit 100) on open, pull-to-refresh, Retry and coming back to the tab: name, pay type, rate, is_active, hired_on and role | lib/screens/payroll/payroll_controller.dart:160lib/domain/usecases/payroll/payroll_usecase.dart:13lib/data/repositories/payroll_repository.dart:17lib/data/repositories/payroll_repository.dart:134 |
POST /v1/employeesCreate employee |
Add employee (PAN-76). Not idempotent: never retried by the app itself | lib/screens/payroll/payroll_controller.dart:406lib/domain/usecases/payroll/payroll_usecase.dart:15lib/data/repositories/payroll_repository.dart:23 |
PATCH /v1/employees/{employeeId}Update employee |
Edit employee, and Deactivate or Reactivate (is_active): the pay fields always, role, dates and is_active only when they changed | lib/screens/payroll/payroll_controller.dart:407lib/screens/payroll/payroll_controller.dart:429lib/domain/usecases/payroll/payroll_usecase.dart:19lib/data/repositories/payroll_repository.dart:29 |
GET /v1/employees/{employeeId}/shiftsList shifts of an employee |
Shifts tab: every employee's shifts for the week (from, to), in parallel, reading locked_reason. Also, when Mark paid is refused because of open shifts, the run's employees' shifts are read to list the ones still open | lib/screens/payroll/payroll_controller.dart:184lib/screens/payroll/payroll_controller.dart:579lib/domain/usecases/payroll/payroll_usecase.dart:24lib/data/repositories/payroll_repository.dart:36 |
POST /v1/employees/{employeeId}/shiftsStart/record a shift |
Log shift: started_at, plus ended_at unless the shift is still open. Sent once, never retried by itself 409 shift_overlap and shift_locked show the app's own text (payroll_copy.dart:18); a 422 on employee_id or ended_at names that problem. |
lib/screens/payroll/widgets/log_shift_page.dart:155lib/screens/payroll/payroll_controller.dart:337lib/domain/usecases/payroll/payroll_usecase.dart:27lib/data/repositories/payroll_repository.dart:46 |
PATCH /v1/shifts/{shiftId}Edit or end a shift |
Edit shift or End shift: only the changed started_at and ended_at (End shift prefills ended_at with now); nothing is sent when nothing changed Not offered for a locked shift (locked_reason payroll, payroll_controller.dart:195). 409 shift_overlap and shift_locked show the app's own text. |
lib/screens/payroll/widgets/edit_shift_sheet.dart:105lib/screens/payroll/payroll_controller.dart:361lib/domain/usecases/payroll/payroll_usecase.dart:30lib/data/repositories/payroll_repository.dart:53 |
DELETE /v1/shifts/{shiftId}Delete a shift |
Delete shift from the edit sheet, after a confirm dialog; the week reloads Not offered for a locked shift. 409 shift_locked shows "These hours are in a paid pay run, so they can't be changed." |
lib/screens/payroll/payroll_page.dart:367lib/screens/payroll/payroll_controller.dart:380lib/domain/usecases/payroll/payroll_usecase.dart:35lib/data/repositories/payroll_repository.dart:58 |
GET /v1/payroll-runsList payroll runs |
Every page: the Pay runs tab (newest first), the paid-week banner, the paid-day check before saving a shift and the overlap check in New pay run | lib/screens/payroll/payroll_controller.dart:205lib/domain/usecases/payroll/payroll_usecase.dart:40lib/data/repositories/payroll_repository.dart:62lib/data/repositories/payroll_repository.dart:134 |
POST /v1/payroll-runsCreate draft payroll run |
New pay run: period_start and period_end, plus frequency only when the sheet overrides the business setting; the new draft opens 409 payroll_period_overlap shows "There's already a pay run for part of these dates." The app reads hours_worked, gross_pay, deductions and net_pay per entry. |
lib/screens/payroll/widgets/new_run_sheet.dart:199lib/screens/payroll/payroll_controller.dart:507lib/domain/usecases/payroll/payroll_usecase.dart:44lib/data/repositories/payroll_repository.dart:78 |
POST /v1/payroll-runs/previewPreview a payroll run (no writes) |
New pay run: what a run for the chosen dates would contain (per-employee hours, gross, deductions, net and open_shifts_count). Owner only, writes nothing; asked again when the dates or frequency change and a stale answer is dropped 409 payroll_period_overlap and the 422s are the same as on create; the figures stay empty and the error shows on the sheet. |
lib/screens/payroll/widgets/new_run_sheet.dart:23lib/screens/payroll/payroll_controller.dart:492lib/domain/usecases/payroll/payroll_usecase.dart:48lib/data/repositories/payroll_repository.dart:90 |
POST /v1/payroll-runs/{payrollRunId}/payPay run: creates one Manpower (opex) expense |
Mark paid: paid_on from the sheet, with an Idempotency-Key made when the sheet opens and reused on every try. The run in the answer replaces the one shown (paying can recalculate it), then the runs and the week reload so the locks show 409 conflict (already paid) reads the run again and counts as success. |
lib/screens/payroll/widgets/mark_paid_sheet.dart:158lib/screens/payroll/payroll_controller.dart:539lib/domain/usecases/payroll/payroll_usecase.dart:70lib/data/repositories/payroll_repository.dart:77 |
GET /v1/payroll-runs/{payrollRunId}Get payroll run with entries |
Read the run again after Mark paid answered 409 conflict, or when the pay answer had no run in it | lib/screens/payroll/payroll_controller.dart:554lib/domain/usecases/payroll/payroll_usecase.dart:42lib/data/repositories/payroll_repository.dart:127lib/data/repositories/payroll_repository.dart:70 |
DELETE /v1/payroll-runs/{payrollRunId}Delete draft payroll run |
Delete a draft run (PAN-72) from the run detail, after the confirm dialog; the runs reload 409 payroll_run_paid: the run is read again (it is paid now) and the app says so. |
lib/screens/payroll/payroll_page.dart:342lib/screens/payroll/payroll_controller.dart:602lib/domain/usecases/payroll/payroll_usecase.dart:52lib/data/repositories/payroll_repository.dart:100 |
GET /v1/payroll-settingsGet payroll settings |
On open (owner): the settings the sheets and the work-days label use (salary proration, work days, standard hours, frequency, next period suggestion). A failure keeps the last settings and the sheets fall back to the defaults | lib/screens/payroll/payroll_controller.dart:107lib/domain/usecases/payroll/payroll_usecase.dart:59lib/data/repositories/payroll_repository.dart:104 |
PATCH /v1/payroll-settingsUpdate payroll settings |
Save the Settings tab (desktop): only the changed fields, never empty | lib/screens/payroll/widgets/payroll_settings_form.dart:93lib/screens/payroll/payroll_controller.dart:139lib/domain/usecases/payroll/payroll_usecase.dart:61lib/data/repositories/payroll_repository.dart:112 |
Each call links to its operation in the API reference. Code locations are file:line in panly-app at 72aaffd, listed from the screen down to the line that sends the request.