Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
Srinivas-Saravanan 2025-06-03 10:17:01 +05:30
commit e6cfbc8be4
7 changed files with 94 additions and 23 deletions

View File

@ -5192,8 +5192,10 @@ class ClientController extends AdminController
->where('insurers.is_active', 1) ->where('insurers.is_active', 1)
->where('tpa.is_active', 1) ->where('tpa.is_active', 1)
->where('employees.is_active', 1) ->where('employees.is_active', 1)
->where('employees.emp_status', "active")
->where('employees.relationship', "Self") ->where('employees.relationship', "Self")
->where('employee_polices.is_active', 1) ->where('employee_polices.is_active', 1)
->where('employee_polices.status', "active")
->where($field_name, $param); ->where($field_name, $param);
if (!empty($client_id)) { if (!empty($client_id)) {

View File

@ -3325,7 +3325,8 @@ class EmployeeRestController extends AdminController
public function getWellnessUrl() public function getWellnessUrl()
{ {
$url = "https://aam.mohfw.gov.in/home/login"; // $url = "https://aam.mohfw.gov.in/home/login";
$url = "";
if (!empty($url)) { if (!empty($url)) {
return $this->respond([ return $this->respond([
@ -3335,7 +3336,7 @@ class EmployeeRestController extends AdminController
} else { } else {
return $this->respond([ return $this->respond([
'status' => 'failed', 'status' => 'failed',
'message' => 'No link found' 'message' => 'Coming soon........!'
], 200); ], 200);
} }
} }

View File

@ -1659,6 +1659,8 @@ class TicketController extends BaseController
$policies = $this->employeePolicyModel $policies = $this->employeePolicyModel
->select('client_policy_id') ->select('client_policy_id')
->where('employee_id', $emp_id) ->where('employee_id', $emp_id)
->where('is_active', 1)
->where('status', 'active')
->findAll(); ->findAll();
if (empty($policies)) { if (empty($policies)) {
@ -1670,8 +1672,20 @@ class TicketController extends BaseController
// Fetch all policy names and IDs in one query // Fetch all policy names and IDs in one query
$policyNameandID = $this->clientPolicyModel $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') ->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,
')
->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('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();

View File

@ -326,14 +326,18 @@ class ClientPolicyModel extends Model
public function updateStatus() public function updateStatus()
{ {
// Update client_policy table // Update client_policy table
$client = $this->db->query("UPDATE client_policy SET policy_status = 0 WHERE policy_end_date < CURDATE()"); $client = $this->db->query("UPDATE client_policy SET policy_status = 0 WHERE policy_end_date < CURDATE()");
$client_count = $this->db->affectedRows(); $client_count = $this->db->affectedRows();
// Update employee_polices table // Update employee_polices table
$employee = $this->db->query("UPDATE employee_polices SET status = 'expired' WHERE policy_end_date < CURDATE()"); $employee = $this->db->query("UPDATE employee_polices SET status = 'expired', is_active = 0 WHERE policy_end_date < CURDATE()");
$emp_count = $this->db->affectedRows(); $emp_count = $this->db->affectedRows();
// Log the result
log_message('info', "Client policies updated: {$client_count}");
log_message('info', "Employee policies updated: {$emp_count}");
return ['client' => $client_count, 'emp' => $emp_count]; return ['client' => $client_count, 'emp' => $emp_count];
} }
@ -358,12 +362,12 @@ class ClientPolicyModel extends Model
{ {
$query = " $query = "
SELECT client_policy.*, policies.name, policies.policy_type_id SELECT client_policy.*, policies.name, policies.policy_type_id
FROM client_policy FROM client_policy
JOIN policies ON policies.id = client_policy.policy_id JOIN policies ON policies.id = client_policy.policy_id
JOIN policy_type ON policy_type.id = policies.policy_type_id JOIN policy_type ON policy_type.id = policies.policy_type_id
WHERE policy_type.policy_type = '{$type}' WHERE policy_type.policy_type = '{$type}'
AND client_policy.client_id = {$client_id}"; AND client_policy.client_id = {$client_id}";
$result = $this->db->query($query)->getResult(); $result = $this->db->query($query)->getResult();

View File

@ -102,7 +102,7 @@
name="policy_no" placeholder="Policy Number"> name="policy_no" placeholder="Policy Number">
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="tpa_id">TPA ID <span class="text-danger"></span></label> <label for="tpa_no">TPA ID <span class="text-danger"></span></label>
<input type="text" class="form-control" id="tpa_no" placeholder="Enter TPA ID" <input type="text" class="form-control" id="tpa_no" placeholder="Enter TPA ID"
value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>" value="<?= isset($ticket_data['tpa_no']) ? $ticket_data['tpa_no'] : '' ?>"
name="tpa_no"> name="tpa_no">
@ -145,7 +145,7 @@
<div class="form-group"> <div class="form-group">
<label>Policy <span class="text-danger">*</span></label> <label>Policy <span class="text-danger">*</span></label>
<select id="emp_client_policy" name="client_policy_id" <select id="emp_client_policy" name="client_policy_id"
class="form-control custom-select" required onchange="setMinDateDOA(this.value)"> class="form-control custom-select" required onchange="setMinDateDOA(this.value); setInsurerAndTPAData(this)">
<?php if (!empty($ticket_data['client_policy_id'])) { ?> <?php if (!empty($ticket_data['client_policy_id'])) { ?>
<option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option> <option value="<?= $ticket_data['client_policy_id'] ?>"><?= $ticket_data['client_policy_id_text'] ?></option>
<?php } else { ?> <?php } else { ?>
@ -156,7 +156,7 @@
</div> </div>
<div class="form-group col-md-3"> <div class="form-group col-md-3">
<label for="tpa_id">TPA <span class="text-danger"></span></label> <label for="tpa_name">TPA <span class="text-danger"></span></label>
<input type=hidden id="tpa_id" name="tpa_id" value="<?= isset($ticket_data['tpa_id']) ? $ticket_data['tpa_id'] : '' ?>"> <input type=hidden id="tpa_id" name="tpa_id" value="<?= isset($ticket_data['tpa_id']) ? $ticket_data['tpa_id'] : '' ?>">
<input type=text class="form-control" id="tpa_name" placeholder="TPA" value="<?= isset($ticket_data['tpa_name']) ? $ticket_data['tpa_name'] : '' ?>" readonly> <input type=text class="form-control" id="tpa_name" placeholder="TPA" value="<?= isset($ticket_data['tpa_name']) ? $ticket_data['tpa_name'] : '' ?>" readonly>
</div> </div>
@ -1048,7 +1048,11 @@
if (ticket_type == 1 && item.policy_type_id != 1) { if (ticket_type == 1 && item.policy_type_id != 1) {
$('#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-tpaid' : item.tpa_id ?? "",
'data-insurername' : item.insurer_name ?? "",
'data-tpaname' : item.tpa_name ?? "",
})); }));
$("#policy_no").val(""); $("#policy_no").val("");
if (policyCount == 1) { if (policyCount == 1) {
@ -1139,6 +1143,26 @@
} }
}); });
} }
function setInsurerAndTPAData(input) {
let selectedOption = $(input).find('option:selected');
let insurer_id = selectedOption.data('insurerid');
let insurer_name = selectedOption.data('insurername');
let tap_name = selectedOption.data('tpaname');
let tap_id = selectedOption.data('tpaid');
console.log('Insurer ID:', insurer_id);
console.log('Insurer Name:', insurer_name);
console.log('TPA Name:', tap_name);
console.log('TPA ID:', tap_id);
$('#insurer_id').val(insurer_id);
$('#insurer_name').val(insurer_name);
$('#tpa_id').val(tap_id);
$('#tpa_name').val(tap_name);
}
</script> </script>
<script> <script>
$("#infoIcon").click(function() { $("#infoIcon").click(function() {

View File

@ -111,7 +111,7 @@
<div class="form-group"> <div class="form-group">
<label>Policy <span class="text-danger">*</span></label> <label>Policy <span class="text-danger">*</span></label>
<select id="emp_client_policy" name="client_policy_id" <select id="emp_client_policy" name="client_policy_id"
class="form-control custom-select" required onchange="setDateValidation(this.value,true)" class="form-control custom-select" required onchange="setDateValidation(this.value,true); setInsurerAndTPAData(this)"
<?= isset($ticket_data['client_policy_id'])?" class = 'readonly-select'":'' ?> <?= isset($ticket_data['client_policy_id'])?" class = 'readonly-select'":'' ?>
> >
<?php if (!empty($ticket_data['client_policy_id'])) { ?> <?php if (!empty($ticket_data['client_policy_id'])) { ?>
@ -705,7 +705,11 @@
if (ticket_type != 1 && item.policy_type_id != 2) { 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-tpaid' : item.tpa_id ?? "",
'data-insurername' : item.insurer_name ?? "",
'data-tpaname' : item.tpa_name ?? "",
})); }));
console.log("policy count from loop",""); console.log("policy count from loop","");
$("#policy_no").val(""); $("#policy_no").val("");
@ -813,6 +817,25 @@
}); });
} }
function setInsurerAndTPAData(input) {
let selectedOption = $(input).find('option:selected');
let insurer_id = selectedOption.data('insurerid');
let insurer_name = selectedOption.data('insurername');
let tap_name = selectedOption.data('tpaname');
let tap_id = selectedOption.data('tpaid');
console.log('Insurer ID:', insurer_id);
console.log('Insurer Name:', insurer_name);
console.log('TPA Name:', tap_name);
console.log('TPA ID:', tap_id);
$('#insurer_id').val(insurer_id);
$('#tpa_id').val(tap_id);
$('#insurer_name').val(insurer_name);
$('#tpa_name').val(tap_name);
}
// function setMinDateDOA(policy_id) { // function setMinDateDOA(policy_id) {
// console.log("Function set min date called "); // console.log("Function set min date called ");
// console.log("Existing DOA instance: ", doa); // console.log("Existing DOA instance: ", doa);

View File

@ -582,7 +582,7 @@ if (!isset($view_ticket_page)) {
// if (response.data.emp_id == null || response.data.emp_id == ''){ // if (response.data.emp_id == null || response.data.emp_id == ''){
unSetClientPolicy(); unSetClientPolicy();
// } // }
setClientAndInsurerData(response.data); setClientAndInsurerData(response.data, true);
setClientBranchPolicy(response.data.emp_id, searchType ?? null, response.data.policy_id ?? null); setClientBranchPolicy(response.data.emp_id, searchType ?? null, response.data.policy_id ?? null);
appendACMS(response.acms) appendACMS(response.acms)
@ -742,12 +742,15 @@ if (!isset($view_ticket_page)) {
} }
function setClientAndInsurerData(data) { function setClientAndInsurerData(data, insurer_data = false) {
if(insurer_data == false){
$('#insurer_id').val(data.insurer_id);
$('#insurer_name').val(data.insurer_name);
$('#tpa_id').val(data.tpa_id);
$('#tpa_name').val(data.tpa_name);
}
$('#insurer_id').val(data.insurer_id);
$('#insurer_name').val(data.insurer_name);
$('#tpa_id').val(data.tpa_id);
$('#tpa_name').val(data.tpa_name);
$('#client_id').val(data.client_id); $('#client_id').val(data.client_id);
$('#client_name').val(data.client_name); $('#client_name').val(data.client_name);