2026-04-28 16:31:45 +02:00
|
|
|
import React, { useState, useEffect, useCallback } from 'react'
|
2026-04-28 19:46:09 +02:00
|
|
|
import { Link } from 'react-router-dom'
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
import api from '../utils/api'
|
|
|
|
|
import { useAuth } from '../context/AuthContext'
|
2026-04-29 06:15:26 +02:00
|
|
|
import ExercisePickerModal from '../components/ExercisePickerModal'
|
2026-04-29 06:49:16 +02:00
|
|
|
import ExercisePeekModal from '../components/ExercisePeekModal'
|
2026-05-05 13:39:30 +02:00
|
|
|
import TrainingUnitSectionsEditor from '../components/TrainingUnitSectionsEditor'
|
|
|
|
|
import {
|
|
|
|
|
defaultSection,
|
|
|
|
|
normalizeUnitToForm,
|
|
|
|
|
enrichSectionsWithVariants,
|
|
|
|
|
buildSectionsPayload,
|
2026-05-05 14:47:38 +02:00
|
|
|
hydrateExercisePlanningRow,
|
2026-05-05 13:39:30 +02:00
|
|
|
} from '../utils/trainingUnitSectionsForm'
|
2026-04-28 16:31:45 +02:00
|
|
|
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
function TrainingPlanningPage() {
|
|
|
|
|
const { user } = useAuth()
|
|
|
|
|
const [groups, setGroups] = useState([])
|
|
|
|
|
const [selectedGroupId, setSelectedGroupId] = useState('')
|
|
|
|
|
const [units, setUnits] = useState([])
|
2026-04-28 16:31:45 +02:00
|
|
|
const [planTemplates, setPlanTemplates] = useState([])
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
const [loading, setLoading] = useState(true)
|
|
|
|
|
const [showModal, setShowModal] = useState(false)
|
|
|
|
|
const [editingUnit, setEditingUnit] = useState(null)
|
2026-04-28 16:31:45 +02:00
|
|
|
const [draftPlanTemplateId, setDraftPlanTemplateId] = useState('')
|
|
|
|
|
const [quickTemplateId, setQuickTemplateId] = useState('')
|
2026-04-29 06:15:26 +02:00
|
|
|
const [exercisePickerOpen, setExercisePickerOpen] = useState(false)
|
|
|
|
|
const [exercisePickerTarget, setExercisePickerTarget] = useState(null)
|
2026-05-05 14:42:46 +02:00
|
|
|
const [planningPeekCtx, setPlanningPeekCtx] = useState(null)
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
|
|
|
|
|
const today = new Date().toISOString().split('T')[0]
|
|
|
|
|
const thirtyDaysLater = new Date(Date.now() + 30 * 24 * 60 * 60 * 1000).toISOString().split('T')[0]
|
|
|
|
|
|
|
|
|
|
const [startDate, setStartDate] = useState(today)
|
|
|
|
|
const [endDate, setEndDate] = useState(thirtyDaysLater)
|
|
|
|
|
|
|
|
|
|
const [formData, setFormData] = useState({
|
|
|
|
|
group_id: '',
|
|
|
|
|
planned_date: '',
|
|
|
|
|
planned_time_start: '',
|
|
|
|
|
planned_time_end: '',
|
|
|
|
|
planned_focus: '',
|
|
|
|
|
actual_date: '',
|
|
|
|
|
actual_time_start: '',
|
|
|
|
|
actual_time_end: '',
|
|
|
|
|
attendance_count: '',
|
|
|
|
|
status: 'planned',
|
|
|
|
|
notes: '',
|
|
|
|
|
trainer_notes: '',
|
2026-04-28 16:31:45 +02:00
|
|
|
sections: [defaultSection()]
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
loadData()
|
|
|
|
|
}, [])
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (selectedGroupId) {
|
|
|
|
|
loadUnits()
|
|
|
|
|
}
|
|
|
|
|
}, [selectedGroupId, startDate, endDate])
|
|
|
|
|
|
2026-04-28 16:31:45 +02:00
|
|
|
const loadPlanTemplates = useCallback(async () => {
|
|
|
|
|
try {
|
|
|
|
|
const tpl = await api.listTrainingPlanTemplates()
|
|
|
|
|
setPlanTemplates(tpl)
|
|
|
|
|
} catch (e) {
|
|
|
|
|
console.error('Vorlagen laden:', e)
|
|
|
|
|
}
|
|
|
|
|
}, [])
|
|
|
|
|
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
const loadData = async () => {
|
|
|
|
|
try {
|
2026-04-29 06:15:26 +02:00
|
|
|
const groupsData = await api.listTrainingGroups({ status: 'active' })
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
setGroups(groupsData)
|
2026-04-28 16:31:45 +02:00
|
|
|
await loadPlanTemplates()
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
|
|
|
|
|
if (groupsData.length > 0) {
|
2026-04-28 16:31:45 +02:00
|
|
|
const ownGroup = groupsData.find((g) => g.trainer_id === user?.id)
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
if (ownGroup) {
|
|
|
|
|
setSelectedGroupId(ownGroup.id)
|
|
|
|
|
} else if (groupsData.length === 1) {
|
|
|
|
|
setSelectedGroupId(groupsData[0].id)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('Failed to load data:', err)
|
|
|
|
|
alert('Fehler beim Laden: ' + err.message)
|
|
|
|
|
} finally {
|
|
|
|
|
setLoading(false)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const loadUnits = async () => {
|
|
|
|
|
if (!selectedGroupId) return
|
|
|
|
|
try {
|
2026-04-28 16:31:45 +02:00
|
|
|
const unitsData = await api.listTrainingUnits({
|
|
|
|
|
group_id: selectedGroupId,
|
|
|
|
|
start_date: startDate,
|
|
|
|
|
end_date: endDate
|
|
|
|
|
})
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
setUnits(unitsData)
|
|
|
|
|
} catch (err) {
|
|
|
|
|
console.error('Failed to load units:', err)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleQuickCreate = async () => {
|
|
|
|
|
if (!selectedGroupId) {
|
|
|
|
|
alert('Bitte wähle zuerst eine Trainingsgruppe')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
const date = prompt('Datum für neue Trainingseinheit (YYYY-MM-DD):', today)
|
|
|
|
|
if (!date) return
|
|
|
|
|
try {
|
2026-04-28 16:31:45 +02:00
|
|
|
const body = {
|
|
|
|
|
group_id: parseInt(selectedGroupId, 10),
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
planned_date: date
|
2026-04-28 16:31:45 +02:00
|
|
|
}
|
|
|
|
|
if (quickTemplateId) {
|
|
|
|
|
body.plan_template_id = parseInt(quickTemplateId, 10)
|
|
|
|
|
}
|
|
|
|
|
await api.quickCreateTrainingUnit(body)
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
await loadUnits()
|
|
|
|
|
} catch (err) {
|
|
|
|
|
alert('Fehler beim Erstellen: ' + err.message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleCreate = () => {
|
|
|
|
|
if (!selectedGroupId) {
|
|
|
|
|
alert('Bitte wähle zuerst eine Trainingsgruppe')
|
|
|
|
|
return
|
|
|
|
|
}
|
2026-04-28 16:31:45 +02:00
|
|
|
const group = groups.find((g) => g.id === parseInt(selectedGroupId, 10))
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
setEditingUnit(null)
|
2026-04-28 16:31:45 +02:00
|
|
|
setDraftPlanTemplateId('')
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
setFormData({
|
|
|
|
|
group_id: selectedGroupId,
|
|
|
|
|
planned_date: today,
|
|
|
|
|
planned_time_start: group?.time_start?.slice(0, 5) || '',
|
|
|
|
|
planned_time_end: group?.time_end?.slice(0, 5) || '',
|
|
|
|
|
planned_focus: '',
|
|
|
|
|
actual_date: '',
|
|
|
|
|
actual_time_start: '',
|
|
|
|
|
actual_time_end: '',
|
|
|
|
|
attendance_count: '',
|
|
|
|
|
status: 'planned',
|
|
|
|
|
notes: '',
|
|
|
|
|
trainer_notes: '',
|
2026-04-28 16:31:45 +02:00
|
|
|
sections: [defaultSection('Hauptteil')]
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
})
|
|
|
|
|
setShowModal(true)
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-28 16:31:45 +02:00
|
|
|
const applyTemplateFromSelect = async (templateId) => {
|
|
|
|
|
setDraftPlanTemplateId(templateId)
|
|
|
|
|
if (!templateId) return
|
|
|
|
|
try {
|
|
|
|
|
const tpl = await api.getTrainingPlanTemplate(parseInt(templateId, 10))
|
|
|
|
|
setFormData((fd) => ({
|
|
|
|
|
...fd,
|
|
|
|
|
sections: (tpl.sections || []).length
|
|
|
|
|
? tpl.sections.map((s) => ({
|
|
|
|
|
title: s.title,
|
|
|
|
|
guidance_notes: s.guidance_text || '',
|
|
|
|
|
items: []
|
|
|
|
|
}))
|
|
|
|
|
: [defaultSection()]
|
|
|
|
|
}))
|
|
|
|
|
} catch (err) {
|
|
|
|
|
alert('Vorlage laden: ' + err.message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
const handleEdit = async (unit) => {
|
|
|
|
|
try {
|
|
|
|
|
const fullUnit = await api.getTrainingUnit(unit.id)
|
|
|
|
|
setEditingUnit(fullUnit)
|
2026-04-28 16:31:45 +02:00
|
|
|
setDraftPlanTemplateId(fullUnit.plan_template_id ? String(fullUnit.plan_template_id) : '')
|
2026-04-29 06:15:26 +02:00
|
|
|
let sections = normalizeUnitToForm(fullUnit)
|
|
|
|
|
sections = await enrichSectionsWithVariants(sections)
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
setFormData({
|
|
|
|
|
group_id: fullUnit.group_id,
|
|
|
|
|
planned_date: fullUnit.planned_date || '',
|
|
|
|
|
planned_time_start: fullUnit.planned_time_start?.slice(0, 5) || '',
|
|
|
|
|
planned_time_end: fullUnit.planned_time_end?.slice(0, 5) || '',
|
|
|
|
|
planned_focus: fullUnit.planned_focus || '',
|
|
|
|
|
actual_date: fullUnit.actual_date || '',
|
|
|
|
|
actual_time_start: fullUnit.actual_time_start?.slice(0, 5) || '',
|
|
|
|
|
actual_time_end: fullUnit.actual_time_end?.slice(0, 5) || '',
|
2026-04-28 16:31:45 +02:00
|
|
|
attendance_count: fullUnit.attendance_count ?? '',
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
status: fullUnit.status || 'planned',
|
|
|
|
|
notes: fullUnit.notes || '',
|
|
|
|
|
trainer_notes: fullUnit.trainer_notes || '',
|
2026-04-29 06:15:26 +02:00
|
|
|
sections,
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
})
|
|
|
|
|
setShowModal(true)
|
|
|
|
|
} catch (err) {
|
|
|
|
|
alert('Fehler beim Laden: ' + err.message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-28 16:31:45 +02:00
|
|
|
const handleSaveAsTemplate = async () => {
|
|
|
|
|
const name = window.prompt('Name für die neue Trainingsvorlage (nur Abschnitts-Gliederung):')
|
|
|
|
|
if (!name?.trim()) return
|
|
|
|
|
try {
|
|
|
|
|
await api.createTrainingPlanTemplate({
|
|
|
|
|
name: name.trim(),
|
|
|
|
|
sections: formData.sections.map((s) => ({
|
|
|
|
|
title: s.title || 'Abschnitt',
|
|
|
|
|
guidance_text: s.guidance_notes?.trim() ? s.guidance_notes.trim() : null
|
|
|
|
|
}))
|
|
|
|
|
})
|
|
|
|
|
await loadPlanTemplates()
|
|
|
|
|
alert('Vorlage gespeichert.')
|
|
|
|
|
} catch (err) {
|
|
|
|
|
alert('Speichern: ' + err.message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
const handleDelete = async (unit) => {
|
|
|
|
|
if (!confirm(`Trainingseinheit vom ${unit.planned_date} wirklich löschen?`)) return
|
|
|
|
|
try {
|
|
|
|
|
await api.deleteTrainingUnit(unit.id)
|
|
|
|
|
await loadUnits()
|
|
|
|
|
} catch (err) {
|
|
|
|
|
alert('Fehler beim Löschen: ' + err.message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const handleSubmit = async (e) => {
|
|
|
|
|
e.preventDefault()
|
|
|
|
|
if (!formData.group_id || !formData.planned_date) {
|
|
|
|
|
alert('Gruppe und Datum sind Pflichtfelder')
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
try {
|
2026-04-28 16:31:45 +02:00
|
|
|
const sectionsPayload = buildSectionsPayload(formData.sections)
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
const payload = {
|
2026-04-28 16:31:45 +02:00
|
|
|
planned_date: formData.planned_date,
|
|
|
|
|
planned_time_start: formData.planned_time_start || null,
|
|
|
|
|
planned_time_end: formData.planned_time_end || null,
|
|
|
|
|
planned_focus: formData.planned_focus || null,
|
|
|
|
|
actual_date: formData.actual_date || null,
|
|
|
|
|
actual_time_start: formData.actual_time_start || null,
|
|
|
|
|
actual_time_end: formData.actual_time_end || null,
|
|
|
|
|
attendance_count: formData.attendance_count ? parseInt(formData.attendance_count, 10) : null,
|
|
|
|
|
status: formData.status || 'planned',
|
|
|
|
|
notes: formData.notes || null,
|
|
|
|
|
trainer_notes: formData.trainer_notes || null,
|
|
|
|
|
sections: sectionsPayload
|
|
|
|
|
}
|
|
|
|
|
if (!editingUnit) {
|
|
|
|
|
payload.group_id = parseInt(formData.group_id, 10)
|
|
|
|
|
if (draftPlanTemplateId) {
|
|
|
|
|
payload.plan_template_id = parseInt(draftPlanTemplateId, 10)
|
|
|
|
|
}
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (editingUnit) {
|
|
|
|
|
await api.updateTrainingUnit(editingUnit.id, payload)
|
|
|
|
|
} else {
|
|
|
|
|
await api.createTrainingUnit(payload)
|
|
|
|
|
}
|
|
|
|
|
setShowModal(false)
|
|
|
|
|
await loadUnits()
|
|
|
|
|
} catch (err) {
|
|
|
|
|
alert('Fehler beim Speichern: ' + err.message)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const updateFormField = (field, value) => {
|
2026-04-28 16:31:45 +02:00
|
|
|
setFormData((prev) => ({ ...prev, [field]: value }))
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (loading) {
|
|
|
|
|
return (
|
2026-05-05 12:39:15 +02:00
|
|
|
<div className="app-page" style={{ padding: '2rem 0', textAlign: 'center' }}>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
<div className="spinner"></div>
|
|
|
|
|
<p>Laden...</p>
|
|
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
2026-04-28 16:31:45 +02:00
|
|
|
const selectedGroup = groups.find((g) => g.id === parseInt(selectedGroupId, 10))
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
|
|
|
|
|
return (
|
2026-05-05 12:41:59 +02:00
|
|
|
<div className="app-page">
|
2026-04-28 19:46:09 +02:00
|
|
|
<h1 style={{ marginBottom: '0.35rem' }}>Trainingsplanung</h1>
|
|
|
|
|
<p style={{ color: 'var(--text2)', fontSize: '0.95rem', marginBottom: '1.25rem' }}>
|
|
|
|
|
Wähle eine Trainingsgruppe, lege dann Termine mit Inhalt (Abschnitte und Übungen) an — ein Plan entsteht aus einer oder mehreren{' '}
|
|
|
|
|
<strong>Trainingseinheiten</strong> im gewählten Zeitraum.
|
|
|
|
|
</p>
|
|
|
|
|
|
2026-05-05 09:02:13 +02:00
|
|
|
<div className="card" style={{ marginBottom: '1.25rem', padding: '12px 14px' }}>
|
|
|
|
|
<p style={{ margin: 0, 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, Slots, Übungen als Vorlage).
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
2026-04-28 19:46:09 +02:00
|
|
|
{!loading && groups.length === 0 && (
|
|
|
|
|
<div
|
|
|
|
|
className="card"
|
|
|
|
|
style={{
|
|
|
|
|
marginBottom: '1.25rem',
|
|
|
|
|
borderLeft: '4px solid var(--accent)',
|
|
|
|
|
padding: '1rem 1.25rem'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<h2 style={{ fontSize: '1.1rem', marginBottom: '0.5rem' }}>Erst Verein & Gruppe anlegen</h2>
|
|
|
|
|
<p style={{ color: 'var(--text2)', marginBottom: '0.85rem', lineHeight: 1.5 }}>
|
|
|
|
|
Ohne Trainingsgruppe kann hier nichts gebucht werden. Unter <strong>Vereine</strong> legst du einen Verein an
|
|
|
|
|
(kurzer Name genügt), optional eine Sparte, dann eine <strong>Trainingsgruppe</strong>. Wochentage, feste Zeiten oder
|
|
|
|
|
Eigenschaften sind optional und kannst du später ergänzen.
|
|
|
|
|
</p>
|
|
|
|
|
<Link to="/clubs" className="btn btn-primary" style={{ textDecoration: 'none' }}>
|
|
|
|
|
Zu Vereinen & Trainingsgruppen
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
|
|
|
|
|
<div className="card" style={{ marginBottom: '1.5rem' }}>
|
2026-04-28 16:31:45 +02:00
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: 'grid',
|
|
|
|
|
gridTemplateColumns: 'repeat(auto-fit, minmax(200px, 1fr))',
|
|
|
|
|
gap: '1rem'
|
|
|
|
|
}}
|
|
|
|
|
>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
<div>
|
|
|
|
|
<label className="form-label">Trainingsgruppe</label>
|
|
|
|
|
<select
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={selectedGroupId}
|
|
|
|
|
onChange={(e) => setSelectedGroupId(e.target.value)}
|
|
|
|
|
>
|
|
|
|
|
<option value="">Bitte wählen</option>
|
2026-04-28 16:31:45 +02:00
|
|
|
{groups.map((g) => (
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
<option key={g.id} value={g.id}>
|
|
|
|
|
{g.name} ({g.club_name})
|
|
|
|
|
</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="form-label">Von</label>
|
|
|
|
|
<input
|
|
|
|
|
type="date"
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={startDate}
|
|
|
|
|
onChange={(e) => setStartDate(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div>
|
|
|
|
|
<label className="form-label">Bis</label>
|
|
|
|
|
<input
|
|
|
|
|
type="date"
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={endDate}
|
|
|
|
|
onChange={(e) => setEndDate(e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{selectedGroup && (
|
2026-04-28 16:31:45 +02:00
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
marginTop: '1rem',
|
|
|
|
|
padding: '1rem',
|
|
|
|
|
background: 'var(--surface2)',
|
|
|
|
|
borderRadius: '8px'
|
|
|
|
|
}}
|
|
|
|
|
>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
<p style={{ fontSize: '0.875rem', color: 'var(--text2)' }}>
|
2026-04-28 16:31:45 +02:00
|
|
|
{selectedGroup.location || 'Kein Ort angegeben'}
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
{selectedGroup.weekday && ` · ${selectedGroup.weekday}`}
|
2026-04-28 16:31:45 +02:00
|
|
|
{selectedGroup.time_start &&
|
|
|
|
|
` · ${selectedGroup.time_start.slice(0, 5)} - ${selectedGroup.time_end?.slice(0, 5)}`}
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
2026-04-28 16:31:45 +02:00
|
|
|
<div
|
|
|
|
|
style={{
|
2026-04-28 19:46:09 +02:00
|
|
|
marginTop: '1.25rem',
|
|
|
|
|
paddingTop: '1rem',
|
|
|
|
|
borderTop: '1px solid var(--border, rgba(0,0,0,0.08))'
|
2026-04-28 16:31:45 +02:00
|
|
|
}}
|
|
|
|
|
>
|
2026-04-28 19:46:09 +02:00
|
|
|
<p style={{ fontSize: '0.88rem', color: 'var(--text2)', marginBottom: '0.75rem' }}>
|
|
|
|
|
<strong>Plan anlegen:</strong> neue Trainingseinheit mit Datum, Zeit und Ablauf — oder schnell nur mit Datum (Zeiten aus der Gruppe).
|
|
|
|
|
{!selectedGroupId && (
|
|
|
|
|
<span style={{ display: 'block', marginTop: '0.35rem' }}>
|
|
|
|
|
Wähle oben eine Trainingsgruppe, um die Schaltflächen zu aktivieren.
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
{groups.length === 0 && (
|
|
|
|
|
<span style={{ display: 'block', marginTop: '0.35rem' }}>
|
|
|
|
|
Es gibt noch keine aktive Trainingsgruppe — unter{' '}
|
|
|
|
|
<Link to="/clubs">
|
|
|
|
|
Vereine
|
|
|
|
|
</Link>{' '}
|
|
|
|
|
anlegen oder aktivieren.
|
|
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</p>
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: 'flex',
|
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
|
gap: '0.5rem',
|
|
|
|
|
alignItems: 'center'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
className="btn btn-primary"
|
|
|
|
|
disabled={!selectedGroupId}
|
|
|
|
|
title={!selectedGroupId ? 'Zuerst eine Trainingsgruppe wählen' : undefined}
|
|
|
|
|
onClick={handleCreate}
|
2026-04-28 16:31:45 +02:00
|
|
|
>
|
2026-04-28 19:46:09 +02:00
|
|
|
+ Neue Trainingseinheit planen
|
2026-04-28 16:31:45 +02:00
|
|
|
</button>
|
2026-04-28 19:46:09 +02:00
|
|
|
<div style={{ display: 'flex', alignItems: 'center', gap: '0.5rem', flexWrap: 'wrap' }}>
|
|
|
|
|
<label className="form-label" style={{ marginBottom: 0 }}>
|
|
|
|
|
Schnell (+ optional Vorlage):
|
|
|
|
|
</label>
|
|
|
|
|
<select
|
|
|
|
|
className="form-input"
|
|
|
|
|
style={{ minWidth: '180px', marginBottom: 0 }}
|
|
|
|
|
value={quickTemplateId}
|
|
|
|
|
onChange={(e) => setQuickTemplateId(e.target.value)}
|
|
|
|
|
disabled={!selectedGroupId}
|
|
|
|
|
title={!selectedGroupId ? 'Zuerst Trainingsgruppe wählen' : undefined}
|
|
|
|
|
>
|
|
|
|
|
<option value="">Standard (leer)</option>
|
|
|
|
|
{planTemplates.map((t) => (
|
|
|
|
|
<option key={t.id} value={String(t.id)}>
|
|
|
|
|
{t.name}
|
|
|
|
|
{typeof t.sections_count === 'number' ? ` (${t.sections_count} Abschn.)` : ''}
|
|
|
|
|
</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
|
|
|
|
<button
|
|
|
|
|
type="button"
|
|
|
|
|
className="btn btn-secondary"
|
|
|
|
|
disabled={!selectedGroupId}
|
|
|
|
|
title={!selectedGroupId ? 'Zuerst eine Trainingsgruppe wählen' : undefined}
|
|
|
|
|
onClick={handleQuickCreate}
|
|
|
|
|
>
|
|
|
|
|
Schnell erstellen
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
2026-04-28 16:31:45 +02:00
|
|
|
</div>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
</div>
|
2026-04-28 19:46:09 +02:00
|
|
|
</div>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
|
|
|
|
|
{!selectedGroupId ? (
|
|
|
|
|
<div className="card">
|
|
|
|
|
<p style={{ color: 'var(--text2)', textAlign: 'center' }}>
|
2026-04-28 19:46:09 +02:00
|
|
|
Wähle oben eine Trainingsgruppe — danach kannst du mit <strong>„Neue Trainingseinheit planen“</strong> starten.
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
) : units.length === 0 ? (
|
|
|
|
|
<div className="card">
|
|
|
|
|
<p style={{ color: 'var(--text2)', textAlign: 'center' }}>
|
2026-04-28 19:46:09 +02:00
|
|
|
Keine Trainingseinheiten in diesem Zeitraum. Nutze oben <strong>„Neue Trainingseinheit planen“</strong> oder{' '}
|
|
|
|
|
<strong>„Schnell erstellen“</strong>, um den ersten Termin anzulegen.
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
) : (
|
|
|
|
|
<div style={{ display: 'grid', gap: '1rem' }}>
|
2026-04-28 16:31:45 +02:00
|
|
|
{units.map((unit) => (
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
<div key={unit.id} className="card">
|
2026-04-28 16:31:45 +02:00
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: 'flex',
|
2026-05-05 12:39:15 +02:00
|
|
|
flexWrap: 'wrap',
|
2026-04-28 16:31:45 +02:00
|
|
|
justifyContent: 'space-between',
|
2026-05-05 12:39:15 +02:00
|
|
|
alignItems: 'flex-start',
|
|
|
|
|
gap: '12px',
|
2026-04-28 16:31:45 +02:00
|
|
|
marginBottom: '1rem'
|
|
|
|
|
}}
|
|
|
|
|
>
|
2026-05-05 12:39:15 +02:00
|
|
|
<div style={{ minWidth: 0, flex: '1 1 200px' }}>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
<h3 style={{ marginBottom: '0.25rem' }}>
|
|
|
|
|
{unit.planned_date}
|
2026-04-28 16:31:45 +02:00
|
|
|
{unit.planned_time_start &&
|
|
|
|
|
` · ${unit.planned_time_start.slice(0, 5)} - ${unit.planned_time_end?.slice(0, 5)}`}
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
</h3>
|
|
|
|
|
{unit.planned_focus && (
|
2026-04-28 16:31:45 +02:00
|
|
|
<p
|
|
|
|
|
style={{
|
|
|
|
|
color: 'var(--text2)',
|
|
|
|
|
fontSize: '0.875rem',
|
|
|
|
|
marginBottom: '0.5rem'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
Fokus: {unit.planned_focus}
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
<div style={{ display: 'flex', gap: '0.5rem', flexWrap: 'wrap' }}>
|
2026-04-28 16:31:45 +02:00
|
|
|
<span
|
|
|
|
|
style={{
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
fontSize: '0.75rem',
|
|
|
|
|
padding: '0.25rem 0.5rem',
|
|
|
|
|
borderRadius: '4px',
|
2026-04-28 16:31:45 +02:00
|
|
|
background:
|
|
|
|
|
unit.status === 'completed'
|
|
|
|
|
? '#2ea44f'
|
|
|
|
|
: unit.status === 'cancelled'
|
|
|
|
|
? 'var(--danger)'
|
|
|
|
|
: 'var(--surface2)',
|
|
|
|
|
color:
|
|
|
|
|
unit.status === 'completed' || unit.status === 'cancelled'
|
|
|
|
|
? 'white'
|
|
|
|
|
: 'var(--text2)'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{unit.status === 'planned' && 'Geplant'}
|
|
|
|
|
{unit.status === 'completed' && 'Durchgeführt'}
|
|
|
|
|
{unit.status === 'cancelled' && 'Abgesagt'}
|
|
|
|
|
</span>
|
|
|
|
|
{unit.attendance_count !== null && unit.attendance_count !== undefined && (
|
|
|
|
|
<span
|
|
|
|
|
style={{
|
|
|
|
|
fontSize: '0.75rem',
|
|
|
|
|
padding: '0.25rem 0.5rem',
|
|
|
|
|
borderRadius: '4px',
|
|
|
|
|
background: 'var(--surface2)',
|
|
|
|
|
color: 'var(--text2)'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
{unit.attendance_count} Teilnehmer
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
</span>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-05-05 12:39:15 +02:00
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
display: 'flex',
|
|
|
|
|
gap: '0.5rem',
|
|
|
|
|
flexWrap: 'wrap',
|
|
|
|
|
justifyContent: 'flex-end',
|
|
|
|
|
flex: '1 1 180px',
|
|
|
|
|
minWidth: 0
|
|
|
|
|
}}
|
|
|
|
|
>
|
2026-04-29 06:37:52 +02:00
|
|
|
<Link
|
|
|
|
|
to={`/planning/run/${unit.id}`}
|
|
|
|
|
className="btn btn-secondary"
|
|
|
|
|
style={{ textDecoration: 'none', display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}
|
|
|
|
|
>
|
|
|
|
|
Plan & Ablauf
|
|
|
|
|
</Link>
|
2026-04-29 06:49:16 +02:00
|
|
|
<Link
|
|
|
|
|
to={`/planning/run/${unit.id}/coach`}
|
|
|
|
|
className="btn btn-primary"
|
|
|
|
|
style={{ textDecoration: 'none', display: 'inline-flex', alignItems: 'center', justifyContent: 'center' }}
|
|
|
|
|
>
|
|
|
|
|
Im Training (Coach)
|
|
|
|
|
</Link>
|
2026-04-28 16:31:45 +02:00
|
|
|
<button className="btn btn-secondary" onClick={() => handleEdit(unit)}>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
Bearbeiten
|
|
|
|
|
</button>
|
|
|
|
|
<button
|
|
|
|
|
className="btn"
|
2026-04-28 16:31:45 +02:00
|
|
|
style={{ background: 'var(--danger)', color: 'white', border: 'none' }}
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
onClick={() => handleDelete(unit)}
|
|
|
|
|
>
|
|
|
|
|
Löschen
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
{unit.notes && (
|
|
|
|
|
<p style={{ color: 'var(--text2)', fontSize: '0.875rem', marginTop: '0.5rem' }}>
|
2026-04-28 16:31:45 +02:00
|
|
|
{unit.notes}
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
</p>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
{showModal && (
|
2026-04-28 16:31:45 +02:00
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
position: 'fixed',
|
|
|
|
|
top: 0,
|
|
|
|
|
left: 0,
|
|
|
|
|
right: 0,
|
|
|
|
|
bottom: 0,
|
|
|
|
|
background: 'rgba(0,0,0,0.5)',
|
|
|
|
|
display: 'flex',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
zIndex: 1000,
|
|
|
|
|
padding: '1rem',
|
|
|
|
|
overflowY: 'auto'
|
|
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
style={{
|
|
|
|
|
background: 'var(--surface)',
|
|
|
|
|
borderRadius: '12px',
|
2026-05-05 12:39:15 +02:00
|
|
|
padding: 'clamp(12px, 3vw, 2rem)',
|
2026-05-05 14:47:38 +02:00
|
|
|
maxWidth: 'min(1100px, 100%)',
|
2026-04-28 16:31:45 +02:00
|
|
|
width: '100%',
|
|
|
|
|
maxHeight: '92vh',
|
|
|
|
|
overflowY: 'auto',
|
2026-05-05 12:39:15 +02:00
|
|
|
margin: 'max(0px, env(safe-area-inset-top, 0px)) auto',
|
|
|
|
|
boxSizing: 'border-box',
|
|
|
|
|
minWidth: 0
|
2026-04-28 16:31:45 +02:00
|
|
|
}}
|
|
|
|
|
>
|
|
|
|
|
<h2 style={{ marginBottom: '1rem' }}>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
{editingUnit ? 'Trainingseinheit bearbeiten' : 'Neue Trainingseinheit'}
|
|
|
|
|
</h2>
|
|
|
|
|
|
2026-04-28 16:31:45 +02:00
|
|
|
{!editingUnit && (
|
|
|
|
|
<div className="form-row" style={{ marginBottom: '1.25rem' }}>
|
|
|
|
|
<label className="form-label">Gliederungsvorlage (optional)</label>
|
|
|
|
|
<select
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={draftPlanTemplateId}
|
|
|
|
|
onChange={(e) => applyTemplateFromSelect(e.target.value)}
|
|
|
|
|
>
|
|
|
|
|
<option value="">Keine Vorlage</option>
|
|
|
|
|
{planTemplates.map((t) => (
|
|
|
|
|
<option key={t.id} value={String(t.id)}>
|
|
|
|
|
{t.name}
|
|
|
|
|
</option>
|
|
|
|
|
))}
|
|
|
|
|
</select>
|
|
|
|
|
<p style={{ fontSize: '0.8rem', color: 'var(--text2)', marginTop: '0.35rem' }}>
|
|
|
|
|
Lädt die Abschnitte und Hinweise aus der Vorlage; Übungen fügst du hier ein.
|
|
|
|
|
</p>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
|
|
|
|
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
<form onSubmit={handleSubmit}>
|
|
|
|
|
<h3 style={{ marginBottom: '1rem' }}>Planung</h3>
|
|
|
|
|
|
2026-05-05 12:39:15 +02:00
|
|
|
<div className="responsive-grid-3" style={{ marginBottom: '1rem' }}>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
<div className="form-row">
|
|
|
|
|
<label className="form-label">Datum *</label>
|
|
|
|
|
<input
|
|
|
|
|
type="date"
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={formData.planned_date}
|
|
|
|
|
onChange={(e) => updateFormField('planned_date', e.target.value)}
|
|
|
|
|
required
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-row">
|
|
|
|
|
<label className="form-label">Von</label>
|
|
|
|
|
<input
|
|
|
|
|
type="time"
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={formData.planned_time_start}
|
|
|
|
|
onChange={(e) => updateFormField('planned_time_start', e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-row">
|
|
|
|
|
<label className="form-label">Bis</label>
|
|
|
|
|
<input
|
|
|
|
|
type="time"
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={formData.planned_time_end}
|
|
|
|
|
onChange={(e) => updateFormField('planned_time_end', e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-row">
|
|
|
|
|
<label className="form-label">Trainingsfokus</label>
|
|
|
|
|
<input
|
|
|
|
|
type="text"
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={formData.planned_focus}
|
|
|
|
|
onChange={(e) => updateFormField('planned_focus', e.target.value)}
|
2026-04-28 16:31:45 +02:00
|
|
|
placeholder="z.B. Grundlagen, Kinder altersgerecht"
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
2026-05-05 14:47:38 +02:00
|
|
|
<div style={{ marginTop: '2rem' }}>
|
2026-05-05 13:39:30 +02:00
|
|
|
<TrainingUnitSectionsEditor
|
2026-05-05 14:47:38 +02:00
|
|
|
heading="Abschnitte & Übungen"
|
|
|
|
|
headingAccessory={
|
|
|
|
|
<button type="button" className="btn btn-secondary" onClick={handleSaveAsTemplate}>
|
|
|
|
|
Vorlage aus Aufbau speichern
|
|
|
|
|
</button>
|
|
|
|
|
}
|
2026-05-05 13:39:30 +02:00
|
|
|
sections={formData.sections}
|
2026-05-05 14:47:38 +02:00
|
|
|
wideExerciseGrid
|
2026-05-05 13:39:30 +02:00
|
|
|
onSectionsChange={(updater) =>
|
|
|
|
|
setFormData((prev) => ({
|
|
|
|
|
...prev,
|
|
|
|
|
sections: updater(prev.sections),
|
|
|
|
|
}))
|
|
|
|
|
}
|
2026-05-05 14:52:19 +02:00
|
|
|
onRequestExercisePick={({ sectionIndex, itemIndex }) => {
|
2026-05-05 14:42:46 +02:00
|
|
|
setExercisePickerTarget({
|
|
|
|
|
sIdx: sectionIndex,
|
|
|
|
|
iIdx: typeof itemIndex === 'number' ? itemIndex : undefined,
|
|
|
|
|
})
|
2026-05-05 13:39:30 +02:00
|
|
|
setExercisePickerOpen(true)
|
|
|
|
|
}}
|
2026-05-05 14:42:46 +02:00
|
|
|
onPeekExercise={(id, variantId) =>
|
|
|
|
|
setPlanningPeekCtx({ exerciseId: id, variantId: variantId ?? null })
|
|
|
|
|
}
|
2026-05-05 13:39:30 +02:00
|
|
|
showExecutionExtras={!!editingUnit}
|
|
|
|
|
/>
|
2026-05-05 14:47:38 +02:00
|
|
|
</div>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
|
2026-05-05 13:39:30 +02:00
|
|
|
<div style={{ marginBottom: '1.75rem' }} />
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
|
|
|
|
|
{editingUnit && (
|
|
|
|
|
<>
|
2026-04-28 16:31:45 +02:00
|
|
|
<h3 style={{ marginTop: '0.5rem', marginBottom: '1rem' }}>Durchführung</h3>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
|
2026-05-05 12:39:15 +02:00
|
|
|
<div className="responsive-grid-4" style={{ marginBottom: '1rem' }}>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
<div className="form-row">
|
|
|
|
|
<label className="form-label">Tatsächliches Datum</label>
|
|
|
|
|
<input
|
|
|
|
|
type="date"
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={formData.actual_date}
|
|
|
|
|
onChange={(e) => updateFormField('actual_date', e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-row">
|
|
|
|
|
<label className="form-label">Von</label>
|
|
|
|
|
<input
|
|
|
|
|
type="time"
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={formData.actual_time_start}
|
|
|
|
|
onChange={(e) => updateFormField('actual_time_start', e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-row">
|
|
|
|
|
<label className="form-label">Bis</label>
|
|
|
|
|
<input
|
|
|
|
|
type="time"
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={formData.actual_time_end}
|
|
|
|
|
onChange={(e) => updateFormField('actual_time_end', e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-row">
|
|
|
|
|
<label className="form-label">Teilnehmer</label>
|
|
|
|
|
<input
|
|
|
|
|
type="number"
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={formData.attendance_count}
|
|
|
|
|
onChange={(e) => updateFormField('attendance_count', e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-row">
|
|
|
|
|
<label className="form-label">Status</label>
|
|
|
|
|
<select
|
|
|
|
|
className="form-input"
|
|
|
|
|
value={formData.status}
|
|
|
|
|
onChange={(e) => updateFormField('status', e.target.value)}
|
|
|
|
|
>
|
|
|
|
|
<option value="planned">Geplant</option>
|
|
|
|
|
<option value="completed">Durchgeführt</option>
|
|
|
|
|
<option value="cancelled">Abgesagt</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
|
|
|
|
|
<h3 style={{ marginTop: '2rem', marginBottom: '1rem' }}>Notizen</h3>
|
|
|
|
|
|
|
|
|
|
<div className="form-row">
|
|
|
|
|
<label className="form-label">Öffentliche Notizen</label>
|
|
|
|
|
<textarea
|
|
|
|
|
className="form-input"
|
|
|
|
|
rows={3}
|
|
|
|
|
value={formData.notes}
|
|
|
|
|
onChange={(e) => updateFormField('notes', e.target.value)}
|
2026-04-28 16:31:45 +02:00
|
|
|
placeholder="Für Teilnehmer"
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div className="form-row">
|
|
|
|
|
<label className="form-label">Trainernotizen</label>
|
|
|
|
|
<textarea
|
|
|
|
|
className="form-input"
|
|
|
|
|
rows={3}
|
|
|
|
|
value={formData.trainer_notes}
|
|
|
|
|
onChange={(e) => updateFormField('trainer_notes', e.target.value)}
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
<div style={{ display: 'flex', gap: '0.5rem', marginTop: '1.5rem' }}>
|
|
|
|
|
<button type="submit" className="btn btn-primary" style={{ flex: 1 }}>
|
|
|
|
|
{editingUnit ? 'Speichern' : 'Erstellen'}
|
|
|
|
|
</button>
|
2026-04-28 16:31:45 +02:00
|
|
|
<button type="button" className="btn btn-secondary" onClick={() => setShowModal(false)}>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
Abbrechen
|
|
|
|
|
</button>
|
|
|
|
|
</div>
|
|
|
|
|
</form>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
)}
|
2026-04-29 06:15:26 +02:00
|
|
|
<ExercisePickerModal
|
|
|
|
|
open={exercisePickerOpen}
|
2026-05-05 14:52:19 +02:00
|
|
|
multiSelect
|
2026-04-29 06:15:26 +02:00
|
|
|
onClose={() => {
|
|
|
|
|
setExercisePickerOpen(false)
|
|
|
|
|
setExercisePickerTarget(null)
|
|
|
|
|
}}
|
2026-05-05 14:52:19 +02:00
|
|
|
onSelectExercises={async (picked) => {
|
|
|
|
|
if (!exercisePickerTarget || !picked?.length) return
|
|
|
|
|
const rows = []
|
|
|
|
|
for (const ex of picked) {
|
|
|
|
|
const row = await hydrateExercisePlanningRow(ex)
|
|
|
|
|
if (row) rows.push(row)
|
|
|
|
|
}
|
|
|
|
|
if (!rows.length) return
|
2026-04-29 06:15:26 +02:00
|
|
|
const { sIdx, iIdx } = exercisePickerTarget
|
|
|
|
|
setFormData((prev) => ({
|
|
|
|
|
...prev,
|
2026-05-05 14:52:19 +02:00
|
|
|
sections: prev.sections.map((s, si) => {
|
|
|
|
|
if (si !== sIdx) return s
|
|
|
|
|
const items = [...(s.items || [])]
|
|
|
|
|
if (typeof iIdx === 'number') {
|
|
|
|
|
const cur = items[iIdx]
|
|
|
|
|
if (!cur || cur.item_type !== 'exercise') return s
|
|
|
|
|
const [first, ...tail] = rows
|
|
|
|
|
items[iIdx] = {
|
|
|
|
|
...cur,
|
|
|
|
|
exercise_id: first.exercise_id,
|
|
|
|
|
exercise_variant_id: first.exercise_variant_id,
|
|
|
|
|
exercise_title: first.exercise_title,
|
|
|
|
|
variants: first.variants,
|
|
|
|
|
}
|
|
|
|
|
if (tail.length) items.splice(iIdx + 1, 0, ...tail)
|
|
|
|
|
return { ...s, items }
|
|
|
|
|
}
|
|
|
|
|
return { ...s, items: [...items, ...rows] }
|
|
|
|
|
}),
|
2026-04-29 06:15:26 +02:00
|
|
|
}))
|
|
|
|
|
setExercisePickerOpen(false)
|
|
|
|
|
setExercisePickerTarget(null)
|
|
|
|
|
}}
|
|
|
|
|
/>
|
2026-04-29 06:49:16 +02:00
|
|
|
<ExercisePeekModal
|
2026-05-05 14:42:46 +02:00
|
|
|
open={planningPeekCtx != null}
|
|
|
|
|
exerciseId={planningPeekCtx?.exerciseId}
|
|
|
|
|
variantId={planningPeekCtx?.variantId ?? undefined}
|
|
|
|
|
onClose={() => setPlanningPeekCtx(null)}
|
2026-04-29 06:49:16 +02:00
|
|
|
/>
|
feat: Training Planning (core feature) complete
Backend:
- Created migration 006_training_planning.sql
- training_units table (planned vs actual, status, notes)
- training_unit_exercises M:N (order, duration, modifications)
- Created routers/training_planning.py with full CRUD
- List with filters (group, date range, status)
- Get detail with exercises
- Create/Update/Delete with access control
- Quick create endpoint (auto-fills from group defaults)
- Permission: trainer for own groups, admin for all
- Registered training_planning router in main.py
Frontend:
- Complete TrainingPlanningPage with full planning workflow
- Group selector + date range picker
- List view with status badges (planned/completed/cancelled)
- Create/Edit modal with exercise management
- Drag to reorder exercises (▲▼)
- Quick create button (one-click with group defaults)
- Durchführung section (actual date/time, attendance, status)
- Public notes + trainer-only notes
- Updated api.js with deleteTrainingUnit and quickCreateTrainingUnit
- Added /planning route to App.jsx
- Navigation already configured (Calendar icon)
This is the CORE feature - trainers can now plan and document training sessions.
Next: Admin routes, role system refinement, testing
2026-04-22 16:54:34 +02:00
|
|
|
</div>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default TrainingPlanningPage
|