// AK-P17a Interim-UI (AD-28) — locations screen composed from ~/ui (D-HR // "Standorte", archetype A2 + A5 create modal). Pure presentational: renders the // server-built HrLocationListVM; admin create/set-default/archive run through the // injected actions (route owns the fetcher). The create form uses a real Dialog // (DialogLayout -> Dialog -> Dialog.Content), never a Card fake. Final Subframe // optics = tracked design-nachzug. import { useState } from "react"; import { useTranslation } from "react-i18next"; import { AppLink } from "~/components/app/AppLink"; import { FeatherGlobe, FeatherPlus } from "@subframe/core"; import type { HrLocationListVM } from "@hivegrid/view-models"; import { PAGE_HEADER_ICON_CLASS, PageBody, PageHeader, PageShell } from "../shared/PageShell"; import { BadgeFeedback } from "~/ui/components/BadgeFeedback"; import { Button } from "~/ui/components/Button"; import { Checkbox } from "~/ui/components/Checkbox"; import { Dialog } from "~/ui/components/Dialog"; import { EmptyState } from "~/ui/components/EmptyState"; import { Table } from "~/ui/components/Table"; import { TextInput } from "~/ui/components/TextInput"; export type HrLocationsActions = { onCreate: (input: { name: string; city: string; isDefault: boolean }) => void; onSetDefault: (locationId: string) => void; onArchive: (locationId: string) => void; }; export type HrLocationsPageProps = { vm: HrLocationListVM; submitting: boolean; actions: HrLocationsActions; }; export function HrLocationsPage({ vm, submitting, actions }: HrLocationsPageProps) { const { t } = useTranslation(); const [createOpen, setCreateOpen] = useState(false); const [name, setName] = useState(""); const [city, setCity] = useState(""); const [isDefault, setIsDefault] = useState(false); if (vm.status !== "ready" || !vm.data) { return ( } title={t("hr.locations.title")} subtitle={t("hr.locations.subtitle")} /> {null} ); } const { rows, canManage, emptyHeadlineKey, emptyBodyKey } = vm.data; function submitCreate() { actions.onCreate({ name, city, isDefault }); setCreateOpen(false); setName(""); setCity(""); setIsDefault(false); } return ( } title={t("hr.locations.title")} subtitle={t("hr.locations.subtitle")} actions={ canManage ? ( ) : undefined } /> {rows.length === 0 ? (
) : (
{t("hr.locations.column.name")}{t("hr.locations.column.city")}{t("hr.locations.column.employees")} {canManage ? : null} } > {rows.map((row) => (
{row.name} {row.isDefault ? ( {t("hr.locations.default")} ) : null}
{row.city ?? "—"} {row.employeeCount} {canManage ? (
{!row.isDefault ? ( ) : null}
) : null}
))}
)}
{t("hr.locations.create.title")}
setName(event.target.value)} data-ui-id="ui.hr.locations.create.name" /> setCity(event.target.value)} data-ui-id="ui.hr.locations.create.city" /> setIsDefault(checked)} />
); }