mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Validate and save the new serailizer
This commit is contained in:
@ -20,6 +20,7 @@
|
||||
|
||||
/* exported
|
||||
allocateStockToBuild,
|
||||
completeBuildOrder,
|
||||
editBuildOrder,
|
||||
loadAllocationTable,
|
||||
loadBuildOrderAllocationTable,
|
||||
@ -120,6 +121,57 @@ function newBuildOrder(options={}) {
|
||||
}
|
||||
|
||||
|
||||
/* Construct a form to "complete" (finish) a build order */
|
||||
function completeBuildOrder(build_id, options={}) {
|
||||
|
||||
var url = `/api/build/${build_id}/finish/`;
|
||||
|
||||
var fields = {
|
||||
accept_unallocated: {},
|
||||
accept_incomplete: {},
|
||||
};
|
||||
|
||||
var html = '';
|
||||
|
||||
if (options.can_complete) {
|
||||
|
||||
} else {
|
||||
html += `
|
||||
<div class='alert alert-block alert-danger'>
|
||||
<strong>{% trans "Build Order is incomplete" %}</strong>
|
||||
</div>
|
||||
`;
|
||||
|
||||
if (!options.allocated) {
|
||||
html += `<div class='alert alert-block alert-warning'>{% trans "Required stock has not been fully allocated" %}</div>`;
|
||||
}
|
||||
|
||||
if (!options.completed) {
|
||||
html += `<div class='alert alert-block alert-warning'>{% trans "Required build quantity has not been completed" %}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
// Hide particular fields if they are not required
|
||||
|
||||
if (options.allocated) {
|
||||
delete fields.accept_unallocated;
|
||||
}
|
||||
|
||||
if (options.completed) {
|
||||
delete fields.accept_incomplete;
|
||||
}
|
||||
|
||||
constructForm(url, {
|
||||
fields: fields,
|
||||
reload: true,
|
||||
confirm: true,
|
||||
method: 'POST',
|
||||
title: '{% trans "Complete Build Order" %}',
|
||||
preFormContent: html,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Construct a set of output buttons for a particular build output
|
||||
*/
|
||||
|
Reference in New Issue
Block a user