Implement Framework Import Modal with Enhanced Filtering and Styling
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m27s
Deploy Development / deploy (push) Successful in 43s
Test Suite / pytest-backend (push) Successful in 36s
Test Suite / lint-backend (push) Successful in 0s
Test Suite / build-frontend (push) Successful in 13s
Test Suite / k6 /health Baseline (push) Successful in 34s
Test Suite / playwright-tests (push) Successful in 1m27s
- Introduced a new modal for importing training framework sessions, featuring a backdrop and panel for improved user experience. - Added comprehensive filtering options for focus areas, training types, and target groups, utilizing a structured filter state. - Enhanced session duration handling with distinct duration collection and display, improving clarity in program selection. - Updated utility functions to support new filtering capabilities and session duration management, ensuring a cohesive user interface.
This commit is contained in:
1 parent
9353909fda
commit
9c3494a7ea
4 files changed
+806
-212
No files matched your search
@@ -1,8 +1,12 @@
|
||||
import React, { useMemo, useState } from 'react'
|
||||
import React, { useEffect, useMemo, useState } from 'react'
|
||||
import {
|
||||
collectDistinctSessionDurationsMinutes,
|
||||
EMPTY_FRAMEWORK_IMPORT_FILTERS,
|
||||
filterFrameworkPrograms,
|
||||
frameworkProgramOptionLabel,
|
||||
frameworkSessionDurationLabel,
|
||||
hasActiveFrameworkImportFilters,
|
||||
summarizeFrameworkImportFilters,
|
||||
} from '../../utils/frameworkProgramListHelpers'
|
||||
import { formatDurationDisplay } from '../../utils/trainingDurationUtils'
|
||||
|
||||
@@ -32,185 +36,320 @@ export default function TrainingPlanningFrameworkImportModal({
|
||||
onSubmit,
|
||||
onClose,
|
||||
}) {
|
||||
const [filterQuery, setFilterQuery] = useState('')
|
||||
const [filterFocusIds, setFilterFocusIds] = useState([])
|
||||
const [filterTypeIds, setFilterTypeIds] = useState([])
|
||||
const [filterTargetGroupIds, setFilterTargetGroupIds] = useState([])
|
||||
const [filterDurationMin, setFilterDurationMin] = useState('')
|
||||
const [filters, setFilters] = useState(() => ({ ...EMPTY_FRAMEWORK_IMPORT_FILTERS }))
|
||||
const [filterPanelOpen, setFilterPanelOpen] = useState(true)
|
||||
|
||||
useEffect(() => {
|
||||
if (!open) {
|
||||
setFilters({ ...EMPTY_FRAMEWORK_IMPORT_FILTERS })
|
||||
setFilterPanelOpen(true)
|
||||
}
|
||||
}, [open])
|
||||
|
||||
const distinctDurations = useMemo(
|
||||
() => collectDistinctSessionDurationsMinutes(frameworkProgramsList),
|
||||
[frameworkProgramsList]
|
||||
)
|
||||
|
||||
const filteredPrograms = useMemo(
|
||||
() =>
|
||||
filterFrameworkPrograms(frameworkProgramsList, {
|
||||
query: filterQuery,
|
||||
focusAreaIds: filterFocusIds,
|
||||
trainingTypeIds: filterTypeIds,
|
||||
targetGroupIds: filterTargetGroupIds,
|
||||
durationTargetMin: filterDurationMin === '' ? null : parseInt(filterDurationMin, 10),
|
||||
}),
|
||||
[
|
||||
frameworkProgramsList,
|
||||
filterQuery,
|
||||
filterFocusIds,
|
||||
filterTypeIds,
|
||||
filterTargetGroupIds,
|
||||
filterDurationMin,
|
||||
]
|
||||
() => filterFrameworkPrograms(frameworkProgramsList, filters),
|
||||
[frameworkProgramsList, filters]
|
||||
)
|
||||
|
||||
const filterActive = hasActiveFrameworkImportFilters(filters)
|
||||
const filterSummaryParts = useMemo(
|
||||
() =>
|
||||
summarizeFrameworkImportFilters(filters, {
|
||||
focusAreas: catalogFocusAreas,
|
||||
trainingTypes: catalogTrainingTypes,
|
||||
targetGroups: catalogTargetGroups,
|
||||
}),
|
||||
[filters, catalogFocusAreas, catalogTrainingTypes, catalogTargetGroups]
|
||||
)
|
||||
|
||||
const totalCount = (frameworkProgramsList || []).length
|
||||
const matchCount = filteredPrograms.length
|
||||
|
||||
useEffect(() => {
|
||||
if (!fwImportProgramId) return
|
||||
const stillVisible = filteredPrograms.some((p) => String(p.id) === String(fwImportProgramId))
|
||||
if (!stillVisible) onProgramChange('')
|
||||
}, [filteredPrograms, fwImportProgramId, onProgramChange])
|
||||
|
||||
const selectedProgramSummary = useMemo(() => {
|
||||
if (!fwImportProgramId) return null
|
||||
return (frameworkProgramsList || []).find((p) => String(p.id) === String(fwImportProgramId))
|
||||
}, [frameworkProgramsList, fwImportProgramId])
|
||||
|
||||
const toggleId = (list, setList, id) => {
|
||||
const updateFilter = (patch) => setFilters((prev) => ({ ...prev, ...patch }))
|
||||
|
||||
const clearFilters = () => setFilters({ ...EMPTY_FRAMEWORK_IMPORT_FILTERS })
|
||||
|
||||
const toggleId = (key, id) => {
|
||||
const s = String(id)
|
||||
setList((prev) => (prev.includes(s) ? prev.filter((x) => x !== s) : [...prev, s]))
|
||||
setFilters((prev) => {
|
||||
const cur = prev[key] || []
|
||||
const next = cur.includes(s) ? cur.filter((x) => x !== s) : [...cur, s]
|
||||
return { ...prev, [key]: next }
|
||||
})
|
||||
}
|
||||
|
||||
if (!open) return null
|
||||
|
||||
return (
|
||||
<div
|
||||
className="fw-import-modal-backdrop"
|
||||
data-testid="planning-framework-import-modal"
|
||||
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: 1010,
|
||||
padding: '1rem',
|
||||
overflowY: 'auto',
|
||||
}}
|
||||
>
|
||||
<div
|
||||
style={{
|
||||
background: 'var(--surface)',
|
||||
borderRadius: '12px',
|
||||
padding: 'clamp(14px, 3vw, 1.75rem)',
|
||||
maxWidth: 'min(680px, 100%)',
|
||||
width: '100%',
|
||||
maxHeight: '90vh',
|
||||
overflowY: 'auto',
|
||||
boxSizing: 'border-box',
|
||||
minWidth: 0,
|
||||
}}
|
||||
>
|
||||
<h2 style={{ marginBottom: '0.65rem' }}>Sessions aus Rahmen übernehmen</h2>
|
||||
<p style={{ color: 'var(--text2)', fontSize: '0.9rem', marginBottom: '1rem', lineHeight: 1.5 }}>
|
||||
<div className="fw-import-modal-panel">
|
||||
<h2 className="fw-import-modal-panel__title">Sessions aus Rahmen übernehmen</h2>
|
||||
<p className="fw-import-modal-panel__lead">
|
||||
Wähle ein Trainingsrahmenprogramm und eine oder mehrere Sessions. Pro Session entsteht eine{' '}
|
||||
<strong>eigene geplante Einheit</strong> in der aktuellen Gruppe (Kopie des Ablaufs). Die{' '}
|
||||
<strong>Verknüpfung zum Rahmen-Slot</strong> bleibt sichtbar.
|
||||
<strong>eigene geplante Einheit</strong> in der aktuellen Gruppe (Kopie des Ablaufs).
|
||||
</p>
|
||||
|
||||
<details className="planning-filter-help" style={{ marginBottom: '1rem' }}>
|
||||
<summary className="planning-filter-help__summary">Rahmen filtern (optional)</summary>
|
||||
<div className="planning-filter-help__body" style={{ display: 'grid', gap: '10px' }}>
|
||||
<div className="form-row" style={{ marginBottom: 0 }}>
|
||||
<label className="form-label">Suche (Titel, Ziele, Katalog)</label>
|
||||
<input
|
||||
className="form-input"
|
||||
value={filterQuery}
|
||||
onChange={(e) => setFilterQuery(e.target.value)}
|
||||
placeholder="z. B. Gürtel, Koordination …"
|
||||
<div className="fw-import-results-bar">
|
||||
<div className="fw-import-results-bar__count">
|
||||
<strong className="fw-import-results-bar__num">{matchCount}</strong>
|
||||
<span>
|
||||
{' '}
|
||||
von {totalCount} Rahmenprogramm{totalCount === 1 ? '' : 'en'}
|
||||
</span>
|
||||
{matchCount === 0 && totalCount > 0 ? (
|
||||
<span className="fw-import-results-bar__warn"> — kein Treffer</span>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="fw-import-results-bar__actions">
|
||||
{filterActive ? (
|
||||
<span className="fw-import-filter-badge" title={filterSummaryParts.join(' · ')}>
|
||||
Filter aktiv
|
||||
</span>
|
||||
) : null}
|
||||
{filterActive ? (
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary framework-ctrl framework-ctrl--xs"
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
onClick={clearFilters}
|
||||
>
|
||||
Filter zurücksetzen
|
||||
</button>
|
||||
) : null}
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary framework-ctrl framework-ctrl--xs"
|
||||
disabled={fwImportSubmitting}
|
||||
onClick={() => setFilterPanelOpen((v) => !v)}
|
||||
aria-expanded={filterPanelOpen}
|
||||
>
|
||||
{filterPanelOpen ? 'Filter einklappen' : 'Filter anzeigen'}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{!filterPanelOpen && filterActive && filterSummaryParts.length > 0 ? (
|
||||
<ul className="fw-import-filter-chips" aria-label="Aktive Filter">
|
||||
{filterSummaryParts.map((part) => (
|
||||
<li key={part} className="fw-import-filter-chip">
|
||||
{part}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : null}
|
||||
|
||||
{filterPanelOpen ? (
|
||||
<div className="fw-import-filter-panel">
|
||||
<div className="fw-import-filter-panel__grid">
|
||||
<div className="form-row fw-import-filter-panel__search">
|
||||
<label className="form-label">Suche (Titel, Ziele, Katalog)</label>
|
||||
<input
|
||||
className="form-input"
|
||||
value={filters.query}
|
||||
onChange={(e) => updateFilter({ query: e.target.value })}
|
||||
placeholder="z. B. Gürtel, Koordination …"
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
</div>
|
||||
|
||||
<fieldset className="fw-import-duration-fieldset">
|
||||
<legend className="form-label">Ziel-Session-Dauer</legend>
|
||||
<div className="fw-import-duration-mode" role="radiogroup" aria-label="Dauer-Filtermodus">
|
||||
{[
|
||||
{ id: 'any', label: 'Alle' },
|
||||
{ id: 'range', label: 'Zeitspanne' },
|
||||
{ id: 'preset', label: 'Vorhandene Zeiten' },
|
||||
].map((opt) => (
|
||||
<label key={opt.id} className="fw-import-duration-mode__opt">
|
||||
<input
|
||||
type="radio"
|
||||
name="fw-duration-mode"
|
||||
checked={filters.durationMode === opt.id}
|
||||
disabled={fwImportSubmitting || (opt.id === 'preset' && distinctDurations.length === 0)}
|
||||
onChange={() =>
|
||||
updateFilter({
|
||||
durationMode: opt.id,
|
||||
...(opt.id === 'any'
|
||||
? { durationRangeFrom: '', durationRangeTo: '', durationPresetMin: null }
|
||||
: {}),
|
||||
})
|
||||
}
|
||||
/>
|
||||
<span>{opt.label}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{filters.durationMode === 'range' ? (
|
||||
<div className="responsive-grid-2 fw-import-duration-range">
|
||||
<div className="form-row" style={{ marginBottom: 0 }}>
|
||||
<label className="form-label">Von (Minuten)</label>
|
||||
<input
|
||||
type="number"
|
||||
min={0}
|
||||
className="form-input"
|
||||
value={filters.durationRangeFrom}
|
||||
onChange={(e) =>
|
||||
updateFilter({ durationMode: 'range', durationRangeFrom: e.target.value })
|
||||
}
|
||||
placeholder="z. B. 60"
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-row" style={{ marginBottom: 0 }}>
|
||||
<label className="form-label">Bis (Minuten)</label>
|
||||
<input
|
||||
type="number"
|
||||
min={0}
|
||||
className="form-input"
|
||||
value={filters.durationRangeTo}
|
||||
onChange={(e) =>
|
||||
updateFilter({ durationMode: 'range', durationRangeTo: e.target.value })
|
||||
}
|
||||
placeholder="z. B. 90"
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{filters.durationMode === 'preset' ? (
|
||||
distinctDurations.length === 0 ? (
|
||||
<p className="form-sub" style={{ margin: '8px 0 0' }}>
|
||||
In der Bibliothek sind noch keine Session-Dauern hinterlegt. Nutze „Zeitspanne“ oder lege
|
||||
Dauer pro Session im Rahmenprogramm fest.
|
||||
</p>
|
||||
) : (
|
||||
<div className="fw-import-duration-presets">
|
||||
{distinctDurations.map((min) => {
|
||||
const on = filters.durationPresetMin === min
|
||||
return (
|
||||
<button
|
||||
key={min}
|
||||
type="button"
|
||||
className={
|
||||
'btn framework-ctrl framework-ctrl--xs' +
|
||||
(on ? ' fw-import-duration-preset--on' : ' btn-secondary')
|
||||
}
|
||||
disabled={fwImportSubmitting}
|
||||
onClick={() =>
|
||||
updateFilter({
|
||||
durationMode: 'preset',
|
||||
durationPresetMin: on ? null : min,
|
||||
durationRangeFrom: '',
|
||||
durationRangeTo: '',
|
||||
})
|
||||
}
|
||||
>
|
||||
{formatDurationDisplay(min)}
|
||||
</button>
|
||||
)
|
||||
})}
|
||||
</div>
|
||||
)
|
||||
) : null}
|
||||
</fieldset>
|
||||
|
||||
{catalogFocusAreas.length > 0 ? (
|
||||
<div className="fw-import-catalog-block">
|
||||
<span className="form-label">Fokusbereich</span>
|
||||
<div className="framework-catalog-checkgrid">
|
||||
{catalogFocusAreas.map((fa) => (
|
||||
<label key={fa.id} className="framework-catalog-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={(filters.focusAreaIds || []).includes(String(fa.id))}
|
||||
onChange={() => toggleId('focusAreaIds', fa.id)}
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
<span>{fa.name}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{catalogTrainingTypes.length > 0 ? (
|
||||
<div className="fw-import-catalog-block">
|
||||
<span className="form-label">Trainingsart</span>
|
||||
<div className="framework-catalog-checkgrid">
|
||||
{catalogTrainingTypes.map((t) => (
|
||||
<label key={t.id} className="framework-catalog-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={(filters.trainingTypeIds || []).includes(String(t.id))}
|
||||
onChange={() => toggleId('trainingTypeIds', t.id)}
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
<span>{t.name}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{catalogTargetGroups.length > 0 ? (
|
||||
<div className="fw-import-catalog-block">
|
||||
<span className="form-label">Zielgruppe</span>
|
||||
<div className="framework-catalog-checkgrid">
|
||||
{catalogTargetGroups.map((tg) => (
|
||||
<label key={tg.id} className="framework-catalog-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={(filters.targetGroupIds || []).includes(String(tg.id))}
|
||||
onChange={() => toggleId('targetGroupIds', tg.id)}
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
<span>{tg.name}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="form-row" style={{ marginBottom: 0 }}>
|
||||
<label className="form-label">Ziel-Session-Dauer (Minuten)</label>
|
||||
<input
|
||||
type="number"
|
||||
min={0}
|
||||
className="form-input"
|
||||
value={filterDurationMin}
|
||||
onChange={(e) => setFilterDurationMin(e.target.value)}
|
||||
placeholder="z. B. 90"
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
<p className="form-sub" style={{ marginTop: '4px' }}>
|
||||
Zeigt Programme, deren hinterlegte Session-Dauer in etwa passt (±10 Min).
|
||||
</p>
|
||||
</div>
|
||||
{catalogFocusAreas.length > 0 ? (
|
||||
<div>
|
||||
<span className="form-label" style={{ display: 'block', marginBottom: '6px' }}>
|
||||
Fokusbereich
|
||||
</span>
|
||||
<div className="framework-catalog-checkgrid">
|
||||
{catalogFocusAreas.map((fa) => (
|
||||
<label key={fa.id} className="framework-catalog-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={filterFocusIds.includes(String(fa.id))}
|
||||
onChange={() => toggleId(filterFocusIds, setFilterFocusIds, fa.id)}
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
<span>{fa.name}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
{catalogTrainingTypes.length > 0 ? (
|
||||
<div>
|
||||
<span className="form-label" style={{ display: 'block', marginBottom: '6px' }}>
|
||||
Trainingsart
|
||||
</span>
|
||||
<div className="framework-catalog-checkgrid">
|
||||
{catalogTrainingTypes.map((t) => (
|
||||
<label key={t.id} className="framework-catalog-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={filterTypeIds.includes(String(t.id))}
|
||||
onChange={() => toggleId(filterTypeIds, setFilterTypeIds, t.id)}
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
<span>{t.name}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
{catalogTargetGroups.length > 0 ? (
|
||||
<div>
|
||||
<span className="form-label" style={{ display: 'block', marginBottom: '6px' }}>
|
||||
Zielgruppe
|
||||
</span>
|
||||
<div className="framework-catalog-checkgrid">
|
||||
{catalogTargetGroups.map((tg) => (
|
||||
<label key={tg.id} className="framework-catalog-check">
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={filterTargetGroupIds.includes(String(tg.id))}
|
||||
onChange={() => toggleId(filterTargetGroupIds, setFilterTargetGroupIds, tg.id)}
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
<span>{tg.name}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
) : null}
|
||||
<p className="form-sub" style={{ margin: 0 }}>
|
||||
{filteredPrograms.length} von {frameworkProgramsList.length} Rahmenprogramm(en) sichtbar.
|
||||
Entwicklungsziele sind freie Texte — die Suche durchsucht auch Ziel-Titel.
|
||||
<p className="form-sub fw-import-filter-panel__hint">
|
||||
Entwicklungsziele sind freie Texte — die Suche durchsucht auch Ziel-Titel. Bei der Dauer werden nur
|
||||
Programme mit hinterlegter Session-Dauer berücksichtigt.
|
||||
</p>
|
||||
</div>
|
||||
</details>
|
||||
) : null}
|
||||
|
||||
<div className="form-row">
|
||||
<label className="form-label">Rahmenprogramm</label>
|
||||
<div className="form-row fw-import-program-select">
|
||||
<label className="form-label">
|
||||
Rahmenprogramm
|
||||
<span className="fw-import-program-select__count">
|
||||
{' '}
|
||||
({matchCount} {matchCount === 1 ? 'Treffer' : 'Treffer'})
|
||||
</span>
|
||||
</label>
|
||||
<select
|
||||
className="form-input"
|
||||
value={fwImportProgramId}
|
||||
onChange={(e) => onProgramChange(e.target.value)}
|
||||
disabled={fwImportLoading || fwImportSubmitting}
|
||||
disabled={fwImportLoading || fwImportSubmitting || matchCount === 0}
|
||||
>
|
||||
<option value="">Bitte wählen…</option>
|
||||
<option value="">
|
||||
{matchCount === 0 ? 'Kein Rahmenprogramm passt zum Filter' : 'Bitte wählen…'}
|
||||
</option>
|
||||
{filteredPrograms.map((fp) => (
|
||||
<option key={fp.id} value={String(fp.id)}>
|
||||
{frameworkProgramOptionLabel(fp)}
|
||||
@@ -231,14 +370,12 @@ export default function TrainingPlanningFrameworkImportModal({
|
||||
</div>
|
||||
|
||||
{fwImportLoading ? (
|
||||
<p style={{ color: 'var(--text2)', marginTop: '1rem' }}>Laden der Sessions…</p>
|
||||
<p className="fw-import-muted">Laden der Sessions…</p>
|
||||
) : fwImportDetail?.slots?.length ? (
|
||||
<>
|
||||
<fieldset style={{ border: 'none', margin: '1rem 0', padding: 0 }}>
|
||||
<legend className="form-label" style={{ padding: 0, marginBottom: '0.5rem' }}>
|
||||
Sessions (mit Ablauf)
|
||||
</legend>
|
||||
<ul style={{ listStyle: 'none', padding: 0, margin: 0 }}>
|
||||
<fieldset className="fw-import-sessions">
|
||||
<legend className="form-label">Sessions (mit Ablauf)</legend>
|
||||
<ul className="fw-import-sessions__list">
|
||||
{[...fwImportDetail.slots]
|
||||
.sort((a, b) => (a.sort_order ?? 0) - (b.sort_order ?? 0))
|
||||
.map((slot) => {
|
||||
@@ -251,51 +388,41 @@ export default function TrainingPlanningFrameworkImportModal({
|
||||
? formatDurationDisplay(slot.planned_duration_min)
|
||||
: null
|
||||
return (
|
||||
<li key={slot.id} style={{ marginBottom: '10px' }}>
|
||||
<li key={slot.id} className="fw-import-sessions__item">
|
||||
<label
|
||||
style={{
|
||||
display: 'flex',
|
||||
gap: '10px',
|
||||
alignItems: 'flex-start',
|
||||
cursor: hasBp ? 'pointer' : 'not-allowed',
|
||||
opacity: hasBp ? 1 : 0.55,
|
||||
}}
|
||||
className={
|
||||
'fw-import-sessions__label' + (hasBp ? '' : ' fw-import-sessions__label--disabled')
|
||||
}
|
||||
>
|
||||
<input
|
||||
type="checkbox"
|
||||
className="fw-import-sessions__check"
|
||||
checked={checked}
|
||||
disabled={!hasBp || fwImportSubmitting}
|
||||
onChange={() => onToggleSlot(slot)}
|
||||
style={{ marginTop: '0.2rem', flexShrink: 0 }}
|
||||
/>
|
||||
<span style={{ flex: 1, minWidth: 0 }}>
|
||||
<strong>{label}</strong>
|
||||
{slotDur ? (
|
||||
<span
|
||||
style={{
|
||||
marginLeft: '8px',
|
||||
fontSize: '0.82rem',
|
||||
color: 'var(--text2)',
|
||||
fontWeight: 500,
|
||||
}}
|
||||
>
|
||||
· {slotDur}
|
||||
</span>
|
||||
) : null}
|
||||
<span className="fw-import-sessions__body">
|
||||
<span className="fw-import-sessions__title-row">
|
||||
<strong>{label}</strong>
|
||||
{slotDur ? (
|
||||
<span className="fw-import-sessions__dur">{slotDur}</span>
|
||||
) : (
|
||||
<span className="fw-import-sessions__dur fw-import-sessions__dur--muted">
|
||||
Dauer offen
|
||||
</span>
|
||||
)}
|
||||
</span>
|
||||
{!hasBp ? (
|
||||
<span style={{ display: 'block', fontSize: '0.82rem', color: 'var(--danger)' }}>
|
||||
<span className="fw-import-sessions__warn">
|
||||
Ohne Session-Ablauf — Übernahme nicht möglich.
|
||||
</span>
|
||||
) : null}
|
||||
{hasBp && checked ? (
|
||||
<span style={{ display: 'block', marginTop: '6px' }}>
|
||||
<span className="form-label" style={{ fontSize: '0.78rem' }}>
|
||||
Termin (Datum)
|
||||
</span>
|
||||
<span className="fw-import-sessions__date">
|
||||
<span className="form-label">Termin (Datum)</span>
|
||||
<input
|
||||
type="date"
|
||||
className="form-input"
|
||||
style={{ maxWidth: '200px', marginTop: '4px' }}
|
||||
value={fwImportSlotDates[String(slot.id)] || ''}
|
||||
onChange={(e) => onSlotDateChange(String(slot.id), e.target.value)}
|
||||
disabled={fwImportSubmitting}
|
||||
@@ -310,15 +437,7 @@ export default function TrainingPlanningFrameworkImportModal({
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
<div
|
||||
className="responsive-grid-3"
|
||||
style={{
|
||||
marginBottom: '0.75rem',
|
||||
padding: '12px',
|
||||
background: 'var(--surface2)',
|
||||
borderRadius: '8px',
|
||||
}}
|
||||
>
|
||||
<div className="fw-import-dates-panel responsive-grid-3">
|
||||
<div className="form-row">
|
||||
<label className="form-label">Startdatum (Vorschlag)</label>
|
||||
<input
|
||||
@@ -340,11 +459,10 @@ export default function TrainingPlanningFrameworkImportModal({
|
||||
disabled={fwImportSubmitting}
|
||||
/>
|
||||
</div>
|
||||
<div className="form-row" style={{ alignSelf: 'end' }}>
|
||||
<div className="form-row fw-import-dates-panel__action">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-secondary"
|
||||
style={{ width: '100%' }}
|
||||
disabled={fwImportSubmitting}
|
||||
onClick={onApplyDateSuggestions}
|
||||
>
|
||||
@@ -354,10 +472,10 @@ export default function TrainingPlanningFrameworkImportModal({
|
||||
</div>
|
||||
</>
|
||||
) : fwImportProgramId ? (
|
||||
<p style={{ color: 'var(--text2)', marginTop: '0.75rem' }}>Keine Sessions in diesem Programm.</p>
|
||||
<p className="fw-import-muted">Keine Sessions in diesem Programm.</p>
|
||||
) : null}
|
||||
|
||||
<div style={{ display: 'flex', flexWrap: 'wrap', gap: '0.5rem', marginTop: '1.25rem' }}>
|
||||
<div className="fw-import-modal-panel__footer">
|
||||
<button
|
||||
type="button"
|
||||
className="btn btn-primary"
|
||||
|
||||
Reference in new issue
Block a user