2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-16 01:36:29 +00:00

Js forms updates (#4378)

* Refactor forms for creating and editing SalesOrder

- Common function for defining fields

* More visual improvements for forms

* Refactor fields for SupplierPartPriceBreak

* More refactoring

* Refactor for stockitemtestresult table

* Comment fields

* JS linting fix
This commit is contained in:
Oliver
2023-02-21 07:24:49 +11:00
committed by GitHub
parent 17bfea4428
commit 62455199f3
12 changed files with 267 additions and 172 deletions

View File

@@ -315,7 +315,9 @@ function stockItemFields(options={}) {
purchase_price: {
icon: 'fa-dollar-sign',
},
purchase_price_currency: {},
purchase_price_currency: {
icon: 'fa-coins',
},
packaging: {
icon: 'fa-box',
},
@@ -686,7 +688,9 @@ function assignStockToCustomer(items, options={}) {
is_customer: true,
},
},
notes: {},
notes: {
icon: 'fa-sticky-note',
},
},
confirm: true,
confirmMessage: '{% trans "Confirm stock assignment" %}',
@@ -855,7 +859,9 @@ function mergeStockItems(items, options={}) {
structural: false,
}
},
notes: {},
notes: {
icon: 'fa-sticky-note',
},
allow_mismatched_suppliers: {},
allow_mismatched_status: {},
},
@@ -1299,6 +1305,28 @@ function formatDate(row) {
return html;
}
/* Construct set of default fields for a StockItemTestResult */
function stockItemTestResultFields(options={}) {
let fields = {
test: {},
result: {},
value: {},
attachment: {},
notes: {
icon: 'fa-sticky-note',
},
stock_item: {
hidden: true,
},
};
if (options.stock_item) {
fields.stock_item.value = options.stock_item;
}
return fields;
}
/*
* Load StockItemTestResult table
*/
@@ -1564,7 +1592,9 @@ function loadStockTestResultsTable(table, options) {
result: {},
value: {},
attachment: {},
notes: {},
notes: {
icon: 'fa-sticky-note',
},
stock_item: {
value: options.stock_item,
hidden: true,
@@ -1584,13 +1614,7 @@ function loadStockTestResultsTable(table, options) {
var url = `/api/stock/test/${pk}/`;
constructForm(url, {
fields: {
test: {},
result: {},
value: {},
attachment: {},
notes: {},
},
fields: stockItemTestResultFields(),
title: '{% trans "Edit Test Result" %}',
onSuccess: reloadTestTable,
});
@@ -2860,7 +2884,9 @@ function uninstallStockItem(installed_item_id, options={}) {
structural: false,
}
},
note: {},
note: {
icon: 'fa-sticky-note',
},
},
preFormContent: function(opts) {
var html = '';