mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Add option to select multiple build outputs
- Can "complete" these outputs
This commit is contained in:
parent
d47b32e4aa
commit
14ef56785e
@ -213,19 +213,31 @@
|
||||
</div>
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-outputs'>
|
||||
{% if not build.is_complete %}
|
||||
<div class='panel-heading'>
|
||||
<h4>{% trans "Incomplete Build Outputs" %}</h4>
|
||||
</div>
|
||||
<div class='panel-content'>
|
||||
{% if build.active %}
|
||||
<div class='btn-group' role='group' id='build-output-toolbar'>
|
||||
<button class='btn btn-primary' type='button' id='btn-create-output' title='{% trans "Create new build output" %}'>
|
||||
<span class='fas fa-plus-circle'></span> {% trans "Create New Output" %}
|
||||
</button>
|
||||
|
||||
<div id='build-output-toolbar'>
|
||||
<div class='button-toolbar container-fluid'>
|
||||
{% if build.active %}
|
||||
<div class='btn-group'>
|
||||
<button class='btn btn-success' type='button' id='btn-create-output' title='{% trans "Create new build output" %}'>
|
||||
<span class='fas fa-plus-circle'></span>
|
||||
</button>
|
||||
<!-- Build output actions -->
|
||||
<div class='btn-group'>
|
||||
<button id='output-options' class='btn btn-primary dropdown-toiggle' type='button' data-toggle='dropdown' title='{% trans "Output Actions" %}'>
|
||||
<span class='fas fa-tools'></span> <span class='caret'></span>
|
||||
</button>
|
||||
<ul class='dropdown-menu'>
|
||||
<li><a href='#' id='multi-output-complete' title='{% trans "Complete selected items" %}'><span class='fas fa-check-circle icon-green'></span> {% trans "Complete outputs" %}</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="panel-group" id="build-output-accordion" role="tablist" aria-multiselectable="true">
|
||||
{% for item in build.incomplete_outputs %}
|
||||
{% include "build/allocation_card.html" with item=item tracked_items=build.has_tracked_bom_items %}
|
||||
@ -233,10 +245,10 @@
|
||||
</div>
|
||||
|
||||
<table class='table table-striped table-condensed' id='build-output-table' data-toolbar='#build-output-toolbar'></table>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-completed'>
|
||||
<div class='panel-heading'>
|
||||
<h4>
|
||||
{% trans "Completed Build Outputs" %}
|
||||
@ -336,6 +348,28 @@ inventreeGet(
|
||||
|
||||
{% if build.active %}
|
||||
loadBuildOutputTable(build_info);
|
||||
linkButtonsToSelection(
|
||||
'#build-output-table',
|
||||
[
|
||||
'#output-options',
|
||||
'#multi-output-complete',
|
||||
]
|
||||
);
|
||||
|
||||
$('#multi-output-complete').click(function() {
|
||||
var outputs = $('#build-output-table').bootstrapTable('getSelections');
|
||||
|
||||
completeBuildOutputs(
|
||||
build_info.pk,
|
||||
outputs,
|
||||
{
|
||||
success: function() {
|
||||
$('#build-output-table').bootstrapTable('refresh');
|
||||
}
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
{% endif %}
|
||||
|
||||
{% for item in build.incomplete_outputs %}
|
||||
|
@ -25,10 +25,19 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li class='list-group-item' title='{% trans "Build Outputs" %}'>
|
||||
{% if not build.is_complete %}
|
||||
<li class='list-group-item' title='{% trans "In Progress Items" %}'>
|
||||
<a href='#' id='select-outputs' class='nav-toggle'>
|
||||
<span class='fas fa-box sidebar-icon'></span>
|
||||
{% trans "Build Outputs" %}
|
||||
<span class='fas fa-tasks sidebar-icon'></span>
|
||||
{% trans "In Progress Items" %}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li class='list-group-item' title='{% trans "Completed Items" %}'>
|
||||
<a href='#' id='select-completed' class='nav-toggle'>
|
||||
<span class='fas fa-boxes sidebar-icon'></span>
|
||||
{% trans "Completed Items" %}
|
||||
</a>
|
||||
</li>
|
||||
|
||||
|
@ -423,8 +423,6 @@ function completeBuildOutputs(build_id, outputs, options={}) {
|
||||
output: pk,
|
||||
});
|
||||
output_pk_values.push(pk);
|
||||
} else {
|
||||
console.log(`Could not find row for ${pk}`);
|
||||
}
|
||||
});
|
||||
|
||||
@ -753,6 +751,12 @@ function loadBuildOutputTable(build_info, options={}) {
|
||||
setupBuildOutputButtonCallbacks();
|
||||
},
|
||||
columns: [
|
||||
{
|
||||
title: '',
|
||||
visible: true,
|
||||
checkbox: true,
|
||||
switchable: false,
|
||||
},
|
||||
{
|
||||
field: 'part',
|
||||
title: '{% trans "Part" %}',
|
||||
|
@ -56,10 +56,10 @@ function enableButtons(elements, enabled) {
|
||||
}
|
||||
|
||||
|
||||
/* Link a bootstrap-table object to one or more buttons.
|
||||
* The buttons will only be enabled if there is at least one row selected
|
||||
*/
|
||||
function linkButtonsToSelection(table, buttons) {
|
||||
/* Link a bootstrap-table object to one or more buttons.
|
||||
* The buttons will only be enabled if there is at least one row selected
|
||||
*/
|
||||
|
||||
if (typeof table === 'string') {
|
||||
table = $(table);
|
||||
|
Loading…
Reference in New Issue
Block a user