Move all "SalesOrder" content onto a single page

This commit is contained in:
Oliver 2021-07-13 19:59:11 +10:00
parent a0b3359d62
commit 39c58e4015
2 changed files with 139 additions and 17 deletions

View File

@ -4,38 +4,156 @@
{% load status_codes %} {% load status_codes %}
{% load i18n %} {% load i18n %}
{% load static %} {% load static %}
{% load markdownify %}
{% block menubar %} {% block menubar %}
{% include "order/so_navbar.html" with tab='details' %} {% include "order/so_navbar.html" with tab='details' %}
{% endblock %} {% endblock %}
{% block heading %} {% block page_content %}
{% trans "Sales Order Items" %}
{% endblock %}
{% block details %} <div class='panel panel-default panel-inventree' id='panel-order-items'>
<div class='panel-heading'>
<h4>{% trans "Sales Order Items" %}</h4>
{% if roles.sales_order.change %} </div>
<div id='order-toolbar-buttons' class='btn-group' style='float: right;'> <div class='panel-content'>
{% if roles.sales_order.change %}
<div id='order-toolbar-buttons' class='btn-group' style='float: right;'>
<button type='button' class='btn btn-success' id='new-so-line'> <button type='button' class='btn btn-success' id='new-so-line'>
<span class='fas fa-plus-circle'></span> {% trans "Add Line Item" %} <span class='fas fa-plus-circle'></span> {% trans "Add Line Item" %}
</button> </button>
</div>
{% endif %}
<table class='table table-striped table-condensed' id='so-lines-table' data-toolbar='#order-toolbar-buttons'>
</table>
</div>
</div> </div>
{% endif %}
<table class='table table-striped table-condensed' id='so-lines-table' data-toolbar='#order-toolbar-buttons'> <div class='panel panel-default panel-inventree' id='panel-order-builds'>
<div class='panel-heading'>
<h4>{% trans "Build Orders" %}</h4>
</div>
<div class='panel-content'>
<table class='table table-striped table-condensed' id='builds-table'></table>
</div>
</div>
</table> <div class='panel panel-default panel-inventree' id='panel-order-attachments'>
<div class='panel-heading'>
<h4>{% trans "Attachments" %}</h4>
</div>
<div class='panel-content'>
{% include "attachment_table.html" %}
</div>
</div>
<div class='panel panel-default panel-inventree' id='panel-order-notes'>
<div class='panel-heading'>
<div class='row'>
<div class='col-sm-6'>
<h4>{% trans "Notes" %}</h4>
</div>
<div class='col-sm-6'>
<div class='btn-group float-right'>
<button type='button' id='edit-notes' title='{% trans "Edit Notes" %}' class='btn btn-small btn-default'>
<span class='fas fa-edit'>
</span>
</button>
</div>
</div>
</div>
</div>
<div class='panel-content'>
{{ order.notes | markdownify }}
</div>
</div>
{% endblock %} {% endblock %}
{% block js_ready %} {% block js_ready %}
{{ block.super }} {{ block.super }}
function reloadTable() { $('#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"); $("#so-lines-table").bootstrapTable("refresh");
} }
$("#new-so-line").click(function() { $("#new-so-line").click(function() {

View File

@ -43,6 +43,8 @@
</div> </div>
{% endblock %} {% endblock %}
{% block page_content %}
{% block pre_content_panels %} {% block pre_content_panels %}
{% endblock %} {% endblock %}
@ -71,6 +73,8 @@
{% endblock %} {% endblock %}
{% endblock %}
{% block js_ready %} {% block js_ready %}
{{ block.super }} {{ block.super }}