{% extends "order/order_base.html" %} {% load inventree_extras %} {% load i18n %} {% load static %} {% block menubar %} {% include 'order/po_navbar.html' with tab='attachments' %} {% endblock %} {% block heading %} {% trans "Purchase Order Attachments" %} {% endblock %} {% block details %} {% include "attachment_table.html" with attachments=order.attachments.all %} {% endblock %} {% block js_ready %} {{ block.super }} enableDragAndDrop( '#attachment-dropzone', '{% url "api-po-attachment-list" %}', { data: { order: {{ order.id }}, }, label: 'attachment', success: function(data, status, xhr) { location.reload(); } } ); loadAttachmentTable( '{% url "api-po-attachment-list" %}', { filters: { order: {{ order.pk }}, }, onEdit: function(pk) { var url = `/api/order/po/attachment/${pk}/`; constructForm(url, { fields: { comment: {}, }, onSuccess: reloadAttachmentTable, title: '{% trans "Edit Attachment" %}', }); }, onDelete: function(pk) { constructForm(`/api/order/po/attachment/${pk}/`, { method: 'DELETE', confirmMessage: '{% trans "Confirm Delete Operation" %}', title: '{% trans "Delete Attachment" %}', onSuccess: reloadAttachmentTable, }); } } ); $("#new-attachment").click(function() { constructForm('{% url "api-po-attachment-list" %}', { method: 'POST', fields: { attachment: {}, comment: {}, order: { value: {{ order.pk }}, hidden: true, }, }, reload: true, title: '{% trans "Add Attachment" %}', }); }); {% endblock %}