FIX_PROPOSAL_HIDESHOW
This commit is contained in:
parent
8b17c74ba7
commit
2c2768ef2f
@ -3095,19 +3095,19 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
var proposalHTMLNumber = "";
|
var proposalHTMLNumber = "";
|
||||||
console.log("Header Name : ",header.parentHeader);
|
// console.log("Header Name : ",header.parentHeader);
|
||||||
// alert(headerName);
|
// alert(headerName);
|
||||||
if (lead_type == 1){
|
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));
|
matchedKey = Object.keys(overallColumnDataProposal).find(key => headerName.startsWith(key));
|
||||||
proposalHTMLNumber = header.parentHeader.split(' ')[1];
|
proposalHTMLNumber = header.parentHeader.split(' ')[1];
|
||||||
|
|
||||||
}else{
|
}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")){
|
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;
|
var tempHeader = header.parentHeader;
|
||||||
matchedKey = Object.keys(overallColumnDataProposal).find(key => tempHeader.startsWith(key));
|
matchedKey = Object.keys(overallColumnDataProposal).find(key => tempHeader.startsWith(key));
|
||||||
@ -3115,7 +3115,7 @@
|
|||||||
|
|
||||||
}else{
|
}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")){
|
if (header.parentHeader.startsWith("Existing")){
|
||||||
var tempHeader2 = lead_type == 2 ?"Existing Renewal 0":"Existing Roll Over 0";
|
var tempHeader2 = lead_type == 2 ?"Existing Renewal 0":"Existing Roll Over 0";
|
||||||
@ -3139,7 +3139,7 @@
|
|||||||
// // console.log("something wrong :headerCheckBoxProperties ", headerCheckBoxProperties);
|
// // console.log("something wrong :headerCheckBoxProperties ", headerCheckBoxProperties);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// console.log("Header checkbox Properties : ",headerCheckBoxProperties);
|
||||||
th1.innerHTML = `
|
th1.innerHTML = `
|
||||||
${headerName}
|
${headerName}
|
||||||
<span class="three-dot-menu" >⋮</span>
|
<span class="three-dot-menu" >⋮</span>
|
||||||
@ -3168,9 +3168,9 @@
|
|||||||
const th2 = document.createElement('th');
|
const th2 = document.createElement('th');
|
||||||
if (header.parentHeader.startsWith("Proposal") || header.parentHeader.startsWith("Existing")) {
|
if (header.parentHeader.startsWith("Proposal") || header.parentHeader.startsWith("Existing")) {
|
||||||
var insurers = overallColumnDataProposal[matchedKey].insurers;
|
var insurers = overallColumnDataProposal[matchedKey].insurers;
|
||||||
// // console.log("trying to find something :header.parentHeader ", header.parentHeader);
|
// console.log("trying to find something :header.parentHeader ", header.parentHeader);
|
||||||
// // console.log("trying to find something :insurers ", insurers);
|
// console.log("trying to find something :insurers ", insurers);
|
||||||
// // console.log("trying to find : subHeader",subHeader)
|
// console.log("trying to find : subHeader",subHeader)
|
||||||
const matchedInsurer = insurers.find(ins => ins.ins_name == subHeader);
|
const matchedInsurer = insurers.find(ins => ins.ins_name == subHeader);
|
||||||
|
|
||||||
|
|
||||||
@ -3388,7 +3388,7 @@
|
|||||||
var proposal = getProposalsWithQCRZero(overallData);
|
var proposal = getProposalsWithQCRZero(overallData);
|
||||||
// // console.log("column to hide : ", proposal);
|
// // console.log("column to hide : ", proposal);
|
||||||
proposal.forEach(function(prop) {
|
proposal.forEach(function(prop) {
|
||||||
// // console.log("column prop : ", prop);
|
console.log("column prop : ", prop);
|
||||||
hideColumn(prop);
|
hideColumn(prop);
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -3402,14 +3402,15 @@
|
|||||||
const mainHeaderRow = table.querySelector('thead tr:first-child');
|
const mainHeaderRow = table.querySelector('thead tr:first-child');
|
||||||
let proposalHeader = null;
|
let proposalHeader = null;
|
||||||
let proposalColspan = 1;
|
let proposalColspan = 1;
|
||||||
let startColumnIndex = -1;
|
let startColumnIndex = 2;
|
||||||
|
|
||||||
// Find the header matching the columnName and its position
|
// Find the header matching the columnName and its position
|
||||||
Array.from(mainHeaderRow.children).forEach((th, index) => {
|
Array.from(mainHeaderRow.children).forEach((th, index) => {
|
||||||
if (th.textContent.trim().startsWith(columnName)) {
|
if (th.textContent.trim().startsWith(columnName)) {
|
||||||
proposalHeader = th;
|
proposalHeader = th;
|
||||||
proposalColspan = parseInt(th.getAttribute('colspan')) || 1;
|
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;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -3421,6 +3422,15 @@
|
|||||||
|
|
||||||
// 2. Hide the main proposal header
|
// 2. Hide the main proposal header
|
||||||
proposalHeader.style.display = "none";
|
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
|
// 3. Find and hide all subheaders under this proposal
|
||||||
const subHeaderRow = table.querySelector('thead tr:last-child');
|
const subHeaderRow = table.querySelector('thead tr:last-child');
|
||||||
@ -3428,6 +3438,8 @@
|
|||||||
|
|
||||||
// Calculate range of subheaders to hide (same colspan as proposal header)
|
// Calculate range of subheaders to hide (same colspan as proposal header)
|
||||||
const endColumnIndex = startColumnIndex + proposalColspan - 1;
|
const endColumnIndex = startColumnIndex + proposalColspan - 1;
|
||||||
|
console.log("end col index : ",endColumnIndex);
|
||||||
|
|
||||||
for (let i = startColumnIndex; i <= endColumnIndex; i++) {
|
for (let i = startColumnIndex; i <= endColumnIndex; i++) {
|
||||||
if (subHeaders[i]) subHeaders[i].style.display = "none";
|
if (subHeaders[i]) subHeaders[i].style.display = "none";
|
||||||
}
|
}
|
||||||
@ -3639,7 +3651,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// // console.log("Insurer names to make non-editable:", insNames);
|
console.log("Insurer names to make non-editable:", insNames);
|
||||||
|
|
||||||
$("table").each(function() {
|
$("table").each(function() {
|
||||||
var table = $(this);
|
var table = $(this);
|
||||||
@ -3653,7 +3665,7 @@
|
|||||||
mainHeaderRow.children("th, td").each(function() {
|
mainHeaderRow.children("th, td").each(function() {
|
||||||
var cellText = $(this).text().trim();
|
var cellText = $(this).text().trim();
|
||||||
var colspan = parseInt($(this).attr("colspan") || 1, 10);
|
var colspan = parseInt($(this).attr("colspan") || 1, 10);
|
||||||
|
console.log("cellText",cellText);
|
||||||
// Store the header text at this visual index
|
// Store the header text at this visual index
|
||||||
for (var i = 0; i < colspan; i++) {
|
for (var i = 0; i < colspan; i++) {
|
||||||
headerMapping[visualIndex + i] = cellText;
|
headerMapping[visualIndex + i] = cellText;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user