add HTML templates for PO

This commit is contained in:
Matthias 2022-03-11 00:58:18 +01:00
parent 76698ec627
commit e841b7faf6
No known key found for this signature in database
GPG Key ID: F50EF5741D33E076
2 changed files with 60 additions and 0 deletions

View File

@ -171,6 +171,12 @@ src="{% static 'img/blank_image.png' %}"
<td>{{ order.responsible }}</td>
</tr>
{% endif %}
<tr>
<td><span class='fas fa-dollar-sign'></span></td>
<td>{% trans "Total cost" %}</td>
<td id="poTotalPrice">{{ order.get_total_price }}</td>
</tr>
</table>
{% endblock %}

View File

@ -43,6 +43,29 @@
<table class='table table-striped table-condensed' id='po-line-table' data-toolbar='#order-toolbar-buttons'>
</table>
</div>
<div class='panel-heading'>
<div class='d-flex flex-wrap'>
<h4>{% trans "Additional Order Items" %}</h4>
{% include "spacer.html" %}
<div class='btn-group' role='group'>
{% if roles.purchase_order.change and order.is_pending %}
<button type='button' class='btn btn-success' id='new-po-additional-line'>
<span class='fas fa-plus-circle'></span> {% trans "Add Additional Order Items" %}
</button>
{% endif %}
</div>
</div>
</div>
<div class='panel-content'>
<div id='order-additional-toolbar-buttons' class='btn-group' style='float: right;'>
<div class='btn-group'>
{% include "filter_list.html" with id="purchase-order-additional-lines" %}
</div>
</div>
<table class='table table-striped table-condensed' id='po-additional-lines-table' data-toolbar='#order-additional-toolbar-buttons'>
</table>
</div>
</div>
<div class='panel panel-hidden' id='panel-received-items'>
@ -207,6 +230,37 @@ loadPurchaseOrderLineItemTable('#po-line-table', {
{% endif %}
});
$("#new-po-additional-line").click(function() {
var fields = poAdditionalLineItemFields({
order: {{ order.pk }},
});
constructForm('{% url "api-po-additional-line-list" %}', {
fields: fields,
method: 'POST',
title: '{% trans "Add Order Line" %}',
onSuccess: function() {
$("#po-additional-lines-table").bootstrapTable("refresh");
},
});
});
loadPurchaseOrderAdditionalLineItemTable(
'#po-additional-lines-table',
{
order: {{ order.pk }},
status: {{ order.status }},
}
);
loadOrderTotal(
'#poTotalPrice',
{
url: '{% url "api-po-detail" order.pk %}',
}
);
enableSidebar('purchaseorder');
{% endblock %}