diff --git a/scipost_django/common/templates/icons/reception.html b/scipost_django/common/templates/icons/reception.html new file mode 100644 index 0000000000000000000000000000000000000000..c601353cbabd307a6d8d71b2aec43042283775c0 --- /dev/null +++ b/scipost_django/common/templates/icons/reception.html @@ -0,0 +1,17 @@ +{% load common_extras %} + +{% with strength=value|multiply:5|int_divide:max %} + + {% if strength == 0 %} + <span title="{{ value }}" class="text-secondary">{% include "bi/reception-0.html" %}</span> + {% elif strength == 1 %} + <span title="{{ value }}" class="text-success">{% include "bi/reception-1.html" %}</span> + {% elif strength == 2 %} + <span title="{{ value }}" class="text-primary">{% include "bi/reception-2.html" %}</span> + {% elif strength == 3 %} + <span title="{{ value }}" class="text-warning">{% include "bi/reception-3.html" %}</span> + {% elif strength >= 4 %} + <span title="{{ value }}" class="text-danger">{% include "bi/reception-4.html" %}</span> + {% endif %} + +{% endwith %} diff --git a/scipost_django/common/templatetags/common_extras.py b/scipost_django/common/templatetags/common_extras.py index f8707d14750e65103b8083c22b49a9a5bd9e456a..f01460feed21957a663df42e7f7cdda1604f4d2b 100644 --- a/scipost_django/common/templatetags/common_extras.py +++ b/scipost_django/common/templatetags/common_extras.py @@ -31,3 +31,14 @@ def rstrip_minutes(text): if "day" in text or "hour" in text: return re.split("[0-9]+\xa0minutes", text, 1)[0].rstrip(", ") return text + + +# Math +@register.filter +def int_divide(a, b): + return a // b + + +@register.filter +def multiply(a, b): + return a * b diff --git a/scipost_django/templates/bi/reception-0.html b/scipost_django/templates/bi/reception-0.html new file mode 100644 index 0000000000000000000000000000000000000000..f2d813aaeb182034bae15f821ce27727bba3e7cf --- /dev/null +++ b/scipost_django/templates/bi/reception-0.html @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg" + width="16" + height="16" + fill="currentColor" + class="bi bi-reception-0" + viewBox="0 0 16 16"> + <path d="M0 13.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5zm4 0a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5zm4 0a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5zm4 0a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5z" /> +</svg> diff --git a/scipost_django/templates/bi/reception-1.html b/scipost_django/templates/bi/reception-1.html new file mode 100644 index 0000000000000000000000000000000000000000..6792e973e24b13f39d811179194f11c62f90a34c --- /dev/null +++ b/scipost_django/templates/bi/reception-1.html @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg" + width="16" + height="16" + fill="currentColor" + class="bi bi-reception-1" + viewBox="0 0 16 16"> + <path d="M0 11.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-2zm4 2a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5zm4 0a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5zm4 0a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5z" /> +</svg> diff --git a/scipost_django/templates/bi/reception-2.html b/scipost_django/templates/bi/reception-2.html new file mode 100644 index 0000000000000000000000000000000000000000..77cc2b0cd6da504d57ec65239aac7f16a60d48e8 --- /dev/null +++ b/scipost_django/templates/bi/reception-2.html @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg" + width="16" + height="16" + fill="currentColor" + class="bi bi-reception-2" + viewBox="0 0 16 16"> + <path d="M0 11.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-2zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-5zm4 5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5zm4 0a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5z" /> +</svg> diff --git a/scipost_django/templates/bi/reception-3.html b/scipost_django/templates/bi/reception-3.html new file mode 100644 index 0000000000000000000000000000000000000000..438b39519f26995e63cd7ecd2ad213b8c206c301 --- /dev/null +++ b/scipost_django/templates/bi/reception-3.html @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg" + width="16" + height="16" + fill="currentColor" + class="bi bi-reception-3" + viewBox="0 0 16 16"> + <path d="M0 11.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-2zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-5zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-8zm4 8a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5z" /> +</svg> diff --git a/scipost_django/templates/bi/reception-4.html b/scipost_django/templates/bi/reception-4.html new file mode 100644 index 0000000000000000000000000000000000000000..c6066d2d90a1fcaa9e2d0f5aabff17b29374b0d1 --- /dev/null +++ b/scipost_django/templates/bi/reception-4.html @@ -0,0 +1,8 @@ +<svg xmlns="http://www.w3.org/2000/svg" + width="16" + height="16" + fill="currentColor" + class="bi bi-reception-4" + viewBox="0 0 16 16"> + <path d="M0 11.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-2zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v5a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-5zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v8a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-8zm4-3a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-.5.5h-2a.5.5 0 0 1-.5-.5v-11z" /> +</svg>