The bank as five pages: bank, properties, stocks, passbook and fellow managers
The hall with its hot spots is gone; each service is a page of its own with a picture and its figures. The properties hang on an estate agent's board, and what the club owns carries a stamp. The page for dealings between managers appears only where more than one human plays. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
1 parent
e14b2f2374
commit
964a4ae35d
27 files changed
+407
-520
No files matched your search
@@ -98,10 +98,10 @@ bool App::engine_bank_action(const std::string &action, Rml::Element *target) {
|
||||
open_amount(std::move(request)); return true;
|
||||
}
|
||||
std::string App::engine_credit_view() {
|
||||
std::string out = "<div class=\"credit-portrait\">" + img("art.bank-adviser-v1.png", 620, 515, false, false, 1000) + "</div>";
|
||||
std::string out;
|
||||
Json data;
|
||||
try { data = engine_credit_projection(engine_data_, engine_credit_); }
|
||||
catch (const std::exception &) { return out + "<p class=\"bank-note\">Der Bankkredit ist in diesem Kontext nicht verfügbar.</p>"; }
|
||||
catch (const std::exception &) { return "<div class=\"pg-panel pg-grow\"><div class=\"pg-empty\"><span>Der Bankkredit ist in diesem Kontext nicht verfügbar.</span></div></div>"; }
|
||||
// the original's labels arrive in capitals: one capital per word reads calmer
|
||||
const auto calm = [](std::string text) {
|
||||
bool first = true;
|
||||
@@ -116,26 +116,28 @@ std::string App::engine_credit_view() {
|
||||
}
|
||||
return text;
|
||||
};
|
||||
out += "<div class=\"credit-facts engine-credit\">";
|
||||
// the loan as the bank states it: every figure a line; what may be changed is a button
|
||||
out += "<div class=\"pg-panel pg-col pg-grow\" style=\"" + pg_css("gap:4px;padding:12px 16px;") + "\">" + pg_kicker("Kredit");
|
||||
int64_t total = 0, paid = 0;
|
||||
for (size_t i = 0; i < 8; ++i) {
|
||||
const auto &f = data.at("fields")[i]; const auto value = f.at("value").get<int64_t>();
|
||||
if (i == 1) total = value;
|
||||
if (i == 5) paid = value;
|
||||
const auto text = i == 3 || i == 4 ? number(value) + " Monate" : money(value * 100, {{"code", "EUR"}, {"minor_units", 2}});
|
||||
out += "<div class=\"credit-fact\" style=\"top:" + std::to_string(i * 64) + "dp;\"><span>" + esc(calm(engine_text(f.at("label")))) + "</span><strong>";
|
||||
if (data.at("saved")[0] == 0 && f.at("editable") == true) out += btn("engine-credit-edit", esc(text), "bank-control", "id=\"engine-credit-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\"");
|
||||
else out += esc(text);
|
||||
out += "</strong></div>";
|
||||
out += "<div class=\"pg-kv bk-credit-line\"><span>" + esc(calm(engine_text(f.at("label")))) + "</span>";
|
||||
if (data.at("saved")[0] == 0 && f.at("editable") == true) out += pg_button("engine-credit-edit", esc(text), "bk-edit", "id=\"engine-credit-" + std::to_string(i) + "\" data-id=\"" + std::to_string(i) + "\"");
|
||||
else out += "<strong>" + esc(text) + "</strong>";
|
||||
out += "</div>";
|
||||
}
|
||||
out += "</div><figure class=\"credit-schedule engine-credit\"><div class=\"credit-schedule-caption\"><h3>Kreditvorschau</h3></div><div class=\"stock-tiles credit-tiles\">";
|
||||
out += "<div class=\"bk-tiles\" style=\"margin-top:" + pg(8) + ";\">";
|
||||
for (const auto &[label, key] : std::array<std::pair<const char *, const char *>, 3>{{{"Gebühren", "fees"}, {"Erstattung", "refund"}, {"Bereits getilgt", "principalPaid"}}})
|
||||
out += "<div class=\"stock-tile\"><strong>" + esc(engine_price(data.at(key))) + "</strong><span>" + label + "</span></div>";
|
||||
out += "<div class=\"bk-tile\"><strong>" + esc(engine_price(data.at(key))) + "</strong><span>" + label + "</span></div>";
|
||||
// how much of the whole sum is paid back
|
||||
const double done = total > 0 ? std::clamp(double(paid) * 100.0 / double(total), 0.0, 100.0) : 0;
|
||||
out += "</div><div class=\"credit-progress\"><div class=\"credit-progress-label\"><span>Zurückgezahlt</span><strong>" + (total > 0 ? std::to_string(int(std::lround(done))) + " %" : std::string("kein Kredit")) +
|
||||
"</strong></div><div class=\"bank-part-track\"><div style=\"width:" + scalar(done) + "%;\"></div></div></div>";
|
||||
out += "<p class=\"credit-schedule-note\">" + std::string(data.at("saved")[0] == 0 ? "Die Bank berechnet Laufzeit, Raten und Gebühren. Gebucht wird erst nach deiner Bestätigung." : "Laufender Kredit · Änderungen folgen mit vollständiger Gebührenvorschau.") + "</p></figure>";
|
||||
out += "<nav class=\"bank-actions\">" + btn("engine-credit-reset", "Zurücksetzen", "bank-control", "id=\"engine-credit-reset\"") + btn("engine-credit-apply", "Verbindlich buchen", "bank-control", "id=\"engine-credit-apply\" " + std::string(engine_credit_edits_.empty() ? "disabled" : "")) + "</nav>";
|
||||
out += "</div><div class=\"bk-part\"><div class=\"pg-row\" style=\"justify-content:space-between;\"><span>Zurückgezahlt</span><strong>" + (total > 0 ? std::to_string(int(std::lround(done))) + " %" : std::string("kein Kredit")) +
|
||||
"</strong></div>" + pg_bar(done, "sage") + "</div><span class=\"pg-sp\"></span><span class=\"pg-mut\" style=\"display:block;\">" +
|
||||
std::string(data.at("saved")[0] == 0 ? "Die Bank berechnet Laufzeit, Raten und Gebühren. Gebucht wird erst nach deiner Bestätigung." : "Laufender Kredit · Änderungen folgen mit vollständiger Gebührenvorschau.") + "</span></div>";
|
||||
out += "<div class=\"pg-row\" style=\"" + pg_css("gap:8px;") + "\">" + pg_button("engine-credit-reset", "Zurücksetzen", "block", "id=\"engine-credit-reset\"") +
|
||||
pg_button("engine-credit-apply", "Verbindlich buchen", "primary block", "id=\"engine-credit-apply\" " + std::string(engine_credit_edits_.empty() ? "disabled=\"disabled\"" : "")) + "</div>";
|
||||
return out;
|
||||
}
|
||||
Reference in new issue
Block a user