mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Show part delete button when part still active
This commit is contained in:
parent
344383d3d4
commit
1e9ae927d4
@ -130,7 +130,7 @@
|
||||
{% if roles.part.change %}
|
||||
<li><a href='#' id='part-edit'><span class='fas fa-edit icon-blue'></span> {% trans "Edit part" %}</a></li>
|
||||
{% endif %}
|
||||
{% if not part.active and roles.part.delete %}
|
||||
{% if roles.part.delete %}
|
||||
<li><a href='#' id='part-delete'><span class='fas fa-trash-alt icon-red'></span> {% trans "Delete part" %}</a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
@ -503,7 +503,7 @@
|
||||
});
|
||||
{% endif %}
|
||||
|
||||
{% if not part.active and roles.part.delete %}
|
||||
{% if roles.part.delete %}
|
||||
$("#part-delete").click(function() {
|
||||
launchModalForm(
|
||||
"{% url 'part-delete' part.id %}",
|
||||
|
@ -3,6 +3,16 @@
|
||||
|
||||
{% block pre_form_content %}
|
||||
|
||||
{% if part.active %}
|
||||
|
||||
<div class='alert alert-block alert-danger'>
|
||||
{% blocktrans with full_name=part.full_name %}Part '<strong>{{full_name}}</strong>' cannot be deleted as it is still marked as <strong>active</strong>.
|
||||
<br>Disable the "Active" part attribute and re-try.
|
||||
{% endblocktrans %}
|
||||
</div>
|
||||
|
||||
{% else %}
|
||||
|
||||
<div class='alert alert-block alert-danger'>
|
||||
{% blocktrans with full_name=part.full_name %}Are you sure you want to delete part '<strong>{{full_name}}</strong>'?{% endblocktrans %}
|
||||
</div>
|
||||
@ -55,4 +65,12 @@
|
||||
<p>{% blocktrans with count=part.serials.all|length full_name=part.full_name %}There are {{count}} unique parts tracked for '{{full_name}}'. Deleting this part will permanently remove this tracking information.{% endblocktrans %}</p>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block form %}
|
||||
{% if not part.active %}
|
||||
{{ block.super }}
|
||||
{% endif %}
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user