// flows2.jsx — Support workers (pay run) and Plan-review prep const { useState: uS3, useEffect: uE3 } = React; // ══════════════════════════════════════════════════════════════════ // SUPPORT WORKERS + PAY RUN // ══════════════════════════════════════════════════════════════════ function Workers() { const S = useHaven(); const sheets = S.doc.timesheets; const [running, setRunning] = uS3(false); const [addingTs, setAddingTs] = uS3(false); const worker = (id) => S.doc.workers.find((w) => w.id === id) || { rate: 0, name: '(removed worker)', initials: '?' }; const pending = sheets.filter((s) => s.status === 'pending'); const pendingTotal = pending.reduce((s, t) => s + t.hours * worker(t.worker).rate, 0); const pendingHours = pending.reduce((s, t) => s + t.hours, 0); const approve = (id) => S.approveTimesheet(id); const approved = sheets.filter((s) => s.status === 'approved'); const readyTotal = approved.reduce((s, t) => s + t.hours * worker(t.worker).rate, 0); return (
Pay recorded — the hours and amount have come off your Core budget. Remember payslips and Single Touch Payroll in your payroll software.
A great review is really just good records plus your story. You've got the records — let's add the story.
${esc(g.note)}
` : ''} ${g.supports ? `Supported by ${esc(g.supports)}
` : ''}| Support area | Funded | Spent | Remaining | |
|---|---|---|---|---|
| Whole plan | ${m0(plan.total)} | ${m0(plan.spent)} | ${m0(plan.remaining)} | |
What worked well: ${esc(d.review.notes.worked)}
` : ''} ${d.review.notes.change.trim() ? `What to change or add: ${esc(d.review.notes.change)}
` : ''}` : ''} ${d.providers.length ? `| Provider | Support area | Rate | Agreement ends |
|---|
| Name | Role | Rate |
|---|
| Date | Provider | Support area | Amount | Status |
|---|
${d.claims.length} claims recorded · ${m2(claimTotal)} total
` : ''}