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

This commit is contained in:
Srinivas-Saravanan 2025-02-12 14:23:49 +05:30
commit 719ed2810a
11 changed files with 534 additions and 98 deletions

View File

@ -387,7 +387,7 @@ $routes->group("policy_tranction", ["filter" => "authMVC"], function ($routes) {
$routes->group("leads", ["filter" => "authMVC"], function ($routes) { $routes->group("leads", ["filter" => "authMVC"], function ($routes) {
$routes->get("list", "LeadsController::viewLeadsList"); $routes->match(['get', 'post'],"list", "LeadsController::viewLeadsList");
$routes->post("create", "LeadsController::createLead"); $routes->post("create", "LeadsController::createLead");
$routes->get("list/(:any)", "LeadsController::getLeadDataForEdit/$1"); $routes->get("list/(:any)", "LeadsController::getLeadDataForEdit/$1");
$routes->get("sendMail", "LeadsController::sendMailWithAttachement"); $routes->get("sendMail", "LeadsController::sendMailWithAttachement");
@ -395,7 +395,6 @@ $routes->group("leads", ["filter" => "authMVC"], function ($routes) {
$routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1"); $routes->get("exportQCRandRFQ/(:any)", "LeadsController::exportQCRandRFQ/$1");
$routes->get("featchLeadDataAndInsertClient/(:any)", "LeadsController::featchLeadDataAndInsertClient/$1"); $routes->get("featchLeadDataAndInsertClient/(:any)", "LeadsController::featchLeadDataAndInsertClient/$1");
$routes->get("featchClientPolicyFromLead/(:any)", "LeadsController::featchClientPolicyFromLead/$1"); $routes->get("featchClientPolicyFromLead/(:any)", "LeadsController::featchClientPolicyFromLead/$1");
}); });
$routes->group("rfq", ["filter" => "authMVC"], function ($routes) { $routes->group("rfq", ["filter" => "authMVC"], function ($routes) {

View File

@ -4335,43 +4335,6 @@ class ClientController extends AdminController
// ----------------------------------------------------------------------------------------------------- // -----------------------------------------------------------------------------------------------------
public function updateRenewalData()
{
$db = db_connect();
$renewalData = $db->table('old_renewal_data_copy')
->where('client_id IS NOT NULL')
->where('is_inserted != 1')
->get()
->getResultArray();
$successData = [];
foreach ($renewalData as $key => $value) {
// Get branch_id properly
$branch = $this->clientBranchModel->where('client_id', $value['client_id'] ?? 0)->first();
$value['branch_id'] = $branch['branch_id'] ?? null;
// Fix vehicle_id key (previously "vehicel_id")
$value['vehicle_id'] = null;
if ($value['policy_type_id'] == 8 && !empty($value['policy_type_id'])) {
$value['vehicle_id'] = $this->prepareVehicleData($value);
}
// Process client policy, policy transaction, and co-share details
$value['client_policy_id'] = $this->prepareClientPolicy($value);
$value['pt_id'] = $this->preparePolicyData($value);
$value['pt_co_id'] = $this->preparePtCoShareDetails($value);
// Update is_inserted field in DB
$db->table('old_renewal_data_copy')
->where('id', $value['id'])
->set(['is_inserted' => 1])
->update();
$successData[] = ['id' => $value['id'], 'client' => $value['insured']];
}
kint::dump($successData);
}
// private function preparePolicyData($renewalData) // private function preparePolicyData($renewalData)
// { // {
@ -4451,22 +4414,62 @@ class ClientController extends AdminController
// return $clientPolicyModel->insert($clientPolicy); // return $clientPolicyModel->insert($clientPolicy);
// } // }
public function updateRenewalData()
{
$db = db_connect();
$renewalData = $db->table('old_renewal_data_copy')
->where('client_id IS NOT NULL')
->where('is_inserted != 1')
->get()
->getResultArray();
// dd($renewalData);
$successData = [];
foreach ($renewalData as $key => $value) {
// Get branch_id properly
$branch = $this->clientBranchModel->where('client_id', $value['client_id'] ?? 0)->first();
// kint::dump($branch);
$value['branch_id'] = $branch['id'] ?? null;
// Fix vehicle_id key (previously "vehicel_id")
$value['vehicle_id'] = null;
if ($value['policy_type_id'] == 8 && !empty($value['policy_type_id'])) {
$value['vehicle_id'] = $this->prepareVehicleData($value);
}
// Process client policy, policy transaction, and co-share details
$value['client_policy_id'] = $this->prepareClientPolicy($value);
$value['pt_id'] = $this->preparePolicyData($value);
$value['pt_co_id'] = $this->preparePtCoShareDetails($value);
// Update is_inserted field in DB
$db->table('old_renewal_data_copy')
->where('id', $value['id'])
->set(['is_inserted' => 1])
->update();
$successData[] = ['id' => $value['id'], 'client' => $value['insured']];
}
kint::dump($successData);
}
private function preparePolicyData($renewalData) private function preparePolicyData($renewalData)
{ {
$data = [ $data = [
'issuer' => $renewalData['issuer_type_id'], 'issuer' => $renewalData['issuer_type_id'] ?? null,
'client_id' => $renewalData['client_id'], 'client_id' => $renewalData['client_id'] ?? null,
'client_branch_id' => $renewalData['branch_id'] ?? 0, 'client_branch_id' => $renewalData['branch_id'] ?? 0,
'vehicle_id' => $renewalData['vehicel_id'], 'vehicle_id' => $renewalData['vehicel_id'] ?? null,
'insurer_id' => $renewalData['insurer_id'], 'insurer_id' => $renewalData['insurer_id'] ?? null,
'insurer_branch_id' => $renewalData['insurer_branch_id'], 'insurer_branch_id' => $renewalData['insurer_branch_id'],
'tpa_id' => null, 'tpa_id' => null,
'tpa_branch_id' => null, 'tpa_branch_id' => null,
'policy_type_id' => $renewalData['policy_type_id'], 'policy_type_id' => $renewalData['policy_type_id'] ?? null,
'client_policy_id' => $renewalData['client_policy_id'] ?? null, 'client_policy_id' => $renewalData['client_policy_id'] ?? null,
'issue_type' => 1, 'issue_type' => 1,
'source_client_policy_id' => null, 'source_client_policy_id' => null,
'policy_no' => $renewalData['policy_no'], 'policy_no' => $renewalData['policy_no'] ?? null,
'cd_ac_no' => null, 'cd_ac_no' => null,
'policy_issue_date' => $renewalData['date_date_of_issue'], 'policy_issue_date' => $renewalData['date_date_of_issue'],
'policy_start_date' => $renewalData['date_policy_start_date'], 'policy_start_date' => $renewalData['date_policy_start_date'],
@ -4510,12 +4513,13 @@ class ClientController extends AdminController
'ct_type' => 1, 'ct_type' => 1,
'ct_tran_id' => null, 'ct_tran_id' => null,
'remarks' => null, 'remarks' => null,
'cd_ac_pk' =>$renewalData['cd_ac_pk'] ?? null, 'cd_ac_pk' => $renewalData['cd_ac_pk'] ?? null,
'install_due_date' => null, 'install_due_date' => null,
'policy_with_corr' => 0 'policy_with_corr' => 0
]; ];
// kint::dump($data); // kint::dump($data);
// dd($data);
$policyTransactionModel = new PolicyTransactionModel(); $policyTransactionModel = new PolicyTransactionModel();
$id = $policyTransactionModel->insert($data); $id = $policyTransactionModel->insert($data);
return $id; return $id;
@ -4533,6 +4537,8 @@ class ClientController extends AdminController
'rc' => null, 'rc' => null,
]; ];
// dd($vehicleData);
$VehicleModel = new VehicleModel(); $VehicleModel = new VehicleModel();
$id = $VehicleModel->insert($vehicleData); $id = $VehicleModel->insert($vehicleData);
return $id; return $id;
@ -4595,7 +4601,6 @@ class ClientController extends AdminController
$PTCOShareDetailsModel = new PTCOShareDetailsModel(); $PTCOShareDetailsModel = new PTCOShareDetailsModel();
$id = $PTCOShareDetailsModel->insert($pt_co_share_details); $id = $PTCOShareDetailsModel->insert($pt_co_share_details);
return $id; return $id;
} }
private function prepareClientPolicy($renewalData) private function prepareClientPolicy($renewalData)

View File

@ -1011,14 +1011,33 @@ class EmpDataServiceController extends BaseController
// dd($inceptionData, $additionData, $dependentAdditionData, $correctionData, $enhancementData, $deletionData, $mergedData); // dd($inceptionData, $additionData, $dependentAdditionData, $correctionData, $enhancementData, $deletionData, $mergedData);
$template_json = $this->clientPolicyModel // $template_json = $this->clientPolicyModel
->select('insurer_excel_export_template.jsoncolumns') // ->select('insurer_excel_export_template.jsoncolumns')
->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id') // ->join('insurer_excel_export_template', 'insurer_excel_export_template.insurer_id = client_policy.insurer_id and insurer_excel_export_template.policy_type_id = client_policy.policy_type_id')
->where('client_policy.id', $export_data['client_policy_id']) // ->where('client_policy.id', $export_data['client_policy_id'])
->where('insurer_excel_export_template.event_name', 'all') // ->where('insurer_excel_export_template.event_name', 'all')
->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024 // ->where('insurer_excel_export_template.is_active', 1) //Live issue changes 17-10-2024
->where('insurer_excel_export_template.type_name', $export_data['actions']) // ->where('insurer_excel_export_template.type_name', $export_data['actions'])
->first(); // ->first();
$sql = "
SELECT `insurer_excel_export_template`.`jsoncolumns`
FROM `client_policy`
JOIN `insurer_excel_export_template`
ON `insurer_excel_export_template`.`insurer_id` = `client_policy`.`insurer_id`
AND `insurer_excel_export_template`.`policy_type_id` =
CASE
WHEN `client_policy`.`policy_type_id` IN (2, 3, 4, 5) THEN 2
ELSE `client_policy`.`policy_type_id`
END
WHERE `client_policy`.`id` = '".$export_data['client_policy_id']."'
AND `insurer_excel_export_template`.`event_name` = 'all'
AND `insurer_excel_export_template`.`is_active` = 1
AND `insurer_excel_export_template`.`type_name` = '".$export_data['actions']."'
LIMIT 1";
$query = db_connect()->query($sql);
$template_json = $query->getRowArray();
if(!empty($template_json) && $template_json != null){ if(!empty($template_json) && $template_json != null){

View File

@ -107,6 +107,7 @@ class LeadsController extends BaseController
// $d = $this->calculateMembersDemography(['lead_id' => 24]); // $d = $this->calculateMembersDemography(['lead_id' => 24]);
//$this->mergeQuoteExcelFileWithMembersListExcelFile(24, 1, $propsal_and_insurer = null); //$this->mergeQuoteExcelFileWithMembersListExcelFile(24, 1, $propsal_and_insurer = null);
// dd($d); // dd($d);
$data['page_name'] = 'Leads'; $data['page_name'] = 'Leads';
// Set basic data // Set basic data
@ -134,11 +135,27 @@ class LeadsController extends BaseController
// dd($data); // dd($data);
if ($this->request->is('get')) {
// Fetch leads data // Fetch leads data
$data ['lead_data_list'] = $this->leadsModel->getLeadDataForLising(); $data ['lead_data_list'] = $this->leadsModel->getLeadDataForLising();
// Load layout and pass data // Load layout and pass data
$this->loadLayout('leads_list', $data); $this->loadLayout('lead_filter', $data);
}else{
$search_data = $this->request->getPost();
// print_r($search_data);
$where = [];
foreach ($search_data as $search_objects => $key) {
if ($key != null && $key != '' && $key != 0) {
$where[$search_objects] = $key;
}
}
$data['lead_data_list'] = $this->leadsModel->getLeadDataForLising($where);
$html = view('leads_list', $data);
return $this->respond(['status' => true, 'html' => $html], 200);
}
} }
public function createLead() public function createLead()

View File

@ -462,8 +462,12 @@ class TicketController extends BaseController
$mail_responce = $this->sendAutoMailTrigger($ticket_id); $mail_responce = $this->sendAutoMailTrigger($ticket_id);
//send mail to the head for rejected ticket approvel //send mail to the head for rejected ticket approvel
if($ticket_data['claim_status_id'] == 8){ if($ticket_data['claim_status_id'] == 8 && $ticket_data['is_head_approved'] == 0){
$this->sendMailToTheHead($ticket_data); $this->sendMailToTheHead($ticket_data);
}else{
$this->myLogger->logme('error', "Head Mail can't be sent");
$this->myLogger->logme('error', "CLAIM STATUS ID : {data}", ['data' => $ticket_data['claim_status_id']]);
$this->myLogger->logme('error', "IS HEAD APPROVED : {data}", ['data' => $ticket_data['is_head_approved']]);
} }
return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim updated successfully", 'mail_responce' => $mail_responce], 200); return $this->respond(['status' => true, 'code' => 200, 'data' => $ticket_data, "message" => "Claim updated successfully", 'mail_responce' => $mail_responce], 200);

View File

@ -120,10 +120,10 @@ class LeadsModel extends Model
return $data; return $data;
} }
public function getLeadDataForLising() public function getLeadDataForLising($where = null)
{ {
return $this->select(' $data = $this->select('
leads.*, leads.*,
kyc_entity_type.name as entity_type, kyc_entity_type.name as entity_type,
policy_type.policy_type, policy_type.policy_type,
@ -147,10 +147,13 @@ class LeadsModel extends Model
->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left') ->join('kyc_entity_type', 'leads.entity_type_id = kyc_entity_type.id', 'left')
->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left') ->join('user_profiles', 'leads.salse_person_id = user_profiles.id', 'left')
->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left') ->join('policy_type', 'leads.policy_type_id = policy_type.id', 'left')
->where('leads.is_active', 1) ->where('leads.is_active', 1);
->orderBy('id', 'desc')
->findAll();
if (!empty($where)) {
$data->where($where);
}
return $data->orderBy('leads.id', 'desc')->findAll();
} }
public function getLeadForInsertClientList($type = null, $client_id = null) public function getLeadForInsertClientList($type = null, $client_id = null)

367
app/Views/lead_filter.php Normal file
View File

@ -0,0 +1,367 @@
<style>
.col-12 {
max-width: 98% !important;
}
</style>
<div class="row" id="lead_filter_div">
<div class="col-12" style="margin-top: -12px;">
<div id="accordion" class="mb-3">
<div class="card mb-1">
<h5 class="m-1">
<div class="row">
<div class="col-md-6" style="position: relative;left: 17px;">
<h4 style="text-align: left;">Lead Filter</h4>
</div>
<div class="col-md-6">
<a style="text-align: right;" id="toggleIcon" class="text-dark float-right"
data-toggle="collapse" href="#collapseOne" aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary"
style="font-size: 28px;"></i>
</a>
</div>
</div>
</h5>
<div id="collapseOne" class="collapse hide" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<div class="form-group">
<div class="form-row">
<div class="form-group col-md-3">
<label for="filter_issuer_type"> Issuer Type <span
class="text-danger"></span></label>
<select class="form-control" id="filter_issuer_type" name="filter_issuer_type">
<option value="0">Select</option>
<?php
if (isset($issuer) && count($issuer)) {
foreach ($issuer as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="filter_lead_type"> Lead Type <span class="text-danger"></span></label>
<select class="form-control" id="filter_lead_type" name="filter_lead_type">
<option value="0">Select</option>
<?php
if (isset($lead_type) && count($lead_type)) {
foreach ($lead_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="filter_client_type"> Client Type <span
class="text-danger"></span></label>
<select class="form-control" id="filter_client_type" name="filter_client_type">
<option value="0">Select</option>
<?php
if (isset($client_type) && count($client_type)) {
foreach ($client_type as $key => $value) {
echo "<option value='" . $key . "'>" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="filter_policy_type"> Policy Type <span
class="text-danger"></span></label>
<select class="form-control" id="filter_policy_type" name="filter_policy_type">
<option value="0">Select</option>
<?php
if (isset($policy_type) && count($policy_type)) {
foreach ($policy_type as $key => $value) {
echo "<option value='" . $value['id'] . "'>" . $value['policy_type'] . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-3">
<label for="filter_client_id">Client<span class="text-danger"></span></label>
<select class="form-control" id="filter_client_id" name="filter_client_id">
<option value="0">Select</option>
</select>
</div>
<div class="form-group col-md-3">
<label for="filter_client_branch_id">Client Branch<span
class="text-danger"></span></label>
<select class="form-control" id="filter_client_branch_id"
name="filter_client_branch_id">
<option value="0">Select</option>
</select>
</div>
<div class="form-group col-md-3">
<label for="filter_lead_status">Status<span class="text-danger"></span></label>
<select class="form-control" id="filter_lead_status" name="filter_lead_status">
<option value="0">Select</option>
<?php
if (isset($lead_status) && count($lead_status)) {
foreach ($lead_status as $key => $value) {
echo "<option value=" . $key . ">" . $value . "</option>";
}
}
?>
</select>
</div>
<div class="form-group col-md-12 text-right m-b-0" style="margin-bottom: -15px;">
<a href="<?= base_url("/leads/list"); ?>" class="btn btn-secondary"
id="clear-filters">Clear</a>
<a class="btn btn-primary" id="get-emp-list"
onclick="fetchTicketListData();">Submit</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- end page title -->
<div id="lead_list_div">
<?php include('leads_list.php'); ?>
</div>
<script>
var client_list = [];
var branch_list = [];
$(document).ready(function() {
$('#filter_client_id').select2();
$('#filter_client_branch_id').select2();
$('#filter_policy_type').select2();
});
$(document).ready(function() {
$('#filter_client_id').change(function() {
let client_id = $(this).val();
if (branch_list != '') {
// console.log(branch_list[client_id]);
let data = branch_list[client_id];
appendBranch(data);
}
})
});
//----- AJAX FUNCTIONS --------------------------------------------------------------------------------
function fetchTicketListData() {
var issuer_type = $('#filter_issuer_type').val();
var lead_type = $('#filter_lead_type').val();
var policy_type = $('#filter_policy_type').val();
var client_type = $('#filter_client_type').val();
var status = $('#filter_lead_status').val();
var client_id = $('#filter_client_id').val();
var client_branch_id = $('#filter_client_branch_id').val();
var requestData = {
issuer: issuer_type,
lead_type: lead_type,
policy_type_id: policy_type,
client_type: client_type,
status: status,
client_id: client_id,
client_branch_id: client_branch_id,
};
console.log("requestData", requestData);
var url = '<?= base_url('/leads/list') ?>';
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
console.log('Filter Responce', response);
if (response.status == true) {
$('#lead_list_div').empty();
$('#lead_list_div').html(response.html);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
setTimeout(function(){
additionalDropdown();
}, 1000);
} else {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the data.', 'ERROR');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
});
}
//function for fetch client, branch
function getClientAndBranchAndPolicy() {
$.ajax({
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
type: "GET",
dataType: 'json',
success: function(res) {
console.log('getClientAndBranchAndPolicy', res);
if (res.status == true) {
client_list = res.client_data;
branch_list = res.branch_data;
appendClients(res.client_data);
} else {
console.log('No data found');
}
},
error: function(xhr, status, error) {
console.error(xhr.responseText);
console.error(status, error);
}
});
}
//----- END AJAX FUNCTIONS --------------------------------------------------------------------------------
function appendClients(data) {
$('#filter_client_id').empty();
$('#filter_client_id').append($('<option>', {
value: 0,
text: 'Select'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.client_name,
});
$('#filter_client_id').append(option);
});
}
function appendBranch(data) {
$('#filter_client_branch_id').empty();
$('#filter_client_branch_id').append($('<option>', {
value: '',
text: 'Select'
}));
$.each(data, function(index, item) {
var option = $('<option>', {
value: item.id,
text: item.branch_name
});
$('#filter_client_branch_id').append(option);
});
}
// -----------------------------------------------------------------------------------------------------------
function additionalDropdown() {
const table = document.getElementById("tickets-table");
if (!table) return; // Prevent errors if the table is not found
let activeDropdown = null;
function handleDropdownClick(row, event) {
// Hide any active dropdown
if (activeDropdown) {
activeDropdown.style.display = 'none';
}
let customDropdown = row.customDropdown;
if (!customDropdown) {
const originalDropdown = row.querySelector('.dropdown-menu');
if (!originalDropdown) return;
customDropdown = document.createElement('div');
customDropdown.className = 'custom-dropdown-menu';
customDropdown.innerHTML = originalDropdown.innerHTML;
document.body.appendChild(customDropdown);
row.customDropdown = customDropdown;
// Preserve click handlers and add auto-close
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
item.addEventListener('click', function (e) {
const onclickAttr = this.getAttribute('onclick');
if (onclickAttr) eval(onclickAttr);
const href = this.getAttribute('href');
if (href && href !== '#') window.location.href = href;
customDropdown.style.display = 'none';
activeDropdown = null;
e.stopPropagation();
});
});
}
// Get click position
const rect = event.target.getBoundingClientRect();
// Position the dropdown
customDropdown.style.display = 'block';
customDropdown.style.position = 'fixed';
customDropdown.style.left = `${rect.left}px`;
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
activeDropdown = customDropdown;
event.stopPropagation();
}
// Add click event listener to rows
table.querySelectorAll("tbody tr").forEach(row => {
row.addEventListener("click", function (event) {
if (!event.target.closest('td:last-child')) {
handleDropdownClick(row, event);
}
});
});
// Close dropdown when clicking outside
document.addEventListener("click", function () {
if (activeDropdown) {
activeDropdown.style.display = 'none';
activeDropdown = null;
}
});
}
</script>

View File

@ -161,6 +161,7 @@ table.dataTable tbody td {
<script> <script>
document.addEventListener("DOMContentLoaded", function () { document.addEventListener("DOMContentLoaded", function () {
const table = document.getElementById("tickets-table"); const table = document.getElementById("tickets-table");
// Create custom dropdown // Create custom dropdown
@ -326,12 +327,14 @@ $(document).ready(function() {
function hide_list_show_add() function hide_list_show_add()
{ {
$('#leads_list').hide() $('#leads_list').hide()
$('#lead_filter_div').hide()
$('#leads_form').show() $('#leads_form').show()
} }
function show_list_hide_add() function show_list_hide_add()
{ {
$('#leads_list').show() $('#leads_list').show()
$('#lead_filter_div').show()
$('#leads_form').hide() $('#leads_form').hide()
} }

View File

@ -269,7 +269,7 @@
value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date"> value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date">
</div> </div>
<div class="form-group col-md-3 approved" style="display: none;"> <div class="form-group col-md-9 approved" style="display: none;">
<label for="approved_letter">Approved Letter</label> <label for="approved_letter">Approved Letter</label>
<input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter" <input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter"
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter"> value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
@ -287,7 +287,7 @@
value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date"> value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date">
</div> </div>
<div class="form-group col-md-3 settled" style="display: none;"> <div class="form-group col-md-9 settled" style="display: none;">
<label for="settle_letter">Settle Letter</label> <label for="settle_letter">Settle Letter</label>
<input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter" <input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter"
value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter"> value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter">

View File

@ -197,13 +197,19 @@
name="si_amt"> name="si_amt">
</div> </div>
<div class="form-group col-md-3 approved" style="display: none;">
<label for="approved_amount">Approved Amount</label>
<input type="text" class="form-control" id="approved_amount" placeholder="Enter Approved Amount"
value="<?= isset($ticket_data['approved_amount']) ? $ticket_data['approved_amount'] : '' ?>" name="approved_amount">
</div>
<div class="form-group col-md-3 approved" style="display: none;"> <div class="form-group col-md-3 approved" style="display: none;">
<label for="approved_date">Approved Date</label> <label for="approved_date">Approved Date</label>
<input type="text" class="form-control datepicker" id="approved_date" placeholder="Select Approved Date" <input type="text" class="form-control datepicker" id="approved_date" placeholder="Select Approved Date"
value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date"> value="<?= isset($ticket_data['approved_date']) ? $ticket_data['approved_date'] : '' ?>" name="approved_date">
</div> </div>
<div class="form-group col-md-3 approved" style="display: none;"> <div class="form-group col-md-9 approved" style="display: none;">
<label for="approved_letter">Approved Letter</label> <label for="approved_letter">Approved Letter</label>
<input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter" <input type="text" class="form-control" id="approved_letter" placeholder="Enter Approved Letter"
value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter"> value="<?= isset($ticket_data['approved_letter']) ? $ticket_data['approved_letter'] : '' ?>" name="approved_letter">
@ -221,7 +227,7 @@
value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date"> value="<?= isset($ticket_data['settled_date']) ? $ticket_data['settled_date'] : '' ?>" name="settled_date">
</div> </div>
<div class="form-group col-md-3 settled" style="display: none;"> <div class="form-group col-md-9 settled" style="display: none;">
<label for="settle_letter">Settle Letter</label> <label for="settle_letter">Settle Letter</label>
<input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter" <input type="text" class="form-control" id="settle_letter" placeholder="Enter Settle Letter"
value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter"> value="<?= isset($ticket_data['settle_letter']) ? $ticket_data['settle_letter'] : '' ?>" name="settle_letter">
@ -291,9 +297,9 @@ function updateClaimStatusDisplay(value) {
$('.settled, .approved').hide(); $('.settled, .approved').hide();
// Show relevant section based on value // Show relevant section based on value
if (value == 20) { // APPROVED if (value == 20 || value == 30 || value == 40) { // APPROVED
$('.approved').show(); $('.approved').show();
} else if (value == 24) { // SETTLED } else if (value == 24 || value == 34 || value == 44) { // SETTLED
$('.settled').show(); $('.settled').show();
} }
} }

View File

@ -641,7 +641,7 @@
// Check if data is valid (not null or undefined) and is an object // Check if data is valid (not null or undefined) and is an object
if (data && typeof data === 'object') { if (data && typeof data === 'object') {
insurer_count = data.proposal_data.over_all_column_data['Proposal 1']['insurers'].length; let insurer_count = data.proposal_data.over_all_column_data['Proposal 1']?.insurers?.length || 0;
jsonToTable(data); jsonToTable(data);
} else { } else {
addSuggestionsToTable(); addSuggestionsToTable();
@ -1030,16 +1030,29 @@ function addSuggestionsToTable() {
console.log(' addSuggestionsToTable suggestions ', suggestions); console.log(' addSuggestionsToTable suggestions ', suggestions);
console.log(' addSuggestionsToTable suggestions type', typeof suggestions); console.log(' addSuggestionsToTable suggestions type', typeof suggestions);
console.log(' over_all_column_data', over_all_column_data);
let leadType = <?= isset($lead_data) && isset($lead_data['lead_type']) ? $lead_data['lead_type'] : 1; ?>; let leadType = <?= isset($lead_data) && isset($lead_data['lead_type']) ? $lead_data['lead_type'] : 1; ?>;
console.log('leadType', leadType); console.log('leadType', leadType);
let renewal_or_rollover = "Proposal 1"; let renewal_or_rollover = "Proposal 1";
if(leadType == 2){ if (leadType == 2) {
renewal_or_rollover = "Existing Renewal" renewal_or_rollover = "Existing Renewal";
}else if(leadType == 3){ } else if (leadType == 3) {
renewal_or_rollover = "Existing Rollover" renewal_or_rollover = "Existing Rollover";
} }
over_all_column_data = {
[renewal_or_rollover]: {
"qcr": 1,
"stc": 1,
"insurers": []
}
};
console.log('renewal_or_rollover', renewal_or_rollover);
console.log(' over_all_column_data', over_all_column_data);
$('#first_proposel_title').html(` $('#first_proposel_title').html(`
${renewal_or_rollover} ${renewal_or_rollover}
<span class="dropdown" onclick="showThreeDottedMenu(event)"> <span class="dropdown" onclick="showThreeDottedMenu(event)">
@ -3806,7 +3819,7 @@ function constructInsurerNameWithVersion(proposal_name, insurerName) {
let newDisplayName = `${insurerName}-V${maxVersion + 1}`; let newDisplayName = `${insurerName}-V${maxVersion + 1}`;
return newDisplayName; return newDisplayName;
} }
return false; return insurerName;
} }
function checkTheTableDataChanged(redirect_type, url){ function checkTheTableDataChanged(redirect_type, url){