Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
velz 2024-04-30 08:42:49 +05:30
commit f64a695cf3
7 changed files with 189 additions and 99 deletions

View File

@ -105,7 +105,6 @@ $routes->post('save_deposit', 'ClientController::saveDeposit');
$routes->post("gpa_create", "ClientController::policyGPATerms"); $routes->post("gpa_create", "ClientController::policyGPATerms");
$routes->post("edit", "ClientController::editClientPolicyPremium"); $routes->post("edit", "ClientController::editClientPolicyPremium");
}); });
}); });
@ -140,7 +139,6 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
$routes->get("list/(:any)", "MasterController::insurerBranchList/$1"); $routes->get("list/(:any)", "MasterController::insurerBranchList/$1");
$routes->get("remove/(:any)", "MasterController::removeInsurerBranch/$1"); $routes->get("remove/(:any)", "MasterController::removeInsurerBranch/$1");
}); });
}); });
$routes->group("tpa", ["filter" => "authMVC"], function ($routes) { $routes->group("tpa", ["filter" => "authMVC"], function ($routes) {
@ -177,7 +175,6 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
// $routes->get("list", "MasterController::tpaBranchList"); // $routes->get("list", "MasterController::tpaBranchList");
$routes->get("list/(:any)", "MasterController::kycDocsList/$1"); $routes->get("list/(:any)", "MasterController::kycDocsList/$1");
$routes->get("remove/(:any)", "MasterController::removeKYCDocs/$1"); $routes->get("remove/(:any)", "MasterController::removeKYCDocs/$1");
}); });
}); });
@ -198,7 +195,6 @@ $routes->group("/master", ["filter" => "authMVC"], function($routes){
$routes->get("list/(:any)", "MasterController::policesList/$1"); $routes->get("list/(:any)", "MasterController::policesList/$1");
$routes->get("remove/(:any)", "MasterController::removePolicyPolicies/$1"); $routes->get("remove/(:any)", "MasterController::removePolicyPolicies/$1");
}); });
}); });
}); });
@ -273,8 +269,6 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
$routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData"); $routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData"); $routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
}); });
$routes->post("sendEmail", "EmployeeRestController::send_email"); $routes->post("sendEmail", "EmployeeRestController::send_email");

View File

@ -573,6 +573,9 @@ class ClientController extends AdminController
public function createClientPolicy() public function createClientPolicy()
{ {
// print_r($this->request->getPost()); die;
$this->myLogger->logme('error','Client policy CREATE function called'); $this->myLogger->logme('error','Client policy CREATE function called');
$insurerValue = (string) $this->request->getPost('insurer'); $insurerValue = (string) $this->request->getPost('insurer');
@ -607,6 +610,8 @@ class ClientController extends AdminController
$data['base_policy'] = $this->request->getPost('base_policy'); $data['base_policy'] = $this->request->getPost('base_policy');
$data['policy_status'] = 1; $data['policy_status'] = 1;
$policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first(); $policy_terms = $this->clientPolicyModel->where('id', $this->request->getPost('base_policy'))->first();
if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) { if ( $this->request->getPost('is_addon') == 2 || $this->request->getPost('is_addon') == 3) {
@ -992,7 +997,10 @@ class ClientController extends AdminController
{ {
$this->myLogger->logme('error','getPolicesByInsurerId function called'); $this->myLogger->logme('error','getPolicesByInsurerId function called');
if($id){ if($id){
$police_data = $this->policesModel->where(['insurer_id' => $id, 'is_active' => 1])->findAll(); $police_data = $this->policesModel
->select('policies.*, policy_type.policy_type')
->join('policy_type', 'policy_type.id = policies.policy_type_id')
->where(['insurer_id' => $id, 'policies.is_active' => 1])->findAll();
return $this->respond(['status' => true,'code' => 200,'data' => $police_data], 200); return $this->respond(['status' => true,'code' => 200,'data' => $police_data], 200);
}else{ }else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200); return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);

View File

@ -209,12 +209,25 @@ class EmployeeRestController extends AdminController
if ($Count > 0) { if ($Count > 0) {
if(isset($data[0]->id))
{
if(!isset($data[0]->is_addon_value))
{
$this->createEmployeePolicyData($data[0]->id , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id);
}else{
$this->createEmployeePolicyData($data[0]->id , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si);
}
}else{
if(!isset($data[0]->is_addon_value)) if(!isset($data[0]->is_addon_value))
{ {
$this->createEmployeePolicyData($employee , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id); $this->createEmployeePolicyData($employee , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id);
}else{ }else{
$this->createEmployeePolicyData($data[0]->id , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si); $this->createEmployeePolicyData($employee , $data[0]->emp_code , $data[0]->client_id , $data[0]->client_policy_id , $data[0]->basic_cover_si);
} }
}
$this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code); $this->updatePremiumAmount($data[0]->client_policy_id , $data[0]->emp_code);
@ -970,6 +983,7 @@ class EmployeeRestController extends AdminController
// $message = 'Dear ' . $dataToInsert[$a]['name'] . ",<br> We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer, <br><br><br> Click on the link below to review your personal and family details:<br><a href='https://venbait.in/nhance/app/dev'>Review Details</a>" ; // $message = 'Dear ' . $dataToInsert[$a]['name'] . ",<br> We are glad to welcome you to the employee benefit program ," .$policy_name['name'] ."offered by your employer, <br><br><br> Click on the link below to review your personal and family details:<br><a href='https://venbait.in/nhance/app/dev'>Review Details</a>" ;
$data['employee_name']=$dataToInsert[$a]['name']; $data['employee_name']=$dataToInsert[$a]['name'];
$data['policy_name']=$policy['name']; $data['policy_name']=$policy['name'];
$data['App_Url'] = $_ENV['App_Url'];
$message = view('mail_welcome', $data); $message = view('mail_welcome', $data);

View File

@ -56,10 +56,10 @@ class ClientModel extends Model
return $this->db->table('clients') return $this->db->table('clients')
->select('clients.*') ->select('clients.*')
->where('is_active', 1)
->get() ->get()
->getResult(); ->getResult();
} }
} }

View File

@ -276,17 +276,18 @@ public function updateStatus(){
public function getpolicyWithPattern($client_id){ public function getpolicyWithPattern($client_id){
$query = " $query = $this->db->table('client_policy')
SELECT client_policy.*, policies.name, policies.policy_type_id ->select('client_policy.*, policies.name, policies.policy_type_id, policy_type.policy_type')
FROM client_policy ->join('policies', 'policies.id = client_policy.policy_id')
JOIN policies ON policies.id = client_policy.policy_id ->join('policy_type', 'policy_type.id = policies.policy_type_id')
JOIN policy_type ON policy_type.id = policies.policy_type_id // ->where('policy_type.policy_type', 'GMC')
WHERE policy_type.policy_type = 'GMC' ->whereIn('policy_type.id', [2, 3])
AND client_policy.client_id = {$client_id}"; ->where('client_policy.client_id', $client_id)
->get()
->getResult();
$result = $this->db->query($query)->getResult();
return $result; return $query;
} }
public function getTopUpPolicy($client_id, $type){ public function getTopUpPolicy($client_id, $type){

View File

@ -399,11 +399,11 @@
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
if (xhr.status === 404) { if (xhr.status === 404) {
toastr.warning('Resource not found', 'Warning'); console.log('Resource not found', 'Warning');
} else if (xhr.status === 500) { } else if (xhr.status === 500) {
toastr.warning('Internal server error', 'Warning'); console.log('Internal server error', 'Warning');
} else { } else {
toastr.warning('Unknown error occurred', 'Warning'); console.log('Unknown error occurred', 'Warning');
} }
}, 1000); }, 1000);
} }
@ -418,6 +418,11 @@
var secondPart = parts[1]; var secondPart = parts[1];
var url = "<?= base_url("util/police-by-insurer/") ?>" + secondPart; var url = "<?= base_url("util/police-by-insurer/") ?>" + secondPart;
var selectedOption = $('#base_policy').find(':selected');
var base_policy_data_id = selectedOption.data('id');
console.log('base_policy_data_id', base_policy_data_id);
$.get(url, function(res) { $.get(url, function(res) {
// res = JSON.parse(res)// // res = JSON.parse(res)//
// console.log(res) // console.log(res)
@ -427,29 +432,46 @@
$.each(res.data, function(index, item) { $.each(res.data, function(index, item) {
if ($policy_type_value == 3) { if ($policy_type_value == 3) {
if (item.policy_type_id == 5 || item.policy_type_id == 3) {
if (base_policy_data_id == 3) {
if (item.policy_type_id == 5) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id + item.id +
'">' + item.name + '</option>'; '">' + item.name + '( ' + item.policy_type + ' )</option>';
} }
} else if ($policy_type_value == 2) {
if (item.policy_type_id == 4) { } else {
if (item.policy_type_id == 5 || item.policy_type_id == 3) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id + item.id +
'">' + item.name + '</option>'; '">' + item.name + '( ' + item.policy_type + ' )</option>';
}
}
} else if ($policy_type_value == 2) {
if (item.policy_type_id == 4 || item.policy_type_id == 5) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '( ' + item.policy_type + ' )</option>';
} }
} else if ($policy_type_value == 1) { } else if ($policy_type_value == 1) {
if (item.policy_type_id == 1 || item.policy_type_id == 2) { if (item.policy_type_id == 1 || item.policy_type_id == 2) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id + item.id +
'">' + item.name + '</option>'; '">' + item.name + '( ' + item.policy_type + ' )</option>';
} }
} else { } else {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id + item.id +
'">' + item.name + '</option>'; '">' + item.name + '( ' + item.policy_type + ' )</option>';
} }
}); });
@ -553,11 +575,35 @@
} }
if (res.data.is_addon == 2 || res.data.is_addon == 3) { if (res.data.is_addon == 2 || res.data.is_addon == 3) {
$('#insurer').prop('disabled', true); $("#insurer").next(".select2-container").css({
$('#tpa').prop('disabled', true); 'pointer-events': 'none',
});
$('#select2-insurer-container').css({
'background-color': '#ebebe0',
});
$("#tpa").next(".select2-container").css({
'pointer-events': 'none',
});
$('#select2-tpa-container').css({
'background-color': '#ebebe0',
});
} else { } else {
$('#insurer').prop('disabled', false);
$('#tpa').prop('disabled', false); $("#insurer").next(".select2-container").css({
'pointer-events': 'auto',
});
$('#select2-insurer-container').css({
'background-color': 'transparent',
});
$("#tpa").next(".select2-container").css({
'pointer-events': 'auto',
});
$('#select2-tpa-container').css({
'background-color': 'transparent',
});
} }
var policeOptionHTML = ''; var policeOptionHTML = '';
@ -672,11 +718,11 @@
$('.loader').fadeOut(); $('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow'); $('.loader-mask').delay(350).fadeOut('slow');
if (xhr.status === 404) { if (xhr.status === 404) {
toastr.warning('Resource not found', 'Warning'); console.log('Resource not found', 'Warning');
} else if (xhr.status === 500) { } else if (xhr.status === 500) {
toastr.warning('Internal server error', 'Warning'); console.log('Internal server error', 'Warning');
} else { } else {
toastr.warning('Unknown error occurred', 'Warning'); console.log('Unknown error occurred', 'Warning');
} }
}, 1000); }, 1000);
} }
@ -1044,11 +1090,35 @@
$('#base_policy').val('').change(); $('#base_policy').val('').change();
if ($(this).val() == 2 || $(this).val() == 3) { if ($(this).val() == 2 || $(this).val() == 3) {
$('#insurer').prop('disabled', true);
$('#tpa').prop('disabled', true); $("#insurer").next(".select2-container").css({
'pointer-events': 'none',
});
$('#select2-insurer-container').css({
'background-color': '#ebebe0',
});
$("#tpa").next(".select2-container").css({
'pointer-events': 'none',
});
$('#select2-tpa-container').css({
'background-color': '#ebebe0',
});
} else { } else {
$('#insurer').prop('disabled', false);
$('#tpa').prop('disabled', false); $("#insurer").next(".select2-container").css({
'pointer-events': 'auto',
});
$('#select2-insurer-container').css({
'background-color': 'transparent',
});
$("#tpa").next(".select2-container").css({
'pointer-events': 'auto',
});
$('#select2-tpa-container').css({
'background-color': 'transparent',
});
} }
@ -1107,7 +1177,8 @@
OptionsHTML += '<option value="" selected>Select Base Policy</option>'; OptionsHTML += '<option value="" selected>Select Base Policy</option>';
$.each(res.data, function(index, item) { $.each(res.data, function(index, item) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id + OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id +
'">' + item.name + '</option>'; '">' + item.name + '( ' + item.policy_type + ' )</option>';
}); });
$('#base_policy').html(OptionsHTML); $('#base_policy').html(OptionsHTML);
}, },
@ -1176,6 +1247,8 @@
// if (item.policy_type_id == 5) { // if (item.policy_type_id == 5) {
console.log(item); console.log(item);
policeOptionHTML += '<option data-id="' + item.policy_type_id + policeOptionHTML += '<option data-id="' + item.policy_type_id +
'" value="' + item.id + '" ' + (res.data.policy_id === item.id ? '" value="' + item.id + '" ' + (res.data.policy_id === item.id ?
'selected="selected"' : '') + '>' + item.name + '</option>'; 'selected="selected"' : '') + '>' + item.name + '</option>';

View File

@ -14,7 +14,7 @@
<p class="rad" style="margin: 0!important; text-align: center!important; font-size: 18px!important;">We are glad to welcome you to the employee benefit program, <?= isset($policy_name) ? $policy_name : '' ?> offered by your employer.</p> <p class="rad" style="margin: 0!important; text-align: center!important; font-size: 18px!important;">We are glad to welcome you to the employee benefit program, <?= isset($policy_name) ? $policy_name : '' ?> offered by your employer.</p>
</div> </div>
<button class="explore" style="padding: 15px 25px; background: linear-gradient(to right, #0267C1, #0280EF); border-radius: 50px; border: 0; color: #fff; transition: all .2s ease-in-out; cursor: pointer; box-shadow: 0 5px 10px rgba(0, 0, 0, .1); margin-bottom: 15px;"> <button class="explore" style="padding: 15px 25px; background: linear-gradient(to right, #0267C1, #0280EF); border-radius: 50px; border: 0; color: #fff; transition: all .2s ease-in-out; cursor: pointer; box-shadow: 0 5px 10px rgba(0, 0, 0, .1); margin-bottom: 15px;">
<a href="https://venbait.in/nhance/app/dev" style="text-decoration: none; color: #fff;">Review Details</a> <a href="<?= $App_Url; ?>" style="text-decoration: none; color: #fff;">Review Details</a>
</button> </button>
</div> </div>
</div> </div>