A bid on a listed player can be taken back

transfer.submit {action: withdrawBid, listingId} removes the manager's bid
before the seller decides. The orders list of the transfer market does it
with its delete button.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Fable 5.2 committed 2026-11-17 14:13:33 +01:00
1 parent 1ec8295c84
commit 83bd96c1ff
9 files changed
+77 -4

No files matched your search

+3 -1
View File
@@ -172,7 +172,9 @@ Json engine_transfer_command(const Json &b, const Json &draft,
const auto kind = draft.at("kind").get<std::string>(),
player = draft.at("player").get<std::string>();
Json payload;
if (kind == "withdraw") {
if (kind == "withdrawBid") {
payload = {{"action", "withdrawBid"}, {"listingId", draft.at("listing")}};
} else if (kind == "withdraw") {
const auto it =
std::find_if(d.at("squad").begin(), d.at("squad").end(),
[&](const auto &p) { return p.at("playerId") == player; });
+11
View File
@@ -469,6 +469,17 @@ bool App::engine_transfer_action(const std::string &action,
close_transfer();
return true;
}
if (action == "transfer-order-delete" && target) {
// an order of the list is the manager's bid on a listed player: it can be taken back
const int index = target->GetAttribute<int>("data-index", -1);
const auto &orders = engine_transfer_value_.at("orders");
if (index < 0 || size_t(index) >= orders.size()) return true;
const Json draft = {{"kind", "withdrawBid"}, {"player", orders[size_t(index)].at("player")}, {"listing", orders[size_t(index)].at("listing")}};
transfer_dialog_.clear(); // the question lies under the list otherwise
confirmation("Das Gebot für " + orders[size_t(index)].at("name").get<std::string>() + " zurückziehen?", [send, draft] { send(draft); });
popup_accept_ = "Zurückziehen";
return true;
}
if (action == "transfer-orders") {
transfer_dialog_ = "orders";
transfer_return_focus_ = target->GetId();
+1 -2
View File
@@ -552,8 +552,7 @@ std::string App::render_transfer_dialog() {
const auto &o = rows[i];
body += "<div class=\"pg-tr\">" + pg_td("<strong>" + esc(o.at("name").get<std::string>()) + "</strong>", 0) + pg_td(esc(engine_mode_ ? "Gebot" : o.at("poached") == true ? "Abwerben" : kinds.at(o.at("kind"))), 110) +
pg_td(esc(transfer_money(o.at("fee").get<int64_t>())), 170, "r") + pg_td(std::to_string(o.at("months").get<int>()) + " Monate", 120, "r") +
pg_td(btn("transfer-order-delete", "×", "pg-btn round tm-small", "id=\"transfer-order-delete-" + std::to_string(i) + "\" data-index=\"" + std::to_string(i) + "\" aria-label=\"Auftrag zurücknehmen\" " +
std::string(engine_mode_ ? "disabled title=\"Noch nicht angebunden\"" : "")), 60, "r", true) + "</div>";
pg_td(btn("transfer-order-delete", "×", "pg-btn round tm-small", "id=\"transfer-order-delete-" + std::to_string(i) + "\" data-index=\"" + std::to_string(i) + "\" aria-label=\"Auftrag zurücknehmen\""), 60, "r", true) + "</div>";
}
body += "</div></div></div>";
}