FIX_LIVE_ISSUES
This commit is contained in:
parent
5f0491aa8e
commit
27806fdeb0
@ -45,6 +45,7 @@ class Acl
|
|||||||
'#^/swagger#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, ACCOUNT_MANAGER_ROLE_ID, MANAGER_ROLE_ID]],
|
'#^/swagger#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, ACCOUNT_MANAGER_ROLE_ID, MANAGER_ROLE_ID]],
|
||||||
'#^/viewClaimFile#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, ACCOUNT_MANAGER_ROLE_ID, MANAGER_ROLE_ID, STAFF_ROLE_ID]],
|
'#^/viewClaimFile#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID, ACCOUNT_MANAGER_ROLE_ID, MANAGER_ROLE_ID, STAFF_ROLE_ID]],
|
||||||
'#^/employee/tpaReportsDashboard#' => ['roles' => [ACCOUNT_MANAGER_ROLE_ID, ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
'#^/employee/tpaReportsDashboard#' => ['roles' => [ACCOUNT_MANAGER_ROLE_ID, ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
||||||
|
'#^/policy_tranction/sendInstallmentRemainderMail#' => ['roles' => [ADMIN_ROLE_ID, HEAD_ROLE_ID]],
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -483,7 +483,7 @@ $routes->group("/util", ["filter" => "authMVC"], function ($routes) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
$routes->post("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
$routes->get("policy_tranction/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
||||||
$routes->cli("cli/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
$routes->cli("cli/sendInstallmentRemainderMail","PolicyTransactionController::sendInstallmentRemainderMail");
|
||||||
$routes->cli("cli/cronDailyBDSReport", "PolicyTransactionController::cronDailyBDSReport");
|
$routes->cli("cli/cronDailyBDSReport", "PolicyTransactionController::cronDailyBDSReport");
|
||||||
$routes->cli('cli/croneDailyActivityReport', 'DashboardController::croneDailyActivityReport');
|
$routes->cli('cli/croneDailyActivityReport', 'DashboardController::croneDailyActivityReport');
|
||||||
|
|||||||
@ -7798,7 +7798,6 @@ class ClientController extends AdminController
|
|||||||
|
|
||||||
public function getTheEmpDataForClaim($param, $type = null)
|
public function getTheEmpDataForClaim($param, $type = null)
|
||||||
{
|
{
|
||||||
// Construct the base query
|
|
||||||
$data = $this->clientPolicyModel
|
$data = $this->clientPolicyModel
|
||||||
->select("
|
->select("
|
||||||
clients.id AS client_id,
|
clients.id AS client_id,
|
||||||
@ -7816,20 +7815,20 @@ class ClientController extends AdminController
|
|||||||
employee_polices.uhid AS policy_no,
|
employee_polices.uhid AS policy_no,
|
||||||
employee_polices.client_policy_id
|
employee_polices.client_policy_id
|
||||||
")
|
")
|
||||||
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
->join('clients', 'client_policy.client_id = clients.id')
|
||||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
->join('insurers', 'client_policy.insurer_id = insurers.id')
|
||||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||||
->join('employees', 'clients.id = employees.client_id', 'left')
|
->join('employees', 'clients.id = employees.client_id')
|
||||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
->join('employee_polices', 'employees.id = employee_polices.employee_id AND client_policy.id = employee_polices.client_policy_id')
|
||||||
->where('client_policy.is_active', 1)
|
->where('client_policy.is_active', 1)
|
||||||
|
->where('client_policy.id', $param)
|
||||||
->where('employees.is_active', 1)
|
->where('employees.is_active', 1)
|
||||||
->where('employees.relationship', "Self")
|
->where('employees.relationship', 'Self')
|
||||||
->where('employee_polices.is_active', 1)
|
|
||||||
->whereIn('employees.emp_status', ['active', 'expired'])
|
->whereIn('employees.emp_status', ['active', 'expired'])
|
||||||
|
->where('employee_polices.is_active', 1)
|
||||||
->whereIn('employee_polices.status', ['active', 'expired'])
|
->whereIn('employee_polices.status', ['active', 'expired'])
|
||||||
->where('employees.is_active', 1)
|
->groupBy('employees.id')
|
||||||
->where('employee_polices.client_policy_id', $param)
|
->orderBy('employees.name', 'ASC')
|
||||||
->groupBy('employees.emp_code')
|
|
||||||
->get()
|
->get()
|
||||||
->getResultArray();
|
->getResultArray();
|
||||||
|
|
||||||
@ -7842,7 +7841,7 @@ class ClientController extends AdminController
|
|||||||
insurers.id AS insurer_id,
|
insurers.id AS insurer_id,
|
||||||
insurers.name AS insurer_name,
|
insurers.name AS insurer_name,
|
||||||
tpa.id AS tpa_id,
|
tpa.id AS tpa_id,
|
||||||
tpa.name AS tpa_name,
|
tpa.name AS tpa_name
|
||||||
")
|
")
|
||||||
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
||||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||||
|
|||||||
@ -5373,8 +5373,8 @@ class PolicyTransactionController extends BaseController
|
|||||||
// print_r($bdsInstallmentData);die();
|
// print_r($bdsInstallmentData);die();
|
||||||
|
|
||||||
if (empty($bdsInstallmentData)) {
|
if (empty($bdsInstallmentData)) {
|
||||||
$this->myLogger->logme("error", "No Client Installment is Due in the 15th Day");
|
$this->myLogger->logme("error", "No Client Installment is Due in the 5th Day");
|
||||||
CLI::write("No Client Installment is Due in the 15th Day");
|
CLI::write("No Client Installment is Due in the 5th Day");
|
||||||
return ['status' => false, 'message' => 'No data found', 'response' => []];
|
return ['status' => false, 'message' => 'No data found', 'response' => []];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3323,51 +3323,47 @@ class TicketController extends BaseController
|
|||||||
|
|
||||||
public function getPoliciesbyEmpID()
|
public function getPoliciesbyEmpID()
|
||||||
{
|
{
|
||||||
$received_data = $this->request->getPost();
|
$emp_id = (int) ($this->request->getPost('emp_id') ?? 0);
|
||||||
$ticket_type_id = $this->request->getPost('ticket_type_id') ?? null;
|
$ticket_type_id = (int) ($this->request->getPost('ticket_type_id') ?? 0);
|
||||||
$client_id = $this->request->getPost('client_id') ?? null;
|
$client_id = (int) ($this->request->getPost('client_id') ?? 0);
|
||||||
$emp_id = $received_data['emp_id'];
|
|
||||||
|
|
||||||
// Get all client policy IDs for the given employee
|
if ($emp_id <= 0) {
|
||||||
if ($ticket_type_id == 1) {
|
return $this->respond(['status' => false, 'message' => 'Invalid Employee']);
|
||||||
|
}
|
||||||
|
|
||||||
//get the self data for get the all policy list aginst the emp_code
|
$policyTypeMap = [
|
||||||
$self_data = $this->employeeModel->where('is_active', 1)->where('id', $emp_id)->first();
|
1 => [2, 3, 4, 5], // GMC
|
||||||
|
2 => [1], // GPA
|
||||||
|
3 => [6], // EDLI
|
||||||
|
4 => [7], // GTLI
|
||||||
|
72 => [72], // OPD
|
||||||
|
];
|
||||||
|
|
||||||
$db = db_connect();
|
$db = db_connect();
|
||||||
$builder = $db->table('employees e');
|
$builder = $db->table('employee_polices ep');
|
||||||
$builder->select('ep.*');
|
$builder->select('ep.client_policy_id');
|
||||||
$builder->join('employee_polices ep', 'e.id = ep.employee_id');
|
$builder->join('employees e', 'e.id = ep.employee_id');
|
||||||
$builder->join('client_policy cp', 'cp.id = ep.client_policy_id AND cp.policy_type_id IN (2,3,4,5)');
|
$builder->join('client_policy cp', 'cp.id = ep.client_policy_id');
|
||||||
$builder->where('e.is_active', 1);
|
$builder->where('ep.employee_id', $emp_id);
|
||||||
$builder->where('ep.is_active', 1);
|
$builder->where('ep.is_active', 1);
|
||||||
$builder->where('e.emp_code', $self_data['emp_code']);
|
$builder->whereIn('ep.status', ['active', 'expired']);
|
||||||
if(!empty($client_id)){
|
$builder->where('e.is_active', 1);
|
||||||
|
|
||||||
|
if ($client_id > 0) {
|
||||||
$builder->where('e.client_id', $client_id);
|
$builder->where('e.client_id', $client_id);
|
||||||
}
|
}
|
||||||
$builder->groupBy('client_policy_id');
|
|
||||||
|
|
||||||
$query = $builder->get();
|
if (isset($policyTypeMap[$ticket_type_id])) {
|
||||||
$policies = $query->getResultArray();
|
$builder->whereIn('cp.policy_type_id', $policyTypeMap[$ticket_type_id]);
|
||||||
} else {
|
|
||||||
|
|
||||||
$policies = $this->employeePolicyModel
|
|
||||||
->select('client_policy_id')
|
|
||||||
->where('employee_id', $emp_id)
|
|
||||||
->where('is_active', 1)
|
|
||||||
->where('status', 'active')
|
|
||||||
->findAll();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Return empty if no policies found
|
$policyRows = $builder->groupBy('ep.client_policy_id')->get()->getResultArray();
|
||||||
if (empty($policies)) {
|
$policy_ids = array_values(array_unique(array_column($policyRows, 'client_policy_id')));
|
||||||
return [];
|
|
||||||
|
if (empty($policy_ids)) {
|
||||||
|
return $this->respond(['status' => false, 'message' => 'Policy Not Found']);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Extract client policy IDs into an array
|
|
||||||
$policy_ids = array_column($policies, 'client_policy_id');
|
|
||||||
|
|
||||||
// Fetch all policy names and IDs in one query
|
|
||||||
$policyNameandID = $this->clientPolicyModel
|
$policyNameandID = $this->clientPolicyModel
|
||||||
->select('
|
->select('
|
||||||
CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name,
|
CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name,
|
||||||
@ -3377,22 +3373,19 @@ class TicketController extends BaseController
|
|||||||
insurers.id as insurer_id,
|
insurers.id as insurer_id,
|
||||||
insurers.name as insurer_name,
|
insurers.name as insurer_name,
|
||||||
tpa.name as tpa_name,
|
tpa.name as tpa_name,
|
||||||
tpa.id as tpa_id,
|
tpa.id as tpa_id
|
||||||
')
|
')
|
||||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id AND policy_type.is_active = 1')
|
->join('policy_type', 'policy_type.id = client_policy.policy_type_id AND policy_type.is_active = 1')
|
||||||
->join('insurers', 'insurers.id = client_policy.insurer_id AND insurers.is_active = 1', 'left')
|
->join('insurers', 'insurers.id = client_policy.insurer_id AND insurers.is_active = 1', 'left')
|
||||||
->join('tpa', 'tpa.id = client_policy.tpa_id AND tpa.is_active = 1', 'left')
|
->join('tpa', 'tpa.id = client_policy.tpa_id AND tpa.is_active = 1', 'left')
|
||||||
// ->where('client_policy.policy_status', 1)
|
|
||||||
->whereIn('client_policy.id', $policy_ids)
|
->whereIn('client_policy.id', $policy_ids)
|
||||||
->findAll();
|
->findAll();
|
||||||
|
|
||||||
// dd($policyNameandID);
|
if (!empty($policyNameandID)) {
|
||||||
if ($policyNameandID){
|
return $this->respond(['status' => true, 'policy_data' => $policyNameandID]);
|
||||||
|
|
||||||
return $this->respond(['status'=>true,'policy_data'=> $policyNameandID]);
|
|
||||||
}else{
|
|
||||||
return $this->respond(['status'=>false,'message'=> "Policy Not Found"]);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $this->respond(['status' => false, 'message' => 'Policy Not Found']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCheckListAndConvertArrayToString($ticket_data)
|
public function getCheckListAndConvertArrayToString($ticket_data)
|
||||||
|
|||||||
@ -819,14 +819,31 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function appendPolicyDropdown(data) {
|
function isGpaFormPolicyType(ticket_type, item) {
|
||||||
|
if (ticket_type == 2) {
|
||||||
|
return item.policy_type_id == 1;
|
||||||
|
}
|
||||||
|
if (ticket_type == 3) {
|
||||||
|
return item.policy_type_id == 6;
|
||||||
|
}
|
||||||
|
if (ticket_type == 4) {
|
||||||
|
return item.policy_type_id == 7;
|
||||||
|
}
|
||||||
|
return ticket_type != 1 && item.policy_type_id != 2;
|
||||||
|
}
|
||||||
|
|
||||||
// var ticket_type = $('#ticket_type').val();
|
function appendPolicyDropdown(data) {
|
||||||
hiddenData = $("#empIDHidden").val();
|
hiddenData = $("#empIDHidden").val();
|
||||||
hiddenData = JSON.parse(hiddenData);
|
hiddenData = JSON.parse(hiddenData);
|
||||||
|
|
||||||
console.log("second function is called : ", data);
|
console.log("second function is called : ", data);
|
||||||
let ticket_type = $('#ticket_type_id').val();
|
let ticket_type = $('#ticket_type_id').val();
|
||||||
|
|
||||||
|
if ($('#emp_client_policy').hasClass('select2-hidden-accessible')) {
|
||||||
|
$('#emp_client_policy').select2('destroy');
|
||||||
|
}
|
||||||
|
$('#emp_client_policy').removeClass('readonly-select');
|
||||||
|
|
||||||
$('#emp_client_policy').empty();
|
$('#emp_client_policy').empty();
|
||||||
$('#emp_client_policy').append($('<option>', {
|
$('#emp_client_policy').append($('<option>', {
|
||||||
value: '',
|
value: '',
|
||||||
@ -834,47 +851,46 @@
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
var policyAppendCount = 0;
|
var policyAppendCount = 0;
|
||||||
console.log("got data from backend ",data);
|
console.log("got data from backend ", data);
|
||||||
let policyCount = 1;
|
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
// console.log("item len",item.length);
|
if (!isGpaFormPolicyType(ticket_type, item)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (ticket_type != 1 && item.policy_type_id != 2) {
|
|
||||||
$('#emp_client_policy').append($('<option>', {
|
$('#emp_client_policy').append($('<option>', {
|
||||||
value: item.client_policy_value,
|
value: item.client_policy_value,
|
||||||
text: item.client_policy_name,
|
text: item.client_policy_name,
|
||||||
'data-insurerid' : item.insurer_id ?? "",
|
'data-insurerid': item.insurer_id ?? "",
|
||||||
'data-tpaid' : item.tpa_id ?? "",
|
'data-tpaid': item.tpa_id ?? "",
|
||||||
'data-insurername' : item.insurer_name ?? "",
|
'data-insurername': item.insurer_name ?? "",
|
||||||
'data-tpaname' : item.tpa_name ?? "",
|
'data-tpaname': item.tpa_name ?? "",
|
||||||
|
'data-policy-no': item.policy_no ?? ""
|
||||||
}));
|
}));
|
||||||
console.log("policy count from loop","");
|
|
||||||
$("#policy_no").val("");
|
|
||||||
if (policyCount == 1){
|
|
||||||
console.log("policy count from if",item.policy_no);
|
|
||||||
$("#policy_no").val(item.policy_no);
|
|
||||||
}else{
|
|
||||||
console.log("policy count from greter if ","");
|
|
||||||
$("#policy_no").val("");
|
|
||||||
}
|
|
||||||
policyCount++;
|
|
||||||
policyAppendCount++;
|
policyAppendCount++;
|
||||||
if (hiddenData['searchType'] != null && hiddenData['searchType'] != "" && hiddenData['policy_id'] != null && hiddenData['policy_id'] != "") {
|
});
|
||||||
// $('#emp_client_policy').select2();
|
|
||||||
$("#emp_client_policy").select2();
|
$('#emp_client_policy').select2();
|
||||||
$('#emp_client_policy').val(hiddenData['policy_id']).addClass('readonly-select').select2('destroy').trigger("change");
|
|
||||||
} else {
|
|
||||||
// $('#emp_client_policy').append($('<option>', {
|
|
||||||
// value: item.client_policy_value,
|
|
||||||
// text: item.client_policy_name
|
|
||||||
// }));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
if (policyAppendCount == 0) {
|
if (policyAppendCount == 0) {
|
||||||
|
$("#policy_no").val("");
|
||||||
toastr.warning("No Policies found for the Employee", "Warning");
|
toastr.warning("No Policies found for the Employee", "Warning");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let selectedPolicyId = '';
|
||||||
|
if (hiddenData['searchType'] != null && hiddenData['searchType'] != "" && hiddenData['policy_id'] != null && hiddenData['policy_id'] != "") {
|
||||||
|
let policyId = String(hiddenData['policy_id']);
|
||||||
|
if ($('#emp_client_policy option[value="' + policyId + '"]').length) {
|
||||||
|
selectedPolicyId = policyId;
|
||||||
|
$('#emp_client_policy').addClass('readonly-select');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!selectedPolicyId) {
|
||||||
|
selectedPolicyId = $('#emp_client_policy option:not([value=""])').first().val();
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#emp_client_policy').val(selectedPolicyId).trigger('change');
|
||||||
}
|
}
|
||||||
// $('#emp_client_policy').select2();
|
// $('#emp_client_policy').select2();
|
||||||
$("#emp_client_policy").on('change', function() {
|
$("#emp_client_policy").on('change', function() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user