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,17 +213,29 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class='panel panel-default panel-inventree panel-hidden' id='panel-outputs'>
|
<div class='panel panel-default panel-inventree panel-hidden' id='panel-outputs'>
|
||||||
{% if not build.is_complete %}
|
|
||||||
<div class='panel-heading'>
|
<div class='panel-heading'>
|
||||||
<h4>{% trans "Incomplete Build Outputs" %}</h4>
|
<h4>{% trans "Incomplete Build Outputs" %}</h4>
|
||||||
</div>
|
</div>
|
||||||
<div class='panel-content'>
|
<div class='panel-content'>
|
||||||
{% if build.active %}
|
<div id='build-output-toolbar'>
|
||||||
<div class='btn-group' role='group' id='build-output-toolbar'>
|
<div class='button-toolbar container-fluid'>
|
||||||
<button class='btn btn-primary' type='button' id='btn-create-output' title='{% trans "Create new build output" %}'>
|
{% if build.active %}
|
||||||
<span class='fas fa-plus-circle'></span> {% trans "Create New Output" %}
|
<div class='btn-group'>
|
||||||
</button>
|
<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>
|
||||||
|
|
||||||
<div class="panel-group" id="build-output-accordion" role="tablist" aria-multiselectable="true">
|
<div class="panel-group" id="build-output-accordion" role="tablist" aria-multiselectable="true">
|
||||||
@ -233,10 +245,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<table class='table table-striped table-condensed' id='build-output-table' data-toolbar='#build-output-toolbar'></table>
|
<table class='table table-striped table-condensed' id='build-output-table' data-toolbar='#build-output-toolbar'></table>
|
||||||
{% endif %}
|
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
</div>
|
||||||
|
|
||||||
|
<div class='panel panel-default panel-inventree panel-hidden' id='panel-completed'>
|
||||||
<div class='panel-heading'>
|
<div class='panel-heading'>
|
||||||
<h4>
|
<h4>
|
||||||
{% trans "Completed Build Outputs" %}
|
{% trans "Completed Build Outputs" %}
|
||||||
@ -336,6 +348,28 @@ inventreeGet(
|
|||||||
|
|
||||||
{% if build.active %}
|
{% if build.active %}
|
||||||
loadBuildOutputTable(build_info);
|
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 %}
|
{% endif %}
|
||||||
|
|
||||||
{% for item in build.incomplete_outputs %}
|
{% for item in build.incomplete_outputs %}
|
||||||
|
@ -25,10 +25,19 @@
|
|||||||
</li>
|
</li>
|
||||||
{% endif %}
|
{% 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'>
|
<a href='#' id='select-outputs' class='nav-toggle'>
|
||||||
<span class='fas fa-box sidebar-icon'></span>
|
<span class='fas fa-tasks sidebar-icon'></span>
|
||||||
{% trans "Build Outputs" %}
|
{% 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>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
@ -423,8 +423,6 @@ function completeBuildOutputs(build_id, outputs, options={}) {
|
|||||||
output: pk,
|
output: pk,
|
||||||
});
|
});
|
||||||
output_pk_values.push(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();
|
setupBuildOutputButtonCallbacks();
|
||||||
},
|
},
|
||||||
columns: [
|
columns: [
|
||||||
|
{
|
||||||
|
title: '',
|
||||||
|
visible: true,
|
||||||
|
checkbox: true,
|
||||||
|
switchable: false,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
field: 'part',
|
field: 'part',
|
||||||
title: '{% trans "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) {
|
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') {
|
if (typeof table === 'string') {
|
||||||
table = $(table);
|
table = $(table);
|
||||||
|
Loading…
Reference in New Issue
Block a user