Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Render green order fulfilled status

Anna Siwikb8238098eb58
diff --git a/saleor/core/templatetags/status.py b/saleor/core/templatetags/status.py
index 4e270aca9a..fe61e75693 100644
--- a/saleor/core/templatetags/status.py
+++ b/saleor/core/templatetags/status.py
@@ -3,6 +3,7 @@ import datetime
from django.template import Library
from payments import PaymentStatus
+from ...order import OrderStatus
from ...product import ProductAvailabilityStatus, VariantAvailabilityStatus
from ...product.utils import (
get_product_availability_status, get_variant_availability_status)
@@ -30,6 +31,15 @@ def render_status(status, status_display=None):
return {'label_cls': label_cls, 'status': status_display or status}
[email protected]_tag('status_label.html')
+def render_order_status(status, status_display=None):
+ if status == OrderStatus.FULFILLED:
+ label_cls = LABEL_SUCCESS
+ else:
+ label_cls = LABEL_DEFAULT
+ return {'label_cls': label_cls, 'status': status_display or status}
+
+
@register.inclusion_tag('status_label.html')
def render_availability_status(product):
status = get_product_availability_status(product)
diff --git a/templates/account/details.html b/templates/account/details.html
index 0a24baf0aa..1770c98504 100644
--- a/templates/account/details.html
+++ b/templates/account/details.html
@@ -78,7 +78,7 @@
<span class="float-right">{{ order.total.gross|amount:'html' }}</span>
</div>
<div class="col-md-4 d-none d-md-block">
- {% render_status order.status order.get_status_display %}
+ {% render_order_status order.status order.get_status_display %}
</div>
<div class="col-md-1 col-5">
<a href="{{ order.get_absolute_url }}" class="float-right link--styled">
diff --git a/templates/dashboard/customer/detail.html b/templates/dashboard/customer/detail.html
index 0a74cdf28b..6377d55714 100644
--- a/templates/dashboard/customer/detail.html
+++ b/templates/dashboard/customer/detail.html
@@ -107,7 +107,7 @@
{{ order.created }}
</td>
<td>
- {% render_status order.status order.get_status_display %}
+ {% render_order_status order.status order.get_status_display %}
</td>
<td class="right-align">
{{ order.total.gross|amount:'html' }}
diff --git a/templates/dashboard/index.html b/templates/dashboard/index.html
index 54c9ee226b..4f33467682 100644
--- a/templates/dashboard/index.html
+++ b/templates/dashboard/index.html
@@ -1,7 +1,7 @@
{% extends "dashboard/base.html" %}
{% load i18n %}
{% load prices_i18n %}
-{% load render_status from status %}
+{% load status %}
{% block title %}
{{ block.super }}
@@ -100,7 +100,7 @@
#{{ order.id }}
</td>
<td>
- {% render_status order.status order.get_status_display %}
+ {% render_order_status order.status order.get_status_display %}
</td>
{% trans "Guest" context "Anonymous user account value" as guest %}
<td>
diff --git a/templates/dashboard/order/detail.html b/templates/dashboard/order/detail.html
index 034c9177fa..413b5ba3e2 100644
--- a/templates/dashboard/order/detail.html
+++ b/templates/dashboard/order/detail.html
@@ -252,7 +252,7 @@
Order #{{ order }}
{% endblocktrans %}
</h5>
- {% render_status order.status order.get_status_display %}
+ {% render_order_status order.status order.get_status_display %}
</div>
<div class="data-table-container">
<table class="bordered highlight responsive data-table">
@@ -411,7 +411,7 @@
Fulfillment #{{ fulfillment }}
{% endblocktrans %}
</h5>
- {% render_status fulfillment.status fulfillment.get_status_display %}
+ {% render_order_status fulfillment.status fulfillment.get_status_display %}
</div>
<div class="data-table-container">
<table class="bordered highlight responsive data-table">
diff --git a/templates/dashboard/order/list.html b/templates/dashboard/order/list.html
index 8213d7d4f7..bf5c30500a 100644
--- a/templates/dashboard/order/list.html
+++ b/templates/dashboard/order/list.html
@@ -49,7 +49,7 @@
#{{ order.id }}
</td>
<td>
- {% render_status order.status order.get_status_display %}
+ {% render_order_status order.status order.get_status_display %}
</td>
{% trans "Guest" context "Anonymous user account value" as guest %}
<td>