{% extends "stock/item_base.html" %}
{% load static %}
{% load i18n %}
{% block menubar %}
{% include "stock/navbar.html" with tab='attachments' %}
{% endblock %}
{% block heading %}
{% trans "Stock Item Attachments" %}
{% endblock %}
{% block details %}
{% include "attachment_table.html" with attachments=item.attachments.all %}
{% endblock %}
{% block js_ready %}
{{ block.super }}
enableDragAndDrop(
'#attachment-dropzone',
"{% url 'stock-item-attachment-create' %}",
{
data: {
stock_item: {{ item.id }},
},
label: 'attachment',
success: function(data, status, xhr) {
location.reload();
}
}
);
$("#new-attachment").click(function() {
launchModalForm("{% url 'stock-item-attachment-create' %}?item={{ item.id }}",
{
reload: true,
});
});
$("#attachment-table").on('click', '.attachment-edit-button', function() {
var button = $(this);
var url = `/stock/item/attachment/${button.attr('pk')}/edit/`;
launchModalForm(url,
{
reload: true,
});
});
$("#attachment-table").on('click', '.attachment-delete-button', function() {
var button = $(this);
var url = `/stock/item/attachment/${button.attr('pk')}/delete/`;
launchModalForm(url, {
success: function() {
location.reload();
}
});
});
$("#attachment-table").inventreeTable({
});
{% endblock %}