// 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 { Alert } from "~/ui/components/Alert"; 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 { Select } from "~/ui/components/Select"; import { Table } from "~/ui/components/Table"; 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 PayslipMemberOption = { userId: string; displayName: string; team: string | null; roleNames: readonly string[]; }; export type HrAdminPayslipsActions = { onMatch: (input: { periodYear: string; periodMonth: string; files: readonly File[] }) => void; onConfirm: (input: { file: File; employeeUserId: string; periodYear: string; periodMonth: string }) => void; }; export type HrAdminPayslipsPageProps = { rows: readonly PayslipAdminRow[]; preview: readonly PayslipPreviewRow[]; memberOptions: readonly PayslipMemberOption[]; period: { year: string; month: string }; submitting: boolean; errorKey: string | null; feedbackKey: string | null; 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, memberOptions, period, submitting, errorKey, feedbackKey, actions }: HrAdminPayslipsPageProps) { const { t } = useTranslation(); const [year, setYear] = useState(""); const [month, setMonth] = useState(""); const [files, setFiles] = useState([]); const [matchedFiles, setMatchedFiles] = useState([]); const [assignees, setAssignees] = useState>({}); return (
{t("hr.payslips.admin.title")} {t("hr.payslips.admin.subtitle")}
{/* Bulk auto-match */}
setYear(e.target.value)} /> setMonth(e.target.value)} />
{files.length > 0 ? ( {t("hr.payslips.upload.selected", { count: files.length })} ) : null} {errorKey ? : null} {submitting ? ( ) : null} {!submitting && feedbackKey ? ( ) : null}
{preview.length > 0 ? (
{t("hr.payslips.match.title")} {preview.map((row) => (
{row.fileName} {t(row.confidenceKey)}
))}
) : null}
{t("hr.payslips.admin.existing")} {rows.length === 0 ? (
) : (
{t("hr.payslips.column.employee")}{t("hr.payslips.column.period")}{t("hr.payslips.column.status")} } > {rows.map((row) => ( {row.employeeLabel} {row.periodLabel} {row.isRead ? t("hr.payslips.read") : t("hr.payslips.unread")} ))}
)}
); }