diff --git a/InvenTree/templates/js/barcode.js b/InvenTree/templates/js/barcode.js index 990adc1a0b..8308086afb 100644 --- a/InvenTree/templates/js/barcode.js +++ b/InvenTree/templates/js/barcode.js @@ -75,7 +75,7 @@ function postBarcodeData(barcode_data, options={}) { enableBarcodeInput(modal, true); if (status == 'success') { - + if ('success' in response) { if (options.onScan) { options.onScan(response); @@ -125,7 +125,7 @@ function enableBarcodeInput(modal, enabled=true) { var barcode = $(modal + ' #barcode'); barcode.prop('disabled', !enabled); - + modalEnable(modal, enabled); barcode.focus(); @@ -157,14 +157,14 @@ function barcodeDialog(title, options={}) { var barcode = getBarcodeData(modal); if (barcode && barcode.length > 0) { - + postBarcodeData(barcode, options); } } $(modal).on('shown.bs.modal', function() { $(modal + ' .modal-form-content').scrollTop(0); - + var barcode = $(modal + ' #barcode'); // Handle 'enter' key on barcode @@ -210,10 +210,10 @@ function barcodeDialog(title, options={}) { var content = ''; content += `
{% trans "Scan barcode data below" %}
`; - + content += `
`; content += `
`; - + // Optional content before barcode input content += `
`; content += options.headerContent || ''; @@ -254,14 +254,14 @@ function barcodeScanDialog() { */ var modal = '#modal-form'; - + barcodeDialog( "Scan Barcode", { onScan: function(response) { if ('url' in response) { $(modal).modal('hide'); - + // Redirect to the URL! window.location.href = response.url; } else { @@ -399,7 +399,7 @@ function barcodeCheckIn(location_id, options={}) { break; } } - + if (match) { reloadTable(); } @@ -429,9 +429,9 @@ function barcodeCheckIn(location_id, options={}) { onSubmit: function() { // Called when the 'check-in' button is pressed - + var data = {location: location_id}; - + // Extract 'notes' field data.notes = $(modal + ' #notes').val(); diff --git a/InvenTree/templates/js/bom.js b/InvenTree/templates/js/bom.js index 5b62955499..462db6eba4 100644 --- a/InvenTree/templates/js/bom.js +++ b/InvenTree/templates/js/bom.js @@ -33,7 +33,7 @@ function removeRowFromBomWizard(e) { var colNum = 0; table.find('tr').each(function() { - + colNum++; if (colNum >= 3) { @@ -111,9 +111,9 @@ function loadBomTable(table, options) { if (options.part_detail) { params.part_detail = true; } - + params.sub_part_detail = true; - + var filters = {}; if (!options.disableFilters) { @@ -173,7 +173,7 @@ function loadBomTable(table, options) { // Display an extra icon if this part is an assembly if (sub_part.assembly) { var text = ``; - + html += renderLink(text, `/part/${row.sub_part}/bom/`); } @@ -182,7 +182,7 @@ function loadBomTable(table, options) { } ); - + // Part description cols.push( { @@ -325,7 +325,7 @@ function loadBomTable(table, options) { sortable: true, } ) - + // Part notes cols.push( { @@ -348,18 +348,18 @@ function loadBomTable(table, options) { if (row.part == options.parent_id) { var bValidate = ``; - + var bValid = ``; var bEdit = ``; var bDelt = ``; - + var html = "
"; - + html += bEdit; html += bDelt; - + if (!row.validated) { html += bValidate; } else { @@ -394,7 +394,7 @@ function loadBomTable(table, options) { { success: function(response) { for (var idx = 0; idx < response.length; idx++) { - + response[idx].parentId = bom_pk; if (response[idx].sub_part_detail.assembly) { @@ -412,7 +412,7 @@ function loadBomTable(table, options) { } ) } - + table.inventreeTable({ treeEnable: !options.editable, rootParentId: parent_id, @@ -497,7 +497,7 @@ function loadBomTable(table, options) { var pk = $(this).attr('pk'); var url = `/part/bom/${pk}/delete/`; - + launchModalForm( url, { @@ -509,7 +509,7 @@ function loadBomTable(table, options) { }); table.on('click', '.bom-edit-button', function() { - + var pk = $(this).attr('pk'); var url = `/part/bom/${pk}/edit/`; @@ -524,7 +524,7 @@ function loadBomTable(table, options) { }); table.on('click', '.bom-validate-button', function() { - + var pk = $(this).attr('pk'); var url = `/api/bom/${pk}/validate/`; diff --git a/InvenTree/templates/js/build.js b/InvenTree/templates/js/build.js index d4ceb9c909..0233974741 100644 --- a/InvenTree/templates/js/build.js +++ b/InvenTree/templates/js/build.js @@ -49,7 +49,7 @@ function makeBuildOutputActionButtons(output, buildInfo, lines) { function reloadTable() { $(panel).find(`#allocation-table-${outputId}`).bootstrapTable('refresh'); } - + // Find the div where the buttons will be displayed var buildActions = $(panel).find(`#output-actions-${outputId}`); @@ -82,7 +82,7 @@ function makeBuildOutputActionButtons(output, buildInfo, lines) { //disabled: true } ); - + // Add a button to "delete" the particular build output html += makeIconButton( 'fa-trash-alt icon-red', 'button-output-delete', outputId, @@ -171,7 +171,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { var partId = buildInfo.part; var outputId = null; - + if (output) { outputId = output.pk; } else { @@ -179,7 +179,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { } var table = options.table; - + if (options.table == null) { table = `#allocation-table-${outputId}`; } @@ -187,7 +187,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { // If an "output" is specified, then only "trackable" parts are allocated // Otherwise, only "untrackable" parts are allowed var trackable = ! !output; - + function reloadTable() { // Reload the entire build allocation table $(table).bootstrapTable('refresh'); @@ -492,7 +492,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { if (row.stock_item_detail.location) { var text = row.stock_item_detail.location_name; var url = `/stock/location/${row.stock_item_detail.location}/`; - + return renderLink(text, url); } else { return '{% trans "No location set" %}'; @@ -600,7 +600,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { qA *= output.quantity; qB *= output.quantity; - + // Handle the case where both numerators are zero if ((aA == 0) && (aB == 0)) { return (qA > qB) ? 1 : -1; @@ -610,7 +610,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { if ((qA == 0) || (qB == 0)) { return 1; } - + var progressA = parseFloat(aA) / qA; var progressB = parseFloat(aB) / qB; @@ -618,7 +618,7 @@ function loadBuildOutputAllocationTable(buildInfo, output, options={}) { if (progressA == progressB) { return (qA < qB) ? 1 : -1; } - + return (progressA < progressB) ? 1 : -1; } }, @@ -670,7 +670,7 @@ function loadBuildTable(table, options) { var filters = {}; params['part_detail'] = true; - + if (!options.disableFilters) { filters = loadTableFilters("build"); } @@ -801,11 +801,11 @@ function loadBuildTable(table, options) { function updateAllocationTotal(id, count, required) { - + count = parseFloat(count); - + $('#allocation-total-'+id).html(count); - + var el = $("#allocation-panel-" + id); el.removeClass('part-allocation-pass part-allocation-underallocated part-allocation-overallocated'); @@ -819,7 +819,7 @@ function updateAllocationTotal(id, count, required) { } function loadAllocationTable(table, part_id, part, url, required, button) { - + // Load the allocation table table.bootstrapTable({ url: url, @@ -848,9 +848,9 @@ function loadAllocationTable(table, part_id, part, url, required, button) { var bEdit = ""; var bDel = ""; - + html += "
" + bEdit + bDel + "
"; - + return html; } } @@ -992,7 +992,7 @@ function loadBuildPartsTable(table, options={}) { // Display an extra icon if this part is an assembly if (sub_part.assembly) { var text = ``; - + html += renderLink(text, `/part/${row.sub_part}/bom/`); } diff --git a/InvenTree/templates/js/company.js b/InvenTree/templates/js/company.js index d258c8bab1..be4b707466 100644 --- a/InvenTree/templates/js/company.js +++ b/InvenTree/templates/js/company.js @@ -39,11 +39,11 @@ function loadCompanyTable(table, url, options={}) { if (row.is_customer) { html += ``; } - + if (row.is_manufacturer) { html += ``; } - + if (row.is_supplier) { html += ``; } diff --git a/InvenTree/templates/js/filters.js b/InvenTree/templates/js/filters.js index 612af8e03c..a27e91d5dc 100644 --- a/InvenTree/templates/js/filters.js +++ b/InvenTree/templates/js/filters.js @@ -185,11 +185,11 @@ function getFilterOptionList(tableKey, filterKey) { function generateAvailableFilterList(tableKey) { var remaining = getRemainingTableFilters(tableKey); - + var id = 'filter-tag-' + tableKey.toLowerCase(); var html = `