From 68b066a2d15b840bcb265f6e6922e821808b46a4 Mon Sep 17 00:00:00 2001 From: gerlofvanek Date: Thu, 28 Nov 2024 17:16:48 +0100 Subject: [PATCH] ui: Add modal for confirm send bid. --- basicswap/templates/offer.html | 172 ++++++++++++++++++++++++++++++++- basicswap/ui/page_offers.py | 19 +++- 2 files changed, 185 insertions(+), 6 deletions(-) diff --git a/basicswap/templates/offer.html b/basicswap/templates/offer.html index dafd3bc..130a556 100644 --- a/basicswap/templates/offer.html +++ b/basicswap/templates/offer.html @@ -306,7 +306,7 @@ -
+ {% if data.show_edit_form %}
@@ -469,6 +469,7 @@
+
@@ -485,6 +486,172 @@
+ + + + + {% else %}
@@ -530,6 +697,9 @@
{% endif %} + + + diff --git a/basicswap/ui/page_offers.py b/basicswap/ui/page_offers.py index f04a9d9..3d4620d 100644 --- a/basicswap/ui/page_offers.py +++ b/basicswap/ui/page_offers.py @@ -160,10 +160,16 @@ def parseOfferFormData(swap_client, form_data, page_data, options={}): (parsed_data["amt_from"] * parsed_data["rate"]) // ci_from.COIN() ) - page_data["amt_var"] = True if have_data_entry(form_data, "amt_var") else False - parsed_data["amt_var"] = page_data["amt_var"] - page_data["rate_var"] = True if have_data_entry(form_data, "rate_var") else False - parsed_data["rate_var"] = page_data["rate_var"] + if swap_client.debug: + page_data["amt_var"] = True if have_data_entry(form_data, "amt_var") else False + parsed_data["amt_var"] = page_data["amt_var"] + page_data["rate_var"] = True if have_data_entry(form_data, "rate_var") else False + parsed_data["rate_var"] = page_data["rate_var"] + else: + page_data["amt_var"] = True + page_data["rate_var"] = False + parsed_data["amt_var"] = True + parsed_data["rate_var"] = False page_data["automation_strat_id"] = int( get_data_entry_or(form_data, "automation_strat_id", -1) @@ -628,7 +634,7 @@ def page_offer(self, url_split, post_string): swap_client.editOffer(offer_id, change_data) elif b"newbid" in form_data: show_bid_form = True - elif b"sendbid" in form_data: + elif b"sendbid" in form_data and b"confirm" in form_data and b"formid" in form_data: try: addr_from = form_data[b"addr_from"][0].decode("utf-8") extend_data["nb_addr_from"] = addr_from @@ -672,6 +678,8 @@ def page_offer(self, url_split, post_string): self.server.swap_client.log.error(traceback.format_exc()) err_messages.append("Send bid failed: " + str(ex)) show_bid_form = True + elif b"sendbid" in form_data: + show_bid_form = True amount_to: int = offer.amount_to if amount_to is None: @@ -711,6 +719,7 @@ def page_offer(self, url_split, post_string): "active_ind": offer.active_ind, "swap_type": strSwapDesc(offer.swap_type), "reverse": reverse_bid, + "form_id": get_data_entry_or(form_data, "formid", "") if form_data else "" } data.update(extend_data)