From 9bc686b76f6af18b70fdcab3fa10d3e413a52354 Mon Sep 17 00:00:00 2001
From: Oliver
Date: Thu, 10 Mar 2022 12:44:57 +1100
Subject: [PATCH] Refactor "delete stock location" dialog
- Simplify dialog
- Make text translatable
---
.../templates/stock/location_delete.html | 49 ++++++++-----------
1 file changed, 20 insertions(+), 29 deletions(-)
diff --git a/InvenTree/stock/templates/stock/location_delete.html b/InvenTree/stock/templates/stock/location_delete.html
index 9c560e58c5..c86ab4bc05 100644
--- a/InvenTree/stock/templates/stock/location_delete.html
+++ b/InvenTree/stock/templates/stock/location_delete.html
@@ -4,40 +4,31 @@
{% load inventree_extras %}
{% block pre_form_content %}
-{% trans "Are you sure you want to delete this stock location?" %}
-
-
-
+
+ {% trans "Are you sure you want to delete this stock location?" %}
+
+
{% if location.children.all|length > 0 %}
-This location contains {{ location.children.all|length }} child locations.
-If this location is deleted, these child locations will be moved to
-{% if location.parent %}
-the '{{ location.parent.name }}' location.
-{% else %}
-the top level 'Stock' location.
+
+ {% blocktrans with n=location.children.all|length %}This location contains {{ n }} child locations{% endblocktrans %}.
+ {% if location.parent %}
+ {% blocktrans with location=location.parent.name %}If this location is deleted, these child locations will be moved to {{ location }}{% endblocktrans %}.
+ {% else %}
+ {% trans "If this location is deleted, these child locations will be moved to the top level stock location" %}.
+ {% endif %}
+
{% endif %}
-
-
- {% for loc in location.children.all %}
- - {{ loc.name }} - {{ loc.description}}
- {% endfor %}
-
-{% endif %}
{% if location.stock_items.all|length > 0 %}
-This location contains {{ location.stock_items.all|length }} stock items.
-{% if location.parent %}
-If this location is deleted, these items will be moved to the '{{ location.parent.name }}' location.
-{% else %}
-If this location is deleted, these items will be moved to the top level 'Stock' location.
+
+ {% blocktrans with n=location.stock_items.all|length %}This location contains {{ n }} stock items{% endblocktrans %}.
+ {% if location.parent %}
+ {% blocktrans with location=location.parent.name %}If this location is deleted, these stock items will be moved to {{ location }}{% endblocktrans %}.
+ {% else %}
+ {% trans "If this location is deleted, these stock items will be moved to the top level stock location" %}.
+ {% endif %}
+
{% endif %}
-
-
- {% for item in location.stock_items.all %}
- - {{ item.part.full_name }} - {{ item.part.description }}{% decimal item.quantity %}
- {% endfor %}
-
-{% endif %}
{% endblock %}
\ No newline at end of file