From 2b0d528ec75ee4ad62d825a2904ab27f9de18f33 Mon Sep 17 00:00:00 2001 From: Weyoune Date: Sun, 15 Nov 2026 21:37:01 +0100 Subject: [PATCH] Toto as a page of the notebook: our slip in the dress of the other pages The matches as a panel on the left, the printed slip with its six columns filling the right, the actions and the status in the foot, the receipts as notes. Co-Authored-By: Claude Fable 5.2 --- assets/modern/pages.rcss | 52 ++++++++++++++ assets/modern/toto.rcss | 103 +-------------------------- src/modern/ui/pages.inc | 2 +- src/modern/ui/toto_screens.inc | 123 +++++++++++++++++++-------------- 4 files changed, 126 insertions(+), 154 deletions(-) diff --git a/assets/modern/pages.rcss b/assets/modern/pages.rcss index c8fb1bd..2cb95ce 100644 --- a/assets/modern/pages.rcss +++ b/assets/modern/pages.rcss @@ -610,3 +610,55 @@ body.midnight .sd-stage,body.matchday .sd-stage {background-color:var(--p-n2);} .pg-root .settings-jump-label .settings-select {width:470dp;font-size:28dp;} .pg-root #settings-apply,.pg-root #settings-apply:hover {background-color:var(--p-accent);border-color:var(--p-accent);color:var(--p-on-accent);opacity:1;} .pg-root #settings-apply:disabled,.pg-root #settings-apply[disabled] {opacity:1;background-color:var(--p-n2);border-color:var(--p-div);color:var(--p-n5);} + +/* --- toto: the matches on the left, the printed slip with its six columns on the right --- */ +.tt-programme {width:990dp;flex:none;gap:18dp;padding:27dp 32dp;} +.tt-table {display:block;} +.tt-row {display:flex;align-items:center;gap:14dp;height:92dp;border-top:2dp var(--p-row);font-size:28dp;} +.tt-row.head {height:56dp;border-top-width:0dp;font-size:23dp;font-weight:bold;letter-spacing:1dp;color:var(--p-n7);} +.tt-no {display:block;flex:none;width:56dp;text-align:right;font-weight:bold;} +.tt-row.head .tt-teams {display:block;text-align:center;} +.tt-teams {display:flex;flex:1;min-width:0;align-items:center;gap:9dp;} +.tt-club {display:flex;flex:1;min-width:0;align-items:center;gap:11dp;} +.tt-club.home {justify-content:flex-end;} +.tt-club-name {display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} +.tt-versus {display:block;flex:none;width:27dp;text-align:center;color:var(--p-n7);} +.tt-league {display:block;flex:none;width:110dp;text-align:right;white-space:nowrap;color:var(--p-n7);} +.tt-note {display:block;font-size:27dp;line-height:36dp;} +.tt-coupon {display:flex;flex-direction:column;flex:1;min-width:0;gap:14dp;padding:27dp 32dp;border:3dp #c8573f;border-radius:45dp;background-color:#fff8ed;color:#bd302c;} +.tt-heading {display:flex;flex:none;align-items:flex-end;justify-content:space-between;height:128dp;padding-bottom:14dp;border-bottom:3dp #bd302c;} +.tt-brand strong {display:block;font-size:76dp;font-weight:bold;letter-spacing:-6dp;line-height:70dp;transform:skewX(-8deg);} +.tt-brand span {display:block;margin-top:7dp;font-size:27dp;font-weight:bold;letter-spacing:3dp;line-height:32dp;} +.tt-caption {display:block;text-align:right;} +.tt-caption strong {display:block;font-size:35dp;line-height:42dp;font-weight:normal;} +.tt-caption span {display:block;font-size:27dp;line-height:32dp;font-weight:bold;} +.tt-caption small {display:block;font-size:22dp;line-height:27dp;} +.tt-fields {display:flex;flex:1;min-height:0;align-items:flex-start;gap:22dp;} +.tt-field {display:block;flex:none;width:268dp;padding:0;border-radius:18dp;} +.tt-field.selected-column {background-color:#ffffff;} +.tt-column,.tt-column:disabled {display:flex;align-items:center;justify-content:space-between;width:268dp;height:66dp;padding:0 14dp;border:0dp;border-bottom:3dp transparent;border-radius:18dp 18dp 0dp 0dp;background-color:transparent;decorator:none;font-family:Display;font-size:31dp;color:#8c2f1a;} +.pg-root .tt-column span {display:block;white-space:nowrap;color:#8c2f1a;} +.tt-column strong {display:block;flex:none;width:38dp;height:38dp;line-height:38dp;border-radius:9dp;text-align:center;font-family:Modern;font-size:27dp;font-weight:bold;background-color:#bd302c;color:#fff8ed;} +.tt-column:hover {background-color:#bd302c13;decorator:none;} +.selected-column .tt-column,.selected-column .tt-column:hover {border-bottom-color:#bd302c;background-color:#bd302c0d;} +.tt-pick-head {display:flex;height:40dp;border-bottom:2dp #bd302c;font-size:26dp;font-weight:bold;text-align:center;} +.tt-pick-head span {display:block;flex:none;line-height:40dp;} +.tt-pick-row {display:flex;align-items:center;height:96dp;border-bottom:1dp #d1554f55;} +.tt-row-number {display:block;flex:none;height:70dp;line-height:70dp;border-radius:7dp;text-align:center;background-color:#bd302c;font-size:26dp;font-weight:bold;color:#fff8ed;} +.pg-root .toto-pick,.pg-root .toto-pick:disabled {position:relative;display:block;flex:none;height:70dp;padding:0;border:2.5dp #cd4740;border-radius:9dp;background-color:#fffdf8;decorator:none;font-family:Modern;font-size:28dp;color:#c0443d;} +.pg-root .toto-pick:hover {background-color:#bd302c12;decorator:none;} +.pg-root .toto-pick[aria-pressed=true] {color:#d9a29d;} +.pg-root .toto-pick:focus-visible,.tt-column:focus-visible {box-shadow:0dp 0dp 0dp 3dp #253e62;} +.tt-pick-value {display:block;width:100%;line-height:65dp;text-align:center;} +.tt-cross {position:absolute;left:-2dp;top:-2dp;display:block;pointer-events:none;} +.tt-progress {display:block;height:44dp;line-height:44dp;text-align:center;font-size:23dp;font-weight:bold;color:#a0695f;} +.tt-progress.full {color:#3d472b;} +.tt-footer {display:flex;flex:none;align-items:center;justify-content:space-between;padding-top:11dp;border-top:2dp #bd302c;font-size:26dp;font-weight:bold;color:#8c2f1a;} +.tt-footer span {display:block;white-space:nowrap;} +.tt-footer strong {font-weight:bold;} +/* the slips in the dialogs */ +.tt-receipt {padding:9dp 27dp;} +.tt-receipt-row {display:flex;align-items:center;height:62dp;border-top:2dp var(--p-row);font-size:28dp;} +.tt-receipt-row.head {height:54dp;border-top-width:0dp;font-size:23dp;font-weight:bold;letter-spacing:1dp;color:var(--p-n7);} +.tt-cell {display:block;flex:1;min-width:0;text-align:center;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;} +.tt-cell.first {flex:3;text-align:left;} diff --git a/assets/modern/toto.rcss b/assets/modern/toto.rcss index e06b321..6e91b60 100644 --- a/assets/modern/toto.rcss +++ b/assets/modern/toto.rcss @@ -1,103 +1,2 @@ /* SPDX-License-Identifier: GPL-3.0-only */ -.toto-native {position:absolute;left:0;top:0;right:0;bottom:0;} -.toto-program {position:absolute;left:0;top:0;width:1116.265625dp;height:1614dp;padding:28dp;border:2dp var(--border);border-radius:18dp;background-color:var(--panel);overflow:hidden;} -.toto-program>header {position:absolute;left:28dp;right:28dp;top:28dp;height:176dp;padding:8dp 10dp;border-bottom:2dp var(--border);} -.toto-program>header>p {margin:0 0 8dp;font-size:28dp;line-height:28dp;color:var(--muted);} -.toto-program h2 {margin:0 0 14dp;font-size:42dp;font-weight:bold;line-height:48dp;} -.toto-program>header>span {font-size:28dp;line-height:31dp;} -.toto-program-head {position:absolute;left:28dp;right:28dp;top:204dp;height:94dp;padding:0 12dp 16dp;border-bottom:2dp var(--border);display:flex;align-items:flex-end;gap:20dp;color:var(--muted);font-size:28dp;} -.toto-program-head>span {width:90dp;flex-shrink:0;line-height:28dp;} -.toto-program-head>span:nth-child(2) {flex:1;width:auto;text-align:center;} -.toto-program-head>span:last-child {text-align:right;} -.toto-match-row {position:absolute;left:28dp;right:28dp;height:82dp;padding:5dp 12dp;border-bottom:2dp var(--border);display:flex;align-items:center;gap:20dp;} -.toto-match-row.striped {background-color:var(--soft);} -.toto-match-number {width:90dp;flex-shrink:0;font-size:28dp;} -.toto-match-league {width:90dp;flex-shrink:0;font-size:28dp;text-align:right;color:var(--muted);white-space:nowrap;} -.toto-match-teams {display:flex;align-items:center;gap:10dp;flex:1;min-width:0;} -.toto-match-teams>div {display:flex;align-items:center;flex:1;min-width:0;} -.toto-home {justify-content:flex-end;} -.toto-away {justify-content:flex-start;} -.toto-versus {width:32dp;flex-shrink:0;text-align:center;font-size:28dp;color:var(--muted);} -.toto-club-label {display:flex;align-items:center;gap:10dp;max-width:100%;min-width:0;font-size:28dp;line-height:34dp;} -.toto-club-label .image-frame {flex-shrink:0;} -.toto-club-name {display:block;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;} -.toto-home .toto-club-name {text-align:right;} -.toto-program-note {position:absolute;left:38dp;right:38dp;top:1228dp;font-size:28dp;line-height:36dp;color:var(--muted);margin:0;} -.toto-coupon {position:absolute;left:1152.265625dp;top:0;width:1459.734375dp;height:1614dp;padding:28dp;border:2dp #dfc9b9;border-radius:4dp;background-color:#fff8ed;color:#bd302c;overflow:hidden;} -.toto-print-mark {position:absolute;left:8dp;width:5dp;height:40dp;background-color:#bd302c;} -.toto-print-mark.top {top:30dp;}.toto-print-mark.bottom {bottom:30dp;} -.toto-paper-heading {position:absolute;left:28dp;right:28dp;top:28dp;height:154dp;border-bottom:3dp #bd302c;display:flex;align-items:center;justify-content:space-between;} -.toto-paper-brand {width:40%;} -.toto-paper-brand>strong {display:block;font-size:76dp;font-weight:bold;letter-spacing:-6dp;line-height:68.4dp;transform:skewX(-8deg);} -.toto-paper-brand h2 {margin:12dp 0 0;font-size:28dp;font-weight:bold;letter-spacing:3dp;line-height:33.6dp;color:#bd302c;} -.toto-paper-caption {display:flex;flex-direction:column;gap:12dp;align-items:flex-end;width:55%;} -.toto-paper-caption>strong,.toto-paper-caption>span,.toto-paper-caption>small {display:block;width:100%;text-align:right;} -.toto-paper-caption>strong {font-size:35dp;line-height:42dp;font-weight:normal;} -.toto-paper-caption>span {font-size:28dp;line-height:30dp;} -.toto-paper-caption>small {font-size:22dp;line-height:26.4dp;} -.toto-field {position:absolute;top:182dp;width:221.619792dp;height:1066dp;} -.toto-column-heading {position:absolute;left:0;top:0;width:100%;height:74dp;padding:0 12dp;border:0dp;border-bottom:3dp transparent;border-radius:0dp;background-color:transparent;color:#bd302c;display:flex;align-items:center;justify-content:space-between;gap:8dp;} -.toto-column-heading>span {display:block;font-size:28dp;white-space:nowrap;} -.toto-column-heading>strong {display:block;width:34dp;height:36dp;line-height:36dp;text-align:center;flex-shrink:0;font-size:28dp;font-weight:normal;background-color:#bd302c;color:#fff8ed;} -.selected-column .toto-column-heading {border-bottom-color:#bd302c;background-color:#bd302c0a;} -.toto-column-heading:hover {background-color:#bd302c13;} -.toto-pick-head {position:absolute;left:0;top:74dp;width:100%;height:42dp;border-bottom:2dp #bd302c;font-size:28dp;text-align:center;} -.toto-pick-head>span {position:absolute;top:0;height:40dp;line-height:40dp;} -.toto-pick-head>span:first-child {font-size:17dp;} -.toto-pick-row {position:absolute;left:0;width:100%;height:82dp;border-bottom:1dp #d1554f55;} -.toto-row-number {position:absolute;left:0;top:8.5dp;width:28dp;height:64dp;line-height:64dp;text-align:center;background-color:#bd302c;color:#fff8ed;font-size:28dp;} -.toto-pick {position:absolute;top:8.5dp;height:64dp;display:flex;align-items:center;justify-content:center;padding:0;border:2dp #cd4740;border-radius:0dp;background-color:transparent;color:#c0443d;font-size:28dp;} -.toto-pick:hover {background-color:#bd302c0c;}.toto-pick[aria-pressed=true] {color:#c06a63;} -.toto-pick:focus-visible,.toto-column-heading:focus-visible {box-shadow:0dp 0dp 0dp 3dp #253e62;background-color:#253e6210;} -.toto-pick-value {display:block;width:100%;line-height:34dp;text-align:center;} -.toto-cross {position:absolute;left:-2dp;top:-2dp;width:59.53993dp;height:64dp;pointer-events:none;} -.toto-field-progress {position:absolute;top:1018dp;left:0;width:100%;height:48dp;line-height:48dp;text-align:center;margin:0;font-size:19dp;color:#a53a33;} -.toto-paper-footer {position:absolute;left:28dp;right:28dp;top:1248dp;padding-top:16dp;border-top:2dp #bd302c;} -.toto-paper-footer p {margin:0 0 10dp;font-size:23dp;line-height:27.6dp;text-align:center;} -.toto-paper-footer strong {font-weight:bold;}.toto-paper-footer b {font-weight:normal;margin:0 12dp;} -.toto-paper-footer>span {display:block;font-size:22dp;line-height:30.8dp;} -.toto-paper-footer>small {display:block;margin-top:12dp;padding-top:10dp;border-top:2dp #bd302c66;font-size:18dp;line-height:21.6dp;letter-spacing:.6dp;} -.toto-status {position:absolute;left:0;right:0;top:1644dp;height:92dp;display:flex;align-items:center;justify-content:space-between;gap:30dp;font-size:28dp;color:var(--muted);} -.toto-status>div {display:flex;flex-direction:column;gap:12dp;width:60%;} -.toto-status>div>strong {display:block;width:100%;font-size:30dp;font-weight:normal;color:var(--text);line-height:35dp;} -.toto-status>div>span {display:block;width:100%;font-size:28dp;line-height:29dp;} -.toto-status>p {margin:0;white-space:nowrap;}.toto-status>p>strong {margin-left:24dp;font-size:34dp;font-weight:normal;color:var(--accent);} -.toto-nav {position:absolute;left:0;right:0;bottom:0;height:94dp;display:flex;gap:20dp;} -.toto-control {display:flex;align-items:center;justify-content:center;flex:1;min-width:0;padding:8dp 15dp;border:2dp var(--border);border-radius:12dp;background-color:transparent;decorator:linear-gradient(180deg,#c1d1e31c,#869eb312);font-size:30dp;} -.toto-control>span {display:block;width:100%;white-space:nowrap;text-align:center;} -.toto-layer {position:absolute;left:0;right:0;top:0;bottom:0;display:flex;align-items:center;justify-content:center;background-color:#08101980;z-index:30;} -.toto-dialog {width:2484dp;padding:40dp 52dp;border:2dp var(--border);border-radius:22dp;background-color:#283542f5;font-size:36dp;} -.toto-dialog h2 {width:100%;font-size:42dp;line-height:48dp;font-weight:bold;letter-spacing:-.4dp;text-align:center;margin:0 0 35dp;} -.toto-dialog.receipt {height:1172dp;background-color:#283542;} -.toto-receipt {width:100%;height:820dp;overflow-y:auto;} -.toto-receipt-row {display:flex;height:64dp;width:100%;font-size:34dp;} -.toto-receipt-row>span {display:block;flex-shrink:0;height:64dp;line-height:64dp;text-align:center;} -.toto-receipt-row.head {color:var(--muted);border-bottom:2dp var(--border);} -.toto-receipt-row.striped {background-color:#38706b19;} -.toto-receipt-total {margin:30dp 0 0;font-size:30dp;line-height:45dp;text-align:right;color:var(--accent);} -.toto-notice {margin:36dp 0;line-height:54dp;} -.toto-dialog-actions {display:flex;height:65dp;width:100%;margin-top:45dp;} -.toto-dialog-actions .toto-control {font-size:32dp;} -body.midnight .toto-program {background-color:#12243140;border-color:#c5d9e726;} -body.midnight .toto-program>header>p {color:#97afc2;} -body.midnight .toto-program h2 {color:#e5edf3;} -body.midnight .toto-program>header>span {color:#b4c7d6;} -body.midnight .toto-match-row.striped {background-color:#c5d9e704;} -body.midnight .toto-match-row {border-color:#c5d9e717;} -body.midnight .toto-club-label {color:#d7e3ec;} -body.midnight .toto-away .toto-club-label {color:#a9bfce;} -body.midnight .toto-program-note {color:#91aabb;} -body.midnight .toto-status {color:#9eb7c8;} -body.midnight .toto-status>div>strong {color:#d1e3ec;} -body.midnight .toto-status>p>strong,body.midnight .toto-receipt-total {color:#cce5dc;} -body.silver .toto-control {decorator:linear-gradient(180deg,#ffffffd8,#e9e1cf99);} -body.matchday .toto-control {decorator:linear-gradient(180deg,#e8d6dc12,#a1a0aa0d);} -body.silver .toto-dialog,body.silver .toto-dialog.receipt {background-color:#f7f3e9fc;} -body.matchday .toto-dialog,body.matchday .toto-dialog.receipt {background-color:#2c2c32fc;} -.toto-dialog.notice {position:relative;height:332dp;} -.toto-dialog.notice .toto-notice {position:absolute;left:52dp;right:52dp;top:124dp;height:54dp;margin:0;} -.toto-dialog.notice .toto-dialog-actions {position:absolute;left:52dp;right:52dp;top:223dp;width:auto;height:65dp;margin:0;} -.toto-program>header>span {position:absolute;left:10dp;top:125.5dp;height:31dp;line-height:31dp;} - -.toto-dialog.receipt.settlement {height:auto;width:1600dp;} -.toto-dialog.settlement .toto-receipt {height:auto;max-height:500dp;} +/* Toto is a page of the notebook now: its styles are the tt-* rules in pages.rcss. */ diff --git a/src/modern/ui/pages.inc b/src/modern/ui/pages.inc index 84100e1..34cf8f4 100644 --- a/src/modern/ui/pages.inc +++ b/src/modern/ui/pages.inc @@ -5,7 +5,7 @@ // The menus that are laid out as a page of the notebook. Every other career menu is still a // sheet of the old format, shown scaled inside the book. bool App::page_native() const { - static const std::set native{"settings", "save", "load", "stadium", "statistics", "news", "transfer", "training", "almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"}; + static const std::set native{"toto", "settings", "save", "load", "stadium", "statistics", "news", "transfer", "training", "almanac", "tactics", "achievements", "highscore", "balance", "contracts", "environment", "tables", "league", "other", "strengths", "fairplay", "indoor", "scorers"}; if (menu_ == "calendar" || menu_ == "postpone" || menu_ == "lineup") return notebook_page() && engine_mode_; // a national coach arranges friendlies on the older sheet if (menu_ == "friendlies") return notebook_page() && engine_mode_ && engine_data_.contains("desktop") && engine_data_.at("desktop").at("meta").at("scope").at("role") == "club"; diff --git a/src/modern/ui/toto_screens.inc b/src/modern/ui/toto_screens.inc index ab4c6e1..32c98e2 100644 --- a/src/modern/ui/toto_screens.inc +++ b/src/modern/ui/toto_screens.inc @@ -4,6 +4,9 @@ std::string toto_pick_id(int col, int row, int pick) { return "toto-pick-" + std::to_string(col) + "-" + std::to_string(row) + "-" + std::to_string(pick); } } +// Finanzen > Toto as a page of the notebook: the eleven matches on the left, the printed slip +// with its six columns on the right, and in the foot what one does with the slip. The slip +// keeps its own red print; everything around it follows the notes of the other pages. std::string App::render_toto() { const auto t=toto_value(); const auto toto_cash=[&](int64_t value){return engine_mode_?money(value,{{"code","EUR"},{"minor_units",2}}):cash(value);}; @@ -11,87 +14,105 @@ std::string App::render_toto() { const bool available = programme.at("complete").get(); const auto &games = programme.at("rows"); const std::array picks{1, 0, 2}; - std::string out = "
" - "

Die Begegnungen

Spielprogramm

"+esc(programme.value("caption",std::string("Spielrunde 27")))+" · Saison " + esc(programme.at("season").get()) + - "
Nr.Heim – GastLiga
"; + page_hint_ = "11 Spiele · 6 Tipp-Spalten"; + std::string out = "
" + pg_kicker("Die Begegnungen") + + "

" + esc(programme.value("caption",std::string("Spielrunde 27"))) + " · Saison " + esc(programme.at("season").get()) + + "

NR.HEIM – GASTLIGA
"; const auto club_name = [&](const Json *club, bool home,const Json &reference) { const auto label=reference.is_object()?reference.at("name").get():club?world_->name(*club):std::string("—"); - const auto name = "" + esc(label) + "", logo = crest(club, 34); - return "" + - (home ? name + logo : logo + name) + ""; + const auto name = "" + esc(label) + "", logo = crest(club, 45); + return "
" + (home ? name + logo : logo + name) + "
"; }; for (int r = 0; r < 11; ++r) { const bool has = size_t(r) < games.size(); const auto *home = has ? world_->find("clubs", games[size_t(r)].at("home")) : nullptr; const auto *away = has ? world_->find("clubs", games[size_t(r)].at("away")) : nullptr; - out += "
" - "" + std::to_string(r + 1) + "
" + - club_name(home,true,has?games[size_t(r)].value("home_ref",Json()):Json()) + "
–
" + club_name(away,false,has?games[size_t(r)].value("away_ref",Json()):Json()) + - "
" + (has ? games[size_t(r)].value("league_label",std::to_string(games[size_t(r)].value("tier",0))+". BL") : "—") + "
"; + out += "
" + std::to_string(r + 1) + "
" + + club_name(home,true,has?games[size_t(r)].value("home_ref",Json()):Json()) + "–" + club_name(away,false,has?games[size_t(r)].value("away_ref",Json()):Json()) + + "
" + (has ? esc(games[size_t(r)].value("league_label",std::to_string(games[size_t(r)].value("tier",0))+". BL")) : std::string("—")) + "
"; } - out += "

" + std::string(available ? "Heim links · Gast rechts
Die Spielnummer steht in jeder Tipp-Spalte." - : "Das Spielprogramm ist unvollständig.
Ein Schein kann derzeit nicht vorgemerkt werden.") + "

" - "
" - "
TOTO

ELFERWETTE

" - "
Spielschein11 Spiele · 6 Tipp-Spalten"+esc(programme.value("print_caption",std::string("Spielprogramm 27")))+"
"; + out += "
" + std::string(available ? "Heim links · Gast rechts. Die Spielnummer steht in jeder Tipp-Spalte." + : "Das Spielprogramm ist unvollständig. Ein Schein kann derzeit nicht vorgemerkt werden.") + "" + "
TOTOELFERWETTE
" + "
Spielschein11 Spiele · 6 Tipp-Spalten"+esc(programme.value("print_caption",std::string("Spielprogramm 27")))+"
"; const auto cross = renderer_.diagram("toto-ink-cross", "", 160); - constexpr double col_width = 221.619792, gap = 14, pick_width = (col_width - 43) / 3; + // the slip's own measures, in dp: six columns across the sheet, eleven rows down + constexpr double col_width = 268, number_width = 34, pick_gap = 6, pick_width = (col_width - number_width - 3 * pick_gap) / 3, pick_height = 70; for (int c = 0; c < 6; ++c) { const auto count = summary.at("counts")[size_t(c)].get(); - out += "
" + - btn("toto-column", "Spalte" + std::to_string(c + 1) + "", "toto-column-heading", + out += "
" + + btn("toto-column", "Spalte" + std::to_string(c + 1) + "", "tt-column", "id=\"toto-column-" + std::to_string(c) + "\" data-column=\"" + std::to_string(c) + "\" aria-pressed=\"" + (c == toto_column_ ? "true" : "false") + "\"") + - "
Nr."; - for (int p = 0; p < 3; ++p) - out += "" + std::to_string(picks[size_t(p)]) + ""; + "
Nr."; + for (int p = 0; p < 3; ++p) out += "" + std::to_string(picks[size_t(p)]) + ""; out += "
"; for (int r = 0; r < 11; ++r) { - out += "
" + std::to_string(r + 1) + ""; + out += "
" + std::to_string(r + 1) + ""; for (int p = 0; p < 3; ++p) { const auto pick = picks[size_t(p)]; const bool chosen = t.at("columns")[size_t(c)][size_t(r)] == pick; const bool tabstop = toto_focus_[size_t(c)] == std::pair(r, pick); - out += btn("toto-pick", "" + std::to_string(pick) + "" + (chosen ? - "" + picture(cross, pick_width, 64) + "" : ""), + out += btn("toto-pick", "" + std::to_string(pick) + "" + (chosen ? + "" + picture(cross, pick_width, pick_height) + "" : ""), "toto-pick", "id=\"" + toto_pick_id(c, r, pick) + "\" data-column=\"" + std::to_string(c) + "\" data-row=\"" + std::to_string(r) + "\" data-pick=\"" + std::to_string(pick) + "\" aria-pressed=\"" + (chosen ? "true" : "false") + "\" aria-label=\"Spalte " + std::to_string(c + 1) + ", Spiel " + std::to_string(r + 1) + ", " + (pick == 1 ? "Heimsieg" : pick == 0 ? "Unentschieden" : "Auswärtssieg") + - "\" style=\"left:" + scalar(33 + p * (pick_width + 5)) + "dp;width:" + scalar(pick_width) + "dp;tab-index:" + (tabstop ? "auto" : "none") + ";\" data-tabstop=\"" + (tabstop ? "true" : "false") + "\""); + "\" style=\"width:" + scalar(pick_width) + "dp;margin-left:" + scalar(pick_gap) + "dp;tab-index:" + (tabstop ? "auto" : "none") + ";\" data-tabstop=\"" + (tabstop ? "true" : "false") + "\""); } out += "
"; } - out += "

" + (count == 0 ? "Leer" : count == 11 ? "Vollständig" : std::to_string(count) + " / 11") + "

"; + out += "" + (count == 0 ? "Leer" : count == 11 ? "Vollständig" : std::to_string(count) + " / 11") + "
"; } - out += "

1 Heimsieg · 0 Unentschieden · 2 Auswärtssieg

" - "Pro Spiel und Spalte ein Kreuz. Leere Spalten bleiben unberücksichtigt."+std::string(engine_mode_?"Dreierpack · Digitaler Tippschein":"OpenBMH · Musterschein · Grafik-POC")+"
"; + out += "
1 = Heimsieg · 0 = Unentschieden · 2 = Auswärtssieg · pro Spiel und Spalte ein Kreuz" + + std::string(engine_mode_?"Einsatz je Spalte":"Einsatz gesamt") + " " + esc(toto_cash(t.at("stake"))) + "
"; const int complete = summary.at("complete"), partial = summary.at("partial"); - out += "
" + std::to_string(complete) + (complete == 1 ? " vollständige Spalte" : " vollständige Spalten") + - "" + (engine_mode_&&!engine_toto_feedback_.empty()?esc(engine_toto_feedback_):partial ? std::to_string(partial) + (partial == 1 ? " Spalte noch unvollständig" : " Spalten noch unvollständig") : - "Spalte " + std::to_string(toto_column_ + 1) + " für Tippvorschlag und Leeren ausgewählt") + "

"+std::string(engine_mode_?"Einsatz je Spalte":"Einsatz gesamt")+" " + esc(toto_cash(t.at("stake"))) + "

"; - out += ""; + const auto feedback = engine_mode_&&!engine_toto_feedback_.empty()?engine_toto_feedback_:partial ? std::to_string(partial) + (partial == 1 ? " Spalte noch unvollständig" : " Spalten noch unvollständig") : + "Spalte " + std::to_string(toto_column_ + 1) + " für Tippvorschlag und Leeren ausgewählt"; + const bool can_submit = available && summary.at("can_submit").get(); + out += ""; if (toto_dialog_.empty()) return out; - if(engine_mode_&&toto_dialog_=="settlement") {const auto &last=engine_toto_value_.at("last");std::string detail="

Letzte Toto-Abrechnung

SpalteTreffer
";size_t n=0;for(const auto &hit:last.at("hits"))detail+="
Spalte "+std::to_string(++n)+""+std::to_string(hit.get())+" Richtige
";return out+detail+"

Bezahlt "+esc(toto_cash(last.at("paid")))+" · Gewonnen "+esc(toto_cash(last.at("won")))+"

";} + const auto close = [&](const std::string &label) { return pg_button("toto-dialog-close", label, "primary", "id=\"toto-dialog-close\""); }; + const auto dialog = [&](const std::string &title, const std::string &body, const std::string &label, double width) { + return "

" + esc(title) + + "

" + body + "
"; + }; + const auto cell = [](const std::string &text, const std::string &css = std::string()) { return "" + text + ""; }; + if(engine_mode_&&toto_dialog_=="settlement") { + // what the last slip brought: the hits of every column, what was paid and what was won + const auto &last=engine_toto_value_.at("last"); + std::string rows="
"+cell("SPALTE","first")+cell("RICHTIGE")+"
";size_t n=0; + for(const auto &hit:last.at("hits"))rows+="
"+cell("Spalte "+std::to_string(++n),"first")+cell(""+std::to_string(hit.get())+" Richtige")+"
"; + return out+dialog("Letzte Toto-Abrechnung",rows+"
Bezahlt "+esc(toto_cash(last.at("paid")))+" · Gewonnen "+esc(toto_cash(last.at("won")))+"","Schließen",480); + } const auto &coupon = t.at("coupon"); if (coupon.is_null()) { toto_dialog_.clear(); return out; } std::vector active; for (int c = 0; c < 6; ++c) if (coupon.at("columns")[size_t(c)][0] != -1) active.push_back(c); - out += "
" - "

" + std::string(toto_dialog_ == "receipt" ? engine_mode_?"Aktuell vorgemerkter Schein":"Letzter vorgemerkter Schein" : "Tippschein vorgemerkt") + "

"; const auto caption = std::to_string(active.size()) + (active.size() == 1 ? " Spalte" : " Spalten"); - if (toto_dialog_ == "receipt") { - out += "
"; - for (int row = -1; row < 11; ++row) { - out += "
" + (row == -1 ? "Spiel" : std::to_string(row + 1)) + ""; - for (const auto c : active) out += "" + - (row == -1 ? "Spalte " + std::to_string(c + 1) : std::to_string(coupon.at("columns")[size_t(c)][size_t(row)].get())) + ""; - out += "
"; + const auto total = "
Gesamteinsatz" + esc(toto_cash(coupon.at("stake"))) + "
"; + if (toto_dialog_ != "receipt") + return out + dialog("Tippschein vorgemerkt", "

" + esc(caption + " · " + std::to_string(active.size() * 11) + " Tipps") + "

" + total, "Verstanden", 480); + // the slip that waits for the matchday: every match with the tip of each column + std::string rows = "
" + cell("SPIEL", "first"); + for (const auto c : active) rows += cell("SP. " + std::to_string(c + 1)); + rows += "
"; + for (int row = 0; row < 11; ++row) { + std::string match = std::to_string(row + 1) + "."; + if (size_t(row) < games.size()) { + const auto side = [&](const char *key, const char *reference) { + const auto &game = games[size_t(row)]; + if (game.value(reference, Json()).is_object()) return game.at(reference).at("name").get(); + const auto *club = world_->find("clubs", game.at(key)); + return club ? world_->name(*club) : std::string("—"); + }; + match += " " + side("home", "home_ref") + " – " + side("away", "away_ref"); } - out += "

" + caption + " · Einsatz gesamt " + esc(toto_cash(coupon.at("stake"))) + "

"; - } else out += "

" + caption + " · " + std::to_string(active.size() * 11) + " Tipps · Einsatz gesamt " + esc(toto_cash(coupon.at("stake"))) + "

"; - out += "
"; - return out; + rows += "
" + cell(esc(match), "first"); + for (const auto c : active) rows += cell("" + std::to_string(coupon.at("columns")[size_t(c)][size_t(row)].get()) + ""); + rows += "
"; + } + return out + dialog(engine_mode_?"Aktuell vorgemerkter Schein":"Letzter vorgemerkter Schein", rows + "" + total, "Schließen", 620); }