diff --git a/InvenTree/order/templates/order/sales_order_detail.html b/InvenTree/order/templates/order/sales_order_detail.html index 4af0e219d6..9da0c88c82 100644 --- a/InvenTree/order/templates/order/sales_order_detail.html +++ b/InvenTree/order/templates/order/sales_order_detail.html @@ -4,38 +4,156 @@ {% load status_codes %} {% load i18n %} {% load static %} +{% load markdownify %} {% block menubar %} {% include "order/so_navbar.html" with tab='details' %} {% endblock %} -{% block heading %} -{% trans "Sales Order Items" %} -{% endblock %} +{% block page_content %} -{% block details %} - - -{% if roles.sales_order.change %} -
- +
+
+

{% trans "Sales Order Items" %}

+
+
+ {% if roles.sales_order.change %} +
+ +
+ {% endif %} + +
+
-{% endif %} - +
+
+

{% trans "Build Orders" %}

+
+
+
+
+ - +
+
+

{% trans "Attachments" %}

+
+
+ {% include "attachment_table.html" %} +
+
+ +
+
+
+
+

{% trans "Notes" %}

+
+
+
+ +
+
+
+
+
+ {{ order.notes | markdownify }} +
+
{% endblock %} {% block js_ready %} {{ block.super }} -function reloadTable() { - $("#so-lines-table").bootstrapTable("refresh"); -} + $('#edit-notes').click(function() { + constructForm('{% url "api-so-detail" order.pk %}', { + fields: { + notes: { + multiline: true, + } + }, + title: '{% trans "Edit Notes" %}', + reload: true, + }); + }); + + enableDragAndDrop( + '#attachment-dropzone', + '{% url "api-so-attachment-list" %}', + { + data: { + order: {{ order.id }}, + }, + label: 'attachment', + success: function(data, status, xhr) { + location.reload(); + } + } + ); + + loadAttachmentTable( + '{% url "api-so-attachment-list" %}', + { + filters: { + order: {{ order.pk }}, + }, + onEdit: function(pk) { + var url = `/api/order/so/attachment/${pk}/`; + + constructForm(url, { + fields: { + comment: {}, + }, + onSuccess: reloadAttachmentTable, + title: '{% trans "Edit Attachment" %}', + }); + }, + onDelete: function(pk) { + constructForm(`/api/order/so/attachment/${pk}/`, { + method: 'DELETE', + confirmMessage: '{% trans "Confirm Delete Operation" %}', + title: '{% trans "Delete Attachment" %}', + onSuccess: reloadAttachmentTable, + }); + } + } + ); + + $("#new-attachment").click(function() { + + constructForm('{% url "api-so-attachment-list" %}', { + method: 'POST', + fields: { + attachment: {}, + comment: {}, + order: { + value: {{ order.pk }}, + hidden: true + } + }, + onSuccess: reloadAttachmentTable, + title: '{% trans "Add Attachment" %}' + }); + }); + + loadBuildTable($("#builds-table"), { + url: "{% url 'api-build-list' %}", + params: { + sales_order: {{ order.id }}, + }, + }); + + function reloadTable() { + $("#so-lines-table").bootstrapTable("refresh"); + } $("#new-so-line").click(function() { diff --git a/InvenTree/templates/two_column.html b/InvenTree/templates/two_column.html index c942bef1fa..bcc85c7269 100644 --- a/InvenTree/templates/two_column.html +++ b/InvenTree/templates/two_column.html @@ -43,6 +43,8 @@ {% endblock %} +{% block page_content %} + {% block pre_content_panels %} {% endblock %} @@ -71,6 +73,8 @@ {% endblock %} +{% endblock %} + {% block js_ready %} {{ block.super }}