/** * TrusteeOrganisationsView * * Organisations-Verwaltung für eine Trustee-Instanz */ import React from 'react'; import { useTrusteeOrganisations, useTrusteeOrganisationOperations } from '../../../hooks/useTrustee'; import { useTablePermission } from '../../../hooks/useInstancePermissions'; import styles from './TrusteeViews.module.css'; export const TrusteeOrganisationsView: React.FC = () => { const { items: organisations, loading, error, refetch } = useTrusteeOrganisations(); const { handleDelete, deletingItems } = useTrusteeOrganisationOperations(); const { canCreate, canUpdate, canDelete } = useTablePermission('TrusteeOrganisation'); if (loading) { return
Lade Organisationen...
; } if (error) { return
Fehler: {error}
; } const onDelete = async (orgId: string) => { if (window.confirm('Organisation wirklich löschen?')) { const success = await handleDelete(orgId); if (success) { refetch(); } } }; return (
{/* Toolbar */}
{canCreate && ( )}
{/* Tabelle */} {organisations.length === 0 ? (

Keine Organisationen vorhanden.

) : ( {organisations.map((org) => ( ))}
Label Status Aktionen
{org.label} {org.enabled ? 'Aktiv' : 'Inaktiv'} {canUpdate && ( )} {canDelete && ( )}
)}
); }; export default TrusteeOrganisationsView;