// 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 { FeatherPlus } from "@subframe/core"; import type { HrLocationListVM } from "@hivegrid/view-models"; 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
; } const { rows, canManage, emptyHeadlineKey, emptyBodyKey } = vm.data; function submitCreate() { actions.onCreate({ name, city, isDefault }); setCreateOpen(false); setName(""); setCity(""); setIsDefault(false); } return (