Files
omsorg/omsorgapp/src/app/useValueListItems.js
T
Felix KemmlerandClaude Sonnet 5 e9e96a57dc Add facilities, contracts, orders, value lists, audit log, and desktop app modules
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>
2026-08-08 23:29:16 +02:00

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 };
}