feat: update application version to 0.8.37 and enhance training planning features
Deploy Development / deploy (push) Failing after 14s
Test Suite / pytest-backend (push) Successful in 5s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 2s
Test Suite / playwright-tests (push) Successful in 23s
Deploy Development / deploy (push) Failing after 14s
Test Suite / pytest-backend (push) Successful in 5s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Failing after 2s
Test Suite / playwright-tests (push) Successful in 23s
- Bumped application version to 0.8.37 in both backend and frontend files. - Updated training planning API to include new session assignment features, allowing for lead trainer and assistant trainer assignments. - Enhanced the TrainingPlanningPage to support dynamic loading of club member directories based on selected groups. - Improved validation for trainer assignments, ensuring only active club members can be assigned as trainers. - Updated changelog to reflect the new version and changes made in this release.
This commit is contained in:
1 parent
14745b347d
commit
c778d21b26
10 files changed
+597
-91
No files matched your search
@@ -153,11 +153,12 @@ function Dashboard() {
|
||||
</ul>
|
||||
) : (
|
||||
<p style={{ color: 'var(--text2)', fontSize: '0.9rem', margin: 0 }}>
|
||||
Keine anstehenden Termine mit dir als Leitung oder Co‑Trainer. Unter{' '}
|
||||
Keine anstehenden Termine, bei denen du als Leitung oder Co-Trainer dieser Einheit eingetragen
|
||||
bist. Unter{' '}
|
||||
<Link to="/planning" style={{ color: 'var(--accent-dark)' }}>
|
||||
Trainingsplanung
|
||||
</Link>{' '}
|
||||
kannst du den Vereins‑ oder Gruppen‑Zeitraum einblenden.
|
||||
kannst du Zeiträume und Zuordnungen bearbeiten.
|
||||
</p>
|
||||
)}
|
||||
</div>
|
||||
|
||||
@@ -72,6 +72,21 @@ function enumerateIsoDays(fromIso, toIso) {
|
||||
|
||||
const WEEKDAYS_DE = ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So']
|
||||
|
||||
function toNumList(arr) {
|
||||
if (!Array.isArray(arr)) return []
|
||||
const out = []
|
||||
for (const x of arr) {
|
||||
const n = Number(x)
|
||||
if (Number.isFinite(n) && n >= 1) out.push(n)
|
||||
}
|
||||
return out
|
||||
}
|
||||
|
||||
const sessionAssignDefaults = () => ({
|
||||
lead_trainer_profile_id: '',
|
||||
session_assistants_inherit: true,
|
||||
session_assistant_profile_ids: [],
|
||||
})
|
||||
function TrainingPlanningPage() {
|
||||
const { user } = useAuth()
|
||||
const [groups, setGroups] = useState([])
|
||||
@@ -107,6 +122,7 @@ function TrainingPlanningPage() {
|
||||
const [calendarMonthStr, setCalendarMonthStr] = useState(() => today.slice(0, 7))
|
||||
const [planScope, setPlanScope] = useState('group')
|
||||
const [assignedToMeOnly, setAssignedToMeOnly] = useState(false)
|
||||
const [clubDirectory, setClubDirectory] = useState([])
|
||||
|
||||
const [formData, setFormData] = useState({
|
||||
group_id: '',
|
||||
@@ -121,7 +137,8 @@ function TrainingPlanningPage() {
|
||||
status: 'planned',
|
||||
notes: '',
|
||||
trainer_notes: '',
|
||||
sections: [defaultSection()]
|
||||
sections: [defaultSection()],
|
||||
...sessionAssignDefaults()
|
||||
})
|
||||
|
||||
const loadPlanTemplates = useCallback(async () => {
|
||||
@@ -206,6 +223,39 @@ function TrainingPlanningPage() {
|
||||
}
|
||||
}, [selectedGroupId, loadUnits])
|
||||
|
||||
useEffect(() => {
|
||||
if (!showModal) {
|
||||
setClubDirectory([])
|
||||
return undefined
|
||||
}
|
||||
const gid = parseInt(formData.group_id || selectedGroupId || '0', 10)
|
||||
if (!Number.isFinite(gid) || gid < 1) {
|
||||
setClubDirectory([])
|
||||
return undefined
|
||||
}
|
||||
const g = groups.find((x) => x.id === gid)
|
||||
const cid = g?.club_id
|
||||
if (!cid) {
|
||||
setClubDirectory([])
|
||||
return undefined
|
||||
}
|
||||
let cancelled = false
|
||||
;(async () => {
|
||||
try {
|
||||
const d = await api.clubMembersDirectory(cid)
|
||||
if (!cancelled) setClubDirectory(Array.isArray(d) ? d : [])
|
||||
} catch (err) {
|
||||
if (!cancelled) {
|
||||
console.error('Mitgliederverzeichnis:', err)
|
||||
setClubDirectory([])
|
||||
}
|
||||
}
|
||||
})()
|
||||
return () => {
|
||||
cancelled = true
|
||||
}
|
||||
}, [showModal, formData.group_id, selectedGroupId, groups])
|
||||
|
||||
useEffect(() => {
|
||||
if (!frameworkImportOpen) return
|
||||
let cancelled = false
|
||||
@@ -380,7 +430,8 @@ function TrainingPlanningPage() {
|
||||
status: 'planned',
|
||||
notes: '',
|
||||
trainer_notes: '',
|
||||
sections: [defaultSection('Hauptteil')]
|
||||
sections: [defaultSection('Hauptteil')],
|
||||
...sessionAssignDefaults()
|
||||
})
|
||||
setShowModal(true)
|
||||
}
|
||||
@@ -406,12 +457,9 @@ function TrainingPlanningPage() {
|
||||
status: 'planned',
|
||||
notes: '',
|
||||
trainer_notes: '',
|
||||
sections: [defaultSection('Hauptteil')]
|
||||
})
|
||||
setShowModal(true)
|
||||
}
|
||||
|
||||
const applyTemplateFromSelect = async (templateId) => {
|
||||
sections: [defaultSection('Hauptteil')],
|
||||
...sessionAssignDefaults()
|
||||
}) = async (templateId) => {
|
||||
setDraftPlanTemplateId(templateId)
|
||||
if (!templateId) return
|
||||
try {
|
||||
@@ -452,6 +500,14 @@ function TrainingPlanningPage() {
|
||||
notes: fullUnit.notes || '',
|
||||
trainer_notes: fullUnit.trainer_notes || '',
|
||||
sections,
|
||||
lead_trainer_profile_id:
|
||||
fullUnit.lead_trainer_profile_id != null && fullUnit.lead_trainer_profile_id !== ''
|
||||
? String(fullUnit.lead_trainer_profile_id)
|
||||
: '',
|
||||
session_assistants_inherit:
|
||||
fullUnit.assistant_trainer_profile_ids == null ||
|
||||
fullUnit.assistant_trainer_profile_ids === undefined,
|
||||
session_assistant_profile_ids: toNumList(fullUnit.assistant_trainer_profile_ids),
|
||||
})
|
||||
setShowModal(true)
|
||||
} catch (err) {
|
||||
@@ -519,6 +575,19 @@ function TrainingPlanningPage() {
|
||||
trainer_notes: formData.trainer_notes || null,
|
||||
sections: sectionsPayload
|
||||
}
|
||||
const leadStr = String(formData.lead_trainer_profile_id || '').trim()
|
||||
if (leadStr) {
|
||||
payload.lead_trainer_profile_id = parseInt(leadStr, 10)
|
||||
} else if (editingUnit) {
|
||||
payload.lead_trainer_profile_id = null
|
||||
}
|
||||
if (formData.session_assistants_inherit) {
|
||||
if (editingUnit) payload.assistant_trainer_profile_ids = null
|
||||
} else {
|
||||
payload.assistant_trainer_profile_ids = [...formData.session_assistant_profile_ids].sort(
|
||||
(a, b) => a - b
|
||||
)
|
||||
}
|
||||
if (!editingUnit) {
|
||||
payload.group_id = parseInt(formData.group_id, 10)
|
||||
if (draftPlanTemplateId) {
|
||||
@@ -1189,6 +1258,28 @@ function TrainingPlanningPage() {
|
||||
<p style={{ fontSize: '0.82rem', color: 'var(--text2)', margin: '0 0 0.5rem' }}>
|
||||
Leitung: {(unit.lead_trainer_name || '').trim() || '—'}
|
||||
</p>
|
||||
{(() => {
|
||||
const coRaw = unit.effective_assistant_trainer_profile_ids
|
||||
const co = Array.isArray(coRaw)
|
||||
? coRaw.map(Number).filter((x) => Number.isFinite(x) && x >= 1)
|
||||
: []
|
||||
if (!co.length) return null
|
||||
const src =
|
||||
unit.assistant_trainer_profile_ids != null
|
||||
? 'Session-Zuweisung'
|
||||
: 'über Trainingsgruppe'
|
||||
return (
|
||||
<p
|
||||
style={{
|
||||
fontSize: '0.78rem',
|
||||
color: 'var(--text3)',
|
||||
margin: '0 0 0.5rem',
|
||||
}}
|
||||
>
|
||||
Co-Trainer ({src}): {co.length}
|
||||
</p>
|
||||
)
|
||||
})()}
|
||||
{unit.planned_focus && (
|
||||
<p
|
||||
style={{
|
||||
@@ -1643,6 +1734,98 @@ function TrainingPlanningPage() {
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div
|
||||
className="card"
|
||||
style={{
|
||||
marginTop: '1.25rem',
|
||||
marginBottom: '0.25rem',
|
||||
padding: '12px 14px',
|
||||
background: 'var(--surface2)',
|
||||
}}
|
||||
>
|
||||
<h3 style={{ margin: '0 0 10px', fontSize: '1rem' }}>Trainerzuordnung (diese Einheit)</h3>
|
||||
<div className="form-row">
|
||||
<label className="form-label">Leitung</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={formData.lead_trainer_profile_id}
|
||||
onChange={(e) => updateFormField('lead_trainer_profile_id', e.target.value)}
|
||||
disabled={!editingUnit && !formData.group_id}
|
||||
>
|
||||
<option value="">Standard (Haupttrainer der Gruppe)</option>
|
||||
{clubDirectory.map((m) => {
|
||||
const idStr = String(m.id)
|
||||
return (
|
||||
<option key={idStr} value={idStr}>
|
||||
{(m.name || '').trim() || m.email || `Profil ${m.id}`}
|
||||
</option>
|
||||
)
|
||||
})}
|
||||
</select>
|
||||
<p style={{ fontSize: '0.8rem', color: 'var(--text2)', marginTop: '0.35rem', lineHeight: 1.45 }}>
|
||||
Für Vertretungen genügt in der Regel die Vereinsmitgliedschaft; Zuweisen dürfen u. a.
|
||||
Haupt-/Co‑Trainer dieser Gruppe, der/die Ersteller:in der Einheit oder Vereinsadmins.
|
||||
</p>
|
||||
</div>
|
||||
<div className="form-row" style={{ marginTop: '0.75rem' }}>
|
||||
<label style={{ display: 'flex', alignItems: 'center', gap: '8px', cursor: 'pointer' }}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={formData.session_assistants_inherit}
|
||||
onChange={(e) =>
|
||||
updateFormField('session_assistants_inherit', e.target.checked)
|
||||
}
|
||||
/>
|
||||
<span style={{ fontSize: '0.9rem', color: 'var(--text1)' }}>
|
||||
Co-Trainer wie in der Trainingsgruppe (Standard)
|
||||
</span>
|
||||
</label>
|
||||
</div>
|
||||
{!formData.session_assistants_inherit ? (
|
||||
<div style={{ marginTop: '10px', maxHeight: '200px', overflowY: 'auto' }}>
|
||||
{clubDirectory.map((m) => {
|
||||
const mid = typeof m.id === 'number' ? m.id : parseInt(String(m.id), 10)
|
||||
const labelText = `${(m.name || '').trim() || m.email || `Profil ${mid}`}`
|
||||
const isOn = Number.isFinite(mid) && formData.session_assistant_profile_ids.includes(mid)
|
||||
return (
|
||||
<label
|
||||
key={`co-${mid}`}
|
||||
style={{
|
||||
display: 'flex',
|
||||
alignItems: 'center',
|
||||
gap: '8px',
|
||||
fontSize: '0.875rem',
|
||||
marginBottom: '6px',
|
||||
cursor: 'pointer',
|
||||
color: 'var(--text1)',
|
||||
}}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={isOn}
|
||||
onChange={() => {
|
||||
setFormData((prev) => {
|
||||
const was = prev.session_assistant_profile_ids.includes(mid)
|
||||
const nextIds = was
|
||||
? prev.session_assistant_profile_ids.filter((x) => x !== mid)
|
||||
: [...prev.session_assistant_profile_ids, mid].sort((a, b) => a - b)
|
||||
return { ...prev, session_assistant_profile_ids: nextIds }
|
||||
})
|
||||
}}
|
||||
/>
|
||||
<span>{labelText}</span>
|
||||
</label>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
) : null}
|
||||
{!clubDirectory.length && showModal ? (
|
||||
<p style={{ margin: '10px 0 0', fontSize: '0.82rem', color: 'var(--text3)', lineHeight: 1.4 }}>
|
||||
Keine Einträge im Vereins-Mitgliederverzeichnis oder noch nicht geladen (nur für Vereinsinterne).
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
<div style={{ marginTop: '2rem' }}>
|
||||
<TrainingUnitSectionsEditor
|
||||
heading="Abschnitte & Übungen"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// Shinkan Jinkendo Frontend Version
|
||||
|
||||
export const APP_VERSION = "0.8.36"
|
||||
export const APP_VERSION = "0.8.37"
|
||||
export const BUILD_DATE = "2026-05-05"
|
||||
|
||||
export const PAGE_VERSIONS = {
|
||||
|
||||
Reference in new issue
Block a user