FEAT_NON_EB_CONTD_POLICY_BIND_HR_API
This commit is contained in:
parent
5dd4a5fcbb
commit
5ef7cbb4af
@ -131,3 +131,4 @@ define('UPLOAD_EXT_POLICY_DOCS', ['pdf', 'jpg', 'jpeg', 'png', 'xls', 'xlsx']);
|
||||
define('UPLOAD_EXT_LEAD_FILES', ['xls', 'xlsx', 'pdf', 'jpg', 'jpeg', 'png']);
|
||||
define('UPLOAD_EXT_EXCEL', ['xls', 'xlsx', 'ods', 'csv']);
|
||||
define('UPLOAD_EXT_MAIL_ATTACHMENTS', ['pdf', 'jpg', 'jpeg', 'png', 'doc', 'docx', 'xls', 'xlsx']);
|
||||
define('UPLOAD_EXT_NON_EB_RACK_RATE', ['pdf', 'xls', 'xlsx']);
|
||||
|
||||
@ -171,6 +171,9 @@ $routes->group("/client", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("policyGMCTerms", "ClientController::policyGMCTerms");
|
||||
$routes->get("getterms", "ClientController::getterms");
|
||||
$routes->get("remove/(:any)", "ClientController::removePolicy/$1");
|
||||
$routes->get("getNonEbRackRateFiles", "ClientController::getNonEbRackRateFiles");
|
||||
$routes->post("uploadNonEbRackRateFile", "ClientController::uploadNonEbRackRateFile");
|
||||
$routes->post("removeNonEbRackRateFile", "ClientController::removeNonEbRackRateFile");
|
||||
});
|
||||
|
||||
$routes->group("kyc", ["filter" => "authMVC"], function ($routes) {
|
||||
|
||||
@ -964,6 +964,8 @@ class ClientController extends AdminController
|
||||
'tpa_branch_code' => $item->tpa_branch_code,
|
||||
'branch_name' => $item->branch_name ?? ' - ',
|
||||
'policy_type_id' => $item->policy_type_id,
|
||||
'allocg' => $item->allocg,
|
||||
'lead_misc' => $item->lead_misc,
|
||||
];
|
||||
}, $rawList)) : [];
|
||||
$editData['client_policy']['role'] = get_role_id();
|
||||
@ -3113,6 +3115,89 @@ class ClientController extends AdminController
|
||||
}
|
||||
}
|
||||
|
||||
public function getNonEbRackRateFiles()
|
||||
{
|
||||
$clientPolicyId = $this->request->getGet('client_policy_id');
|
||||
$policy = $this->clientPolicyModel->where('id', $clientPolicyId)->first();
|
||||
|
||||
if (!$policy) {
|
||||
return $this->respond(['status' => false, 'message' => 'Policy not found'], 200);
|
||||
}
|
||||
|
||||
$files = [];
|
||||
$jsonField = is_array($policy) ? ($policy['non_eb_rack_rate_files'] ?? null) : ($policy->non_eb_rack_rate_files ?? null);
|
||||
|
||||
if (!empty($jsonField)) {
|
||||
$files = json_decode($jsonField, true) ?? [];
|
||||
}
|
||||
|
||||
return $this->respond(['status' => true, 'files' => $files], 200);
|
||||
}
|
||||
|
||||
public function uploadNonEbRackRateFile()
|
||||
{
|
||||
$clientPolicyId = $this->request->getPost('client_policy_id');
|
||||
$policy = $this->clientPolicyModel->where('id', $clientPolicyId)->first();
|
||||
|
||||
if (!$policy) {
|
||||
return $this->respond(['status' => false, 'message' => 'Policy not found'], 200);
|
||||
}
|
||||
|
||||
$uploadFilePath = WRITEPATH . 'uploads/non_eb_rack_rate';
|
||||
$fileName = file_Upload($this->request->getFile('file'), $uploadFilePath, UPLOAD_EXT_NON_EB_RACK_RATE);
|
||||
|
||||
if (empty($fileName)) {
|
||||
return $this->respond(['status' => false, 'message' => 'Invalid file. Only PDF and Excel files are allowed.'], 200);
|
||||
}
|
||||
|
||||
$originalName = $this->request->getFile('file')->getClientName();
|
||||
$ext = pathinfo($fileName, PATHINFO_EXTENSION);
|
||||
|
||||
$jsonField = is_array($policy) ? ($policy['non_eb_rack_rate_files'] ?? null) : ($policy->non_eb_rack_rate_files ?? null);
|
||||
$files = !empty($jsonField) ? (json_decode($jsonField, true) ?? []) : [];
|
||||
|
||||
$fileEntry = [
|
||||
'name' => $fileName,
|
||||
'original_name' => $originalName,
|
||||
'type' => $ext,
|
||||
'uploaded_at' => date('Y-m-d H:i:s'),
|
||||
];
|
||||
|
||||
$files[] = $fileEntry;
|
||||
|
||||
$this->clientPolicyModel->where('id', $clientPolicyId)->set(['non_eb_rack_rate_files' => json_encode($files)])->update();
|
||||
|
||||
return $this->respond(['status' => true, 'file' => $fileEntry], 200);
|
||||
}
|
||||
|
||||
public function removeNonEbRackRateFile()
|
||||
{
|
||||
$clientPolicyId = $this->request->getPost('client_policy_id');
|
||||
$filename = $this->request->getPost('filename');
|
||||
$policy = $this->clientPolicyModel->where('id', $clientPolicyId)->first();
|
||||
|
||||
if (!$policy) {
|
||||
return $this->respond(['status' => false, 'message' => 'Policy not found'], 200);
|
||||
}
|
||||
|
||||
$jsonField = is_array($policy) ? ($policy['non_eb_rack_rate_files'] ?? null) : ($policy->non_eb_rack_rate_files ?? null);
|
||||
$files = !empty($jsonField) ? (json_decode($jsonField, true) ?? []) : [];
|
||||
|
||||
$files = array_values(array_filter($files, function ($file) use ($filename) {
|
||||
return $file['name'] !== $filename;
|
||||
}));
|
||||
|
||||
$this->clientPolicyModel->where('id', $clientPolicyId)->set(['non_eb_rack_rate_files' => json_encode($files)])->update();
|
||||
|
||||
// Delete physical file
|
||||
$filePath = WRITEPATH . 'uploads/non_eb_rack_rate/' . $filename;
|
||||
if (file_exists($filePath)) {
|
||||
unlink($filePath);
|
||||
}
|
||||
|
||||
return $this->respond(['status' => true], 200);
|
||||
}
|
||||
|
||||
public function deactivatePolicyTransactionsPolicy($clientPolicyId)
|
||||
{
|
||||
// Deactivate policy_transaction records
|
||||
|
||||
@ -2272,8 +2272,10 @@ class EmployeeRestController extends AdminController
|
||||
where is_active = 1
|
||||
and status = $emp_policy_status
|
||||
and client_policy_id = client_policy.id
|
||||
) as total_premium
|
||||
) as total_premium,
|
||||
CASE WHEN policy_type.allocg IN ('Non-EB', 'Marine') THEN 'Non-EB' ELSE 'EB' END as allocg
|
||||
", false)
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id', 'left')
|
||||
->where('md5(client_policy.client_id)', $this->request->getGet('client_id'))
|
||||
->where('client_policy.client_branch_id', $this->request->getGet('client_branch_id'))
|
||||
->where('client_policy.is_active', 1)
|
||||
@ -4520,6 +4522,29 @@ class EmployeeRestController extends AdminController
|
||||
];
|
||||
// print_r($post_data); die;
|
||||
|
||||
|
||||
$ClientPolicyData = $this->clientPolicyModel
|
||||
->select("
|
||||
client_policy.id as client_policy_id ,
|
||||
client_policy.client_id as client_id,
|
||||
client_policy.policy_type_id as policy_type_id,
|
||||
client_policy.is_addon as is_addon ,
|
||||
client_policy.open_for_enrollment as OpenForEnrollment ,
|
||||
client_policy.inception_type as inception_type,
|
||||
client_policy.policy_no as policy_no,
|
||||
client_policy.insurer_id as insurer_id,
|
||||
DATE_FORMAT(client_policy.policy_start_date, '%d-%m-%Y') AS policy_start_date,
|
||||
DATE_FORMAT(client_policy.policy_end_date, '%d-%m-%Y') AS policy_expiry_date,
|
||||
CASE WHEN policy_type.allocg IN ('Non-EB', 'Marine') THEN 'Non-EB' ELSE 'EB' END as allocg
|
||||
", false)
|
||||
->join('policy_type', 'policy_type.id = client_policy.policy_type_id', 'left')
|
||||
->where('md5(client_policy.client_id)', $post_data['client_id'])
|
||||
->where('client_policy.client_branch_id', $post_data['client_branch_id'])
|
||||
->where('client_policy.is_active', 1)
|
||||
// ->where('client_policy.policy_status', $this->request->getGet('policy_status'))
|
||||
->whereIn('client_policy.id', $post_data['policy_id'])
|
||||
->first();
|
||||
|
||||
if (empty($post_data['client_id'])) {
|
||||
return $this->respondCreated(['status' => false, 'message' => 'Client is required', 'data' => []]);
|
||||
}
|
||||
@ -4538,7 +4563,7 @@ class EmployeeRestController extends AdminController
|
||||
|
||||
// print_r($client_data); die;
|
||||
|
||||
if ($client_data['hr_file_processed_by'] == 1) {
|
||||
if ($client_data['hr_file_processed_by'] == 1 && $ClientPolicyData['allocg'] == 'EB') {
|
||||
$responce = $this->fileUploadInFilesTable($post_data);
|
||||
} else {
|
||||
$responce = $this->fileUploadInHrFileUploadTable($post_data);
|
||||
|
||||
@ -59,6 +59,7 @@ class ClientPolicyModel extends Model
|
||||
"is_from_lead",
|
||||
"wellness_plan_id",
|
||||
"wellness_vendor_id",
|
||||
"non_eb_rack_rate_files",
|
||||
];
|
||||
|
||||
// Callbacks
|
||||
@ -135,6 +136,8 @@ class ClientPolicyModel extends Model
|
||||
->select('tpa_branch.branch_name as tpa_branch_name, tpa_branch.branch_code as tpa_branch_code')
|
||||
->select('policy_type.policy_type as policy_type_name')
|
||||
->select('client_branch.branch_name as branch_name')
|
||||
->select('policy_type.allocg as allocg')
|
||||
->select('leads.misc as lead_misc')
|
||||
->join('insurers', 'insurers.id = client_policy.insurer_id')
|
||||
->join('insurer_branch', 'client_policy.insurer_branch_id = insurer_branch.id')
|
||||
->join('tpa', 'tpa.id = client_policy.tpa_id', 'left')
|
||||
|
||||
@ -454,6 +454,40 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Non EB Rack Rate Modal -->
|
||||
<style>
|
||||
#nonEbRackRateModal .modal-dialog { max-width: 420px !important; width: 420px !important; }
|
||||
#nonEbRackRateModal .modal-body { min-height: auto !important; padding: 10px 15px !important; }
|
||||
#nonEbRackRateModal .modal-header { padding: 8px 15px !important; }
|
||||
#nonEbRackRateModal .modal-footer { padding: 6px 15px !important; }
|
||||
#nonEbRackRateModal .non-eb-upload-row { display: flex; align-items: center; gap: 8px; }
|
||||
#nonEbRackRateModal .non-eb-upload-row input[type="file"] { flex: 1; font-size: 12px; }
|
||||
</style>
|
||||
<div class="modal fade" id="nonEbRackRateModal" tabindex="-1" role="dialog" aria-hidden="true">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h6 class="modal-title mb-0">Non EB Rack Rate Files</h6>
|
||||
<button type="button" class="close" onclick="if(window._nonEbModal) window._nonEbModal.hide();"><span>×</span></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<input type="hidden" id="non_eb_rack_rate_client_policy_id" />
|
||||
<div class="non-eb-upload-row mb-2">
|
||||
<input type="file" id="non_eb_rack_rate_file" accept=".pdf,.xlsx,.xls" />
|
||||
<button type="button" class="btn btn-primary btn-sm" id="btnUploadNonEbFile" style="white-space:nowrap; height:30px;">
|
||||
<i class="mdi mdi-upload"></i> Upload
|
||||
</button>
|
||||
</div>
|
||||
<small class="text-muted">PDF, Excel only</small>
|
||||
<hr class="my-1">
|
||||
<div id="non_eb_rack_rate_file_list" style="max-height:150px; overflow-y:auto;"></div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary btn-sm" onclick="if(window._nonEbModal) window._nonEbModal.hide();">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let hrAccessControlHtmlAppended = false;
|
||||
|
||||
@ -527,13 +527,23 @@ input:checked + .slider_blue::before {
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" data-cdamt="${item.lead_cd_amount}" 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}" data-cdamt="${item.lead_cd_amount}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>`;
|
||||
|
||||
var isNonEb = (item.allocg === 'Non-EB' || item.allocg === 'Marine');
|
||||
|
||||
if (!isNonEb) {
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><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}" data-typeid="${item.policy_type_id}" 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>`;
|
||||
} else {
|
||||
policyTable += `
|
||||
<a href="#" data-misc='${item.lead_misc || ""}' class="dropdown-item btnNonEbTerms"><i class="mdi mdi-file-document-outline mr-2 text-muted font-18 vertical-middle"></i>Non EB Terms</a>
|
||||
<a href="#" data-id="${item.id}" class="dropdown-item btnNonEbRackRateModal"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Non EB Rack Rate</a>`;
|
||||
}
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
if (role != 3 && role != 4) {
|
||||
|
||||
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||
}
|
||||
@ -794,14 +804,24 @@ input:checked + .slider_blue::before {
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" data-cdamt="${item.lead_cd_amount}" 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}" data-cdamt="${item.lead_cd_amount}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>`;
|
||||
|
||||
var isNonEb = (item.allocg === 'Non-EB' || item.allocg === 'Marine');
|
||||
|
||||
if (!isNonEb) {
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><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}" data-typeid="${item.policy_type_id}" 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>`;
|
||||
} else {
|
||||
policyTable += `
|
||||
<a href="#" data-misc='${item.lead_misc || ""}' class="dropdown-item btnNonEbTerms"><i class="mdi mdi-file-document-outline mr-2 text-muted font-18 vertical-middle"></i>Non EB Terms</a>
|
||||
<a href="#" data-id="${item.id}" class="dropdown-item btnNonEbRackRateModal"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Non EB Rack Rate</a>`;
|
||||
}
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
if (role != 3 && role != 4) {
|
||||
|
||||
|
||||
|
||||
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete-outline mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||
}
|
||||
@ -1197,6 +1217,144 @@ input:checked + .slider_blue::before {
|
||||
});
|
||||
});
|
||||
|
||||
$('body').on('click', '.btnNonEbTerms', function(e) {
|
||||
e.preventDefault();
|
||||
var miscData = $(this).attr('data-misc');
|
||||
if (miscData && miscData !== '' && miscData !== 'null') {
|
||||
try {
|
||||
var misc = JSON.parse(miscData);
|
||||
if (misc.placement_sheet_id) {
|
||||
window.open('https://docs.google.com/spreadsheets/d/' + misc.placement_sheet_id, '_blank');
|
||||
} else {
|
||||
alert('No terms found');
|
||||
}
|
||||
} catch (e) {
|
||||
alert('No terms found');
|
||||
}
|
||||
} else {
|
||||
alert('No terms found');
|
||||
}
|
||||
});
|
||||
|
||||
$('body').on('click', '.btnNonEbRackRateModal', function(e) {
|
||||
e.preventDefault();
|
||||
var clientPolicyId = $(this).data('id');
|
||||
$('#non_eb_rack_rate_client_policy_id').val(clientPolicyId);
|
||||
$('#non_eb_rack_rate_file_list').empty();
|
||||
$('#non_eb_rack_rate_file').val('');
|
||||
|
||||
// Load existing files
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/policy/getNonEbRackRateFiles") ?>',
|
||||
method: 'GET',
|
||||
data: { client_policy_id: clientPolicyId },
|
||||
success: function(res) {
|
||||
if (res.status && res.files && res.files.length > 0) {
|
||||
res.files.forEach(function(file) {
|
||||
appendNonEbRackRateFile(file);
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
window._nonEbModal = new bootstrap.Modal(document.getElementById('nonEbRackRateModal'));
|
||||
window._nonEbModal.show();
|
||||
});
|
||||
|
||||
function appendNonEbRackRateFile(file) {
|
||||
var icon = file.type === 'pdf' ? 'mdi-file-pdf text-danger' : 'mdi-file-excel text-success';
|
||||
var html = `<div class="d-flex align-items-center justify-content-between border rounded p-1 mb-1" data-filename="${file.name}" style="font-size:12px;">
|
||||
<div><i class="mdi ${icon} font-16 mr-1"></i>${file.original_name}</div>
|
||||
<button type="button" class="btn btn-sm btn-outline-danger py-0 px-1 btnRemoveNonEbFile" data-filename="${file.name}"><i class="mdi mdi-close"></i></button>
|
||||
</div>`;
|
||||
$('#non_eb_rack_rate_file_list').append(html);
|
||||
}
|
||||
|
||||
$('body').on('click', '#btnUploadNonEbFile', function() {
|
||||
var fileInput = document.getElementById('non_eb_rack_rate_file');
|
||||
var file = fileInput.files[0];
|
||||
if (!file) {
|
||||
toastr.warning('Please select a file first.', 'Warning');
|
||||
return;
|
||||
}
|
||||
|
||||
var ext = file.name.split('.').pop().toLowerCase();
|
||||
if (!['pdf', 'xlsx', 'xls'].includes(ext)) {
|
||||
toastr.error('Only PDF and Excel files are allowed.', 'Invalid File');
|
||||
$('#non_eb_rack_rate_file').val('');
|
||||
return;
|
||||
}
|
||||
|
||||
var formData = new FormData();
|
||||
formData.append('file', file);
|
||||
formData.append('client_policy_id', $('#non_eb_rack_rate_client_policy_id').val());
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/policy/uploadNonEbRackRateFile") ?>',
|
||||
method: 'POST',
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 500);
|
||||
if (res.status) {
|
||||
toastr.success('File uploaded successfully', 'Success');
|
||||
appendNonEbRackRateFile(res.file);
|
||||
$('#non_eb_rack_rate_file').val('');
|
||||
} else {
|
||||
toastr.error(res.message || 'Upload failed', 'Error');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 500);
|
||||
toastr.error('Something went wrong', 'Error');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('body').on('click', '.btnRemoveNonEbFile', function() {
|
||||
var btn = $(this);
|
||||
var filename = btn.data('filename');
|
||||
var clientPolicyId = $('#non_eb_rack_rate_client_policy_id').val();
|
||||
|
||||
Swal.fire({
|
||||
title: "Are you sure?",
|
||||
text: "This file will be removed.",
|
||||
icon: "warning",
|
||||
showCancelButton: true,
|
||||
confirmButtonColor: "#d33",
|
||||
confirmButtonText: "Yes, remove it",
|
||||
}).then((result) => {
|
||||
if (result.isConfirmed) {
|
||||
$.ajax({
|
||||
url: '<?= base_url("client/policy/removeNonEbRackRateFile") ?>',
|
||||
method: 'POST',
|
||||
data: { client_policy_id: clientPolicyId, filename: filename },
|
||||
success: function(res) {
|
||||
if (res.status) {
|
||||
btn.closest('[data-filename]').remove();
|
||||
toastr.success('File removed', 'Success');
|
||||
} else {
|
||||
toastr.error(res.message || 'Remove failed', 'Error');
|
||||
}
|
||||
},
|
||||
error: function() {
|
||||
toastr.error('Something went wrong', 'Error');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('body').on('click', '.btnOpenEnroll', function() {
|
||||
|
||||
Swal.fire({
|
||||
@ -2533,9 +2691,19 @@ $(document).ready(function () {
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" data-cdamt="${item.lead_cd_amount}" 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}" data-cdamt="${item.lead_cd_amount}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>`;
|
||||
|
||||
let isNonEb3 = (item.allocg === 'Non-EB' || item.allocg === 'Marine');
|
||||
|
||||
if (!isNonEb3) {
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><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}" data-typeid="${item.policy_type_id}" 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>`;
|
||||
} else {
|
||||
policyTable += `
|
||||
<a href="#" data-misc='${item.lead_misc || ""}' class="dropdown-item btnNonEbTerms"><i class="mdi mdi-file-document-outline mr-2 text-muted font-18 vertical-middle"></i>Non EB Terms</a>
|
||||
<a href="#" data-id="${item.id}" class="dropdown-item btnNonEbRackRateModal"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Non EB Rack Rate</a>`;
|
||||
}
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
if (role != 3 && role != 4) {
|
||||
@ -2543,14 +2711,14 @@ $(document).ready(function () {
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||
}
|
||||
|
||||
policyTable += `
|
||||
policyTable += `
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(showExpired == false && checkDateStatus(item.policy_end_date) != 'Expired'){
|
||||
@ -2569,9 +2737,19 @@ $(document).ready(function () {
|
||||
<div class="btn-group dropdown">
|
||||
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
|
||||
<div class="dropdown-menu dropdown-menu-right">
|
||||
<a href="#" data-id="${item.id}" id="${item.policy_id}" data-cdamt="${item.lead_cd_amount}" 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}" data-cdamt="${item.lead_cd_amount}" class="dropdown-item btnPolicyEdit"><i class="mdi mdi-lead-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>`;
|
||||
|
||||
let isNonEb4 = (item.allocg === 'Non-EB' || item.allocg === 'Marine');
|
||||
|
||||
if (!isNonEb4) {
|
||||
policyTable += `
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item btnPolicyMaster" ><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}" data-typeid="${item.policy_type_id}" 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>`;
|
||||
} else {
|
||||
policyTable += `
|
||||
<a href="#" data-misc='${item.lead_misc || ""}' class="dropdown-item btnNonEbTerms"><i class="mdi mdi-file-document-outline mr-2 text-muted font-18 vertical-middle"></i>Non EB Terms</a>
|
||||
<a href="#" data-id="${item.id}" class="dropdown-item btnNonEbRackRateModal"><i class="mdi mdi-book-open mr-2 text-muted font-18 vertical-middle"></i>Non EB Rack Rate</a>`;
|
||||
}
|
||||
|
||||
// Conditionally render the delete option based on the role
|
||||
if (role != 3 && role != 4) {
|
||||
@ -2579,14 +2757,14 @@ $(document).ready(function () {
|
||||
<a href="#" data-id="${item.id}" id="${search_term}" data-typeid="${item.policy_type_id}" class="dropdown-item" onclick="removepolicy(this)"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Delete</a>`;
|
||||
}
|
||||
|
||||
policyTable += `
|
||||
policyTable += `
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
`;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user