# Feature Extensions Plan — Feuerwehr Dashboard

> Generated 2026-03-16. Features that extend existing functionality.

## Selected for Implementation (current sprint)
- #3 Inspection Schedule Export (PDF/CSV)
- #4 Vehicle Availability Calendar
- #8 Atemschutz Recertification Alert
- #19 Events Conflict Detection
- #21 Bulk Member Communication
- #22 Audit Log Alerts

---

## Backlog — Vehicles & Equipment

### Maintenance Cost Trend Reports [Medium]
- Aggregate costs from `wartungslog` by vehicle/type, with YoY trends
- Add new tab or section to `FahrzeugDetail.tsx` maintenance tab
- Backend: new `GET /api/vehicles/:id/wartung/stats` endpoint
- Frontend: bar/line chart using existing chart pattern from `IncidentStatsChart`
- Data available: `wartungslog.kosten`, `wartungslog.datum`, `wartungslog.art`

### Equipment Move History [Quick Win]
- Track when equipment moves between vehicles/storage via audit_log entries
- Show timeline in `AusruestungDetail.tsx` with location change history
- Backend: query audit_log for equipment UPDATE actions where fahrzeug_id changed
- Frontend: simple timeline list component

### Equipment Inventory by Category Report [Quick Win]
- Dashboard card showing equipment count by category/status with drill-down
- Use existing `equipmentService.getEquipmentStats()` data
- Frontend: new `EquipmentCategoryCard` in dashboard Status group
- Chip counts per category, color-coded by status

---

## Backlog — Personnel & Atemschutz

### Member Qualification Matrix Export [Medium]
- CSV/PDF showing all members × qualifications (licenses, certifications, training status)
- Backend: new `GET /api/members/qualifications/export` joining ausbildung, atemschutz_traeger, fahrgenehmigungen, untersuchungen
- Frontend: export button on Mitglieder page
- PDF template: table with member rows × qualification columns

### Rank Promotion Timeline [Quick Win]
- Visual timeline of rank changes per member
- Data: `dienstgrad_verlauf` table already has full history
- Frontend: timeline component in MitgliedDetail "Beförderungen" tab
- Use MUI Timeline component or simple vertical list

### Qualifications Expiring Soon Widget [Medium]
- Dashboard widget showing members with soon-to-expire qualifications
- Query: JOIN ausbildung.ablaufdatum, atemschutz.gueltig_bis, untersuchungen.gueltig_bis
- WHERE expiry date BETWEEN now AND now + 90 days
- Backend: new `GET /api/members/expiring-qualifications?days=90`
- Frontend: new dashboard card in Status group

### Member On-Duty Roster Widget [Quick Win]
- Quick view showing who is on active duty (status=aktiv + specific function)
- Backend: filter members by status and funktion
- Frontend: simple card widget showing avatar + name list

---

## Backlog — Incidents & Operations

### Response Time Analytics [Medium]
- Dashboard showing hilfsfrist trends, median times by incident type
- Data: `einsatz_statistik` materialized view has `hilfsfrist_min`
- Backend: new `GET /api/incidents/response-times?groupBy=einsatz_art`
- Frontend: line chart or box plot in Einsaetze page analytics section

### Personnel Availability During Incident [Medium]
- Incident detail view showing who was on-duty vs. who responded
- Cross-reference einsatz_personal with member status at time of incident
- Backend: extend `getIncidentById` to include non-responding active members
- Frontend: new section in EinsatzDetail with available/responded columns

### Vehicle Usage by Incident Type [Quick Win]
- Report: which vehicles deployed per incident type
- Backend: aggregate einsatz_fahrzeuge grouped by einsatz_art
- Simple query on existing data, return as stats
- Frontend: table or chart in Einsaetze page

### Incident Debriefing Template [Medium]
- Structured post-incident notes (what went well, improvements, training needs)
- Extend `bericht_text` or add new JSON column `debrief` with structured fields
- Backend: migration for new column, extend PATCH endpoint
- Frontend: collapsible section in EinsatzDetail with structured fields

### Callout Distribution Report [Quick Win]
- Personnel workload analysis: how many callouts per member
- Backend: `SELECT user_id, COUNT(*) FROM einsatz_personal GROUP BY user_id`
- Frontend: table or chart in admin dashboard or Mitglieder page

---

## Backlog — Training & Events

### Training Attendance Statistics [Medium]
- Member participation trends (% events attended, absences, by type)
- Backend: aggregate uebung_teilnahmen by user_id with status counts
- Frontend: new admin tab or member profile tab with charts
- Could show per-member attendance rate badge

### Training Requirement Tracking [Significant]
- Mark Übungen as mandatory for certain roles/ranks
- Schema: new `training_requirements` table (role, training_type, frequency)
- Backend: CRUD for requirements, validation check for members
- Frontend: admin config page + dashboard alerts for non-compliant members
- Notifications for members missing required training

### QR Code Check-In [Medium]
- Mobile-friendly quick check-in for training events
- Generate QR code containing `POST /api/training/:id/attendance` URL
- Frontend: QR code display on UebungDetail page
- Scanner: simple camera component or link to URL

---

## Backlog — Notifications & Admin

### Customizable Notification Preferences [Medium]
- Per-user opt-in/out of notification types (training, incidents, roster)
- Extend user preferences schema with notification_preferences object
- Backend: check preferences before creating notifications
- Frontend: new section in Settings page with toggle switches per type

---

## Backlog — Reporting & Analytics

### Annual Department Report (PDF) [Significant]
- Compile incident stats, training participation, member roster, equipment inventory
- Backend: new `GET /api/reports/annual?year=2025` generating comprehensive PDF
- Use existing PDF generation pattern from Kalender
- Sections: executive summary, incident stats, training stats, personnel changes, equipment inventory

### Member Hours Tracking [Medium]
- Calculate firefighter hours from training events + incidents + on-duty shifts
- Backend: aggregate event duration (datum_von to datum_bis) + incident time (alarm to einrueck)
- Frontend: member profile analytics tab + dashboard card

### Equipment Utilization Report [Quick Win]
- Usage by category/vehicle/incident type
- Backend: join ausruestung with einsatz_fahrzeuge to correlate
- Frontend: table in admin dashboard or Ausruestung page

### Member Skills Matrix [Medium]
- Export showing member name × all certifications
- Backend: JOIN across ausbildung, atemschutz_traeger, fahrgenehmigungen
- Frontend: exportable table with color-coded validity indicators
- PDF export using existing PDF generation pattern

---

## Backlog — System

### Incident Photo/Document Gallery [Medium]
- Upload photos/PDFs to incidents
- Schema: new `einsatz_dokumente` table (einsatz_id, filename, mime_type, storage_path)
- Backend: multipart upload endpoint, file storage (local or Nextcloud)
- Frontend: gallery component in EinsatzDetail with drag-and-drop

### Incident Stats Year Selector [Quick Win]
- View historical stats for previous years
- Backend: already supports `year` query parameter
- Frontend: add year selector dropdown to IncidentStatsChart
- Simple UI change, no backend work needed
