From 6529c78e32e71a07b76f80bcbedf05645a7f9d62 Mon Sep 17 00:00:00 2001 From: liumengyi Date: Wed, 1 Mar 2023 02:52:05 +0000 Subject: [PATCH] * Finish task #85646. --- module/project/js/edit.js | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/module/project/js/edit.js b/module/project/js/edit.js index c1353908a1..fdc708019d 100644 --- a/module/project/js/edit.js +++ b/module/project/js/edit.js @@ -62,6 +62,13 @@ $(function() bootbox.alert(unLinkProductTip.replace("%s", allProducts[last])); } } + var chosenProducts = 0; + $(".productsBox select[name^='products']").each(function() + { + if($(this).val() > 0) chosenProducts ++; + }); + if(chosenProducts > 1) $('.division').removeClass('hide'); + if(chosenProducts <= 1) $('.division').addClass('hide'); }); $(document).on('change', '[name*=branch]', function() @@ -198,7 +205,7 @@ function loadBranches(product) } }); - (chosenProducts.length > 1 && model == 'waterfall') ? $('.division').removeClass('hide') : $('.division').addClass('hide'); + (chosenProducts.length > 1 && model == 'waterfall' && model == 'waterfallplus') ? $('.division').removeClass('hide') : $('.division').addClass('hide'); var $tableRow = $(product).closest('.table-row'); var index = $tableRow.find('select:first').attr('id').replace('products' , ''); @@ -255,15 +262,15 @@ function loadPlans(product, branch) /** * Add new line for link product. - * - * @param obj $obj + * + * @param obj $obj * @access public * @return void */ function addNewLine(obj) { var newLine = $(obj).closest('tr').clone(); - var index = 0; + var index = 0; $(".productsBox select[name^='products']").each(function() { var id = $(this).attr('id').replace('products' , ''); @@ -294,5 +301,5 @@ function removeLine(obj) { $(obj).closest('tr').remove(); disableSelectedProduct(); - if($("select[name^='products']").length < 2) $('.division').addClass('hide'); + if($("select[name^='products']").length < 2) $('.division').addClass('hide'); }