Fix create trade offer flow and other related bugs
This commit is contained in:
parent
f3a1366269
commit
65ca344582
40 changed files with 867 additions and 278 deletions
|
|
@ -1,5 +1,5 @@
|
|||
{% load trade_offer_tags %}
|
||||
{% if offered_cards or wanted_cards %}
|
||||
{% if have_cards or want_cards %}
|
||||
<hr class="my-8 border-t border-base-300">
|
||||
<h2 class="text-2xl font-bold mb-4">Results</h2>
|
||||
{% if search_results %}
|
||||
|
|
|
|||
28
theme/templates/trades/trade_offer_confirm_create.html
Normal file
28
theme/templates/trades/trade_offer_confirm_create.html
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load static card_badge trade_offer_tags %}
|
||||
|
||||
{% block title %}Confirm Trade Offer{% endblock title %}
|
||||
|
||||
{% block content %}
|
||||
<div class="container mx-auto max-w-xl mt-6">
|
||||
<h2 class="text-2xl font-bold mb-4">Confirm Trade Offer</h2>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{# Re-create hidden inputs from POST data, except the preview button #}
|
||||
{% for key, values in post_data.lists %}
|
||||
{% for value in values %}
|
||||
{% if key != "preview" %}
|
||||
<input type="hidden" name="{{ key }}" value="{{ value }}">
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
|
||||
{% render_trade_offer dummy_trade_offer False False True %}
|
||||
|
||||
<div class="flex justify-between mt-4">
|
||||
<button type="submit" name="edit" class="btn btn-secondary">Edit</button>
|
||||
<button type="submit" name="confirm" class="btn btn-primary">Confirm Trade Offer</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
{% endblock content %}
|
||||
|
|
@ -6,7 +6,7 @@
|
|||
{% block content %}
|
||||
<div class="container mx-auto max-w-xl mt-6">
|
||||
<h2 class="text-2xl font-bold mb-4">Create a Trade Offer</h2>
|
||||
<form method="post" novalidate class="space-y-4">
|
||||
<form method="post" action="{% url 'trade_offer_confirm_create' %}" novalidate class="space-y-4">
|
||||
{% csrf_token %}
|
||||
|
||||
{% include "trades/_friend_code_select.html" with friend_codes=friend_codes selected_friend_code=selected_friend_code field_name=form.initiated_by.html_name label="Initiated by" %}
|
||||
|
|
@ -14,14 +14,18 @@
|
|||
<!-- Card Selectors: "Have" and "Want" -->
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div class="form-control">
|
||||
{% card_multiselect "have_cards" "I Have:" "Select some cards..." cards form.initial.have_cards %}
|
||||
{% with have_values=form.have_cards.value|default:form.initial.have_cards %}
|
||||
{% card_multiselect "have_cards" "I Have:" "Select some cards..." cards have_values %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
<div class="form-control">
|
||||
{% card_multiselect "want_cards" "I Want:" "Select some cards..." cards form.initial.want_cards %}
|
||||
{% with want_values=form.want_cards.value|default:form.initial.want_cards %}
|
||||
{% card_multiselect "want_cards" "I Want:" "Select some cards..." cards want_values %}
|
||||
{% endwith %}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn btn-primary w-full">Create Offer</button>
|
||||
<button type="submit" name="preview" class="btn btn-primary w-full">Preview Trade Offer</button>
|
||||
</form>
|
||||
{% if form.errors %}
|
||||
<div class="alert alert-error mt-4">
|
||||
|
|
|
|||
|
|
@ -8,9 +8,9 @@
|
|||
<h2 class="text-2xl font-bold">Trade Offer Details</h2>
|
||||
<div class="flex justify-center mt-10">
|
||||
{% if screenshot_mode == "true" %}
|
||||
{% render_trade_offer object True %}
|
||||
{% render_trade_offer object True show_friend_code %}
|
||||
{% else %}
|
||||
{% render_trade_offer object %}
|
||||
{% render_trade_offer object False False True %}
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if acceptance_form %}
|
||||
|
|
@ -55,7 +55,7 @@
|
|||
{% if is_initiator %}
|
||||
<a href="{{ delete_close_url }}" class="btn btn-danger">Delete/Close Trade Offer</a>
|
||||
{% elif request.user.is_authenticated %}
|
||||
<button type="submit" class="btn btn-primary">Submit Acceptance</button>
|
||||
<button type="submit" class="btn btn-primary">Accept Offer</button>
|
||||
{% endif %}
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -10,21 +10,21 @@
|
|||
{% csrf_token %}
|
||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-4">
|
||||
<div>
|
||||
{% card_multiselect "offered_cards" "Have:" "Select zero or more cards..." cards offered_cards %}
|
||||
{% card_multiselect "have_cards" "I Have:" "Select zero or more cards..." cards have_cards %}
|
||||
</div>
|
||||
<div>
|
||||
{% card_multiselect "wanted_cards" "Want:" "Select zero or more cards..." cards wanted_cards %}
|
||||
{% card_multiselect "want_cards" "I Want:" "Select zero or more cards..." cards want_cards %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex flex-col md:flex-row gap-4">
|
||||
<button type="submit" class="btn btn-primary flex-1">Find a Trade Offer</button>
|
||||
<button type="submit" class="btn btn-primary">Find a Trade Offer</button>
|
||||
</div>
|
||||
</form>
|
||||
</section>
|
||||
|
||||
<!-- Search Results Section -->
|
||||
<section id="search-results" class="mb-8">
|
||||
{% include "trades/_search_results.html" %}
|
||||
{% include "trades/_search_results.html" with search_results=search_results %}
|
||||
</section>
|
||||
{% endblock content %}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue