Port planning menus and indoor tables (by Codex)
This commit is contained in:
1 parent
13461c693a
commit
9a93c4fcc8
32 files changed
+1667
-169
No files matched your search
@@ -52,9 +52,9 @@ jobs:
|
||||
- name: Configure opt-in UI without external assets
|
||||
run: cmake -S . -B build-ui -G Ninja -DCMAKE_BUILD_TYPE=Release -DOPENBMH_BUILD_MODERN_UI=ON -DOPENBMH_BUILD_EDITOR=OFF -DBMH_DATA=
|
||||
- name: Compile native frontend and synthetic checks
|
||||
run: cmake --build build-ui --target openbmh_play modern_ui_core_tests modern_ticket_document_tests modern_control_layout_tests modern_reports_tests --parallel 2
|
||||
run: cmake --build build-ui --target openbmh_play modern_ui_core_tests modern_ticket_document_tests modern_control_layout_tests modern_reports_tests modern_planning_tests --parallel 2
|
||||
- name: Check controls, fonts, density and draft cancellation
|
||||
run: ctest --test-dir build-ui -R "^modern_(ui_|ticket_|control_|reports_)" --output-on-failure --output-junit modern-ui-results.xml
|
||||
run: ctest --test-dir build-ui -R "^modern_(ui_|ticket_|control_|reports_|planning_)" --output-on-failure --output-junit modern-ui-results.xml
|
||||
- name: Upload test report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only */
|
||||
/* HTML Hallentabellen: 78/22 percent columns, 66dp heading and row tracks. */
|
||||
.indoor-list .report-row {height:66dp;}
|
||||
.indoor-list .report-cell {width:22%;}
|
||||
.indoor-list .report-cell.first {width:78%;}
|
||||
.indoor-info {display:flex;align-items:center;justify-content:center;left:0;right:0;width:100%;}
|
||||
@@ -1,5 +1,5 @@
|
||||
<rml>
|
||||
<head><title>OpenBMH</title><link type="text/rcss" href="theme.rcss"/><link type="text/rcss" href="ticket.rcss"/><link type="text/rcss" href="sports.rcss"/><link type="text/rcss" href="calendar.rcss"/><link type="text/rcss" href="reports.rcss"/><link type="text/rcss" href="report_details.rcss"/><link type="text/rcss" href="report_pickers.rcss"/></head>
|
||||
<head><title>OpenBMH</title><link type="text/rcss" href="theme.rcss"/><link type="text/rcss" href="ticket.rcss"/><link type="text/rcss" href="sports.rcss"/><link type="text/rcss" href="calendar.rcss"/><link type="text/rcss" href="reports.rcss"/><link type="text/rcss" href="report_details.rcss"/><link type="text/rcss" href="report_pickers.rcss"/><link type="text/rcss" href="indoor.rcss"/><link type="text/rcss" href="planning.rcss"/></head>
|
||||
<body class="midnight">
|
||||
<div id="background"></div>
|
||||
<div id="canvas"></div>
|
||||
|
||||
@@ -0,0 +1,106 @@
|
||||
/* SPDX-License-Identifier: GPL-3.0-only */
|
||||
.planning-heading {position:absolute;left:0;right:0;top:0;height:118dp;}
|
||||
.planning-heading h2 {position:absolute;left:0;right:780dp;top:16dp;font-size:38dp;font-weight:normal;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
|
||||
.planning-heading p {position:absolute;left:0;right:780dp;top:71dp;font-size:26dp;color:var(--muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
|
||||
.friendlies-layout .planning-heading h2 .club-label {height:58dp;}
|
||||
.friendlies-layout .planning-heading.booking h2 {top:8.5dp;}
|
||||
.friendlies-layout .planning-heading.booking p {top:78.5dp;}
|
||||
.planning-progress {position:absolute;right:0;top:34dp;display:flex;align-items:center;gap:32dp;font-size:28dp;color:var(--muted);}
|
||||
.planning-step {display:flex;align-items:center;gap:14dp;}
|
||||
.planning-step-number {display:flex;align-items:center;justify-content:center;width:48dp;height:48dp;border:2dp var(--border);border-radius:24dp;font-size:25dp;}
|
||||
.planning-step.current {color:var(--accent);}
|
||||
.planning-step.current .planning-step-number {background-color:var(--selected);border-color:var(--accent);}
|
||||
.planning-footer {position:absolute;left:0;right:0;bottom:0;height:94dp;display:flex;gap:20dp;}
|
||||
.planning-footer button {flex:1;min-width:0;height:94dp;font-size:30dp;padding:12dp 24dp;border-radius:12dp;background-color:transparent;decorator:linear-gradient(180deg,#c1d1e31c,#869eb312);}
|
||||
.postpone-summary {position:absolute;padding:22dp 28dp;top:1526dp;width:1293dp;height:200dp;border:2dp var(--border);border-radius:16dp;background-color:var(--soft);}
|
||||
.postpone-summary.source {left:0;}
|
||||
.postpone-summary.target {right:0;}
|
||||
.postpone-summary h3 {display:block;margin:0 0 12dp;height:32dp;line-height:32dp;font-size:28dp;font-weight:normal;}
|
||||
.postpone-summary p {display:block;margin:0;font-size:26dp;line-height:1.35;}
|
||||
.postpone-summary small {display:block;margin-top:10dp;font-size:23dp;line-height:27dp;color:var(--muted);}
|
||||
.postpone-summary small.valid,.friendly-date-summary .valid {color:var(--accent);}
|
||||
.postpone-cancel {position:absolute;right:16dp;top:16dp;width:52dp;height:52dp;padding:0;font-size:36dp;background-color:transparent;border:0dp;}
|
||||
.calendar-day.friendly-date {color:#a9dccb;}
|
||||
.calendar-day .source-outline {border-color:#a9dccb;}
|
||||
.friendlies-layout .calendar-day[disabled] {opacity:0.3;}
|
||||
.friendlies-layout .calendar-day.has-match[disabled] {opacity:0.7;}
|
||||
.friendly-opponents {position:absolute;left:0;right:0;top:148dp;bottom:132dp;border:2dp var(--border);border-radius:18dp;background-color:var(--soft);overflow-x:hidden;overflow-y:auto;}
|
||||
.friendly-row {display:flex;height:78dp;font-size:35dp;}
|
||||
.friendly-row.head {height:66dp;font-size:27dp;color:var(--muted);border-bottom:2dp var(--border);}
|
||||
.friendly-row.striped {background-color:var(--soft);}
|
||||
.friendly-row.selected {background-color:var(--selected);}
|
||||
.friendly-cell {display:flex;align-items:center;justify-content:center;flex-shrink:0;width:14%;padding:8dp 24dp;overflow:hidden;}
|
||||
.friendly-cell:first-child {width:58%;justify-content:flex-start;}
|
||||
.friendly-opponent {display:flex;align-items:center;justify-content:flex-start;width:100%;min-width:0;padding:4dp 0;border:0dp;border-radius:6dp;background-color:transparent;font-size:35dp;}
|
||||
.friendly-opponent .club-label {min-width:0;white-space:nowrap;}
|
||||
.friendly-opponent .club-label .image-frame {flex-shrink:0;}
|
||||
.friendly-row.selected .friendly-opponent {color:var(--accent);}
|
||||
.friendly-date-summary {position:absolute;left:0;right:0;top:1606dp;height:132dp;border-top:2dp var(--border);}
|
||||
.friendly-date-summary .date-side,.friendly-date-summary .status-side {position:absolute;top:8dp;width:1268dp;height:114dp;}
|
||||
.friendly-date-summary .date-side {left:20dp;}
|
||||
.friendly-date-summary .status-side {left:1324dp;}
|
||||
.friendly-date-summary .date-side>span {position:absolute;top:22dp;font-size:24dp;color:var(--muted);}
|
||||
.friendly-date-summary .date-side p {position:absolute;top:69dp;left:0;right:0;font-size:29dp;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;}
|
||||
.friendly-key {display:flex;align-items:center;gap:12dp;font-size:24dp;color:var(--muted);}
|
||||
.friendly-key .league-dot,.friendly-key .friendly-dot {display:block;width:12dp;height:12dp;flex-shrink:0;border-radius:6dp;background-color:#e9cb86;}
|
||||
.friendly-key .friendly-dot {margin-left:20dp;background-color:#a9dccb;}
|
||||
.friendly-date-summary .status-side p {position:absolute;top:42dp;font-size:27dp;}
|
||||
.planning-layer {position:absolute;left:0;right:0;top:0;bottom:0;z-index:30;display:flex;align-items:center;justify-content:center;background-color:#08101980;}
|
||||
.planning-dialog {position:relative;width:1840dp;flex-shrink:0;border:2dp #e1ecf429;border-radius:22dp;background-color:#283542f5;font-size:30dp;}
|
||||
.planning-dialog h2 {position:absolute;left:52dp;right:52dp;top:40dp;height:45dp;line-height:45dp;font-size:40dp;text-align:center;font-weight:bold;}
|
||||
.friendly-dialog-club {position:absolute;top:121dp;left:52dp;right:52dp;height:209dp;display:flex;flex-direction:column;align-items:center;gap:30dp;padding:20dp 0 34dp;font-size:38dp;}
|
||||
.friendly-dialog-club>.club-label {display:flex;align-items:center;justify-content:center;gap:18dp;}
|
||||
.friendly-dialog-club>span:last-child {font-size:29dp;color:var(--muted);}
|
||||
.planning-badge {display:block;width:92dp;height:92dp;padding:10dp;border-radius:14dp;background-color:#f4f6f8;}
|
||||
.friendly-quote-amount {position:absolute;left:52dp;right:52dp;top:365dp;height:111dp;display:flex;align-items:center;justify-content:space-between;border:2dp var(--border);border-radius:16dp;background-color:var(--soft);padding:32dp;font-size:32dp;}
|
||||
.friendly-quote-amount strong {font-size:38dp;font-weight:normal;color:var(--accent);}
|
||||
.friendly-quote-note {position:absolute;left:52dp;right:52dp;top:511dp;font-size:29dp;line-height:43.5dp;text-align:center;color:var(--muted);}
|
||||
.planning-dialog-actions {position:absolute;left:52dp;right:52dp;bottom:40dp;height:82dp;display:flex;gap:24dp;}
|
||||
.planning-dialog-actions button {flex:1;min-width:0;height:82dp;font-size:30dp;padding:12dp 24dp;border-radius:12dp;background-color:transparent;decorator:linear-gradient(180deg,#c1d1e31c,#869eb312);}
|
||||
.friendly-bookings {position:absolute;left:52dp;right:52dp;top:121dp;bottom:162dp;overflow-y:auto;overflow-x:hidden;}
|
||||
.friendly-bookings>p {font-size:29dp;line-height:43.5dp;text-align:center;}
|
||||
.friendly-booking-row {display:flex;height:80dp;font-size:29dp;}
|
||||
.friendly-booking-row.head {font-size:26dp;color:var(--muted);border-bottom:2dp var(--border);}
|
||||
.friendly-booking-row>span {display:flex;align-items:center;flex-shrink:0;width:24%;padding:12dp 16dp;}
|
||||
.friendly-booking-row>span:nth-child(2) {width:58%;}
|
||||
.friendly-booking-row>span:nth-child(3) {width:18%;justify-content:center;}
|
||||
.planning-notice {position:absolute;left:52dp;right:52dp;top:121dp;font-size:36dp;line-height:54dp;}
|
||||
body.midnight .planning-heading h2 {color:#e0eaf2;}
|
||||
body.midnight .planning-heading p {color:#a2b8c9;}
|
||||
body.midnight .planning-dialog h2 {color:#e3ecf3;}
|
||||
body.midnight .friendly-opponents {background-color:#12243140;border-color:#c5d9e726;}
|
||||
body.midnight .friendly-row {color:#d4e0e9;}
|
||||
body.midnight .friendly-row.head {color:#9fb7c8;}
|
||||
body.midnight .friendly-row.striped {background-color:#e3edf605;}
|
||||
body.midnight .friendly-row.selected {background-color:#9acbb21a;}
|
||||
body.silver .planning-dialog {background-color:#eaf1f7fc;border-color:var(--border);}
|
||||
body.matchday .planning-dialog {background-color:#2c2c32fc;border-color:var(--border);}
|
||||
body.silver .planning-footer button,body.silver .planning-dialog-actions button {decorator:linear-gradient(180deg,#ffffffb0,#bfd0e259);}
|
||||
body.matchday .planning-footer button,body.matchday .planning-dialog-actions button {decorator:linear-gradient(180deg,#e8d6dc12,#a1a0aa0d);}
|
||||
body.silver .calendar-day.friendly-date {color:#256a4f;}
|
||||
body.silver .calendar-day .source-outline {border-color:#256a4f;}
|
||||
|
||||
.postpone-layout .planning-heading {height:100dp;}
|
||||
.postpone-layout .planning-heading h2 {top:11dp;font-size:34dp;}
|
||||
.postpone-layout .planning-heading p {top:60dp;font-size:25dp;}
|
||||
.postpone-layout .planning-progress {top:26dp;font-size:29dp;gap:34dp;}
|
||||
.postpone-layout .planning-step-number {font-size:26dp;}
|
||||
.postpone-summary.selected-source {padding-right:90dp;border-color:var(--accent);}
|
||||
.postpone-layout .planning-footer button {font-size:29dp;}
|
||||
#postpone-move:not([disabled]) {color:var(--accent);background-color:var(--selected);border-color:var(--accent);}
|
||||
body.midnight .postpone-layout .planning-heading h2 {color:#dce8f1;}
|
||||
body.midnight .postpone-layout .planning-heading p {color:#9fb8ca;}
|
||||
body.midnight .postpone-summary {border-color:#c5d9e726;background-color:#12243140;}
|
||||
body.midnight .postpone-summary h3 {color:#c9dce9;}
|
||||
body.midnight .postpone-summary p {color:#afc5d5;}
|
||||
body.midnight .postpone-summary small {color:#8faabc;}
|
||||
body.midnight .postpone-summary .valid {color:#a9dccb;}
|
||||
body.midnight .postpone-summary.selected-source {border-color:#a9dccb57;}
|
||||
body.midnight .friendly-quote-amount strong {color:#f7e7ac;}
|
||||
|
||||
.planning-dialog.undo-blocked {width:2484dp;}
|
||||
.planning-dialog.undo-blocked h2 {font-size:42dp;height:48dp;line-height:48dp;color:var(--text);}
|
||||
.planning-dialog.undo-blocked .planning-notice {top:124dp;}
|
||||
.planning-dialog.undo-blocked .planning-dialog-actions {height:65dp;}
|
||||
.planning-dialog.undo-blocked .planning-dialog-actions button {height:65dp;font-size:32dp;}
|
||||
body.midnight .planning-dialog.undo-blocked h2 {color:#eff0d6;}
|
||||
@@ -48,3 +48,6 @@ body.silver .report-detail-actions .report-detail-action:hover,body.matchday .re
|
||||
body.silver .report-detail-table,body.matchday .report-detail-table {color:var(--text);}
|
||||
body.silver .report-detail-striped {background-color:#42627d09;}
|
||||
body.matchday .report-detail-striped {background-color:#f8e7e00a;}
|
||||
|
||||
.report-detail-indoor-info {height:332dp;}
|
||||
.report-detail-info-text {position:absolute;left:52dp;right:52dp;top:124dp;height:54dp;line-height:54dp;margin:0;font-size:36dp;}
|
||||
@@ -1,6 +1,6 @@
|
||||
# Native Modern UI · erster Umsetzungsstand
|
||||
|
||||
Stand: 23. Oktober 2026. **Experimenteller RmlUI-Unterbau und erster
|
||||
Stand: 24. Oktober 2026. **Experimenteller RmlUI-Unterbau und erster
|
||||
bedienbarer Durchlauf. Noch keine vollständige Umsetzung des HTML-Mockups.**
|
||||
Die normale Classic-Konfiguration bleibt unverändert; die neue Oberfläche
|
||||
wird ausdrücklich mit `OPENBMH_BUILD_MODERN_UI=ON` gebaut.
|
||||
@@ -45,6 +45,15 @@ wird ausdrücklich mit `OPENBMH_BUILD_MODERN_UI=ON` gebaut.
|
||||
Spielerprofile einschließlich Wappen und Porträts. Ergebnisse, Tabellen
|
||||
und Qualifikationsfarben bleiben ausdrücklich Demo-Projektionen.
|
||||
|
||||
- [Freundschaftsspiele](desktop/friendlies/README.md): inländische und
|
||||
ausländische Gegner, Austragungsort und Kostenbestätigung, freier Termin,
|
||||
bis zu 20 lokale Vormerkungen und sortierte Übersicht.
|
||||
- [Verlegen](desktop/postpone/README.md): Ausgangsspiel und neuer Termin,
|
||||
Originaltag als stabile Identität, erneute Verlegung und Rücknahme mit
|
||||
belegtem Originaltermin als Sperrfall. Änderungen erscheinen im Kalender.
|
||||
- [Hallentabellen](desktop/indoor/README.md): bis zu 16 Vereine aus der ersten
|
||||
deutschen Liga, unabhängige Platz-/Punktesortierung, Vereinsprofile und Info.
|
||||
|
||||
**Anstoß führt keine Aktion aus**, weder per Maus noch per Tastatur. Das gilt
|
||||
auch für die direkte Aktionsschnittstelle des Demoanbieters.
|
||||
|
||||
|
||||
@@ -20,6 +20,9 @@ Implementierung in der Spiel-Engine.
|
||||
| Taktik | [Interaktive Diagramme und Einsatzregler](desktop/tactics/README.md) |
|
||||
| Kalender | [Zwölf Monate, transponierte Wochen und Ligavorschau](desktop/calendar/README.md) |
|
||||
| Berichte | [Tabellen, Stärken, Ligaspiele, übrige Spiele und Profile](desktop/reports/README.md) |
|
||||
| Freundschaftsspiele | [Gegner, Austragungsort, Kostenbestätigung und Vormerkungen](desktop/friendlies/README.md) |
|
||||
| Verlegen | [Kalendergestützte Verlegung mit Rücknahme](desktop/postpone/README.md) |
|
||||
| Hallentabellen | [16 Vereine, Sortierung und Hallenmasters-Info](desktop/indoor/README.md) |
|
||||
| Transfers | [Ablöse-Kasten und Positionsfilter](desktop/transfers/README.md) |
|
||||
|
||||
Jeder Bereich nennt die geprüfte Quelle, bestehende Funktionen und offene
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# Kalender · native Modern UI
|
||||
|
||||
Stand: 23. Oktober 2026. Quelle ist das unveränderte private HTML-Mockup
|
||||
`bmh_4k_ui`, Produktrevision `0bf0f2afd2ff8d5dabb96c795db2a5d0abaaf278`:
|
||||
Stand: 24. Oktober 2026. Quelle ist das unveränderte private HTML-Mockup
|
||||
`bmh_4k_ui`, Referenzrevision `a7f8e39c8cb562a09d85dabae81e62a981afeb85`:
|
||||
`desktop/management-menus.js`, `league-preview.js`, `table-window.css` und
|
||||
`menu-themes.css`. Native Ansicht: `src/modern/ui/calendar_screen.inc`.
|
||||
|
||||
@@ -28,8 +28,10 @@ Wiederöffnen und Laden eines UI-Demostands erhalten.
|
||||
## Daten und Enginegrenze
|
||||
|
||||
Der Demoanbieter liefert `calendar` mit Saisonbeginn, gewähltem Tagesindex,
|
||||
Liga-ID und reservierten leeren Projektionen für Freundschaftsspiele und
|
||||
Verlegungen. `calendar`-Aktionen erlauben nur `select` und `league`.
|
||||
Liga-ID sowie die lokale Planung aus [Freundschaftsspielen](../friendlies/README.md)
|
||||
und [Verlegen](../postpone/README.md). Die Vormerkungen und Verlegungen
|
||||
ändern die angezeigten Termine der eigenen Liga; bei fremder Ligavorschau
|
||||
bleiben deren Vorschautermine unverändert.
|
||||
Unbekannte Ligen, ungültige Tagesindizes und nicht ganzzahlige Eingaben
|
||||
werden atomar abgewiesen. Die Saison stammt aus dem Demodatum; sie ist
|
||||
nicht auf das Jahr der HTML-Vorschau festgelegt.
|
||||
@@ -43,9 +45,9 @@ angezeigten Liga. Die Manageridentität wird dadurch nicht geändert.
|
||||
**Dies ist keine Spielplanerzeugung für die Engine.** Es gibt weder Zufall
|
||||
noch Sessionzugriffe. Der spätere Sessionadapter ersetzt die Terminvorschau
|
||||
durch echte Spieltage, Pokale, Verlegungen und Freundschaftsspiele. Die
|
||||
zugehörigen nativen Planungsmenüs und farbigen Freundschaftsmarkierungen sind
|
||||
in diesem Meilenstein noch nicht angebunden; deren gespeicherte Aktionen
|
||||
werden nicht stillschweigend vorgetäuscht.
|
||||
zugehörigen nativen Planungsmenüs und farbigen Freundschaftsmarkierungen
|
||||
sind als reine UI-Vorschau angebunden. Bestätigte Vormerkungen sind grün
|
||||
markiert und erscheinen mit Gegner in der Terminzeile.
|
||||
|
||||
## QA
|
||||
|
||||
@@ -60,5 +62,6 @@ Synthetische Regression prüft Gregorianische Schaltjahre einschließlich
|
||||
2100, Wochentagspositionen, zwei Begegnungen je Gegner, 18-/20-Vereinsgrößen,
|
||||
atomare Ablehnung und Wiederherstellung. Die Renderer-QA prüft zusätzlich
|
||||
sichtbare Wochentage, Auswahlrahmen, Terminzeilen, Tastatur/Fokus und
|
||||
Länder-/Ligawechsel. Gemeinsame Dropdown-Optik bleibt in der
|
||||
[Befundliste](../../qa-findings.md) erfasst.
|
||||
Länder-/Ligawechsel. Land und Liga verwenden jetzt die gemeinsamen Footerpicker mit identischer
|
||||
Popupschrift und separater Markierungsspalte. Das bewusste erneute Wählen
|
||||
des gleichen Landes setzt seine erste Liga zurück; Escape verwirft die Auswahl.
|
||||
@@ -0,0 +1,148 @@
|
||||
# Freundschaftsspiele · native Modern UI
|
||||
|
||||
Stand: 24. Oktober 2026, natives Planungspaket. Die unveränderte private
|
||||
HTML-Referenz `bmh_4k_ui` steht auf
|
||||
`a7f8e39c8cb562a09d85dabae81e62a981afeb85`; die relevanten Produktdateien
|
||||
entsprechen `494a25611de847f23bf714bfdab6708387f581a7`.
|
||||
Maßgeblich sind `desktop/management-menus.js`, `league-preview.js`,
|
||||
`advertising-friendlies-window.css` und die gemeinsamen Tabellen- und
|
||||
Theme-Regeln. Native Quellen sind
|
||||
[planning_screens.inc](../../../../src/modern/ui/planning_screens.inc),
|
||||
[planning_controls.inc](../../../../src/modern/ui/planning_controls.inc),
|
||||
[calendar_screen.inc](../../../../src/modern/ui/calendar_screen.inc) und
|
||||
[planning.rcss](../../../../assets/modern/planning.rcss).
|
||||
Private Referenzbilder und Weltdaten werden nicht mitgeliefert.
|
||||
|
||||
## Ansicht und Ablauf
|
||||
|
||||
Die Gegnerphase zeigt Verein und Wappen, Stärke, Platz und Spiele. Nur der
|
||||
verwaltete Verein fehlt in seiner eigenen Ligaauswahl; ausländische Vereine
|
||||
sind als Gegner zulässig. Land und Liga wechseln unabhängig von der
|
||||
Ligavorschau des normalen Kalenders und der Berichte. Zielstruktur sind
|
||||
fünf deutsche Ligen mit je 18 Vereinen und die vier Auslandsländer Spanien,
|
||||
Italien, Frankreich und England als Vorschau und Gegnerquelle. Vorhandene
|
||||
Katalogligen und deren Vereinszahlen werden gelesen; eine ausländische
|
||||
Auswahl eröffnet keine andere Karriere. Die Vorschautermine unterstützen
|
||||
insbesondere 18 Vereine mit 34 und 20 Vereine mit 38 Spieltagen.
|
||||
|
||||
Die Dialogfolge der HTML-Referenz bleibt erhalten:
|
||||
|
||||
1. Gegner wählen oder „Termin auswählen“ öffnen: Dialog „Austragungsort“.
|
||||
2. „Heim“ oder „Auswärts“ übernehmen: Dialog „Freundschaftsspiel · Kosten“.
|
||||
3. „Termin wählen“ bestätigen: Kalenderphase mit zwölf Monaten von Juli
|
||||
bis Juni, vier Spalten und drei Reihen.
|
||||
4. Freien Tag auswählen und „Termin vormerken“ betätigen: lokale
|
||||
Vormerkung mit Bestätigung. Nach dem Schließen führt der Fokus zur
|
||||
Schaltfläche „Vorgemerkte Spiele“.
|
||||
|
||||
Gegner und Austragungsort werden bereits bei ihrer Auswahl gespeichert.
|
||||
Abbrechen oder Escape im Dialog erhält diese Auswahl, erzeugt aber kein
|
||||
Spiel. Escape in der Kalenderphase führt zur Gegnerphase zurück. Tab
|
||||
bleibt innerhalb eines offenen Dialogs; nach dessen Schließen wird der
|
||||
aufrufende Knopf wieder fokussiert. Die Vormerkungsliste ist nach Datum
|
||||
sortiert und zeigt Datum, Gegner und Heim/Auswärts.
|
||||
|
||||
Der Kostenbeitrag ist eine reine Demoanzeige:
|
||||
`(Heim ? 25000 : 12000) + ursprünglicher Gegnerindex × 500`.
|
||||
Der Index stammt aus der vollständigen Katalogreihenfolge der gewählten
|
||||
Gegnerliga, bevor der eigene Verein aus der sichtbaren Liste entfernt wird.
|
||||
Keine Bestätigung zieht diesen Betrag vom Guthaben ab.
|
||||
|
||||
## Termine, Zustand und Speicherung
|
||||
|
||||
[demo_calendar.hpp](../../../../src/modern/ui/demo_calendar.hpp) und
|
||||
[demo_calendar.cpp](../../../../src/modern/ui/demo_calendar.cpp) stellen den
|
||||
Präsentationsvertrag bereit. `DemoSource` hält unter `calendar` den
|
||||
Saisonbeginn `start`, den gemeinsamen Tagesindex `selected`, die mit
|
||||
`reports.league` synchronisierte Vorschau `league` sowie die getrennte
|
||||
Gegnerauswahl `friendly_league`, `opponent`, `home` und
|
||||
`friendly_stage` (`0` Gegnerphase, `1` Kalenderphase). Die Vormerkungen
|
||||
liegen in `friendlies` als `{day, opponent, league, home}`. Vereins- und
|
||||
Ligaangaben sind stabile Katalog-IDs. Leere oder einzelne Vereinsbestände
|
||||
dürfen `opponent: ""` zeigen; ohne gültigen Gegner bleibt Vormerken gesperrt.
|
||||
|
||||
Die `calendar`-Aktionen `friendly-country`, `friendly-league`,
|
||||
`friendly-opponent`, `friendly-venue`, `friendly-stage` und `friendly-book`
|
||||
ändern ausschließlich diesen Demozustand. `select` wählt weiter den
|
||||
geteilten Kalendertag. Der Provider prüft den vorhandenen und den geplanten
|
||||
Zustand, bevor er eine Änderung übernimmt. Ungültige Typen, unbekannte IDs,
|
||||
der eigene Verein als Gegner und zusätzliche Aktionsfelder werden
|
||||
abgewiesen. `DemoSource` weist zusätzlich veraltete Revisionen zurück.
|
||||
|
||||
Freie Termine beginnen am Saisonindex 7, also am 8. Juli, und müssen vor
|
||||
dem nächsten 1. Juli liegen. Ligaspiele einschließlich ihrer
|
||||
[Verlegungen](../postpone/README.md) und vorhandene Freundschaftsspiele
|
||||
belegen den Kalender der eigenen Karriere. Eine fremde Vorschau in
|
||||
`calendar.league` verändert diese Prüfung nicht. Derselbe Tag kann nicht
|
||||
zweimal reserviert werden; maximal 20 Vormerkungen sind erlaubt. Frühe und
|
||||
belegte Tage sind in der Kalenderphase gesperrt; nach 20 Einträgen sind
|
||||
„Termin auswählen“ und „Termin vormerken“ gesperrt. Im normalen Kalender
|
||||
erscheinen eigene Vormerkungen nur bei Vorschau der eigenen Liga.
|
||||
|
||||
Speichern und Laden erhält Auswahl, Kalenderphase und Vormerkungen.
|
||||
`migrate_demo_calendar()` ergänzt fehlende Planungsfelder älterer
|
||||
Checkpoints und validiert das vollständige Ergebnis atomar. Vorhandene
|
||||
ungültige Werte, beschädigte Einträge und Terminüberschneidungen werden
|
||||
abgewiesen und nicht repariert. Ein Wechsel des ersten verwalteten Vereins
|
||||
setzt dessen Kalenderplanung zurück; Änderungen weiterer Manager bei
|
||||
unverändertem erstem Verein erhalten sie.
|
||||
|
||||
## Referenzmaße und bewusste Abweichungen
|
||||
|
||||
Die Referenzvermessung verwendet eine logische Inhaltsfläche von
|
||||
2612 × 1864. Die Gegnerliste beginnt bei `(0,148)` und ist 2612 × 1584
|
||||
groß; ihre Spalten sind 58/14/14/14 Prozent breit. Der Kopf ist 66 Einheiten
|
||||
hoch bei Schriftgröße 27, Datenzeilen 78 bei Schriftgröße 35. Der untere
|
||||
Bereich beginnt bei y1770 und ist 94 Einheiten hoch. Die Kalenderphase
|
||||
verwendet `(0,148,2612,1424)` mit Monatsabständen von 22; darunter liegen
|
||||
Terminübersicht und drei Aktionsknöpfe. Die mittigen Dialoge sind 1840
|
||||
Einheiten breit, die Ort-Auswahl 496, der Kostendialog 720,5 Einheiten hoch.
|
||||
Diese Maße beschreiben den HTML-Maßstab; ihre native Übereinstimmung gehört
|
||||
zur gesonderten Laufzeitprüfung.
|
||||
|
||||
**OpenBMH deviates from the original:** Die Saison folgt dem gespeicherten
|
||||
Demodatum einschließlich tatsächlicher Schaltjahre statt dem festen
|
||||
HTML-Jahr 2027/28. IDs ersetzen veränderliche Vereins- und Ligaindizes.
|
||||
Vereine, Wappen und Kader stammen aus dem geladenen OBW; die Stärke wird
|
||||
mit der bestehenden Berichtsprojektion aus vorhandenen Kaderattributen
|
||||
bestimmt. Fehlende Stärken bleiben „—“. Die HTML-Formel `79 − i % 9` wird
|
||||
nicht als tatsächliche Vereinsstärke ausgegeben. Platz `i + 1` und Spiele
|
||||
`26` bleiben ausdrücklich Demoangaben.
|
||||
|
||||
Nach dem Kostendialog erhält ein bereits gültiger gewählter Tag den Fokus;
|
||||
sonst wird chronologisch der erste freie Tag ab Index 7 fokussiert. Die
|
||||
HTML-Referenz greift stattdessen auf den ersten freien Knopf ihrer nach
|
||||
Wochentagen angeordneten DOM-Reihenfolge zurück, im Referenzdefault auf
|
||||
den 12. Juli. Der native Fokus verändert den gespeicherten gewählten Tag
|
||||
nicht eigenmächtig.
|
||||
|
||||
## Prüfstand und Enginegrenze
|
||||
|
||||
`tests/modern_planning_tests.cpp` und die Planungsfälle in
|
||||
`tests/modern_ui_core_tests.cpp` sind grün. Die synthetischen Tests prüfen
|
||||
unter anderem stabile IDs, Gebührenindex, 18-/20-Vereinsvorlagen,
|
||||
Schaltjahresgrenzen, freie/belegte Termine, das 20er-Limit, fehlerhafte
|
||||
Eingaben einschließlich Ganzzahlüberlauf, atomare Ablehnung, Migration und
|
||||
Speicher-Roundtrip. Die Sourceintegration prüft auch Planung bei fremder
|
||||
Ligavorschau, unveränderte Finanzen und Manager sowie die vollständige
|
||||
Ablehnung kollidierender Checkpoints.
|
||||
|
||||
Der gemeinsame Paketbuild und alle 18 ausgewählten Regressionstests bestehen.
|
||||
Die unabhängige native Prüfung umfasst 18 Matrixläufe in drei Themes bei
|
||||
720p/1080p, 43 Bedienzustände und gezielte Nachprüfungen der visuellen
|
||||
Sperrkennzeichnung. Die beschriebenen P1-/P2-Befunde sind behoben. Bilder,
|
||||
Skripte und ladbare UI-Demostände liegen privat unter
|
||||
`bmh_4k_ui/docs/qa/planning-batch-2026-10-24/`. Diese Nachweise betreffen
|
||||
Linux/OpenGL und die dokumentierten Fälle, keine vollständige
|
||||
Windows-/macOS-Laufzeitabnahme oder allgemeine Freigabe der Modern UI.
|
||||
|
||||
Es entstehen ausschließlich lokale UI-Vormerkungen. Der Provider
|
||||
konstruiert keine Engine oder Session, verbraucht keinen RNG und ändert
|
||||
weder OBW-Welt noch Geld, Ergebnisse oder echte Spielpläne. Der spätere
|
||||
Sessionadapter muss verbindliche Terminregeln, Gegnerzusagen, Kosten und
|
||||
Matchanlage gesondert liefern; die Demo bestätigt diese Regeln nicht.
|
||||
|
||||
Der Austragungsort heißt nativ „Heimspiel“ statt des im Gold fest gebundenen
|
||||
„Heimspiel in Frankfurt“. Die Demo erfindet keinen Ortsdatensatz für andere
|
||||
verwaltete Vereine. Beim Wechsel über OS-Beenden → Speichern wird eine offene
|
||||
Planungsauflage verworfen; der Speicherbildschirm bleibt per Tab bedienbar.
|
||||
@@ -0,0 +1,97 @@
|
||||
# Hallentabellen
|
||||
|
||||
Stand: 24. Oktober 2026. Die native RmlUI-Ansicht übernimmt die
|
||||
Hallentabellen aus dem privaten HTML-Mockup `bmh_4k_ui`, Referenzrevision
|
||||
`a7f8e39c`. Das relevante Produktverhalten entspricht Revision
|
||||
`494a25611de847f23bf714bfdab6708387f581a7`. Maßgeblich sind insbesondere
|
||||
`desktop/report-menus.js` (`indoor()`, `sortOptions()`), `poc-menus.css`,
|
||||
`table-window.css` und `menu-themes.css`. Proprietäre Referenzbilder und
|
||||
Weltdaten gehören nicht in dieses öffentliche Dokument.
|
||||
|
||||
## Sichtbare Daten und Grenzen
|
||||
|
||||
Die Ansicht kombiniert Vereine, Namen und Wappen aus dem geladenen
|
||||
OBW-Katalog mit ausdrücklich fiktiven Platzierungen und Punkten. Sie
|
||||
verwendet die ersten **höchstens 16 Vereine der ersten deutschen
|
||||
Katalogliga**, in deren Katalogreihenfolge. Die Platzierung ist der
|
||||
Ausgangsindex plus eins; die Punktzahl lautet `324 − 19 × Ausgangsindex`.
|
||||
Bei 16 Vereinen reicht sie daher von 324 bis 39 Punkten. Kleinere Ligen
|
||||
zeigen nur ihre vorhandenen Vereine. Ohne deutsche Liga bleibt die Liste
|
||||
leer; es gibt keine erfundenen Ersatzvereine.
|
||||
|
||||
Die Auswahl erfolgt unabhängig von der aktuell in anderen Berichten
|
||||
gewählten Liga, dem Land, Tabellenfilter, Spieltag und Wettbewerb. Eine
|
||||
18er- oder 20er-Liga erzeugt hier deshalb jeweils 16 Zeilen. Stabile
|
||||
Katalog-IDs verbinden die Zeilen mit den bestehenden Vereinsprofilen;
|
||||
Vereinsnamen sind nicht im Quellcode festgeschrieben. Der verwaltete
|
||||
Verein verwendet dieselbe Hervorhebung wie die übrigen Berichte.
|
||||
|
||||
Diese Zahlen dienen allein der UI-Vorschau bis zum Anstoß. Die Ansicht
|
||||
berechnet keine echten Hallenturniere, verbraucht keinen Enginezufall und
|
||||
ändert weder Weltdateien noch Enginezustand. Auch die Beschriftung
|
||||
„Nach dem 5. Turnier“ bestätigt keine tatsächlich gespielten Turniere.
|
||||
|
||||
## Aufbau und Interaktionen
|
||||
|
||||
Der Menüinhalt hat die gemeinsame logische Fläche von 2612 × 1864.
|
||||
Die Tabelle beginnt links oben; ihre beiden Spalten sind zu 78 Prozent
|
||||
„Pl. / Verein“ und zu 22 Prozent „Punkte“ aufgeteilt. Kopf und Datenzeilen
|
||||
sind jeweils 66 Einheiten hoch. Die Kopfzeile verwendet Schriftgröße 30,
|
||||
die Datenzeilen 36. Platz und Verein stehen links, Punkte rechts. Anders
|
||||
als in der Ligatabelle gibt es keine Qualifikationsmarkierungen. Die
|
||||
untere Schaltfläche nimmt die volle Breite und 94 Einheiten Höhe ein.
|
||||
|
||||
Beide Spaltenköpfe sind Sortierschaltflächen mit sichtbarer Richtung und
|
||||
`aria-sort`. „Pl. / Verein“ sortiert nach der vorhandenen Platzierung.
|
||||
Erneutes Betätigen desselben Kopfes kehrt die Richtung um; die erstmalige
|
||||
Auswahl von Platz beginnt aufsteigend, die von Punkten absteigend. Die
|
||||
Standardansicht zeigt Punkte absteigend. Platznummern und Punktzahlen
|
||||
bleiben beim Umsortieren ihrem Verein zugeordnet. Eine gespeicherte
|
||||
Sortierung nach `original` ist ebenfalls zulässig und folgt je nach
|
||||
Richtung der ursprünglichen Katalogreihenfolge. Die Sortierung liegt
|
||||
separat unter `reports.sorts.indoor`; Änderungen anderer Berichtssorten
|
||||
und „Gesamt“ der Ligatabelle setzen sie nicht zurück.
|
||||
|
||||
Vereinsbuttons öffnen dieselben Profile und Kader-/Spielerdetails wie die
|
||||
übrigen Berichte. „Nach dem 5. Turnier“ öffnet den Dialog
|
||||
„Hallenmasters“ mit dem Text „Fiktive Ergebnisse und Platzierungen zur
|
||||
Saison …“. Die Saison folgt dem gespeicherten Demo-Datum: Juli bis
|
||||
Dezember gehören zum beginnenden, Januar bis Juni zum vorherigen
|
||||
Saisonjahr. Es gibt kein festgeschriebenes Jahr aus dem HTML-Mockup.
|
||||
„Zurück“ schließt die Information und stellt den Fokus auf der
|
||||
aufrufenden Schaltfläche wieder her. Die gemeinsame Berichtsebene sperrt
|
||||
während eines offenen Dialogs den darunterliegenden Menüinhalt.
|
||||
|
||||
## Speicherung und Migration
|
||||
|
||||
Neue Demozustände enthalten `reports.sorts.indoor` mit `key: "points"`
|
||||
und `desc: true`. Ältere Checkpoints, denen ausschließlich diese neue
|
||||
Sortierung fehlt, erhalten sie über `migrate_demo_reports()`. Die
|
||||
Migration prüft den vollständigen resultierenden Berichtszustand und
|
||||
übernimmt ihn erst bei erfolgreicher Validierung. Vorhandene gültige
|
||||
Indoor-Sortierungen bleiben unverändert. Vorhandene ungültige Sortierungen,
|
||||
unbekannte Felder und weitere beschädigte Berichtsdaten werden abgewiesen;
|
||||
die Migration repariert sie nicht teilweise.
|
||||
|
||||
`report_indoor_rows()` und die Berichtsaktionen arbeiten ausschließlich
|
||||
mit dem Präsentationszustand und dem unveränderten Katalog. Ob und wann
|
||||
die Engine echte Hallenturniere, Teilnehmer, Punkte oder Ergebnisse
|
||||
liefert, bleibt eine separate Integrationsentscheidung.
|
||||
|
||||
## Prüfstand
|
||||
|
||||
`tests/modern_reports_tests.cpp` prüft mit synthetischen Katalogdaten den
|
||||
16er-Grenzwert, stabile IDs, Plätze und Punkte, die Unabhängigkeit von
|
||||
ausländischer Ligaauswahl und Berichtsfiltern, alle Sortierrichtungen,
|
||||
unabhängige Berichtssortierungen sowie strenge, atomare und wiederholbare
|
||||
Checkpointmigration. Kleine und leere Kataloge werden ebenfalls geprüft.
|
||||
Eine separate C++-Syntaxprüfung von Projektion und Tests ist erfolgreich.
|
||||
|
||||
Der gemeinsame Paketbuild und alle 18 ausgewählten Regressionstests bestehen.
|
||||
Die unabhängige native Prüfung umfasst 18 Matrixläufe in drei Themes bei
|
||||
720p/1080p, 43 Bedienzustände und gezielte Nachprüfungen der visuellen
|
||||
Sperrkennzeichnung. Die beschriebenen P1-/P2-Befunde sind behoben. Bilder,
|
||||
Skripte und ladbare UI-Demostände liegen privat unter
|
||||
`bmh_4k_ui/docs/qa/planning-batch-2026-10-24/`. Diese Nachweise betreffen
|
||||
Linux/OpenGL und die dokumentierten Fälle, keine vollständige
|
||||
Windows-/macOS-Laufzeitabnahme oder allgemeine Freigabe der Modern UI.
|
||||
@@ -0,0 +1,153 @@
|
||||
# Spiel verlegen · native Modern UI
|
||||
|
||||
Stand: 24. Oktober 2026, natives Planungspaket. Quelle ist das unveränderte
|
||||
private HTML-Mockup `bmh_4k_ui`, Referenzrevision
|
||||
`a7f8e39c8cb562a09d85dabae81e62a981afeb85`; die relevanten Produktdateien
|
||||
entsprechen `494a25611de847f23bf714bfdab6708387f581a7`.
|
||||
Maßgeblich sind `desktop/management-menus.js`, `league-preview.js` und
|
||||
`career-menus.css` nach den gemeinsamen Tabellenregeln. Die native
|
||||
Umsetzung liegt in
|
||||
[planning_screens.inc](../../../../src/modern/ui/planning_screens.inc),
|
||||
[planning_controls.inc](../../../../src/modern/ui/planning_controls.inc),
|
||||
[calendar_screen.inc](../../../../src/modern/ui/calendar_screen.inc) und
|
||||
[planning.rcss](../../../../assets/modern/planning.rcss).
|
||||
Private Referenzbilder und Weltdaten bleiben außerhalb des Repositorys.
|
||||
|
||||
## Ansicht und Bedienung
|
||||
|
||||
Der Kopf nennt den eigenen Verein, dessen Liga und die Saison. Daneben
|
||||
stehen die Schritte „Spiel wählen“ und „Termin wählen“. Zwölf Monatskarten
|
||||
von Juli bis Juni stehen in vier Spalten und drei Reihen. Die
|
||||
Wochentage stehen wie in der HTML-Vorlage in sieben Zeilen, die Wochen in
|
||||
sechs Datumsspalten. Ligatermine sind gelb; ein bestätigtes Ausgangsspiel
|
||||
erhält einen grünen Innenrahmen. Unter dem Kalender stehen Ausgangsspiel
|
||||
und neuer Termin in getrennten Karten, darunter die drei Aktionen
|
||||
„Ausgangsspiel wählen“, „Hierhin verlegen“ und „Letzte Verlegung zurück“.
|
||||
|
||||
Zunächst einen gelben Ligatag anklicken und als Ausgangsspiel bestätigen.
|
||||
Danach einen freien Tag ab Saisonindex 7, dem 8. Juli, auswählen und
|
||||
„Hierhin verlegen“ betätigen. Die Ausgangsauswahl wird nach erfolgreicher
|
||||
Verlegung aufgehoben. Anders als im Buchungskalender der
|
||||
[Freundschaftsspiele](../friendlies/README.md) bleiben die Tagesknöpfe hier
|
||||
auch bei früheren oder belegten Terminen anklickbar; der Aktionsknopf
|
||||
bleibt dann gesperrt. Das × der Ausgangskarte hebt nur diese Auswahl auf:
|
||||
gewählter Tag und gespeicherte Verlegungen bleiben erhalten.
|
||||
|
||||
Die Planung verwendet immer die Liga des ersten verwalteten Vereins.
|
||||
Eine zuvor gewählte fremde Liga in Berichten oder im normalen Kalender
|
||||
ändert weder die eigene Karriere noch die Verlegungsquelle. Der
|
||||
Planungsrenderer verwendet dafür eine eigene Ansichtskopie; die geteilte
|
||||
Ligavorschau wird durch das Öffnen dieses Menüs nicht umgestellt.
|
||||
|
||||
## Ursprünglicher Termin und Rücknahme
|
||||
|
||||
Jede Begegnung hat einen unveränderlichen ursprünglichen Saisonindex
|
||||
`from`. `CalendarFixture.day` zeigt den aktuellen Termin, `round` behält
|
||||
den Spieltag und `home`/`away` behalten die stabilen Vereins-IDs. Die
|
||||
Ausgangsauswahl speichert `source_day: from`, keine Position in einer Liste
|
||||
und keinen bereits verschobenen Zwischentermin.
|
||||
|
||||
Beispiel: Ein Spiel von Tag 30 wird auf Tag 7 und anschließend auf Tag 8
|
||||
verlegt. Die gespeicherte Verlegung lautet danach `{from: 30, to: 8}`.
|
||||
Eine erneute Verlegung derselben Quelle ersetzt deren bisherigen Eintrag
|
||||
und hängt sie an das Ende der Rücknahmereihenfolge. „Letzte Verlegung
|
||||
zurück“ entfernt diesen letzten Eintrag und stellt Tag 30 wieder her;
|
||||
Tag 7 ist kein Rücknahmeschritt.
|
||||
|
||||
Ist der Originaltag inzwischen durch ein anderes Ligaspiel oder ein
|
||||
Freundschaftsspiel belegt, wird die Rücknahme atomar abgewiesen. Der Dialog
|
||||
„Rücknahme nicht möglich“ erläutert den belegten ursprünglichen Termin.
|
||||
Die vorhandene Verlegung bleibt erhalten. Das entspricht der belegten
|
||||
HTML-Folge einschließlich des Falls, dass nach einer Verlegung ein
|
||||
Freundschaftsspiel auf den freigewordenen Originaltag vorgemerkt wurde.
|
||||
|
||||
## Daten, Validierung und Checkpoints
|
||||
|
||||
Der Präsentationsprovider in
|
||||
[demo_calendar.hpp](../../../../src/modern/ui/demo_calendar.hpp) und
|
||||
[demo_calendar.cpp](../../../../src/modern/ui/demo_calendar.cpp) erweitert
|
||||
`calendar` um `source_day` mit Standardwert `-1` und `moves` mit Einträgen
|
||||
`{from, to}`. Er teilt `start` und `selected` mit dem normalen Kalender und
|
||||
den Freundschaftsspielen. Nur `calendar.league` wird mit
|
||||
`reports.league` synchronisiert; die Gegnerliga `friendly_league` bleibt
|
||||
separat.
|
||||
|
||||
Die `calendar`-Aktionen `postpone-source`, `postpone-cancel`,
|
||||
`postpone-move` und `postpone-undo` arbeiten auf einer Kopie des
|
||||
Demozustands und übernehmen diese erst nach vollständiger Validierung.
|
||||
`select` wählt den Tag. Die Quelle muss ein ursprünglicher eigener
|
||||
Ligatermin sein; Ziele müssen ab Index 7 und innerhalb der Saison liegen.
|
||||
Doppelte Quellen oder Ziele sowie Überschneidungen zwischen Ligaspielen
|
||||
und den höchstens 20 Freundschaftsvormerkungen werden abgewiesen. Das
|
||||
gilt auch nach mehreren Verlegungen. `DemoSource` überprüft die Revision
|
||||
vor jeder Aktion; fehlgeschlagene oder veraltete Aktionen verändern weder
|
||||
Zustand noch Revision.
|
||||
|
||||
Die Ligavorlage ist deterministisch: erster Termin `30 + 7 × round`, je
|
||||
ein Heim- und Auswärtsspiel pro Gegner. 18 Vereine ergeben 34, 20 Vereine
|
||||
38 Spieltage. Die Zielstruktur umfasst fünf deutsche Ligen mit je 18
|
||||
Vereinen sowie die vier Auslandsländer Spanien, Italien, Frankreich und
|
||||
England als Vorschau. Die tatsächliche Projektion folgt den vorhandenen
|
||||
Katalogligen. Eigene Verlegungen werden ausschließlich bei Vorschau der
|
||||
eigenen Liga angewandt. Bei einer fremden Liga zeigt der normale Kalender
|
||||
die unveränderten Termine ihres ersten Vereins; eigene Vormerkungen werden
|
||||
dort ausgeblendet. Ausländische Vereine bleiben als Freundschaftsgegner
|
||||
wählbar, ohne die Karriere zu wechseln.
|
||||
|
||||
Speichern und Laden erhält die ausgewählte Quelle und alle Verlegungen.
|
||||
`migrate_demo_calendar()` ergänzt fehlende Planungsfelder älterer
|
||||
UI-Checkpoints, validiert aber vorhandene Werte und Einträge unverändert.
|
||||
Ungültige Quellen, Kollisionen, unbekannte IDs oder fehlerhafte Typen
|
||||
führen zur vollständigen Ablehnung. Beim Wechsel des ersten verwalteten
|
||||
Vereins wird die lokale Kalenderplanung zurückgesetzt. Änderungen weiterer
|
||||
Manager bei unverändertem erstem Verein setzen sie nicht zurück.
|
||||
|
||||
## Referenzmaße und bewusste Abweichungen
|
||||
|
||||
Die vermessene HTML-Inhaltsfläche ist 2612 × 1864 groß. Der Kopf belegt
|
||||
`(0,0,2612,100)`. Der Kalender liegt bei `(0,132,2612,1362)`, mit
|
||||
horizontalen Abständen von 28 und vertikalen von 22. Monatskarten messen
|
||||
632 × rund 439,33; Monatsnamen und Tage verwenden Schriftgröße 30,
|
||||
Wochentage 24. Die beiden Zusammenfassungskarten beginnen bei y1526,
|
||||
sind jeweils 1293 × 200 groß und haben 26 Einheiten Abstand. Der
|
||||
Aktionsbereich beginnt bei y1770, ist 94 Einheiten hoch und enthält drei
|
||||
gleich breite Knöpfe mit 24 Einheiten Abstand. Die bestätigte Quelle hat
|
||||
einen grünen Innenrahmen von 3 Einheiten. Diese Referenzmaße sind das
|
||||
Vergleichsziel; sie erklären keine native Abnahme für bereits bestanden.
|
||||
|
||||
**OpenBMH deviates from the original:** Die Saison folgt dem gespeicherten
|
||||
Demodatum statt dem festen HTML-Zeitraum Juli 2027 bis Juni 2028. Reale
|
||||
Gregorianische Schaltjahre bestimmen die Saisonlänge von 365 oder 366
|
||||
Tagen. Stabile Vereins- und Liga-IDs ersetzen die HTML-Listenindizes;
|
||||
der eigene Verein wird aus dem gespeicherten Erstmanager ermittelt und
|
||||
ist nicht fest auf den ersten HTML-Verein eingestellt. Katalognamen und
|
||||
Wappen können entsprechend von der Referenz abweichen. Die Unterschiede
|
||||
bei Gegnerstärken und Fokus nach dem Kostendialog sind im
|
||||
[Freundschaftsspiel-Dokument](../friendlies/README.md) beschrieben.
|
||||
|
||||
## Prüfstand und Enginegrenze
|
||||
|
||||
Die synthetischen Providerprüfungen in `tests/modern_planning_tests.cpp`
|
||||
und die Planungsintegration in `tests/modern_ui_core_tests.cpp` sind grün.
|
||||
Geprüft werden insbesondere ursprüngliche Terminidentität, erneutes
|
||||
Verlegen, Reihenfolge der Rücknahme, durch Freundschaftsspiele blockierte
|
||||
Rücknahme, doppelte Quellen und Ziele, Ligakollisionen, freie Originaltage,
|
||||
fremde Ligavorschau, stabile IDs, Saisonränder und atomare Ablehnung.
|
||||
Die Sourceintegration prüft den Speicher-Roundtrip und stellt bei
|
||||
kollidierenden Checkpoints den unveränderten Zustand samt Revision sicher.
|
||||
|
||||
Der gemeinsame Paketbuild und alle 18 ausgewählten Regressionstests bestehen.
|
||||
Die unabhängige native Prüfung umfasst 18 Matrixläufe in drei Themes bei
|
||||
720p/1080p, 43 Bedienzustände und gezielte Nachprüfungen der visuellen
|
||||
Sperrkennzeichnung. Die beschriebenen P1-/P2-Befunde sind behoben. Bilder,
|
||||
Skripte und ladbare UI-Demostände liegen privat unter
|
||||
`bmh_4k_ui/docs/qa/planning-batch-2026-10-24/`. Diese Nachweise betreffen
|
||||
Linux/OpenGL und die dokumentierten Fälle, keine vollständige
|
||||
Windows-/macOS-Laufzeitabnahme oder allgemeine Freigabe der Modern UI.
|
||||
|
||||
Diese Verlegungen betreffen ausschließlich den lokalen UI-Demostand.
|
||||
Weder Engine noch Session werden erzeugt oder verändert, kein RNG wird
|
||||
verbraucht und weder Geld noch OBW-Welt oder echte Spiele ändern sich.
|
||||
Der spätere Sessionadapter muss tatsächliche Spielpläne, zulässige
|
||||
Verlegungszeiträume, Wettbewerbe, Zustimmung und mögliche Kosten liefern.
|
||||
Die aktuelle Demo behauptet keine solche Enginefreigabe.
|
||||
@@ -66,3 +66,9 @@ deshalb nicht ins öffentliche Quellcode-Repository. Öffentliche Zusammenfassun
|
||||
- [Berichte](desktop/reports/README.md): Tabellen/Stärken und zwei Spielübersichten
|
||||
als gemeinsames Paket; eigenständiger HTML-/Renderervergleich einschließlich
|
||||
20 Vereinen, Sortierung, Footerpickern und Vereins-/Spielerprofilen.
|
||||
|
||||
- [Verlegen](desktop/postpone/README.md),
|
||||
[Freundschaftsspiele](desktop/friendlies/README.md) und
|
||||
[Hallentabellen](desktop/indoor/README.md): ein gemeinsames Paket mit
|
||||
18 Rendererläufen, 43 Bedienzuständen und gesondertem OS-Beenden-/
|
||||
Speichern-Nachtest. Aktueller Gesamtkatalog: 18 native und 18 offene Routen.
|
||||
@@ -1,14 +1,14 @@
|
||||
# Offene native UI-Befunde
|
||||
|
||||
Stand: 23. Oktober 2026. Diese Liste betrifft die ausdrücklich aktivierte,
|
||||
Stand: 24. Oktober 2026. Diese Liste betrifft die ausdrücklich aktivierte,
|
||||
noch unfertige Modern-Vorschau. Sie ist keine Abnahme der kompletten UI.
|
||||
Verbindliche Quelle ist das private HTML-Mockup; echte Rendererbilder und
|
||||
Bedienungsnachweise bleiben im privaten QA-Paket.
|
||||
|
||||
| Bereich | Priorität | Noch offen |
|
||||
|---|---|---|
|
||||
| Weitere native Dropdowns | P2 | Die neuen HTML-nahen Footerpicker gelten zunächst für Tabellen, Stärken, Ligaspiele und übrige Spiele. Kalender/Manager und weitere Auswahlfelder verwenden noch den bisherigen Select-Unterbau. |
|
||||
| Länder-Picker außerhalb des Berichtpakets | P2 | Bewusste Neuwahl derselben Nation setzt in HTML auf deren erste Liga zurück. In den vier Berichtmenüs umgesetzt; Kalender/Manager noch gesondert angleichen. Abbrechen muss die Unterliga erhalten. |
|
||||
| Weitere native Dropdowns | P2 | Die neuen HTML-nahen Footerpicker gelten für Tabellen, Stärken, Ligaspiele, übrige Spiele, Kalender und Freundschaftsspiele. Manager und weitere Auswahlfelder verwenden noch den bisherigen Select-Unterbau. |
|
||||
| Länder-Picker außerhalb des Berichtpakets | P2 | Bewusste Neuwahl derselben Nation setzt in HTML auf deren erste Liga zurück. In Berichtmenüs, Kalender und Freundschaftsspielen umgesetzt; Manager noch gesondert angleichen. Abbrechen muss die Unterliga erhalten. |
|
||||
| Desktop/Rahmen | P2 | Vollständiger Bild-, Widgetinhalt- und Glasvergleich noch ausstehend; aktuelle Teilprüfungen betreffen einzelne Komponenten. |
|
||||
| Weitere Untermenüs | Offen | Noch nicht portierte Routen im Gesamtkatalog bleiben ausdrücklich `UNIMPLEMENTED`. |
|
||||
|
||||
@@ -19,6 +19,10 @@ Vereinsprofil, Kader und Spielerprofil ersetzen den bisherigen Hinweistext.
|
||||
Die neuen Footerpicker übernehmen Markierungsspalte, Popupzeilen,
|
||||
Themes, Platzierung und Tastatursteuerung der HTML-Vorlage.
|
||||
|
||||
Das Planungspaket ergänzt Verlegen, Freundschaftsspiele und Hallentabellen.
|
||||
Beim Verlassen eines Menüs werden lokale Dialog- und Pickerzustände auch
|
||||
beim Wechsel über die OS-Beenden-/Speichern-Rückfrage verworfen.
|
||||
|
||||
Bereits korrigiert wurden vertikale Button-/Dropdownbeschriftungen,
|
||||
Pfeilausrichtung, Escape/Fokus nach Auswahl, Training-Scrollposition,
|
||||
Budgetumbrüche, lange Spielernamen neben Stärkewerten sowie Taktik-Schatten.
|
||||
@@ -28,7 +32,7 @@ gemeinsamen Controländerungen zusätzlich in mehreren Menüs nachgeprüft.
|
||||
Die erste Gesamterfassung enthält 36 Routen, davon zwölf native Aufnahmen
|
||||
und 24 ausstehende Ports. Diese historische Matrix bleibt unverändert.
|
||||
Der anschließend übertragene Kalender bekommt einen eigenen Vergleich;
|
||||
der aktuelle Runner erfasst 15 native Routen und 21 offene Ports.
|
||||
der aktuelle Runner erfasst 18 native Routen und 18 offene Ports.
|
||||
Spätere Meilensteine erfassen denselben Gesamtkatalog erneut.
|
||||
|
||||
Siehe [QA-Ablauf](menu-qa.md), [Typografie](typography-qa.md) und
|
||||
|
||||
@@ -14,7 +14,7 @@ endif()
|
||||
set(modern_assets "${CMAKE_BINARY_DIR}/assets/modern")
|
||||
FetchContent_GetProperties(rmlui)
|
||||
file(MAKE_DIRECTORY "${modern_assets}")
|
||||
foreach(asset modern.rml theme.rcss ticket.rcss sports.rcss calendar.rcss reports.rcss report_details.rcss report_pickers.rcss)
|
||||
foreach(asset modern.rml theme.rcss ticket.rcss sports.rcss calendar.rcss reports.rcss report_details.rcss report_pickers.rcss indoor.rcss planning.rcss)
|
||||
configure_file("${CMAKE_SOURCE_DIR}/assets/modern/${asset}" "${modern_assets}/${asset}" COPYONLY)
|
||||
endforeach()
|
||||
file(GLOB modern_icons CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/assets/modern/icons/*.svg")
|
||||
@@ -41,6 +41,12 @@ if(MSVC)
|
||||
target_compile_options(modern_ui_core_tests PRIVATE /utf-8)
|
||||
endif()
|
||||
add_test(NAME modern_ui_core_tests COMMAND modern_ui_core_tests)
|
||||
add_executable(modern_planning_tests ../../../tests/modern_planning_tests.cpp)
|
||||
target_link_libraries(modern_planning_tests PRIVATE bmh_modern_ui_core)
|
||||
if(MSVC)
|
||||
target_compile_options(modern_planning_tests PRIVATE /utf-8)
|
||||
endif()
|
||||
add_test(NAME modern_planning_tests COMMAND modern_planning_tests)
|
||||
add_executable(modern_reports_tests ../../../tests/modern_reports_tests.cpp)
|
||||
target_link_libraries(modern_reports_tests PRIVATE bmh_modern_ui_core)
|
||||
if(MSVC)
|
||||
|
||||
@@ -1,93 +1,86 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
std::string App::render_calendar() {
|
||||
const auto snapshot = snap();
|
||||
const auto &calendar = snapshot.state.at("calendar");
|
||||
namespace {
|
||||
std::string calendar_date_label(const std::string &iso) {
|
||||
return iso.substr(8, 2) + "." + iso.substr(5, 2) + "." + iso.substr(0, 4);
|
||||
}
|
||||
}
|
||||
|
||||
Json App::planning_calendar() const {
|
||||
auto calendar = snap().state.at("calendar");
|
||||
calendar["league"] = calendar_own_league(*world_, manager(snap()).value("club", ""));
|
||||
return calendar;
|
||||
}
|
||||
|
||||
std::string App::calendar_day_info(const Json &calendar) const {
|
||||
const auto days = calendar_days(calendar.at("start").get<std::string>());
|
||||
const auto fixtures = calendar_fixtures(calendar, *world_,
|
||||
manager(snapshot).value("club", ""));
|
||||
const int selected = calendar.at("selected").get<int>();
|
||||
const auto league_id = calendar.at("league").get<std::string>();
|
||||
const auto *league = world_->find("competitions", league_id);
|
||||
const auto nation = league ? league->value("nation", "") : "";
|
||||
const std::array<const char *, 12> months = {
|
||||
"Januar", "Februar", "März", "April", "Mai", "Juni",
|
||||
"Juli", "August", "September", "Oktober", "November", "Dezember"};
|
||||
const std::array<const char *, 7> weekdays = {"MO", "DI", "MI", "DO",
|
||||
"FR", "SA", "SO"};
|
||||
std::string body;
|
||||
const auto date = calendar_date_label(days.at(size_t(selected)).iso);
|
||||
const auto own = manager(snap()).value("club", "");
|
||||
for (const auto &f : calendar_fixtures(calendar, *world_, own))
|
||||
if (f.day == selected) {
|
||||
const auto *home = world_->find("clubs", f.home), *away = world_->find("clubs", f.away);
|
||||
return date + " · " + std::to_string(f.round + 1) + ". Spieltag · " +
|
||||
(home ? world_->name(*home) : "") + " – " + (away ? world_->name(*away) : "");
|
||||
}
|
||||
if (calendar.at("league") == calendar_own_league(*world_, own))
|
||||
for (const auto &f : calendar.at("friendlies"))
|
||||
if (f.at("day") == selected) {
|
||||
const auto *opponent = world_->find("clubs", f.at("opponent"));
|
||||
return date + " · Freundschaftsspiel: " + (opponent ? world_->name(*opponent) : "—");
|
||||
}
|
||||
return date + " · spielfrei";
|
||||
}
|
||||
|
||||
std::string App::calendar_grid(const Json &calendar, double top, double height,
|
||||
double gap_x, double gap_y, bool booking,
|
||||
bool postpone) {
|
||||
const auto days = calendar_days(calendar.at("start").get<std::string>());
|
||||
const auto own = manager(snap()).value("club", "");
|
||||
const auto fixtures = calendar_fixtures(calendar, *world_, own);
|
||||
const bool own_league = calendar.at("league") == calendar_own_league(*world_, own);
|
||||
const int selected = calendar.at("selected").get<int>();
|
||||
const double width = (2612 - gap_x * 3) / 4, card_height = (height - gap_y * 2) / 3;
|
||||
const double grid_top = postpone ? 58 : 66;
|
||||
const double cell_width = (width - 28 - 65) / 6;
|
||||
const double cell_height = (card_height - grid_top - (postpone ? 20 : 24)) / 7;
|
||||
const std::array<const char *, 12> months = {"Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"};
|
||||
const std::array<const char *, 7> weekdays = {"MO", "DI", "MI", "DO", "FR", "SA", "SO"};
|
||||
std::string body = "<div class=\"calendar-grid\">";
|
||||
int first = 0;
|
||||
for (int panel = 0; panel < 12; ++panel) {
|
||||
const int month = days[size_t(first)].month;
|
||||
const int offset = days[size_t(first)].weekday;
|
||||
const int month = days[size_t(first)].month, offset = days[size_t(first)].weekday;
|
||||
body += "<section class=\"calendar-month\" style=\"" +
|
||||
rect((panel % 4) * 660, (panel / 4) * 556, 632, 528) +
|
||||
"\"><h2>" + months[size_t(month - 1)] + "</h2>";
|
||||
constexpr double cell_width = (604.0 - 65) / 6, cell_height = 438.0 / 7;
|
||||
rect((panel % 4) * (width + gap_x), top + (panel / 4) * (card_height + gap_y), width, card_height) +
|
||||
"\"><h2" + std::string(postpone ? " style=\"top:12dp;\"" : "") + ">" + months[size_t(month - 1)] + "</h2>";
|
||||
for (int row = 0; row < 7; ++row) {
|
||||
body += "<span class=\"calendar-weekday " +
|
||||
std::string(row == 6 ? "sunday" : "") + "\" style=\"" +
|
||||
rect(12, 66 + row * cell_height, 65, cell_height) + "\">" +
|
||||
"<span>" + weekdays[size_t(row)] + "</span></span>";
|
||||
body += "<span class=\"calendar-weekday " + std::string(row == 6 ? "sunday" : "") + "\" style=\"" +
|
||||
rect(12, grid_top + row * cell_height, 65, cell_height) + "\"><span>" + weekdays[size_t(row)] + "</span></span>";
|
||||
for (int col = 0; col < 6; ++col) {
|
||||
const int number = col * 7 + row - offset + 1;
|
||||
const int index = first + number - 1;
|
||||
if (number < 1 || index >= int(days.size()) ||
|
||||
days[size_t(index)].month != month)
|
||||
continue;
|
||||
const bool match = std::any_of(fixtures.begin(), fixtures.end(),
|
||||
[&](const auto &f) {
|
||||
return f.day == index;
|
||||
});
|
||||
const bool chosen = selected == index;
|
||||
const auto &iso = days[size_t(index)].iso;
|
||||
const auto date = iso.substr(8, 2) + "." + iso.substr(5, 2) + "." +
|
||||
iso.substr(0, 4);
|
||||
body += btn(
|
||||
"calendar-select",
|
||||
(chosen ? "<span class=\"calendar-outline\" style=\"" +
|
||||
rect(3, 3, cell_width - 6, cell_height - 6) +
|
||||
"\"></span>"
|
||||
: "") +
|
||||
std::string("<span class=\"control-label\">") +
|
||||
std::to_string(number) + "</span>",
|
||||
std::string("calendar-day ") + (match ? "has-match " : "") +
|
||||
(chosen ? "selected-day" : ""),
|
||||
"id=\"calendar-day-" + std::to_string(index) + "\" data-id=\"" +
|
||||
std::to_string(index) + "\" aria-pressed=\"" +
|
||||
(chosen ? "true" : "false") + "\" aria-label=\"" + date +
|
||||
(match ? ", belegt" : ", frei") + "\" style=\"" +
|
||||
rect(77 + col * cell_width, 66 + row * cell_height,
|
||||
cell_width, cell_height) + "\"");
|
||||
const int day_number = col * 7 + row - offset + 1, index = first + day_number - 1;
|
||||
if (day_number < 1 || index >= int(days.size()) || days[size_t(index)].month != month) continue;
|
||||
const auto match = std::find_if(fixtures.begin(), fixtures.end(), [&](const auto &f) { return f.day == index; });
|
||||
const bool friendly = own_league && std::any_of(calendar.at("friendlies").begin(), calendar.at("friendlies").end(), [&](const auto &f) { return f.at("day") == index; });
|
||||
const bool occupied = match != fixtures.end() || friendly, chosen = selected == index;
|
||||
const bool source = postpone && match != fixtures.end() && match->from == calendar.value("source_day", -1);
|
||||
body += btn("calendar-select",
|
||||
(chosen || source ? "<span class=\"calendar-outline " + std::string(source ? "source-outline" : "") + "\" style=\"" + rect(3, 3, cell_width - 6, cell_height - 6) + "\"></span>" : "") +
|
||||
"<span class=\"control-label\">" + std::to_string(day_number) + "</span>",
|
||||
std::string("calendar-day ") + (occupied ? "has-match " : "") + (friendly ? "friendly-date " : "") + (source ? "source-day " : "") + (chosen ? "selected-day" : ""),
|
||||
"id=\"calendar-day-" + std::to_string(index) + "\" data-id=\"" + std::to_string(index) + "\" aria-pressed=\"" + (chosen ? "true" : "false") + "\" aria-label=\"" + calendar_date_label(days[size_t(index)].iso) +
|
||||
(occupied ? ", belegt" : ", frei") + "\" style=\"" + rect(77 + col * cell_width, grid_top + row * cell_height, cell_width, cell_height) + "\" " + (booking && (index < 7 || occupied) ? "disabled" : ""));
|
||||
}
|
||||
}
|
||||
body += "</section>";
|
||||
while (first < int(days.size()) && days[size_t(first)].month == month)
|
||||
++first;
|
||||
while (first < int(days.size()) && days[size_t(first)].month == month) ++first;
|
||||
}
|
||||
const auto &iso = days[size_t(selected)].iso;
|
||||
std::string info = iso.substr(8, 2) + "." + iso.substr(5, 2) + "." +
|
||||
iso.substr(0, 4) + " · spielfrei";
|
||||
for (const auto &f : fixtures)
|
||||
if (f.day == selected) {
|
||||
const auto *home = world_->find("clubs", f.home),
|
||||
*away = world_->find("clubs", f.away);
|
||||
info = iso.substr(8, 2) + "." + iso.substr(5, 2) + "." + iso.substr(0, 4) +
|
||||
" · " + std::to_string(f.round + 1) + ". Spieltag · " +
|
||||
(home ? world_->name(*home) : "") + " – " +
|
||||
(away ? world_->name(*away) : "");
|
||||
}
|
||||
body += "<p id=\"calendar-info\" class=\"calendar-info\">" + esc(info) +
|
||||
"</p><nav class=\"bottom-controls\">";
|
||||
std::vector<std::pair<std::string, std::string>> countries, leagues;
|
||||
std::set<std::string> seen;
|
||||
for (auto *l : world_->leagues()) {
|
||||
const auto id = l->value("nation", "");
|
||||
if (seen.insert(id).second)
|
||||
countries.emplace_back(id, world_->nation_name(id));
|
||||
if (id == nation)
|
||||
leagues.emplace_back(l->value("id", ""), world_->name(*l));
|
||||
}
|
||||
return body + select("calendar-country", countries, nation, "calendar-country") +
|
||||
select("calendar-league", leagues, league_id, "calendar-league") +
|
||||
"</nav>";
|
||||
return body + "</div>";
|
||||
}
|
||||
|
||||
std::string App::render_calendar() {
|
||||
const auto calendar = snap().state.at("calendar");
|
||||
return "<div id=\"report-underlay\" class=\"report-underlay\">" +
|
||||
calendar_grid(calendar, 0, 1640, 28, 28, false, false) +
|
||||
"<p id=\"calendar-info\" class=\"calendar-info\">" + esc(calendar_day_info(calendar)) +
|
||||
"</p><nav class=\"report-footer\">" + report_picker("country", 0, 1294) +
|
||||
report_picker("league", 1318, 1294) + "</nav></div>";
|
||||
}
|
||||
@@ -148,6 +148,24 @@ void App::ProcessEvent(Rml::Event &event) try {
|
||||
n = n->GetParentNode())
|
||||
if (n->GetId() == "native-ticket-layer")
|
||||
return;
|
||||
if (!planning_dialog_.empty() && popup_.empty()) {
|
||||
const bool key_event = type == "keydown";
|
||||
const auto key = key_event ? Rml::Input::KeyIdentifier(event.GetParameter<int>("key_identifier", 0)) : Rml::Input::KI_UNKNOWN;
|
||||
if ((key_event && key == Rml::Input::KI_ESCAPE) ||
|
||||
(type == "mouseup" && event.GetParameter<int>("button", 0) == 1)) {
|
||||
planning_action("planning-close", nullptr);
|
||||
event.StopImmediatePropagation();
|
||||
return;
|
||||
}
|
||||
bool inside = false;
|
||||
for (auto *node = event.GetTargetElement(); node && node != doc_; node = node->GetParentNode())
|
||||
if (node->GetId() == "planning-layer") inside = true;
|
||||
if (!inside && (type == "click" || type == "dblclick" || type == "mousedown" ||
|
||||
type == "mouseup" || (key_event && key != Rml::Input::KI_TAB))) {
|
||||
event.StopImmediatePropagation();
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (!report_detail_kind_.empty() && popup_.empty()) {
|
||||
const bool keyboard = type == "keydown";
|
||||
const auto key = keyboard
|
||||
@@ -167,8 +185,16 @@ void App::ProcessEvent(Rml::Event &event) try {
|
||||
event.StopImmediatePropagation();
|
||||
return;
|
||||
}
|
||||
} else if (report_detail_kind_.empty() && popup_.empty() && report_picker_event(event))
|
||||
} else if (report_detail_kind_.empty() && planning_dialog_.empty() && popup_.empty() && report_picker_event(event))
|
||||
return;
|
||||
if (menu_ == "friendlies" && planning_dialog_.empty() && popup_.empty() &&
|
||||
snap().state.at("calendar").at("friendly_stage") == 1 &&
|
||||
((type == "keydown" && event.GetParameter<int>("key_identifier", 0) == Rml::Input::KI_ESCAPE) ||
|
||||
(type == "mouseup" && event.GetParameter<int>("button", 0) == 1))) {
|
||||
planning_action("friendly-back", nullptr);
|
||||
event.StopImmediatePropagation();
|
||||
return;
|
||||
}
|
||||
if (type == "mouseup" && event.GetParameter<int>("button", 0) == 1) {
|
||||
if (scene_ == "desktop" && !menu_.empty() && popup_.empty()) {
|
||||
menu_.clear();
|
||||
@@ -313,10 +339,11 @@ void App::ProcessEvent(Rml::Event &event) try {
|
||||
(!menu_.empty() || !popup_.empty() || scene_ != "desktop")) {
|
||||
Rml::ElementList controls;
|
||||
auto *root = !popup_.empty() ? element("popup")
|
||||
: !planning_dialog_.empty() ? element("planning-layer")
|
||||
: !report_detail_kind_.empty() ? element("report-detail-layer")
|
||||
: element("canvas");
|
||||
root->QuerySelectorAll(
|
||||
controls, !popup_.empty() || !report_detail_kind_.empty()
|
||||
controls, !popup_.empty() || !report_detail_kind_.empty() || !planning_dialog_.empty()
|
||||
? "button,input,select"
|
||||
: ".window button,.window input,.window select");
|
||||
controls.erase(std::remove_if(controls.begin(), controls.end(),
|
||||
@@ -334,7 +361,8 @@ void App::ProcessEvent(Rml::Event &event) try {
|
||||
int(controls.size());
|
||||
controls[size_t(next)]->Focus(true);
|
||||
if (controls[size_t(next)]->GetId().starts_with("report-detail-player-") ||
|
||||
controls[size_t(next)]->GetId().starts_with("report-club-"))
|
||||
controls[size_t(next)]->GetId().starts_with("report-club-") ||
|
||||
controls[size_t(next)]->GetId().starts_with("friendly-opponent-"))
|
||||
controls[size_t(next)]->ScrollIntoView(
|
||||
Rml::ScrollIntoViewOptions(Rml::ScrollAlignment::Nearest));
|
||||
event.StopImmediatePropagation();
|
||||
@@ -374,6 +402,7 @@ void App::ProcessEvent(Rml::Event &event) try {
|
||||
void App::dispatch(const std::string &action, Rml::Element *target) {
|
||||
const auto id =
|
||||
target ? target->GetAttribute<Rml::String>("data-id", "") : std::string();
|
||||
if (planning_action(action, target) || indoor_action(action, target)) return;
|
||||
if (report_detail_action(action, target)) {
|
||||
close_report_picker(false);
|
||||
return;
|
||||
@@ -984,7 +1013,7 @@ void App::dispatch(const std::string &action, Rml::Element *target) {
|
||||
}
|
||||
static const std::set<std::string> available = {
|
||||
"tables", "strengths", "camp", "settings",
|
||||
"save", "load", "training", "tactics", "calendar", "league", "other"};
|
||||
"save", "load", "training", "tactics", "calendar", "league", "other", "postpone", "friendlies", "indoor"};
|
||||
if (!available.contains(route)) {
|
||||
message("Diese native Ansicht wird im nächsten Menüpaket übertragen.");
|
||||
return;
|
||||
@@ -992,6 +1021,7 @@ void App::dispatch(const std::string &action, Rml::Element *target) {
|
||||
menu_ = route;
|
||||
report_picker_.clear();
|
||||
report_detail_kind_.clear();
|
||||
planning_dialog_.clear();
|
||||
if (route == "settings") {
|
||||
settings_category_ = "display";
|
||||
draft_preferences_ = nullptr;
|
||||
@@ -1362,6 +1392,7 @@ void App::script() {
|
||||
Json{{"scene", scene_},
|
||||
{"menu", menu_},
|
||||
{"report_picker", report_picker_},
|
||||
{"planning_dialog", planning_dialog_},
|
||||
{"report_detail", {{"kind", report_detail_kind_},
|
||||
{"club", report_detail_club_},
|
||||
{"player", report_detail_player_}}},
|
||||
|
||||
+237
-44
@@ -5,6 +5,7 @@
|
||||
#include <iomanip>
|
||||
#include <numeric>
|
||||
#include <sstream>
|
||||
#include <set>
|
||||
|
||||
namespace bmh::modern_ui {
|
||||
std::vector<CalendarDay> calendar_days(const std::string &start) {
|
||||
@@ -30,65 +31,248 @@ std::vector<CalendarDay> calendar_days(const std::string &start) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Json demo_calendar(const Catalog &world, const std::string &date) {
|
||||
auto year = std::stoi(date.substr(0, 4));
|
||||
if (date.substr(5, 2) < "07")
|
||||
--year;
|
||||
const auto leagues = world.leagues("nation:de");
|
||||
namespace {
|
||||
bool integer(const Json &v, int low, int high) {
|
||||
if (v.is_number_unsigned())
|
||||
return high >= 0 && v.get<uint64_t>() <= uint64_t(high) &&
|
||||
(low <= 0 || v.get<uint64_t>() >= uint64_t(low));
|
||||
return v.is_number_integer() && v.get<int64_t>() >= low &&
|
||||
v.get<int64_t>() <= high;
|
||||
}
|
||||
bool keys(const Json &v, std::initializer_list<const char *> expected) {
|
||||
if (!v.is_object() || v.size() != expected.size()) return false;
|
||||
return std::all_of(expected.begin(), expected.end(),
|
||||
[&](const auto *key) { return v.contains(key); });
|
||||
}
|
||||
std::string own_club(const Catalog &world, const std::string &managed) {
|
||||
if (!managed.empty()) return world.manageable(managed) ? managed : "";
|
||||
for (const auto *club : world.clubs())
|
||||
if (world.manageable(club->value("id", ""))) return club->value("id", "");
|
||||
return "";
|
||||
}
|
||||
bool league_exists(const Catalog &world, const std::string &id) {
|
||||
const auto leagues = world.leagues();
|
||||
return leagues.empty() ? id.empty() : std::any_of(
|
||||
leagues.begin(), leagues.end(), [&](auto *l) { return l->at("id") == id; });
|
||||
}
|
||||
std::string first_opponent(const Catalog &world, const std::string &league,
|
||||
const std::string &managed) {
|
||||
if (league.empty()) return "";
|
||||
for (auto *club : world.clubs(league))
|
||||
if (club->at("id") != managed) return club->at("id").get<std::string>();
|
||||
return "";
|
||||
}
|
||||
bool opponent_exists(const Catalog &world, const std::string &league,
|
||||
const std::string &opponent, const std::string &managed) {
|
||||
if (!league_exists(world, league)) return false;
|
||||
if (opponent.empty()) return first_opponent(world, league, managed).empty();
|
||||
const auto *club = world.find("clubs", opponent);
|
||||
return club && opponent != managed && club->value("type", "club") == "club" &&
|
||||
!league.empty() && club->value("competition", "") == league;
|
||||
}
|
||||
Json own_calendar(const Json &state, const Catalog &world,
|
||||
const std::string &managed) {
|
||||
auto own = state;
|
||||
own["league"] = calendar_own_league(world, managed);
|
||||
return own;
|
||||
}
|
||||
} // namespace
|
||||
std::string calendar_own_league(const Catalog &world, const std::string &managed) {
|
||||
const auto *club = world.find("clubs", own_club(world, managed));
|
||||
return club ? club->value("competition", "") : "";
|
||||
}
|
||||
Json demo_calendar(const Catalog &world, const std::string &date,
|
||||
const std::string &managed) {
|
||||
if (date.size() != 10 || date[4] != '-' || date[7] != '-' ||
|
||||
!std::all_of(date.begin(), date.end(), [](char c) {
|
||||
return (c >= '0' && c <= '9') || c == '-';
|
||||
})) throw editor::Error("invalid_demo_calendar");
|
||||
int year;
|
||||
try { year = std::stoi(date.substr(0, 4)); }
|
||||
catch (const std::exception &) { throw editor::Error("invalid_demo_calendar"); }
|
||||
if (date.substr(5, 2) < "07") --year;
|
||||
std::ostringstream start;
|
||||
start.imbue(std::locale::classic());
|
||||
start << std::setfill('0') << std::setw(4) << year << "-07-01";
|
||||
if (calendar_days(start.str()).empty())
|
||||
const auto days = calendar_days(start.str());
|
||||
if (days.empty() || std::none_of(days.begin(), days.end(),
|
||||
[&](const auto &day) { return day.iso == date; }))
|
||||
throw editor::Error("invalid_demo_calendar");
|
||||
return {{"start", start.str()},
|
||||
{"selected", 6},
|
||||
{"league", leagues.empty() ? "" : leagues.front()->value("id", "")},
|
||||
{"friendlies", Json::array()},
|
||||
{"moves", Json::array()}};
|
||||
auto leagues = world.leagues("nation:de");
|
||||
if (leagues.empty()) leagues = world.leagues();
|
||||
const auto preview = leagues.empty() ? "" : leagues.front()->value("id", "");
|
||||
const auto own = calendar_own_league(world, managed);
|
||||
const auto friendly = own.empty() ? preview : own;
|
||||
Json result = {{"start", start.str()}, {"selected", 6}, {"league", preview},
|
||||
{"source_day", -1}, {"friendly_league", friendly},
|
||||
{"opponent", first_opponent(world, friendly, own_club(world, managed))},
|
||||
{"home", true}, {"friendly_stage", 0},
|
||||
{"friendlies", Json::array()}, {"moves", Json::array()}};
|
||||
if (!valid_demo_calendar(result, world, managed))
|
||||
throw editor::Error("invalid_demo_calendar");
|
||||
return result;
|
||||
}
|
||||
bool valid_demo_calendar(const Json &v, const Catalog &world) {
|
||||
bool valid_demo_calendar(const Json &v, const Catalog &world,
|
||||
const std::string &managed) {
|
||||
try {
|
||||
if (!keys(v, {"start", "selected", "league", "source_day", "friendly_league",
|
||||
"opponent", "home", "friendly_stage", "friendlies", "moves"}) ||
|
||||
(!managed.empty() && !world.manageable(managed))) return false;
|
||||
const auto days = calendar_days(v.at("start").get<std::string>());
|
||||
if (days.empty() || !v.at("selected").is_number_integer() ||
|
||||
v["selected"] < 0 || v["selected"] >= days.size())
|
||||
if (days.empty() || !integer(v.at("selected"), 0, int(days.size()) - 1) ||
|
||||
!league_exists(world, v.at("league").get<std::string>()) ||
|
||||
!v.at("home").is_boolean() || !integer(v.at("friendly_stage"), 0, 1) ||
|
||||
!opponent_exists(world, v.at("friendly_league").get<std::string>(),
|
||||
v.at("opponent").get<std::string>(), own_club(world, managed)) ||
|
||||
!v.at("friendlies").is_array() || v.at("friendlies").size() > 20 ||
|
||||
(!v.at("friendlies").empty() && own_club(world, managed).empty()) ||
|
||||
!v.at("moves").is_array()) return false;
|
||||
auto base = own_calendar(v, world, managed);
|
||||
base["moves"] = Json::array();
|
||||
const auto fixtures = calendar_fixtures(base, world, own_club(world, managed));
|
||||
std::set<int> sources, destinations, occupied, originals;
|
||||
for (const auto &f : fixtures) originals.insert(f.from);
|
||||
if (!integer(v.at("source_day"), -1, int(days.size()) - 1) ||
|
||||
(v.at("source_day") != -1 && !originals.contains(v.at("source_day").get<int>())))
|
||||
return false;
|
||||
const auto league = v.at("league").get<std::string>();
|
||||
const auto leagues = world.leagues();
|
||||
if (std::none_of(leagues.begin(), leagues.end(), [&](auto *r) {
|
||||
return r->value("id", "") == league;
|
||||
}))
|
||||
return false;
|
||||
// Reserved projections for later native planning menus; no unimplemented
|
||||
// booking or rescheduling action is silently accepted by this preview.
|
||||
return v.at("friendlies").is_array() && v["friendlies"].empty() &&
|
||||
v.at("moves").is_array() && v["moves"].empty();
|
||||
} catch (const Json::exception &) {
|
||||
return false;
|
||||
}
|
||||
for (const auto &m : v.at("moves")) {
|
||||
if (!keys(m, {"from", "to"}) || !integer(m.at("from"), 0, int(days.size()) - 1) ||
|
||||
!integer(m.at("to"), 7, int(days.size()) - 1)) return false;
|
||||
const int from = m.at("from"), to = m.at("to");
|
||||
if (!originals.contains(from) || !sources.insert(from).second ||
|
||||
!destinations.insert(to).second) return false;
|
||||
}
|
||||
for (const auto &f : calendar_fixtures(own_calendar(v, world, managed), world,
|
||||
own_club(world, managed)))
|
||||
if (!occupied.insert(f.day).second) return false;
|
||||
for (const auto &f : v.at("friendlies")) {
|
||||
if (!keys(f, {"day", "opponent", "league", "home"}) ||
|
||||
!integer(f.at("day"), 7, int(days.size()) - 1) ||
|
||||
!f.at("home").is_boolean() || f.at("opponent") == "" ||
|
||||
!opponent_exists(world, f.at("league").get<std::string>(),
|
||||
f.at("opponent").get<std::string>(), own_club(world, managed)) ||
|
||||
!occupied.insert(f.at("day").get<int>()).second) return false;
|
||||
}
|
||||
return true;
|
||||
} catch (const Json::exception &) { return false; }
|
||||
}
|
||||
bool migrate_demo_calendar(Json &state, const Catalog &world,
|
||||
const std::string &managed) {
|
||||
try {
|
||||
if (!state.is_object()) return false;
|
||||
// OpenBMH deviates from the original: the native season follows its saved
|
||||
// start year (including leap days), rather than the HTML's fixed 2027/28.
|
||||
const auto defaults = demo_calendar(world, state.at("start").get<std::string>(), managed);
|
||||
auto next = state;
|
||||
for (const auto *field : {"source_day", "friendly_league", "opponent", "home",
|
||||
"friendly_stage", "friendlies", "moves"})
|
||||
if (!next.contains(field)) next[field] = defaults.at(field);
|
||||
if (!state.contains("opponent"))
|
||||
next["opponent"] = first_opponent(world, next.at("friendly_league").get<std::string>(),
|
||||
own_club(world, managed));
|
||||
if (!valid_demo_calendar(next, world, managed)) return false;
|
||||
state = std::move(next);
|
||||
return true;
|
||||
} catch (const std::exception &) { return false; }
|
||||
}
|
||||
bool calendar_day_occupied(const Json &state, const Catalog &world,
|
||||
const std::string &managed, int day) {
|
||||
for (const auto &f : calendar_fixtures(own_calendar(state, world, managed), world,
|
||||
own_club(world, managed)))
|
||||
if (f.day == day) return true;
|
||||
for (const auto &f : state.at("friendlies"))
|
||||
if (f.at("day") == day) return true;
|
||||
return false;
|
||||
}
|
||||
int calendar_friendly_fee(const Json &state, const Catalog &world) {
|
||||
const auto clubs = world.clubs(state.at("friendly_league").get<std::string>());
|
||||
const auto found = std::find_if(clubs.begin(), clubs.end(),
|
||||
[&](auto *club) { return club->at("id") == state.at("opponent"); });
|
||||
if (found == clubs.end()) return 0;
|
||||
return (state.at("home").get<bool>() ? 25000 : 12000) +
|
||||
int(found - clubs.begin()) * 500;
|
||||
}
|
||||
std::string edit_demo_calendar(Json &state, const Json &action,
|
||||
const Catalog &world) {
|
||||
const auto kind = action.at("kind").get<std::string>();
|
||||
auto next = state;
|
||||
if (kind == "select")
|
||||
next["selected"] = action.at("value");
|
||||
else if (kind == "league")
|
||||
next["league"] = action.at("value");
|
||||
else
|
||||
return "unknown_calendar_action";
|
||||
if (!valid_demo_calendar(next, world))
|
||||
return "invalid_calendar_selection";
|
||||
state = std::move(next);
|
||||
return {};
|
||||
const Catalog &world, const std::string &managed) {
|
||||
if (!valid_demo_calendar(state, world, managed)) return "invalid_calendar_state";
|
||||
try {
|
||||
if (!action.is_object() || !action.contains("kind") || !action.at("kind").is_string())
|
||||
return "invalid_calendar_action";
|
||||
const auto kind = action.at("kind").get<std::string>();
|
||||
const bool value = kind == "select" || kind == "league" ||
|
||||
kind == "friendly-country" || kind == "friendly-league" ||
|
||||
kind == "friendly-opponent" || kind == "friendly-venue" || kind == "friendly-stage";
|
||||
const bool command = kind == "friendly-book" || kind == "postpone-source" ||
|
||||
kind == "postpone-cancel" || kind == "postpone-move" || kind == "postpone-undo";
|
||||
if (!value && !command) return "unknown_calendar_action";
|
||||
if (!(value ? keys(action, {"kind", "value"}) : keys(action, {"kind"})))
|
||||
return "invalid_calendar_action";
|
||||
auto next = state;
|
||||
if (kind == "select") next["selected"] = action.at("value");
|
||||
else if (kind == "league") next["league"] = action.at("value");
|
||||
else if (kind == "friendly-country" || kind == "friendly-league") {
|
||||
const auto id = action.at("value").get<std::string>();
|
||||
auto league = id;
|
||||
if (kind == "friendly-country") {
|
||||
if (!world.find("nations", id)) return "invalid_calendar_selection";
|
||||
const auto leagues = world.leagues(id);
|
||||
if (leagues.empty()) return "invalid_calendar_selection";
|
||||
league = leagues.front()->at("id").get<std::string>();
|
||||
}
|
||||
if (!league_exists(world, league)) return "invalid_calendar_selection";
|
||||
next["friendly_league"] = league;
|
||||
next["opponent"] = first_opponent(world, league, own_club(world, managed));
|
||||
} else if (kind == "friendly-opponent") next["opponent"] = action.at("value");
|
||||
else if (kind == "friendly-venue") next["home"] = action.at("value");
|
||||
else if (kind == "friendly-stage") next["friendly_stage"] = action.at("value");
|
||||
else if (kind == "friendly-book" || kind == "postpone-move") {
|
||||
const int day = state.at("selected");
|
||||
if (day < 7 || calendar_day_occupied(state, world, managed, day))
|
||||
return "invalid_calendar_selection";
|
||||
if (kind == "friendly-book") {
|
||||
if (state.at("friendlies").size() >= 20 || state.at("opponent") == "" ||
|
||||
own_club(world, managed).empty()) return "invalid_calendar_selection";
|
||||
next["friendlies"].push_back({{"day", day}, {"opponent", state.at("opponent")},
|
||||
{"league", state.at("friendly_league")}, {"home", state.at("home")}});
|
||||
} else {
|
||||
const int from = state.at("source_day");
|
||||
if (from < 0) return "invalid_calendar_selection";
|
||||
auto &moves = next["moves"];
|
||||
moves.erase(std::remove_if(moves.begin(), moves.end(),
|
||||
[&](const auto &m) { return m.at("from") == from; }), moves.end());
|
||||
moves.push_back({{"from", from}, {"to", day}});
|
||||
next["source_day"] = -1;
|
||||
}
|
||||
} else if (kind == "postpone-source") {
|
||||
const auto fixtures = calendar_fixtures(own_calendar(state, world, managed), world,
|
||||
own_club(world, managed));
|
||||
const auto found = std::find_if(fixtures.begin(), fixtures.end(),
|
||||
[&](const auto &f) { return state.at("selected") == f.day; });
|
||||
if (found == fixtures.end()) return "invalid_calendar_selection";
|
||||
next["source_day"] = found->from;
|
||||
} else if (kind == "postpone-cancel") next["source_day"] = -1;
|
||||
else if (kind == "postpone-undo") {
|
||||
if (state.at("moves").empty() || calendar_day_occupied(state, world, managed,
|
||||
state.at("moves").back().at("from").get<int>()))
|
||||
return "invalid_calendar_selection";
|
||||
next["moves"].erase(next["moves"].end() - 1);
|
||||
}
|
||||
if (!valid_demo_calendar(next, world, managed)) return "invalid_calendar_selection";
|
||||
state = std::move(next);
|
||||
return {};
|
||||
} catch (const Json::exception &) { return "invalid_calendar_action"; }
|
||||
}
|
||||
std::vector<CalendarFixture> calendar_fixtures(const Json &state,
|
||||
const Catalog &world,
|
||||
const std::string &managed_club) {
|
||||
const auto clubs = world.clubs(state.at("league").get<std::string>());
|
||||
const auto league = state.at("league").get<std::string>();
|
||||
if (league.empty()) return {};
|
||||
const auto clubs = world.clubs(league);
|
||||
if (clubs.size() < 2)
|
||||
return {};
|
||||
const auto managed = own_club(world, managed_club);
|
||||
const auto found = std::find_if(clubs.begin(), clubs.end(), [&](auto *c) {
|
||||
return c->value("id", "") == managed_club;
|
||||
return c->value("id", "") == managed;
|
||||
});
|
||||
const int followed = found == clubs.end() ? 0 : int(found - clubs.begin());
|
||||
const int count = int(clubs.size()) + int(clubs.size() % 2);
|
||||
@@ -105,16 +289,25 @@ std::vector<CalendarFixture> calendar_fixtures(const Json &state,
|
||||
continue;
|
||||
first.push_back({30 + round * 7, round,
|
||||
clubs[size_t(home)]->value("id", ""),
|
||||
clubs[size_t(away)]->value("id", "")});
|
||||
clubs[size_t(away)]->value("id", ""), 30 + round * 7});
|
||||
}
|
||||
std::rotate(ring.begin() + 1, ring.end() - 1, ring.end());
|
||||
}
|
||||
result = first;
|
||||
for (const auto &fixture : first)
|
||||
result.push_back({fixture.day + (count - 1) * 7,
|
||||
fixture.round + count - 1, fixture.away, fixture.home});
|
||||
fixture.round + count - 1, fixture.away, fixture.home,
|
||||
fixture.from + (count - 1) * 7});
|
||||
const auto days = calendar_days(state.at("start").get<std::string>()).size();
|
||||
std::erase_if(result, [&](const auto &f) { return size_t(f.day) >= days; });
|
||||
// Foreign league previews keep their original dates and followed club.
|
||||
if (found != clubs.end() && league == calendar_own_league(world, managed_club))
|
||||
for (auto &fixture : result)
|
||||
for (const auto &move : state.at("moves"))
|
||||
if (move.at("from") == fixture.from) {
|
||||
fixture.day = move.at("to").get<int>();
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
} // namespace bmh::modern_ui
|
||||
@@ -10,12 +10,26 @@ struct CalendarDay {
|
||||
struct CalendarFixture {
|
||||
int day, round;
|
||||
std::string home, away;
|
||||
int from; // Stable original season day, even after repeated moves.
|
||||
};
|
||||
// Presentation fixtures only. No scheduler, RNG, session or match is called.
|
||||
std::vector<CalendarDay> calendar_days(const std::string &start);
|
||||
Json demo_calendar(const Catalog &, const std::string &date);
|
||||
bool valid_demo_calendar(const Json &, const Catalog &);
|
||||
std::string edit_demo_calendar(Json &, const Json &, const Catalog &);
|
||||
Json demo_calendar(const Catalog &, const std::string &date,
|
||||
const std::string &managed_club = "");
|
||||
bool valid_demo_calendar(const Json &, const Catalog &,
|
||||
const std::string &managed_club = "");
|
||||
std::string edit_demo_calendar(Json &, const Json &, const Catalog &,
|
||||
const std::string &managed_club = "");
|
||||
// Fill absent planning fields in older presentation checkpoints, atomically.
|
||||
// Present values are validated, never repaired or silently discarded.
|
||||
bool migrate_demo_calendar(Json &, const Catalog &,
|
||||
const std::string &managed_club = "");
|
||||
std::string calendar_own_league(const Catalog &,
|
||||
const std::string &managed_club = "");
|
||||
// Planning always checks the manager's schedule, independently of the preview.
|
||||
bool calendar_day_occupied(const Json &, const Catalog &,
|
||||
const std::string &managed_club, int day);
|
||||
int calendar_friendly_fee(const Json &, const Catalog &);
|
||||
std::vector<CalendarFixture> calendar_fixtures(const Json &, const Catalog &,
|
||||
const std::string &managed_club);
|
||||
} // namespace bmh::modern_ui
|
||||
@@ -72,11 +72,13 @@ bool sort_key(const std::string &view, const std::string &key) {
|
||||
static const std::set<std::string> table_keys = {
|
||||
"original", "rank", "played", "wins", "draw", "loss", "form",
|
||||
"points", "gf", "diff"};
|
||||
static const std::set<std::string> indoor_keys = {"original", "rank", "points"};
|
||||
static const std::set<std::string> strength_keys = {
|
||||
"original", "club", "keeper", "defence", "midfield", "attack",
|
||||
"strength"};
|
||||
return view == "tables" ? table_keys.contains(key)
|
||||
: view == "strengths" && strength_keys.contains(key);
|
||||
: view == "strengths" ? strength_keys.contains(key)
|
||||
: view == "indoor" && indoor_keys.contains(key);
|
||||
}
|
||||
std::vector<Fixture> fixtures(size_t club_count, int league) {
|
||||
if (club_count < 2 || club_count > size_t(std::numeric_limits<int>::max() / 2 - 1))
|
||||
@@ -211,7 +213,8 @@ Json demo_reports(const Catalog &world) {
|
||||
{"round", std::min(26, league_rounds(world, league) - 1)},
|
||||
{"filter", 0}, {"competition", 0},
|
||||
{"sorts", {{"tables", {{"key", "points"}, {"desc", true}}},
|
||||
{"strengths", {{"key", "original"}, {"desc", false}}}}}};
|
||||
{"strengths", {{"key", "original"}, {"desc", false}}},
|
||||
{"indoor", {{"key", "points"}, {"desc", true}}}}}};
|
||||
}
|
||||
bool valid_demo_reports(const Json &state, const Catalog &world) {
|
||||
try {
|
||||
@@ -224,9 +227,9 @@ bool valid_demo_reports(const Json &state, const Catalog &world) {
|
||||
const int count = std::max(league_rounds(world, state.at("league")),
|
||||
state.at("competition") == 0 ? 1 : other_rounds);
|
||||
if (!integer(state.at("round"), 0, count - 1) ||
|
||||
!keys(state.at("sorts"), {"tables", "strengths"}))
|
||||
!keys(state.at("sorts"), {"tables", "strengths", "indoor"}))
|
||||
return false;
|
||||
for (const auto *view : {"tables", "strengths"}) {
|
||||
for (const auto *view : {"tables", "strengths", "indoor"}) {
|
||||
const auto &sort = state.at("sorts").at(view);
|
||||
if (!keys(sort, {"key", "desc"}) || !sort.at("key").is_string() ||
|
||||
!sort.at("desc").is_boolean() || !sort_key(view, sort.at("key")))
|
||||
@@ -237,6 +240,19 @@ bool valid_demo_reports(const Json &state, const Catalog &world) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
bool migrate_demo_reports(Json &state, const Catalog &world) {
|
||||
if (valid_demo_reports(state, world))
|
||||
return true;
|
||||
if (!state.is_object() || !state.contains("sorts") ||
|
||||
!state.at("sorts").is_object() || state.at("sorts").contains("indoor"))
|
||||
return false;
|
||||
auto next = state;
|
||||
next["sorts"]["indoor"] = {{"key", "points"}, {"desc", true}};
|
||||
if (!valid_demo_reports(next, world))
|
||||
return false;
|
||||
state = std::move(next);
|
||||
return true;
|
||||
}
|
||||
int report_round_count(const Catalog &world, const Json &state, bool other) {
|
||||
if (!valid_demo_reports(state, world))
|
||||
return 1;
|
||||
@@ -389,6 +405,19 @@ Json report_strength_rows(const Catalog &world, const Json &state) {
|
||||
}
|
||||
return sorted(std::move(rows), state.at("sorts").at("strengths"));
|
||||
}
|
||||
Json report_indoor_rows(const Catalog &world, const Json &state) {
|
||||
if (!valid_demo_reports(state, world))
|
||||
return Json::array();
|
||||
const auto leagues = world.leagues("nation:de");
|
||||
if (leagues.empty())
|
||||
return Json::array();
|
||||
const auto clubs = world.clubs(leagues.front()->at("id"));
|
||||
std::vector<Json> rows;
|
||||
for (size_t i = 0; i < std::min(size_t(16), clubs.size()); ++i)
|
||||
rows.push_back({{"club", clubs[i]->at("id")}, {"original", i},
|
||||
{"rank", i + 1}, {"points", 324 - int(i) * 19}});
|
||||
return sorted(std::move(rows), state.at("sorts").at("indoor"));
|
||||
}
|
||||
Json report_match_rows(const Catalog &world, const Json &state, bool other) {
|
||||
Json result = Json::array();
|
||||
if (!valid_demo_reports(state, world))
|
||||
|
||||
@@ -7,6 +7,9 @@ namespace bmh::modern_ui {
|
||||
// Each function receives the reports subobject, not the complete DemoSource state.
|
||||
Json demo_reports(const Catalog &);
|
||||
bool valid_demo_reports(const Json &, const Catalog &);
|
||||
// Adds only the missing indoor sort to an otherwise valid legacy reports object.
|
||||
// Invalid existing fields reject atomically; current valid states are unchanged.
|
||||
bool migrate_demo_reports(Json &, const Catalog &);
|
||||
// Returns an empty string on success, an explicit error on rejection. Rejections
|
||||
// leave the reports object unchanged. Actions use kind/value, or kind=round with
|
||||
// step (+/-1) and optional other, or kind=sort with view/key.
|
||||
@@ -15,6 +18,8 @@ std::string edit_demo_reports(Json &, const Json &action, const Catalog &);
|
||||
// the corresponding squad positions have no usable OBW strength information.
|
||||
Json report_table_rows(const Catalog &, const Json &);
|
||||
Json report_strength_rows(const Catalog &, const Json &);
|
||||
// At most 16 clubs from the first German league, independent of report selection.
|
||||
Json report_indoor_rows(const Catalog &, const Json &);
|
||||
Json report_match_rows(const Catalog &, const Json &, bool other);
|
||||
// The presentation-only opening draw: adjacent pairs from at most 64 German
|
||||
// league clubs in catalog order; goals are null until a future runtime owns them.
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
std::string App::render_indoor() {
|
||||
const auto snapshot = snap();
|
||||
const auto &state = snapshot.state.at("reports");
|
||||
const auto &sort = state.at("sorts").at("indoor");
|
||||
const auto rows = report_indoor_rows(*world_, state);
|
||||
std::string body = "<div id=\"report-underlay\" class=\"report-underlay\">"
|
||||
"<div id=\"report-list\" class=\"report-list indoor-list\">"
|
||||
"<div class=\"report-table\" role=\"table\">"
|
||||
"<div class=\"report-row report-head\" role=\"row\">";
|
||||
for (const auto &[key, label] :
|
||||
std::array<std::pair<std::string, std::string>, 2>{
|
||||
{{"rank", "Pl. / Verein"}, {"points", "Punkte"}}}) {
|
||||
const bool current = sort.at("key") == key;
|
||||
const bool descending = sort.at("desc").get<bool>();
|
||||
std::string indicator = "<span class=\"report-sort-symbol\">";
|
||||
if (!current || !descending)
|
||||
indicator += "<span class=\"report-sort-arrow up\"></span>";
|
||||
if (!current || descending)
|
||||
indicator += "<span class=\"report-sort-arrow down\"></span>";
|
||||
indicator += "</span>";
|
||||
body += "<div class=\"report-cell " + std::string(key == "rank" ? "first" : "") +
|
||||
"\" role=\"columnheader\" aria-sort=\"" +
|
||||
(current ? descending ? "descending" : "ascending" : "none") + "\">" +
|
||||
btn("report-sort", "<span>" + esc(label) + "</span>" + indicator,
|
||||
"report-sort", "id=\"report-sort-" + key + "\" data-id=\"" + key +
|
||||
"\" aria-label=\"Nach " + esc(label) + " sortieren\"") + "</div>";
|
||||
}
|
||||
body += "</div>";
|
||||
for (size_t i = 0; i < rows.size(); ++i) {
|
||||
const auto &row = rows[i];
|
||||
body += "<div class=\"report-row " + std::string(i % 2 == 0 ? "striped" : "") +
|
||||
"\" role=\"row\" data-club=\"" + esc(row.at("club").get<std::string>()) +
|
||||
"\"><div class=\"report-cell first\" role=\"cell\">"
|
||||
"<span class=\"report-rank\"><span>" +
|
||||
std::to_string(row.at("rank").get<int>()) + ".</span></span>" +
|
||||
report_club_button(row.at("club").get<std::string>()) +
|
||||
"</div><div class=\"report-cell\" role=\"cell\">"
|
||||
"<span class=\"report-value\">" + std::to_string(row.at("points").get<int>()) +
|
||||
"</span></div></div>";
|
||||
}
|
||||
body += "</div></div><nav class=\"report-footer\">" +
|
||||
btn("indoor-info", "<span>Nach dem 5. Turnier</span>", "report-reset indoor-info",
|
||||
"id=\"indoor-info\"") + "</nav></div>";
|
||||
return body + render_report_detail();
|
||||
}
|
||||
|
||||
bool App::indoor_action(const std::string &action, Rml::Element *target) {
|
||||
if (action != "indoor-info")
|
||||
return false;
|
||||
if (menu_ != "indoor" || !world_ || !target)
|
||||
return true;
|
||||
report_detail_return_focus_ = target->GetId();
|
||||
report_detail_kind_ = "indoor-info";
|
||||
report_detail_club_.clear();
|
||||
report_detail_player_.clear();
|
||||
focus_after_render_ = "report-detail-close";
|
||||
refresh();
|
||||
return true;
|
||||
}
|
||||
@@ -81,7 +81,7 @@ DemoSource::DemoSource(std::shared_ptr<const Catalog> catalog)
|
||||
state_["tactics"] = demo_tactics();
|
||||
if (!valid_date(state_.at("date")))
|
||||
throw editor::Error("invalid_demo_date");
|
||||
state_["calendar"] = demo_calendar(*catalog_, state_.at("date"));
|
||||
state_["calendar"] = demo_calendar(*catalog_, state_.at("date"), club);
|
||||
state_["reports"] = demo_reports(*catalog_);
|
||||
saved_ = state_;
|
||||
}
|
||||
@@ -118,6 +118,10 @@ ActionResult DemoSource::apply(const Action &action) {
|
||||
if (next.at("training").at("club") != first) {
|
||||
next["training"] = demo_training(*catalog_, first);
|
||||
next["tactics"] = demo_tactics();
|
||||
next["calendar"] = demo_calendar(*catalog_, next.at("date"), first);
|
||||
const auto error = edit_demo_reports(next["reports"],
|
||||
{{"kind", "league"}, {"value", next["calendar"]["league"]}}, *catalog_);
|
||||
if (!error.empty()) return {false, revision_, error};
|
||||
}
|
||||
} else if (action.kind == "training") {
|
||||
const auto error = edit_demo_training(next["training"], action.value);
|
||||
@@ -129,7 +133,7 @@ ActionResult DemoSource::apply(const Action &action) {
|
||||
return {false, revision_, error};
|
||||
} else if (action.kind == "calendar") {
|
||||
const auto error = edit_demo_calendar(next["calendar"], action.value,
|
||||
*catalog_);
|
||||
*catalog_, next["managers"][0]["club"]);
|
||||
if (!error.empty())
|
||||
return {false, revision_, error};
|
||||
if (action.value.value("kind", "") == "league") {
|
||||
@@ -216,8 +220,8 @@ Json DemoSource::load(const fs::path &file) {
|
||||
!camp_id(data.at("camp").at("selected")))
|
||||
throw editor::Error("invalid_demo_state");
|
||||
if (!data.contains("calendar"))
|
||||
data["calendar"] = demo_calendar(*catalog_, data.at("date"));
|
||||
if (!valid_demo_calendar(data.at("calendar"), *catalog_))
|
||||
data["calendar"] = demo_calendar(*catalog_, data.at("date"), club);
|
||||
if (!migrate_demo_calendar(data["calendar"], *catalog_, club))
|
||||
throw editor::Error("invalid_demo_calendar");
|
||||
if (!data.contains("reports")) {
|
||||
data["reports"] = demo_reports(*catalog_);
|
||||
@@ -228,7 +232,7 @@ Json DemoSource::load(const fs::path &file) {
|
||||
}
|
||||
if (!data.contains("opening_created"))
|
||||
data["opening_created"] = false;
|
||||
if (!valid_demo_reports(data.at("reports"), *catalog_) ||
|
||||
if (!migrate_demo_reports(data["reports"], *catalog_) ||
|
||||
!data.at("opening_created").is_boolean())
|
||||
throw editor::Error("invalid_demo_reports");
|
||||
data["calendar"]["league"] = data["reports"]["league"];
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
bool App::planning_action(const std::string &action, Rml::Element *target) {
|
||||
const auto id = target ? target->GetAttribute<Rml::String>("data-id", "") : "";
|
||||
if (action == "planning-close") {
|
||||
planning_dialog_.clear();
|
||||
focus_after_render_ = planning_return_focus_;
|
||||
refresh();
|
||||
return true;
|
||||
}
|
||||
if (action.starts_with("postpone-")) {
|
||||
if (menu_ != "postpone") return true;
|
||||
if (action == "postpone-undo") {
|
||||
const auto calendar = planning_calendar();
|
||||
if (!calendar.at("moves").empty() && calendar_day_occupied(calendar, *world_, manager(snap()).value("club", ""), calendar.at("moves").back().at("from"))) {
|
||||
planning_dialog_ = "undo-blocked";
|
||||
planning_notice_ = "Der ursprüngliche Termin ist inzwischen belegt.";
|
||||
planning_return_focus_ = "postpone-undo";
|
||||
focus_after_render_ = "planning-close";
|
||||
refresh();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (apply("calendar", {{"kind", action}})) {
|
||||
focus_after_render_ = action == "postpone-cancel" ? "postpone-source"
|
||||
: "calendar-day-" + std::to_string(snap().state.at("calendar").at("selected").get<int>());
|
||||
refresh();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
if (!action.starts_with("friendly-")) return false;
|
||||
if (menu_ != "friendlies") return true;
|
||||
const auto calendar = planning_calendar();
|
||||
if (action == "friendly-opponent" || action == "friendly-calendar") {
|
||||
if (action == "friendly-opponent" && !apply("calendar", {{"kind", "friendly-opponent"}, {"value", id}})) return true;
|
||||
if (snap().state.at("calendar").at("opponent") == "") return true;
|
||||
planning_return_focus_ = target ? target->GetId() : "friendly-calendar";
|
||||
planning_dialog_ = "venue";
|
||||
focus_after_render_ = "friendly-home";
|
||||
} else if (action == "friendly-venue") {
|
||||
if (!apply("calendar", {{"kind", "friendly-venue"}, {"value", id == "home"}})) return true;
|
||||
planning_dialog_ = "quote";
|
||||
focus_after_render_ = "planning-close";
|
||||
} else if (action == "friendly-quote-accept") {
|
||||
if (!apply("calendar", {{"kind", "friendly-stage"}, {"value", 1}})) return true;
|
||||
planning_dialog_.clear();
|
||||
// Keep a valid selected date; otherwise choose the first chronological free day.
|
||||
int selected = calendar.at("selected");
|
||||
const auto own = manager(snap()).value("club", "");
|
||||
const int count = int(calendar_days(calendar.at("start")).size());
|
||||
if (selected < 7 || calendar_day_occupied(calendar, *world_, own, selected)) {
|
||||
selected = 7;
|
||||
while (selected < count && calendar_day_occupied(calendar, *world_, own, selected)) ++selected;
|
||||
}
|
||||
focus_after_render_ = selected < count ? "calendar-day-" + std::to_string(selected) : "friendly-back";
|
||||
} else if (action == "friendly-back") {
|
||||
if (!apply("calendar", {{"kind", "friendly-stage"}, {"value", 0}})) return true;
|
||||
planning_dialog_.clear();
|
||||
focus_after_render_ = "friendly-opponent-" + calendar.at("opponent").get<std::string>();
|
||||
} else if (action == "friendly-book") {
|
||||
if (!apply("calendar", {{"kind", "friendly-book"}})) return true;
|
||||
const auto days = calendar_days(calendar.at("start"));
|
||||
const auto *opponent = world_->find("clubs", calendar.at("opponent"));
|
||||
planning_notice_ = calendar_date_label(days.at(calendar.at("selected").get<size_t>()).iso) + " · " +
|
||||
(opponent ? world_->name(*opponent) : "—") + " · " + (calendar.at("home").get<bool>() ? "Heim" : "Auswärts");
|
||||
planning_return_focus_ = "friendly-list";
|
||||
planning_dialog_ = "booked";
|
||||
focus_after_render_ = "planning-close";
|
||||
} else if (action == "friendly-list") {
|
||||
planning_return_focus_ = "friendly-list";
|
||||
planning_dialog_ = "list";
|
||||
focus_after_render_ = "planning-close";
|
||||
} else return false;
|
||||
close_report_picker(false);
|
||||
refresh();
|
||||
return true;
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
std::string App::planning_progress(bool second, bool postpone) {
|
||||
const std::array<std::string, 2> captions = postpone
|
||||
? std::array<std::string, 2>{"Spiel wählen", "Termin wählen"}
|
||||
: std::array<std::string, 2>{"Gegner", "Termin"};
|
||||
std::string out = "<div class=\"planning-progress\">";
|
||||
for (int i = 0; i < 2; ++i)
|
||||
out += "<span class=\"planning-step " + std::string(second == bool(i) ? "current" : "") +
|
||||
"\"><span class=\"planning-step-number\"><span>" + std::to_string(i + 1) +
|
||||
"</span></span><span>" + captions[size_t(i)] + "</span></span>";
|
||||
return out + "</div>";
|
||||
}
|
||||
|
||||
std::string App::render_postpone() {
|
||||
const auto calendar = planning_calendar();
|
||||
const auto own = manager(snap()).value("club", "");
|
||||
const auto *league = world_->find("competitions", calendar.at("league"));
|
||||
const auto fixtures = calendar_fixtures(calendar, *world_, own);
|
||||
const int day = calendar.at("selected"), from = calendar.at("source_day");
|
||||
const auto selected = std::find_if(fixtures.begin(), fixtures.end(), [&](const auto &f) { return f.day == day; });
|
||||
const auto source = std::find_if(fixtures.begin(), fixtures.end(), [&](const auto &f) { return f.from == from; });
|
||||
const bool has_source = source != fixtures.end();
|
||||
const bool valid = has_source && day >= 7 && !calendar_day_occupied(calendar, *world_, own, day);
|
||||
const auto start = calendar.at("start").get<std::string>().substr(0, 4);
|
||||
const auto season = start + "/" + std::to_string((std::stoi(start) + 1) % 100);
|
||||
const auto status = !has_source ? "Zuerst ein gelb markiertes Ligaspiel wählen."
|
||||
: day < 7 ? "Bitte einen Termin ab dem 8. Juli wählen."
|
||||
: !valid ? "Dieser Termin ist bereits belegt." : "Freier Termin · Spiel kann verlegt werden.";
|
||||
auto source_calendar = calendar;
|
||||
source_calendar["selected"] = has_source ? source->day : day;
|
||||
const auto source_label = has_source || selected != fixtures.end() ? calendar_day_info(source_calendar)
|
||||
: "Ein gelb markiertes Ligaspiel im Kalender anklicken.";
|
||||
std::string body = "<div id=\"report-underlay\" class=\"report-underlay postpone-layout\">"
|
||||
"<header class=\"planning-heading\"><h2>" + esc(world_->name(*world_->find("clubs", own))) +
|
||||
"</h2><p>" + esc(league ? world_->name(*league) : "") + " · Saison " + season +
|
||||
"</p>" + planning_progress(has_source, true) + "</header>" +
|
||||
calendar_grid(calendar, 132, 1362, 28, 22, false, true) +
|
||||
"<section class=\"postpone-summary source " + std::string(has_source ? "selected-source" : "") + "\"><h3>Ausgangsspiel</h3><p>" + esc(source_label) +
|
||||
"</p><small>" + (has_source ? "Das Ausgangsspiel ist im Kalender grün umrahmt." : "Mit „Ausgangsspiel wählen“ bestätigen.") +
|
||||
"</small>" + (has_source ? btn("postpone-cancel", "×", "postpone-cancel", "id=\"postpone-cancel\" aria-label=\"Ausgangsspielauswahl aufheben\"") : "") +
|
||||
"</section><section class=\"postpone-summary target\"><h3>Neuer Termin</h3><p>" + esc(calendar_day_info(calendar)) +
|
||||
"</p><small class=\"" + (valid ? "valid" : "") + "\">" + status + "</small></section><nav class=\"planning-footer\">";
|
||||
body += btn("postpone-source", "Ausgangsspiel wählen", {}, "id=\"postpone-source\" " + std::string(selected == fixtures.end() ? "disabled" : "")) +
|
||||
btn("postpone-move", "Hierhin verlegen", {}, "id=\"postpone-move\" " + std::string(valid ? "" : "disabled")) +
|
||||
btn("postpone-undo", "Letzte Verlegung zurück", {}, "id=\"postpone-undo\" " + std::string(calendar.at("moves").empty() ? "disabled" : ""));
|
||||
return body + "</nav></div>" + render_planning_dialog();
|
||||
}
|
||||
|
||||
std::string App::render_friendlies() {
|
||||
const auto calendar = planning_calendar();
|
||||
const auto own = manager(snap()).value("club", "");
|
||||
const auto *league = world_->find("competitions", calendar.at("friendly_league"));
|
||||
const auto *opponent = world_->find("clubs", calendar.at("opponent"));
|
||||
const bool booking = calendar.at("friendly_stage") == 1, full = calendar.at("friendlies").size() >= 20;
|
||||
const int day = calendar.at("selected");
|
||||
const bool available = day >= 7 && !calendar_day_occupied(calendar, *world_, own, day);
|
||||
const auto start = calendar.at("start").get<std::string>().substr(0, 4);
|
||||
const auto season = start + "/" + std::to_string((std::stoi(start) + 1) % 100);
|
||||
const auto venue = calendar.at("home").get<bool>() ? "Heimspiel" : "Auswärtsspiel";
|
||||
std::string body = "<div id=\"report-underlay\" class=\"report-underlay friendlies-layout\">"
|
||||
"<header class=\"planning-heading " + std::string(booking ? "booking" : "") + "\"><h2>" + (booking ? label(opponent, 58) : esc(league ? world_->name(*league) : "—")) +
|
||||
"</h2><p>" + (booking ? std::string(venue) + " · Kostenbeitrag " + cash(calendar_friendly_fee(calendar, *world_))
|
||||
: "Freundschaftsspiel vereinbaren · Saison " + season) +
|
||||
"</p>" + planning_progress(booking, false) + "</header>";
|
||||
const auto count_label = "Vorgemerkte Spiele · " + std::to_string(calendar.at("friendlies").size());
|
||||
if (!booking) {
|
||||
const auto clubs = world_->clubs(calendar.at("friendly_league"));
|
||||
auto reports = snap().state.at("reports");
|
||||
reports["league"] = calendar.at("friendly_league");
|
||||
reports["round"] = 0;
|
||||
const auto strengths = report_strength_rows(*world_, reports);
|
||||
body += "<div id=\"friendly-opponents\" class=\"friendly-opponents\"><div class=\"friendly-table\"><div class=\"friendly-row head\">";
|
||||
for (const auto &heading : {"Gegner", "Stärke", "Platz", "Spiele"}) body += "<div class=\"friendly-cell\"><span>" + std::string(heading) + "</span></div>";
|
||||
body += "</div>";
|
||||
size_t visible = 0;
|
||||
for (size_t i = 0; i < clubs.size(); ++i) {
|
||||
const auto *c = clubs[i]; const auto id = c->value("id", "");
|
||||
if (id == own) continue;
|
||||
const auto value = std::find_if(strengths.begin(), strengths.end(), [&](const auto &r) { return r.at("club") == id; });
|
||||
const auto strength = value == strengths.end() ? "—" : report_number(value->at("strength"));
|
||||
body += "<div class=\"friendly-row " + std::string(visible++ % 2 == 0 ? "striped " : "") + (calendar.at("opponent") == id ? "selected" : "") + "\"><div class=\"friendly-cell\">" +
|
||||
btn("friendly-opponent", label(c, 42), "friendly-opponent", "id=\"friendly-opponent-" + esc(id) + "\" data-id=\"" + esc(id) + "\" aria-pressed=\"" + (calendar.at("opponent") == id ? "true" : "false") + "\"") +
|
||||
"</div><div class=\"friendly-cell\"><span>" + strength + "</span></div><div class=\"friendly-cell\"><span>" + std::to_string(i + 1) +
|
||||
"</span></div><div class=\"friendly-cell\"><span>26</span></div></div>";
|
||||
}
|
||||
body += "</div></div><nav class=\"report-footer\">" + report_picker("country", 0, 547.526882) + report_picker("league", 569.526882, 766.537634) +
|
||||
btn("friendly-calendar", "Termin auswählen", "report-reset", "id=\"friendly-calendar\" style=\"" + rect(1358.064516, 0, 547.526882, 94) + "\" " + (full || !opponent ? "disabled" : "")) +
|
||||
btn("friendly-list", count_label, "report-reset", "id=\"friendly-list\" style=\"" + rect(1927.591398, 0, 684.408602, 94) + "\"");
|
||||
} else {
|
||||
body += calendar_grid(calendar, 148, 1424, 22, 22, true, false) +
|
||||
"<section class=\"friendly-date-summary\"><div class=\"date-side\"><span>Gewählter Termin</span><p>" + esc(calendar_day_info(calendar)) +
|
||||
"</p></div><div class=\"status-side\"><div class=\"friendly-key\"><span class=\"league-dot\"></span><span>Ligaspiel</span><span class=\"friendly-dot\"></span><span>Freundschaftsspiel</span></div><p class=\"" + (available && !full ? "valid" : "") + "\">" +
|
||||
(full ? "Alle 20 Vormerkungen sind belegt." : available ? "Freier Termin · Spiel kann vorgemerkt werden." : "Bitte einen freien Termin ab dem 8. Juli wählen.") +
|
||||
"</p></div></section><nav class=\"planning-footer\">" +
|
||||
btn("friendly-back", "Gegner ändern", {}, "id=\"friendly-back\"") +
|
||||
btn("friendly-list", count_label, {}, "id=\"friendly-list\"") +
|
||||
btn("friendly-book", "Termin vormerken", {}, "id=\"friendly-book\" " + std::string(available && !full && opponent ? "" : "disabled"));
|
||||
}
|
||||
return body + "</nav></div>" + render_planning_dialog();
|
||||
}
|
||||
|
||||
std::string App::render_planning_dialog() {
|
||||
if (planning_dialog_.empty()) return {};
|
||||
const auto calendar = planning_calendar();
|
||||
const auto *opponent = world_->find("clubs", calendar.at("opponent"));
|
||||
std::string heading, body, actions;
|
||||
double height = planning_dialog_ == "undo-blocked" ? 332 : 341;
|
||||
const auto close = [&](const std::string &caption) { return btn("planning-close", caption, {}, "id=\"planning-close\""); };
|
||||
if (planning_dialog_ == "venue" || planning_dialog_ == "quote") {
|
||||
const bool quote = planning_dialog_ == "quote";
|
||||
heading = quote ? "Freundschaftsspiel · Kosten" : "Austragungsort";
|
||||
height = quote ? 720.5 : 496;
|
||||
body = "<div class=\"friendly-dialog-club\"><span class=\"club-label\"><span class=\"planning-badge\">" + crest(opponent, 72) + "</span><span>" + esc(opponent ? world_->name(*opponent) : "—") + "</span></span><span>" +
|
||||
(quote ? std::string(calendar.at("home").get<bool>() ? "Heimspiel" : "Auswärtsspiel") : "Heimspiel oder Auswärtsspiel?") + "</span></div>";
|
||||
if (quote) {
|
||||
body += "<div class=\"friendly-quote-amount\"><span>Fiktiver Kostenbeitrag</span><strong>" + cash(calendar_friendly_fee(calendar, *world_)) +
|
||||
"</strong></div><p class=\"friendly-quote-note\">Anschließend einen freien Termin im Kalender wählen.</p>";
|
||||
actions = close("Abbrechen") + btn("friendly-quote-accept", "Termin wählen", {}, "id=\"friendly-quote-accept\"");
|
||||
} else actions = btn("friendly-venue", "Heim", {}, "id=\"friendly-home\" data-id=\"home\"") +
|
||||
btn("friendly-venue", "Auswärts", {}, "id=\"friendly-away\" data-id=\"away\"") + close("Abbrechen");
|
||||
} else if (planning_dialog_ == "list") {
|
||||
heading = "Vorgemerkte Freundschaftsspiele";
|
||||
auto bookings = calendar.at("friendlies");
|
||||
std::sort(bookings.begin(), bookings.end(), [](const auto &a, const auto &b) { return a.at("day") < b.at("day"); });
|
||||
const auto days = calendar_days(calendar.at("start"));
|
||||
height = bookings.empty() ? 330.5 : 287 + std::min(1020., 80. * (bookings.size() + 1));
|
||||
body = "<div class=\"friendly-bookings\">";
|
||||
if (bookings.empty()) body += "<p>Noch keine Freundschaftsspiele vorgemerkt.</p>";
|
||||
else {
|
||||
body += "<div class=\"friendly-booking-row head\"><span><span>Datum</span></span><span><span>Gegner</span></span><span><span>Ort</span></span></div>";
|
||||
for (const auto &f : bookings)
|
||||
body += "<div class=\"friendly-booking-row\"><span><span>" + calendar_date_label(days.at(f.at("day").get<size_t>()).iso) +
|
||||
"</span></span><span>" + label(world_->find("clubs", f.at("opponent")), 42) + "</span><span><span>" +
|
||||
(f.at("home").get<bool>() ? "Heim" : "Auswärts") + "</span></span></div>";
|
||||
}
|
||||
body += "</div>";
|
||||
actions = close("Zurück");
|
||||
} else {
|
||||
heading = planning_dialog_ == "booked" ? "Spiel vorgemerkt" : "Rücknahme nicht möglich";
|
||||
body = "<p class=\"planning-notice\">" + esc(planning_notice_) + "</p>";
|
||||
actions = close("Verstanden");
|
||||
}
|
||||
return "<div id=\"planning-layer\" class=\"planning-layer\"><section id=\"planning-dialog\" class=\"planning-dialog " + planning_dialog_ +
|
||||
"\" role=\"dialog\" aria-modal=\"true\" aria-labelledby=\"planning-dialog-title\" style=\"height:" + scalar(height) +
|
||||
"dp;\"><h2 id=\"planning-dialog-title\">" + heading + "</h2>" + body +
|
||||
"<nav class=\"planning-dialog-actions\">" + actions + "</nav></section></div>";
|
||||
}
|
||||
@@ -121,7 +121,18 @@ std::string App::render_report_detail() {
|
||||
"id=\"report-detail-close\"");
|
||||
};
|
||||
std::string title, body, actions;
|
||||
if (report_detail_kind_ == "club" && club) {
|
||||
if (report_detail_kind_ == "indoor-info") {
|
||||
title = "Hallenmasters";
|
||||
std::string season = "—";
|
||||
if (const auto date = report_detail_date(current_date)) {
|
||||
const int start = (*date)[0] - ((*date)[1] < 7 ? 1 : 0);
|
||||
const auto next = std::to_string((start + 1) % 100);
|
||||
season = std::to_string(start) + "/" + (next.size() < 2 ? "0" : "") + next;
|
||||
}
|
||||
body = "<p class=\"report-detail-info-text\">Fiktive Ergebnisse und Platzierungen zur Saison " +
|
||||
esc(season) + ".</p>";
|
||||
actions = close("Zurück");
|
||||
} else if (report_detail_kind_ == "club" && club) {
|
||||
title = display_name(club);
|
||||
const Json *stadium = nullptr;
|
||||
if (const auto id = club->find("stadium");
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
namespace {
|
||||
bool report_picker_menu(const std::string &menu) {
|
||||
return menu == "tables" || menu == "strengths" || menu == "league" ||
|
||||
menu == "other";
|
||||
menu == "other" || menu == "calendar" || menu == "friendlies";
|
||||
}
|
||||
bool report_picker_kind(const std::string &kind) {
|
||||
return kind == "country" || kind == "league" || kind == "filter" ||
|
||||
@@ -46,8 +46,7 @@ App::report_picker_items(const std::string &kind) const {
|
||||
});
|
||||
return items;
|
||||
}
|
||||
const auto reports = snap().state.at("reports");
|
||||
const auto *league = world_->find("competitions", reports.at("league").get<std::string>());
|
||||
const auto *league = world_->find("competitions", report_picker_value("league"));
|
||||
if (league)
|
||||
for (const auto *candidate : world_->leagues(league->value("nation", "")))
|
||||
items.emplace_back(candidate->value("id", ""), world_->name(*candidate));
|
||||
@@ -60,7 +59,9 @@ std::string App::report_picker_value(const std::string &kind) const {
|
||||
const auto reports = snap().state.at("reports");
|
||||
if (kind == "filter" || kind == "competition")
|
||||
return std::to_string(reports.at(kind).get<int>());
|
||||
const auto league = reports.at("league").get<std::string>();
|
||||
const auto league = menu_ == "friendlies" ? snap().state.at("calendar").at("friendly_league").get<std::string>()
|
||||
: menu_ == "calendar" ? snap().state.at("calendar").at("league").get<std::string>()
|
||||
: reports.at("league").get<std::string>();
|
||||
if (kind == "league")
|
||||
return league;
|
||||
const auto *row = world_->find("competitions", league);
|
||||
@@ -170,7 +171,14 @@ bool App::report_picker_action(const std::string &action, Rml::Element *target)
|
||||
? Json(std::stoi(value)) : Json(value);
|
||||
close_report_picker(false);
|
||||
// Commit even an unchanged country: the Gold resets its first league.
|
||||
apply("reports", {{"kind", kind}, {"value", selection}});
|
||||
if (menu_ == "friendlies")
|
||||
apply("calendar", {{"kind", "friendly-" + kind}, {"value", selection}});
|
||||
else if (menu_ == "calendar") {
|
||||
const auto leagues = kind == "country" ? world_->leagues(value) : std::vector<const Json *>{};
|
||||
const auto league = kind == "country" && !leagues.empty() ? leagues.front()->value("id", "") : value;
|
||||
apply("calendar", {{"kind", "league"}, {"value", league}});
|
||||
} else
|
||||
apply("reports", {{"kind", kind}, {"value", selection}});
|
||||
focus_after_render_ = "report-picker-" + kind;
|
||||
refresh();
|
||||
return true;
|
||||
|
||||
@@ -885,6 +885,12 @@ std::string App::render_menu(const std::string &key) {
|
||||
std::string body;
|
||||
if (key == "tables" || key == "strengths" || key == "league" || key == "other")
|
||||
body = render_reports(key);
|
||||
else if (key == "postpone")
|
||||
body = render_postpone();
|
||||
else if (key == "friendlies")
|
||||
body = render_friendlies();
|
||||
else if (key == "indoor")
|
||||
body = render_indoor();
|
||||
else if (key == "training")
|
||||
body = render_training();
|
||||
else if (key == "tactics")
|
||||
@@ -903,5 +909,5 @@ std::string App::render_menu(const std::string &key) {
|
||||
else
|
||||
throw editor::Error("Diese native Ansicht ist noch nicht verfügbar.");
|
||||
return "<div class=\"fill\" style=\"z-index:100;\">" +
|
||||
window(title(key), body) + "</div>";
|
||||
window(key == "postpone" ? "Spiel verlegen" : title(key), body) + "</div>";
|
||||
}
|
||||
+24
-2
@@ -310,6 +310,7 @@ class App final : public Rml::EventListener {
|
||||
std::string last_report_state_, report_picker_, report_detail_kind_,
|
||||
report_detail_club_, report_detail_player_, report_detail_return_focus_,
|
||||
report_option_to_scroll_;
|
||||
std::string planning_dialog_, planning_notice_, planning_return_focus_;
|
||||
float device_ratio_ = 1.f;
|
||||
Json desktop_ = Json::object(), saved_desktop_ = Json::object(),
|
||||
options_ = Json::object();
|
||||
@@ -616,6 +617,16 @@ class App final : public Rml::EventListener {
|
||||
std::string render_training();
|
||||
std::string render_tactics();
|
||||
std::string render_calendar();
|
||||
Json planning_calendar() const;
|
||||
std::string calendar_day_info(const Json &) const;
|
||||
std::string calendar_grid(const Json &, double, double, double, double, bool, bool);
|
||||
std::string render_postpone();
|
||||
std::string render_friendlies();
|
||||
std::string render_planning_dialog();
|
||||
std::string planning_progress(bool, bool);
|
||||
bool planning_action(const std::string &, Rml::Element *);
|
||||
std::string render_indoor();
|
||||
bool indoor_action(const std::string &, Rml::Element *);
|
||||
std::string training_balls(const std::string &, int, int, bool,
|
||||
const std::string &player = {}, int size = 56,
|
||||
int gap = 10, bool overtraining = false);
|
||||
@@ -675,6 +686,13 @@ class App final : public Rml::EventListener {
|
||||
dirty_ = true;
|
||||
}
|
||||
void render() {
|
||||
// A window-close save prompt can leave a menu while its local dialog is
|
||||
// open. Never keep that menu's modal/input gate in the destination view.
|
||||
if (menu_ != last_rendered_menu_) {
|
||||
planning_dialog_.clear();
|
||||
report_detail_kind_.clear();
|
||||
report_picker_.clear();
|
||||
}
|
||||
training_scroll_.reset();
|
||||
if (menu_ == "training" && last_rendered_menu_ == "training")
|
||||
if (auto *roster = element("training-roster"))
|
||||
@@ -705,7 +723,7 @@ class App final : public Rml::EventListener {
|
||||
if (!menu_.empty())
|
||||
markup += render_menu(menu_);
|
||||
element("canvas")->SetInnerRML(markup);
|
||||
if (!report_detail_kind_.empty()) {
|
||||
if (!report_detail_kind_.empty() || !planning_dialog_.empty()) {
|
||||
Rml::ElementList behind;
|
||||
doc_->QuerySelectorAll(behind,
|
||||
"#report-underlay button,#report-underlay input,#report-underlay select,.window .titlebar button");
|
||||
@@ -736,7 +754,8 @@ class App final : public Rml::EventListener {
|
||||
if (!focus_after_render_.empty()) {
|
||||
if (auto *node = element(focus_after_render_))
|
||||
node->Focus(keyboard_navigation_);
|
||||
if (focus_after_render_.starts_with("report-option-"))
|
||||
if (focus_after_render_.starts_with("report-option-") ||
|
||||
focus_after_render_.starts_with("friendly-opponent-"))
|
||||
report_option_to_scroll_ = focus_after_render_;
|
||||
focus_after_render_.clear();
|
||||
}
|
||||
@@ -1039,6 +1058,9 @@ public:
|
||||
#include "modern/ui/report_pickers.inc"
|
||||
#include "modern/ui/report_details.inc"
|
||||
#include "modern/ui/reports_screens.inc"
|
||||
#include "modern/ui/indoor_screen.inc"
|
||||
#include "modern/ui/planning_screens.inc"
|
||||
#include "modern/ui/planning_controls.inc"
|
||||
} // namespace
|
||||
bool is_modern_world(const fs::path &file) {
|
||||
try {
|
||||
|
||||
@@ -100,7 +100,7 @@ int main(int argc, char **argv) try {
|
||||
std::ostringstream css;
|
||||
for (const auto *name : {"theme.rcss", "ticket.rcss", "sports.rcss",
|
||||
"calendar.rcss", "reports.rcss", "report_details.rcss",
|
||||
"report_pickers.rcss"}) {
|
||||
"report_pickers.rcss", "indoor.rcss", "planning.rcss"}) {
|
||||
std::ifstream input(root / name);
|
||||
require(bool(input), "Production stylesheet missing");
|
||||
css << input.rdbuf() << '\n';
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-only
|
||||
#include "modern/ui/demo_calendar.hpp"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <chrono>
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
|
||||
using namespace bmh::modern_ui;
|
||||
namespace {
|
||||
void require(bool ok, const char *message) {
|
||||
if (!ok) throw std::runtime_error(message);
|
||||
}
|
||||
std::string league(int group) { return "competition:planning-" + std::to_string(group); }
|
||||
std::string club(int group, int index) {
|
||||
return "club:planning-" + std::to_string(group) + "-" + std::to_string(index);
|
||||
}
|
||||
struct Fixture {
|
||||
fs::path root;
|
||||
std::shared_ptr<const Catalog> world;
|
||||
explicit Fixture(int own_count = 18, bool populated = true) {
|
||||
root = fs::temp_directory_path() / ("openbmh-planning-" +
|
||||
std::to_string(std::chrono::steady_clock::now().time_since_epoch().count()));
|
||||
fs::create_directories(root / "world");
|
||||
const auto write = [&](const std::string &file, const Json &value) {
|
||||
std::ofstream out(root / file); out << value.dump();
|
||||
require(bool(out), "Cannot write synthetic fixture");
|
||||
};
|
||||
write("manifest.json", {{"format", "openbmh-world"}, {"kind", "world"},
|
||||
{"format_version", "1.1"}, {"id", "world:synthetic-planning"},
|
||||
{"requires", {"editor:world-v1"}},
|
||||
{"x-editor", {{"profile", "editor-world-v1"}}}});
|
||||
write("world/nations.json", {{"items", Json::array({
|
||||
{{"id", "nation:de"}}, {{"id", "nation:foreign"}}, {{"id", "nation:empty"}}})}});
|
||||
Json competitions = Json::array(), clubs = Json::array();
|
||||
// Five manageable German leagues, plus foreign 20- and 18-club previews.
|
||||
if (populated) for (int group = 0; group < 7; ++group) {
|
||||
const auto nation = group < 5 ? "nation:de" : "nation:foreign";
|
||||
competitions.push_back({{"id", league(group)}, {"nation", nation}, {"type", "league"}});
|
||||
const int count = group == 0 ? own_count : group == 5 ? 20 : 18;
|
||||
for (int index = 0; index < count; ++index)
|
||||
clubs.push_back({{"id", club(group, index)}, {"name", "Synthetic club"},
|
||||
{"nation", nation}, {"competition", league(group)}});
|
||||
}
|
||||
write("world/competitions.json", {{"items", competitions}});
|
||||
write("world/clubs.json", {{"items", clubs}});
|
||||
write("world/players.json", {{"items", Json::array()}});
|
||||
world = Catalog::open(root);
|
||||
}
|
||||
~Fixture() { std::error_code ec; fs::remove_all(root, ec); }
|
||||
};
|
||||
void edit(Json &state, const Catalog &world, const Json &action,
|
||||
const std::string &managed = club(0, 3)) {
|
||||
const auto error = edit_demo_calendar(state, action, world, managed);
|
||||
if (!error.empty()) throw std::runtime_error("Unexpected rejection: " + error + " " + action.dump());
|
||||
require(valid_demo_calendar(state, world, managed), "Action produced invalid calendar");
|
||||
}
|
||||
void reject(Json &state, const Catalog &world, const Json &action,
|
||||
const std::string &managed = club(0, 3)) {
|
||||
const auto before = state;
|
||||
require(!edit_demo_calendar(state, action, world, managed).empty() && state == before,
|
||||
"Rejected action threw or changed state");
|
||||
}
|
||||
void select(Json &state, const Catalog &world, int day) {
|
||||
edit(state, world, {{"kind", "select"}, {"value", day}});
|
||||
}
|
||||
void move(Json &state, const Catalog &world, int source, int target) {
|
||||
select(state, world, source); edit(state, world, {{"kind", "postpone-source"}});
|
||||
select(state, world, target); edit(state, world, {{"kind", "postpone-move"}});
|
||||
}
|
||||
bool same(const std::vector<CalendarFixture> &a, const std::vector<CalendarFixture> &b) {
|
||||
if (a.size() != b.size()) return false;
|
||||
for (size_t i = 0; i < a.size(); ++i)
|
||||
if (a[i].day != b[i].day || a[i].from != b[i].from || a[i].round != b[i].round ||
|
||||
a[i].home != b[i].home || a[i].away != b[i].away) return false;
|
||||
return true;
|
||||
}
|
||||
} // namespace
|
||||
int main() try {
|
||||
Fixture fixture;
|
||||
const auto &world = *fixture.world;
|
||||
const auto immutable_clubs = world.rows("clubs"), immutable_competitions = world.rows("competitions");
|
||||
auto state = demo_calendar(world, "2027-07-01", club(0, 3));
|
||||
require(valid_demo_calendar(state, world, club(0, 3)) && state["selected"] == 6 &&
|
||||
state["opponent"] == club(0, 0), "Default planning state is invalid");
|
||||
require(calendar_days(state["start"]).size() == 366 &&
|
||||
calendar_days("2099-07-01").size() == 365, "Leap-year season boundary incorrect");
|
||||
require(calendar_own_league(world, club(2, 7)) == league(2) &&
|
||||
calendar_own_league(world) == league(0) &&
|
||||
!valid_demo_calendar(state, world, club(5, 0)), "Manager identity fallback is unsafe");
|
||||
for (int group = 0; group < 7; ++group) {
|
||||
auto shown = state; shown["league"] = league(group);
|
||||
const auto managed = group < 5 ? club(group, 7) : club(0, 3);
|
||||
const auto fixtures = calendar_fixtures(shown, world, managed);
|
||||
require(fixtures.size() == size_t(group == 5 ? 38 : 34), "Wrong preview league size");
|
||||
std::map<std::string, int> opponents;
|
||||
const auto followed = group < 5 ? managed : club(group, 0);
|
||||
for (const auto &f : fixtures) {
|
||||
require((f.home == followed || f.away == followed) && f.home != f.away &&
|
||||
f.from == 30 + 7 * f.round && f.day == f.from, "Incorrect stable fixture identity");
|
||||
++opponents[f.home == followed ? f.away : f.home];
|
||||
}
|
||||
require(opponents.size() == size_t(group == 5 ? 19 : 17) &&
|
||||
std::all_of(opponents.begin(), opponents.end(), [](const auto &p) { return p.second == 2; }),
|
||||
"Preview does not meet every opponent twice");
|
||||
}
|
||||
edit(state, world, {{"kind", "friendly-opponent"}, {"value", club(0, 4)}});
|
||||
require(calendar_friendly_fee(state, world) == 27000, "Fee filtered own club out of opponent index");
|
||||
edit(state, world, {{"kind", "friendly-venue"}, {"value", false}});
|
||||
require(calendar_friendly_fee(state, world) == 14000, "Away fee incorrect");
|
||||
edit(state, world, {{"kind", "friendly-country"}, {"value", "nation:foreign"}});
|
||||
require(state["friendly_league"] == league(5) && state["opponent"] == club(5, 0) &&
|
||||
state["league"] == league(0), "Friendly picker overwrote league preview");
|
||||
edit(state, world, {{"kind", "friendly-stage"}, {"value", 1}});
|
||||
select(state, world, 7); edit(state, world, {{"kind", "friendly-book"}});
|
||||
require(state["friendlies"].front() == Json({{"day", 7}, {"opponent", club(5, 0)},
|
||||
{"league", league(5)}, {"home", false}}), "Booking did not retain stable identity and venue");
|
||||
reject(state, world, {{"kind", "friendly-book"}});
|
||||
select(state, world, 30); reject(state, world, {{"kind", "friendly-book"}});
|
||||
move(state, world, 30, 8);
|
||||
auto own_fixtures = calendar_fixtures(state, world, club(0, 3));
|
||||
require(own_fixtures.front().from == 30 && own_fixtures.front().day == 8 &&
|
||||
state["source_day"] == -1 && !calendar_day_occupied(state, world, club(0, 3), 30),
|
||||
"Rescheduling lost source identity or did not free original date");
|
||||
move(state, world, 37, 9); move(state, world, 8, 10);
|
||||
require(state["moves"] == Json::array({{{"from", 37}, {"to", 9}}, {{"from", 30}, {"to", 10}}}),
|
||||
"Repeated move failed to replace source and append to undo order");
|
||||
edit(state, world, {{"kind", "postpone-undo"}});
|
||||
require(calendar_fixtures(state, world, club(0, 3)).front().day == 30 &&
|
||||
state["moves"].size() == 1, "Undo did not restore original round date");
|
||||
move(state, world, 30, 11); select(state, world, 30);
|
||||
edit(state, world, {{"kind", "friendly-book"}});
|
||||
reject(state, world, {{"kind", "postpone-undo"}});
|
||||
select(state, world, 11); edit(state, world, {{"kind", "postpone-source"}});
|
||||
select(state, world, 7); reject(state, world, {{"kind", "postpone-move"}});
|
||||
select(state, world, 44); reject(state, world, {{"kind", "postpone-move"}});
|
||||
edit(state, world, {{"kind", "postpone-cancel"}});
|
||||
reject(state, world, {{"kind", "postpone-move"}});
|
||||
select(state, world, 365); edit(state, world, {{"kind", "friendly-book"}});
|
||||
auto foreign = state; foreign["league"] = league(5);
|
||||
auto foreign_base = foreign; foreign_base["moves"] = Json::array();
|
||||
require(same(calendar_fixtures(foreign, world, club(0, 3)),
|
||||
calendar_fixtures(foreign_base, world, club(0, 3))), "Own moves leaked into foreign preview");
|
||||
require(calendar_day_occupied(foreign, world, club(0, 3), 11) &&
|
||||
!calendar_day_occupied(foreign, world, club(0, 3), 30 + 7 * 35),
|
||||
"Planning occupancy used selected preview league");
|
||||
auto full = demo_calendar(world, "2026-07-01", club(0, 3));
|
||||
for (int day = 7; full["friendlies"].size() < 20; ++day) {
|
||||
if (calendar_day_occupied(full, world, club(0, 3), day)) continue;
|
||||
select(full, world, day); edit(full, world, {{"kind", "friendly-book"}});
|
||||
}
|
||||
select(full, world, 29); reject(full, world, {{"kind", "friendly-book"}});
|
||||
const std::vector<Json> bad_actions = {nullptr, Json::array(), "bad", Json::object(),
|
||||
{{"kind", 1}}, {{"kind", "unknown"}}, {{"kind", "select"}},
|
||||
{{"kind", "select"}, {"value", true}}, {{"kind", "select"}, {"value", 7.0}},
|
||||
{{"kind", "select"}, {"value", uint64_t(-1)}},
|
||||
{{"kind", "select"}, {"value", -1}}, {{"kind", "select"}, {"value", 366}},
|
||||
{{"kind", "friendly-country"}, {"value", "nation:empty"}},
|
||||
{{"kind", "friendly-country"}, {"value", "nation:unknown"}},
|
||||
{{"kind", "friendly-league"}, {"value", "competition:unknown"}},
|
||||
{{"kind", "friendly-opponent"}, {"value", club(0, 3)}},
|
||||
{{"kind", "friendly-opponent"}, {"value", club(1, 0)}},
|
||||
{{"kind", "friendly-opponent"}, {"value", ""}},
|
||||
{{"kind", "friendly-venue"}, {"value", 1}},
|
||||
{{"kind", "friendly-stage"}, {"value", 2}},
|
||||
{{"kind", "friendly-stage"}, {"value", false}},
|
||||
{{"kind", "postpone-cancel"}, {"value", 0}},
|
||||
{{"kind", "friendly-book"}, {"unexpected", 1}}};
|
||||
for (const auto &action : bad_actions) reject(state, world, action);
|
||||
std::vector<Json> bad_states;
|
||||
for (const auto &value : std::vector<Json>{true, 1.5, -2, 366, uint64_t(-1)}) {
|
||||
auto bad = state; bad["source_day"] = value; bad_states.push_back(bad);
|
||||
}
|
||||
auto bad = state; bad["source_day"] = 31; bad_states.push_back(bad);
|
||||
bad = state; bad["moves"].push_back(bad["moves"].front()); bad_states.push_back(bad);
|
||||
bad = state; bad["moves"][0]["to"] = bad["moves"][1]["to"]; bad_states.push_back(bad);
|
||||
bad = state; bad["moves"][0]["to"] = 44; bad_states.push_back(bad);
|
||||
bad = state; bad["moves"][0]["from"] = 31; bad_states.push_back(bad);
|
||||
bad = state; bad["moves"][0]["to"] = 7; bad_states.push_back(bad);
|
||||
bad = state; bad["moves"][0]["to"] = 366; bad_states.push_back(bad);
|
||||
bad = state; bad["friendlies"].push_back(bad["friendlies"].front()); bad_states.push_back(bad);
|
||||
bad = state; bad["friendlies"][0]["opponent"] = club(0, 3); bad_states.push_back(bad);
|
||||
bad = state; bad["friendlies"][0]["league"] = league(0); bad_states.push_back(bad);
|
||||
bad = state; bad["friendlies"][0]["day"] = 44; bad_states.push_back(bad);
|
||||
bad = state; bad["friendlies"][0]["home"] = 1; bad_states.push_back(bad);
|
||||
bad = state; bad["friendlies"][0]["unexpected"] = true; bad_states.push_back(bad);
|
||||
bad = state; bad["unexpected"] = 1; bad_states.push_back(bad);
|
||||
for (auto &invalid : bad_states) {
|
||||
if (valid_demo_calendar(invalid, world, club(0, 3)))
|
||||
throw std::runtime_error("Corrupt schedule accepted: " + invalid.dump());
|
||||
reject(invalid, world, {{"kind", "postpone-cancel"}});
|
||||
const auto before = invalid;
|
||||
require(!migrate_demo_calendar(invalid, world, club(0, 3)) && invalid == before,
|
||||
"Migration repaired present corrupt data");
|
||||
}
|
||||
auto old = demo_calendar(world, "2027-07-01", club(0, 3));
|
||||
for (const auto *key : {"source_day", "friendly_league", "opponent", "home", "friendly_stage"})
|
||||
old.erase(key);
|
||||
require(!valid_demo_calendar(old, world, club(0, 3)) &&
|
||||
migrate_demo_calendar(old, world, club(0, 3)) &&
|
||||
valid_demo_calendar(old, world, club(0, 3)), "Old checkpoint migration failed");
|
||||
const auto defaults = demo_calendar(world, "2027-07-01", club(0, 3));
|
||||
for (const auto &entry : defaults.items())
|
||||
require(old.at(entry.key()) == entry.value(), "Migration changed an old field or default");
|
||||
require(valid_demo_calendar(Json::parse(state.dump()), world, club(0, 3)),
|
||||
"JSON checkpoint roundtrip lost valid planning data");
|
||||
auto different_manager = demo_calendar(world, "2026-07-01", club(3, 7));
|
||||
require(different_manager["friendly_league"] == league(3) &&
|
||||
different_manager["opponent"] == club(3, 0), "Nonfirst manager adopted first career league");
|
||||
Fixture tiny(1); auto one = demo_calendar(*tiny.world, "2026-07-01", club(0, 0));
|
||||
require(one["opponent"] == "" && calendar_friendly_fee(one, *tiny.world) == 0,
|
||||
"Single-club league invented an opponent");
|
||||
require(edit_demo_calendar(one, {{"kind", "friendly-book"}}, *tiny.world, club(0, 0)) != "",
|
||||
"Single-club friendly booking accepted");
|
||||
Fixture empty(0, false); const auto none = demo_calendar(*empty.world, "2026-07-01");
|
||||
require(valid_demo_calendar(none, *empty.world) && none["opponent"] == "" &&
|
||||
calendar_fixtures(none, *empty.world, "").empty(), "Empty world preview is unsafe");
|
||||
require(world.rows("clubs") == immutable_clubs && world.rows("competitions") == immutable_competitions,
|
||||
"Planning changed immutable world data");
|
||||
std::cout << "Modern planning checks passed\n";
|
||||
return 0;
|
||||
} catch (const std::exception &error) {
|
||||
std::cerr << error.what() << '\n'; return 1;
|
||||
}
|
||||
@@ -86,6 +86,84 @@ std::map<std::string, Json> by_club(const Json &rows) {
|
||||
for (const auto &r : rows) result.emplace(r.at("club").get<std::string>(), r);
|
||||
return result;
|
||||
}
|
||||
void check_indoor(const Catalog &world) {
|
||||
auto state = demo_reports(world);
|
||||
require(state["sorts"]["indoor"] == Json({{"key", "points"}, {"desc", true}}),
|
||||
"Indoor default sort must be points descending");
|
||||
const auto ranked = report_indoor_rows(world, state);
|
||||
require(ranked.size() == 16, "Indoor preview must cap the first German league at16 clubs");
|
||||
for (size_t i = 0; i < ranked.size(); ++i)
|
||||
require(ranked[i]["club"] == club(1, int(i)) && ranked[i]["rank"] == i + 1 &&
|
||||
ranked[i]["original"] == i && ranked[i]["points"] == 324 - int(i) * 19,
|
||||
"Indoor projection changed catalog IDs, ranks or Gold points");
|
||||
edit(state, {{"kind", "league"}, {"value", league(0)}}, world);
|
||||
edit(state, {{"kind", "filter"}, {"value", 4}}, world);
|
||||
edit(state, {{"kind", "competition"}, {"value", 8}}, world);
|
||||
state["round"] = 37;
|
||||
require(report_indoor_rows(world, state) == ranked,
|
||||
"Indoor preview must ignore selected foreign league, round and report filters");
|
||||
const auto table_sort = state["sorts"]["tables"];
|
||||
const auto strength_sort = state["sorts"]["strengths"];
|
||||
edit(state, {{"kind", "sort"}, {"view", "indoor"}, {"key", "points"}}, world);
|
||||
auto reversed = ranked;
|
||||
std::reverse(reversed.begin(), reversed.end());
|
||||
require(state["sorts"]["indoor"]["desc"] == false &&
|
||||
report_indoor_rows(world, state) == reversed,
|
||||
"Indoor points toggle must reverse numeric order without renumbering places");
|
||||
edit(state, {{"kind", "sort"}, {"view", "indoor"}, {"key", "rank"}}, world);
|
||||
require(state["sorts"]["indoor"]["desc"] == false && report_indoor_rows(world, state) == ranked,
|
||||
"Indoor rank selection must start ascending");
|
||||
edit(state, {{"kind", "sort"}, {"view", "indoor"}, {"key", "rank"}}, world);
|
||||
require(state["sorts"]["indoor"]["desc"] == true && report_indoor_rows(world, state) == reversed,
|
||||
"Indoor rank toggle must descend");
|
||||
edit(state, {{"kind", "sort"}, {"view", "indoor"}, {"key", "original"}}, world);
|
||||
require(state["sorts"]["indoor"]["desc"] == false && report_indoor_rows(world, state) == ranked,
|
||||
"Indoor original order must follow catalog order");
|
||||
edit(state, {{"kind", "sort"}, {"view", "indoor"}, {"key", "original"}}, world);
|
||||
require(report_indoor_rows(world, state) == reversed,
|
||||
"Indoor original order must honor its direction");
|
||||
require(state["sorts"]["tables"] == table_sort && state["sorts"]["strengths"] == strength_sort,
|
||||
"Indoor sorting must not alter other report sorts");
|
||||
const auto indoor_sort = state["sorts"]["indoor"];
|
||||
edit(state, {{"kind", "reset"}}, world);
|
||||
require(state["sorts"]["indoor"] == indoor_sort,
|
||||
"Table reset must retain independent indoor sort");
|
||||
|
||||
const auto current = state;
|
||||
require(migrate_demo_reports(state, world) && state == current,
|
||||
"Current reports migration must be idempotent");
|
||||
auto legacy = current;
|
||||
legacy["sorts"].erase("indoor");
|
||||
require(!valid_demo_reports(legacy, world), "Missing indoor sort must require migration");
|
||||
require(migrate_demo_reports(legacy, world) && valid_demo_reports(legacy, world),
|
||||
"Legacy reports did not acquire indoor default");
|
||||
auto expected = current;
|
||||
expected["sorts"]["indoor"] = {{"key", "points"}, {"desc", true}};
|
||||
require(legacy == expected, "Migration altered existing report choices");
|
||||
auto legacy_invalid = legacy;
|
||||
legacy_invalid["sorts"].erase("indoor");
|
||||
legacy_invalid["sorts"]["tables"]["desc"] = 1;
|
||||
const std::vector<Json> invalid = {
|
||||
nullptr, Json::array(), Json{{"sorts", Json::object()}}, legacy_invalid,
|
||||
[&] { auto v = legacy; v["sorts"]["indoor"] = nullptr; return v; }(),
|
||||
[&] { auto v = legacy; v["sorts"]["indoor"]["key"] = "club"; return v; }(),
|
||||
[&] { auto v = legacy; v["sorts"]["indoor"]["desc"] = "false"; return v; }(),
|
||||
[&] { auto v = legacy; v["sorts"]["indoor"]["extra"] = 1; return v; }(),
|
||||
[&] { auto v = legacy; v["sorts"]["indoor"] = Json::array(); return v; }(),
|
||||
[&] { auto v = legacy; v["sorts"].erase("indoor"); v["round"] = -1; return v; }(),
|
||||
[&] { auto v = legacy; v["sorts"].erase("indoor"); v["sorts"]["extra"] = 1; return v; }()};
|
||||
for (auto value : invalid) {
|
||||
const auto before = value;
|
||||
require(!valid_demo_reports(value, world) && !migrate_demo_reports(value, world) && value == before &&
|
||||
report_indoor_rows(world, value).empty(),
|
||||
"Malformed indoor/legacy reports were repaired or partially mutated");
|
||||
}
|
||||
for (const auto &key : {"club", "strength", "name"}) {
|
||||
const auto before = state;
|
||||
require(!edit_demo_reports(state, {{"kind", "sort"}, {"view", "indoor"}, {"key", key}}, world).empty() &&
|
||||
state == before, "Invalid indoor sort mutated reports");
|
||||
}
|
||||
}
|
||||
void check_league(const Catalog &world, const std::string &id, int count) {
|
||||
auto state = demo_reports(world); edit(state, {{"kind", "league"}, {"value", id}}, world);
|
||||
const int rounds = report_round_count(world, state);
|
||||
@@ -169,6 +247,7 @@ int main() try {
|
||||
auto state = demo_reports(world);
|
||||
require(valid_demo_reports(state, world) && state.at("league") == league(1) &&
|
||||
state.at("round") == 26, "Default state did not choose first German league");
|
||||
check_indoor(world);
|
||||
check_league(world, league(1), 18); check_league(world, league(0), 20);
|
||||
auto first = state; first["round"] = 0;
|
||||
const auto first_match = report_match_rows(world, first, false).front();
|
||||
@@ -295,13 +374,17 @@ int main() try {
|
||||
for (const auto &v : bad_states) require(!valid_demo_reports(v, world), "Malformed reports state accepted");
|
||||
Fixture tiny(2); auto small = demo_reports(*tiny.world);
|
||||
require(small["round"] == 1, "Default round did not clamp for two clubs");
|
||||
const auto tiny_indoor = report_indoor_rows(*tiny.world, small);
|
||||
require(tiny_indoor.size() == 2 && tiny_indoor.back()["points"] == 305,
|
||||
"Indoor preview invented clubs in a tiny German league");
|
||||
edit(small, {{"kind", "competition"}, {"value", 1}}, *tiny.world); small["round"] = 33;
|
||||
require(report_match_rows(*tiny.world, small, false)[0]["round"] == 1, "Local league projection did not clamp shared round");
|
||||
edit(small, {{"kind", "competition"}, {"value", 0}}, *tiny.world);
|
||||
require(small["round"] == 1, "Switching back to league clamped to the wrong round");
|
||||
Fixture empty(0, false); const auto none = demo_reports(*empty.world);
|
||||
require(valid_demo_reports(none, *empty.world) && report_round_count(*empty.world, none) == 1 &&
|
||||
report_table_rows(*empty.world, none).empty() && report_opening_pairs(*empty.world).empty(),
|
||||
report_table_rows(*empty.world, none).empty() && report_opening_pairs(*empty.world).empty() &&
|
||||
report_indoor_rows(*empty.world, none).empty(),
|
||||
"Empty presentation catalogue is unsafe");
|
||||
require(world.rows("clubs") == immutable_clubs && world.rows("players") == immutable_players,
|
||||
"Report projection mutated immutable world data");
|
||||
|
||||
@@ -372,6 +372,51 @@ int main(int argc, char **argv) try {
|
||||
{{"kind", "league"}, {"value", "missing"}}}).ok &&
|
||||
restored_reports.snapshot().state == accepted_reports.state,
|
||||
"Rejected report load/action partially mutated the session");
|
||||
const auto planning_before = restored_reports.snapshot();
|
||||
const auto plan_action = [&](const Json &change) {
|
||||
return restored_reports.apply({restored_reports.snapshot().revision, "calendar", change}).ok;
|
||||
};
|
||||
require(plan_action({{"kind", "friendly-league"}, {"value", "comp:other"}}) &&
|
||||
plan_action({{"kind", "friendly-opponent"}, {"value", "club:b"}}) &&
|
||||
plan_action({{"kind", "friendly-venue"}, {"value", true}}) &&
|
||||
plan_action({{"kind", "friendly-stage"}, {"value", 1}}) &&
|
||||
plan_action({{"kind", "select"}, {"value", 7}}) &&
|
||||
plan_action({{"kind", "friendly-book"}}),
|
||||
"Planning through the shared source failed");
|
||||
require(restored_reports.snapshot().state["cash"] == planning_before.state["cash"] &&
|
||||
restored_reports.snapshot().state["managers"] == planning_before.state["managers"] &&
|
||||
restored_reports.snapshot().state["training"] == planning_before.state["training"],
|
||||
"Presentation planning mutated finances, managers or training");
|
||||
require(plan_action({{"kind", "select"}, {"value", 30}}) &&
|
||||
plan_action({{"kind", "postpone-source"}}) &&
|
||||
plan_action({{"kind", "select"}, {"value", 8}}) &&
|
||||
plan_action({{"kind", "postpone-move"}}),
|
||||
"Rescheduling used the foreign preview instead of the manager schedule");
|
||||
restored_reports.save(root / "planning.ui.json", default_desktop());
|
||||
DemoSource restored_planning(calendar_world);
|
||||
restored_planning.load(root / "planning.ui.json");
|
||||
require(restored_planning.snapshot().state == restored_reports.snapshot().state,
|
||||
"Bookings or moves were lost on source round-trip");
|
||||
const auto planning_accepted = restored_planning.snapshot();
|
||||
auto colliding_plan = Json::parse(bmh::editor::read_file(root / "planning.ui.json"));
|
||||
colliding_plan["calendar"]["friendlies"][0]["day"] = 8;
|
||||
write(root, "colliding-plan.ui.json", colliding_plan);
|
||||
rejected = false;
|
||||
try { restored_planning.load(root / "colliding-plan.ui.json"); }
|
||||
catch (const std::exception &) { rejected = true; }
|
||||
require(rejected && restored_planning.snapshot().state == planning_accepted.state &&
|
||||
restored_planning.snapshot().revision == planning_accepted.revision,
|
||||
"Conflicting plan partially loaded");
|
||||
auto old_planning = Json::parse(bmh::editor::read_file(root / "calendar.ui.json"));
|
||||
for (const auto *key : {"source_day", "friendly_league", "opponent", "home", "friendly_stage"})
|
||||
old_planning["calendar"].erase(key);
|
||||
old_planning["reports"]["sorts"].erase("indoor");
|
||||
write(root, "old-planning.ui.json", old_planning);
|
||||
restored_planning.load(root / "old-planning.ui.json");
|
||||
require(restored_planning.snapshot().state["calendar"]["league"] == "comp:other" &&
|
||||
restored_planning.snapshot().state["calendar"]["friendly_league"] == "comp:home" &&
|
||||
restored_planning.snapshot().state["reports"]["sorts"]["indoor"]["key"] == "points",
|
||||
"Old checkpoint lost league preview or failed planning/indoor migration");
|
||||
GuiAssets absent(root / "missing-gui");
|
||||
require(!absent.available(),
|
||||
"World resources were mistaken for GUI resources");
|
||||
|
||||
Reference in new issue
Block a user