Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev
This commit is contained in:
commit
027bc8b4cf
@ -439,6 +439,7 @@ $routes->post("/employeeRest/getVerifiedUserData", "RestAuthenticationController
|
||||
$routes->post("/employeeRest/verifyMpin", "RestAuthenticationController::verifyMpin");
|
||||
$routes->post("/employeeRest/checkMpin", "RestAuthenticationController::checkMpin");
|
||||
$routes->post("/employeeRest/verifyEmployeeEmailId", "RestAuthenticationController::verifyEmployeeWithEmailId");
|
||||
$routes->post("/employeeRest/updateEmpOTP", "RestAuthenticationController::updateEmpOTP");
|
||||
|
||||
//HR login api's
|
||||
$routes->post("/employeeRest/verifyHrWithMobileNumber", "RestAuthenticationController::verifyHrWithMobileNumber");
|
||||
|
||||
@ -4711,6 +4711,10 @@ class ClientController extends AdminController
|
||||
// $empmodel = new EmployeeModel();
|
||||
// $data = $empmodel->getEmployeePolicy(348);
|
||||
// dd($data);
|
||||
|
||||
|
||||
// $LeadsController = new LeadsController();
|
||||
// $LeadsController->constructNonEbExcelToSaveTemp(92, 2, "Proposal 2-ICICIPRU-ICICI001");
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------------------------------------
|
||||
|
||||
@ -2455,76 +2455,6 @@ class LeadsController extends BaseController
|
||||
$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)
|
||||
{
|
||||
// Set basic data
|
||||
@ -2653,7 +2583,15 @@ class LeadsController extends BaseController
|
||||
$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);
|
||||
$proposalData = end($jsonData);
|
||||
@ -2748,21 +2686,29 @@ class LeadsController extends BaseController
|
||||
|
||||
$rowNumber += 2;
|
||||
|
||||
// Kint::dump($jsonData);
|
||||
|
||||
foreach ($jsonData as $key => $data) {
|
||||
|
||||
// Kint::dump($data, 'First');
|
||||
|
||||
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) {
|
||||
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) {
|
||||
$data = $this->convertNonEbJsonForQCR($data, $type, $proposalData);
|
||||
$data = $this->convertNonEbJsonForQCR($data, $type, $proposalData, $key);
|
||||
unset($data['proposalData']);
|
||||
}
|
||||
|
||||
// dd($data);
|
||||
// Add headers and subheaders
|
||||
$headers = $data['table_data']['headers'];
|
||||
// dd($headers);
|
||||
@ -2781,7 +2727,7 @@ class LeadsController extends BaseController
|
||||
$sheet->getColumnDimension($columnLetter)->setWidth(60);
|
||||
|
||||
|
||||
if ($header['parentHeader'] == '') {
|
||||
if ($header['parentHeader'] == 'Policy') {
|
||||
// $header['parentHeader'] = 'S.No.';
|
||||
$sheet->getColumnDimension('A')->setWidth(10);
|
||||
}
|
||||
@ -2875,7 +2821,7 @@ class LeadsController extends BaseController
|
||||
|
||||
if ($cellData['parentth'] == 'SNO') {
|
||||
$sheet->setCellValue("{$columnLetter}{$rowNumber}", $serial_no);
|
||||
} else if ($cellData['parentth'] == '') {
|
||||
} else if ($cellData['parentth'] == 'Policy') {
|
||||
$mergeStart = $rowNumber; // Start 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}")
|
||||
->getAlignment()->setVertical(\PhpOffice\PhpSpreadsheet\Style\Alignment::VERTICAL_CENTER);
|
||||
} else {
|
||||
$sheet->setCellValue("{$columnLetter}{$rowNumber}", $cellData['display_value']);
|
||||
$sheet->setCellValue("{$columnLetter}{$rowNumber}", $cellData['display_content']);
|
||||
}
|
||||
|
||||
$columnLetter++;
|
||||
@ -2952,6 +2898,7 @@ class LeadsController extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
// dd($rowNumber);
|
||||
// Set filename
|
||||
$string = ($type == 2) ? 'QCR' : 'RFQ';
|
||||
$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;
|
||||
@ -2978,7 +2925,7 @@ class LeadsController extends BaseController
|
||||
// Column-wise Check: Remove headers and relevant data if qcr == 0
|
||||
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
|
||||
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
|
||||
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) {
|
||||
if (isset($header['subHeaders'])) {
|
||||
$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
|
||||
foreach ($first_json['table_data']['data'] as $rowKey => $rowData) {
|
||||
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)
|
||||
)
|
||||
) {
|
||||
|
||||
unset($first_json['table_data']['data'][$rowKey]);
|
||||
break; // Stop checking other columns for this row
|
||||
if ($indexOfTheTable == 0) {
|
||||
|
||||
if ($data['parentth'] == "Policy" && $data['input_value'] != "Checked") {
|
||||
unset($first_json['table_data']['data'][$rowKey]);
|
||||
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;
|
||||
}
|
||||
|
||||
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 = [];
|
||||
|
||||
// Default headers: S. No and Particulars
|
||||
$defaultHeaders = [
|
||||
[
|
||||
'parentHeader' => 'Sno',
|
||||
'subHeaders' => ['-']
|
||||
],
|
||||
[
|
||||
'parentHeader' => 'Particulars',
|
||||
'subHeaders' => ['-']
|
||||
]
|
||||
// Add the first two default headers only once
|
||||
$headerData[] = [
|
||||
'parentHeader' => $data['table_data']['headers'][0]['parentHeader'],
|
||||
'subHeaders' => ['-']
|
||||
];
|
||||
$headerData[] = [
|
||||
'parentHeader' => $data['table_data']['headers'][1]['parentHeader'],
|
||||
'subHeaders' => ['-']
|
||||
];
|
||||
|
||||
// Add default headers to the result
|
||||
$headerData = array_merge($headerData, $defaultHeaders);
|
||||
$second_table_name = $data['table_data']['headers'][1]['parentHeader'] ?? "";
|
||||
|
||||
// Loop through the headers to find matching proposal and insurer
|
||||
foreach ($data['table_data']['headers'] as $header) {
|
||||
// Check if the parentHeader matches the target proposal
|
||||
if ($header['parentHeader'] === $proposel) {
|
||||
// Check if subHeaders contain the target insurer key
|
||||
if ($header['parentHeader'] === $proposal) {
|
||||
foreach ($header['subHeaders'] as $subHeader) {
|
||||
if ($subHeader === $insurer) {
|
||||
$headerData[] = [
|
||||
'parentHeader' => $header['parentHeader'],
|
||||
'subHeaders' => [
|
||||
'Quote asked', // Default value
|
||||
$subHeader // Matched insurer key
|
||||
]
|
||||
'subHeaders' => ['Quote asked', $subHeader]
|
||||
];
|
||||
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'];
|
||||
$items = $entry['items'];
|
||||
$row_id = $entry['row_id'];
|
||||
$dataEntry = $entry['data'];
|
||||
|
||||
$result = [
|
||||
"SNO" => $sno,
|
||||
"items" => $items,
|
||||
"items" => $row_id,
|
||||
"data" => []
|
||||
];
|
||||
$filteredData = [];
|
||||
|
||||
foreach ($dataEntry as $item) {
|
||||
foreach ($entry['data'] as $item) {
|
||||
|
||||
// Include Sno and Particulars by default
|
||||
if (in_array($item['parentth'], ['Sno', 'Particulars'])) {
|
||||
$result['data'][] = [
|
||||
"parentth" => $item['parentth'],
|
||||
"subth" => $item['subth'],
|
||||
"value" => $item['value'],
|
||||
"input_value" => $item['input_value'],
|
||||
"display_value" => $item['display_value'],
|
||||
"rowspan" => $item['rowspan'],
|
||||
];
|
||||
// Always include SNO and Particulars
|
||||
if (in_array($item['parentth'], ['S.NO', "Policy", "", 'Particulars', $second_table_name])) {
|
||||
$filteredData[] = $item;
|
||||
}
|
||||
|
||||
// Include Proposal with Quote Asked by default
|
||||
if ($item['parentth'] === $proposel && $item['subth'] === "Quote asked") {
|
||||
$result['data'][] = [
|
||||
"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
|
||||
if ($item['parentth'] === $proposal && $item['subth'] === "Quote asked") {
|
||||
$filteredData[] = $item;
|
||||
}
|
||||
|
||||
// Example of including matching specific proposals and insurers
|
||||
if ($item['parentth'] === $proposel && $item['subth'] === $insurer) {
|
||||
$result['data'][] = [
|
||||
"parentth" => $item['parentth'],
|
||||
"subth" => $item['subth'],
|
||||
"value" => $item['value'],
|
||||
"input_value" => $item['input_value'],
|
||||
"display_value" => $item['display_value'],
|
||||
"rowspan" => $item['rowspan'],
|
||||
];
|
||||
// Include specific proposal and insurer
|
||||
if ($item['parentth'] === $proposal && $item['subth'] === $insurer) {
|
||||
$filteredData[] = $item;
|
||||
}
|
||||
}
|
||||
|
||||
// Add to the final result
|
||||
$columnData[] = $result;
|
||||
// Update the entry with filtered data
|
||||
$entry['SNO'] = $sno;
|
||||
$entry['items'] = $items;
|
||||
$entry['row_id'] = $row_id;
|
||||
$entry['data'] = $filteredData;
|
||||
}
|
||||
unset($entry);
|
||||
|
||||
// kint::dump($data);
|
||||
return $data;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -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()
|
||||
{
|
||||
|
||||
@ -83,7 +83,8 @@ if (isset($selected_lead_type)) {
|
||||
var client_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 temp_client_id = 0;
|
||||
var temp_branch_id = 0;
|
||||
|
||||
// select2 document ready
|
||||
$(document).ready(function() {
|
||||
@ -222,7 +223,21 @@ if (isset($selected_lead_type)) {
|
||||
let data = branch_list[client_id];
|
||||
appendBranch(data);
|
||||
} else {
|
||||
toastr.warning("No Branch Found for the selected Client", 'Warning');
|
||||
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');
|
||||
}
|
||||
} else {
|
||||
console.log("Step 4: temp_client_id is not 0 - Showing warning");
|
||||
toastr.warning("No Branch Found for the selected Client", 'Warning');
|
||||
}
|
||||
}
|
||||
|
||||
})
|
||||
@ -230,6 +245,7 @@ if (isset($selected_lead_type)) {
|
||||
$('#client_branch_id').change(function() {
|
||||
|
||||
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 &&
|
||||
client_branch_id != '' && client_branch_id != null) {
|
||||
@ -238,7 +254,22 @@ if (isset($selected_lead_type)) {
|
||||
appendRenewalPolicies(data);
|
||||
} else {
|
||||
$('#source_policy_id').empty();
|
||||
toastr.warning("No Policies Found for the selected Branch", 'Warning');
|
||||
|
||||
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');
|
||||
}
|
||||
} 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);
|
||||
|
||||
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');
|
||||
$('#leads_primarykey').val(data.id || '');
|
||||
|
||||
@ -354,9 +354,17 @@ hr.solid {
|
||||
|
||||
$(document).ready(function(){
|
||||
|
||||
var today = new Date();
|
||||
|
||||
var policy_start_datePicker = flatpickr("#policy_start_date", {
|
||||
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", {
|
||||
dateFormat: "d/m/Y",
|
||||
@ -705,7 +713,22 @@ function getPolicyData(input) {
|
||||
$(`#policy_type_id`).val(res.data.policy_type_id).trigger('change');
|
||||
$(`#insurer`).val(insurer).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);
|
||||
|
||||
|
||||
|
||||
@ -182,11 +182,11 @@
|
||||
<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 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>
|
||||
<a id="submitExcel" onclick="checkTheTableDataChanged(2)" class="btn btn-primary" 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="submitMail" class="btn btn-primary" 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="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 actionBtns" style="margin-right: 10px;">Export Excel</a>
|
||||
<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 actionBtns" style="margin-right: 10px;" onclick="checkTheTableDataChanged(3)">Send Insurer Mail</button>
|
||||
<button id="submitPlacement" class="btn btn-primary qcrbtn actionBtns" onclick="checkTheTableDataChanged(6)">Placement</button>
|
||||
</div>
|
||||
|
||||
|
||||
@ -391,6 +391,8 @@
|
||||
rfq_data = rfq_data ? JSON.parse(rfq_data) : {}; // Convert to object if not already
|
||||
|
||||
var rfq_or_qcr = 1;
|
||||
var proposalDataForDropDown = {};
|
||||
|
||||
var policyConfig = {
|
||||
1: ['Quote asked']
|
||||
};
|
||||
@ -421,8 +423,10 @@
|
||||
});
|
||||
var tableCount = 0;
|
||||
const policies = <?= json_encode($policies) ?>;
|
||||
console.log('policies', policies);
|
||||
|
||||
const child_table_data = <?= json_encode($child_table_data) ?>;
|
||||
console.log('child_table_data', child_table_data);
|
||||
|
||||
const policyOrder = [{
|
||||
'fire': {
|
||||
@ -1318,6 +1322,7 @@
|
||||
}
|
||||
|
||||
<td contenteditable="true">${tableData ? policy_question : policy.description}</td>
|
||||
|
||||
${Object.values(quotesConfig).flatMap(codes =>
|
||||
codes.map((_, colIndex) => {
|
||||
// Get the subheader (assuming it's the second <tr> inside <thead>)
|
||||
@ -1490,10 +1495,13 @@
|
||||
const newUrl = segments.join("/"); // Rebuild the URL
|
||||
rfq_or_qcr = 1;
|
||||
history.pushState(null, "", newUrl); // Change the URL without reloading
|
||||
|
||||
if (rfq_data.length) {
|
||||
console.log("inside if conditoon");
|
||||
localStorage.setItem('allTablesJsonData', JSON.stringify(rfq_data));
|
||||
jsonToTables();
|
||||
proposalDataForDropDown = rfq_data[rfq_data.length - 1].proposal_data;
|
||||
console.log("proposalDataForDropDown", proposalDataForDropDown);
|
||||
if (!$.isEmptyObject(storedData)) {
|
||||
console.log("DATA FROM DB : ", JSON.parse(storedData));
|
||||
let data = JSON.parse(storedData);
|
||||
@ -1995,9 +2003,17 @@
|
||||
localStorage.removeItem('policyData');
|
||||
|
||||
toastr.success(response.message, "Success");
|
||||
console.log(rfq_data.length);
|
||||
|
||||
$('.actionBtns').show();
|
||||
if(rfq_or_qcr == 2){
|
||||
$("#openQCR").hide();
|
||||
}
|
||||
|
||||
// window.location.reload();
|
||||
} else {
|
||||
toastr.error(response.message, "Error");
|
||||
$('.actionBtns').hide();
|
||||
}
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -2225,6 +2241,7 @@
|
||||
}
|
||||
|
||||
function openQCR() {
|
||||
|
||||
const url = window.location.pathname; // Get the path (e.g., "/nhance/rfq/list/75/1")
|
||||
const segments = url.split("/"); // Split by "/"
|
||||
segments[segments.length - 1] = "2"; // Change the last segment
|
||||
@ -2240,6 +2257,7 @@
|
||||
jsonToTables();
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
// $('#rfq_qcr_page_title').text('QCR');
|
||||
hideProposalOptionsForChild();
|
||||
showOrHideFieldsBasedOnRFQorQCR();
|
||||
}
|
||||
@ -2664,6 +2682,7 @@
|
||||
$(".rfqbtn").show();
|
||||
$(".qcrbtn").hide();
|
||||
$("#saveRFQ").css("margin-right", "10px");
|
||||
$('#rfq_qcr_page_title').text('RFQ');
|
||||
|
||||
} else if (rfq_or_qcr == 2) {
|
||||
$(".newInsurer").show();
|
||||
@ -2685,9 +2704,21 @@
|
||||
$(".rfqbtn").hide();
|
||||
$(".qcrbtn").show();
|
||||
$("#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();
|
||||
}
|
||||
|
||||
@ -3068,6 +3099,7 @@
|
||||
<!-- Export Excel and Mail Script -->
|
||||
<script>
|
||||
var proposalDataForDropDown = {};
|
||||
var user_role_id = <?= get_role_id(); ?>;
|
||||
|
||||
const editorConfig = {
|
||||
buttons: [
|
||||
|
||||
Loading…
Reference in New Issue
Block a user