feat: update maturity models and version to 0.7.2
- Incremented application version to 0.7.2 and updated database schema version to 20260427025. - Enhanced maturity models functionality to support M:N relationships for focus areas, style directions, and target groups. - Updated frontend to allow multi-selection for focus areas, style directions, and target groups. - Documented changes in the changelog for version 0.7.2, including new migration details and UI improvements.
This commit is contained in:
1 parent
5277f4f4cf
commit
f1ee1eec7e
4 files changed
+497
-204
No files matched your search
@@ -4,6 +4,31 @@ import { useAuth } from '../context/AuthContext'
|
||||
import api from '../utils/api'
|
||||
import AdminPageNav from '../components/AdminPageNav'
|
||||
|
||||
function MultiIdSelect({ label, options, valueIds, onChange, hint }) {
|
||||
return (
|
||||
<div>
|
||||
<label className="form-label">{label}</label>
|
||||
<select
|
||||
multiple
|
||||
className="form-input"
|
||||
style={{ minHeight: 100, width: '100%' }}
|
||||
value={(valueIds || []).map(String)}
|
||||
onChange={(e) => {
|
||||
const v = Array.from(e.target.selectedOptions, (o) => parseInt(o.value, 10))
|
||||
onChange(v)
|
||||
}}
|
||||
>
|
||||
{options.map((o) => (
|
||||
<option key={o.id} value={o.id}>{o.name}</option>
|
||||
))}
|
||||
</select>
|
||||
{hint ? (
|
||||
<div style={{ fontSize: 12, color: 'var(--text3)', marginTop: 4 }}>{hint}</div>
|
||||
) : null}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default function AdminMaturityModelsPage() {
|
||||
const { user } = useAuth()
|
||||
const isAdmin = user?.role === 'admin' || user?.role === 'superadmin'
|
||||
@@ -23,9 +48,9 @@ export default function AdminMaturityModelsPage() {
|
||||
const [newModel, setNewModel] = useState({
|
||||
name: '',
|
||||
level_count: 5,
|
||||
focus_area_id: '',
|
||||
style_direction_id: '',
|
||||
target_group_id: '',
|
||||
focus_area_ids: [],
|
||||
style_direction_ids: [],
|
||||
target_group_ids: [],
|
||||
status: 'draft'
|
||||
})
|
||||
|
||||
@@ -76,9 +101,9 @@ export default function AdminMaturityModelsPage() {
|
||||
setMeta({
|
||||
name: d.name,
|
||||
description: d.description || '',
|
||||
focus_area_id: d.focus_area_id ?? '',
|
||||
style_direction_id: d.style_direction_id ?? '',
|
||||
target_group_id: d.target_group_id ?? '',
|
||||
focus_area_ids: (d.focus_areas || []).map((x) => x.id),
|
||||
style_direction_ids: (d.style_directions || []).map((x) => x.id),
|
||||
target_group_ids: (d.target_groups || []).map((x) => x.id),
|
||||
status: d.status,
|
||||
version: d.version || '1.0'
|
||||
})
|
||||
@@ -118,13 +143,9 @@ export default function AdminMaturityModelsPage() {
|
||||
name: newModel.name.trim(),
|
||||
level_count: parseInt(String(newModel.level_count), 10),
|
||||
status: newModel.status,
|
||||
focus_area_id: newModel.focus_area_id ? parseInt(String(newModel.focus_area_id), 10) : null,
|
||||
style_direction_id: newModel.style_direction_id
|
||||
? parseInt(String(newModel.style_direction_id), 10)
|
||||
: null,
|
||||
target_group_id: newModel.target_group_id
|
||||
? parseInt(String(newModel.target_group_id), 10)
|
||||
: null
|
||||
focus_area_ids: newModel.focus_area_ids,
|
||||
style_direction_ids: newModel.style_direction_ids,
|
||||
target_group_ids: newModel.target_group_ids
|
||||
}
|
||||
const created = await api.createMaturityModel(payload)
|
||||
await refreshModels()
|
||||
@@ -132,9 +153,9 @@ export default function AdminMaturityModelsPage() {
|
||||
setNewModel({
|
||||
name: '',
|
||||
level_count: 5,
|
||||
focus_area_id: '',
|
||||
style_direction_id: '',
|
||||
target_group_id: '',
|
||||
focus_area_ids: [],
|
||||
style_direction_ids: [],
|
||||
target_group_ids: [],
|
||||
status: 'draft'
|
||||
})
|
||||
} catch (e) {
|
||||
@@ -152,11 +173,9 @@ export default function AdminMaturityModelsPage() {
|
||||
await api.updateMaturityModel(selectedId, {
|
||||
name: meta.name,
|
||||
description: meta.description || null,
|
||||
focus_area_id: meta.focus_area_id === '' ? null : parseInt(String(meta.focus_area_id), 10),
|
||||
style_direction_id:
|
||||
meta.style_direction_id === '' ? null : parseInt(String(meta.style_direction_id), 10),
|
||||
target_group_id:
|
||||
meta.target_group_id === '' ? null : parseInt(String(meta.target_group_id), 10),
|
||||
focus_area_ids: meta.focus_area_ids,
|
||||
style_direction_ids: meta.style_direction_ids,
|
||||
target_group_ids: meta.target_group_ids,
|
||||
status: meta.status,
|
||||
version: meta.version
|
||||
})
|
||||
@@ -343,10 +362,18 @@ export default function AdminMaturityModelsPage() {
|
||||
onClick={() => selectModel(m.id)}
|
||||
>
|
||||
<div style={{ fontWeight: 600 }}>{m.name}</div>
|
||||
<div style={{ fontSize: 12, opacity: 0.85 }}>
|
||||
{[m.focus_area_name, m.style_direction_name, m.target_group_name]
|
||||
.filter(Boolean)
|
||||
.join(' · ') || 'Allgemein'}
|
||||
<div style={{ fontSize: 12, opacity: 0.85, lineHeight: 1.35 }}>
|
||||
{(m.focus_areas || []).length
|
||||
? `Fokus: ${m.focus_areas.map((f) => f.name).join(', ')}`
|
||||
: 'Fokus: alle'}
|
||||
<br />
|
||||
{(m.style_directions || []).length
|
||||
? `Stil: ${m.style_directions.map((s) => s.name).join(', ')}`
|
||||
: 'Stil: alle'}
|
||||
<br />
|
||||
{(m.target_groups || []).length
|
||||
? `Zielgr.: ${m.target_groups.map((t) => t.name).join(', ')}`
|
||||
: 'Zielgr.: alle'}
|
||||
</div>
|
||||
<div style={{ fontSize: 11, opacity: 0.75 }}>{m.status} · {m.level_count} Stufen</div>
|
||||
</button>
|
||||
@@ -384,39 +411,27 @@ export default function AdminMaturityModelsPage() {
|
||||
<option value="active">Aktiv</option>
|
||||
<option value="archived">Archiviert</option>
|
||||
</select>
|
||||
<label className="form-label">Fokusbereich (optional)</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={newModel.focus_area_id}
|
||||
onChange={(e) => setNewModel((s) => ({ ...s, focus_area_id: e.target.value }))}
|
||||
>
|
||||
<option value="">—</option>
|
||||
{focusAreas.map((fa) => (
|
||||
<option key={fa.id} value={fa.id}>{fa.name}</option>
|
||||
))}
|
||||
</select>
|
||||
<label className="form-label">Stilrichtung (optional)</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={newModel.style_direction_id}
|
||||
onChange={(e) => setNewModel((s) => ({ ...s, style_direction_id: e.target.value }))}
|
||||
>
|
||||
<option value="">—</option>
|
||||
{styles.map((s) => (
|
||||
<option key={s.id} value={s.id}>{s.name}</option>
|
||||
))}
|
||||
</select>
|
||||
<label className="form-label">Zielgruppe (optional)</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={newModel.target_group_id}
|
||||
onChange={(e) => setNewModel((s) => ({ ...s, target_group_id: e.target.value }))}
|
||||
>
|
||||
<option value="">—</option>
|
||||
{targetGroups.map((tg) => (
|
||||
<option key={tg.id} value={tg.id}>{tg.name}</option>
|
||||
))}
|
||||
</select>
|
||||
<MultiIdSelect
|
||||
label="Fokusbereiche (leer = alle)"
|
||||
options={focusAreas}
|
||||
valueIds={newModel.focus_area_ids}
|
||||
onChange={(ids) => setNewModel((s) => ({ ...s, focus_area_ids: ids }))}
|
||||
hint="Strg/Cmd gedrückt halten für Mehrfachauswahl."
|
||||
/>
|
||||
<MultiIdSelect
|
||||
label="Stilrichtungen (leer = alle)"
|
||||
options={styles}
|
||||
valueIds={newModel.style_direction_ids}
|
||||
onChange={(ids) => setNewModel((s) => ({ ...s, style_direction_ids: ids }))}
|
||||
hint="Strg/Cmd gedrückt halten für Mehrfachauswahl."
|
||||
/>
|
||||
<MultiIdSelect
|
||||
label="Zielgruppen (leer = alle)"
|
||||
options={targetGroups}
|
||||
valueIds={newModel.target_group_ids}
|
||||
onChange={(ids) => setNewModel((s) => ({ ...s, target_group_ids: ids }))}
|
||||
hint="Strg/Cmd gedrückt halten für Mehrfachauswahl."
|
||||
/>
|
||||
<button type="submit" className="btn btn-primary btn-full" disabled={saving}>
|
||||
Anlegen
|
||||
</button>
|
||||
@@ -454,55 +469,27 @@ export default function AdminMaturityModelsPage() {
|
||||
onChange={(e) => setMeta((m) => ({ ...m, description: e.target.value }))}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 }}>
|
||||
<div>
|
||||
<label className="form-label">Fokusbereich</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={meta.focus_area_id === null || meta.focus_area_id === '' ? '' : meta.focus_area_id}
|
||||
onChange={(e) => setMeta((m) => ({ ...m, focus_area_id: e.target.value }))}
|
||||
>
|
||||
<option value="">— (alle)</option>
|
||||
{focusAreas.map((fa) => (
|
||||
<option key={fa.id} value={fa.id}>{fa.name}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label className="form-label">Stilrichtung</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={
|
||||
meta.style_direction_id === null || meta.style_direction_id === ''
|
||||
? ''
|
||||
: meta.style_direction_id
|
||||
}
|
||||
onChange={(e) => setMeta((m) => ({ ...m, style_direction_id: e.target.value }))}
|
||||
>
|
||||
<option value="">— (alle)</option>
|
||||
{styles.map((s) => (
|
||||
<option key={s.id} value={s.id}>{s.name}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<label className="form-label">Zielgruppe</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={
|
||||
meta.target_group_id === null || meta.target_group_id === ''
|
||||
? ''
|
||||
: meta.target_group_id
|
||||
}
|
||||
onChange={(e) => setMeta((m) => ({ ...m, target_group_id: e.target.value }))}
|
||||
>
|
||||
<option value="">— (alle)</option>
|
||||
{targetGroups.map((tg) => (
|
||||
<option key={tg.id} value={tg.id}>{tg.name}</option>
|
||||
))}
|
||||
</select>
|
||||
</div>
|
||||
<MultiIdSelect
|
||||
label="Fokusbereiche (keine Auswahl = alle)"
|
||||
options={focusAreas}
|
||||
valueIds={meta.focus_area_ids}
|
||||
onChange={(ids) => setMeta((m) => ({ ...m, focus_area_ids: ids }))}
|
||||
hint="Strg/Cmd + Klick für mehrere. Alle abwählen = gilt in jedem Fokusbereich."
|
||||
/>
|
||||
<MultiIdSelect
|
||||
label="Stilrichtungen (keine Auswahl = alle)"
|
||||
options={styles}
|
||||
valueIds={meta.style_direction_ids}
|
||||
onChange={(ids) => setMeta((m) => ({ ...m, style_direction_ids: ids }))}
|
||||
hint="Strg/Cmd + Klick für mehrere."
|
||||
/>
|
||||
<MultiIdSelect
|
||||
label="Zielgruppen (keine Auswahl = alle)"
|
||||
options={targetGroups}
|
||||
valueIds={meta.target_group_ids}
|
||||
onChange={(ids) => setMeta((m) => ({ ...m, target_group_ids: ids }))}
|
||||
hint="Strg/Cmd + Klick für mehrere."
|
||||
/>
|
||||
<div style={{ display: 'grid', gridTemplateColumns: '1fr 1fr', gap: 12 }}>
|
||||
<div>
|
||||
<label className="form-label">Status</label>
|
||||
@@ -640,17 +627,25 @@ export default function AdminMaturityModelsPage() {
|
||||
</div>
|
||||
<ul style={{ marginTop: 12, paddingLeft: 18 }}>
|
||||
{(detail.model_skills || []).map((ms) => (
|
||||
<li key={ms.skill_id} style={{ marginBottom: 6 }}>
|
||||
<strong>{ms.skill_name}</strong>
|
||||
{' '}
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
style={{ padding: '2px 8px', fontSize: 12 }}
|
||||
onClick={() => handleRemoveSkill(ms.skill_id)}
|
||||
>
|
||||
entfernen
|
||||
</button>
|
||||
<li key={ms.skill_id} style={{ marginBottom: 10 }}>
|
||||
<div>
|
||||
<strong>{ms.skill_name}</strong>
|
||||
{' '}
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
style={{ padding: '2px 8px', fontSize: 12 }}
|
||||
onClick={() => handleRemoveSkill(ms.skill_id)}
|
||||
>
|
||||
entfernen
|
||||
</button>
|
||||
</div>
|
||||
{(ms.skill_main_category_name || ms.skill_subcategory_name) ? (
|
||||
<div style={{ fontSize: 12, color: 'var(--text2)', marginTop: 2 }}>
|
||||
{ms.skill_main_category_name}
|
||||
{ms.skill_subcategory_name ? ` › ${ms.skill_subcategory_name}` : ''}
|
||||
</div>
|
||||
) : null}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
@@ -690,10 +685,17 @@ export default function AdminMaturityModelsPage() {
|
||||
left: 0,
|
||||
background: 'var(--surface)',
|
||||
fontWeight: 600,
|
||||
whiteSpace: 'nowrap'
|
||||
maxWidth: 220,
|
||||
verticalAlign: 'top'
|
||||
}}
|
||||
>
|
||||
{ms.skill_name}
|
||||
<div>{ms.skill_name}</div>
|
||||
{(ms.skill_main_category_name || ms.skill_subcategory_name) ? (
|
||||
<div style={{ fontSize: 11, fontWeight: 400, color: 'var(--text2)', marginTop: 4, lineHeight: 1.3 }}>
|
||||
{ms.skill_main_category_name || '—'}
|
||||
{ms.skill_subcategory_name ? ` › ${ms.skill_subcategory_name}` : ''}
|
||||
</div>
|
||||
) : null}
|
||||
</td>
|
||||
{(detail.levels || []).map((l) => {
|
||||
const key = `${ms.skill_id}-${l.level_number}`
|
||||
|
||||
Reference in new issue
Block a user