FEAT_REGENERATE_ECARD_TO_S3
This commit is contained in:
parent
7b994166c6
commit
0a7d93a195
@ -2203,6 +2203,9 @@ class EmpDataServiceController extends BaseController
|
|||||||
|
|
||||||
if ($get_policy_type['policy_type_id'] != 1) {
|
if ($get_policy_type['policy_type_id'] != 1) {
|
||||||
|
|
||||||
|
// generate e-card and store S3
|
||||||
|
$r = Jobs::addJob(['job_name' => 'bulkGenerateEcardAndStoreinS3', 'payload' => ['client_policy_id' => $client_policy_id]]);
|
||||||
|
|
||||||
$job_details = new Jobs();
|
$job_details = new Jobs();
|
||||||
$r = Jobs::addJob(['job_name' => 'sendMailForDownloadingECard', 'payload' => ['ids' => $emp_policy_ids, 'client_policy_id' => $client_policy_id]]);
|
$r = Jobs::addJob(['job_name' => 'sendMailForDownloadingECard', 'payload' => ['ids' => $emp_policy_ids, 'client_policy_id' => $client_policy_id]]);
|
||||||
}
|
}
|
||||||
@ -2524,6 +2527,7 @@ class EmpDataServiceController extends BaseController
|
|||||||
$event_type = $file['event_type'];
|
$event_type = $file['event_type'];
|
||||||
$policy_issue_date = $file['policy_issue_date'];
|
$policy_issue_date = $file['policy_issue_date'];
|
||||||
|
|
||||||
|
$client_policy_data = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||||
|
|
||||||
$status_val = 'success';
|
$status_val = 'success';
|
||||||
if ($status == 'in-progress-partially') {
|
if ($status == 'in-progress-partially') {
|
||||||
@ -2613,6 +2617,10 @@ class EmpDataServiceController extends BaseController
|
|||||||
'status' => $status_val,
|
'status' => $status_val,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if($client_policy_data['policy_type_id'] != 1){
|
||||||
|
// re-generate e-card and store S3
|
||||||
|
$r = Jobs::addJob(['job_name' => 'bulkGenerateEcardAndStoreinS3', 'payload' => ['client_policy_id' => $client_policy_id]]);
|
||||||
|
}
|
||||||
|
|
||||||
$this->myLogger->logme('error', 'importCorrectionUpdateEndorsementID employee count : {data}', ['data'=> $emp_count]);
|
$this->myLogger->logme('error', 'importCorrectionUpdateEndorsementID employee count : {data}', ['data'=> $emp_count]);
|
||||||
$this->myLogger->logme('error', 'importCorrectionUpdateEndorsementID batch file status : {data}', ['data'=> $status_val]);
|
$this->myLogger->logme('error', 'importCorrectionUpdateEndorsementID batch file status : {data}', ['data'=> $status_val]);
|
||||||
|
|||||||
@ -4163,6 +4163,8 @@ class EmployeeController extends AdminController
|
|||||||
|
|
||||||
return $this->respond([
|
return $this->respond([
|
||||||
'status' => 'ECARD_BULK_TO_S3 Job queued',
|
'status' => 'ECARD_BULK_TO_S3 Job queued',
|
||||||
|
'message' => 'E-card re-generation process has started successfully.',
|
||||||
|
'dataStatus' => true,
|
||||||
'total' => $total,
|
'total' => $total,
|
||||||
'batches' => $total_batches
|
'batches' => $total_batches
|
||||||
], 200);
|
], 200);
|
||||||
|
|||||||
@ -279,6 +279,7 @@ class EmployeePolicyModel extends Model
|
|||||||
'client_branch.branch_code as client_branch_code',
|
'client_branch.branch_code as client_branch_code',
|
||||||
'cp.policy_no',
|
'cp.policy_no',
|
||||||
'cp.policy_type_id',
|
'cp.policy_type_id',
|
||||||
|
'cp.is_addon',
|
||||||
$ecard_download_link
|
$ecard_download_link
|
||||||
])
|
])
|
||||||
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
->join('employees emp', 'employee_polices.employee_id = emp.id')
|
||||||
|
|||||||
@ -206,6 +206,14 @@
|
|||||||
<a class="dropdown-item" onclick="send_mail_for_individual_employee_ecard('<?= $employee['id'];?>', '<?= $employee['client_policy_id'];?>')" ><i class="mdi mdi-email-alert mr-2 text-muted font-18 vertical-middle"></i>Send E-Card Mail</a>
|
<a class="dropdown-item" onclick="send_mail_for_individual_employee_ecard('<?= $employee['id'];?>', '<?= $employee['client_policy_id'];?>')" ><i class="mdi mdi-email-alert mr-2 text-muted font-18 vertical-middle"></i>Send E-Card Mail</a>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if($employee['relationship'] == 'Self' && in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
|
||||||
|
<a class="dropdown-item" onclick="showReGenerateConfirmation('<?= $employee['client_policy_id'];?>', '<?= $employee['emp_code'];?>')" ><i class="mdi mdi-refresh mr-2 text-muted font-18 vertical-middle"></i>Re-Generate E-Card</a>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
|
<?php if($employee['is_addon'] == 3 && $employee['policy_type_id'] == 3 && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
|
||||||
|
<a class="dropdown-item" onclick="showReGenerateConfirmation('<?= $employee['client_policy_id'];?>', '<?= $employee['emp_code'];?>')" ><i class="mdi mdi-refresh mr-2 text-muted font-18 vertical-middle"></i>Re-Generate E-Card</a>
|
||||||
|
<?php } ?>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -780,4 +788,67 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function showReGenerateConfirmation(client_policy_id, emp_code){
|
||||||
|
|
||||||
|
Swal.fire({
|
||||||
|
title: "Do you want to Re-Generate Ecard for this family?",
|
||||||
|
showDenyButton: true,
|
||||||
|
showCancelButton: false,
|
||||||
|
confirmButtonText: "Yes",
|
||||||
|
denyButtonText: "No"
|
||||||
|
}).then((result) => {
|
||||||
|
|
||||||
|
if (result.isConfirmed) {
|
||||||
|
reGenerateEcardForSingleFamily(client_policy_id, emp_code)
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function reGenerateEcardForSingleFamily(client_policy_id, emp_code)
|
||||||
|
{
|
||||||
|
if(!client_policy_id){
|
||||||
|
toastr.warning('Failed to re-Generate E-card', 'WARNING');
|
||||||
|
}
|
||||||
|
if(!emp_code){
|
||||||
|
toastr.warning('Failed to re-Generate E-card', 'WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log({client_policy_id, emp_code});
|
||||||
|
|
||||||
|
let url = '<?= base_url('/employee/bulkGenerateEcardAndStoreinS3') ?>';
|
||||||
|
|
||||||
|
// Data to send in the AJAX request
|
||||||
|
let requestData = {
|
||||||
|
client_policy_id: client_policy_id,
|
||||||
|
emp_code: emp_code,
|
||||||
|
};
|
||||||
|
|
||||||
|
$('.loader').fadeIn();
|
||||||
|
$('.loader-mask').fadeIn();
|
||||||
|
|
||||||
|
// Send AJAX request
|
||||||
|
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
||||||
|
|
||||||
|
console.log('Data fetched successfully:', response);
|
||||||
|
|
||||||
|
if (response.dataStatus == true) {
|
||||||
|
toastr.success(response.message || 'Initiating successafully.', 'SUCCESS');
|
||||||
|
} else {
|
||||||
|
toastr.warning(response.status || 'Unable to regenerate e-card.', 'WARNING');
|
||||||
|
}
|
||||||
|
|
||||||
|
$('.loader').fadeOut();
|
||||||
|
$('.loader-mask').delay(350).fadeOut('slow');
|
||||||
|
|
||||||
|
}, function(xhr, status, error) {
|
||||||
|
console.error('Error fetching data:', error);
|
||||||
|
console.error(xhr.responseText);
|
||||||
|
toastr.error('Unable to regenerate e-card.', 'ERROR');
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user