100 lines
No EOL
3.1 KiB
HTML
100 lines
No EOL
3.1 KiB
HTML
{% extends '_base.html' %}
|
|
{% load static %}
|
|
|
|
{% block title %}Trade Offer Details & Update{% endblock title %}
|
|
|
|
{% block content %}
|
|
<div class="container my-4">
|
|
<h2 class="mb-4">Trade Offer Details</h2>
|
|
|
|
<!-- Offer Details Card -->
|
|
<div class="card mb-4">
|
|
<div class="card-header">
|
|
Offer Information
|
|
</div>
|
|
<div class="card-body">
|
|
<p>
|
|
<strong>Created At:</strong> {{ object.created_at|date:"M d, Y H:i" }}<br>
|
|
<strong>Updated At:</strong> {{ object.updated_at|date:"M d, Y H:i" }}<br>
|
|
|
|
{% comment %}
|
|
Only display these fields if the current user is associated with the initiating friend code
|
|
or (if available) with the accepted friend code.
|
|
{% endcomment %}
|
|
{% if object.initiated_by.user == request.user or object.accepted_by and object.accepted_by.user == request.user %}
|
|
<strong>Initiated By:</strong> {{ object.initiated_by }}<br>
|
|
<strong>Accepted By:</strong>
|
|
{% if object.accepted_by %}
|
|
{{ object.accepted_by }}
|
|
{% else %}
|
|
Not yet accepted
|
|
{% endif %}<br>
|
|
{% endif %}
|
|
|
|
<strong>Cards You Have:</strong>
|
|
{% for card in object.have_cards.all %}
|
|
{{ card.name }}{% if not forloop.last %}, {% endif %}
|
|
{% endfor %}<br>
|
|
<strong>Cards You Want:</strong>
|
|
{% for card in object.want_cards.all %}
|
|
{{ card.name }}{% if not forloop.last %}, {% endif %}
|
|
{% endfor %}<br>
|
|
<strong>Current State:</strong> {{ object.get_state_display }}
|
|
</p>
|
|
</div>
|
|
</div>
|
|
|
|
{% if form.fields %}
|
|
<!-- Form Card -->
|
|
<div class="card mb-4">
|
|
<div class="card-header">
|
|
{% if action == "accept" %}
|
|
Accept Trade Offer
|
|
{% else %}
|
|
Update Trade Offer
|
|
{% endif %}
|
|
</div>
|
|
<div class="card-body">
|
|
<form method="post" novalidate>
|
|
{% csrf_token %}
|
|
{{ form.as_p }}
|
|
<button type="submit" class="btn {% if action == 'accept' %}btn-success{% else %}btn-primary{% endif %}">
|
|
{% if action == "accept" %}
|
|
Accept Trade Offer
|
|
{% else %}
|
|
Submit
|
|
{% endif %}
|
|
</button>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<div class="alert alert-info">
|
|
You are not authorized to perform any status changes on this trade offer.
|
|
</div>
|
|
{% endif %}
|
|
|
|
{% if form and form.errors %}
|
|
<div class="alert alert-danger mt-3">
|
|
<strong>Please correct the errors below:</strong>
|
|
<ul class="mb-0">
|
|
{% for field in form %}
|
|
{% for error in field.errors %}
|
|
<li>{{ error }}</li>
|
|
{% endfor %}
|
|
{% endfor %}
|
|
{% for error in form.non_field_errors %}
|
|
<li>{{ error }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
</div>
|
|
{% endif %}
|
|
|
|
<div class="mt-3">
|
|
<a href="{% url 'trade_offer_list' %}" class="btn btn-secondary">Back to Trade Offers</a>
|
|
{% if can_delete %}
|
|
<a href="{% url 'trade_offer_delete' object.pk %}" class="btn btn-danger ms-2">Delete Trade Offer</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
{% endblock content %} |