From 9fd830f21d5424f5463a783a0076f939cc27872a Mon Sep 17 00:00:00 2001 From: Srinivas-Saravanan Date: Fri, 9 May 2025 10:49:14 +0530 Subject: [PATCH] FIX_VALIDATION_FOR_RISK_SPLITUP --- app/Views/policyRegisterModel.php | 57 +++++++++++++++++++------------ 1 file changed, 36 insertions(+), 21 deletions(-) diff --git a/app/Views/policyRegisterModel.php b/app/Views/policyRegisterModel.php index c5f41032..1e12dbbe 100644 --- a/app/Views/policyRegisterModel.php +++ b/app/Views/policyRegisterModel.php @@ -425,10 +425,10 @@ } // console.log("form from : ", formDataSplitUp); - if (productSelectionData.multipleProduct == 'on') { - let selectionType = productSelectionData.multilocation_type; + // if (productSelectionData.multipleProduct == 'on') { + // let selectionType = productSelectionData.multilocation_type; - if (selectionType == 'multiFloater') { + // if (selectionType == 'multiFloater') { let InProcess = [...document.querySelectorAll('[id^="stockInProcess_"]')].map(el => Number(el.value) || 0); let rawMaterial = [...document.querySelectorAll('[id^="rawMaterial_"]')].map(el => Number(el.value) || 0); let findMaterial = [...document.querySelectorAll('[id^="finishedStock_"]')].map(el => Number(el.value) || 0); @@ -456,16 +456,16 @@ return false; } // console.log("Total SI: ", totalSI); - } else { - let InProcess = [...document.querySelectorAll('[id^="stockInProcess_"]')].map(el => Number(el.value) || 0); - let rawMaterial = [...document.querySelectorAll('[id^="rawMaterial_"]')].map(el => Number(el.value) || 0); - let findMaterial = [...document.querySelectorAll('[id^="finishedStock_"]')].map(el => Number(el.value) || 0); + // } else { + // let InProcess = [...document.querySelectorAll('[id^="stockInProcess_"]')].map(el => Number(el.value) || 0); + // let rawMaterial = [...document.querySelectorAll('[id^="rawMaterial_"]')].map(el => Number(el.value) || 0); + // let findMaterial = [...document.querySelectorAll('[id^="finishedStock_"]')].map(el => Number(el.value) || 0); - totalSI = InProcess.reduce((acc, val) => acc + val, 0) + - rawMaterial.reduce((acc, val) => acc + val, 0) + - findMaterial.reduce((acc, val) => acc + val, 0); - } - } + // totalSI = InProcess.reduce((acc, val) => acc + val, 0) + + // rawMaterial.reduce((acc, val) => acc + val, 0) + + // findMaterial.reduce((acc, val) => acc + val, 0); + // } + // } // console.log("Form is trying to submit : ", formDataSplitUp); @@ -657,17 +657,32 @@ // alert("you got ir"); console.log("increment2",increment2); console.log("policyRiskAddress.length",policyRiskAddress.length); - if (increment2 <= policyRiskAddress.length) { + policyRiskAddress.forEach(function() { - // console.log("increment count is ", increment2) - addHTMLInputForRiskSplitUP(); - validatePolicyBasedOnProductSelection(); - hideAndShowBurglary(); + if (increment2 <= policyRiskAddress.length) { + // console.log("increment count is ", increment2) + addHTMLInputForRiskSplitUP(); + validatePolicyBasedOnProductSelection(); + hideAndShowBurglary(); + } + }) - }else { - alert("fdg"); - } - } + // else { + // const container = document.getElementById("addRiskSplitUp"); + // container.innerHTML = ""; + // increment2 = 1; + // if (increment2 <= policyRiskAddress.length) { + // policyRiskAddress.forEach(function() { + // // console.log("increment count is ", increment2) + // addHTMLInputForRiskSplitUP(); + // validatePolicyBasedOnProductSelection(); + // hideAndShowBurglary(); + // // increment2++; + // }) + // // alert("fdg"); + // } + // } + } } else { if (contianertoCheck.innerHTML == "") { addHTMLInputForRiskSplitUpWarninig();