Production
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
import type { Headquarters } from "../../types";
|
||||
|
||||
/** Pick any number of headquarters. `owners` shows who manages each one today. */
|
||||
export function HeadquartersChecklist({ headquarters, selected, onChange, owners = {}, disabled = false }: {
|
||||
headquarters: Headquarters[];
|
||||
selected: ReadonlySet<string>;
|
||||
onChange: (next: Set<string>) => void;
|
||||
owners?: Record<string, string>;
|
||||
disabled?: boolean;
|
||||
}) {
|
||||
if (headquarters.length === 0) return <p className="hq-empty">No headquarters yet — create one under Organisation first.</p>;
|
||||
const toggle = (id: string) => {
|
||||
const next = new Set(selected);
|
||||
if (next.has(id)) next.delete(id); else next.add(id);
|
||||
onChange(next);
|
||||
};
|
||||
return (
|
||||
<div className="hq-check-list" role="group" aria-label="Headquarters">
|
||||
{headquarters.map((h) => (
|
||||
<label key={h.id} className={`hq-check${selected.has(h.id) ? " on" : ""}`}>
|
||||
<input type="checkbox" checked={selected.has(h.id)} disabled={disabled} onChange={() => toggle(h.id)} />
|
||||
<span className="hq-check-text">
|
||||
<strong>{h.code}</strong> · {h.name}
|
||||
{owners[h.id] && <small>Managed by {owners[h.id]}</small>}
|
||||
</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user