diff --git a/src/pages/05_quotation/QuotationFormProductSelect.vue b/src/pages/05_quotation/QuotationFormProductSelect.vue index 36ae84f0..fabc1266 100644 --- a/src/pages/05_quotation/QuotationFormProductSelect.vue +++ b/src/pages/05_quotation/QuotationFormProductSelect.vue @@ -141,7 +141,7 @@ function toggleDelete(node?: Node) { targetItem && deleteItem(selectedItems.value, selectedItems.value.indexOf(targetItem)); targetNode && deleteItem(nodes.value, nodes.value.indexOf(targetNode)); - if (node.type === 'type') { + if (node.type === 'service') { const countProducts = (node: Node[]) => { let count = 0; @@ -365,6 +365,24 @@ function mapNode() { nodes.value = JSON.parse(JSON.stringify(node)); pageState.addModal = false; } + +function countCheckedProducts(array: Node[]) { + let count = 0; + + for (const item of array) { + // Check if both conditions are true + if (item.checked && item.type === 'product') { + count++; + } + // Recursively check children if present + if (Array.isArray(item.children)) { + count += countCheckedProducts(item.children); + } + } + + return count; +} + watch( () => selectedNode.value, (v) => { @@ -563,6 +581,12 @@ watch( $t('general.list', { msg: $t('productService.title'), }) + }}, + {{ + $t('general.selected', { + number: countCheckedProducts(nodes), + msg: $t('productService.product.product'), + }) }}