{% extends 'base.html' %}

{% block title %}Delete or Close Trade Offer{% endblock title %}

{% block content %}
<div class="container mx-auto max-w-md mt-6">
  <h2 class="text-2xl font-bold mb-4">
    {% if action == 'delete' %}
      Delete Trade Offer
    {% elif action == 'close' %}
      Close Trade Offer
    {% else %}
      Delete/Close Trade Offer
    {% endif %}
  </h2>

  <p>
    <strong>Status:</strong> {% if object.is_closed %}Closed{% else %}Open{% endif %}
  </p>

  <p class="mb-4">
    {% if action == 'delete' %}
      Are you sure you want to delete this trade offer? This will permanently remove the offer.
    {% elif action == 'close' %}
      Are you sure you want to close this trade offer? It will remain in the system as closed.
    {% else %}
      This trade offer cannot be deleted or closed because there are active acceptances.
    {% endif %}
  </p>

  <form method="post" class="space-x-4">
    {% csrf_token %}
    {% if action %}
      {% if action == 'delete' %}
        <button type="submit" class="btn btn-error">Confirm Delete</button>
      {% elif action == 'close' %}
        <button type="submit" class="btn btn-warning">Confirm Close Trade Offer</button>
      {% endif %}
    {% else %}
      <button type="submit" class="btn btn-error" disabled>Cannot Delete/Close Trade Offer</button>
    {% endif %}
    <a href="{% url 'trade_offer_list' %}" class="btn btn-secondary">Cancel</a>
  </form>
</div>
{% endblock content %} 