Update hivegrid-cloud reference to latest main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e98d38e716
commit
7b21524c86
3781 files changed
+373484
-225607
No files matched your search
+168
@@ -0,0 +1,168 @@
|
||||
// AK-P17b Interim-UI (AD-28) — payslip administration composed from ~/ui (D-HR
|
||||
// "Lohnabrechnungen verwalten", archetype A2 + A4). Pure presentational: bulk
|
||||
// auto-match preview (hard/soft/none confidence) with a per-row confirm, plus the
|
||||
// existing-payslips list. Match/confirm run through injected actions (route owns
|
||||
// the fetcher). Final Subframe optics = tracked design-nachzug.
|
||||
|
||||
import { useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { BadgeFeedback } from "~/ui/components/BadgeFeedback";
|
||||
import { Button } from "~/ui/components/Button";
|
||||
import { Card } from "~/ui/components/Card";
|
||||
import { EmptyState } from "~/ui/components/EmptyState";
|
||||
import { Table } from "~/ui/components/Table";
|
||||
import { TextArea } from "~/ui/components/TextArea";
|
||||
import { TextInput } from "~/ui/components/TextInput";
|
||||
|
||||
export type PayslipPreviewRow = {
|
||||
fileId: string;
|
||||
fileName: string;
|
||||
confidence: string;
|
||||
confidenceKey: string;
|
||||
confidenceTone: string;
|
||||
employeeUserId: string | null;
|
||||
employeeLabel: string | null;
|
||||
};
|
||||
|
||||
export type PayslipAdminRow = { id: string; employeeLabel: string; periodLabel: string; isRead: boolean };
|
||||
|
||||
export type HrAdminPayslipsActions = {
|
||||
onMatch: (input: { periodYear: string; periodMonth: string; files: string }) => void;
|
||||
onConfirm: (input: { fileId: string; employeeUserId: string; periodYear: string; periodMonth: string }) => void;
|
||||
};
|
||||
|
||||
export type HrAdminPayslipsPageProps = {
|
||||
rows: readonly PayslipAdminRow[];
|
||||
preview: readonly PayslipPreviewRow[];
|
||||
period: { year: string; month: string };
|
||||
submitting: boolean;
|
||||
actions: HrAdminPayslipsActions;
|
||||
};
|
||||
|
||||
function toneFarbe(tone: string): "subtle-positive" | "subtle-warning" | "subtle-neutral" {
|
||||
if (tone === "success") return "subtle-positive";
|
||||
if (tone === "warning") return "subtle-warning";
|
||||
return "subtle-neutral";
|
||||
}
|
||||
|
||||
export function HrAdminPayslipsPage({ rows, preview, period, submitting, actions }: HrAdminPayslipsPageProps) {
|
||||
const { t } = useTranslation();
|
||||
const [year, setYear] = useState("");
|
||||
const [month, setMonth] = useState("");
|
||||
const [files, setFiles] = useState("");
|
||||
const [assignees, setAssignees] = useState<Record<string, string>>({});
|
||||
|
||||
return (
|
||||
<div className="flex w-full flex-col gap-6 p-6" data-ui-id="ui.hr.admin.payslips">
|
||||
<div className="flex flex-col gap-0">
|
||||
<span className="text-heading-2 font-heading-2 text-text-neutral-primary">{t("hr.payslips.admin.title")}</span>
|
||||
<span className="text-body-default-regular-150 font-body-default-regular-150 text-text-neutral-secondary">{t("hr.payslips.admin.subtitle")}</span>
|
||||
</div>
|
||||
|
||||
{/* Bulk auto-match */}
|
||||
<Card>
|
||||
<div className="flex w-full flex-col gap-4" data-ui-id="ui.hr.admin.payslips.match">
|
||||
<div className="flex flex-wrap gap-4">
|
||||
<TextInput label={t("hr.payslips.field.year")} showLabel>
|
||||
<TextInput.Input type="number" value={year} onChange={(e) => setYear(e.target.value)} />
|
||||
</TextInput>
|
||||
<TextInput label={t("hr.payslips.field.month")} showLabel>
|
||||
<TextInput.Input type="number" value={month} onChange={(e) => setMonth(e.target.value)} />
|
||||
</TextInput>
|
||||
</div>
|
||||
<TextArea label={t("hr.payslips.field.filesHint")} showLabel className="w-full">
|
||||
<TextArea.Input value={files} onChange={(e) => setFiles(e.target.value)} />
|
||||
</TextArea>
|
||||
<div className="flex justify-end">
|
||||
<Button
|
||||
variant="secondary"
|
||||
loading={submitting}
|
||||
disabled={!year.trim() || !month.trim() || !files.trim()}
|
||||
onClick={() => actions.onMatch({ periodYear: year, periodMonth: month, files })}
|
||||
data-ui-id="ui.hr.admin.payslips.match.submit"
|
||||
>
|
||||
{t("hr.payslips.action.match")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
|
||||
{preview.length > 0 ? (
|
||||
<div className="flex w-full flex-col gap-3" data-ui-id="ui.hr.admin.payslips.preview">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{t("hr.payslips.match.title")}</span>
|
||||
{preview.map((row) => (
|
||||
<Card key={row.fileId} data-row-id={row.fileId} data-confidence={row.confidence}>
|
||||
<div className="flex w-full flex-col gap-3">
|
||||
<div className="flex items-center justify-between gap-3">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{row.fileName}</span>
|
||||
<BadgeFeedback farbe={toneFarbe(row.confidenceTone)} size="small">
|
||||
{t(row.confidenceKey)}
|
||||
</BadgeFeedback>
|
||||
</div>
|
||||
<div className="flex items-end gap-2">
|
||||
<TextInput label={t("hr.payslips.field.employee")} showLabel fillContainer className="max-w-none">
|
||||
<TextInput.Input
|
||||
value={assignees[row.fileId] ?? row.employeeUserId ?? ""}
|
||||
onChange={(e) => setAssignees((s) => ({ ...s, [row.fileId]: e.target.value }))}
|
||||
/>
|
||||
</TextInput>
|
||||
<Button
|
||||
loading={submitting}
|
||||
onClick={() =>
|
||||
actions.onConfirm({
|
||||
fileId: row.fileId,
|
||||
employeeUserId: assignees[row.fileId] ?? row.employeeUserId ?? "",
|
||||
periodYear: period.year,
|
||||
periodMonth: period.month,
|
||||
})
|
||||
}
|
||||
>
|
||||
{t("hr.payslips.action.assign")}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="flex w-full flex-col gap-2">
|
||||
<span className="text-body-default-medium-0 font-body-default-medium-0 text-text-neutral-primary">{t("hr.payslips.admin.existing")}</span>
|
||||
{rows.length === 0 ? (
|
||||
<div data-ui-id="ui.hr.admin.payslips.empty">
|
||||
<EmptyState title={t("hr.payslips.admin.empty.headline")} body={t("hr.payslips.admin.empty.body")} />
|
||||
</div>
|
||||
) : (
|
||||
<div className="w-full overflow-x-auto">
|
||||
<Table
|
||||
data-ui-id="ui.hr.admin.payslips.list"
|
||||
header={
|
||||
<Table.HeaderRow>
|
||||
<Table.HeaderCell>{t("hr.payslips.column.employee")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("hr.payslips.column.period")}</Table.HeaderCell>
|
||||
<Table.HeaderCell>{t("hr.payslips.column.status")}</Table.HeaderCell>
|
||||
</Table.HeaderRow>
|
||||
}
|
||||
>
|
||||
{rows.map((row) => (
|
||||
<Table.Row key={row.id} data-row-id={row.id}>
|
||||
<Table.Cell>
|
||||
<span className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-primary">{row.employeeLabel}</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<span className="text-body-default-regular-0 font-body-default-regular-0 text-text-neutral-secondary">{row.periodLabel}</span>
|
||||
</Table.Cell>
|
||||
<Table.Cell>
|
||||
<BadgeFeedback farbe={row.isRead ? "subtle-positive" : "subtle-warning"} size="small">
|
||||
{row.isRead ? t("hr.payslips.read") : t("hr.payslips.unread")}
|
||||
</BadgeFeedback>
|
||||
</Table.Cell>
|
||||
</Table.Row>
|
||||
))}
|
||||
</Table>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user