FIX_CLIENT_LIST_HIDE_DELETED_CLIENT_AND_CLIENT_POLICY_FILTERS : RV

This commit is contained in:
VENKATESHWARAN 2024-04-29 12:33:06 +05:30
parent 36dd429b57
commit bc3642e404
5 changed files with 171 additions and 95 deletions

View File

@ -105,7 +105,6 @@ $routes->post('save_deposit', 'ClientController::saveDeposit');
$routes->post("gpa_create", "ClientController::policyGPATerms");
$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("remove/(:any)", "MasterController::removeInsurerBranch/$1");
});
});
$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/(:any)", "MasterController::kycDocsList/$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("remove/(:any)", "MasterController::removePolicyPolicies/$1");
});
});
});
@ -273,8 +269,6 @@ $routes->group("employeeRest", ["filter" => "authJWT"], function($routes){
$routes->get("exportCashDepositData", "EmployeeRestController::exportCashDepositData");
$routes->get("removeEmpAndEmpPolicyData", "EmployeeRestController::removeEmpAndEmpPolicyData");
});
$routes->post("sendEmail", "EmployeeRestController::send_email");

View File

@ -573,6 +573,9 @@ class ClientController extends AdminController
public function createClientPolicy()
{
// print_r($this->request->getPost()); die;
$this->myLogger->logme('error','Client policy CREATE function called');
$insurerValue = (string) $this->request->getPost('insurer');
@ -607,6 +610,8 @@ class ClientController extends AdminController
$data['base_policy'] = $this->request->getPost('base_policy');
$data['policy_status'] = 1;
$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) {
@ -992,7 +997,10 @@ class ClientController extends AdminController
{
$this->myLogger->logme('error','getPolicesByInsurerId function called');
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);
}else{
return $this->respond(['status' => false,'code' => 404, 'message' => 'no data found'], 200);

View File

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

View File

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

View File

@ -399,11 +399,11 @@
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if (xhr.status === 404) {
toastr.warning('Resource not found', 'Warning');
console.log('Resource not found', 'Warning');
} else if (xhr.status === 500) {
toastr.warning('Internal server error', 'Warning');
console.log('Internal server error', 'Warning');
} else {
toastr.warning('Unknown error occurred', 'Warning');
console.log('Unknown error occurred', 'Warning');
}
}, 1000);
}
@ -418,6 +418,11 @@
var secondPart = parts[1];
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) {
// res = JSON.parse(res)//
// console.log(res)
@ -427,29 +432,46 @@
$.each(res.data, function(index, item) {
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="' +
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="' +
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) {
if (item.policy_type_id == 1 || item.policy_type_id == 2) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
item.id +
'">' + item.name + '</option>';
'">' + item.name + '( ' + item.policy_type + ' )</option>';
}
} else {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' +
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) {
$('#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 {
$('#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 = '';
@ -672,11 +718,11 @@
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if (xhr.status === 404) {
toastr.warning('Resource not found', 'Warning');
console.log('Resource not found', 'Warning');
} else if (xhr.status === 500) {
toastr.warning('Internal server error', 'Warning');
console.log('Internal server error', 'Warning');
} else {
toastr.warning('Unknown error occurred', 'Warning');
console.log('Unknown error occurred', 'Warning');
}
}, 1000);
}
@ -1044,11 +1090,35 @@
$('#base_policy').val('').change();
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 {
$('#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>';
$.each(res.data, function(index, item) {
OptionsHTML += '<option data-id="' + item.policy_type_id + '" value="' + item.id +
'">' + item.name + '</option>';
'">' + item.name + '( ' + item.policy_type + ' )</option>';
});
$('#base_policy').html(OptionsHTML);
},
@ -1176,6 +1247,8 @@
// if (item.policy_type_id == 5) {
console.log(item);
policeOptionHTML += '<option data-id="' + item.policy_type_id +
'" value="' + item.id + '" ' + (res.data.policy_id === item.id ?
'selected="selected"' : '') + '>' + item.name + '</option>';