Refactor "delete stock location" dialog

- Simplify dialog
- Make text translatable
This commit is contained in:
Oliver 2022-03-10 12:44:57 +11:00
parent 478bc1c355
commit 9bc686b76f

View File

@ -4,40 +4,31 @@
{% load inventree_extras %}
{% block pre_form_content %}
{% trans "Are you sure you want to delete this stock location?" %}
<br>
<div class='alert alert-block alert-danger'>
{% trans "Are you sure you want to delete this stock location?" %}
</div>
{% if location.children.all|length > 0 %}
<p>This location contains {{ location.children.all|length }} child locations.<br>
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.
<div class='alert alert-block alert-warning'>
{% blocktrans with n=location.children.all|length %}This location contains {{ n }} child locations{% endblocktrans %}.<br>
{% 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 %}
</div>
{% endif %}
</p>
<ul class='list-group'>
{% for loc in location.children.all %}
<li class='list-group-item'><strong>{{ loc.name }}</strong> - <em>{{ loc.description}}</em></li>
{% endfor %}
</ul>
{% endif %}
{% if location.stock_items.all|length > 0 %}
<p>This location contains {{ location.stock_items.all|length }} stock items.<br>
{% 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.
<div class='alert alert-block alert-warning'>
{% blocktrans with n=location.stock_items.all|length %}This location contains {{ n }} stock items{% endblocktrans %}.<br>
{% 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 %}
</div>
{% endif %}
</p>
<ul class='list-group'>
{% for item in location.stock_items.all %}
<li class='list-group-item'><strong>{{ item.part.full_name }}</strong> - <em>{{ item.part.description }}</em><span class='badge badge-right rounded-pill bg-dark'>{% decimal item.quantity %}</span></li>
{% endfor %}
</ul>
{% endif %}
{% endblock %}