Implement planning layout and enhance training module functionality
Deploy Development / deploy (push) Failing after 23s
Test Suite / pytest-backend (push) Successful in 35s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 6s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Has been cancelled

- Added a new PlanningLayout component to manage the training planning interface, allowing for better organization of related pages.
- Introduced a FormActionBar component across various modals and forms to standardize action buttons for saving and canceling.
- Updated the TrainingPlanningPageRoot and TrainingPlanningUnitFormModal to utilize the new FormActionBar for improved user experience.
- Enhanced the TrainingModuleEditPage and TrainingFrameworkProgramEditPage with save and close functionality, streamlining the editing process.
- Refactored existing modals to incorporate the new layout and action bar, ensuring consistency across the application.
This commit is contained in:
Lars committed 2026-05-19 10:02:39 +02:00
1 parent 82705f0c3e
commit 4fee5a2b47
14 files changed
+525 -207

No files matched your search

@@ -684,29 +684,6 @@ function TrainingPlanningPageRoot() {
}
}
const handleDeletePlanTemplate = useCallback(
async (tpl) => {
if (!tpl?.id) return
const label = (tpl.name || '').trim() || `Vorlage #${tpl.id}`
if (
!window.confirm(
`Trainingsvorlage „${label}“ wirklich löschen? Die Aktion kann nicht rückgängig gemacht werden.`
)
) {
return
}
try {
await api.deleteTrainingPlanTemplate(tpl.id)
setDraftPlanTemplateId((prev) => (String(prev) === String(tpl.id) ? '' : prev))
await loadPlanTemplates()
toast.success('Vorlage gelöscht.')
} catch (err) {
toast.error(err.message || 'Löschen fehlgeschlagen')
}
},
[loadPlanTemplates, toast]
)
const openModuleApplyModal = useCallback(async (placement) => {
setModuleApplyErr('')
setModuleApplySearchQuery('')
@@ -995,11 +972,11 @@ function TrainingPlanningPageRoot() {
}
}
const handleSubmit = async (e) => {
e.preventDefault()
const handleSubmit = async (e, { closeAfter = true } = {}) => {
e?.preventDefault?.()
if (!formData.group_id || !formData.planned_date) {
toast.error('Gruppe und Datum sind Pflichtfelder')
return
return false
}
try {
const planPart = buildPlanPayloadForSave(formData.sections)
@@ -1041,15 +1018,22 @@ function TrainingPlanningPageRoot() {
}
}
let savedUnit
if (editingUnit) {
await api.updateTrainingUnit(editingUnit.id, payload)
savedUnit = await api.updateTrainingUnit(editingUnit.id, payload)
} else {
await api.createTrainingUnit(payload)
savedUnit = await api.createTrainingUnit(payload)
}
setShowModal(false)
await loadUnits()
if (closeAfter) {
setShowModal(false)
} else if (savedUnit?.id) {
await handleEdit({ id: savedUnit.id })
}
return true
} catch (err) {
toast.error('Fehler beim Speichern: ' + err.message)
return false
}
}
@@ -1179,7 +1163,7 @@ function TrainingPlanningPageRoot() {
const clubDirectoryForAssignCo = filterDirectoryExcludingLead(clubDirectory, assignExcludeLeadPid)
return (
<div className="app-page">
<>
<h1 style={{ marginBottom: '0.35rem' }}>Trainingsplanung</h1>
<div
@@ -1232,25 +1216,9 @@ function TrainingPlanningPageRoot() {
<p style={{ color: 'var(--text2)', fontSize: '0.95rem', marginBottom: '1.25rem' }}>
Wähle eine Trainingsgruppe und lege <strong>Trainingseinheiten</strong> für den Zeitraum an (Inhalt: Abschnitte
und Übungen).
und Übungen). Rahmenprogramme, Module und Vorlagen erreichst du über die Registerkarten oben.
</p>
<div className="card" style={{ marginBottom: '1.25rem', padding: '12px 14px' }}>
<p style={{ margin: '0 0 0.5rem', fontSize: '0.92rem', color: 'var(--text2)' }}>
Mehrere Einheiten strukturieren auf einmal:{' '}
<Link to="/planning/framework-programs" style={{ fontWeight: 600, color: 'var(--accent-dark)' }}>
Trainingsrahmenprogramme
</Link>{' '}
(Ziele, Sessions, Vorlagen‑Ablauf).
</p>
<p style={{ margin: 0, fontSize: '0.92rem', color: 'var(--text2)' }}>
Wiederverwendbare Blöcke innerhalb einer Einheit:{' '}
<Link to="/planning/training-modules" style={{ fontWeight: 600, color: 'var(--accent-dark)' }}>
Trainingsmodule
</Link>{' '}
(übernahme als Kopie beim Bearbeiten einer Einheit).
</p>
</div>
{!loading && groups.length === 0 && (
<div
className="card"
@@ -2023,7 +1991,8 @@ function TrainingPlanningPageRoot() {
draftPlanTemplateId={draftPlanTemplateId}
onDraftTemplateSelect={applyTemplateFromSelect}
planTemplates={planTemplates}
onDeletePlanTemplate={handleDeletePlanTemplate}
onSaveOnly={(e) => handleSubmit(e, { closeAfter: false })}
onSaveAndClose={(e) => handleSubmit(e, { closeAfter: true })}
clubDirectory={clubDirectory}
clubDirectoryForCo={clubDirectoryForCo}
planningModalClubId={planningModalClubId}
@@ -2123,7 +2092,7 @@ function TrainingPlanningPageRoot() {
peekExtras={planningPeekCtx?.peekExtras ?? undefined}
onClose={() => setPlanningPeekCtx(null)}
/>
</div>
</>
)
}