{% extends 'auth/dashboard.html' %} {% load static %} {% block content %}
My Orders / {{ order.order_number }}

Order {{ order.order_number }}

Placed on {{ order.created_at|date:"N j, Y" }} at {{ order.created_at|date:"g:i A" }}

{% for s in status_steps %}{% if s.code == order.status %}{{ s.label }}{% endif %}{% endfor %} {% if not order.status in "FULFILLED CANCELLED SHIPPED PROCESSING ORDER_RECEIVED PLACED" %}{{ order.status }}{% endif %} {{ order.get_payment_status_display|default:order.payment_status }}
{% if messages %}
{% for message in messages %}
{{ message }}
{% endfor %}
{% endif %} {% if status_steps %}

Order Progress

{% for step in status_steps %}
{% if step.done %} {% else %} {{ forloop.counter }} {% endif %}
{{ step.label }}
{% endfor %}
{% endif %}

Items Ordered

{% for item in order.items.all %}
{% if item.package and item.package.display_image %} {{ item.package_name_snapshot }} {% else %}
{% endif %}

{{ item.package_name_snapshot }}

{% if item.variety_name_snapshot %}

{{ item.variety_name_snapshot }}

{% endif %}

{{ item.unit_label_snapshot }} {% if item.manufacturer_name_snapshot %} - {{ item.manufacturer_name_snapshot }}{% endif %}

{{ item.quantity }} x KES {{ item.unit_price_snapshot|floatformat:0 }}

KES {{ item.line_total|floatformat:0 }}

{% empty %}

No items found.

{% endfor %}
{% if order.discount_amount %}
Subtotal KES {{ order.subtotal_amount|floatformat:0 }}
Discount - KES {{ order.discount_amount|floatformat:0 }}
{% endif %} {% if order.pickup_fee %}
Pickup Fee KES {{ order.pickup_fee|floatformat:0 }}
{% endif %}
Total KES {{ order.total_amount|floatformat:0 }}
{{ order_balance_due|default:0|floatformat:0|stringformat:"s" }} {% if order_balance_due <= 0 %}Fully Paid{% else %}Balance Due{% endif %} {% if order_balance_due <= 0 %} Paid in Full {% else %} KES {{ order_balance_due|floatformat:0 }} {% endif %}

Delivery Information

Location

{{ order.delivery_location|default:"-" }}

{% if order.pickup_station %}

Pickup Station

{{ order.pickup_station.name }}{% if order.pickup_station.location %} - {{ order.pickup_station.location }}{% endif %}

{% endif %}

Contact Name

{{ order.delivery_contact_name|default:"-" }}

Phone

{{ order.phone_number|default:"-" }}

{% if order.assigned_field_officer %}

Field Officer

{{ order.assigned_field_officer.get_full_name }}

{% endif %} {% if order.delivery_notes %}

Delivery Notes

{{ order.delivery_notes }}

{% endif %}
{% if order.admin_notes %}

Admin Notes

{{ order.admin_notes }}

{% endif %} {% if order_status_history_entries %}

Status History

{% for entry in order_status_history_entries %}
{{ entry.get_status_display|default:entry.status }} {{ entry.created_at|date:"N j, Y g:i A" }}
{% if entry.changed_by %}

by {{ entry.changed_by.get_full_name }}

{% endif %} {% if entry.note %}

"{{ entry.note }}"

{% endif %}
{% endfor %}
{% endif %}

Payment Summary

{% if order_payment_entries %}
{% for payment in order_payment_entries %}
KES {{ payment.amount|floatformat:0 }} {{ payment.status }}

{{ payment.get_method_display }} {% if payment.reference %} - {{ payment.reference }}{% endif %} {% if payment.mpesa_receipt_number %} - {{ payment.mpesa_receipt_number }}{% endif %}

{{ payment.created_at|date:"N j, Y g:i A" }}

{% endfor %}
{% else %}

No payments recorded yet.

{% endif %}
Order Total KES {{ order.total_amount|floatformat:0 }}
Amount Paid KES {{ order.amount_paid|floatformat:0 }}
{% if order_balance_due > 0 %}
Balance Due KES {{ order_balance_due|floatformat:0 }}
{% else %}
Status Fully Paid
{% endif %}
{% if can_process_order %} {% if can_manage_order_status and admin_next_status_choices %}

Update Order Status

{% csrf_token %}
{% endif %} {% if can_assign_order_officer and field_officers %}

Assign Field Officer

{% csrf_token %}
{% endif %} {% if can_record_order_payment %}

Record Payment

{% csrf_token %}
0 %}value="{{ order_balance_due }}"{% endif %} required>
{% endif %} {% endif %}
{% endblock %}