mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 13:05:42 +00:00
Refactor CancelBuild form
This commit is contained in:
@ -21,6 +21,7 @@
|
||||
/* exported
|
||||
allocateStockToBuild,
|
||||
autoAllocateStockToBuild,
|
||||
cancelBuildOrder,
|
||||
completeBuildOrder,
|
||||
createBuildOutput,
|
||||
editBuildOrder,
|
||||
@ -123,6 +124,49 @@ function newBuildOrder(options={}) {
|
||||
}
|
||||
|
||||
|
||||
/* Construct a form to cancel a build order */
|
||||
function cancelBuildOrder(build_id, options={}) {
|
||||
|
||||
constructForm(
|
||||
`/api/build/${build_id}/cancel/`,
|
||||
{
|
||||
method: 'POST',
|
||||
title: '{% trans "Cancel Build Order" %}',
|
||||
confirm: true,
|
||||
fields: {
|
||||
remove_allocated_stock: {},
|
||||
remove_incomplete_outputs: {},
|
||||
},
|
||||
preFormContent: function(opts) {
|
||||
var html = `
|
||||
<div class='alert alert-block alert-info'>
|
||||
{% trans "Are you sure you wish to cancel this build?" %}
|
||||
</div>`;
|
||||
|
||||
if (opts.context.has_allocated_stock) {
|
||||
html += `
|
||||
<div class='alert alert-block alert-warning'>
|
||||
{% trans "Stock items have been allocated to this build order" %}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
if (opts.context.incomplete_outputs) {
|
||||
html += `
|
||||
<div class='alert alert-block alert-warning'>
|
||||
{% trans "There are incomplete outputs remaining for this build order" %}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
return html;
|
||||
},
|
||||
onSuccess: function(response) {
|
||||
handleFormSuccess(response, options);
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/* Construct a form to "complete" (finish) a build order */
|
||||
function completeBuildOrder(build_id, options={}) {
|
||||
|
||||
|
Reference in New Issue
Block a user