From 2d1776a151721d65d0ae007049d358085b2fcfd5 Mon Sep 17 00:00:00 2001 From: Oliver Date: Wed, 25 May 2022 23:35:53 +1000 Subject: [PATCH] Refactor 'DeleteManufacturerPart' form (#3067) * Refactor 'DeleteManufacturerPart' form - Remove duplicated forms - Update style to match other forms - Block on each deletion before progressing to the next one * PEP fix * Adds deleteSupplierParts function * Refactor all instances of supplier part deletion * Refactor tractor : use convenience function for bootstraptable.getSelections * Add deleter for manufacturerpartparameter. Refactor existing code into a single function * Refactor deletion for stock items * JS linting --- InvenTree/build/templates/build/detail.html | 6 +- InvenTree/build/templates/build/index.html | 3 +- .../company/templates/company/detail.html | 43 ++-- .../templates/company/manufacturer_part.html | 107 +++----- .../company/manufacturer_part_sidebar.html | 4 +- .../order/purchase_order_detail.html | 6 +- .../templates/order/purchase_orders.html | 2 +- .../order/templates/order/sales_orders.html | 2 +- InvenTree/part/templates/part/detail.html | 40 +-- InvenTree/stock/templates/stock/location.html | 2 +- InvenTree/templates/js/translated/api.js | 45 ++++ InvenTree/templates/js/translated/bom.js | 37 +-- InvenTree/templates/js/translated/build.js | 25 +- InvenTree/templates/js/translated/company.js | 238 +++++++++++++----- InvenTree/templates/js/translated/forms.js | 24 +- InvenTree/templates/js/translated/modals.js | 11 + InvenTree/templates/js/translated/part.js | 4 +- InvenTree/templates/js/translated/stock.js | 45 ++-- InvenTree/templates/js/translated/tables.js | 18 ++ 19 files changed, 371 insertions(+), 291 deletions(-) diff --git a/InvenTree/build/templates/build/detail.html b/InvenTree/build/templates/build/detail.html index dca3fe359d..3b612bcfed 100644 --- a/InvenTree/build/templates/build/detail.html +++ b/InvenTree/build/templates/build/detail.html @@ -527,11 +527,7 @@ $('#btn-unallocate').on('click', function() { $('#allocate-selected-items').click(function() { - var bom_items = $("#allocation-table-untracked").bootstrapTable("getSelections"); - - if (bom_items.length == 0) { - bom_items = $("#allocation-table-untracked").bootstrapTable('getData'); - } + var bom_items = getTableData('#allocation-table-untracked'); allocateStockToBuild( {{ build.pk }}, diff --git a/InvenTree/build/templates/build/index.html b/InvenTree/build/templates/build/index.html index 4dbf2aba7a..a70d5d0d95 100644 --- a/InvenTree/build/templates/build/index.html +++ b/InvenTree/build/templates/build/index.html @@ -185,8 +185,7 @@ loadBuildTable($("#build-table"), { {% if report_enabled %} $('#multi-build-print').click(function() { - var rows = $("#build-table").bootstrapTable('getSelections'); - + var rows = getTableData("#build-table"); var build_ids = []; rows.forEach(function(row) { diff --git a/InvenTree/company/templates/company/detail.html b/InvenTree/company/templates/company/detail.html index 9ae40f0833..a5e2e159fc 100644 --- a/InvenTree/company/templates/company/detail.html +++ b/InvenTree/company/templates/company/detail.html @@ -28,8 +28,8 @@
-