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');
|
||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
$message = 'Policy updated Successfully';
|
||||
|
||||
|
||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
|
||||
if ($record['open_for_enrollment'] == 0) {
|
||||
$open_for_enrollment_update_value = 1;
|
||||
$message = 'Update Open Enrollment Successfully';
|
||||
$message = 'Enrollment Opened Successfully';
|
||||
} else if ($record['open_for_enrollment'] == 1) {
|
||||
$open_for_enrollment_update_value = 0;
|
||||
$message = 'Update Open Enrollment Successfully';
|
||||
$message = 'Enrollment Closed Successfully';
|
||||
}
|
||||
|
||||
$data = $this->policesModel->getPolicyPremium($record['policy_id']);
|
||||
@ -1589,7 +1592,8 @@ class ClientController extends AdminController
|
||||
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();
|
||||
if ($open_for_enrollment) {
|
||||
@ -1600,8 +1604,9 @@ class ClientController extends AdminController
|
||||
$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>TPA</th>
|
||||
<th>Date</th>
|
||||
<th>Enrollment Status</th>
|
||||
<th>Status</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
@ -246,8 +247,28 @@
|
||||
} else {
|
||||
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 += `
|
||||
<tr>
|
||||
@ -255,6 +276,7 @@
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</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>
|
||||
<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="${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>
|
||||
`;
|
||||
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>
|
||||
</td>
|
||||
@ -389,7 +402,27 @@
|
||||
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 += `
|
||||
<tr>
|
||||
@ -397,6 +430,7 @@
|
||||
<td>${item.policy_name} (${item.policy_type_name})</td>
|
||||
<td>${item.tpa_short} - ${item.tpa_branch_code}</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>
|
||||
<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="${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>
|
||||
`;
|
||||
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>
|
||||
</td>
|
||||
@ -756,18 +781,22 @@
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "You need to approve this!",
|
||||
icon: "warning",
|
||||
icon: "info",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#3085d6",
|
||||
cancelButtonColor: "#d33",
|
||||
confirmButtonText: "Yes"
|
||||
confirmButtonText: "Yes",
|
||||
}).then((result) => {
|
||||
|
||||
|
||||
if (result.isConfirmed) {
|
||||
|
||||
var client_policy_id = $(this).attr('data-id');
|
||||
var policy_id = $(this).attr('id');
|
||||
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) {
|
||||
$('.loader').fadeIn();
|
||||
@ -781,30 +810,28 @@
|
||||
client_policy_id: client_policy_id,
|
||||
},
|
||||
success: function(res) {
|
||||
console.log(res);
|
||||
|
||||
console.log(res.client_policy_data);
|
||||
|
||||
if (res) {
|
||||
if (res.open_for_enrollment) {
|
||||
var json_decode = JSON.parse(res.open_for_enrollment);
|
||||
var open_for_enrollment = json_decode.open_for_enrollment;
|
||||
var client_policy_id = json_decode.client_policy_id;
|
||||
|
||||
if (open_for_enrollment == 1) {
|
||||
// console.log($('[data-id="' + client_policy_id + '"]');
|
||||
|
||||
$('.btnOpenEnroll').each(function(index, element) {
|
||||
if ($(element).data('id') == client_policy_id) {
|
||||
$(element).css({
|
||||
'background-color': 'lightgrey',
|
||||
});
|
||||
$(element).html('<i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment');
|
||||
$(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>');
|
||||
}
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
$('.btnOpenEnroll').each(function(index, element) {
|
||||
if ($(element).data('id') == client_policy_id) {
|
||||
$(element).css({
|
||||
'background-color': '',
|
||||
});
|
||||
$(element).html('<i class="mdi mdi-file-lock mr-2 text-muted font-18 vertical-middle"></i>Open Enrollment');
|
||||
$(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>');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user