// SPDX-License-Identifier: GPL-3.0-only
std::string App::render_balance() {
const auto rows = balance_rows();
if (!rows.value("ok", false)) throw editor::Error("Die Bilanzdaten sind ungültig.");
std::string out = "
";
if (balance_future_) {
out += "
Ausgabenplanung
";
int i = 0;
for (const auto &row : rows.at("plan")) {
const auto name = row.at("name").get
();
out += "" + esc(name) + "" +
btn("balance-plan", esc(number(row.at("amount").get() / (engine_mode_?100:finance_currency_factor(*world_)))),
"balance-plan-value amount-trigger", "id=\"balance-plan-" + std::to_string(i) +
"\" data-id=\"" + std::to_string(i) + "\" aria-label=\"" + esc(name + " in " + (engine_mode_?"Euro":money_unit() == "€" ? "Euro" : money_unit())) + "\" " + std::string(engine_mode_&&row.at("editable")!=true?"disabled":"")) + "
";
++i;
}
out += "Geplante Ausgaben" +
esc(balance_cash(rows.at("plan_total").get())) + "
";
} else {
int index = 0;
for (const auto &kind : {std::string("income"), std::string("costs")}) {
out += "
" + (kind == "income" ? "Einnahmen" : "Ausgaben") + "
"
"
PositionBetrag
";
int n = 0;
for (const auto &row : rows.at(kind)) {
out += "
" +
esc(row.at("name").get()) + "" + esc(balance_cash(row.at("amount").get())) + "
";
}
out += "
";
}
const std::array
values = {
number(rows.at("league_home_games").get()) + " Liga-Heimspiele",
number(rows.at("other_home_games").get()) + " sonstige Heimspiele",
"Zuschauerschnitt: " + number(rows.at("attendance_average").get()),
"Eintrittspreis: " + balance_cash(rows.at("ticket").get()),
"Kontostand: " + balance_cash(rows.at("cash").get()),
"Saldo: " + balance_cash(rows.at("balance").get())};
for (int i = 0; i < 6; ++i)
out += "()):std::string()) + "\" style=\"" +
rect(26 + (i % 2) * 1310, 1526 + (i / 2) * 68, 1250, 38) + "\">" + esc(values[size_t(i)]) + "
";
}
out += btn("balance-toggle", "" + std::string(balance_future_ ? "Zukunft" : "Aktuell") +
"", "balance-toggle report-reset",
"id=\"balance-toggle\" aria-label=\"Zwischen aktueller Bilanz und Zukunftsplanung wechseln\"");
return out + (engine_mode_?""+esc(engine_busy_?engine_operation_:engine_balance_feedback_)+"
":"") + " ";
}