Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
Srinivas-Saravanan 2025-03-22 10:20:47 +05:30
commit 027bc8b4cf
7 changed files with 207 additions and 165 deletions

View File

@ -439,6 +439,7 @@ $routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin"); $routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin"); $routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
$routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId"); $routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId");
$routes->post("/employeeRest/updateEmpOTP", "RestAuthenticationController::updateEmpOTP");
//HR login api's //HR login api's
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber"); $routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");

View File

@ -4711,6 +4711,10 @@ class ClientController extends AdminController
// $empmodel = new EmployeeModel(); // $empmodel = new EmployeeModel();
// $data = $empmodel->getEmployeePolicy(348); // $data = $empmodel->getEmployeePolicy(348);
// dd($data); // dd($data);
// $LeadsController = new LeadsController();
// $LeadsController->constructNonEbExcelToSaveTemp(92, 2, "Proposal 2-ICICIPRU-ICICI001");
} }
// ------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------

View File

@ -2455,76 +2455,6 @@ class LeadsController extends BaseController
$this->loadLayout('view_rfq_non_eb'); $this->loadLayout('view_rfq_non_eb');
} }
// public function getLeadNonEB($type, $id = null)
// {
// // Set basic data
// $data['issuer'] = $this->issuer;
// $data['client_type'] = $this->clientType;
// $data['lead_type'] = $this->leadType;
// $data['lead_status'] = $this->leadsStatus;
// // Fetch policy types and entity data
// $data['policy_type'] = $this->policyTypeModel->where('is_active', 1)->findAll();
// $data['entity'] = $this->kycEntityTypeModel->where('is_active', 1)->findAll();
// // Fetch insurer and TPA branch data
// $data['insurer'] = $this->insurerBranchModel->getInsurerBranchesWithInsurerNames();
// $data['tpa'] = $this->tpaBranchModel->getTpaBranchesWithTpaNames();
// // print_r($data['tpa']);die();
// // Fetch sales team members who are active in team 5
// $data['salse_team'] = $this->userModel
// ->select('user_profiles.*')
// ->join('user_teams', 'user_profiles.id = user_teams.user_id')
// ->where('user_teams.team_id', 5)
// ->where('user_teams.is_active', 1)
// ->where('user_profiles.is_active', 1)
// ->findAll();
// // dd($data);
// $data['lastFiveYears'] = $this->getLastFiveFinancialYears();
// $data['gpaClaimType'] = $this->claim_type_for_gpa;
// $data['causeOfDeath'] = $this->cause_of_death;
// $data['selected_lead_type'] = $type;
// if(!empty($id)){
// $data['lead_edit_data'] = $this->leadsModel->where('id', $id)->first();
// if (!empty($data['lead_edit_data'])) {
// $data['lead_edit_data']['policy_start_date'] = !empty($data['lead_edit_data']['policy_start_date'])
// ? change_date_format($data['lead_edit_data']['policy_start_date'], 'Y-m-d', 'd/m/Y')
// : null;
// $data['lead_edit_data']['policy_end_date'] = !empty($data['lead_edit_data']['policy_end_date'])
// ? change_date_format($data['lead_edit_data']['policy_end_date'], 'Y-m-d', 'd/m/Y')
// : null;
// $data['lead_edit_data']['incurred_claims_date'] = !empty($data['lead_edit_data']['incurred_claims_date'])
// ? change_date_format($data['lead_edit_data']['incurred_claims_date'], 'Y-m-d', 'd/m/Y')
// : null;
// $data['lead_edit_data']['premium_date'] = !empty($data['lead_edit_data']['premium_date'])
// ? change_date_format($data['lead_edit_data']['premium_date'], 'Y-m-d', 'd/m/Y')
// : null;
// } else {
// $data['lead_edit_data'] = [];
// }
// if (!empty($data['lead_edit_data']['fin_years_claims'])) {
// $decoded = json_decode($data['lead_edit_data']['fin_years_claims'], true);
// $data['lead_edit_data']['fin_years_claims_array'] = isset($decoded['finyear']) ? $decoded['finyear'] : [];
// } else {
// $data['lead_edit_data']['fin_years_claims_array'] = [];
// }
// $data['lead_edit_data']['html'] = $this->generateViewPageHtml($data['lead_edit_data']['policy_type_id'], $data) ?? "";
// }
// // dd($data);
// return $this->loadLayout('leads_form_handler', $data);
// }
public function getLeadNonEB($type, $id = null) public function getLeadNonEB($type, $id = null)
{ {
// Set basic data // Set basic data
@ -2653,7 +2583,15 @@ class LeadsController extends BaseController
$lead_data = []; $lead_data = [];
} }
$lead_data = array_merge(['Insured' => $rfq_data['client_name']], $lead_data); $lead_data = array_merge(['Insured' => $rfq_data['client_name']], $lead_data);
// dd($lead_data);
// if(!empty($rfq_data['fin_years_claims'])){
// $claim_details = json_decode($rfq_data['fin_years_claims'], true) ?? [];
// if(!empty($claim_details['finyear'])){
// $lead_data['claim_details'] = $claim_details['finyear'];
// }
// Kint::dump($claim_details);
// }
$jsonData = json_decode($rfq_data['json'], true); $jsonData = json_decode($rfq_data['json'], true);
$proposalData = end($jsonData); $proposalData = end($jsonData);
@ -2748,21 +2686,29 @@ class LeadsController extends BaseController
$rowNumber += 2; $rowNumber += 2;
// Kint::dump($jsonData);
foreach ($jsonData as $key => $data) { foreach ($jsonData as $key => $data) {
// Kint::dump($data, 'First');
if ($type == 2) { if ($type == 2) {
$data = $this->convertNonEbJsonForQCR($data, $type, $proposalData);
unset($data['proposalData']); $data = $this->convertNonEbJsonForQCR($data, $type, $proposalData, $key);
// Kint::dump($data, 'Second');
if ($propsal_and_insurer !== null) { if ($propsal_and_insurer !== null) {
list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2); list($proposal_key, $insurer_key) = explode('-', $propsal_and_insurer, 2);
$data = $this->transformProposelData($data, $proposal_key, $insurer_key); $data = $this->transformNonEbProposelData($data, $proposal_key, $insurer_key, $key);
} }
unset($data['proposalData']);
} else if ($type == 1) { } else if ($type == 1) {
$data = $this->convertNonEbJsonForQCR($data, $type, $proposalData); $data = $this->convertNonEbJsonForQCR($data, $type, $proposalData, $key);
unset($data['proposalData']); unset($data['proposalData']);
} }
// dd($data);
// Add headers and subheaders // Add headers and subheaders
$headers = $data['table_data']['headers']; $headers = $data['table_data']['headers'];
// dd($headers); // dd($headers);
@ -2781,7 +2727,7 @@ class LeadsController extends BaseController
$sheet->getColumnDimension($columnLetter)->setWidth(60); $sheet->getColumnDimension($columnLetter)->setWidth(60);
if ($header['parentHeader'] == '') { if ($header['parentHeader'] == 'Policy') {
// $header['parentHeader'] = 'S.No.'; // $header['parentHeader'] = 'S.No.';
$sheet->getColumnDimension('A')->setWidth(10); $sheet->getColumnDimension('A')->setWidth(10);
} }
@ -2875,7 +2821,7 @@ class LeadsController extends BaseController
if ($cellData['parentth'] == 'SNO') { if ($cellData['parentth'] == 'SNO') {
$sheet->setCellValue("{$columnLetter}{$rowNumber}", $serial_no); $sheet->setCellValue("{$columnLetter}{$rowNumber}", $serial_no);
} else if ($cellData['parentth'] == '') { } else if ($cellData['parentth'] == 'Policy') {
$mergeStart = $rowNumber; // Start row for merging $mergeStart = $rowNumber; // Start row for merging
$mergeEnd = $rowNumber + ($cellData['rowspan'] - 1); // End row for merging $mergeEnd = $rowNumber + ($cellData['rowspan'] - 1); // End row for merging
@ -2884,7 +2830,7 @@ class LeadsController extends BaseController
$sheet->getStyle("{$columnLetter}{$mergeStart}:{$columnLetter}{$mergeEnd}") $sheet->getStyle("{$columnLetter}{$mergeStart}:{$columnLetter}{$mergeEnd}")
->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER); ->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
} else { } else {
$sheet->setCellValue("{$columnLetter}{$rowNumber}", $cellData['display_value']); $sheet->setCellValue("{$columnLetter}{$rowNumber}", $cellData['display_content']);
} }
$columnLetter++; $columnLetter++;
@ -2952,6 +2898,7 @@ class LeadsController extends BaseController
]); ]);
} }
// dd($rowNumber);
// Set filename // Set filename
$string = ($type == 2) ? 'QCR' : 'RFQ'; $string = ($type == 2) ? 'QCR' : 'RFQ';
$filename = "{$string}_{$rfq_data['client_short_name']}_{$rfq_data['policy_type']}_" . date('YmdHis') . '.xlsx'; $filename = "{$string}_{$rfq_data['client_short_name']}_{$rfq_data['policy_type']}_" . date('YmdHis') . '.xlsx';
@ -2967,7 +2914,7 @@ class LeadsController extends BaseController
]; ];
} }
public function convertNonEbJsonForQCR($jsonArr, $type, $proposeldata) public function convertNonEbJsonForQCR($jsonArr, $type, $proposeldata, $indexOfTheTable)
{ {
$first_json = $jsonArr; $first_json = $jsonArr;
@ -2978,7 +2925,7 @@ class LeadsController extends BaseController
// Column-wise Check: Remove headers and relevant data if qcr == 0 // Column-wise Check: Remove headers and relevant data if qcr == 0
foreach ($first_json['proposal_data']['over_all_column_data'] as $proposalKey => $proposalData) { foreach ($first_json['proposal_data']['over_all_column_data'] as $proposalKey => $proposalData) {
if (($proposalData['qcr'] == 0 || $proposalData['qcr'] === false) || ($proposalData['stc'] == 0 || $proposalData['stc'] === false)) { if ((isset($proposalData['qcr']) && isset($proposalData['stc'])) && ($proposalData['qcr'] == 0 || $proposalData['qcr'] === false) || ($proposalData['stc'] == 0 || $proposalData['stc'] === false)) {
// Remove matching parentHeader in headers // Remove matching parentHeader in headers
foreach ($first_json['table_data']['headers'] as $index => $header) { foreach ($first_json['table_data']['headers'] as $index => $header) {
@ -3005,7 +2952,12 @@ class LeadsController extends BaseController
// Insurer Check: Remove subHeaders and relevant data for insurers with qcr == 0 // Insurer Check: Remove subHeaders and relevant data for insurers with qcr == 0
foreach ($proposalData['insurers'] as $insurerIndex => $insurer) { foreach ($proposalData['insurers'] as $insurerIndex => $insurer) {
if (($insurer['qcr'] === 0 || $insurer['qcr'] === false) || ($insurer['stc'] === 0 || $insurer['stc'] === false)) {
$qcr = $insurer['qcr'] ?? null;
$stc = $insurer['stc'] ?? null;
if (($qcr === 0 || $qcr === false) || ($stc === 0 || $stc === false)) {
foreach ($first_json['table_data']['headers'] as &$header) { foreach ($first_json['table_data']['headers'] as &$header) {
if (isset($header['subHeaders'])) { if (isset($header['subHeaders'])) {
$header['subHeaders'] = array_values(array_filter($header['subHeaders'], function ($sub) use ($insurer) { $header['subHeaders'] = array_values(array_filter($header['subHeaders'], function ($sub) use ($insurer) {
@ -3034,16 +2986,22 @@ class LeadsController extends BaseController
// Row-wise Check: Remove rows if qcr == 0 for actions // Row-wise Check: Remove rows if qcr == 0 for actions
foreach ($first_json['table_data']['data'] as $rowKey => $rowData) { foreach ($first_json['table_data']['data'] as $rowKey => $rowData) {
foreach ($rowData['data'] as $data) { foreach ($rowData['data'] as $data) {
if (
isset($data['parentth']) && $data['parentth'] === "Action" &&
(
(isset($data['input_value']['qcr']) && $data['input_value']['qcr'] == 0) ||
(isset($data['input_value']['stc']) && $data['input_value']['stc'] == 0)
)
) {
if ($indexOfTheTable == 0) {
if ($data['parentth'] == "Policy" && $data['input_value'] != "Checked") {
unset($first_json['table_data']['data'][$rowKey]); unset($first_json['table_data']['data'][$rowKey]);
break; // Stop checking other columns for this row break;
}
} else {
if (
isset($data['parentth'], $data['input_value']['qcr'], $data['input_value']['stc']) &&
$data['parentth'] === "Action" &&
($data['input_value']['qcr'] == 0 || $data['input_value']['stc'] == 0)
) {
unset($first_json['table_data']['data'][$rowKey]);
break;
}
} }
} }
} }
@ -3100,106 +3058,79 @@ class LeadsController extends BaseController
return null; return null;
} }
public function transformNonEbProposelData($data, $proposel, $insurer) public function transformNonEbProposelData(&$data, $proposal, $insurer, $tableCount)
{ {
// Kint::dump($data, $proposal, $insurer, $tableCount);
// print_r($data['premium_data']['data']); die; // Initialize headers with defaults
$headerData = []; $headerData = [];
// Default headers: S. No and Particulars // Add the first two default headers only once
$defaultHeaders = [ $headerData[] = [
[ 'parentHeader' => $data['table_data']['headers'][0]['parentHeader'],
'parentHeader' => 'Sno',
'subHeaders' => ['-'] 'subHeaders' => ['-']
], ];
[ $headerData[] = [
'parentHeader' => 'Particulars', 'parentHeader' => $data['table_data']['headers'][1]['parentHeader'],
'subHeaders' => ['-'] 'subHeaders' => ['-']
]
]; ];
// Add default headers to the result $second_table_name = $data['table_data']['headers'][1]['parentHeader'] ?? "";
$headerData = array_merge($headerData, $defaultHeaders);
// Loop through the headers to find matching proposal and insurer
foreach ($data['table_data']['headers'] as $header) { foreach ($data['table_data']['headers'] as $header) {
// Check if the parentHeader matches the target proposal if ($header['parentHeader'] === $proposal) {
if ($header['parentHeader'] === $proposel) {
// Check if subHeaders contain the target insurer key
foreach ($header['subHeaders'] as $subHeader) { foreach ($header['subHeaders'] as $subHeader) {
if ($subHeader === $insurer) { if ($subHeader === $insurer) {
$headerData[] = [ $headerData[] = [
'parentHeader' => $header['parentHeader'], 'parentHeader' => $header['parentHeader'],
'subHeaders' => [ 'subHeaders' => ['Quote asked', $subHeader]
'Quote asked', // Default value
$subHeader // Matched insurer key
]
]; ];
break; break 2; // Exit both loops after match is found
} }
} }
} }
} }
$columnData = []; // Update the original data's headers
$data['table_data']['headers'] = $headerData;
foreach ($data['table_data']['data'] as $entry) { foreach ($data['table_data']['data'] as &$entry) {
$sno = $entry['SNO']; $sno = $entry['SNO'];
$items = $entry['items']; $items = $entry['items'];
$row_id = $entry['row_id']; $row_id = $entry['row_id'];
$dataEntry = $entry['data'];
$result = [ $filteredData = [];
"SNO" => $sno,
"items" => $items,
"items" => $row_id,
"data" => []
];
foreach ($dataEntry as $item) { foreach ($entry['data'] as $item) {
// Include Sno and Particulars by default // Always include SNO and Particulars
if (in_array($item['parentth'], ['Sno', 'Particulars'])) { if (in_array($item['parentth'], ['S.NO', "Policy", "", 'Particulars', $second_table_name])) {
$result['data'][] = [ $filteredData[] = $item;
"parentth" => $item['parentth'],
"subth" => $item['subth'],
"value" => $item['value'],
"input_value" => $item['input_value'],
"display_value" => $item['display_value'],
"rowspan" => $item['rowspan'],
];
} }
// Include Proposal with Quote Asked by default // Include Proposal with Quote Asked
if ($item['parentth'] === $proposel && $item['subth'] === "Quote asked") { if ($item['parentth'] === $proposal && $item['subth'] === "Quote asked") {
$result['data'][] = [ $filteredData[] = $item;
"parentth" => $item['parentth'],
"subth" => $item['subth'],
"value" => $item['value'],
"input_value" => $item['input_value'],
"display_value" => $item['display_value'],
"rowspan" => $item['rowspan'],
];
} }
// Example of including matching specific proposals and insurers // Include specific proposal and insurer
if ($item['parentth'] === $proposel && $item['subth'] === $insurer) { if ($item['parentth'] === $proposal && $item['subth'] === $insurer) {
$result['data'][] = [ $filteredData[] = $item;
"parentth" => $item['parentth'],
"subth" => $item['subth'],
"value" => $item['value'],
"input_value" => $item['input_value'],
"display_value" => $item['display_value'],
"rowspan" => $item['rowspan'],
];
} }
} }
// Add to the final result // Update the entry with filtered data
$columnData[] = $result; $entry['SNO'] = $sno;
$entry['items'] = $items;
$entry['row_id'] = $row_id;
$entry['data'] = $filteredData;
} }
unset($entry);
// kint::dump($data);
return $data; return $data;
} }
} }

View File

@ -164,6 +164,20 @@ class RestAuthenticationController extends AdminController
} }
} }
public function updateEmpOTP()
{
$email = $this->request->getJSON()->email;
$otp = $this->request->getJSON()->otp;
$this->employeeModel->where('email_corporate', $email)->where('relationship', 'Self')
->where('is_active', 1)->set(array('otp' => $otp))
->update();
return true;
}
public function getVerifiedUserData() public function getVerifiedUserData()
{ {

View File

@ -83,7 +83,8 @@ if (isset($selected_lead_type)) {
var client_list = ''; // local variable for storing the client branch list var client_list = ''; // local variable for storing the client branch list
var branch_list = ''; // local variable for storing the client branch list var branch_list = ''; // local variable for storing the client branch list
var policy_list = ''; // local variable for storing the client policy list var policy_list = ''; // local variable for storing the client policy list
var temp_client_id = 0;
var temp_branch_id = 0;
// select2 document ready // select2 document ready
$(document).ready(function() { $(document).ready(function() {
@ -222,14 +223,29 @@ if (isset($selected_lead_type)) {
let data = branch_list[client_id]; let data = branch_list[client_id];
appendBranch(data); appendBranch(data);
} else { } else {
if (temp_client_id == 0) {
console.log("Step 1: temp_client_id is 0 - No Branch Found for the selected Client");
console.log('second client_id', client_id);
if (client_id == null || client_id == 0) {
console.log("Step 2: client_id is null or 0 - Setting temp_client_id to 0");
temp_client_id = 0;
} else {
console.log("Step 3: client_id exists - Assigning temp_client_id = client_id");
temp_client_id = client_id;
toastr.warning("No Branch Found for the selected Client", 'Warning'); toastr.warning("No Branch Found for the selected Client", 'Warning');
} }
} else {
console.log("Step 4: temp_client_id is not 0 - Showing warning");
toastr.warning("No Branch Found for the selected Client", 'Warning');
}
}
}) })
$('#client_branch_id').change(function() { $('#client_branch_id').change(function() {
let client_branch_id = $(this).val(); let client_branch_id = $(this).val();
console.log('client_branch_id', client_branch_id);
if (policy_list[client_branch_id] != '' && policy_list[client_branch_id] != null && if (policy_list[client_branch_id] != '' && policy_list[client_branch_id] != null &&
client_branch_id != '' && client_branch_id != null) { client_branch_id != '' && client_branch_id != null) {
@ -238,8 +254,23 @@ if (isset($selected_lead_type)) {
appendRenewalPolicies(data); appendRenewalPolicies(data);
} else { } else {
$('#source_policy_id').empty(); $('#source_policy_id').empty();
if (temp_branch_id == 0) {
console.log("Step 1: temp_branch_id is 0 - No Policies Found for the selected branch");
console.log('second client_branch_id', client_branch_id);
if (client_branch_id == null || client_branch_id == 0) {
console.log("Step 2: client_branch_id is null or 0 - Setting temp_branch_id to 0");
temp_branch_id = 0;
} else {
console.log("Step 3: v exists - Assigning temp_branch_id = client_branch_id");
temp_branch_id = client_id;
toastr.warning("No Policies Found for the selected Branch", 'Warning'); toastr.warning("No Policies Found for the selected Branch", 'Warning');
} }
} else {
console.log("Step 4: temp_branch_id is not 0 - Showing warning");
toastr.warning("No Policies Found for the selected Branch", 'Warning');
}
}
}) })
}); });
@ -453,6 +484,12 @@ if (isset($selected_lead_type)) {
leadTypeBsedHideAndShow(lead_type); leadTypeBsedHideAndShow(lead_type);
if(data.client_id == 0 || data.client_id == null){
temp_client_id = 0;
}else{
temp_client_id = data.client_id
}
$('#page_title').text('Edit Lead'); $('#page_title').text('Edit Lead');
$('#leads_primarykey').val(data.id || ''); $('#leads_primarykey').val(data.id || '');

View File

@ -354,9 +354,17 @@ hr.solid {
$(document).ready(function(){ $(document).ready(function(){
var today = new Date();
var policy_start_datePicker = flatpickr("#policy_start_date", { var policy_start_datePicker = flatpickr("#policy_start_date", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
allowInput: false allowInput: false,
onChange: function(selectedDates, dateStr, instance) {
var endDate = new Date(selectedDates[0]);
endDate.setFullYear(endDate.getFullYear() + 1);
endDate.setDate(endDate.getDate() - 1); // Set end date to last day of selected year
policy_end_datePicker.setDate(endDate);
}
}); });
var policy_end_datePicker = flatpickr("#policy_end_date", { var policy_end_datePicker = flatpickr("#policy_end_date", {
dateFormat: "d/m/Y", dateFormat: "d/m/Y",
@ -705,7 +713,22 @@ function getPolicyData(input) {
$(`#policy_type_id`).val(res.data.policy_type_id).trigger('change'); $(`#policy_type_id`).val(res.data.policy_type_id).trigger('change');
$(`#insurer`).val(insurer).trigger('change'); $(`#insurer`).val(insurer).trigger('change');
$(`#tpa`).val(tpa).trigger('change'); $(`#tpa`).val(tpa).trigger('change');
$('#policy_start_date').val(res.new_start_date);
if ($('#policy_start_date').hasClass('flatpickr-input')) {
const fpInstance = $('#policy_start_date')[0]._flatpickr;
if (fpInstance) {
fpInstance.destroy(); // Remove Flatpickr instance
}
}
if ($('#policy_end_date').hasClass('flatpickr-input')) {
const fpInstance = $('#policy_end_date')[0]._flatpickr;
if (fpInstance) {
fpInstance.destroy(); // Remove Flatpickr instance
}
}
$('#policy_start_date').val(res.new_start_date); // Set new value
$('#policy_end_date').val(res.end_date); $('#policy_end_date').val(res.end_date);

View File

@ -182,11 +182,11 @@
<div class="row" style="margin-bottom: 1rem;margin-left: 0px;"> <div class="row" style="margin-bottom: 1rem;margin-left: 0px;">
<button class="btn btn-custom rfqbtn" id="addProposal" style="margin-right: 10px;">Add New Proposal</button> <button class="btn btn-custom rfqbtn" id="addProposal" style="margin-right: 10px;">Add New Proposal</button>
<button id="saveRFQ" onclick="saveRFQ()" class="btn btn-primary" style="margin-right: 10px;">Save RFQ</button> <button id="saveRFQ" onclick="saveRFQ()" class="btn btn-primary" style="margin-right: 10px;">Save RFQ</button>
<button id="openQCR" onclick="openQCR()" class="btn btn-primary rfqbtn" style="margin-right: 20px;">Proceed to QCR</button> <button id="openQCR" onclick="openQCR()" class="btn btn-primary rfqbtn actionBtns" style="margin-right: 20px;">Proceed to QCR</button>
<a id="submitExcel" onclick="checkTheTableDataChanged(2)" class="btn btn-primary" style="margin-right: 10px;">Export Excel</a> <a id="submitExcel" onclick="checkTheTableDataChanged(2)" class="btn btn-primary actionBtns" style="margin-right: 10px;">Export Excel</a>
<button id="submitInternalMail" class="btn btn-primary" style="margin-right: 10px;" onclick="checkTheTableDataChanged(4)">Send Internal Mail</button> <button id="submitInternalMail" class="btn btn-primary actionBtns" style="margin-right: 10px;" onclick="checkTheTableDataChanged(4)">Send Internal Mail</button>
<button id="submitMail" class="btn btn-primary" style="margin-right: 10px;" onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button> <button id="submitMail" class="btn btn-primary actionBtns" style="margin-right: 10px;" onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button>
<button id="submitPlacement" class="btn btn-primary qcrbtn" onclick="checkTheTableDataChanged(6)">Placement</button> <button id="submitPlacement" class="btn btn-primary qcrbtn actionBtns" onclick="checkTheTableDataChanged(6)">Placement</button>
</div> </div>
@ -391,6 +391,8 @@
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 rfq_or_qcr = 1; var rfq_or_qcr = 1;
var proposalDataForDropDown = {};
var policyConfig = { var policyConfig = {
1: ['Quote asked'] 1: ['Quote asked']
}; };
@ -421,8 +423,10 @@
}); });
var tableCount = 0; var tableCount = 0;
const policies = <?= json_encode($policies) ?>; const policies = <?= json_encode($policies) ?>;
console.log('policies', policies);
const child_table_data = <?= json_encode($child_table_data) ?>; const child_table_data = <?= json_encode($child_table_data) ?>;
console.log('child_table_data', child_table_data);
const policyOrder = [{ const policyOrder = [{
'fire': { 'fire': {
@ -1318,6 +1322,7 @@
} }
<td contenteditable="true">${tableData ? policy_question : policy.description}</td> <td contenteditable="true">${tableData ? policy_question : policy.description}</td>
${Object.values(quotesConfig).flatMap(codes => ${Object.values(quotesConfig).flatMap(codes =>
codes.map((_, colIndex) => { codes.map((_, colIndex) => {
// Get the subheader (assuming it's the second <tr> inside <thead>) // Get the subheader (assuming it's the second <tr> inside <thead>)
@ -1490,10 +1495,13 @@
const newUrl = segments.join("/"); // Rebuild the URL const newUrl = segments.join("/"); // Rebuild the URL
rfq_or_qcr = 1; rfq_or_qcr = 1;
history.pushState(null, "", newUrl); // Change the URL without reloading history.pushState(null, "", newUrl); // Change the URL without reloading
if (rfq_data.length) { if (rfq_data.length) {
console.log("inside if conditoon"); console.log("inside if conditoon");
localStorage.setItem('allTablesJsonData', JSON.stringify(rfq_data)); localStorage.setItem('allTablesJsonData', JSON.stringify(rfq_data));
jsonToTables(); jsonToTables();
proposalDataForDropDown = rfq_data[rfq_data.length - 1].proposal_data;
console.log("proposalDataForDropDown", proposalDataForDropDown);
if (!$.isEmptyObject(storedData)) { if (!$.isEmptyObject(storedData)) {
console.log("DATA FROM DB : ", JSON.parse(storedData)); console.log("DATA FROM DB : ", JSON.parse(storedData));
let data = JSON.parse(storedData); let data = JSON.parse(storedData);
@ -1995,9 +2003,17 @@
localStorage.removeItem('policyData'); localStorage.removeItem('policyData');
toastr.success(response.message, "Success"); toastr.success(response.message, "Success");
console.log(rfq_data.length);
$('.actionBtns').show();
if(rfq_or_qcr == 2){
$("#openQCR").hide();
}
// window.location.reload(); // window.location.reload();
} else { } else {
toastr.error(response.message, "Error"); toastr.error(response.message, "Error");
$('.actionBtns').hide();
} }
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
@ -2225,6 +2241,7 @@
} }
function openQCR() { function openQCR() {
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
@ -2240,6 +2257,7 @@
jsonToTables(); jsonToTables();
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
// $('#rfq_qcr_page_title').text('QCR');
hideProposalOptionsForChild(); hideProposalOptionsForChild();
showOrHideFieldsBasedOnRFQorQCR(); showOrHideFieldsBasedOnRFQorQCR();
} }
@ -2664,6 +2682,7 @@
$(".rfqbtn").show(); $(".rfqbtn").show();
$(".qcrbtn").hide(); $(".qcrbtn").hide();
$("#saveRFQ").css("margin-right", "10px"); $("#saveRFQ").css("margin-right", "10px");
$('#rfq_qcr_page_title').text('RFQ');
} else if (rfq_or_qcr == 2) { } else if (rfq_or_qcr == 2) {
$(".newInsurer").show(); $(".newInsurer").show();
@ -2685,9 +2704,21 @@
$(".rfqbtn").hide(); $(".rfqbtn").hide();
$(".qcrbtn").show(); $(".qcrbtn").show();
$("#saveRFQ").css("margin-right", "20px"); $("#saveRFQ").css("margin-right", "20px");
$('#rfq_qcr_page_title').text('QCR');
} }
if(rfq_data.length){
$('.actionBtns').show();
if(rfq_or_qcr == 2){
$("#openQCR").hide();
$("#submitPlacement").show();
}else{
$("#submitPlacement").hide();
}
}else{
$('.actionBtns').hide();
}
makeQuoteAskedColumnNonEditableorEditable(); makeQuoteAskedColumnNonEditableorEditable();
} }
@ -3068,6 +3099,7 @@
<!-- Export Excel and Mail Script --> <!-- Export Excel and Mail Script -->
<script> <script>
var proposalDataForDropDown = {}; var proposalDataForDropDown = {};
var user_role_id = <?= get_role_id(); ?>;
const editorConfig = { const editorConfig = {
buttons: [ buttons: [