Extends omsorgCore with full CRUD for Facility/Contract/Order plus configurable value lists and an audit trail, and wires the omsorgapp frontend up to the new facilities, settings, and audit-log modules; includes a sidebar active-nav-item highlight. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
31 lines
890 B
JavaScript
31 lines
890 B
JavaScript
import { useEffect, useState } from "react";
|
|
|
|
// Lädt die Items einer konfigurierbaren Auswahlliste (siehe omsorgCore/CLAUDE.md,
|
|
// Abschnitt "Konfigurierbare Auswahllisten") über window.omsorg.valueLists.listItems.
|
|
// Ersetzt die früher hier hartcodierten Options-Arrays (Mitarbeiterstatus,
|
|
// Beschäftigungsart, CRM-Status, Einrichtungstyp, ...).
|
|
export function useValueListItems(key) {
|
|
const [items, setItems] = useState([]);
|
|
const [isLoading, setIsLoading] = useState(true);
|
|
|
|
useEffect(() => {
|
|
let cancelled = false;
|
|
|
|
async function load() {
|
|
setIsLoading(true);
|
|
const result = await window.omsorg.valueLists.listItems(key);
|
|
if (!cancelled) {
|
|
setItems(result.ok ? result.data ?? [] : []);
|
|
setIsLoading(false);
|
|
}
|
|
}
|
|
|
|
load();
|
|
return () => {
|
|
cancelled = true;
|
|
};
|
|
}, [key]);
|
|
|
|
return { items, isLoading };
|
|
}
|