{% extends "order/sales_order_base.html" %} {% load inventree_extras %} {% load status_codes %} {% load i18n %} {% load static %} {% load markdownify %} {% block menubar %} {% include "order/so_navbar.html" %} {% endblock %} {% block page_content %}

{% trans "Sales Order Items" %}

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

{% trans "Build Orders" %}

{% trans "Attachments" %}

{% include "attachment_table.html" %}

{% trans "Order Notes" %}

{% if order.notes %} {{ order.notes | markdownify }} {% endif %}
{% endblock %} {% block js_ready %} {{ block.super }} $('#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: { filename: {}, 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() { constructForm('{% url "api-so-line-list" %}', { fields: { order: { value: {{ order.pk }}, hidden: true, }, part: {}, quantity: {}, reference: {}, sale_price: {}, sale_price_currency: {}, notes: {}, }, method: 'POST', title: '{% trans "Add Line Item" %}', onSuccess: reloadTable, }); }); loadSalesOrderLineItemTable( '#so-lines-table', { order: {{ order.pk }}, status: {{ order.status }}, } ); attachNavCallbacks({ name: 'sales-order', default: 'order-items' }); {% endblock %}