mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Render a table of sales orders
This commit is contained in:
parent
c7fd22924f
commit
627c50e465
@ -144,11 +144,74 @@ function loadPurchaseOrderTable(table, options) {
|
|||||||
return imageHoverIcon(row.supplier_detail.image) + renderLink(row.supplier_detail.name, `/company/${row.supplier}/purchase-orders/`);
|
return imageHoverIcon(row.supplier_detail.image) + renderLink(row.supplier_detail.name, `/company/${row.supplier}/purchase-orders/`);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
sortable: true,
|
||||||
|
field: 'description',
|
||||||
|
title: 'Description',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sortable: true,
|
||||||
|
field: 'status',
|
||||||
|
title: 'Status',
|
||||||
|
formatter: function(value, row, index, field) {
|
||||||
|
return orderStatusDisplay(row.status, row.status_text);
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'creation_date',
|
field: 'creation_date',
|
||||||
title: 'Date',
|
title: 'Date',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
sortable: true,
|
||||||
|
field: 'line_items',
|
||||||
|
title: 'Items'
|
||||||
|
},
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadSalesOrderTable(table, options) {
|
||||||
|
|
||||||
|
options.params = options.params || {};
|
||||||
|
options.params['customer_detail'] = true;
|
||||||
|
|
||||||
|
var filters = loadTableFilters("table");
|
||||||
|
|
||||||
|
for (var key in options.params) {
|
||||||
|
filters[key] = options.params[key];
|
||||||
|
}
|
||||||
|
|
||||||
|
setupFilterList("order", $(table));
|
||||||
|
|
||||||
|
$(table).inventreeTable({
|
||||||
|
url: options.url,
|
||||||
|
queryParams: filters,
|
||||||
|
groupBy: false,
|
||||||
|
original: options.params,
|
||||||
|
formatNoMatches: function() { return "No sales orders found"; },
|
||||||
|
columns: [
|
||||||
|
{
|
||||||
|
field: 'pk',
|
||||||
|
title: 'ID',
|
||||||
|
visible: false,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sortable: true,
|
||||||
|
field: 'reference',
|
||||||
|
title: 'Sales Order',
|
||||||
|
formatter: function(value, row, index, field) {
|
||||||
|
return renderLink(value, `/order/sales-order/${row.pk}/`);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
{
|
||||||
|
sortable: true,
|
||||||
|
field: 'customer_detail',
|
||||||
|
title: 'Customer',
|
||||||
|
formatter: function(value, row, index, field) {
|
||||||
|
return imageHoverIcon(row.customer_detail.image) + renderLink(row.customer_detail.name, `/company/${row.customer}/sales-orders/`);
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'description',
|
field: 'description',
|
||||||
@ -162,6 +225,11 @@ function loadPurchaseOrderTable(table, options) {
|
|||||||
return orderStatusDisplay(row.status, row.status_text);
|
return orderStatusDisplay(row.status, row.status_text);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
sortable: true,
|
||||||
|
field: 'creation_date',
|
||||||
|
title: 'Date',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
sortable: true,
|
sortable: true,
|
||||||
field: 'line_items',
|
field: 'line_items',
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
<div id='button-bar'>
|
<div id='button-bar'>
|
||||||
<div class='button-toolbar container-fluid' style='float: right;'>
|
<div class='button-toolbar container-fluid' style='float: right;'>
|
||||||
<button class='btn btn-primary' type='button' id='company-order2' title='Create new purchase order'>{% trans "New Purchase Order" %}</button>
|
<button class='btn btn-primary' type='button' id='company-order2' title='{% trans "Create new purchase order" %}'>{% trans "New Purchase Order" %}</button>
|
||||||
<div class='filter-list' id='filter-list-order'>
|
<div class='filter-list' id='filter-list-order'>
|
||||||
<!-- Empty div -->
|
<!-- Empty div -->
|
||||||
</div>
|
</div>
|
||||||
|
@ -9,4 +9,30 @@
|
|||||||
<h4>{% trans "Sales Orders" %}</h4>
|
<h4>{% trans "Sales Orders" %}</h4>
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
|
<div id='button-bar'>
|
||||||
|
<div class='button-toolbar container-fluid' style='float: right;'>
|
||||||
|
<button class='btn btn-primary' type='button' id='new-sales-order' title='{% trans "Create new sales order" %}'>{% trans "New Sales Order" %}</button>
|
||||||
|
<div class='filter-list' id='filter-list-order'>
|
||||||
|
<!-- Empty div -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<table class='table table-striped table-condensed po-table' id='sales-order-table' data-toolbar='#button-bar'>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block js_ready %}
|
||||||
|
{{ block.super }}
|
||||||
|
|
||||||
|
loadSalesOrderTable("#sales-order-table", {
|
||||||
|
url: "{% url 'api-so-list' %}?customer={{ company.id }}",
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
$("#new-sales-order").click(function() {
|
||||||
|
// TODO - Create a new sales order
|
||||||
|
});
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
@ -124,6 +124,7 @@ class SalseOrderSerializer(InvenTreeModelSerializer):
|
|||||||
'issue_date',
|
'issue_date',
|
||||||
'complete_date',
|
'complete_date',
|
||||||
'creation_date',
|
'creation_date',
|
||||||
|
'description',
|
||||||
'line_items',
|
'line_items',
|
||||||
'link',
|
'link',
|
||||||
'reference',
|
'reference',
|
||||||
|
Loading…
Reference in New Issue
Block a user