Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
bc2f863915
@ -519,6 +519,7 @@
|
||||
var storedData = {};
|
||||
// // console.log("stored data : ", typeof(policyInformationData))
|
||||
|
||||
localStorage.removeItem('policyData');
|
||||
if (policyInformationData.length) {
|
||||
|
||||
localStorage.setItem('policyData', (policyInformationData));
|
||||
@ -2848,11 +2849,20 @@
|
||||
function getTotalCount(proposalDataArray) {
|
||||
let proposals = proposalDataArray.proposal_data.over_all_column_data;
|
||||
|
||||
let proposalCount = Object.keys(proposals).length; // Count proposals
|
||||
let insurerCount = Object.values(proposals).reduce((sum, proposal) => {
|
||||
return sum + (proposal.insurers ? proposal.insurers.length : 0);
|
||||
}, 0); // Count insurers across all proposals
|
||||
// Object.k(proposals)
|
||||
// console.log("Proposal insurer keuys : ",proposals)
|
||||
var proposalCount = 0;
|
||||
var insurerCount = 0;
|
||||
for (const key in proposals) {
|
||||
if (proposals[key].qcr !== 0) {
|
||||
proposalCount++; // Count proposals where qcr !== 0
|
||||
|
||||
// Only count insurers if the proposal's qcr !== 0
|
||||
insurerCount += proposals[key].insurers
|
||||
? proposals[key].insurers.filter(insurer => insurer.qcr !== 0).length
|
||||
: 0;
|
||||
}
|
||||
}
|
||||
return proposalCount + insurerCount;
|
||||
}
|
||||
|
||||
@ -3094,19 +3104,19 @@
|
||||
|
||||
}
|
||||
var proposalHTMLNumber = "";
|
||||
console.log("Header Name : ",header.parentHeader);
|
||||
// console.log("Header Name : ",header.parentHeader);
|
||||
// alert(headerName);
|
||||
if (lead_type == 1){
|
||||
console.log("Header Name lead type 1 : ",header.parentHeader);
|
||||
// console.log("Header Name lead type 1 : ",header.parentHeader);
|
||||
|
||||
matchedKey = Object.keys(overallColumnDataProposal).find(key => headerName.startsWith(key));
|
||||
proposalHTMLNumber = header.parentHeader.split(' ')[1];
|
||||
|
||||
}else{
|
||||
console.log("Header Name lead type not 1 : ",header.parentHeader);
|
||||
// console.log("Header Name lead type not 1 : ",header.parentHeader);
|
||||
|
||||
if (rfq_count == 0 && header.parentHeader.startsWith("Proposal")){
|
||||
console.log("Header Name lead type not 1 proposal: ",header.parentHeader);
|
||||
// console.log("Header Name lead type not 1 proposal: ",header.parentHeader);
|
||||
|
||||
var tempHeader = header.parentHeader;
|
||||
matchedKey = Object.keys(overallColumnDataProposal).find(key => tempHeader.startsWith(key));
|
||||
@ -3114,7 +3124,7 @@
|
||||
|
||||
}else{
|
||||
|
||||
console.log("Header Name lead type not 1 noy proposal: ",header.parentHeader);
|
||||
// console.log("Header Name lead type not 1 noy proposal: ",header.parentHeader);
|
||||
|
||||
if (header.parentHeader.startsWith("Existing")){
|
||||
var tempHeader2 = lead_type == 2 ?"Existing Renewal 0":"Existing Roll Over 0";
|
||||
@ -3138,7 +3148,7 @@
|
||||
// // console.log("something wrong :headerCheckBoxProperties ", headerCheckBoxProperties);
|
||||
}
|
||||
|
||||
|
||||
// console.log("Header checkbox Properties : ",headerCheckBoxProperties);
|
||||
th1.innerHTML = `
|
||||
${headerName}
|
||||
<span class="three-dot-menu" >⋮</span>
|
||||
@ -3167,9 +3177,9 @@
|
||||
const th2 = document.createElement('th');
|
||||
if (header.parentHeader.startsWith("Proposal") || header.parentHeader.startsWith("Existing")) {
|
||||
var insurers = overallColumnDataProposal[matchedKey].insurers;
|
||||
// // console.log("trying to find something :header.parentHeader ", header.parentHeader);
|
||||
// // console.log("trying to find something :insurers ", insurers);
|
||||
// // console.log("trying to find : subHeader",subHeader)
|
||||
// console.log("trying to find something :header.parentHeader ", header.parentHeader);
|
||||
// console.log("trying to find something :insurers ", insurers);
|
||||
// console.log("trying to find : subHeader",subHeader)
|
||||
const matchedInsurer = insurers.find(ins => ins.ins_name == subHeader);
|
||||
|
||||
|
||||
@ -3387,7 +3397,7 @@
|
||||
var proposal = getProposalsWithQCRZero(overallData);
|
||||
// // console.log("column to hide : ", proposal);
|
||||
proposal.forEach(function(prop) {
|
||||
// // console.log("column prop : ", prop);
|
||||
// console.log("column prop : ", prop);
|
||||
hideColumn(prop);
|
||||
})
|
||||
|
||||
@ -3401,14 +3411,15 @@
|
||||
const mainHeaderRow = table.querySelector('thead tr:first-child');
|
||||
let proposalHeader = null;
|
||||
let proposalColspan = 1;
|
||||
let startColumnIndex = -1;
|
||||
let startColumnIndex = 2;
|
||||
|
||||
// Find the header matching the columnName and its position
|
||||
Array.from(mainHeaderRow.children).forEach((th, index) => {
|
||||
if (th.textContent.trim().startsWith(columnName)) {
|
||||
proposalHeader = th;
|
||||
proposalColspan = parseInt(th.getAttribute('colspan')) || 1;
|
||||
startColumnIndex = index; // Starting index of the proposal header
|
||||
// startColumnIndex = index; // Starting index of the proposal header
|
||||
proposalNumber = parseInt(th.textContent.trim().replace(/\D/g, ""), 10);
|
||||
return;
|
||||
}
|
||||
});
|
||||
@ -3420,6 +3431,15 @@
|
||||
|
||||
// 2. Hide the main proposal header
|
||||
proposalHeader.style.display = "none";
|
||||
if (lead_type == 1){
|
||||
for (let i = 1; i < proposalNumber; i++) {
|
||||
startColumnIndex += quotesConfig[i]?.length || 0;
|
||||
}
|
||||
}else{
|
||||
for (let i = 0; i < proposalNumber; i++) {
|
||||
startColumnIndex += quotesConfig[i]?.length || 0;
|
||||
}
|
||||
}
|
||||
|
||||
// 3. Find and hide all subheaders under this proposal
|
||||
const subHeaderRow = table.querySelector('thead tr:last-child');
|
||||
@ -3427,6 +3447,8 @@
|
||||
|
||||
// Calculate range of subheaders to hide (same colspan as proposal header)
|
||||
const endColumnIndex = startColumnIndex + proposalColspan - 1;
|
||||
// console.log("end col index : ",endColumnIndex);
|
||||
|
||||
for (let i = startColumnIndex; i <= endColumnIndex; i++) {
|
||||
if (subHeaders[i]) subHeaders[i].style.display = "none";
|
||||
}
|
||||
@ -3638,7 +3660,7 @@
|
||||
}
|
||||
});
|
||||
|
||||
// // console.log("Insurer names to make non-editable:", insNames);
|
||||
// console.log("Insurer names to make non-editable:", insNames);
|
||||
|
||||
$("table").each(function() {
|
||||
var table = $(this);
|
||||
@ -3651,8 +3673,11 @@
|
||||
|
||||
mainHeaderRow.children("th, td").each(function() {
|
||||
var cellText = $(this).text().trim();
|
||||
if (cellText.startsWith("Existing")){
|
||||
cellText = lead_type == 2 ?"Existing Renewal 0":"Existing Roll Over 0";
|
||||
}
|
||||
var colspan = parseInt($(this).attr("colspan") || 1, 10);
|
||||
|
||||
// console.log("cellText",cellText);
|
||||
// Store the header text at this visual index
|
||||
for (var i = 0; i < colspan; i++) {
|
||||
headerMapping[visualIndex + i] = cellText;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user