";
+ if (page_ == "review") {
+ body += "
" + escaped(str(selected_, "reason", str(selected_, "field"))) +
+ "
" + button("resolve", t("resolve"), "primary") + "
" +
+ escaped(selected_.dump(2)) + "
";
+ } else {
+ name_field(body);
+ if (table() == "nations") {
+ field(body, "/confederation", t("confederation"));
+ field(body, "/playable", t("playable"), "bool");
+ } else if (table() == "competitions") {
+ field(body, "/nation", t("nation"), "select", "nations");
+ field(body, "/type", t("type"));
+ field(body, "/tier", t("tier"), "integer");
+ field(body, "/visible", t("visible"), "bool");
+ field(body, "/trophy", t("trophy"));
+ } else if (table() == "clubs") {
+ field(body, "/short_name", t("short_name"));
+ field(body, "/nation", t("nation"), "select", "nations");
+ field(body, "/competition", t("competition"), "select", "competitions");
+ field(body, "/stadium", t("stadium"), "select", "stadiums");
+ field(body, "/founded", t("founded"), "integer");
+ field(body, "/colors", t("colors"), "json");
+ } else if (table() == "players") {
+ field(body, "/born", t("born"));
+ if (selected_.contains("age_at_start"))
+ field(body, "/age_at_start", t("age_at_start"),
+ selected_["age_at_start"].is_object() ? "json" : "integer");
+ field(body, "/nationalities", t("nationalities"), "json");
+ field(body, "/positions", t("positions"), "json");
+ field(body, "/team", t("team"), "select", "clubs");
+ field(body, "/squad_number", t("squad_number"), "integer");
+ if (page_ == "roster") {
+ body += "
" + button("remember", t("remember_player")) + "
";
+ if (!remembered_.empty() && remembered_ != selected_id_)
+ body += button("swap", t("swap_player"));
+ body +=
+ "
" + button("order-up", "↑") + button("order-down", "↓") + "
";
+ }
+ body += "
" + escaped(t("attributes")) + " · " +
+ escaped(str(selected_, "attribute_set")) + "
";
+ auto attributes = selected_.value("attributes", Json::object());
+ Json definitions = Json::object();
+ for (const auto &rule : session_.execute("rules")) {
+ auto id = str(rule, "attribute_set", str(rule, "id"));
+ if (id == str(selected_, "attribute_set") || id == "rule:" + str(selected_, "attribute_set"))
+ definitions = rule.value("fields", Json::object());
+ }
+ for (auto it = attributes.begin(); it != attributes.end(); ++it) {
+ auto range = definitions.value(it.key(), Json::object());
+ const auto bounds = range.contains("min") && range.contains("max")
+ ? " (" + range["min"].dump() + "–" + range["max"].dump() + ")"
+ : "";
+ field(body, "/attributes/" + it.key(), t(it.key()) + bounds, "integer");
+ }
+ if (attributes.empty())
+ body += "
" + escaped(t("unrated_hint")) + "
";
+ field(body, "/attribute_set", t("attribute_set"));
+ if (attributes.empty() || show_source_)
+ field(body, "/attributes", t("attributes"), "json");
+ } else if (table() == "stadiums") {
+ field(body, "/owner", t("owner"), "select", "clubs");
+ for (auto key : {"total", "seated", "standing", "boxes"})
+ field(body, "/capacity/" + std::string(key), t(key), "integer");
+ field(body, "/facilities", t("facilities"), "json");
+ } else if (table() == "staff") {
+ field(body, "/nation", t("nation"), "select", "nations");
+ field(body, "/role", t("role"));
+ field(body, "/attributes", t("attributes"), "json");
+ } else if (table() == "assets") {
+ field(body, "/source", t("source"));
+ field(body, "/author", t("author"));
+ field(body, "/license", t("license"));
+ body += "
" +
+ escaped(selected_.value("width", Json()).dump() + " × " +
+ selected_.value("height", Json()).dump()) +
+ "
";
+ }
+ if (table() == "players" || table() == "clubs" || table() == "competitions" || table() == "assets") {
+ body += "
" + escaped(t("assets")) + "
" +
+ button("image-import", t("image_import")) + button("image-edit", t("image_edit")) + "
" +
+ button("image-export", t("image_export"), "quiet");
+ }
+ body += "
" + button("toggle-source", t("provenance"), "quiet") + "
";
+ if (show_source_)
+ body += "
" + escaped(selected_.dump(2)) + "
";
+ }
+ body += "
" + button("delete", t("delete"), "danger") +
+ button("apply", t("apply"), "primary") + "