From 0bf982e7f8a872862bd1abf96130b5d0ce2555d5 Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Mon, 20 Mar 2023 13:56:31 -0600 Subject: [PATCH 1/3] Add coupon info to order detail --- dashboard/templates/dashboard/order/detail.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dashboard/templates/dashboard/order/detail.html b/dashboard/templates/dashboard/order/detail.html index acfe5eb..ff9cecd 100644 --- a/dashboard/templates/dashboard/order/detail.html +++ b/dashboard/templates/dashboard/order/detail.html @@ -109,7 +109,7 @@ {% if order.coupon_amount > 0 %} - Discount: + Discount {% if order.coupon %}{{ order.coupon }} ↗{% endif %}: ${{ order.coupon_amount }} {% endif %} From ed3c93418c353340d845114db7c734c2b59954d5 Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Mon, 20 Mar 2023 13:57:02 -0600 Subject: [PATCH 2/3] Add shipment status to order list --- core/__init__.py | 12 ++++++++++++ core/models.py | 10 ++++++++++ dashboard/templates/dashboard/order/_table.html | 14 +++++++++++++- 3 files changed, 35 insertions(+), 1 deletion(-) diff --git a/core/__init__.py b/core/__init__.py index efb4c27..2cd15a8 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -49,6 +49,18 @@ class OrderStatus: ] +class ShippingStatus: + NOT_SHIPPED = 'Not shipped' + PARTIALLY_SHIPPED = 'Partially shipped' + SHIPPED = 'Shipped' + + CHOICES = [ + (NOT_SHIPPED, 'Not shipped'), + (PARTIALLY_SHIPPED, 'Partially shipped'), + (SHIPPED, 'Shipped'), + ] + + class TransactionStatus: # The order was created with the specified context. CREATED = 'CREATED' diff --git a/core/models.py b/core/models.py index 7519732..4235d53 100644 --- a/core/models.py +++ b/core/models.py @@ -24,6 +24,7 @@ from . import ( VoucherType, TransactionStatus, OrderStatus, + ShippingStatus, ShippingProvider, ShippingContainer ) @@ -397,6 +398,15 @@ class Order(models.Model): objects = OrderManager() + def get_shipping_status(self): + has_tracking = self.tracking_numbers.count() > 0 + if has_tracking and self.status == OrderStatus.FULFILLED: + return ShippingStatus.SHIPPED + elif has_tracking and self.status == OrderStatus.PARTIALLY_FULFILLED: + return ShippingStatus.PARTIALLY_SHIPPED + + return ShippingStatus.NOT_SHIPPED + def minus_stock(self): for line in self.lines.all(): line.minus_stock() diff --git a/dashboard/templates/dashboard/order/_table.html b/dashboard/templates/dashboard/order/_table.html index 2cb5272..4a830bf 100644 --- a/dashboard/templates/dashboard/order/_table.html +++ b/dashboard/templates/dashboard/order/_table.html @@ -3,7 +3,8 @@ Order No. Date Customer - Status + Fulfillment + Shipping Total @@ -18,6 +19,17 @@ {{order.get_status_display}} + +
+ {% if order.get_shipping_status == "Shipped" %} + {{ order.get_shipping_status }} + {% elif order.get_shipping_status == "Partially shipped" %} + {{ order.get_shipping_status }} + {% else %} + {{ order.get_shipping_status }} + {% endif %} +
+ ${{order.total_amount}} {% endfor %} From 8145380a9a76b952db7c7119a7c3d362d1241dc1 Mon Sep 17 00:00:00 2001 From: Nathan Chapman Date: Mon, 20 Mar 2023 13:57:33 -0600 Subject: [PATCH 3/3] Update copy --- templates/base.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/base.html b/templates/base.html index 4d1fafa..67540bb 100644 --- a/templates/base.html +++ b/templates/base.html @@ -54,7 +54,7 @@ {% for category in category_list %}
  • {{ category }}
  • {% endfor %} -
  • Subscriptions
  • +
  • Subscribe
  • Fair trade
  • Reviews
  • About