diff --git a/frontend/src/pages/AdminHierarchyPage.jsx b/frontend/src/pages/AdminHierarchyPage.jsx
index 8193e1c..54e424f 100644
--- a/frontend/src/pages/AdminHierarchyPage.jsx
+++ b/frontend/src/pages/AdminHierarchyPage.jsx
@@ -63,55 +63,84 @@ function AdminHierarchyPage() {
}
return (
-
- {/* Left: Tree View */}
-
-
Katalog-Hierarchie
- {error &&
{error}
}
+ <>
+
+
+
+ {/* Tree View */}
+
+
Katalog-Hierarchie
+ {error &&
{error}
}
+
+ {hierarchy.map(fa => (
+
+ ))}
+
+
+ {/* Detail Panel */}
+ {selectedItem && (
+
+
+
)}
-
+ >
)
}
@@ -332,42 +361,174 @@ function FocusAreaDetail({ focusArea, onUpdate }) {
}
function StyleDirectionDetail({ styleDirection, onUpdate }) {
+ const [editing, setEditing] = useState(false)
+ const [form, setForm] = useState({
+ name: styleDirection.name,
+ abbreviation: styleDirection.abbreviation || '',
+ description: styleDirection.description || '',
+ focus_area_id: styleDirection.focus_area_id
+ })
+
+ async function handleSave() {
+ try {
+ await api.updateStyleDirection(styleDirection.id, form)
+ setEditing(false)
+ onUpdate()
+ } catch (e) {
+ alert('Fehler: ' + e.message)
+ }
+ }
+
+ async function handleDelete() {
+ if (!confirm(`Stilrichtung "${styleDirection.name}" wirklich löschen?`)) return
+ try {
+ await api.deleteStyleDirection(styleDirection.id)
+ onUpdate()
+ } catch (e) {
+ alert('Fehler: ' + e.message)
+ }
+ }
+
+ if (!editing) {
+ return (
+
+
{styleDirection.name}
+ {styleDirection.abbreviation &&
Kürzel: {styleDirection.abbreviation}
}
+ {styleDirection.description &&
{styleDirection.description}
}
+
+ {styleDirection.target_groups && styleDirection.target_groups.length > 0 && (
+
+
Zugeordnete Zielgruppen
+
+ {styleDirection.target_groups.map(tg => (
+ -
+ {tg.name} {tg.is_primary && ★ Primär}
+
+ ))}
+
+
+ )}
+
+
+
+
+
+
+ )
+ }
+
return (
-
{styleDirection.name}
- {styleDirection.abbreviation &&
Kürzel: {styleDirection.abbreviation}
}
- {styleDirection.description &&
{styleDirection.description}
}
-
- {styleDirection.target_groups && styleDirection.target_groups.length > 0 && (
-
-
Zugeordnete Zielgruppen
-
- {styleDirection.target_groups.map(tg => (
- -
- {tg.name} {tg.is_primary && ★ Primär}
-
- ))}
-
-
- )}
-
-
+
Stilrichtung bearbeiten
+
+
+ setForm({ ...form, name: e.target.value })}
+ />
+
+
+
+ setForm({ ...form, abbreviation: e.target.value })}
+ />
+
+
+
+
+
+
+
+
)
}
function TrainingTypeDetail({ trainingType, onUpdate }) {
+ const [editing, setEditing] = useState(false)
+ const [form, setForm] = useState({
+ name: trainingType.name,
+ abbreviation: trainingType.abbreviation || '',
+ description: trainingType.description || '',
+ focus_area_id: trainingType.focus_area_id
+ })
+
+ async function handleSave() {
+ try {
+ await api.updateTrainingType(trainingType.id, form)
+ setEditing(false)
+ onUpdate()
+ } catch (e) {
+ alert('Fehler: ' + e.message)
+ }
+ }
+
+ async function handleDelete() {
+ if (!confirm(`Trainingstyp "${trainingType.name}" wirklich löschen?`)) return
+ try {
+ await api.deleteTrainingType(trainingType.id)
+ onUpdate()
+ } catch (e) {
+ alert('Fehler: ' + e.message)
+ }
+ }
+
+ if (!editing) {
+ return (
+
+
{trainingType.name}
+ {trainingType.abbreviation &&
Kürzel: {trainingType.abbreviation}
}
+ {trainingType.description &&
{trainingType.description}
}
+
+
+
+
+
+
+ )
+ }
+
return (
-
{trainingType.name}
- {trainingType.abbreviation &&
Kürzel: {trainingType.abbreviation}
}
- {trainingType.description &&
{trainingType.description}
}
-
-
+
Trainingstyp bearbeiten
+
+
+ setForm({ ...form, name: e.target.value })}
+ />
+
+
+
+ setForm({ ...form, abbreviation: e.target.value })}
+ />
+
+
+
+
+
+
+
+
)
}