mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-18 21:15:41 +00:00
@ -16,6 +16,7 @@
|
||||
{% include "InvenTree/settings/header.html" %}
|
||||
<tbody>
|
||||
{% include "InvenTree/settings/setting.html" with key="INVENTREE_INSTANCE" icon="fa-info-circle" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="INVENTREE_BASE_URL" icon="fa-globe" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="INVENTREE_COMPANY_NAME" icon="fa-building" %}
|
||||
{% include "InvenTree/settings/setting.html" with key="INVENTREE_DEFAULT_CURRENCY" icon="fa-dollar-sign" %}
|
||||
</tbody>
|
||||
|
@ -637,6 +637,12 @@ function loadBuildTable(table, options) {
|
||||
visible: false,
|
||||
switchable: false,
|
||||
},
|
||||
{
|
||||
checkbox: true,
|
||||
title: '{% trans "Select" %}',
|
||||
searchable: false,
|
||||
switchable: false,
|
||||
},
|
||||
{
|
||||
field: 'reference',
|
||||
title: '{% trans "Build" %}',
|
||||
@ -717,6 +723,13 @@ function loadBuildTable(table, options) {
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
linkButtonsToSelection(
|
||||
table,
|
||||
[
|
||||
'#build-print-options',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,10 +1,10 @@
|
||||
{% load i18n %}
|
||||
|
||||
|
||||
function selectTestReport(reports, items, options={}) {
|
||||
function selectReport(reports, items, options={}) {
|
||||
/**
|
||||
* Present the user with the available test reports,
|
||||
* and allow them to select which test report to print.
|
||||
* Present the user with the available reports,
|
||||
* and allow them to select which report to print.
|
||||
*
|
||||
* The intent is that the available report templates have been requested
|
||||
* (via AJAX) from the server.
|
||||
@ -44,7 +44,7 @@ function selectTestReport(reports, items, options={}) {
|
||||
|
||||
html += `
|
||||
<div class='alert alert-block alert-info'>
|
||||
${items.length} {% trans "stock items selected" %}
|
||||
${items.length} {% trans "items selected" %}
|
||||
</div>`;
|
||||
}
|
||||
|
||||
@ -102,7 +102,7 @@ function printTestReports(items, options={}) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Request available labels from the server
|
||||
// Request available reports from the server
|
||||
inventreeGet(
|
||||
'{% url "api-stockitem-testreport-list" %}',
|
||||
{
|
||||
@ -121,7 +121,7 @@ function printTestReports(items, options={}) {
|
||||
}
|
||||
|
||||
// Select report template to print
|
||||
selectTestReport(
|
||||
selectReport(
|
||||
response,
|
||||
items,
|
||||
{
|
||||
@ -129,7 +129,7 @@ function printTestReports(items, options={}) {
|
||||
var href = `/api/report/test/${pk}/print/?`;
|
||||
|
||||
items.forEach(function(item) {
|
||||
href += `items[]=${item}&`;
|
||||
href += `item=${item}&`;
|
||||
});
|
||||
|
||||
window.location.href = href;
|
||||
@ -139,4 +139,111 @@ function printTestReports(items, options={}) {
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function printBuildReports(builds, options={}) {
|
||||
/**
|
||||
* Print Build report for the provided build(s)
|
||||
*/
|
||||
|
||||
if (builds.length == 0) {
|
||||
showAlertDialog(
|
||||
'{% trans "Select Builds" %}',
|
||||
'{% trans "Build(s) must be selected before printing reports" %}',
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
inventreeGet(
|
||||
'{% url "api-build-report-list" %}',
|
||||
{
|
||||
enabled: true,
|
||||
builds: builds,
|
||||
},
|
||||
{
|
||||
success: function(response) {
|
||||
if (response.length == 0) {
|
||||
showAlertDialog(
|
||||
'{% trans "No Reports Found" %}',
|
||||
'{% trans "No report templates found which match selected build(s)" %}'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Select which report to print
|
||||
selectReport(
|
||||
response,
|
||||
builds,
|
||||
{
|
||||
success: function(pk) {
|
||||
var href = `/api/report/build/${pk}/print/?`;
|
||||
|
||||
builds.forEach(function(build) {
|
||||
href += `build=${build}&`;
|
||||
});
|
||||
|
||||
window.location.href = href;
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
function printBomReports(parts, options={}) {
|
||||
/**
|
||||
* Print BOM reports for the provided part(s)
|
||||
*/
|
||||
|
||||
if (parts.length == 0) {
|
||||
showAlertDialog(
|
||||
'{% trans "Select Parts" %}',
|
||||
'{% trans "Part(s) must be selected before printing reports" %}'
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Request available reports from the server
|
||||
inventreeGet(
|
||||
'{% url "api-bom-report-list" %}',
|
||||
{
|
||||
enabled: true,
|
||||
parts: parts,
|
||||
},
|
||||
{
|
||||
success: function(response) {
|
||||
if (response.length == 0) {
|
||||
showAlertDialog(
|
||||
'{% trans "No Reports Found" %}',
|
||||
'{% trans "No report templates found which match selected part(s)" %}',
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// Select which report to print
|
||||
selectReport(
|
||||
response,
|
||||
parts,
|
||||
{
|
||||
success: function(pk) {
|
||||
var href = `/api/report/bom/${pk}/print/?`;
|
||||
|
||||
parts.forEach(function(part) {
|
||||
href += `part=${part}&`;
|
||||
});
|
||||
|
||||
window.location.href = href;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user