CHANGE_POLICY_LIST_ADD_ENROLLMENT_STATUS_COLUNM_TO_OPEN_AND_CLOSE_ENRLMNT : RV
This commit is contained in:
parent
188618718c
commit
0de9e47609
@ -1532,14 +1532,17 @@ class ClientController extends AdminController
|
|||||||
{
|
{
|
||||||
|
|
||||||
$client_policy_id = $this->request->getGet('client_policy_id');
|
$client_policy_id = $this->request->getGet('client_policy_id');
|
||||||
|
$message = 'Policy updated Successfully';
|
||||||
|
|
||||||
|
|
||||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
$message = 'Policy updated Successfully' ;
|
|
||||||
if($record['open_for_enrollment'] == 0){
|
if ($record['open_for_enrollment'] == 0) {
|
||||||
$open_for_enrollment_update_value = 1;
|
$open_for_enrollment_update_value = 1;
|
||||||
$message = 'Update Open Enrollment Successfully';
|
$message = 'Enrollment Opened Successfully';
|
||||||
}else if($record['open_for_enrollment'] == 1){
|
} else if ($record['open_for_enrollment'] == 1) {
|
||||||
$open_for_enrollment_update_value = 0;
|
$open_for_enrollment_update_value = 0;
|
||||||
$message = 'Update Open Enrollment Successfully';
|
$message = 'Enrollment Closed Successfully';
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = $this->policesModel->getPolicyPremium($record['policy_id']);
|
$data = $this->policesModel->getPolicyPremium($record['policy_id']);
|
||||||
@ -1551,57 +1554,59 @@ class ClientController extends AdminController
|
|||||||
$search_term = 'GPA';
|
$search_term = 'GPA';
|
||||||
}
|
}
|
||||||
|
|
||||||
if($search_term === 'GPA'){
|
if ($search_term === 'GPA') {
|
||||||
$racRate = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->countAllResults();
|
$racRate = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->countAllResults();
|
||||||
}else if($search_term === 'GMC'){
|
} else if ($search_term === 'GMC') {
|
||||||
$racRate = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->countAllResults();
|
$racRate = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->countAllResults();
|
||||||
}
|
}
|
||||||
|
|
||||||
$termsData = $this->clientPolicyModel->where(['id' => $client_policy_id, 'is_active' => 1])->first();
|
$termsData = $this->clientPolicyModel->where(['id' => $client_policy_id, 'is_active' => 1])->first();
|
||||||
if(empty($termsData['policy_terms'])){
|
if (empty($termsData['policy_terms'])) {
|
||||||
return $this->respond(['status' => false,'code' => 200,'message' => 'Please define policy terms '], 200);
|
return $this->respond(['status' => false, 'code' => 200, 'message' => 'Please define policy terms '], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$termsData = json_decode($termsData['policy_terms']);
|
$termsData = json_decode($termsData['policy_terms']);
|
||||||
|
|
||||||
if (isset($termsData->sum_insured) && empty($termsData->sum_insured)) {
|
if (isset($termsData->sum_insured) && empty($termsData->sum_insured)) {
|
||||||
return $this->respond(['status' => false,'code' => 200,'message' => 'The Policy terms Sum Insured field is empty', 'data' => $record], 200);
|
return $this->respond(['status' => false, 'code' => 200, 'message' => 'The Policy terms Sum Insured field is empty', 'data' => $record], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($termsData->SumInsured) && empty($termsData->sum_insured)) {
|
if (isset($termsData->SumInsured) && empty($termsData->sum_insured)) {
|
||||||
return $this->respond(['status' => false,'code' => 200,'message' => 'The Policy terms Sum Insured field is empty'], 200);
|
return $this->respond(['status' => false, 'code' => 200, 'message' => 'The Policy terms Sum Insured field is empty'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if 'family_floater' key exists and has a value
|
// Check if 'family_floater' key exists and has a value
|
||||||
if (isset($termsData->family_floater) && $termsData->family_floater == null) {
|
if (isset($termsData->family_floater) && $termsData->family_floater == null) {
|
||||||
return $this->respond(['status' => false,'code' => 200,'message' => 'The Policy terms Family Floater field is empty'], 200);
|
return $this->respond(['status' => false, 'code' => 200, 'message' => 'The Policy terms Family Floater field is empty'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if 'family_floaters' key exists and has a value
|
// Check if 'family_floaters' key exists and has a value
|
||||||
if (isset($termsData->family_floaters) && is_array($termsData->family_floaters) && count($termsData->family_floaters) <= 0) {
|
if (isset($termsData->family_floaters) && is_array($termsData->family_floaters) && count($termsData->family_floaters) <= 0) {
|
||||||
return $this->respond(['status' => false,'code' => 200,'message' => 'The Policy terms Family Members field is empty'], 200);
|
return $this->respond(['status' => false, 'code' => 200, 'message' => 'The Policy terms Family Members field is empty'], 200);
|
||||||
$familyFloatersCount = count($termsData->family_floaters);
|
$familyFloatersCount = count($termsData->family_floaters);
|
||||||
}
|
}
|
||||||
|
|
||||||
if($racRate == 0){
|
if ($racRate == 0) {
|
||||||
|
|
||||||
return $this->respond(['status' => false,'code' => 200,'message' => 'Please define policy premium'], 200);
|
return $this->respond(['status' => false, 'code' => 200, 'message' => 'Please define policy premium'], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
$policy_status = $this->clientPolicyModel->where('id', $client_policy_id )->set('policy_status', 1)->update();
|
// $policy_status = $this->clientPolicyModel->where('id', $client_policy_id )->set('policy_status', 1)->update();
|
||||||
$json_data ='';
|
|
||||||
$open_for_enrollment = $this->clientPolicyModel->where('id', $client_policy_id )->set('open_for_enrollment', $open_for_enrollment_update_value)->update();
|
$json_data = '';
|
||||||
|
$open_for_enrollment = $this->clientPolicyModel->where('id', $client_policy_id)->set('open_for_enrollment', $open_for_enrollment_update_value)->update();
|
||||||
if ($open_for_enrollment) {
|
if ($open_for_enrollment) {
|
||||||
$open_for_enrollment_1 = $this->clientPolicyModel->where('id', $client_policy_id )->find();
|
$open_for_enrollment_1 = $this->clientPolicyModel->where('id', $client_policy_id)->find();
|
||||||
$open_for_enrollment_value = $open_for_enrollment_1[0]['open_for_enrollment'];
|
$open_for_enrollment_value = $open_for_enrollment_1[0]['open_for_enrollment'];
|
||||||
$client_policy_id_value = $client_policy_id;
|
$client_policy_id_value = $client_policy_id;
|
||||||
|
|
||||||
$json_data = json_encode(['open_for_enrollment' => $open_for_enrollment_value, 'client_policy_id' => $client_policy_id_value]);
|
$json_data = json_encode(['open_for_enrollment' => $open_for_enrollment_value, 'client_policy_id' => $client_policy_id_value]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->respond(['status' => true,'code' => 200, 'message' => $message, 'data' => $termsData, 'racRate' => $racRate, 'open_for_enrollment' => $json_data], 200);
|
|
||||||
|
|
||||||
|
|
||||||
|
return $this->respond(['status' => true, 'code' => 200, 'message' => $message, 'data' => $termsData, 'racRate' => $racRate, 'open_for_enrollment' => $json_data, 'client_policy_data' => $record], 200);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -14,6 +14,7 @@
|
|||||||
<th>Policy</th>
|
<th>Policy</th>
|
||||||
<th>TPA</th>
|
<th>TPA</th>
|
||||||
<th>Date</th>
|
<th>Date</th>
|
||||||
|
<th>Enrollment Status</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Action</th>
|
<th>Action</th>
|
||||||
</tr>
|
</tr>
|
||||||
@ -246,8 +247,28 @@
|
|||||||
} else {
|
} else {
|
||||||
search_term = subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
search_term = subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
||||||
}
|
}
|
||||||
|
// console.log('search_term :', search_term)
|
||||||
|
|
||||||
|
var enrollmentStatus = '';
|
||||||
|
if(item.inception_type == 1){
|
||||||
|
|
||||||
|
enrollmentStatus = 'N/A'
|
||||||
|
|
||||||
|
}else if(item.inception_type == 2){
|
||||||
|
|
||||||
|
if(item.open_for_enrollment == 1){
|
||||||
|
|
||||||
|
enrollmentStatus = '<a href="#" data-id="'+ item.id +'" id="' + item.policy_id + '" class="btnOpenEnroll" data-toggle="tooltip" data-placement="left" title="Click To Close Enrollment">Open</a>'
|
||||||
|
|
||||||
|
|
||||||
|
}else if(item.open_for_enrollment == 0){
|
||||||
|
|
||||||
|
enrollmentStatus = '<a href="#" data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" data-id="'+ item.id +'" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
console.log('search_term :', search_term)
|
|
||||||
|
|
||||||
policyTable += `
|
policyTable += `
|
||||||
<tr>
|
<tr>
|
||||||
@ -255,6 +276,7 @@
|
|||||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||||
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
<td>${(item.policy_start_date)} / ${(item.policy_end_date)}</td>
|
||||||
|
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<div class="btn-group dropdown">
|
||||||
@ -263,15 +285,6 @@
|
|||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
||||||
`;
|
|
||||||
if (item.open_for_enrollment == 0) {
|
|
||||||
policyTable +=
|
|
||||||
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a> `;
|
|
||||||
} else {
|
|
||||||
policyTable +=
|
|
||||||
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll" style="background-color: lightgrey;"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle" ></i>Open Enrollment</a> `;
|
|
||||||
}
|
|
||||||
policyTable += `
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -389,7 +402,27 @@
|
|||||||
subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
subject; // Set default value if neither 'GMC' nor 'GPA' exists
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('search_term :', search_term)
|
// console.log('search_term :', search_term)
|
||||||
|
|
||||||
|
var enrollmentStatus = '';
|
||||||
|
if(item.inception_type == 1){
|
||||||
|
|
||||||
|
enrollmentStatus = 'N/A'
|
||||||
|
|
||||||
|
}else if(item.inception_type == 2){
|
||||||
|
|
||||||
|
if(item.open_for_enrollment == 1){
|
||||||
|
|
||||||
|
enrollmentStatus = '<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="'+ item.id +'" id="' + item.policy_id + '" class="btnOpenEnroll">Open</a>'
|
||||||
|
|
||||||
|
|
||||||
|
}else if(item.open_for_enrollment == 0){
|
||||||
|
|
||||||
|
enrollmentStatus = '<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="'+ item.id +'" id="' + item.policy_id + '" class="btnOpenEnroll">Closed</a>'
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
policyTable += `
|
policyTable += `
|
||||||
<tr>
|
<tr>
|
||||||
@ -397,6 +430,7 @@
|
|||||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
<td>${item.tpa_short} - ${item.tpa_branch_code}</td>
|
||||||
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
|
<td>${rearrangeDateFormat(item.policy_start_date)} - ${rearrangeDateFormat(item.policy_end_date)}</td>
|
||||||
|
<td style="text-align: center;">${(enrollmentStatus)}</td>
|
||||||
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
<td>${checkDateStatus(item.policy_end_date, 1)}</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="btn-group dropdown">
|
<div class="btn-group dropdown">
|
||||||
@ -405,15 +439,6 @@
|
|||||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
<a href="#" data-id="${item.id}" id="${search_term}" class="dropdown-item btnPolicyMaster" data-toggle="modal"><i class="mdi mdi-wrench mr-2 text-muted font-18 vertical-middle"></i>Terms</a>
|
||||||
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
<a href="#" data-id="${item.id}" id="${search_term}"class="dropdown-item btnPolicyModel" data-toggle="modal" data-target="#bs-example-modal-lg"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Rack Rate</a>
|
||||||
`;
|
|
||||||
if (item.open_for_enrollment == 0) {
|
|
||||||
policyTable +=
|
|
||||||
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment</a> `;
|
|
||||||
} else {
|
|
||||||
policyTable +=
|
|
||||||
`<a href="#" data-id="${item.id}" id="${item.policy_id}" class="dropdown-item btnOpenEnroll" style="background-color: lightgrey;"><i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle" ></i>Open Enrollment</a> `;
|
|
||||||
}
|
|
||||||
policyTable += `
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -756,18 +781,22 @@
|
|||||||
Swal.fire({
|
Swal.fire({
|
||||||
title: "Are you sure?",
|
title: "Are you sure?",
|
||||||
text: "You need to approve this!",
|
text: "You need to approve this!",
|
||||||
icon: "warning",
|
icon: "info",
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
confirmButtonColor: "#3085d6",
|
confirmButtonColor: "#3085d6",
|
||||||
cancelButtonColor: "#d33",
|
confirmButtonText: "Yes",
|
||||||
confirmButtonText: "Yes"
|
|
||||||
}).then((result) => {
|
}).then((result) => {
|
||||||
|
|
||||||
|
|
||||||
if (result.isConfirmed) {
|
if (result.isConfirmed) {
|
||||||
|
|
||||||
var client_policy_id = $(this).attr('data-id');
|
var client_policy_id = $(this).attr('data-id');
|
||||||
var policy_id = $(this).attr('id');
|
var policy_id = $(this).attr('id');
|
||||||
var client_id = $('#client_id_policy').val()
|
var client_id = $('#client_id_policy').val()
|
||||||
|
|
||||||
// console.log('client_policy_id', client_policy_id);
|
console.log('client_policy_id', client_policy_id)
|
||||||
|
console.log('policy_id', policy_id)
|
||||||
|
console.log('client_id', client_id)
|
||||||
|
|
||||||
if (client_policy_id) {
|
if (client_policy_id) {
|
||||||
$('.loader').fadeIn();
|
$('.loader').fadeIn();
|
||||||
@ -781,30 +810,28 @@
|
|||||||
client_policy_id: client_policy_id,
|
client_policy_id: client_policy_id,
|
||||||
},
|
},
|
||||||
success: function(res) {
|
success: function(res) {
|
||||||
console.log(res);
|
|
||||||
|
console.log(res.client_policy_data);
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
if (res.open_for_enrollment) {
|
if (res.open_for_enrollment) {
|
||||||
var json_decode = JSON.parse(res.open_for_enrollment);
|
var json_decode = JSON.parse(res.open_for_enrollment);
|
||||||
var open_for_enrollment = json_decode.open_for_enrollment;
|
var open_for_enrollment = json_decode.open_for_enrollment;
|
||||||
var client_policy_id = json_decode.client_policy_id;
|
var client_policy_id = json_decode.client_policy_id;
|
||||||
|
|
||||||
if (open_for_enrollment == 1) {
|
if (open_for_enrollment == 1) {
|
||||||
// console.log($('[data-id="' + client_policy_id + '"]');
|
|
||||||
$('.btnOpenEnroll').each(function(index, element) {
|
$('.btnOpenEnroll').each(function(index, element) {
|
||||||
if ($(element).data('id') == client_policy_id) {
|
if ($(element).data('id') == client_policy_id) {
|
||||||
$(element).css({
|
$(element).html('<a data-toggle="tooltip" data-placement="top" title="Click To Close Enrollment" href="#" data-id="' + res.client_policy_data.id + '" id="' + res.client_policy_data.policy_id + '" class="btnOpenEnroll">Open</a>');
|
||||||
'background-color': 'lightgrey',
|
|
||||||
});
|
|
||||||
$(element).html('<i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
$('.btnOpenEnroll').each(function(index, element) {
|
$('.btnOpenEnroll').each(function(index, element) {
|
||||||
if ($(element).data('id') == client_policy_id) {
|
if ($(element).data('id') == client_policy_id) {
|
||||||
$(element).css({
|
$(element).html('<a data-toggle="tooltip" data-placement="top" title="Click To Open Enrollment" href="#" data-id="' + res.client_policy_data.id + '" id="' + res.client_policy_data.policy_id + '" class="btnOpenEnroll">Closed</a>');
|
||||||
'background-color': '',
|
|
||||||
});
|
|
||||||
$(element).html('<i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment');
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user