diff --git a/app/Views/view_rfq_non_eb.php b/app/Views/view_rfq_non_eb.php
index 31f7250c..da988735 100644
--- a/app/Views/view_rfq_non_eb.php
+++ b/app/Views/view_rfq_non_eb.php
@@ -481,10 +481,19 @@
var rfq_or_qcr = 1;
var proposalDataForDropDown = {};
+ var lead_type = "= $lead_data['lead_type'] ?>";
+ // alert(lead_type);
+ var rollover_or_renewal = "";
+
+ if (lead_type != 1){
+
+ rollover_or_renewal = lead_type == 2 ? "Existing Renewal" : "Existing Roll Over";
+ }
var policyConfig = {
1: ['Quote asked']
};
+
let myModal;
var over_all_column_data = {
"Proposal 1": {
@@ -638,7 +647,10 @@
// console.log('removeProposal');
console.log(quotesConfig);
if (!quotesConfig[proposalNumber]) return; // If proposal doesn't exist, exit
-
+ if(Object.keys(quotesConfig).length == 1){
+ toastr.warning("You cannot Delete All the Proposals","Warning");
+ return;
+ }
// Remove all child columns for the proposal
const tables = document.querySelectorAll('table');
tables.forEach(table => {
@@ -1574,6 +1586,7 @@
// console.log("Subheader th: colinded : ",colIndex);
// Get the subheader (assuming it's the second
inside )
let subHeaderThList = [...document.querySelectorAll("thead tr:nth-child(2) th")];
+ console.log("subHeaderThList", subHeaderThList);
// Filter | elements that have a valid 'data-proposal' attribute
let validSubHeaders = subHeaderThList.filter(th => {
@@ -1583,18 +1596,23 @@
});
- // console.log("Subheader th: subHeaderThList",subHeaderThList);
+ console.log("Subheader th: validSubHeaders",validSubHeaders);
// let validSubHeaders = subHeaderThList.filter(th => th.hasAttribute("data-proposal"));
// console.log("Subheader th: validSubHeaders",validSubHeaders);
- let subHeaderTh = validSubHeaders.find(th => th.textContent.trim() === codeValue) || null;
- // console.log("Subheader th: subHeaderTh",subHeaderTh);
+
+
+ let subHeaderTh = validSubHeaders.find(th => th.textContent.trim());
+ console.log("Subheader th: codeValue",codeValue);
+ console.log("Subheader th: subHeaderTh",subHeaderTh);
// if (subHeaderTh.classList.contains("insurer_proposal")) {
// alert(subHeaderTh);
// }
let subHeaderText = subHeaderTh ? subHeaderTh.textContent.trim() : '';
- // console.log("Subheader th: ",subHeaderText);
+ console.log("Subheader th: below code",subHeaderText);
// Check if subheader is NOT "Quote asked"
- let className = subHeaderText !== "Quote asked" && subHeaderText != "-" ? "insurer_proposal" : "";
+ let className = !subHeaderText.startsWith("Quote asked") && subHeaderText != "-" ?
+ "insurer_proposal" : "";
+ console.log("className", className);
// alert(subHeaderText);
let defaultJsonString = typeof default_answers_array == "object" ? JSON.stringify(default_answers_array[0]) : String(default_answers_array);
@@ -2699,18 +2717,19 @@
}
function addSuggestion(rowData) {
- // console.log("child table data ", rowData);
- // console.log("child table data ", rowData.row_id);
- // console.log("child table data ", child_table_data[rowData.row_id]);
+ console.log("child table data rowData", rowData);
+ console.log("child table data rowData.id", rowData.row_id);
+ console.log("child table data child_table_data", child_table_data[rowData.row_id]);
var table_data = child_table_data[rowData.row_id];
+
table_data.forEach(table => {
table.table_row_contents.forEach(row => {
const key = Object.keys(row)[0]; // Get the first key in the row object
const answerType = row[key].answer_type; // Get the answer_type
suggestions[key] = answerType; // Store in suggestions object
});
- });
+ });
// console.log("child table data ", suggestions);
// child_table_data[rowData.rowID]
@@ -2743,13 +2762,16 @@
let keys = Object.keys(quotesConfig);
let lastKey = keys[keys.length - 1];
proposalCount = lastKey;
+ proposalCountForTableINcrease = keys.length;
console.log(proposalCount);
// Calculate width increase
let increaseBy = rfq_or_qcr == 2 ?
getTotalCount(proposalDataArray) * 150 :
- proposalCount * 150;
+ proposalCountForTableINcrease * 150;
+ console.log("Quotes COnfig : ",quotesConfig);
+ console.log("policy COnfig :", policyConfig);
// // console.log("trying to find checkbox data : : : ", increaseBy);
@@ -2833,12 +2855,21 @@
// td.onclick = () => getAnswer(table.id, tr.id);
td.innerHTML = processCellContent(cellData.input_value, rowData, cellData.display_content);
// console.log("DEBUG ISSUE : ",cellData.parentth)
- if (cellData.parentth.startsWith("Proposal")) {
- td.onclick = () => getAnswer(table.id, tr.id);
- if (cellData.subth != "Quote asked") {
+ if (cellData.parentth.startsWith("Proposal") || cellData.parentth.startsWith("Existing")) {
+
+ if (lead_type == 1){
td.onclick = () => getAnswer(table.id, tr.id);
- td.classList.add("insurer_proposal");
+ if (cellData.subth != "Quote asked") {
+ td.onclick = () => getAnswer(table.id, tr.id);
+ td.classList.add("insurer_proposal");
+ }
+ }else{
+
+ if (cellData.subth != "Quote asked") {
+ td.classList.add("insurer_proposal");
+ }
}
+
}
td.contentEditable = true;
@@ -2929,11 +2960,29 @@
// Parent header
const th1 = document.createElement('th');
th1.textContent = header.parentHeader;
- if (header.parentHeader.startsWith('Proposal')) {
- var headerName = header.parentHeader;
- // console.log("header name : ", th1.textContent.trim());
- // console.log("over all column data : ", over_all_column_data)
- matchedKey = Object.keys(overallColumnDataProposal).find(key => headerName.startsWith(key));
+ if (header.parentHeader.startsWith('Proposal') || header.parentHeader.startsWith("Existing")) {
+ if (lead_type == 1){
+ var headerName = header.parentHeader;
+ }else{
+ var headerName = rollover_or_renewal;
+ }
+
+ if (lead_type == 1){
+
+ matchedKey = Object.keys(overallColumnDataProposal).find(key => headerName.startsWith(key));
+
+ }else{
+
+ if (header.parentHeader.startsWith("Proposal")){
+ var tempHeader = header.parentHeader;
+ matchedKey = Object.keys(overallColumnDataProposal).find(key => tempHeader.startsWith(key));
+ }else{
+ matchedKey = Object.keys(overallColumnDataProposal).find(key => headerName.startsWith(key));
+ }
+
+ }
+
+
if (matchedKey) {
// console.log("something wrong : ", overallColumnDataProposal[matchedKey]);
var headerCheckBoxProperties = overallColumnDataProposal[matchedKey];
@@ -2965,7 +3014,7 @@
// Sub headers
header.subHeaders.forEach(subHeader => {
const th2 = document.createElement('th');
- if (header.parentHeader.startsWith("Proposal")) {
+ if (header.parentHeader.startsWith("Proposal") || header.parentHeader.startsWith("Existing")) {
var insurers = overallColumnDataProposal[matchedKey].insurers;
const matchedInsurer = insurers.find(ins => ins.ins_name == subHeader);
@@ -3378,8 +3427,8 @@
if (rfq_or_qcr == 2) {
cell.attr("contenteditable", "false");
removeOnClickFromColumnCells(cell);
-
- if (!cell.text().trim().startsWith("Proposal")){
+
+ if (!cell.text().trim().startsWith("Proposal") && !cell.text().trim().startsWith("Existing")){
cell.addClass("readonly-select");
}
} else if (rfq_or_qcr == 1) {
|