Url and template for InventoryDeleteView
This commit is contained in:
parent
59dacda37d
commit
f3701d91fc
2 changed files with 39 additions and 0 deletions
|
@ -19,6 +19,17 @@
|
|||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% if perms.kfet.delete_inventory %}
|
||||
<hr>
|
||||
<div class="buttons">
|
||||
<button class="btn btn-default" id="button-delete">
|
||||
<span class="glyphicon glyphicon-remove"></span><span>Annuler l'inventaire</span>
|
||||
</button>
|
||||
<form method="post" action="{% url 'kfet.inventory.delete' inventory.pk %}" id="inventory-delete-form">
|
||||
{% csrf_token %}
|
||||
</form>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</aside>
|
||||
|
||||
|
@ -64,4 +75,27 @@
|
|||
</table>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$( function() {
|
||||
// Delete button
|
||||
$('#button-delete').click(function() {
|
||||
$.confirm({
|
||||
title: 'Confirmer la suppression',
|
||||
content: `
|
||||
<div class="warning">
|
||||
<span class='glyphicon glyphicon-warning-sign'></span><span>Cette opération est irréversible !</span>
|
||||
</div>
|
||||
`,
|
||||
backgroundDismiss: true,
|
||||
animation: 'top',
|
||||
closeAnimation: 'bottom',
|
||||
keyboardEnabled: true,
|
||||
confirm: function() {
|
||||
$('#inventory-delete-form').submit();
|
||||
}
|
||||
})
|
||||
})
|
||||
});
|
||||
</script>
|
||||
|
||||
{% endblock %}
|
||||
|
|
|
@ -270,6 +270,11 @@ urlpatterns = [
|
|||
teamkfet_required(views.InventoryRead.as_view()),
|
||||
name="kfet.inventory.read",
|
||||
),
|
||||
path(
|
||||
"inventaires/<int:pk>/delete",
|
||||
views.InventoryDelete.as_view(),
|
||||
name="kfet.inventory.delete",
|
||||
),
|
||||
# -----
|
||||
# Order urls
|
||||
# -----
|
||||
|
|
Loading…
Reference in a new issue