FIX_REMOVE_PROPOSAL_RFQNONEB
This commit is contained in:
parent
37d17e47f1
commit
1c11c9e13e
@ -238,19 +238,19 @@
|
||||
<script>
|
||||
var totalSI;
|
||||
var finalData = {};
|
||||
console.log("policyName : ", $('#policyName').val());
|
||||
// console.log("policyName : ", $('#policyName').val());
|
||||
var policyName = $('#policyName').val();
|
||||
const occupancyMaster = <?= json_encode($occupancy) ?>;
|
||||
console.log("Occupancy : ", occupancyMaster);
|
||||
// console.log("Occupancy : ", occupancyMaster);
|
||||
var storedPolicyData = {};
|
||||
storedPolicyData = JSON.parse(localStorage.getItem('policyData'));
|
||||
$(document).ready(function() {
|
||||
// resetAllform();
|
||||
console.log("Stored date Found : ", typeof(storedPolicyData));
|
||||
// console.log("Stored date Found : ", typeof(storedPolicyData));
|
||||
if (!$.isEmptyObject(storedPolicyData)) {
|
||||
// prepareDataForEdit(storedPolicyData);
|
||||
} else {
|
||||
console.log("inside else trying to open product sleection tab");
|
||||
// console.log("inside else trying to open product sleection tab");
|
||||
// const productSelectionTab = new bootstrap.Tab(document.getElementById);
|
||||
const productSelectionTab = new bootstrap.Tab(document.getElementById('product-selection-tab'));
|
||||
productSelectionTab.show();
|
||||
@ -306,22 +306,22 @@
|
||||
});
|
||||
|
||||
$('#productSelectionForm').submit(function(event) {
|
||||
console.log("Submit function called");
|
||||
// console.log("Submit function called");
|
||||
event.preventDefault();
|
||||
var isValid = $('#productSelectionForm').parsley().validate();
|
||||
console.log('isValid', isValid)
|
||||
// console.log('isValid', isValid)
|
||||
|
||||
if (!isValid) {
|
||||
$('#productSelectionForm').find('input, select, textarea').each(function() {
|
||||
if ($(this).parsley().isValid() === false && !$(this).val()) {
|
||||
console.log('Empty field ID:', this.id);
|
||||
// console.log('Empty field ID:', this.id);
|
||||
}
|
||||
});
|
||||
console.log('Form is Empty', 'Warning');
|
||||
// console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
productSelectionData = {};
|
||||
// console.log("submit function is clicked");
|
||||
// // console.log("submit function is clicked");
|
||||
// event.preventDefault();
|
||||
var formDataProductSelection = $("#productSelectionForm").serializeArray();
|
||||
|
||||
@ -340,14 +340,14 @@
|
||||
policydetailsOpen();
|
||||
|
||||
}
|
||||
console.log("form data product selection : ", productSelectionData);
|
||||
// console.log("form data product selection : ", productSelectionData);
|
||||
|
||||
|
||||
})
|
||||
|
||||
function policydetailsOpen() {
|
||||
// PolicyTabOpened();
|
||||
console.log("function is called");
|
||||
// console.log("function is called");
|
||||
// Use the ID for the Policy Details tab button.
|
||||
// const policyDetailsTab = new bootstrap.Tab(document.getElementById('policy-details-tab'));
|
||||
const policyDetailsTab = new bootstrap.Tab(document.getElementById('policy-details-tab'));
|
||||
@ -361,15 +361,15 @@
|
||||
|
||||
|
||||
var isValid = $('#policyRiskSplitUpForm').parsley().validate();
|
||||
console.log('isValid', isValid);
|
||||
// console.log('isValid', isValid);
|
||||
|
||||
if (!isValid) {
|
||||
$('#policyRiskSplitUpForm').find('input, select, textarea').each(function() {
|
||||
if ($(this).parsley().isValid() === false && !$(this).val()) {
|
||||
console.log('Empty field ID:', this.id);
|
||||
// console.log('Empty field ID:', this.id);
|
||||
}
|
||||
});
|
||||
console.log('Form is Empty', 'Warning');
|
||||
// console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
@ -393,7 +393,7 @@
|
||||
value: $(`#lossIN3Years_${i}`).is(':checked') ? 'on' : 'off'
|
||||
});
|
||||
}
|
||||
console.log("form from : ", formDataSplitUp);
|
||||
// console.log("form from : ", formDataSplitUp);
|
||||
|
||||
if (productSelectionData.multipleProduct == 'on') {
|
||||
let selectionType = productSelectionData.multilocation_type;
|
||||
@ -413,11 +413,19 @@
|
||||
toastr.error("Sum Insured Exceeds Allowed Limit", "ERROR");
|
||||
return false;
|
||||
}
|
||||
console.log("Total SI: ", totalSI);
|
||||
// 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);
|
||||
|
||||
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);
|
||||
// console.log("Form is trying to submit : ", formDataSplitUp);
|
||||
|
||||
const groupData = [];
|
||||
|
||||
@ -454,7 +462,7 @@
|
||||
|
||||
|
||||
policyRiskSplitUpData = groupData;
|
||||
console.log("Grouped Data as Objects: ", policyRiskSplitUpData);
|
||||
// console.log("Grouped Data as Objects: ", policyRiskSplitUpData);
|
||||
|
||||
savePolicyDataLocal();
|
||||
});
|
||||
@ -464,15 +472,15 @@
|
||||
$("#policyRiskAddressForm").submit(function(event) {
|
||||
event.preventDefault();
|
||||
var isValid = $('#policyRiskAddressForm').parsley().validate();
|
||||
console.log('isValid', isValid)
|
||||
// console.log('isValid', isValid)
|
||||
|
||||
if (!isValid) {
|
||||
$('#policyRiskAddressForm').find('input, select, textarea').each(function() {
|
||||
if ($(this).parsley().isValid() === false && !$(this).val()) {
|
||||
console.log('Empty field ID:', this.id);
|
||||
// console.log('Empty field ID:', this.id);
|
||||
}
|
||||
});
|
||||
console.log('Form is Empty', 'Warning');
|
||||
// console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
const formData = $("#policyRiskAddressForm").serializeArray();
|
||||
@ -505,7 +513,7 @@
|
||||
});
|
||||
|
||||
policyRiskAddress = groupedData;
|
||||
console.log("Grouped Data as Objects: ", policyRiskAddress);
|
||||
// console.log("Grouped Data as Objects: ", policyRiskAddress);
|
||||
|
||||
if (productSelectionData.singleProduct == 'on') {
|
||||
savePolicyDataLocal();
|
||||
@ -518,25 +526,25 @@
|
||||
|
||||
event.preventDefault();
|
||||
var isValid = $('#policyDetailsForm').parsley().validate();
|
||||
console.log('isValid', isValid)
|
||||
// console.log('isValid', isValid)
|
||||
|
||||
if (!isValid) {
|
||||
$('#policyDetailsForm').find('input, select, textarea').each(function() {
|
||||
if ($(this).parsley().isValid() === false && !$(this).val()) {
|
||||
console.log('Empty field ID:', this.id);
|
||||
// console.log('Empty field ID:', this.id);
|
||||
}
|
||||
});
|
||||
console.log('Form is Empty', 'Warning');
|
||||
// console.log('Form is Empty', 'Warning');
|
||||
return;
|
||||
}
|
||||
var formData = $("#policyDetailsForm").serializeArray();
|
||||
$.each(formData, function(i, field) {
|
||||
policyDetailsData[field.name] = field.value;
|
||||
});
|
||||
// console.log("form data", policyDetailsData.location_no);
|
||||
// // console.log("form data", policyDetailsData.location_no);
|
||||
|
||||
if (formData !== null && formData !== '') {
|
||||
console.log("form submitted trying to open the ris info tab");
|
||||
// console.log("form submitted trying to open the ris info tab");
|
||||
// riskInfoTabOpened();
|
||||
const riskTab = new bootstrap.Tab(document.getElementById('risk-info-tab'));
|
||||
riskTab.show();
|
||||
@ -567,11 +575,11 @@
|
||||
}
|
||||
} else if (e.target.id === 'risk-splitup-tab') {
|
||||
contianertoCheck = document.getElementById("addRiskSplitUp");
|
||||
console.log("policy det", policyRiskAddress.length)
|
||||
// console.log("policy det", policyRiskAddress.length)
|
||||
if (!$.isEmptyObject(policyRiskAddress)) {
|
||||
if (increment2 == 1) {
|
||||
policyRiskAddress.forEach(function() {
|
||||
console.log("increment count is ", increment2)
|
||||
// console.log("increment count is ", increment2)
|
||||
addHTMLInputForRiskSplitUP();
|
||||
validatePolicyBasedOnProductSelection();
|
||||
hideAndShowBurglary();
|
||||
@ -585,20 +593,20 @@
|
||||
|
||||
}
|
||||
} else if (e.target.id === 'risk-info-tab') {
|
||||
console.log("function called ");
|
||||
// console.log("function called ");
|
||||
contianertoCheck = document.getElementById("addRiskInfo");
|
||||
|
||||
// console.log("policy details data ", policyDetailsData);
|
||||
// // console.log("policy details data ", policyDetailsData);
|
||||
if (!$.isEmptyObject(policyDetailsData)) {
|
||||
if (increment == 1) {
|
||||
console.log("inside if ");
|
||||
// console.log("inside if ");
|
||||
addHTMLInputForRiskAddress();
|
||||
$('select[id^="occupancy_"]').select2();
|
||||
validatePolicyBasedOnProductSelection();
|
||||
|
||||
}
|
||||
} else {
|
||||
console.log("inside else ");
|
||||
// console.log("inside else ");
|
||||
|
||||
if (contianertoCheck.innerHTML == "") {
|
||||
addHTMLInputForRiskAddressWarninig();
|
||||
@ -624,11 +632,11 @@
|
||||
}
|
||||
|
||||
function addHTMLInputForRiskSplitUP() {
|
||||
// console.log("Function called ", increment2, " times");
|
||||
// // console.log("Function called ", increment2, " times");
|
||||
const container = document.getElementById("addRiskSplitUp");
|
||||
// container.innerHTML = '';
|
||||
const newRowRisk = document.createElement("div");
|
||||
// console.log("Risk Split Up for address : ", policyRiskAddress.length)
|
||||
// // console.log("Risk Split Up for address : ", policyRiskAddress.length)
|
||||
// policyRiskAddress
|
||||
|
||||
newRowRisk.innerHTML += `
|
||||
@ -743,7 +751,7 @@
|
||||
const container = document.getElementById('addRiskInfo');
|
||||
// container.innerHTML = "";
|
||||
const newRow = document.createElement('div');
|
||||
// console.log("policy details ", policyDetailsData);
|
||||
// // console.log("policy details ", policyDetailsData);
|
||||
newRow.className = 'form-row dynamic-form-row mb-3';
|
||||
|
||||
newRow2 = document.createElement("div");
|
||||
@ -882,8 +890,8 @@
|
||||
$(document).on('click', '.duplicate-btn', function() {
|
||||
|
||||
|
||||
console.log("button is clicked");
|
||||
console.log("increment cout ", increment);
|
||||
// console.log("button is clicked");
|
||||
// console.log("increment cout ", increment);
|
||||
|
||||
|
||||
if (policyDetailsData.location_no >= increment) {
|
||||
@ -933,7 +941,7 @@
|
||||
})
|
||||
|
||||
function addOrRemoveAdd() {
|
||||
console.log("chceck box clicked");
|
||||
// console.log("chceck box clicked");
|
||||
if ($("#sameAsCommunicationAddress").is(":checked")) {
|
||||
$("#pin_code_1").val(policyDetailsData.pin_code);
|
||||
$("#address1_1").val(policyDetailsData.address1);
|
||||
@ -952,7 +960,7 @@
|
||||
|
||||
|
||||
if (selectedProduct.singleProduct == 'on') {
|
||||
console.log("inside if ");
|
||||
// console.log("inside if ");
|
||||
$('[class*="single_location"]').show();
|
||||
$("#locationNoDIV").hide();
|
||||
$("#location_no").removeAttr("required", false);
|
||||
@ -970,7 +978,7 @@
|
||||
|
||||
|
||||
} else if (selectedProduct.multipleProduct == 'on') {
|
||||
console.log("inside elseif");
|
||||
// console.log("inside elseif");
|
||||
$('[class*="single_location"]').hide().removeAttr('required');
|
||||
// $('[class*="single_location_occupancy"]').hide().removeAttr('required');
|
||||
$('[class*="multi_location_company"]').show();
|
||||
@ -1002,28 +1010,28 @@
|
||||
// alert(element);
|
||||
var selectedOccupancy = $(`#${element}`).val();
|
||||
var selectedOccupancyMasterRow = occupancyMaster.find(iib => iib.id == selectedOccupancy);
|
||||
console.log("selected occupancy masater ", selectedOccupancyMasterRow)
|
||||
console.log("selected occupancy masater ", occupancyMaster)
|
||||
// console.log("selected occupancy masater ", selectedOccupancyMasterRow)
|
||||
// console.log("selected occupancy masater ", occupancyMaster)
|
||||
|
||||
var iibCODE = selectedOccupancyMasterRow.iib_code;
|
||||
console.log("selected occupancy masater ", iibCODE)
|
||||
// console.log("selected occupancy masater ", iibCODE)
|
||||
var elementID = element;
|
||||
let increment = elementID.split("_").pop();
|
||||
console.log("selected occupancy masater increment ", increment)
|
||||
console.log("selected occupancy masater element ", $(`#iibCode_${increment}`))
|
||||
// console.log("selected occupancy masater increment ", increment)
|
||||
// console.log("selected occupancy masater element ", $(`#iibCode_${increment}`))
|
||||
setTimeout(function() {
|
||||
$(`#iibCode_${increment}`).val(iibCODE); // Set the value
|
||||
console.log("Selected --------------------", $(`#iibCode_${increment}`).val()); // Log the value
|
||||
// console.log("Selected --------------------", $(`#iibCode_${increment}`).val()); // Log the value
|
||||
}, 1000);
|
||||
|
||||
|
||||
}
|
||||
console.log("onchange occupancy function called ");
|
||||
// console.log("onchange occupancy function called ");
|
||||
|
||||
// console.log("onchange occupancy function called ", selectedOccupancy);
|
||||
// console.log("onchange occupancy function called ", selectedOccupancyMasterRow);
|
||||
// console.log("onchange occupancy function called ", iibCODE);
|
||||
// console.log("onchange occupancy function called ", increment);
|
||||
// // console.log("onchange occupancy function called ", selectedOccupancy);
|
||||
// // console.log("onchange occupancy function called ", selectedOccupancyMasterRow);
|
||||
// // console.log("onchange occupancy function called ", iibCODE);
|
||||
// // console.log("onchange occupancy function called ", increment);
|
||||
|
||||
|
||||
$('[class*="common_location_occupancy"]').show().prop("required", "required");
|
||||
@ -1032,22 +1040,22 @@
|
||||
$('[class*="single_location_occupancy"]').show().prop("required", "required");
|
||||
|
||||
} else if (selectedProduct.multipleProduct == 'on') {
|
||||
// console.log("Muliple location");f
|
||||
// // console.log("Muliple location");f
|
||||
$('[class*="multiLocationOccupancy"]').show().prop('required', 'required');
|
||||
|
||||
if (selectedProduct.multilocation_type == "multiLocation") {
|
||||
|
||||
// console.log("multiple location without Floater");
|
||||
// // console.log("multiple location without Floater");
|
||||
$('[class*="multiLocationOccupancyWithoutFloater"]').show().prop('required', 'required');
|
||||
|
||||
} else if (selectedProduct.multilocation_type == "multiFloater") {
|
||||
|
||||
// console.log("Muliple location With Floater");
|
||||
// // console.log("Muliple location With Floater");
|
||||
$('[class*="multiLocationOccupancyWithoutFloater"]').hide().removeAttr('required', false);
|
||||
|
||||
} else if (selectedProduct.multilocation_type == "stockFloater") {
|
||||
|
||||
// console.log("multiple location with stock floater");
|
||||
// // console.log("multiple location with stock floater");
|
||||
$('[class*="multiLocationOccupancyWithoutFloater"]').show().prop('required', 'required');
|
||||
$('[class*="stockSI"]').hide().removeAttr('required', false);
|
||||
}
|
||||
@ -1109,7 +1117,7 @@
|
||||
// Ensure policyName is correctly retrieved
|
||||
var policyName = $('#policyName').val();
|
||||
if (!policyName) {
|
||||
console.error("Policy name is undefined. Cannot save data.");
|
||||
// console.error("Policy name is undefined. Cannot save data.");
|
||||
return;
|
||||
}
|
||||
policyName = policyName.toLowerCase();
|
||||
@ -1120,7 +1128,7 @@
|
||||
localStorage.setItem('policyData', JSON.stringify(existingData));
|
||||
if (!$.isEmptyObject(existingData)) {
|
||||
|
||||
console.log("DATA FROM DB : ", (existingData));
|
||||
// console.log("DATA FROM DB : ", (existingData));
|
||||
let data = (existingData);
|
||||
Object.keys(data).forEach(key => {
|
||||
|
||||
@ -1133,7 +1141,7 @@
|
||||
toastr.success("Policy Information Collected ","SUCCESS");
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.log("Updated policy data in localStorage:", existingData);
|
||||
// console.log("Updated policy data in localStorage:", existingData);
|
||||
}
|
||||
|
||||
function saveTODB(data, leadID) {
|
||||
@ -1141,7 +1149,7 @@
|
||||
var url = '<?= base_url('rfq/savePolicyInfo') ?>';
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
console.log("trying to submit data : ", data, " with this lead id : ", leadID);
|
||||
// console.log("trying to submit data : ", data, " with this lead id : ", leadID);
|
||||
$.ajax({
|
||||
url: url,
|
||||
data: {
|
||||
@ -1163,8 +1171,8 @@
|
||||
error: function(xhr, status, error) {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
// console.error(xhr.responseText);
|
||||
// console.error(status, error);
|
||||
}
|
||||
})
|
||||
}
|
||||
@ -1188,14 +1196,14 @@
|
||||
|
||||
// alert("Data restored to original variables.");
|
||||
} else {
|
||||
console.log("No policy data found in local storage.");
|
||||
// console.log("No policy data found in local storage.");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function prepareDataForEdit(data) {
|
||||
// alert(policyName);
|
||||
console.log("Prepare data : ",data);
|
||||
// console.log("Prepare data : ",data);
|
||||
if (policyName == "Fire") {
|
||||
data = data.fire;
|
||||
if (!data) {
|
||||
@ -1215,7 +1223,7 @@
|
||||
}else{
|
||||
// alert("nothing");
|
||||
}
|
||||
console.log("policy data : ", data);
|
||||
// console.log("policy data : ", data);
|
||||
// Populate Product Selection
|
||||
|
||||
// Show first tab
|
||||
@ -1233,7 +1241,7 @@
|
||||
|
||||
$('#singleProduct').prop('checked', data.productSelection.singleProduct === 'on');
|
||||
$('#multipleProduct').prop('checked', data.productSelection.multipleProduct === 'on');
|
||||
console.log($('#multipleProduct').is(":checked") ? "yes" : "no");
|
||||
// console.log($('#multipleProduct').is(":checked") ? "yes" : "no");
|
||||
$('#multipleProduct').is(":checked") ? $('#multilocation_type').show() : $('#multilocation_type').hide();
|
||||
$('#multilocation_type').val(data.productSelection.multilocation_type);
|
||||
$("#client_type").val(data.productSelection.client_type);
|
||||
@ -1247,7 +1255,7 @@
|
||||
const policyDetails = data.policyDetails;
|
||||
Object.keys(policyDetails).forEach(key => {
|
||||
$(`#${key}`).val(policyDetails[key]);
|
||||
// console.log("Key ",key," set value : ",policyDetails[key]);
|
||||
// // console.log("Key ",key," set value : ",policyDetails[key]);
|
||||
});
|
||||
|
||||
// Populate Risk Addresses
|
||||
@ -1328,14 +1336,14 @@
|
||||
var mobile = <?= isset($lead_data['client_type']) ? $lead_data['client_type'] : "" ?>;
|
||||
var email = <?= isset($lead_data['client_type']) ? $lead_data['client_type'] : "" ?>;
|
||||
var panNo = <?= isset($lead_data['client_type']) ? $lead_data['client_type'] : "" ?>;
|
||||
console.log("client_type : ".client_type);
|
||||
// console.log("client_type : ".client_type);
|
||||
if (lead_data) {
|
||||
// lead_data = JSON.parse(lead_data);
|
||||
console.log("Lead Data : ", typeof(lead_data));
|
||||
// console.log("Lead Data : ", typeof(lead_data));
|
||||
|
||||
if (lead_data.risk_location == "Single") {
|
||||
|
||||
console.log("single ");
|
||||
// console.log("single ");
|
||||
$("#singleProduct").prop("checked", true).trigger("change");
|
||||
|
||||
} else if (lead_data.risk_location.startsWith("multi")) {
|
||||
@ -1356,9 +1364,9 @@
|
||||
}
|
||||
|
||||
function hideAndShowBurglary() {
|
||||
console.log("hide and show function called ");
|
||||
// console.log("hide and show function called ");
|
||||
policyName = $("#policyName").val();
|
||||
console.log("hiding the other policy not ths : ", policyName);
|
||||
// console.log("hiding the other policy not ths : ", policyName);
|
||||
if (policyName == "Burglary") {
|
||||
$('[class*="burglary"]').show();
|
||||
$('[class*="fire"]').hide().removeAttr('required', false);
|
||||
@ -1369,7 +1377,7 @@
|
||||
}
|
||||
|
||||
function resetAllform() {
|
||||
console.log("FORM RESETED SUCCESSFULLY");
|
||||
// console.log("FORM RESETED SUCCESSFULLY");
|
||||
$("#productSelectionForm")[0].reset();
|
||||
$("#policyDetailsForm")[0].reset();
|
||||
$("#policyRiskAddressForm")[0].reset();
|
||||
@ -1402,7 +1410,7 @@
|
||||
})
|
||||
|
||||
function copyFirePolicy() {
|
||||
console.log("Copying Fire Policy Data...");
|
||||
// console.log("Copying Fire Policy Data...");
|
||||
storedPolicyData = JSON.parse(localStorage.getItem('policyData'));
|
||||
|
||||
if (storedPolicyData.fire) {
|
||||
|
||||
@ -46,12 +46,21 @@
|
||||
/* background-color: #bfe0e2; */
|
||||
}
|
||||
|
||||
.table th[contenteditable],
|
||||
.table td[contenteditable] {
|
||||
border: 1px solid #007bff;
|
||||
outline: none;
|
||||
.table {
|
||||
border: 1px solid #007bff; /* Border around the table */
|
||||
border-collapse: collapse; /* Ensures borders don’t double up */
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.table th,
|
||||
.table td {
|
||||
border: 1px solid #007bff; /* Border for all table cells */
|
||||
padding: 8px; /* Optional: Adds spacing inside cells */
|
||||
text-align: left; /* Optional: Aligns text inside cells */
|
||||
}
|
||||
|
||||
|
||||
|
||||
th:nth-child(2),
|
||||
td:nth-child(2) {
|
||||
width: 720px;
|
||||
@ -188,6 +197,7 @@
|
||||
}
|
||||
|
||||
.table-collapsible-bar {
|
||||
min-width: 1300px;
|
||||
background-color: #f1f1f1;
|
||||
padding: 10px;
|
||||
cursor: pointer;
|
||||
@ -622,9 +632,11 @@
|
||||
|
||||
// Remove a proposal column
|
||||
function removeProposal(proposalNumber) {
|
||||
let startIndex = 0;
|
||||
console.log("Remove Proposal : startIndex 1 ",startIndex);
|
||||
|
||||
// console.log('removeProposal');
|
||||
// console.log(quotesConfig);
|
||||
console.log(quotesConfig);
|
||||
if (!quotesConfig[proposalNumber]) return; // If proposal doesn't exist, exit
|
||||
|
||||
// Remove all child columns for the proposal
|
||||
@ -636,24 +648,29 @@
|
||||
// Find the proposal header and calculate its colspan
|
||||
const proposalHeader = headerRow1.querySelector(`th[data-proposal="${proposalNumber}"]`);
|
||||
if (proposalHeader) {
|
||||
console.log("Remove Proposal : quotesConfig ",quotesConfig[proposalNumber]);
|
||||
console.log("Remove Proposal : proposalHeader ",proposalHeader);
|
||||
|
||||
if (rfq_or_qcr == 1){
|
||||
var colspan = parseInt(quotesConfig[proposalNumber].length);
|
||||
}else{
|
||||
var colspan = parseInt(proposalHeader.getAttribute('colspan'), 10);
|
||||
}
|
||||
|
||||
console.log("Remove Proposal : colspan ",colspan);
|
||||
// Remove the proposal header
|
||||
proposalHeader.remove();
|
||||
|
||||
// Remove corresponding sub-headers in the second header row
|
||||
const subHeaders = headerRow2.querySelectorAll(`th`);
|
||||
let startIndex = 2; // Start after the first two columns (checkbox and Particulars)
|
||||
startIndex = 2; // Start after the first two columns (checkbox and Particulars)
|
||||
console.log("Remove Proposal : startIndex 2",startIndex);
|
||||
for (let i = 1; i < proposalNumber; i++) {
|
||||
startIndex += quotesConfig[i]?.length || 1;
|
||||
startIndex += quotesConfig[i]?.length || 0;
|
||||
console.log("Remove Proposal : startIndex 3",startIndex);
|
||||
}
|
||||
for (let i = 0; i < colspan; i++) {
|
||||
|
||||
console.log("Remove Proposal : colspan ",colspan);
|
||||
console.log("Remove Proposal : startIndex 4",startIndex)
|
||||
headerRow2.removeChild(headerRow2.children[startIndex]);
|
||||
}
|
||||
|
||||
@ -2661,16 +2678,21 @@
|
||||
function setQuotesConfig(overallColumnData) {
|
||||
let quotesConfiguration = {}; // Stores the transformed output
|
||||
let index = 1; // Keeps track of proposal index
|
||||
|
||||
// console.log(overallColumnData);
|
||||
Object.keys(overallColumnData).forEach((proposalKey) => {
|
||||
|
||||
let parts = proposalKey.split(" ");
|
||||
let lastNumber = parseInt(parts[parts.length - 1], 10);
|
||||
index = lastNumber;
|
||||
// console.log(proposalKey);
|
||||
// console.log(index);
|
||||
// console.log(value);
|
||||
let proposal = overallColumnData[proposalKey];
|
||||
let insurersList = proposal.insurers.map(ins => ins.ins_name); // Extract insurer names
|
||||
|
||||
// Create output format: index { "Quote asked", ...insurers }
|
||||
quotesConfiguration[index] = ["Quote asked", ...insurersList];
|
||||
|
||||
index++; // Increment index for next proposal
|
||||
// proposalCount++;
|
||||
});
|
||||
|
||||
return quotesConfiguration;
|
||||
@ -2718,8 +2740,10 @@
|
||||
// Initialize configurations
|
||||
policyConfig = setPolicyConfiguration(proposalDataArray.proposal_data.over_all_column_data);
|
||||
quotesConfig = setQuotesConfig(proposalDataArray.proposal_data.over_all_column_data);
|
||||
proposalCount = Object.keys(proposalDataArray.proposal_data.over_all_column_data).length;
|
||||
|
||||
let keys = Object.keys(quotesConfig);
|
||||
let lastKey = keys[keys.length - 1];
|
||||
proposalCount = lastKey;
|
||||
console.log(proposalCount);
|
||||
// Calculate width increase
|
||||
let increaseBy = rfq_or_qcr == 2 ?
|
||||
getTotalCount(proposalDataArray) * 150 :
|
||||
@ -2801,7 +2825,7 @@
|
||||
}else {
|
||||
td.innerHTML = "";
|
||||
}
|
||||
td.contentEditable = true;
|
||||
// td.contentEditable = true;
|
||||
// td.classList.add("readonly-select");
|
||||
}
|
||||
// Handle regular cells
|
||||
|
||||
Loading…
Reference in New Issue
Block a user