FEAT_RFQ_NONEB_NEW_CHANGES
This commit is contained in:
parent
b542913153
commit
5828bc707a
@ -100,7 +100,9 @@ class LeadsController extends BaseController
|
|||||||
$this->issuer = [1 => 'JIBS', 2 => 'Nhance'];
|
$this->issuer = [1 => 'JIBS', 2 => 'Nhance'];
|
||||||
$this->clientType = [1 => 'Group', 2 => 'Individual'];
|
$this->clientType = [1 => 'Group', 2 => 'Individual'];
|
||||||
$this->leadType = [1 => 'Fresh', 2 => 'Renewal', 3 => 'Roll Over'];
|
$this->leadType = [1 => 'Fresh', 2 => 'Renewal', 3 => 'Roll Over'];
|
||||||
$this->buisnessType = [1 => 'Industrial', 2 => 'Non Industrial'];
|
$data = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
|
||||||
|
$this->buisnessType = array_column($data, 'name', 'id');
|
||||||
|
// $this->buisnessType = [1 => 'Public Sector', 2 => 'Private Sector',3=> 'Trust',4 => 'Proprietorship',5 => 'Partnership',6 => 'Private',7 => 'Individual'];
|
||||||
$this->leadsStatus = [
|
$this->leadsStatus = [
|
||||||
'queued' => 'In-Queued',
|
'queued' => 'In-Queued',
|
||||||
'qcr_sent' => 'QCR sent',
|
'qcr_sent' => 'QCR sent',
|
||||||
@ -730,9 +732,11 @@ class LeadsController extends BaseController
|
|||||||
$data['product'] = $this->leadsModel->select("policy_type.policy_type")->join('policy_type', 'leads.policy_type_id = policy_type.id')->where('leads.id', $id)->first()['policy_type'];
|
$data['product'] = $this->leadsModel->select("policy_type.policy_type")->join('policy_type', 'leads.policy_type_id = policy_type.id')->where('leads.id', $id)->first()['policy_type'];
|
||||||
// $data['lead_register_data'] = json_decode($data['lead_data']['custom_fields']);
|
// $data['lead_register_data'] = json_decode($data['lead_data']['custom_fields']);
|
||||||
// dd($data['lead_register_data']);
|
// dd($data['lead_register_data']);
|
||||||
|
// $data['entity_type'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
|
||||||
|
$data['buisness_type'] = $this->buisnessType;
|
||||||
|
|
||||||
// dd($data);
|
// dd($data);
|
||||||
$data['client_type'] = $this->clientType;
|
$data['client_type'] = $this->clientType;
|
||||||
$data['buisness_type'] = $this->buisnessType;
|
|
||||||
$this->loadLayout('view_rfq_non_eb', $data);
|
$this->loadLayout('view_rfq_non_eb', $data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2076,6 +2080,7 @@ class LeadsController extends BaseController
|
|||||||
->where('leads.id', $lead_id)
|
->where('leads.id', $lead_id)
|
||||||
->first();
|
->first();
|
||||||
|
|
||||||
|
// log_message('error', 'Lead Data' . json_encode($lead_data));
|
||||||
// print_r($lead_data ); die;
|
// print_r($lead_data ); die;
|
||||||
|
|
||||||
$cc_mails = [];
|
$cc_mails = [];
|
||||||
@ -2236,9 +2241,9 @@ class LeadsController extends BaseController
|
|||||||
foreach ($recipient_data as $recipient) {
|
foreach ($recipient_data as $recipient) {
|
||||||
|
|
||||||
$message = $original_message;
|
$message = $original_message;
|
||||||
$message = str_replace("{{RECIPIENT_NAME}}", $recipient['name'], $message);
|
$message = str_replace("{{RECIPIENT_NAME}}", $recipient['name'] != "" ? $recipient['name'] :" ", $message);
|
||||||
$message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'], $message);
|
$message = str_replace("{{CLIENT_NAME}}", $lead_data['client_name'] != "" ? $lead_data['client_name'] : "", $message);
|
||||||
$message = str_replace("{{POLICY_LONG_NAME}}", $lead_data['long_name'], $message);
|
$message = str_replace("{{POLICY_LONG_NAME}}",$lead_data['long_name'] != ""? $lead_data['long_name'] : "", $message);
|
||||||
$message = str_replace("{{POLICY_START_DATE}}", change_date_format($lead_data['policy_start_date'], 'Y-m-d', 'd-m-Y'), $message);
|
$message = str_replace("{{POLICY_START_DATE}}", change_date_format($lead_data['policy_start_date'], 'Y-m-d', 'd-m-Y'), $message);
|
||||||
$message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'] ?? "", $lead_data['policy_start_date'] ?? "")->days, $message) ?? '--';
|
$message = str_replace("{{DURATION}}", calculate_days_bw_dates($lead_data['policy_end_date'] ?? "", $lead_data['policy_start_date'] ?? "")->days, $message) ?? '--';
|
||||||
|
|
||||||
@ -2809,7 +2814,7 @@ class LeadsController extends BaseController
|
|||||||
$value = $cellData['display_content'] ?? '';
|
$value = $cellData['display_content'] ?? '';
|
||||||
|
|
||||||
// Skip unwanted keys
|
// Skip unwanted keys
|
||||||
if (in_array($parentth, ['SNO', 'Particulars', 'Action']) || $subth === 'Quote Asked') {
|
if (in_array($parentth, ['SNO', 'Particulars', 'Action']) || $subth === 'Sum Insured' || $subth === 'Fidelity Limit') {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3217,11 +3222,11 @@ class LeadsController extends BaseController
|
|||||||
$sheet->getColumnDimension('B')->setWidth($maxWidthA * 1.2);
|
$sheet->getColumnDimension('B')->setWidth($maxWidthA * 1.2);
|
||||||
$sheet->getColumnDimension('C')->setWidth($maxWidthB * 1.2);
|
$sheet->getColumnDimension('C')->setWidth($maxWidthB * 1.2);
|
||||||
|
|
||||||
$rowNumber += 2;
|
$rowNumber += 1;
|
||||||
//Policy Registration
|
//Policy Registration
|
||||||
if (!empty($policy_registration_data)) {
|
if (!empty($policy_registration_data)) {
|
||||||
foreach ($policy_registration_data as $key => $value) {
|
foreach ($policy_registration_data as $key => $value) {
|
||||||
|
// kint::dump($value);
|
||||||
$startRow = $rowNumber; // Track where the block starts
|
$startRow = $rowNumber; // Track where the block starts
|
||||||
|
|
||||||
// Title Row
|
// Title Row
|
||||||
@ -3308,6 +3313,24 @@ class LeadsController extends BaseController
|
|||||||
$rowNumber++;
|
$rowNumber++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isset($value['policyDetails']) && !empty($value['policyDetails'])) {
|
||||||
|
// Type of Business
|
||||||
|
$sheet->mergeCells("A{$rowNumber}:B{$rowNumber}");
|
||||||
|
$sheet->setCellValue("A{$rowNumber}", "Terrorism");
|
||||||
|
$sheet->setCellValue("C{$rowNumber}", ucfirst($value['policyDetails']['terrorism'] ?? 'No'));
|
||||||
|
|
||||||
|
$sheet->getStyle("A{$rowNumber}")->applyFromArray([
|
||||||
|
'font' => ['bold' => true],
|
||||||
|
'alignment' => [
|
||||||
|
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||||
|
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
$rowNumber++;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
$endRow = $rowNumber - 1; // Block ends at previous row
|
$endRow = $rowNumber - 1; // Block ends at previous row
|
||||||
|
|
||||||
// Apply border to the whole block
|
// Apply border to the whole block
|
||||||
@ -3320,8 +3343,9 @@ class LeadsController extends BaseController
|
|||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$rowNumber += 2; // Add space before the next block
|
$rowNumber += 1; // Add space before the next block
|
||||||
}
|
}
|
||||||
|
// die();
|
||||||
}
|
}
|
||||||
|
|
||||||
//Table Data
|
//Table Data
|
||||||
@ -3425,6 +3449,18 @@ class LeadsController extends BaseController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// For the subheader row, merge B and C and set the value
|
||||||
|
$sheet->setCellValue("B{$subHeaderRow}", "Sum Insured");
|
||||||
|
$sheet->mergeCells("B{$subHeaderRow}:C{$subHeaderRow}");
|
||||||
|
$sheet->getStyle("B{$subHeaderRow}:C{$subHeaderRow}")->applyFromArray([
|
||||||
|
'font' => ['bold' => true],
|
||||||
|
'alignment' => [
|
||||||
|
'horizontal' => \PhpOffice\PhpSpreadsheet\Style\Alignment::HORIZONTAL_CENTER,
|
||||||
|
'vertical' => \PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER,
|
||||||
|
],
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
// Apply border to the header range
|
// Apply border to the header range
|
||||||
$prevColumn4 = $this->getPreviousColumn($columnLetter);
|
$prevColumn4 = $this->getPreviousColumn($columnLetter);
|
||||||
$headerRange = "A{$rowNumber}:" . "{$prevColumn4}" . "{$subHeaderRow}";
|
$headerRange = "A{$rowNumber}:" . "{$prevColumn4}" . "{$subHeaderRow}";
|
||||||
@ -3441,7 +3477,9 @@ class LeadsController extends BaseController
|
|||||||
$sheet->getRowDimension($rowNumber)->setRowHeight(25); // Header row height
|
$sheet->getRowDimension($rowNumber)->setRowHeight(25); // Header row height
|
||||||
$sheet->getRowDimension($subHeaderRow)->setRowHeight(20); // Subheader row height
|
$sheet->getRowDimension($subHeaderRow)->setRowHeight(20); // Subheader row height
|
||||||
|
|
||||||
$rowNumber = $subHeaderRow + 2;
|
// $rowNumber = $subHeaderRow + 2;
|
||||||
|
$rowNumber = $subHeaderRow + 1;
|
||||||
|
|
||||||
$column_data = $data['table_data']['data'];
|
$column_data = $data['table_data']['data'];
|
||||||
// dd($column_data);
|
// dd($column_data);
|
||||||
$serial_no = 1;
|
$serial_no = 1;
|
||||||
@ -3729,7 +3767,7 @@ class LeadsController extends BaseController
|
|||||||
$row['data'] = array_filter(
|
$row['data'] = array_filter(
|
||||||
$row['data'],
|
$row['data'],
|
||||||
function ($item) {
|
function ($item) {
|
||||||
return in_array($item['subth'], ['Quote asked', '-']);
|
return in_array($item['subth'], ['Sum Insured', '-',"Liability Limit"]);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -3818,7 +3856,7 @@ class LeadsController extends BaseController
|
|||||||
if ($subHeader === $insurer) {
|
if ($subHeader === $insurer) {
|
||||||
$headerData[] = [
|
$headerData[] = [
|
||||||
'parentHeader' => $header['parentHeader'],
|
'parentHeader' => $header['parentHeader'],
|
||||||
'subHeaders' => ['Quote asked', $subHeader]
|
'subHeaders' => ['Sum Insured', $subHeader]
|
||||||
];
|
];
|
||||||
break 2; // Exit both loops after match is found
|
break 2; // Exit both loops after match is found
|
||||||
}
|
}
|
||||||
@ -3851,8 +3889,8 @@ class LeadsController extends BaseController
|
|||||||
$filteredData[] = $item;
|
$filteredData[] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Include Proposal with Quote Asked
|
// Include Proposal with Sum Insured
|
||||||
if ($item['parentth'] === $proposal && $item['subth'] === "Quote asked") {
|
if ($item['parentth'] === $proposal && ($item['subth'] === "Sum Insured" || $item['subth'] === "Liability Limit")) {
|
||||||
$filteredData[] = $item;
|
$filteredData[] = $item;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -884,7 +884,7 @@
|
|||||||
<?php
|
<?php
|
||||||
if (isset($policy_type) && count($policy_type)) {
|
if (isset($policy_type) && count($policy_type)) {
|
||||||
foreach ($policy_type as $value) {
|
foreach ($policy_type as $value) {
|
||||||
if ($value['allocg'] != "Non-EB") {
|
if ($value['allocg'] != "Non-EB" && $value['allocg'] != "Marine") {
|
||||||
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -217,11 +217,11 @@
|
|||||||
<div class="text-right">
|
<div class="text-right">
|
||||||
<button type="submit" id="riskSplitup" class="btn btn-primary">Validate and Add Risk Split up</button>
|
<button type="submit" id="riskSplitup" class="btn btn-primary">Validate and Add Risk Split up</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<!-- <div class="row">
|
||||||
<div class="col-md-12 text-right">
|
<div class="col-md-12 text-right">
|
||||||
<button type="submit" id="submitPolicyRisk" class="btn btn-primary">Submit For Validation</button>
|
<button type="submit" id="submitPolicyRisk" class="btn btn-primary">Submit For Validation</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div> -->
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -579,11 +579,12 @@
|
|||||||
policyRiskAddress = groupedData;
|
policyRiskAddress = groupedData;
|
||||||
console.log("Grouped Data as Objects: ", policyRiskAddress);
|
console.log("Grouped Data as Objects: ", policyRiskAddress);
|
||||||
|
|
||||||
if (productSelectionData.singleProduct == 'on') {
|
// if (productSelectionData.singleProduct == 'on') {
|
||||||
savePolicyDataLocal();
|
// savePolicyDataLocal();
|
||||||
} else {
|
// } else {
|
||||||
riskSplitup();
|
riskSplitup();
|
||||||
}
|
// }
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#policyDetailsForm").submit(function(event) {
|
$("#policyDetailsForm").submit(function(event) {
|
||||||
@ -652,6 +653,14 @@
|
|||||||
hideAndShowBurglary();
|
hideAndShowBurglary();
|
||||||
})
|
})
|
||||||
|
|
||||||
|
}else{
|
||||||
|
// alert("you got ir");
|
||||||
|
policyRiskAddress.forEach(function() {
|
||||||
|
// console.log("increment count is ", increment2)
|
||||||
|
addHTMLInputForRiskSplitUP();
|
||||||
|
validatePolicyBasedOnProductSelection();
|
||||||
|
hideAndShowBurglary();
|
||||||
|
})
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (contianertoCheck.innerHTML == "") {
|
if (contianertoCheck.innerHTML == "") {
|
||||||
@ -713,23 +722,23 @@
|
|||||||
<div class = "row">
|
<div class = "row">
|
||||||
<div class="form-group col-md-4 multi_location_company">
|
<div class="form-group col-md-4 multi_location_company">
|
||||||
<label for="building_${increment2}">Building</label>
|
<label for="building_${increment2}">Building</label>
|
||||||
<input type="text" id="building_${increment2}" name="building[]" class="form-control multi_location_company " />
|
<input type="number" id="building_${increment2}" name="building[]" class="form-control multi_location_company " />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4 multi_location_company ">
|
<div class="form-group col-md-4 multi_location_company ">
|
||||||
<label for="content_${increment2}">Content</label>
|
<label for="content_${increment2}">Content</label>
|
||||||
<input type="text" id="content_${increment2}" name="content[]" class="form-control multi_location_company " />
|
<input type="number" id="content_${increment2}" name="content[]" class="form-control multi_location_company " />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4 multi_location_company ">
|
<div class="form-group col-md-4 multi_location_company ">
|
||||||
<label for="furniture_${increment2}">Furniture/Office Equipment</label>
|
<label for="furniture_${increment2}">Furniture/Office Equipment</label>
|
||||||
<input type="text" id="furniture_${increment2}" name="furniture[]" class="form-control multi_location_company " />
|
<input type="number" id="furniture_${increment2}" name="furniture[]" class="form-control multi_location_company " />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4 multi_location_company ">
|
<div class="form-group col-md-4 multi_location_company ">
|
||||||
<label for="plantAndMachinery_${increment2}">Plant and Machinery</label>
|
<label for="plantAndMachinery_${increment2}">Plant and Machinery</label>
|
||||||
<input type="text" id="plantAndMachinery_${increment2}" name="plant_and_machinery[]" class="form-control multi_location_company " />
|
<input type="number" id="plantAndMachinery_${increment2}" name="plant_and_machinery[]" class="form-control multi_location_company " />
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group col-md-4 multi_location_company">
|
<div class="form-group col-md-4 multi_location_company">
|
||||||
<label for="electricalFittings_${increment2}">Electrical Fittings</label>
|
<label for="electricalFittings_${increment2}">Electrical Fittings</label>
|
||||||
<input type="text" id="electricalFittings_${increment2}" name="electrical_fittings[]" class="form-control multi_location_company "/>
|
<input type="number" id="electricalFittings_${increment2}" name="electrical_fittings[]" class="form-control multi_location_company "/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
@ -872,7 +881,7 @@
|
|||||||
|
|
||||||
<div class="dt-switch-wrapper col-md-4 common_location_occupancy d-flex align-items-center">
|
<div class="dt-switch-wrapper col-md-4 common_location_occupancy d-flex align-items-center">
|
||||||
<div class="custom-control custom-switch d-flex justify-content-center">
|
<div class="custom-control custom-switch d-flex justify-content-center">
|
||||||
<input type="checkbox" class="custom-control-input" id="isBasement_${increment}" onchange="hideShowBasement(${increment})">
|
<input type="checkbox" class="custom-control-input" id="isBasement_${increment}" onchange="hideShowBasement(this)">
|
||||||
<label class="custom-control-label" for="isBasement_${increment}">Basement</label>
|
<label class="custom-control-label" for="isBasement_${increment}">Basement</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -920,26 +929,13 @@
|
|||||||
|
|
||||||
`;
|
`;
|
||||||
|
|
||||||
// newRow2.innerHTML += `
|
|
||||||
// <div class = "row">
|
|
||||||
// <div class="col-md-12 text-right">
|
|
||||||
// <button type ="submit" id="riskSplitup" class="btn btn-primary">Validate and Add Risk Split up</button>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
// <div class = "row">
|
|
||||||
// <div class="col-md-12 text-right">
|
|
||||||
// <button type ="submit" id="submitPolicyRisk" class="btn btn-primary">Submit For Validation</button>
|
|
||||||
// </div>
|
|
||||||
// </div>
|
|
||||||
|
|
||||||
// `;
|
|
||||||
|
|
||||||
container.appendChild(newRow);
|
container.appendChild(newRow);
|
||||||
// container.appendChild(newRow2);
|
// container.appendChild(newRow2);
|
||||||
|
|
||||||
const selectElement = document.getElementById(`select_location_${increment}`);
|
const selectElement = document.getElementById(`select_location_${increment}`);
|
||||||
selectElement.innerHTML = "";
|
selectElement.innerHTML = "";
|
||||||
for (let i = 1; i <= policyDetailsData.location_no; i++) {
|
for (let i = 1; i <= policyDetailsData.location_no; i++) {
|
||||||
|
console.log("location no : ", policyDetailsData.location_no);
|
||||||
const option = document.createElement('option');
|
const option = document.createElement('option');
|
||||||
option.value = `Location ${i}`;
|
option.value = `Location ${i}`;
|
||||||
option.textContent = `Location ${i}`;
|
option.textContent = `Location ${i}`;
|
||||||
@ -957,37 +953,33 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(document).on('click', '.duplicate-btn', function() {
|
$(document).on('click', '.duplicate-btn', function () {
|
||||||
|
|
||||||
|
|
||||||
// console.log("button is clicked");
|
|
||||||
// console.log("increment cout ", increment);
|
|
||||||
|
|
||||||
|
|
||||||
if (policyDetailsData.location_no >= increment) {
|
if (policyDetailsData.location_no >= increment) {
|
||||||
const $rowToClone = $(this).closest('.form-row');
|
const $rowToClone = $(this).closest('.form-row');
|
||||||
|
|
||||||
|
// Destroy Select2 for the current and previous occupancy fields
|
||||||
|
$(`#occupancy_${increment}`).select2('destroy');
|
||||||
|
$(`#occupancy_${increment - 1}`).select2('destroy');
|
||||||
|
|
||||||
// Clone the row
|
// Clone the row
|
||||||
const $clone = $rowToClone.clone();
|
const $clone = $rowToClone.clone();
|
||||||
|
|
||||||
$clone.find('.select2-hidden-accessible').each(function() {
|
// Clean up select2 artifacts from the clone
|
||||||
|
$clone.find('.select2-hidden-accessible').each(function () {
|
||||||
$(this).select2('destroy');
|
$(this).select2('destroy');
|
||||||
});
|
});
|
||||||
|
|
||||||
$clone.find('.select2-container').remove();
|
$clone.find('.select2-container').remove();
|
||||||
|
|
||||||
// Increment the counter
|
// Update all IDs in the clone
|
||||||
|
$clone.find('[id]').each(function () {
|
||||||
|
|
||||||
// Update all IDs and reset values in the clone
|
|
||||||
$clone.find('[id]').each(function() {
|
|
||||||
const oldId = $(this).attr('id');
|
const oldId = $(this).attr('id');
|
||||||
const newId = oldId.replace(/_(\d+)$/, `_${increment}`);
|
const newId = oldId.replace(/_(\d+)$/, `_${increment}`);
|
||||||
$(this).attr('id', newId);
|
$(this).attr('id', newId);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Update labels to match new IDs
|
// Update all labels
|
||||||
$clone.find('label').each(function() {
|
$clone.find('label').each(function () {
|
||||||
const oldFor = $(this).attr('for');
|
const oldFor = $(this).attr('for');
|
||||||
if (oldFor) {
|
if (oldFor) {
|
||||||
const newFor = oldFor.replace(/_(\d+)$/, `_${increment}`);
|
const newFor = oldFor.replace(/_(\d+)$/, `_${increment}`);
|
||||||
@ -998,18 +990,35 @@
|
|||||||
// Insert the cloned row after the original
|
// Insert the cloned row after the original
|
||||||
$clone.insertAfter($rowToClone);
|
$clone.insertAfter($rowToClone);
|
||||||
|
|
||||||
let selectedLocation = $(`#select_location_${increment}`).val();
|
// Refill and update the select_location dropdown
|
||||||
|
const selectElement = document.getElementById(`select_location_${increment}`);
|
||||||
|
selectElement.innerHTML = "";
|
||||||
|
for (let i = 1; i <= policyDetailsData.location_no; i++) {
|
||||||
|
const option = document.createElement('option');
|
||||||
|
option.value = `Location ${i}`;
|
||||||
|
option.textContent = `Location ${i}`;
|
||||||
|
selectElement.appendChild(option);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (let i = 1;i<increment;i++){
|
||||||
|
|
||||||
|
let selectedLocation = $(`#select_location_${i}`).val();
|
||||||
$(`#select_location_${increment} option[value="${selectedLocation}"]`).remove();
|
$(`#select_location_${increment} option[value="${selectedLocation}"]`).remove();
|
||||||
$(`#occupancy_${increment}`).select2();
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Re-initialize Select2 for both fields
|
||||||
|
$(`#occupancy_${increment - 1}`).select2(); // previous
|
||||||
|
$(`#occupancy_${increment}`).select2(); // current
|
||||||
|
$(`#iibCode_${increment}`).val(""); // current
|
||||||
increment++;
|
increment++;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
toastr.error("Maximum no of allowed locations reached", "Error")
|
toastr.error("Maximum number of allowed locations reached", "Error");
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
})
|
|
||||||
|
|
||||||
function addOrRemoveAdd() {
|
function addOrRemoveAdd() {
|
||||||
// console.log("chceck box clicked");
|
// console.log("chceck box clicked");
|
||||||
if ($("#sameAsCommunicationAddress").is(":checked")) {
|
if ($("#sameAsCommunicationAddress").is(":checked")) {
|
||||||
@ -1039,10 +1048,10 @@
|
|||||||
$('[id^="select_location"]').hide().prev('label').hide();
|
$('[id^="select_location"]').hide().prev('label').hide();
|
||||||
$("[id^='select_location']").removeAttr('required', false);
|
$("[id^='select_location']").removeAttr('required', false);
|
||||||
// $('[class*="single_location_occupancy"]').hide().removeAttr("required", false);
|
// $('[class*="single_location_occupancy"]').hide().removeAttr("required", false);
|
||||||
$('[class*="multi_location_company"]').hide().removeAttr('required');
|
// $('[class*="multi_location_company"]').hide().removeAttr('required');
|
||||||
$("#riskSplitup").hide();
|
// $("#riskSplitup").hide();
|
||||||
$("#submitPolicyRisk").show();
|
$("#submitPolicyRisk").show();
|
||||||
$("#risksplitupTab").hide();
|
// $("#risksplitupTab").hide();
|
||||||
// $('[class*="multiLocationOccupancy"]').hide().removeAttr('required', false);
|
// $('[class*="multiLocationOccupancy"]').hide().removeAttr('required', false);
|
||||||
// $('[class*="multiLocationOccupancyWithoutFloater"]').hide().removeAttr('required', false);
|
// $('[class*="multiLocationOccupancyWithoutFloater"]').hide().removeAttr('required', false);
|
||||||
|
|
||||||
@ -1155,6 +1164,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function savePolicyDataLocal() {
|
function savePolicyDataLocal() {
|
||||||
|
|
||||||
|
isSaved = false;
|
||||||
// Generate the JSON structure using the registerPolicyData function
|
// Generate the JSON structure using the registerPolicyData function
|
||||||
var policyData = registerPolicyData();
|
var policyData = registerPolicyData();
|
||||||
|
|
||||||
@ -1187,6 +1198,7 @@
|
|||||||
$('.loader-mask').fadeIn();
|
$('.loader-mask').fadeIn();
|
||||||
toastr.success("Policy Information Collected ", "SUCCESS");
|
toastr.success("Policy Information Collected ", "SUCCESS");
|
||||||
closeModal();
|
closeModal();
|
||||||
|
changeTerrorism(Number($("#policySI").val()));
|
||||||
$('.loader').fadeOut();
|
$('.loader').fadeOut();
|
||||||
$('.loader-mask').delay(350).fadeOut('slow');
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
// console.log("Updated policy data in localStorage:", existingData);
|
// console.log("Updated policy data in localStorage:", existingData);
|
||||||
@ -1386,6 +1398,7 @@
|
|||||||
var mobile = <?= isset($lead_data['contact_person_mobile']) ? $lead_data['contact_person_mobile'] : "" ?>;
|
var mobile = <?= isset($lead_data['contact_person_mobile']) ? $lead_data['contact_person_mobile'] : "" ?>;
|
||||||
var contact_email = "<?= isset($lead_data['contact_person_email']) ? $lead_data['contact_person_email'] : "" ?>";
|
var contact_email = "<?= isset($lead_data['contact_person_email']) ? $lead_data['contact_person_email'] : "" ?>";
|
||||||
var panNo = <?= isset($lead_data['client_type']) ? $lead_data['client_type'] : "" ?>;
|
var panNo = <?= isset($lead_data['client_type']) ? $lead_data['client_type'] : "" ?>;
|
||||||
|
var buisnessType = <?= isset($lead_data['entity_type_id']) ? $lead_data['entity_type_id'] : "" ?>;
|
||||||
// console.log("client_type : ".client_type);
|
// console.log("client_type : ".client_type);
|
||||||
if (lead_data) {
|
if (lead_data) {
|
||||||
// lead_data = JSON.parse(lead_data);
|
// lead_data = JSON.parse(lead_data);
|
||||||
@ -1407,11 +1420,15 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$("#client_type").val(client_type).trigger("change");
|
$("#client_type").val(client_type).trigger("change");
|
||||||
$("#insured_name").val(clientName);
|
$("#insured_name").val(clientName);
|
||||||
$("#address1").val(lead_data.address);
|
$("#address1").val(lead_data.address);
|
||||||
|
$("#pin_code").val(lead_data.pincode);
|
||||||
$("#mobile").val(mobile);
|
$("#mobile").val(mobile);
|
||||||
$("#email").val(contact_email);
|
$("#email").val(contact_email);
|
||||||
|
console.log("buisness type : ", buisnessType);
|
||||||
|
$("#type_of_buisness").val(buisnessType);
|
||||||
// var policy_type = lead_data.policy_type_id;
|
// var policy_type = lead_data.policy_type_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1544,23 +1561,26 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function hideShowBasement(incrementFromBasement) {
|
function hideShowBasement(element) {
|
||||||
let isBasement = $(`#isBasement_${incrementFromBasement}`).is(":checked");
|
let elementID = element.id;
|
||||||
|
let increment = elementID.split("_").pop();
|
||||||
|
|
||||||
|
let isBasement = $(`#isBasement_${increment}`).is(":checked");
|
||||||
|
|
||||||
// Get the label associated with the input
|
// Get the label associated with the input
|
||||||
let label = $(`label[for='basementSI_${incrementFromBasement}']`);
|
let label = $(`label[for='basementSI_${increment}']`);
|
||||||
|
|
||||||
if (isBasement) {
|
if (isBasement) {
|
||||||
$(`#basementSI_${incrementFromBasement}`).parent().show();
|
$(`#basementSI_${increment}`).parent().show();
|
||||||
$(`#basementSI_${incrementFromBasement}`).prop("required", "required");
|
$(`#basementSI_${increment}`).prop("required", "required");
|
||||||
|
|
||||||
// Add * if not already there
|
// Add * if not already there
|
||||||
if (label.find(".text-danger").length === 0) {
|
if (label.find(".text-danger").length === 0) {
|
||||||
label.append('<span class="text-danger">*</span>');
|
label.append('<span class="text-danger">*</span>');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$(`#basementSI_${incrementFromBasement}`).parent().hide();
|
$(`#basementSI_${increment}`).parent().hide();
|
||||||
$(`#basementSI_${incrementFromBasement}`).removeAttr("required");
|
$(`#basementSI_${increment}`).removeAttr("required");
|
||||||
|
|
||||||
// Remove * if exists
|
// Remove * if exists
|
||||||
label.find(".text-danger").remove();
|
label.find(".text-danger").remove();
|
||||||
|
|||||||
@ -4,7 +4,7 @@
|
|||||||
<?php foreach ($multi_file_data as $file) : ?>
|
<?php foreach ($multi_file_data as $file) : ?>
|
||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
|
|
||||||
<input type="checkbox" class="form-check-input multi_file_attachment" id="file_<?= $file['id'] ?>" name="selected_attachment_files[]" value="<?= $file['id'] ?>" checked>
|
<input type="checkbox" class="form-check-input multi_file_attachment" id="file_<?= $file['id'] ?>" name="selected_attachment_files[]" value="<?= $file['id'] ?>">
|
||||||
<label class="form-check-label" for="file_<?= $file['id'] ?>">
|
<label class="form-check-label" for="file_<?= $file['id'] ?>">
|
||||||
<?= htmlspecialchars($file['docs_name']) ?> - <?= htmlspecialchars($file['file_name']) ?>
|
<?= htmlspecialchars($file['docs_name']) ?> - <?= htmlspecialchars($file['file_name']) ?>
|
||||||
</label>
|
</label>
|
||||||
|
|||||||
@ -20,7 +20,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address -->
|
<!-- Address -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Address</label>
|
<label for="address">Address</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -20,7 +20,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address -->
|
<!-- Address -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Address</label>
|
<label for="address">Address</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -20,7 +20,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address -->
|
<!-- Address -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Address</label>
|
<label for="address">Address</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -68,7 +68,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address -->
|
<!-- Address -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Address:</label>
|
<label for="address">Address:</label>
|
||||||
<textarea class="form-control" id="address" name="address"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -81,7 +81,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Communication Address -->
|
<!-- Communication Address -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Communication Address</label>
|
<label for="address">Communication Address</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -68,7 +68,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address -->
|
<!-- Address -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Address</label>
|
<label for="address">Address</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -14,7 +14,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address of the Insured -->
|
<!-- Address of the Insured -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Address of the Insured</label>
|
<label for="address">Address of the Insured</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -35,7 +35,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address of the Insured -->
|
<!-- Address of the Insured -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Address of the Insured</label>
|
<label for="address">Address of the Insured</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -35,7 +35,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address of the Insured -->
|
<!-- Address of the Insured -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Address of the Insured</label>
|
<label for="address">Address of the Insured</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -178,7 +178,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address -->
|
<!-- Address -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Address</label>
|
<label for="address">Address</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1">value="<?= isset($lead_edit_data['address']) ? $lead_edit_data['address'] : '' ?>"</textarea>
|
<textarea class="form-control" id="address" name="address" rows="1">value="<?= isset($lead_edit_data['address']) ? $lead_edit_data['address'] : '' ?>"</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -67,7 +67,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Communication Address -->
|
<!-- Communication Address -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Communication Address</label>
|
<label for="address">Communication Address</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -27,6 +27,10 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Address -->
|
<!-- Address -->
|
||||||
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
<div class="form-group col-md-4">
|
<div class="form-group col-md-4">
|
||||||
<label for="address">Address</label>
|
<label for="address">Address</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
|
|||||||
@ -35,7 +35,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Communication Address -->
|
<!-- Communication Address -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Communication Address</label>
|
<label for="address">Communication Address</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -33,7 +33,11 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Communication Address -->
|
<!-- Communication Address -->
|
||||||
<div class="form-group col-md-6">
|
<div class="form-group col-md-3">
|
||||||
|
<label for="pinCode">Pin Code</label>
|
||||||
|
<input type="text" class="form-control" id="pinCode" name="pincode" value="<?= isset($lead_edit_data['pincode']) ? htmlspecialchars($lead_edit_data['pincode']) : ''; ?>">
|
||||||
|
</div>
|
||||||
|
<div class="form-group col-md-3">
|
||||||
<label for="address">Communication Address</label>
|
<label for="address">Communication Address</label>
|
||||||
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
<textarea class="form-control" id="address" name="address" rows="1"><?= isset($lead_edit_data['address']) ? htmlspecialchars($lead_edit_data['address']) : ''; ?></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -516,10 +516,13 @@
|
|||||||
</div><!-- /.modal -->
|
</div><!-- /.modal -->
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
var isSaved = true;
|
||||||
// var randomColor = 'hsl(' + Math.random() * 360 + ', 100%, 93%)';
|
// var randomColor = 'hsl(' + Math.random() * 360 + ', 100%, 93%)';
|
||||||
var rfq_data = <?= isset($rfq_data['json']) ? json_encode($rfq_data['json'], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT) : '""' ?>;
|
var rfq_data = <?= isset($rfq_data['json']) ? json_encode($rfq_data['json'], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT) : '""' ?>;
|
||||||
rfq_data = rfq_data ? JSON.parse(rfq_data) : {}; // Convert to object if not already
|
rfq_data = rfq_data ? JSON.parse(rfq_data) : {}; // Convert to object if not already
|
||||||
|
|
||||||
|
var policySI = "";
|
||||||
var rfq_or_qcr = 1;
|
var rfq_or_qcr = 1;
|
||||||
var proposalDataForDropDown = {};
|
var proposalDataForDropDown = {};
|
||||||
var lead_type = "<?= $lead_data['lead_type'] ?>";
|
var lead_type = "<?= $lead_data['lead_type'] ?>";
|
||||||
@ -547,6 +550,9 @@
|
|||||||
'insurers': []
|
'insurers': []
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var tdChanged = false;
|
||||||
|
var changedNewSI = "";
|
||||||
var suggestions = {};
|
var suggestions = {};
|
||||||
var policyInformationData = <?= isset($rfq_data['registration_json']) ? json_encode($rfq_data['registration_json'], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT) : '""' ?>;
|
var policyInformationData = <?= isset($rfq_data['registration_json']) ? json_encode($rfq_data['registration_json'], JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP | JSON_HEX_QUOT) : '""' ?>;
|
||||||
var storedData = {};
|
var storedData = {};
|
||||||
@ -564,6 +570,7 @@
|
|||||||
// // console.log("policy summary is set :", !$.isEmptyObject(policySummary) ? "no" : "yes")
|
// // console.log("policy summary is set :", !$.isEmptyObject(policySummary) ? "no" : "yes")
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
myModal = new bootstrap.Modal(document.getElementById('policyRegisterModel'));
|
myModal = new bootstrap.Modal(document.getElementById('policyRegisterModel'));
|
||||||
|
// monitorTableChanges();
|
||||||
});
|
});
|
||||||
var tableCount = 0;
|
var tableCount = 0;
|
||||||
const policies = <?= json_encode($policies) ?>;
|
const policies = <?= json_encode($policies) ?>;
|
||||||
@ -688,6 +695,7 @@
|
|||||||
// Remove a proposal column
|
// Remove a proposal column
|
||||||
function removeProposal(proposalNumber) {
|
function removeProposal(proposalNumber) {
|
||||||
|
|
||||||
|
isSaved = false;
|
||||||
// alert(proposalNumber);
|
// alert(proposalNumber);
|
||||||
var rowIdCount = {};
|
var rowIdCount = {};
|
||||||
|
|
||||||
@ -801,6 +809,7 @@
|
|||||||
function addRow(event, element) {
|
function addRow(event, element) {
|
||||||
|
|
||||||
// // console.log(' event ', element);
|
// // console.log(' event ', element);
|
||||||
|
isSaved = false;
|
||||||
const button = event.target;
|
const button = event.target;
|
||||||
const row = button.closest('tr');
|
const row = button.closest('tr');
|
||||||
const table = row.closest('table');
|
const table = row.closest('table');
|
||||||
@ -826,6 +835,7 @@
|
|||||||
|
|
||||||
// Remove a row
|
// Remove a row
|
||||||
function removeRow(event) {
|
function removeRow(event) {
|
||||||
|
isSaved = false;
|
||||||
const button = event.target;
|
const button = event.target;
|
||||||
const row = button.closest('tr');
|
const row = button.closest('tr');
|
||||||
const table = row.closest('table');
|
const table = row.closest('table');
|
||||||
@ -1000,6 +1010,7 @@
|
|||||||
document.getElementById('addProposal').addEventListener('click', () => {
|
document.getElementById('addProposal').addEventListener('click', () => {
|
||||||
// // console.log("proposal count before ", proposalCount);
|
// // console.log("proposal count before ", proposalCount);
|
||||||
proposalCount++;
|
proposalCount++;
|
||||||
|
isSaved = false;
|
||||||
// // console.log("proposal count after ", proposalCount);
|
// // console.log("proposal count after ", proposalCount);
|
||||||
|
|
||||||
quotesConfig[proposalCount] = ['Sum Insured'];
|
quotesConfig[proposalCount] = ['Sum Insured'];
|
||||||
@ -1037,7 +1048,13 @@
|
|||||||
|
|
||||||
// Add new quote sub-header
|
// Add new quote sub-header
|
||||||
const newQuoteHeader = document.createElement('th');
|
const newQuoteHeader = document.createElement('th');
|
||||||
|
if (table.id != "public_liability_addOnCoverage"){
|
||||||
|
|
||||||
newQuoteHeader.textContent = 'Sum Insured';
|
newQuoteHeader.textContent = 'Sum Insured';
|
||||||
|
|
||||||
|
}else{
|
||||||
|
newQuoteHeader.textContent = "Liability Limit";
|
||||||
|
}
|
||||||
newQuoteHeader.style.backgroundColor = randomColor;
|
newQuoteHeader.style.backgroundColor = randomColor;
|
||||||
headerRow2.insertBefore(newQuoteHeader, headerRow2.querySelector('th:last-child'));
|
headerRow2.insertBefore(newQuoteHeader, headerRow2.querySelector('th:last-child'));
|
||||||
|
|
||||||
@ -1586,19 +1603,26 @@
|
|||||||
</th>
|
</th>
|
||||||
`).join('')}
|
`).join('')}
|
||||||
<th>Action</th>`;
|
<th>Action</th>`;
|
||||||
|
console.log("quotesConfig",quotesConfig);
|
||||||
const headerRow2 = document.createElement('tr');
|
const headerRow2 = document.createElement('tr');
|
||||||
headerRow2.innerHTML = `
|
headerRow2.innerHTML = `
|
||||||
<th>-</th>
|
<th>-</th>
|
||||||
<th>-</th>
|
<th>-</th>
|
||||||
|
|
||||||
${Object.entries(quotesConfig).flatMap(([proposal, codes]) =>
|
${Object.entries(quotesConfig).flatMap(([proposal, codes]) =>
|
||||||
|
// codes.map(code => `
|
||||||
|
// <th data-proposal="${proposal}" data-quote="${code}" class="${code !== 'Sum Insured' && code !== "Liability Limit" ? 'insurer_proposal' : ''}">
|
||||||
|
// ${table.id == "public_liability_addOnCoverage" ? "Liability Limit" : code}
|
||||||
|
// <span class="three-dot-menu" onclick="showDropdown(event)">⋮</span>
|
||||||
|
// <div class="dropdown-content">
|
||||||
|
// <button onclick="removeQuote(event, ${proposal}, '${code}')">Remove Quote</button>
|
||||||
|
// </div>
|
||||||
|
// </th>
|
||||||
|
// `)
|
||||||
|
// ).join('')}
|
||||||
codes.map(code => `
|
codes.map(code => `
|
||||||
<th data-proposal="${proposal}" data-quote="${code}" class="${code !== 'Sum Insured' ? 'insurer_proposal' : ''}">
|
<th data-proposal="${proposal}" data-quote="${code}" class="${code !== 'Sum Insured' && code !== "Liability Limit" ? 'insurer_proposal' : ''}">
|
||||||
${code}
|
${table.id == "public_liability_addOnCoverage" ? "Liability Limit" : code}
|
||||||
<span class="three-dot-menu" onclick="showDropdown(event)">⋮</span>
|
|
||||||
<div class="dropdown-content">
|
|
||||||
<button onclick="removeQuote(event, ${proposal}, '${code}')">Remove Quote</button>
|
|
||||||
</div>
|
|
||||||
</th>
|
</th>
|
||||||
`)
|
`)
|
||||||
).join('')}
|
).join('')}
|
||||||
@ -1724,7 +1748,7 @@
|
|||||||
let subHeaderText = subHeaderTh ? subHeaderTh.textContent.trim() : '';
|
let subHeaderText = subHeaderTh ? subHeaderTh.textContent.trim() : '';
|
||||||
// // console.log("Subheader th: below code",subHeaderText);
|
// // console.log("Subheader th: below code",subHeaderText);
|
||||||
// Check if subheader is NOT "Sum Insured"
|
// Check if subheader is NOT "Sum Insured"
|
||||||
let className = !subHeaderText.startsWith("Sum Insured") && subHeaderText != "-" ?
|
let className = !subHeaderText.startsWith("Sum Insured") && subHeaderText != "-" && !subHeaderText.startsWith("Liability Limit")?
|
||||||
"insurer_proposal" : "";
|
"insurer_proposal" : "";
|
||||||
// console.log("className", className);
|
// console.log("className", className);
|
||||||
// alert(subHeaderText);
|
// alert(subHeaderText);
|
||||||
@ -1776,6 +1800,17 @@
|
|||||||
tableContainer.appendChild(collapsibleBar);
|
tableContainer.appendChild(collapsibleBar);
|
||||||
tableContainer.appendChild(tableContent);
|
tableContainer.appendChild(tableContent);
|
||||||
container.appendChild(tableContainer);
|
container.appendChild(tableContainer);
|
||||||
|
monitorTableChanges();
|
||||||
|
|
||||||
|
if (changedNewSI != null && changedNewSI != ""){
|
||||||
|
|
||||||
|
console.log("Changed new SI",changedNewSI);
|
||||||
|
setTimeout(function() {
|
||||||
|
updateAddON(changedNewSI)
|
||||||
|
}, 500);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1827,7 +1862,7 @@
|
|||||||
|
|
||||||
let subHeaderText = subHeaderTh ? subHeaderTh.textContent.trim() : '';
|
let subHeaderText = subHeaderTh ? subHeaderTh.textContent.trim() : '';
|
||||||
// Check if subheader is NOT "Sum Insured"
|
// Check if subheader is NOT "Sum Insured"
|
||||||
let className = !subHeaderText.startsWith("Sum Insured") && subHeaderText != "-" ?
|
let className = !subHeaderText.startsWith("Sum Insured") && subHeaderText != "-" && !subHeaderText.startsWith("Liability Limit")?
|
||||||
"insurer_proposal" : ""; // alert(subHeaderText);
|
"insurer_proposal" : ""; // alert(subHeaderText);
|
||||||
let defaultJsonString = typeof default_answers_array == "object" ? JSON.stringify(default_answers_array[0]) : String(default_answers_array);
|
let defaultJsonString = typeof default_answers_array == "object" ? JSON.stringify(default_answers_array[0]) : String(default_answers_array);
|
||||||
|
|
||||||
@ -1863,10 +1898,12 @@
|
|||||||
});
|
});
|
||||||
moveExcessTableLast();
|
moveExcessTableLast();
|
||||||
styleTableColumns();
|
styleTableColumns();
|
||||||
|
monitorTableChanges()
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
// Initialize the parent table
|
// Initialize the parent table
|
||||||
document.addEventListener('DOMContentLoaded', () => {
|
document.addEventListener('DOMContentLoaded', () => {
|
||||||
@ -1883,6 +1920,7 @@
|
|||||||
localStorage.setItem('allTablesJsonData', JSON.stringify(rfq_data));
|
localStorage.setItem('allTablesJsonData', JSON.stringify(rfq_data));
|
||||||
jsonToTables();
|
jsonToTables();
|
||||||
styleTableColumns();
|
styleTableColumns();
|
||||||
|
monitorTableChanges();
|
||||||
proposalDataForDropDown = rfq_data[rfq_data.length - 1].proposal_data;
|
proposalDataForDropDown = rfq_data[rfq_data.length - 1].proposal_data;
|
||||||
// // console.log("proposalDataForDropDown", proposalDataForDropDown);
|
// // console.log("proposalDataForDropDown", proposalDataForDropDown);
|
||||||
if (!$.isEmptyObject(storedData)) {
|
if (!$.isEmptyObject(storedData)) {
|
||||||
@ -2190,6 +2228,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function addOrRemoveIcon(element, event) {
|
function addOrRemoveIcon(element, event) {
|
||||||
|
isSaved = false;
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
|
|
||||||
// Get the parent dropdown to access both buttons reliably
|
// Get the parent dropdown to access both buttons reliably
|
||||||
@ -2257,16 +2296,20 @@
|
|||||||
// // console.log("anchor link clicked ", policyName);
|
// // console.log("anchor link clicked ", policyName);
|
||||||
|
|
||||||
|
|
||||||
myModal = new bootstrap.Modal(document.getElementById('policyRegisterModel'));
|
myModal = new bootstrap.Modal(document.getElementById('policyRegisterModel'),{
|
||||||
|
backdrop: 'static',
|
||||||
|
keyboard: false
|
||||||
|
});
|
||||||
// // console.log("inside if condition");
|
// // console.log("inside if condition");
|
||||||
|
|
||||||
var leadID = $("#lead_id").val();
|
var leadID = $("#lead_id").val();
|
||||||
let policy = policies.find(p => p.name === policyName);
|
let policy = policies.find(p => p.name === policyName);
|
||||||
// alert(policy.quote_asked[0]);
|
// alert(policy.quote_asked[0]);
|
||||||
// var policySI = policies[]
|
// var policySI = policies[]
|
||||||
|
policySI = rfq_count == 0 && !tdChanged ? policy.quote_asked[0] : (changedNewSI) != "" && changedNewSI != 0? changedNewSI : policy.quote_asked[0];
|
||||||
|
console.log("policy si",policySI,"rfq ount ",rfq_count,"tdchanged ",tdChanged,"changedNewSI",changedNewSI);
|
||||||
$("#policyName").val(policyName);
|
$("#policyName").val(policyName);
|
||||||
$("#policySI").val(policy.quote_asked[0]);
|
$("#policySI").val(policySI);
|
||||||
$("#leadID").val(leadID);
|
$("#leadID").val(leadID);
|
||||||
$("#multilocation_type_div").hide();
|
$("#multilocation_type_div").hide();
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -2296,28 +2339,21 @@
|
|||||||
|
|
||||||
// Loop through each location and generate the summary rows dynamically
|
// Loop through each location and generate the summary rows dynamically
|
||||||
for (let i = 0; i < locationCount; i++) {
|
for (let i = 0; i < locationCount; i++) {
|
||||||
let locationIndex = i + 1; // To make it 1-based instead of 0-based
|
let locationIndex = i + 1;
|
||||||
|
|
||||||
tableRowContent.push({
|
let rowContents = [
|
||||||
table_type: "new",
|
{
|
||||||
table_id: `${policyName}_summary_` + locationIndex,
|
|
||||||
table_editable: true,
|
|
||||||
table_name: "Risk Location " + locationIndex + "- " +
|
|
||||||
storedData.locations[i].policyRisk['occupancy'] + "- " +
|
|
||||||
storedData.locations[i].policyRisk['address1'] + " " +
|
|
||||||
storedData.locations[i].policyRisk['address2'],
|
|
||||||
table_row_contents: [{
|
|
||||||
[`fire_plantMachineries_${locationIndex}`]: {
|
[`fire_plantMachineries_${locationIndex}`]: {
|
||||||
"display_value": "Plant & Machineries and Accessories",
|
"display_value": "Plant & Machineries and Accessories",
|
||||||
"answer_type": "free-text",
|
"answer_type": "free-text",
|
||||||
"default_answer": storedData.locations[i].policyRiskSplitUp?.plantAndMachinery || ""
|
"default_answer": storedData.locations[i].policyRiskSplitUp?.plant_and_machinery || ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
[`fire_electricalFittings_${locationIndex}`]: {
|
[`fire_electricalFittings_${locationIndex}`]: {
|
||||||
"display_value": "Electronic Equipments and Accessories",
|
"display_value": "Electronic Equipments and Accessories",
|
||||||
"answer_type": "free-text",
|
"answer_type": "free-text",
|
||||||
"default_answer": storedData.locations[i].policyRiskSplitUp?.electricalFittings || ""
|
"default_answer": storedData.locations[i].policyRiskSplitUp?.electrical_fittings || ""
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -2333,13 +2369,53 @@
|
|||||||
"answer_type": "free-text",
|
"answer_type": "free-text",
|
||||||
"default_answer": storedData.locations[i].policyRiskSplitUp?.content || ""
|
"default_answer": storedData.locations[i].policyRiskSplitUp?.content || ""
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
[`fire_content_${locationIndex}`]: {
|
||||||
|
"display_value": "Stock",
|
||||||
|
"answer_type": "free-text",
|
||||||
|
"default_answer": storedData.locations[i].policyRiskSplitUp?.finished_stock || ""
|
||||||
}
|
}
|
||||||
]
|
}
|
||||||
|
];
|
||||||
|
|
||||||
|
// ✅ Keep the structure, add extra only if value is present
|
||||||
|
const riskSplit = storedData.locations[i].policyRiskSplitUp || {};
|
||||||
|
|
||||||
|
if (riskSplit.stock_in_process) {
|
||||||
|
rowContents.push({
|
||||||
|
[`fire_content_${locationIndex}`]: {
|
||||||
|
"display_value": "Stock In Process",
|
||||||
|
"answer_type": "free-text",
|
||||||
|
"default_answer": riskSplit.stock_in_process
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (riskSplit.raw_material) {
|
||||||
|
rowContents.push({
|
||||||
|
[`fire_content_${locationIndex}`]: {
|
||||||
|
"display_value": "Raw Materials",
|
||||||
|
"answer_type": "free-text",
|
||||||
|
"default_answer": riskSplit.raw_material
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
tableRowContent.push({
|
||||||
|
table_type: "new",
|
||||||
|
table_id: `${policyName}_summary_` + locationIndex,
|
||||||
|
table_editable: true,
|
||||||
|
table_name: "Risk Location " + locationIndex + "- " +
|
||||||
|
storedData.locations[i].policyRisk['occupancy'] + "- " +
|
||||||
|
storedData.locations[i].policyRisk['address1'] + " " +
|
||||||
|
storedData.locations[i].policyRisk['address2'],
|
||||||
|
table_row_contents: rowContents
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var policySummary = tableRowContent;
|
var policySummary = tableRowContent;
|
||||||
// // console.log("policy summary ", policySummary);
|
console.log("policy summary ", policySummary);
|
||||||
return policySummary;
|
return policySummary;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2406,6 +2482,8 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function saveRFQ() {
|
function saveRFQ() {
|
||||||
|
// alert("Function Called");
|
||||||
|
isSaved = true;
|
||||||
// // console.log("save button clicked");
|
// // console.log("save button clicked");
|
||||||
leadJson = tablesToJson();
|
leadJson = tablesToJson();
|
||||||
// // console.log("json from function ", leadJson);
|
// // console.log("json from function ", leadJson);
|
||||||
@ -2775,8 +2853,13 @@
|
|||||||
return allTablesData;
|
return allTablesData;
|
||||||
}
|
}
|
||||||
|
|
||||||
function openQCR() {
|
async function openQCR() {
|
||||||
|
|
||||||
|
if (!isSaved){
|
||||||
|
const proceed = await confirmUnsavedChanges();
|
||||||
|
// if (!proceed) {}
|
||||||
|
// return;
|
||||||
|
}
|
||||||
const url = window.location.pathname; // Get the path (e.g., "/nhance/rfq/list/75/1")
|
const url = window.location.pathname; // Get the path (e.g., "/nhance/rfq/list/75/1")
|
||||||
const segments = url.split("/"); // Split by "/"
|
const segments = url.split("/"); // Split by "/"
|
||||||
segments[segments.length - 1] = "2"; // Change the last segment
|
segments[segments.length - 1] = "2"; // Change the last segment
|
||||||
@ -2987,6 +3070,7 @@
|
|||||||
|
|
||||||
// Create body
|
// Create body
|
||||||
const tbody = document.createElement('tbody');
|
const tbody = document.createElement('tbody');
|
||||||
|
var cellCount = 0;
|
||||||
tableEntry.table_data.data.forEach((rowData, rowDataIndex) => {
|
tableEntry.table_data.data.forEach((rowData, rowDataIndex) => {
|
||||||
const tr = document.createElement('tr');
|
const tr = document.createElement('tr');
|
||||||
tr.id = rowData.row_id;
|
tr.id = rowData.row_id;
|
||||||
@ -3032,20 +3116,29 @@
|
|||||||
|
|
||||||
if (lead_type == 1){
|
if (lead_type == 1){
|
||||||
td.onclick = () => getAnswer(table.id, tr.id);
|
td.onclick = () => getAnswer(table.id, tr.id);
|
||||||
if (cellData.subth != "Sum Insured") {
|
if (cellData.subth != "Sum Insured" && cellData.subth != "Liability Limit") {
|
||||||
td.onclick = () => getAnswer(table.id, tr.id);
|
td.onclick = () => getAnswer(table.id, tr.id);
|
||||||
td.classList.add("insurer_proposal");
|
td.classList.add("insurer_proposal");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
td.onclick = () => getAnswer(table.id, tr.id);
|
td.onclick = () => getAnswer(table.id, tr.id);
|
||||||
if (cellData.subth != "Sum Insured") {
|
if (cellData.subth != "Sum Insured" && cellData.subth != "Liability Limit") {
|
||||||
td.onclick = () => getAnswer(table.id, tr.id);
|
td.onclick = () => getAnswer(table.id, tr.id);
|
||||||
td.classList.add("insurer_proposal");
|
td.classList.add("insurer_proposal");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (cellData.subth == "Sum Insured" && cellData.parentth == "Proposal 1" && table.id == "" && cellCount === 0){
|
||||||
|
console.log("cell count : ",cellCount)
|
||||||
|
changedNewSI = cellData.input_value;
|
||||||
|
console.log("changed new si from jsontotables",changedNewSI);
|
||||||
|
$("#policySI").val(changedNewSI);
|
||||||
|
cellCount = cellCount + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
td.contentEditable = true;
|
td.contentEditable = true;
|
||||||
|
|
||||||
|
|
||||||
@ -3246,8 +3339,8 @@
|
|||||||
const matchedInsurer = insurers.find(ins => ins.ins_name == subHeader);
|
const matchedInsurer = insurers.find(ins => ins.ins_name == subHeader);
|
||||||
|
|
||||||
|
|
||||||
if (subHeader != "Sum Insured") {
|
if (subHeader != "Sum Insured" && subHeader != "Liability Limit") {
|
||||||
// // console.log("trying to find something : matchedInsurer", matchedInsurer);
|
console.log("trying to find something : matchedInsurer", subHeader);
|
||||||
// // console.log("trying to find something :matchedInsurer stc ", matchedInsurer.stc);
|
// // console.log("trying to find something :matchedInsurer stc ", matchedInsurer.stc);
|
||||||
// // console.log("trying to find something : ", matchedInsurer.stc);
|
// // console.log("trying to find something : ", matchedInsurer.stc);
|
||||||
|
|
||||||
@ -3656,7 +3749,7 @@
|
|||||||
subHeaderRow.children("th, td").each(function(actualIndex) {
|
subHeaderRow.children("th, td").each(function(actualIndex) {
|
||||||
colIndexTracker[visualIndex] = actualIndex;
|
colIndexTracker[visualIndex] = actualIndex;
|
||||||
|
|
||||||
if ($(this).text().trim() === "Sum Insured") {
|
if ($(this).text().trim() === "Sum Insured" || $(this).text().trim() === "Liability Limit") {
|
||||||
targetColumnIndexes.push(visualIndex);
|
targetColumnIndexes.push(visualIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4238,8 +4331,13 @@
|
|||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
function checkTheTableDataChanged(redirect_type) {
|
async function checkTheTableDataChanged(redirect_type) {
|
||||||
|
|
||||||
|
if (!isSaved){
|
||||||
|
const proceed = await confirmUnsavedChanges();
|
||||||
|
// if (!proceed) {}
|
||||||
|
// return;
|
||||||
|
}
|
||||||
|
|
||||||
if (redirect_type == 1) {
|
if (redirect_type == 1) {
|
||||||
//BACK BUTTON
|
//BACK BUTTON
|
||||||
@ -4868,4 +4966,229 @@
|
|||||||
createIcon(stcButton);
|
createIcon(stcButton);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function monitorTableChanges() {
|
||||||
|
console.log("monitoring table changes");
|
||||||
|
var proposalValue = "";
|
||||||
|
// Get the first table
|
||||||
|
const table = document.querySelector("table");
|
||||||
|
if (!table) return;
|
||||||
|
|
||||||
|
// Get the first row in the tbody
|
||||||
|
const firstRow = table.querySelector("tbody tr");
|
||||||
|
if (!firstRow) return;
|
||||||
|
|
||||||
|
// console.log("firstRow : ",firstRow);
|
||||||
|
|
||||||
|
// Get all cells in the first row
|
||||||
|
const cells = firstRow.querySelectorAll("td");
|
||||||
|
|
||||||
|
// Get header rows to identify which columns are "Sum Insured"
|
||||||
|
const headerRow1 = table.querySelector("thead tr:nth-child(1)");
|
||||||
|
const headerRow2 = table.querySelector("thead tr:nth-child(2)");
|
||||||
|
|
||||||
|
if (!headerRow1 || !headerRow2) return;
|
||||||
|
|
||||||
|
// console.log("headerRow1 : ",headerRow1);
|
||||||
|
// console.log("headerRow2 : ",headerRow2);
|
||||||
|
// Find which column is the "Sum Insured" column
|
||||||
|
let sumInsuredColumnIndex = -1;
|
||||||
|
const subHeaders = headerRow2.querySelectorAll("th");
|
||||||
|
|
||||||
|
subHeaders.forEach((th, index) => {
|
||||||
|
if (th.textContent.trim() === "Sum Insured") {
|
||||||
|
proposalValue = th.getAttribute("data-proposal");
|
||||||
|
sumInsuredColumnIndex = index;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// console.log("sumInsuredColumnIndex : ",sumInsuredColumnIndex);
|
||||||
|
|
||||||
|
if (sumInsuredColumnIndex === -1) return;
|
||||||
|
|
||||||
|
// Check if we have a cell at that index
|
||||||
|
if (cells.length > sumInsuredColumnIndex) {
|
||||||
|
console.log("It is there");
|
||||||
|
const sumInsuredCell = cells[sumInsuredColumnIndex];
|
||||||
|
|
||||||
|
let previousValue = "";
|
||||||
|
// Add event listener for changes
|
||||||
|
sumInsuredCell.addEventListener("focus", function () {
|
||||||
|
previousValue = this.textContent.trim();
|
||||||
|
});
|
||||||
|
|
||||||
|
sumInsuredCell.addEventListener("blur", function () {
|
||||||
|
const newValue = this.textContent.trim();
|
||||||
|
if (newValue !== previousValue) {
|
||||||
|
tdChanged = true;
|
||||||
|
changedNewSI = newValue;
|
||||||
|
$("#policySI").val(newValue);
|
||||||
|
console.log("new Value",changedNewSI);
|
||||||
|
// alert(newValue);
|
||||||
|
updateAddON(newValue,proposalValue);
|
||||||
|
console.log("Sum Insured value changed to:", newValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
console.log("Sum Insured column not found");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateAddON(newValue,proposalValue = null) {
|
||||||
|
console.log("Function called");
|
||||||
|
var table = document.getElementById("fire_addOnCoverage");
|
||||||
|
|
||||||
|
console.log("table : ",table);
|
||||||
|
if (!table) return;
|
||||||
|
|
||||||
|
const thead = table.querySelector("thead");
|
||||||
|
const tbody = table.querySelector("tbody");
|
||||||
|
|
||||||
|
if (!thead || !tbody) return;
|
||||||
|
|
||||||
|
const topHeaderCells = thead.rows[0].cells;
|
||||||
|
const subHeaderCells = thead.rows[1].cells;
|
||||||
|
|
||||||
|
let targetIndexes = [];
|
||||||
|
|
||||||
|
// Find indexes of columns with the required headers
|
||||||
|
for (let i = 0; i < topHeaderCells.length; i++) {
|
||||||
|
const topHeaderText = topHeaderCells[i].textContent.trim();
|
||||||
|
const subHeaderText = subHeaderCells[i] ? subHeaderCells[i].textContent.trim() : "";
|
||||||
|
|
||||||
|
const subheaderProposalValue = subHeaderCells[i]?.getAttribute("data-proposal");
|
||||||
|
console.log("subheaderProposalValue : ",subheaderProposalValue);
|
||||||
|
console.log("proposalValue : ",proposalValue);
|
||||||
|
|
||||||
|
if (proposalValue != "" && proposalValue != null){
|
||||||
|
|
||||||
|
if (subheaderProposalValue !== proposalValue) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if ((topHeaderText.startsWith("Pro") || topHeaderText.startsWith("Exis")) && subHeaderText === "Sum Insured") {
|
||||||
|
targetIndexes.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through the first 3 rows of tbody and update the matching cells
|
||||||
|
for (let rowIndex = 0; rowIndex < Math.min(3, tbody.rows.length); rowIndex++) {
|
||||||
|
const row = tbody.rows[rowIndex];
|
||||||
|
targetIndexes.forEach(colIndex => {
|
||||||
|
if (row.cells[colIndex]) {
|
||||||
|
console.log("Found row to update")
|
||||||
|
if (['fire_stfi', 'fire_eq'].includes(row.id)) {
|
||||||
|
row.cells[colIndex].textContent = newValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (row.id == "fire_terrorism"){
|
||||||
|
if (storedPolicyData){
|
||||||
|
|
||||||
|
console.log("storedPolicyData : ",storedPolicyData);
|
||||||
|
var is_terrorism = storedPolicyData.fire.policyDetails.terrorism;
|
||||||
|
|
||||||
|
console.log("is terrorism",is_terrorism);
|
||||||
|
if (is_terrorism == "yes"){
|
||||||
|
row.cells[colIndex].textContent = `Yes, ${newValue}`;
|
||||||
|
}else{
|
||||||
|
row.cells[colIndex].textContent = "No"
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
row.cells[colIndex].textContent = "No"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function changeTerrorism(newValue){
|
||||||
|
|
||||||
|
storedPolicyData = JSON.parse(localStorage.getItem('policyData'));
|
||||||
|
|
||||||
|
console.log("Stroredpolicy data : ",storedPolicyData);
|
||||||
|
|
||||||
|
console.log("Change terrorism Function Called");
|
||||||
|
var table = document.getElementById("fire_addOnCoverage");
|
||||||
|
if (!table) return;
|
||||||
|
|
||||||
|
const thead = table.querySelector("thead");
|
||||||
|
const tbody = table.querySelector("tbody");
|
||||||
|
|
||||||
|
if (!thead || !tbody) return;
|
||||||
|
|
||||||
|
const topHeaderCells = thead.rows[0].cells;
|
||||||
|
const subHeaderCells = thead.rows[1].cells;
|
||||||
|
|
||||||
|
let targetIndexes = [];
|
||||||
|
|
||||||
|
// Find indexes of columns with the required headers
|
||||||
|
for (let i = 0; i < topHeaderCells.length; i++) {
|
||||||
|
const topHeaderText = topHeaderCells[i].textContent.trim();
|
||||||
|
const subHeaderText = subHeaderCells[i] ? subHeaderCells[i].textContent.trim() : "";
|
||||||
|
|
||||||
|
|
||||||
|
if ((topHeaderText.startsWith("Pro") || topHeaderText.startsWith("Exis")) && subHeaderText === "Sum Insured") {
|
||||||
|
targetIndexes.push(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Loop through the first 3 rows of tbody and update the matching cells
|
||||||
|
for (let rowIndex = 0; rowIndex < Math.min(3, tbody.rows.length); rowIndex++) {
|
||||||
|
const row = tbody.rows[rowIndex];
|
||||||
|
targetIndexes.forEach(colIndex => {
|
||||||
|
if (row.cells[colIndex]) {
|
||||||
|
|
||||||
|
if (row.id == "fire_terrorism"){
|
||||||
|
console.log("Found the row");
|
||||||
|
if (storedPolicyData){
|
||||||
|
|
||||||
|
console.log("storedPolicyData : ",storedPolicyData);
|
||||||
|
var is_terrorism = storedPolicyData.fire.policyDetails.terrorism;
|
||||||
|
updateAddON(newValue);
|
||||||
|
if (is_terrorism == "yes"){
|
||||||
|
row.cells[colIndex].textContent = `Yes, ${newValue}`;
|
||||||
|
}else{
|
||||||
|
row.cells[colIndex].textContent = "No"
|
||||||
|
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
row.cells[colIndex].textContent = "No"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('input', function (e) {
|
||||||
|
if (e.target.matches('td[contenteditable]')) {
|
||||||
|
isSaved = false;
|
||||||
|
// alert("status changed");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
async function confirmUnsavedChanges() {
|
||||||
|
|
||||||
|
const result = await Swal.fire({
|
||||||
|
title: 'Unsaved changes',
|
||||||
|
text: 'Please save your changes before continuing.',
|
||||||
|
icon: 'warning',
|
||||||
|
showCancelButton: true,
|
||||||
|
confirmButtonText: 'Save Now',
|
||||||
|
cancelButtonText: 'Cancel'
|
||||||
|
});
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
saveRFQ();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
Loading…
Reference in New Issue
Block a user