feat(oxibadge): add timesheet review and export screen
Check, format and test / build (push) Successful in 10m16s

Add the month-review screen shown after records/employees load: an
editable per-employee timesheet table with issue/rounding detection,
bulk fixes (reorder stacked punches, add lunch break, round to step),
and an export flow (single employee or all) wired to a new Rust
export_timesheet command. Split into focused components under
review/ instead of one large file, with shared i18n keys and a new
export_timesheet IPC command.

Assisted-by: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-10-07 15:56:25 +02:00
parent b4cd8e1796
commit acd3efeac6
19 changed files with 2664 additions and 36 deletions
+35 -22
View File
@@ -8,14 +8,19 @@
import Onboarding from '$lib/components/Onboarding.svelte';
import ConfirmMonth from '$lib/components/ConfirmMonth.svelte';
import LoadingScreen from '$lib/components/LoadingScreen.svelte';
import TimesheetReview from '$lib/components/TimesheetReview.svelte';
import { buildEmployees, type AttendanceRecord } from '$lib/components/review/fromRecords';
type Step = 'loading' | 'setup' | 'confirm-month' | 'loading-records' | 'loading-employees' | 'done';
type Step = 'loading' | 'setup' | 'confirm-month' | 'loading-records' | 'loading-employees' | 'review';
let step = $state<Step>('loading');
let selectedYear = $state(0);
let selectedMonth = $state(0);
let records = $state<AttendanceRecord[]>([]);
let employeeNames = $state<Record<string, string>>({});
const period = $derived(`${monthName($locale, selectedMonth)} ${selectedYear}`);
const reviewEmployees = $derived(buildEmployees(selectedYear, selectedMonth, records, employeeNames));
onMount(async () => {
const preferences = await invoke<{ host: string; port: number } | null>('load_preferences');
@@ -28,10 +33,10 @@
step = 'loading-records';
clearError();
try {
const records = await invoke('load_records', selection);
records = await invoke('load_records', selection);
step = 'loading-employees';
await invoke('load_employees', { records });
step = 'done';
employeeNames = await invoke('load_employees', { records });
step = 'review';
} catch (err) {
setError(err);
step = 'confirm-month';
@@ -39,21 +44,29 @@
}
</script>
<Screen>
{#if step === 'loading'}
<p>{$_('loading')}</p>
{:else if step === 'setup'}
<Onboarding onconnected={() => (step = 'confirm-month')} />
{:else if step === 'confirm-month'}
<ConfirmMonth onstart={loadMonth} />
{:else if step === 'loading-records'}
<LoadingScreen
title={$_('loading_records.title')}
description={$_('loading_records.description', { values: { period } })}
/>
{:else if step === 'loading-employees'}
<LoadingScreen title={$_('loading_employees.title')} description={$_('loading_employees.description')} />
{:else}
<p>{$_('done.message')}</p>
{/if}
</Screen>
{#if step === 'review'}
<TimesheetReview
year={selectedYear}
month={selectedMonth}
employees={reviewEmployees}
onback={() => (step = 'confirm-month')}
onexport={(payload) => invoke('export_timesheet', { payload })}
/>
{:else}
<Screen>
{#if step === 'loading'}
<p>{$_('loading')}</p>
{:else if step === 'setup'}
<Onboarding onconnected={() => (step = 'confirm-month')} />
{:else if step === 'confirm-month'}
<ConfirmMonth onstart={loadMonth} />
{:else if step === 'loading-records'}
<LoadingScreen
title={$_('loading_records.title')}
description={$_('loading_records.description', { values: { period } })}
/>
{:else if step === 'loading-employees'}
<LoadingScreen title={$_('loading_employees.title')} description={$_('loading_employees.description')} />
{/if}
</Screen>
{/if}