// AK-P17b Interim-UI (AD-28) — upload-reminder editor (admin) composed from ~/ui // (D-HR "Upload-Erinnerungen", archetype A2 + A5). Pure presentational: create via // a real Dialog; pause/resume/archive via injected actions (dispatch runs in the // worker cron). Final Subframe optics = tracked design-nachzug. import { type MouseEvent, useState } from "react"; import { useTranslation } from "react-i18next"; import { FeatherPlus } from "@subframe/core"; import type { HrReminderCadenceKind, HrReminderListVM } from "@hivegrid/view-models"; import { BadgeFeedback } from "~/ui/components/BadgeFeedback"; import { Button } from "~/ui/components/Button"; import { Card } from "~/ui/components/Card"; import { Checkbox } from "~/ui/components/Checkbox"; import { Dialog } from "~/ui/components/Dialog"; import { EmptyState } from "~/ui/components/EmptyState"; import { Select } from "~/ui/components/Select"; import { TextInput } from "~/ui/components/TextInput"; import { DateField } from "~/components/screens/tasks/DateField"; export type HrAdminUploadRemindersActions = { onCreate: (input: { title: string; documentKind: string; cadenceKind: string; intervalMonths: string; audienceKind: string; dueAt: string; mandatory: boolean; escalate: boolean; }) => void; onSetStatus: (reminderId: string, status: "active" | "paused") => void; onArchive: (reminderId: string) => void; }; export type HrAdminUploadRemindersPageProps = { vm: HrReminderListVM; cadences: readonly HrReminderCadenceKind[]; documentKinds: readonly string[]; audiences: readonly string[]; submitting: boolean; actions: HrAdminUploadRemindersActions; }; const EMPTY = { title: "", intervalMonths: "", mandatory: false, escalate: false }; export function HrAdminUploadRemindersPage({ vm, cadences, documentKinds, audiences, submitting, actions }: HrAdminUploadRemindersPageProps) { const { t } = useTranslation(); const [open, setOpen] = useState(false); const [form, setForm] = useState({ ...EMPTY, documentKind: documentKinds[0] ?? "other", cadenceKind: cadences[0] ?? "once", audienceKind: audiences[0] ?? "all" }); const rows = vm.data?.rows ?? []; function reset() { setForm({ ...EMPTY, documentKind: documentKinds[0] ?? "other", cadenceKind: cadences[0] ?? "once", audienceKind: audiences[0] ?? "all" }); } function submit(event: MouseEvent) { const el = (event.currentTarget as HTMLElement).closest("[data-ui-id='ui.hr.admin.uploadReminders.new']"); const dueAt = el?.querySelector("input[name='dueAt']")?.value ?? ""; if (!form.title.trim()) return; actions.onCreate({ ...form, dueAt }); setOpen(false); reset(); } return (
{t("hr.reminders.title")} {t("hr.reminders.subtitle")}
{rows.length === 0 ? (
) : (
{rows.map((row) => (
{row.title} {t(row.cadenceLabelKey)} · {t("hr.reminders.pending", { count: row.pendingCount })}
{t(row.statusLabelKey)} {row.status === "active" ? ( ) : ( )}
))}
)}
{t("hr.reminders.action.create")}
setForm((s) => ({ ...s, title: e.target.value }))} />
setForm((s) => ({ ...s, intervalMonths: e.target.value }))} />
setForm((s) => ({ ...s, mandatory: c }))} /> setForm((s) => ({ ...s, escalate: c }))} />
); }