Per-Anbieter default VO with auto-select in the schaltung wizard

- New nullable anbieter.default_vo_id column (migration adds it to
  existing DBs); deleting a VO that some provider points at clears
  the reference automatically.
- GET /api/anbieter now includes default_vo_id + default_vo_nummer
  + default_vo_bezeichnung so the wizard can preselect without an
  extra round-trip.
- New PUT /api/anbieter/:id/default-vo endpoint. Validates the VO
  belongs to the given provider; accepts vo_id=null to clear.
- VO admin table grew a "Standard" column and an "Als Standard" /
  "Standard entfernen" button on each row.
- When the user picks a provider in step 1 of the wizard, the VO
  dropdown now preselects the default VO (falling back to the only
  VO if there is exactly one), and immediately loads the
  matching tariffs.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
kerimatilganandClaude Opus 4.7 committed 2026-05-15 16:46:03 +02:00
1 parent 97ff779bcf
commit 041df61b24
5 files changed
+82 -16

No files matched your search

+4 -1
View File
@@ -55,12 +55,15 @@ function initDatabase() {
const db = getDatabase();
db.serialize(() => {
// Anbieter (Providers)
// Anbieter (Providers). default_vo_id picks which of this provider's
// VOs is preselected in the schaltung wizard.
db.run(`CREATE TABLE IF NOT EXISTS anbieter (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL UNIQUE,
default_vo_id INTEGER,
created_at DATETIME DEFAULT CURRENT_TIMESTAMP
)`);
addColumnIfMissing(db, 'anbieter', 'default_vo_id INTEGER');
// Mitarbeiter-Prozentsätze pro Anbieter
db.run(`CREATE TABLE IF NOT EXISTS mitarbeiter_prozentsaetze (