MERGE_BRANCH_WITH_CLAIM_ISSUE_FIX

This commit is contained in:
Srinivas-Saravanan 2025-03-06 09:38:35 +05:30
commit 52e8442b8f
11 changed files with 260 additions and 185 deletions

View File

@ -4295,7 +4295,7 @@ class ClientController extends AdminController
// dd($policyTerms); // dd($policyTerms);
// Re-encode the ordered policy terms // Re-encode the ordered policy terms
$updatedPolicyTerms = json_encode($policyTerms); $updatedPolicyTerms = json_encode($policyTerms);
dd($updatedPolicyTerms); // dd($updatedPolicyTerms);
// dd($orderedPolicyTerms, $updatedPolicyTerms); // dd($orderedPolicyTerms, $updatedPolicyTerms);
$this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]); $this->clientPolicyModel->update($data[$i]['id'], ['policy_terms' => $updatedPolicyTerms]);
@ -4574,7 +4574,7 @@ class ClientController extends AdminController
$employeeRestController = new EmployeeServiceController(); $employeeRestController = new EmployeeServiceController();
// $employeeRestController->excelFileDataValidation(['file_id' => 823]); // $employeeRestController->excelFileDataValidation(['file_id' => 823]);
// $employeeRestController->employeesOnboardPreprocess(['file_id' => 644]); // $employeeRestController->employeesOnboardPreprocess(['file_id' => 726]);
// $employeeRestController->employeesOnboardProcess(['file_id' => 835]); // $employeeRestController->employeesOnboardProcess(['file_id' => 835]);
// $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]); // $employeeRestController->employeesEnrollmentInsert(['file_id' => 836]);
// $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]); // $r = Jobs::addJob(['job_name' => 'employeesEnrollmentInsert','payload' => ['file_id' => 721]]);
@ -4705,6 +4705,9 @@ class ClientController extends AdminController
// $this->loadLayout('tat_report_band_wise_list', $reportData); // $this->loadLayout('tat_report_band_wise_list', $reportData);
// $data = $ticketModel->getTATReport(1); // $data = $ticketModel->getTATReport(1);
// $empmodel = new EmployeeModel();
// $data = $empmodel->getEmployeePolicy(348);
// dd($data);
} }
// ------------------------------------------------------------------------------------------------------- // -------------------------------------------------------------------------------------------------------

View File

@ -104,65 +104,63 @@ class RestAuthenticationController extends AdminController
$email = $this->request->getJSON()->email; $email = $this->request->getJSON()->email;
$employeeData = $this->employeeModel->select('employees.relationship,EP.employee_id') $employeeData = $this->employeeModel->select('
employees.relationship,
EP.employee_id,
employees.client_id,
employees.client_branch_id,
employees.email_corporate
')
->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner') ->join('employee_polices EP', 'EP.employee_id = employees.id', 'inner')
->where('employees.is_active', 1) ->where('employees.is_active', 1)
->where('employees.relationship', 'self') ->where('employees.relationship', 'Self')
->where('employees.emp_status !=', 'truncated') ->where('employees.emp_status !=', 'truncated')
->where('employees.email_corporate', $email) ->where('employees.email_corporate', $email)
->where('EP.is_active', 1) ->where('EP.is_active', 1)
->whereIn('EP.status', ['active']) ->whereIn('EP.status', ['draft', 'enrolled'])
->first(); ->first();
if (isset($employeeData['employee_id'])) if (isset($employeeData['employee_id'])) {
{
$otp = random_int(100000, 999999); $otp = random_int(100000, 999999);
$update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'self') $update = $this->employeeModel->where('email_corporate', $email)->where('relationship', 'Self')
->where('is_active', 1)->set(array('otp' => $otp )) ->where('is_active', 1)->set(array('otp' => $otp))
->update(); ->update();
if($update) if ($update) {
{
$common = [ $common = [
'client_id' => $employeeData['client_id'], 'client_id' => $employeeData['client_id'],
'client_branch_id' => $employeeData['client_branch_id'], 'client_branch_id' => $employeeData['client_branch_id'],
'client_policy_id' => null, 'client_policy_id' => null,
'employee_policy_id' => null, 'employee_policy_id' => null,
'employee_id' => $employeeData['id'], 'employee_id' => $employeeData['employee_id'],
'mail_type' => 'otp_mail', 'mail_type' => 'otp_mail',
]; ];
$subject = 'Nhance user verification - OTP'; $subject = 'Nhance user verification - OTP';
$mail_content = $otp.' is your verification code for Nhance.'; $mail_content = $otp . ' is your verification code for Nhance.';
$res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject ,'common'=>$common ,'message' => $mail_content]); $res = MailHelper::send_email(['mail' => $employeeData['email_corporate'], 'subject' => $subject, 'common' => $common, 'message' => $mail_content]);
$this->myLogger->logme("info", $res); $this->myLogger->logme("info", $res);
if(json_decode($res)->status == 'success') if (json_decode($res)->status == 'success') {
{ $result = ['user_verification' => true, 'message' => "Verified Successfully"];
$result = ['user_verification' => true ,'message' => "Verified Successfully"]; return $this->respond(['status' => 'success', 'code' => 200, 'data' => $result], 200);
return $this->respond(['status' => 'success','code' => 200,'data' => $result],200); } else {
$result = ['user_verification' => false, 'message' => "Mail sending failed , try again"];
}else{ return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
$result = ['user_verification' => false , 'message' => "Mail sending failed , try again"]; }
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
}
}else{
$result = ['user_verification' => false , 'message' => "Verification failed , try again"];
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
}
} else { } else {
$result = ['user_verification' => false , 'message' => "User not found"];
return $this->respond(['status' => 'failed','code' => 404,'data' => $result],200);
$result = ['user_verification' => false, 'message' => "Verification failed , try again"];
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
}
} else {
$result = ['user_verification' => false, 'message' => "User not found"];
return $this->respond(['status' => 'failed', 'code' => 404, 'data' => $result], 200);
} }
} catch (\Throwable $th) { } catch (\Throwable $th) {
return $this->respond(['status' => 'failed','code' => 500,'data' => $th],500); return $this->respond(['status' => 'failed', 'code' => 500, 'data' => $th], 500);
} }
} }

View File

@ -682,7 +682,7 @@ if (!function_exists('generate_relationship_code'))
$slug = \Config\Services::slug(); $slug = \Config\Services::slug();
$relationship_code = $slug->slugify($arr['relationship']); $relationship_code = $slug->slugify($arr['relationship']);
$emp_type_code = ($relationship_code == 'self' ? 'EMP_TYP_01' : 'EMP_TYP_03'); $emp_type_code = ($relationship_code == 'self' ? 'EMP_TYP_01' : 'EMP_TYP_03');
$relationship_code = $gender[ $arr['gender'] ] . $relationship[ $relationship_code ] ; $relationship_code = $gender[ trim($arr['gender']) ] . $relationship[ trim($relationship_code) ];
return ['relationship_code' => $relationship_code,'emp_type_code' => $emp_type_code]; return ['relationship_code' => $relationship_code,'emp_type_code' => $emp_type_code];
} }
} }

View File

@ -1247,7 +1247,7 @@ class sendMailNotification
$subject = $notification['subject']; $subject = $notification['subject'];
$rand_string = 'HX3kUh'; $rand_string = 'HX3kUh';
$link = generate_download_link($rand_string); $link = generate_download_link($rand_string).'/1';
$name = 'John Doe'; $name = 'John Doe';
$mobile = 9080706050; $mobile = 9080706050;

View File

@ -149,7 +149,21 @@ class EmployeeModel extends Model
{ {
return $this->db->table('employee_polices') return $this->db->table('employee_polices')
->select(' policy_type.long_name as Policy_Name , client_policy.policy_terms as Policy_Terms, client_policy.client_id as ClientId, client_policy.policy_id as PolicyId,client_policy.id as ClientPolicyId, client_policy.open_for_enrollment as OpenForEnrollment,client_policy.disclaimer,client_policy.policy_type_id , employee_polices.tpa_id as tpa_id , employee_polices.rand_string as rand_string') // Select all columns from both tables ->select('
policy_type.long_name as Policy_Name ,
client_policy.policy_terms as Policy_Terms,
client_policy.client_id as ClientId,
client_policy.policy_id as PolicyId,
client_policy.id as ClientPolicyId,
CASE
WHEN client_policy.open_for_enrollment IS NULL THEN 0
ELSE client_policy.open_for_enrollment
END AS OpenForEnrollment,
client_policy.disclaimer,
client_policy.policy_type_id ,
employee_polices.tpa_id as tpa_id ,
employee_polices.rand_string as rand_string
', FALSE) // Select all columns from both tables
->join('client_policy', 'client_policy.id = employee_polices.client_policy_id') ->join('client_policy', 'client_policy.id = employee_polices.client_policy_id')
->join('policy_type', 'policy_type.id = client_policy.policy_type_id') ->join('policy_type', 'policy_type.id = client_policy.policy_type_id')
->where('client_policy.policy_status', 1) ->where('client_policy.policy_status', 1)

View File

@ -607,7 +607,8 @@ class PolicyTransactionModel extends Model
policy_type.policy_type, policy_type.policy_type,
pt_co_share_details.agreed_amt AS amount, pt_co_share_details.agreed_amt AS amount,
pt_co_share_details.bp_amt AS bp, pt_co_share_details.bp_amt AS bp,
pt_co_share_details.tp_amt AS tp pt_co_share_details.tp_amt AS tp,
clients.pan
') ')
->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left') ->join('pt_co_share_details', 'policy_transaction.id = pt_co_share_details.pt_id', 'left')
->join('clients', 'clients.id = policy_transaction.client_id', 'left') ->join('clients', 'clients.id = policy_transaction.client_id', 'left')

View File

@ -691,7 +691,7 @@
</a> </a>
</li> </li>
<?php if ((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?> <?php if ((get_role_id() == 1 || get_role_id() == 5) || (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
<li> <li>
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect"> <a href="#policyTransactions" data-toggle="collapse" class="waves-effect">
@ -702,12 +702,11 @@
<div class="collapse" id="policyTransactions"> <div class="collapse" id="policyTransactions">
<ul class="nav-second-level"> <ul class="nav-second-level">
<li> <li>
<a href="#policyTransactions" data-toggle="collapse" class="waves-effect"> <a href="#policyTransactionsSub" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-format-list-bulleted"></i> <i class="mdi mdi-format-list-bulleted"></i>
<span>Policy Transactions</span> <span>Policy Transactions</span>
</a> </a>
<div class="collapse" id="policyTransactions"> <div class="collapse" id="policyTransactionsSub">
<ul> <ul>
<li> <li>
<a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a> <a href="<?= base_url('/policy_tranction/inception/list') ?>">Policy</a>
@ -720,9 +719,12 @@
<li> <li>
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a> <a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement Upload</a>
</li> </li>
<?php } ?>
</ul> </ul>
</div> </div>
</li> </li>
<?php if (in_array(MANAGEMENT_TEAM_ID, user_team())) { ?>
<li> <li>
<a href="#policyReports" data-toggle="collapse" class="waves-effect"> <a href="#policyReports" data-toggle="collapse" class="waves-effect">
<i class="ri-file-chart-fill"></i> <i class="ri-file-chart-fill"></i>
@ -745,19 +747,20 @@
<li> <li>
<a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a> <a href="<?= base_url('/bdsReport/renewal_report') ?>">Renewal Reports</a>
</li> </li>
<?php } ?>
</ul> </ul>
</div> </div>
</li> </li>
<?php } ?>
<li> <li>
<li> <a href="#policyPendingActions" data-toggle="collapse" class="waves-effect">
<a href="#policyMasters" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-timer-sand"></i> <i class="mdi mdi-timer-sand"></i>
<span> Policy Pending Actions </span> <span> Policy Pending Actions </span>
</a> </a>
<div class="collapse" id="policyReports"> <div class="collapse" id="policyPendingActions">
<ul class="nav-third-level"> <ul class="nav-third-level">
<?php if (in_array(FINANCE_TEAM_ID, user_team())) { ?>
<li>
<a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a> <a href="<?= base_url('/policy_tranction/report/report-finance-list') ?>">Finance Team</a>
</li> </li>
<?php } ?> <?php } ?>
@ -766,16 +769,17 @@
<li> <li>
<a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a> <a href="<?= base_url('/policy_tranction/report/report-business-list') ?>">Business Team</a>
</li> </li>
</li> <?php } ?>
</ul> </ul>
</div> </div>
</li>
<li> <li>
<a href="#policyMasters" data-toggle="collapse" class="waves-effect"> <a href="#policyMasters" data-toggle="collapse" class="waves-effect">
<i class="ri-database-2-line"></i> <i class="ri-database-2-line"></i>
<span> Masters </span> <span> Masters </span>
</a> </a>
<div class="collapse" id="policyReports"> <div class="collapse" id="policyMasters">
<ul class="nav-third-level"> <ul class="nav-third-level">
<li> <li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a> <a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
@ -788,11 +792,17 @@
</li> </li>
<li> <li>
<a href="<?= base_url('/dmsSearch') ?>"><i class="ri-book-open-line"></i><span> Documents</span></a> <a href="<?= base_url('/dmsSearch') ?>">
<i class="ri-book-open-line"></i>
<span> Documents</span>
</a>
</li> </li>
</ul> </ul>
</div> </div>
</li> </li>
</div>
</li>
<?php } ?> <?php } ?>

View File

@ -480,7 +480,7 @@
<input id="policy_end_date" type="text" class="form-control" name="policy_end_date" placeholder="DD/MM/YYYY" > <input id="policy_end_date" type="text" class="form-control" name="policy_end_date" placeholder="DD/MM/YYYY" >
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3" id="tpa_div">
<label for="tpa"> TPA <span id="tpa_danger"class="text-danger"></span></label> <label for="tpa"> TPA <span id="tpa_danger"class="text-danger"></span></label>
<select class="form-control" id="tpa" name="tpa" > <select class="form-control" id="tpa" name="tpa" >
<option value="" selected>Select TPA</option> <option value="" selected>Select TPA</option>
@ -1307,6 +1307,12 @@ $(document).ready(function(){
$('#client_type option[value="2"]').show(); $('#client_type option[value="2"]').show();
} }
if(value == 1 || value == 2 || value == 3 || value == 4 || value == 5 || value == 38 || value == 40){
$('#tpa_div').hide();
}else{
$('#tpa_div').show();
}
}); });
@ -1507,6 +1513,13 @@ function getPolicyTransactionDataForEdit(input) {
$('#tpa').val(tpaValue).change(); $('#tpa').val(tpaValue).change();
let policy_type_id_for_hide_tpa = res.data.master_policy_type_id;
if(policy_type_id_for_hide_tpa == 1 || policy_type_id_for_hide_tpa == 2 || policy_type_id_for_hide_tpa == 3 || policy_type_id_for_hide_tpa == 4 || policy_type_id_for_hide_tpa == 5 || policy_type_id_for_hide_tpa == 38 || policy_type_id_for_hide_tpa == 40){
$('#tpa_div').hide();
}else{
$('#tpa_div').show();
}
if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){ if(res.data.client_policy_id != 0 && res.data.client_policy_id != null){
$('#hide_file_upload').show(); $('#hide_file_upload').show();
}else{ }else{
@ -2484,9 +2497,15 @@ function appendOwner(data) {
$.each(data, function(index, item) { $.each(data, function(index, item) {
let client_show_name = item.client_name;
if (item.client_type == 2) {
client_show_name = item.client_name + ' - ' + (item.pan ?? 'N/A');
}
var option = $('<option>', { var option = $('<option>', {
value: item.id, value: item.id,
text: item.client_name, text: client_show_name,
}); });
$('#owner').append(option); $('#owner').append(option);
@ -3362,9 +3381,14 @@ $('#client_type').on('change', function() {
$.each(client_list, function(index, item) { $.each(client_list, function(index, item) {
if (item.client_type == selectedClientType) { if (item.client_type == selectedClientType) {
let client_show_name = item.client_name;
if (item.client_type == 2) {
client_show_name = item.client_name + ' - ' + (item.pan ?? 'N/A');
}
var option = $('<option>', { var option = $('<option>', {
value: item.id, value: item.id,
text: item.client_name, text: client_show_name,
'data-cn': item.client_name, 'data-cn': item.client_name,
'data-ct': item.client_type 'data-ct': item.client_type
}); });
@ -3418,7 +3442,7 @@ $('#Owner_type').on('change', function() {
var option = $('<option>', { var option = $('<option>', {
value: owner.id, value: owner.id,
text: (owner.client_name + ' - ' + (owner.pan ?? '')) text: (owner.client_name + ' - ' + (owner.pan ?? 'N/A'))
}); });
$('#owner').append(option); $('#owner').append(option);
@ -3450,6 +3474,7 @@ $('#policy_status').change(function(){
var client_branch_id = $('#client_branch_id').val(); var client_branch_id = $('#client_branch_id').val();
if(status == 'completed'){ if(status == 'completed'){
if(pt_id == ''){ if(pt_id == ''){
removeAllColumnsExceptFirst('insurerTable'); removeAllColumnsExceptFirst('insurerTable');
} }
@ -3482,6 +3507,12 @@ $('#policy_status').change(function(){
}); });
} }
if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 38 || policy_type_id == 40){
$('#tpa_div').hide();
}else{
$('#tpa_div').show();
}
}else{ }else{
$('#sales_row').hide() $('#sales_row').hide()
$('#policy_no').prop('required', false) $('#policy_no').prop('required', false)

View File

@ -302,7 +302,7 @@ table.dataTable tbody td {
<td><?php echo $issuer[$row['issuer']]; ?></td> <td><?php echo $issuer[$row['issuer']]; ?></td>
<td><?php echo $issuing_type[$row['issue_type']]; ?></td> <td><?php echo $issuing_type[$row['issue_type']]; ?></td>
<td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td> <td><?php echo $client_type[$row['client_type']] ?? '-'; ?></td>
<td><?php echo $row['client_type'] == 2 ? $row['client_name'] : $row['client_short_name'] . ' - ' . $row['client_branch_name']; ?></td> <td><?php echo $row['client_type'] == 2 ? $row['client_name'] . " - " . (!empty($row['pan']) ? $row['pan'] : 'N/A') : $row['client_short_name'] . ' - ' . $row['client_branch_name']; ?></td>
<td><?php echo $row['insurer_short_name']; ?></td> <td><?php echo $row['insurer_short_name']; ?></td>
<td><?php echo $row['policy_type']; ?></td> <td><?php echo $row['policy_type']; ?></td>
<td><?php echo $row['policy_no']; ?></td> <td><?php echo $row['policy_no']; ?></td>
@ -734,17 +734,22 @@ function appendClients(data)
})); }));
$.each(data, function(index, item) { $.each(data, function(index, item) {
let client_show_name = item.client_name;
if (item.client_type == 2) {
client_show_name = item.client_name + ' - ' + (item.pan ?? 'N/A');
}
var option = $('<option>', { var option = $('<option>', {
value: item.id, value: item.id,
text: item.client_name, text: client_show_name,
'data-cn': item.client_name, 'data-cn': item.client_name,
'data-ct': item.client_type, 'data-ct': item.client_type,
class: (item.client_type == 1) ? 'group' : (item.client_type == 2) ? 'individual' : '' class: item.client_type == 1 ? 'group' : item.client_type == 2 ? 'individual' : ''
}); });
$('#client_id').append(option); $('#client_id').append(option);
}); });
} }
function appendVehicles(data, vehicle_id) function appendVehicles(data, vehicle_id)

View File

@ -377,7 +377,7 @@
</div> </div>
<div class="form-group col-md-3 non_id" style="display: none;"> <div class="form-group col-md-3 non_id" style="display: none;">
<label for="non_id_reason">Non ID Reason</label> <label for="non_id_reason">Non ID Reason <span id="non_id_reason_lable_id" class="text-danger"></span></label>
<select class="form-control" id="non_id_reason" name="non_id_reason"> <select class="form-control" id="non_id_reason" name="non_id_reason">
<option value="">Select Reason</option> <option value="">Select Reason</option>
<?php <?php

View File

@ -482,6 +482,8 @@ if (!isset($view_ticket_page)) {
} else { } else {
toastr.error(response.message, 'ERROR'); toastr.error(response.message, 'ERROR');
} }
window.location.href = '<?= base_url('ticket/list') ?>';
}, },
error: function(xhr, status, error) { error: function(xhr, status, error) {
console.error(xhr.responseText); console.error(xhr.responseText);
@ -824,19 +826,19 @@ if (!isset($view_ticket_page)) {
}); });
if (tpaNo == "") { if (tpaNo == "") {
$('#claim_status_id').val(1) $('#claim_status_id').val(1)
$('#non_id_reason').attr('required', true); $('#non_id_reason').attr('required', true);
var $label = $("label[for='non_id_reason']"); var $label = $("#non_id_reason_lable_id");
if ($label.length && !$label.find('.text-danger').length) { $label.text('*');
$label.append(' <span class="text-danger">*</span>');
}
} else { } else {
$('#claim_status_id').val(2) $('#claim_status_id').val(2)
$('#non_id_reason').attr('required', false); $('#non_id_reason').attr('required', false);
var $label = $("label[for='non_id_reason']"); var $label = $("#non_id_reason_lable_id");
$label.text(""); $label.text("");
} }
} }
// $('#employee_data_points').on('change', function() { // $('#employee_data_points').on('change', function() {
@ -874,5 +876,16 @@ if (!isset($view_ticket_page)) {
$('#emp_client_policy_data_list').val('0').select2(); $('#emp_client_policy_data_list').val('0').select2();
$('#search_by_client_employee').val('0').select2(); $('#search_by_client_employee').val('0').select2();
$('#search_by_client_member').val('0').select2(); $('#search_by_client_member').val('0').select2();
} }
$('#tpa_no').on('input', function() {
let tpaNo = $(this).val().trim();
console.log('tpaNo:', tpaNo);
let isEmpty = tpaNo === "";
$('#claim_status_id').val(isEmpty ? 1 : 2);
$('#non_id_reason').prop('required', isEmpty);
$('#non_id_reason_lable_id').text(isEmpty ? '*' : '');
});
</script> </script>