{% extends 'base.html' %} {% block content %}

Order #{{ order.id }}

{% include 'shop/partials/order_tracking.html' %}
Order Details

Status: {{ order.status }}

Placed on: {{ order.created_at|date:'d M Y, H:i' }}

Total: $ {{ order.total|floatformat:2 }}

Phone: {{ order.shipping_address.phone|default:order.phone|default:'—' }}

Shipping Address:
{{ order.shipping_address.full_address|linebreaksbr }}

{% if order.is_fraud %}
⚠️ Fraud Alert: This order has been flagged (Score: {{ order.fraud_score }}).
{% endif %}

Ordered Items

{% for item in items %} {% endfor %}
Product Qty Unit Price Subtotal
{{ item.product.name }} {{ item.quantity }} $ {{ item.price|floatformat:2 }} $ {{ total|floatformat:2 }}
{% if order.status in 'Pending Failed' %}
Payment Options
Pay Full Amount Now ($ {{ order.total|floatformat:2 }})
Or pay in installments: {% for key, plan in installment_plans.items %} {{ plan.name }} {{ plan.description }} {% endfor %}
{% endif %} {% comment %}
{% if order.can_cancel %}
{% csrf_token %}
{% endif %}
{% endcomment %}
Payment History
{% for log in payment_logs %} {% empty %} {% endfor %}
Date Status Amount
{{ log.created_at|date:'d M H:i' }} {{ log.status|title }} $ {{ log.amount|floatformat:2 }}
No payment records yet.
Installment Plan
{% for installment in installments %} {% endfor %}
Month Due Date Amount Status
{{ installment.month }} {{ installment.due_date|date:'d M Y' }} $ {{ installment.amount|floatformat:2 }} {% if installment.is_paid %} Paid {% else %} Pending {% endif %}
{{ compliance_percentage }}% Compliance
{% for installment in installments %}
{{ installment.month }}
Due: {{ installment.due_date|date:"d M Y" }}
$ {{ installment.amount|floatformat:2 }}
{% if installment.is_paid %} Paid {% else %} Pending {% endif %}
{% endfor %}
{% endblock %}