feat: Phase 2B — staff payroll / hourly rate

- Users: add hourly_rate (Float, nullable) — manager-only, not shown to waiter
- WaiterShift: add hourly_rate_snapshot — copied from user.hourly_rate at shift open, never updated
- Shift start (both /start and /manager/start): snapshot rate at shift creation
- compute_shift_pay(): calculates worked hours (minus breaks) × rate_snapshot; returns None if unset
- _enrich_shift(): now includes hourly_rate_snapshot, duration_hours, shift_pay
- shifts_report in reports.py: delegates to _enrich_shift so all shift endpoints are consistent
- Shifts CSV export: adds duration_hours, hourly_rate, shift_pay columns
- StaffTab: hourly_rate field in waiter edit modal (Μισθοδοσία section, col 3)
- ShiftsOverview report: Αμοιβή/ώρα + Αποδοχές columns; untracked shows 'Δεν παρακολουθείται'

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-07 20:55:24 +03:00
co-authored by Claude Sonnet 4.6
parent d0dfd63415
commit e5b8ef32be
8 changed files with 101 additions and 29 deletions
@@ -119,6 +119,8 @@ export default function ShiftsOverview({ onNavigate } = {}) {
<TH>Έναρξη</TH>
<TH>Λήξη</TH>
<TH align="right">Διάρκεια</TH>
<TH align="right">Αμοιβή/ώρα</TH>
<TH align="right">Αποδοχές</TH>
<TH align="right">Αρχικά Μετρητά</TH>
<TH align="right">Εισπράχθηκαν</TH>
<TH align="right">Οφείλει</TH>
@@ -143,6 +145,16 @@ export default function ShiftsOverview({ onNavigate } = {}) {
: <span className="text-sky-600 font-medium">— ενεργή —</span>}
</TD>
<TD mono align="right">{fmtDuration(s.started_at, s.ended_at)}</TD>
<TD mono align="right">
{s.hourly_rate_snapshot != null
? fmtEUR(s.hourly_rate_snapshot)
: <span className="text-slate-400 text-[11px]">—</span>}
</TD>
<TD mono align="right">
{s.shift_pay != null
? <span className="font-semibold text-emerald-700">{fmtEUR(s.shift_pay)}</span>
: <span className="text-slate-400 text-[11px]">Δεν παρακολουθείται</span>}
</TD>
<TD mono align="right">{fmtEUR(s.starting_cash)}</TD>
<TD mono align="right">{fmtEUR(s.total_collected)}</TD>
<TD mono align="right" className="font-semibold text-slate-900">{fmtEUR(s.net_to_deliver)}</TD>
@@ -170,7 +182,7 @@ export default function ShiftsOverview({ onNavigate } = {}) {
</TR>,
isOpen && (
<tr key={`${s.id}-detail`}>
<td colSpan={9} className="border-b border-slate-100 bg-slate-50/60 px-6 py-3">
<td colSpan={11} className="border-b border-slate-100 bg-slate-50/60 px-6 py-3">
<div className="flex items-center gap-4 text-[12px] text-slate-500">
<span>
{'Εργάσιμη Μέρα: '}