MERGE_UAT_BDS_LIVE_ISSUE
This commit is contained in:
commit
5c079a9fbd
@ -1023,7 +1023,6 @@ class PolicyTransactionController extends BaseController
|
||||
'follower_policy_no.*' => ['label' => 'Follower Policy No', 'rules' => 'permit_empty|regex_match[/^[a-zA-Z0-9\/_-]+$/]', 'errors' => [
|
||||
'regex_match' => 'The {field} can only contain letters, numbers, spaces, dashes, and underscores.'
|
||||
]],
|
||||
'calc_policy_issue_date.*' => ['label' => 'Policy Issue Date', 'rules' => 'required', 'errors' => ['required' => 'Policy Issue Date is required']],
|
||||
'co_share_per.*' => ['label' => 'Co-Share %', 'rules' => 'permit_empty|decimal', 'errors' => ['decimal' => 'Co-Share % must be a valid decimal.']],
|
||||
'non_comm_per_amt.*' => ['label' => 'Non-Comm Premium', 'rules' => 'permit_empty|decimal', 'errors' => ['decimal' => 'Amount must be numeric.']],
|
||||
'base_premium.*' => ['label' => 'Base Premium','rules' => 'permit_empty|decimal', 'errors' => ['decimal' => 'Base Premium must be numeric.']],
|
||||
@ -1054,6 +1053,26 @@ class PolicyTransactionController extends BaseController
|
||||
'exp_amt.*' => ['label' => 'Expected Amount', 'rules' => 'permit_empty|decimal', 'errors' => ['decimal' => 'The Expected Amount field must contain a valid number.']]
|
||||
];
|
||||
|
||||
$isCoShare = !empty($post_data['co_share']);
|
||||
$calcPolicyIssueDateRule = [
|
||||
'label' => 'Policy Issue Date',
|
||||
'rules' => 'required',
|
||||
'errors' => ['required' => 'Policy Issue Date is required'],
|
||||
];
|
||||
|
||||
if ($isCoShare) {
|
||||
$coShareTypes = $post_data['co_share_type'] ?? [];
|
||||
if (is_array($coShareTypes)) {
|
||||
foreach ($coShareTypes as $index => $type) {
|
||||
if ((int) $type === 1) {
|
||||
$rules["calc_policy_issue_date.$index"] = $calcPolicyIssueDateRule;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
$rules['calc_policy_issue_date.*'] = $calcPolicyIssueDateRule;
|
||||
}
|
||||
|
||||
if(isset($post_data['client_type']) && $post_data['client_type'] == 1){
|
||||
$rules['client_branch_id'] = ['label' => 'Client Branch', 'rules' => 'required', 'errors' => ['required' => 'Client branch is required']];
|
||||
}
|
||||
@ -1181,6 +1200,15 @@ class PolicyTransactionController extends BaseController
|
||||
$data['co_share'] = 1;
|
||||
}
|
||||
|
||||
if ($data['co_share'] == 1 && !empty($data['follow_insurer_id']) && is_array($data['follow_insurer_id'])) {
|
||||
foreach ($data['follow_insurer_id'] as $index => $followInsurer) {
|
||||
if (($data['co_share_type'][$index] ?? 2) == 1 && !empty($followInsurer)) {
|
||||
list($data['insurer_branch_id'], $data['insurer_id']) = explode('-', $followInsurer);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// if (!isset($data['bro_payable_by'])) {
|
||||
// $data['bro_payable_by'] = 0;
|
||||
// } elseif ($data['bro_payable_by']) {
|
||||
|
||||
@ -176,6 +176,10 @@ class LeadsModel extends Model
|
||||
->join('lead_files', 'leads.id = lead_files.lead_id AND lead_files.type = 2 AND lead_files.is_active = 1', 'left')
|
||||
->where('leads.is_active', 1);
|
||||
|
||||
if (get_role_id() == STAFF_ROLE_ID) {
|
||||
$data->where('leads.created_by', get_session_userid());
|
||||
}
|
||||
|
||||
if (! empty($where)) {
|
||||
$data->where($where);
|
||||
}
|
||||
|
||||
@ -48,7 +48,8 @@
|
||||
|
||||
.switch-label .slider,
|
||||
.switch-label .slider_blue {
|
||||
pointer-events: none;
|
||||
cursor: pointer;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.slider,
|
||||
@ -145,9 +146,8 @@ input:checked + .slider_blue::before {
|
||||
|
||||
<br>
|
||||
|
||||
<div class="" style="padding-bottom: 10px; position: absolute;
|
||||
right: 0;">
|
||||
<label class="switch-label">
|
||||
<div class="expired-policies-toggle-wrap" style="padding-bottom: 10px; position: absolute; right: 0; z-index: 10;">
|
||||
<label class="switch-label" for="chk-show-expired">
|
||||
<input type="checkbox" id="chk-show-expired">
|
||||
<span class="slider"></span>
|
||||
<span class="switch-text">Expired Policies</span>
|
||||
@ -2903,7 +2903,7 @@ $(document).ready(function () {
|
||||
$('#table-client-policy').DataTable().clear().destroy();
|
||||
}
|
||||
|
||||
$('#table-client-policy tbody').html(policyTable); // replace tbody content
|
||||
$('#policy_table').html(policyTable);
|
||||
|
||||
const policyTableInstance = $('#table-client-policy').DataTable({
|
||||
paging: true,
|
||||
|
||||
@ -614,7 +614,7 @@
|
||||
<label for="listed_insurers">Shortlisted Insurers</label>
|
||||
<select class="form-control" id="listed_insurers" name="listed_insurers" multiple>
|
||||
<option value=""></option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<?php foreach ($insurer_branch ?? [] as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
@ -779,8 +779,8 @@
|
||||
<label for="tpa"> TPA <span id="tpa_danger"class="text-danger"></span></label>
|
||||
<select class="form-control" id="tpa" name="tpa" >
|
||||
<option value="" selected>Select TPA</option>
|
||||
<?php foreach ($tpa as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['tpa_id'] ?>">
|
||||
<?php foreach ($tpa ?? [] as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['tpa_id'] ?>">f
|
||||
<?= $value['tpa_short_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
@ -2084,8 +2084,17 @@
|
||||
|
||||
})
|
||||
|
||||
$(document).on('click', 'label.switch.readonly-select, input[type="checkbox"][name="co_share_type[]"].readonly-select', function(e) {
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
|
||||
$(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', function() {
|
||||
|
||||
if ($(this).hasClass('readonly-select')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// $('[name="base_premium[]"]').val("");
|
||||
// $('[name="co_premium[]"]').val("");
|
||||
|
||||
@ -2115,7 +2124,7 @@
|
||||
$(this).prop('checked', false);
|
||||
return;
|
||||
}else{
|
||||
$('#insurer_id').val(insurer)
|
||||
syncInsurerIdFromLeader();
|
||||
}
|
||||
|
||||
$('[name="calc_policy_issue_date[]"]').each(function () {
|
||||
@ -2173,6 +2182,8 @@
|
||||
|
||||
}
|
||||
|
||||
syncInsurerIdFromLeader();
|
||||
|
||||
});
|
||||
|
||||
$(document).on('change', 'select[name="relationship[]"]', function() {
|
||||
@ -2230,7 +2241,7 @@
|
||||
return false;
|
||||
}
|
||||
|
||||
$('#insurer_id').val(insurer)
|
||||
syncInsurerIdFromLeader();
|
||||
|
||||
if (!policy_type_id || !client_id) {
|
||||
$(this).val('').select2();
|
||||
@ -3472,6 +3483,41 @@
|
||||
$('#co_ter_premium_' + input).val(cotep.toFixed(2));
|
||||
}
|
||||
|
||||
function isInceptionEditMode() {
|
||||
return !!$('#policy_tranction_primarykey').val();
|
||||
}
|
||||
|
||||
function lockLeaderCheckboxesInEdit() {
|
||||
if (!isInceptionEditMode()) {
|
||||
return;
|
||||
}
|
||||
$('input[type="checkbox"][name="co_share_type[]"]').each(function() {
|
||||
$(this).addClass('readonly-select');
|
||||
$(this).closest('label.switch').addClass('readonly-select');
|
||||
});
|
||||
}
|
||||
|
||||
function syncInsurerIdFromLeader() {
|
||||
if ($('#cop_yes').is(':checked')) {
|
||||
let leaderInsurer = '';
|
||||
$('input[type="checkbox"][name="co_share_type[]"]:checked').each(function() {
|
||||
let uniqueid = $(this).data('id');
|
||||
let insurer = $('#follow_insurer_id_' + uniqueid).val();
|
||||
if (insurer) {
|
||||
leaderInsurer = insurer;
|
||||
}
|
||||
});
|
||||
if (leaderInsurer) {
|
||||
$('#insurer_id').val(leaderInsurer);
|
||||
}
|
||||
} else {
|
||||
let insurer = $('#follow_insurer_id_1').val();
|
||||
if (insurer) {
|
||||
$('#insurer_id').val(insurer);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function select_leader_disable_premium_amt(input, value) {
|
||||
|
||||
if ($(input).is(':checked')) {
|
||||
@ -3508,6 +3554,8 @@
|
||||
$('input[name="co_ter_premium[]"]').removeClass('readonly-select');
|
||||
|
||||
}
|
||||
|
||||
syncInsurerIdFromLeader();
|
||||
}
|
||||
|
||||
function select_leader_disable_premium_amt_in_edit() {
|
||||
@ -3553,6 +3601,8 @@
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
syncInsurerIdFromLeader();
|
||||
}
|
||||
|
||||
function validateRange(input) {
|
||||
@ -4113,6 +4163,10 @@
|
||||
co_share_type.forEach((value, index) => {
|
||||
formData.append(`co_share_type[${index}]`, value);
|
||||
});
|
||||
|
||||
syncInsurerIdFromLeader();
|
||||
formData.set('insurer_id', $('#insurer_id').val());
|
||||
|
||||
//covert date to mysql format
|
||||
// alert(formData.get('policy_issue_date'));
|
||||
|
||||
@ -4490,6 +4544,8 @@
|
||||
// $(this).val(''); // Clear value
|
||||
// console.log('Input cleared:', $(this).attr('name')); // Log cleared input
|
||||
// });
|
||||
|
||||
syncInsurerIdFromLeader();
|
||||
|
||||
} else {
|
||||
$('#add_more_row').addClass('d-none');
|
||||
@ -4506,6 +4562,8 @@
|
||||
// $(this).val(''); // Clear value
|
||||
// console.log('Input cleared:', $(this).attr('name')); // Log cleared input
|
||||
// });
|
||||
|
||||
syncInsurerIdFromLeader();
|
||||
}
|
||||
});
|
||||
|
||||
@ -4933,7 +4991,7 @@
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]" onchange="getCDAccountNumber(this)" required>
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<?php foreach ($insurer_branch ?? [] as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>" data-ic="<?= $value['category'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
@ -5078,7 +5136,7 @@
|
||||
newCell = `<td>
|
||||
<select class="form-control follow_insurer" data-language="1" data-count="${insurerCount}" id="follow_insurer_id_${insurerCount}" name="follow_insurer_id[]" onchange="getCDAccountNumber(this)" required>
|
||||
<option value="" selected>Select Insurer</option>
|
||||
<?php foreach ($insurer_branch as $value) { ?>
|
||||
<?php foreach ($insurer_branch ?? [] as $value) { ?>
|
||||
<option value="<?= $value['id'] . '-' . $value['insurer_id'] ?>" data-id="<?= $value['insurer_id'] ?>" data-bid="<?= $value['id'] ?>" data-ic="<?= $value['category'] ?>">
|
||||
<?= $value['insurer_name'] . '-' . $value['branch_code'] ?>
|
||||
</option>
|
||||
@ -5363,6 +5421,8 @@
|
||||
dateFormat: "d/m/Y",
|
||||
allowInput: false
|
||||
});
|
||||
|
||||
lockLeaderCheckboxesInEdit();
|
||||
}
|
||||
|
||||
function removeInsurerColumn(index, count_index) {
|
||||
@ -5399,6 +5459,8 @@
|
||||
$('.follow_insurer').prop('required', true);
|
||||
}
|
||||
|
||||
syncInsurerIdFromLeader();
|
||||
|
||||
console.log('#################################### END Remove Insurer Column ####################################');
|
||||
|
||||
}
|
||||
@ -5442,7 +5504,7 @@
|
||||
cell.find('select').val(insurer).change().toggleClass('readonly-select', !!disable_td);
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1').change().toggleClass('readonly-select', !!disable_td);
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type == 1).change();
|
||||
break;
|
||||
case 2: // CD Account Number
|
||||
cell.find('select').val(cd_ac_pk);
|
||||
@ -5572,7 +5634,7 @@
|
||||
cell.find('select').val(insurer).change().toggleClass('readonly-select', !!disable_td);
|
||||
break;
|
||||
case 1: // Is Leader?
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type === '1').change().toggleClass('readonly-select', !!disable_td);
|
||||
cell.find('input[type="checkbox"]').prop('checked', data.co_share_type == 1).change();
|
||||
break;
|
||||
case 2: // CD Account Number
|
||||
cell.find('select').val(cd_ac_pk);
|
||||
@ -5676,6 +5738,9 @@
|
||||
|
||||
// $('input:disabled, select:disabled, textarea:disabled').addClass('readonly-color');
|
||||
|
||||
syncInsurerIdFromLeader();
|
||||
lockLeaderCheckboxesInEdit();
|
||||
|
||||
console.log('#################################### END Populate Table ####################################');
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user