Add delete functionality for training plan templates
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m22s
Deploy Development / deploy (push) Successful in 39s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 12s
Test Suite / k6 /health Baseline (push) Successful in 33s
Test Suite / playwright-tests (push) Successful in 1m22s
This commit is contained in:
1 parent
c3eb5a62c4
commit
e441f59bff
2 files changed
+89
No files matched your search
@@ -658,6 +658,29 @@ 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('')
|
||||
@@ -1924,6 +1947,7 @@ function TrainingPlanningPageRoot() {
|
||||
draftPlanTemplateId={draftPlanTemplateId}
|
||||
onDraftTemplateSelect={applyTemplateFromSelect}
|
||||
planTemplates={planTemplates}
|
||||
onDeletePlanTemplate={handleDeletePlanTemplate}
|
||||
clubDirectory={clubDirectory}
|
||||
clubDirectoryForCo={clubDirectoryForCo}
|
||||
planningModalClubId={planningModalClubId}
|
||||
|
||||
Reference in new issue
Block a user