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]],
|
||||
'#^/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]],
|
||||
'#^/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/cronDailyBDSReport", "PolicyTransactionController::cronDailyBDSReport");
|
||||
$routes->cli('cli/croneDailyActivityReport', 'DashboardController::croneDailyActivityReport');
|
||||
|
||||
@ -7798,7 +7798,6 @@ class ClientController extends AdminController
|
||||
|
||||
public function getTheEmpDataForClaim($param, $type = null)
|
||||
{
|
||||
// Construct the base query
|
||||
$data = $this->clientPolicyModel
|
||||
->select("
|
||||
clients.id AS client_id,
|
||||
@ -7816,20 +7815,20 @@ class ClientController extends AdminController
|
||||
employee_polices.uhid AS policy_no,
|
||||
employee_polices.client_policy_id
|
||||
")
|
||||
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->join('clients', 'client_policy.client_id = clients.id')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id')
|
||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||
->join('employees', 'clients.id = employees.client_id', 'left')
|
||||
->join('employee_polices', 'employees.id = employee_polices.employee_id', 'left')
|
||||
->join('employees', 'clients.id = employees.client_id')
|
||||
->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.id', $param)
|
||||
->where('employees.is_active', 1)
|
||||
->where('employees.relationship', "Self")
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employees.relationship', 'Self')
|
||||
->whereIn('employees.emp_status', ['active', 'expired'])
|
||||
->where('employee_polices.is_active', 1)
|
||||
->whereIn('employee_polices.status', ['active', 'expired'])
|
||||
->where('employees.is_active', 1)
|
||||
->where('employee_polices.client_policy_id', $param)
|
||||
->groupBy('employees.emp_code')
|
||||
->groupBy('employees.id')
|
||||
->orderBy('employees.name', 'ASC')
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
@ -7837,13 +7836,13 @@ class ClientController extends AdminController
|
||||
|
||||
$dataForClientAndInsurer = $this->clientPolicyModel
|
||||
->select("
|
||||
clients.id AS client_id,
|
||||
clients.client_name,
|
||||
insurers.id AS insurer_id,
|
||||
insurers.name AS insurer_name,
|
||||
tpa.id AS tpa_id,
|
||||
tpa.name AS tpa_name,
|
||||
")
|
||||
clients.id AS client_id,
|
||||
clients.client_name,
|
||||
insurers.id AS insurer_id,
|
||||
insurers.name AS insurer_name,
|
||||
tpa.id AS tpa_id,
|
||||
tpa.name AS tpa_name
|
||||
")
|
||||
->join('clients', 'client_policy.client_id = clients.id', 'left')
|
||||
->join('insurers', 'client_policy.insurer_id = insurers.id', 'left')
|
||||
->join('tpa', 'client_policy.tpa_id = tpa.id', 'left')
|
||||
|
||||
@ -5373,8 +5373,8 @@ class PolicyTransactionController extends BaseController
|
||||
// print_r($bdsInstallmentData);die();
|
||||
|
||||
if (empty($bdsInstallmentData)) {
|
||||
$this->myLogger->logme("error", "No Client Installment is Due in the 15th Day");
|
||||
CLI::write("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 5th Day");
|
||||
return ['status' => false, 'message' => 'No data found', 'response' => []];
|
||||
}
|
||||
|
||||
|
||||
@ -3321,78 +3321,71 @@ class TicketController extends BaseController
|
||||
}
|
||||
}
|
||||
|
||||
public function getPoliciesbyEmpID()
|
||||
public function getPoliciesbyEmpID()
|
||||
{
|
||||
$received_data = $this->request->getPost();
|
||||
$ticket_type_id = $this->request->getPost('ticket_type_id') ?? null;
|
||||
$client_id = $this->request->getPost('client_id') ?? null;
|
||||
$emp_id = $received_data['emp_id'];
|
||||
$emp_id = (int) ($this->request->getPost('emp_id') ?? 0);
|
||||
$ticket_type_id = (int) ($this->request->getPost('ticket_type_id') ?? 0);
|
||||
$client_id = (int) ($this->request->getPost('client_id') ?? 0);
|
||||
|
||||
// Get all client policy IDs for the given employee
|
||||
if ($ticket_type_id == 1) {
|
||||
|
||||
//get the self data for get the all policy list aginst the emp_code
|
||||
$self_data = $this->employeeModel->where('is_active', 1)->where('id', $emp_id)->first();
|
||||
|
||||
$db = db_connect();
|
||||
$builder = $db->table('employees e');
|
||||
$builder->select('ep.*');
|
||||
$builder->join('employee_polices ep', '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->where('e.is_active', 1);
|
||||
$builder->where('ep.is_active', 1);
|
||||
$builder->where('e.emp_code', $self_data['emp_code']);
|
||||
if(!empty($client_id)){
|
||||
$builder->where('e.client_id', $client_id);
|
||||
}
|
||||
$builder->groupBy('client_policy_id');
|
||||
|
||||
$query = $builder->get();
|
||||
$policies = $query->getResultArray();
|
||||
} else {
|
||||
|
||||
$policies = $this->employeePolicyModel
|
||||
->select('client_policy_id')
|
||||
->where('employee_id', $emp_id)
|
||||
->where('is_active', 1)
|
||||
->where('status', 'active')
|
||||
->findAll();
|
||||
if ($emp_id <= 0) {
|
||||
return $this->respond(['status' => false, 'message' => 'Invalid Employee']);
|
||||
}
|
||||
|
||||
// Return empty if no policies found
|
||||
if (empty($policies)) {
|
||||
return [];
|
||||
$policyTypeMap = [
|
||||
1 => [2, 3, 4, 5], // GMC
|
||||
2 => [1], // GPA
|
||||
3 => [6], // EDLI
|
||||
4 => [7], // GTLI
|
||||
72 => [72], // OPD
|
||||
];
|
||||
|
||||
$db = db_connect();
|
||||
$builder = $db->table('employee_polices ep');
|
||||
$builder->select('ep.client_policy_id');
|
||||
$builder->join('employees e', 'e.id = ep.employee_id');
|
||||
$builder->join('client_policy cp', 'cp.id = ep.client_policy_id');
|
||||
$builder->where('ep.employee_id', $emp_id);
|
||||
$builder->where('ep.is_active', 1);
|
||||
$builder->whereIn('ep.status', ['active', 'expired']);
|
||||
$builder->where('e.is_active', 1);
|
||||
|
||||
if ($client_id > 0) {
|
||||
$builder->where('e.client_id', $client_id);
|
||||
}
|
||||
|
||||
// Extract client policy IDs into an array
|
||||
$policy_ids = array_column($policies, 'client_policy_id');
|
||||
|
||||
// Fetch all policy names and IDs in one query
|
||||
|
||||
if (isset($policyTypeMap[$ticket_type_id])) {
|
||||
$builder->whereIn('cp.policy_type_id', $policyTypeMap[$ticket_type_id]);
|
||||
}
|
||||
|
||||
$policyRows = $builder->groupBy('ep.client_policy_id')->get()->getResultArray();
|
||||
$policy_ids = array_values(array_unique(array_column($policyRows, 'client_policy_id')));
|
||||
|
||||
if (empty($policy_ids)) {
|
||||
return $this->respond(['status' => false, 'message' => 'Policy Not Found']);
|
||||
}
|
||||
|
||||
$policyNameandID = $this->clientPolicyModel
|
||||
->select('
|
||||
CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name,
|
||||
client_policy.id as client_policy_value,
|
||||
client_policy.policy_type_id,
|
||||
client_policy.policy_no,
|
||||
insurers.id as insurer_id,
|
||||
insurers.name as insurer_name,
|
||||
tpa.name as tpa_name,
|
||||
tpa.id as tpa_id,
|
||||
')
|
||||
CONCAT(policy_type.policy_type, "-", client_policy.policy_no) as client_policy_name,
|
||||
client_policy.id as client_policy_value,
|
||||
client_policy.policy_type_id,
|
||||
client_policy.policy_no,
|
||||
insurers.id as insurer_id,
|
||||
insurers.name as insurer_name,
|
||||
tpa.name as tpa_name,
|
||||
tpa.id as tpa_id
|
||||
')
|
||||
->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('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)
|
||||
->findAll();
|
||||
|
||||
// dd($policyNameandID);
|
||||
if ($policyNameandID){
|
||||
->findAll();
|
||||
|
||||
return $this->respond(['status'=>true,'policy_data'=> $policyNameandID]);
|
||||
}else{
|
||||
return $this->respond(['status'=>false,'message'=> "Policy Not Found"]);
|
||||
if (!empty($policyNameandID)) {
|
||||
return $this->respond(['status' => true, 'policy_data' => $policyNameandID]);
|
||||
}
|
||||
|
||||
return $this->respond(['status' => false, 'message' => 'Policy Not Found']);
|
||||
}
|
||||
|
||||
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 = JSON.parse(hiddenData);
|
||||
|
||||
console.log("second function is called : ", data);
|
||||
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').append($('<option>', {
|
||||
value: '',
|
||||
@ -834,47 +851,46 @@
|
||||
}));
|
||||
|
||||
var policyAppendCount = 0;
|
||||
console.log("got data from backend ",data);
|
||||
let policyCount = 1;
|
||||
console.log("got data from backend ", data);
|
||||
$.each(data, function(index, item) {
|
||||
// console.log("item len",item.length);
|
||||
|
||||
if (ticket_type != 1 && item.policy_type_id != 2) {
|
||||
$('#emp_client_policy').append($('<option>', {
|
||||
value: item.client_policy_value,
|
||||
text: item.client_policy_name,
|
||||
'data-insurerid' : item.insurer_id ?? "",
|
||||
'data-tpaid' : item.tpa_id ?? "",
|
||||
'data-insurername' : item.insurer_name ?? "",
|
||||
'data-tpaname' : item.tpa_name ?? "",
|
||||
}));
|
||||
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++;
|
||||
if (hiddenData['searchType'] != null && hiddenData['searchType'] != "" && hiddenData['policy_id'] != null && hiddenData['policy_id'] != "") {
|
||||
// $('#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 (!isGpaFormPolicyType(ticket_type, item)) {
|
||||
return;
|
||||
}
|
||||
})
|
||||
|
||||
$('#emp_client_policy').append($('<option>', {
|
||||
value: item.client_policy_value,
|
||||
text: item.client_policy_name,
|
||||
'data-insurerid': item.insurer_id ?? "",
|
||||
'data-tpaid': item.tpa_id ?? "",
|
||||
'data-insurername': item.insurer_name ?? "",
|
||||
'data-tpaname': item.tpa_name ?? "",
|
||||
'data-policy-no': item.policy_no ?? ""
|
||||
}));
|
||||
policyAppendCount++;
|
||||
});
|
||||
|
||||
$('#emp_client_policy').select2();
|
||||
|
||||
if (policyAppendCount == 0) {
|
||||
$("#policy_no").val("");
|
||||
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").on('change', function() {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user