BDS_CHANGE_NEW
This commit is contained in:
parent
8c1ae38108
commit
0c85b8ec72
@ -732,6 +732,11 @@
|
||||
|
||||
|
||||
// dd($data);
|
||||
//Fetch POS
|
||||
$data['pos_data'] = db_connect()->table('partner_pos')
|
||||
->where('is_active', 1)
|
||||
->get()
|
||||
->getResultArray();
|
||||
|
||||
// Load view
|
||||
$this->loadLayout('policy_transaction_inception_list', $data);
|
||||
@ -2382,6 +2387,7 @@
|
||||
'service_person_branch_id' => $issue_type['service_person_branch_id'] ?? null,
|
||||
'agent_id' => $issue_type['agent_id'] ?? null,
|
||||
'agent_code' => $issue_type['agent_code'] ?? null,
|
||||
'pos_id' => $issue_type['pos_id'] ?? null,
|
||||
];
|
||||
|
||||
$data['client_branch_id'] = $client_branch_id;
|
||||
|
||||
@ -447,7 +447,7 @@
|
||||
<td>Co-Share %</td>
|
||||
</tr>
|
||||
<tr id="table_tr_36">
|
||||
<td>Non Commissional <br> Premium Amount</td>
|
||||
<td>Non-Commissionable<br> Premium Amount</td>
|
||||
</tr>
|
||||
<tr id="table_tr_4">
|
||||
<td>Base Premium</td>
|
||||
@ -1580,6 +1580,16 @@
|
||||
let terrisom_premium = ($('#bro_payable_by').val() == 1) ? tep : cotep;
|
||||
let tpTotal = base_premium + third_part_premium + terrisom_premium;
|
||||
|
||||
if($('#bro_payable_by').val() == 2){
|
||||
|
||||
if($('#co_share_type_' + input).val() == 1){
|
||||
base_premium = bp;
|
||||
third_part_premium = tp;
|
||||
terrisom_premium = tep;
|
||||
tpTotal = base_premium + third_part_premium + terrisom_premium;
|
||||
}
|
||||
}
|
||||
|
||||
// Co-premium defaults
|
||||
if ($('#cop_yes').val() == 0) {
|
||||
if (!rawVal('co_premium')) $('#co_premium_' + input).val(bp);
|
||||
|
||||
@ -790,7 +790,7 @@
|
||||
</div> -->
|
||||
|
||||
|
||||
<div class="form-group col-md-2">
|
||||
<div class="form-group col-md-3">
|
||||
<label class="switch" style="position: relative;top: 30px;left: 4px;">
|
||||
<input id="cop_yes" type="checkbox" name="co_share">
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
@ -800,13 +800,22 @@
|
||||
style="position: relative;top: 31px;left: 17px;">CoP Yes</label>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-4 payby d-none">
|
||||
<!-- <div class="form-group col-md-4 payby d-none">
|
||||
<label class="switch" style="position: relative;top: 30px;left: 4px;">
|
||||
<input id="bro_payable_by" type="checkbox" name="bro_payable_by" checked>
|
||||
<span class="slider round" style="height: 27px;"></span>
|
||||
</label>
|
||||
|
||||
<label for="inception_type" style="position: relative;top: 31px;left: 17px;">Remuneration Pay By Leader</label>
|
||||
</div> -->
|
||||
|
||||
<div class="form-group col-md-3 payby d-none">
|
||||
<label for="remuneration_pay_by" class="mb-1">Remuneration Pay By</label>
|
||||
<select id="bro_payable_by"name="bro_payable_by"class="form-control">
|
||||
<option value="1">Pay By Leader</option>
|
||||
<option value="0">Pay By Co-Insurers</option>
|
||||
<option value="2">Pay By MIX</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
@ -912,6 +921,20 @@
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="POS">POS</label>
|
||||
<select class="form-control" id="pos_id" name="pos_id">
|
||||
<option value="">Select POS</option>
|
||||
<?php if (isset($pos_data)) { ?>
|
||||
<?php foreach ($pos_data as $value) { ?>
|
||||
<option value="<?= $value['id'];?>">
|
||||
<?= $value['name']." - ". $value['pos_code'];?>
|
||||
</option>
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -977,7 +1000,7 @@
|
||||
<td>Co-Share %</td>
|
||||
</tr>
|
||||
<tr id="table_tr_36">
|
||||
<td>Non Commissional <br> Premium Amount</td>
|
||||
<td>Non-Commissionable <br> Premium Amount</td>
|
||||
</tr>
|
||||
<tr id="table_tr_4">
|
||||
<td>Base Premium</td>
|
||||
@ -1594,6 +1617,7 @@
|
||||
$('#owner').select2();
|
||||
$('#owner_branch').select2();
|
||||
$('#vehicle_no').select2();
|
||||
$('#pos_id').select2();
|
||||
var today = new Date();
|
||||
|
||||
var dob = flatpickr("#dob", {
|
||||
@ -1671,7 +1695,7 @@
|
||||
|
||||
$('#table_tr_34').show();
|
||||
$('#table_tr_37').show();
|
||||
$("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||
// $("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||
|
||||
}else{
|
||||
|
||||
@ -1680,7 +1704,7 @@
|
||||
|
||||
$('#table_tr_34').hide();
|
||||
$('#table_tr_37').hide();
|
||||
$("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||
// $("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||
|
||||
}
|
||||
|
||||
@ -2010,7 +2034,7 @@
|
||||
|
||||
$('#table_tr_34').hide();
|
||||
$('#table_tr_37').hide();
|
||||
$("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||
// $("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||
|
||||
}else{
|
||||
|
||||
@ -2018,7 +2042,7 @@
|
||||
|
||||
$('#table_tr_34').show();
|
||||
$('#table_tr_37').show();
|
||||
$("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||
// $("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||
}
|
||||
|
||||
if(value == 8){
|
||||
@ -2049,6 +2073,8 @@
|
||||
let val = $(this).val();
|
||||
let uniqueid = $(this).data('id');
|
||||
let insurer = $('#follow_insurer_id_'+uniqueid).val()
|
||||
let policy_type_id = $('#policy_type_id').val();
|
||||
let client_type = $('#client_type').val();
|
||||
|
||||
var client_id = $('#client_id').val()
|
||||
var insurer_id = $('#follow_insurer_id_'+uniqueid).find('option:selected').attr('data-id');
|
||||
@ -2099,6 +2125,27 @@
|
||||
$('[id^="cd_current_balance_"]').show();
|
||||
}
|
||||
|
||||
if(policy_type_id > 7 || client_type == 1){
|
||||
$('[name="cd_ac_no_for_child[]"]').removeAttr('onchange');
|
||||
$('#cd_ac_no_' + uniqueid).attr('onchange', 'addCDAccountNumber(this); restrictCDACNO(this);');
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
|
||||
$('[name="cd_ac_no_for_child[]"]').each(function () {
|
||||
$(this).prop('required', false).parsley().reset();
|
||||
});
|
||||
|
||||
$('#cd_ac_no_' + uniqueid).prop('required', true).parsley().reset();
|
||||
|
||||
} else {
|
||||
|
||||
$('[name="cd_ac_no_for_child[]"]').each(function () {
|
||||
$(this).prop('required', false).parsley().reset();
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).on('change', 'select[name="relationship[]"]', function() {
|
||||
@ -2141,6 +2188,7 @@
|
||||
|
||||
$(document).on('change', '[name="follow_insurer_id[]"]', function() {
|
||||
|
||||
let currentSelect = $(this);
|
||||
let insurer = $(this).val();
|
||||
let unique_id = $(this).data('count');
|
||||
let client_id = $('#client_id').val();
|
||||
@ -2154,8 +2202,24 @@
|
||||
$('#insurer_id').val(insurer)
|
||||
|
||||
if (!policy_type_id || !client_id) {
|
||||
$(this).val('').select2();
|
||||
$(this).val('').select2();
|
||||
toastr.warning(!policy_type_id ? 'Please select the Policy Type' : 'Please select the Client', 'WARNING');
|
||||
return false;
|
||||
}
|
||||
|
||||
let isDuplicate = false;
|
||||
|
||||
$('[name="follow_insurer_id[]"]').not(currentSelect).each(function () {
|
||||
if ($(this).val() === insurer) {
|
||||
isDuplicate = true;
|
||||
return false; // break loop
|
||||
}
|
||||
});
|
||||
|
||||
if (isDuplicate) {
|
||||
$(this).val('').select2();
|
||||
toastr.warning('Do not select the same insurer and branch again');
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
@ -2352,8 +2416,7 @@
|
||||
$('#serviced_by').val(res.data.serviced_by ?? '').change();
|
||||
$('#base_cd_amount').val(res.data.base_cd_amount);
|
||||
$('#issuer_branch').val(res.data.issuer_branch);
|
||||
console.log('res.data.base_cd_amount', res.data.base_cd_amount);
|
||||
console.log('res.data.issuer_branch', res.data.issuer_branch);
|
||||
$('#pos_id').val(res.data.pos_id ?? '').change();
|
||||
|
||||
|
||||
// Additional form handling logic
|
||||
@ -2417,11 +2480,12 @@
|
||||
}
|
||||
|
||||
// Handle brokerage pay by
|
||||
if (res.data.bro_payable_by == 1) {
|
||||
$('#bro_payable_by').prop('checked', true);
|
||||
} else {
|
||||
$('#bro_payable_by').prop('checked', false);
|
||||
}
|
||||
// if (res.data.bro_payable_by == 1) {
|
||||
// $('#bro_payable_by').prop('checked', true);
|
||||
// } else {
|
||||
// $('#bro_payable_by').prop('checked', false);
|
||||
// }
|
||||
$('#bro_payable_by').val(res.data.bro_payable_by);
|
||||
|
||||
// Policy transaction status handling
|
||||
if (res.data.status == "completed") {
|
||||
@ -2457,7 +2521,7 @@
|
||||
$('#client_branch_id').prop('required', false);
|
||||
$('#table_tr_34').hide();
|
||||
$('#table_tr_37').hide();
|
||||
$("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||
// $("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||
|
||||
} else {
|
||||
$('#policyholdernamediv').hide();
|
||||
@ -2465,7 +2529,7 @@
|
||||
$('#client_branch_id').prop('required', true);
|
||||
$('#table_tr_34').show();
|
||||
$('#table_tr_37').show();
|
||||
$("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||
// $("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||
}
|
||||
|
||||
//Vehicle File Upload Tab Hide And show
|
||||
@ -2711,7 +2775,8 @@
|
||||
let terrisom_premium = cotep;
|
||||
|
||||
let tpTotal = cop + cotp + cotep;
|
||||
if($('#bro_payable_by').is(':checked')){
|
||||
// if($('#bro_payable_by').is(':checked')){
|
||||
if($('#bro_payable_by').val() == 1){
|
||||
|
||||
tpTotal = bp + tp + tep;
|
||||
|
||||
@ -2719,6 +2784,19 @@
|
||||
third_part_premium = tp;
|
||||
terrisom_premium = tep;
|
||||
|
||||
}else if($('#bro_payable_by').val() == 2){
|
||||
|
||||
console.log("$('#bro_payable_by').val()", $('#bro_payable_by').val());
|
||||
console.log("$('#co_share_type_' + input).is(':checked')", $('co_share_type_' + input).is(':checked'))
|
||||
|
||||
if($('#co_share_type_' + input).is(':checked')){
|
||||
|
||||
tpTotal = bp + tp + tep;
|
||||
|
||||
base_premium = bp;
|
||||
third_part_premium = tp;
|
||||
terrisom_premium = tep;
|
||||
}
|
||||
}
|
||||
|
||||
if (!$('#cop_yes').is(':checked')) {
|
||||
@ -2812,7 +2890,7 @@
|
||||
let policy_type_id = $('#policy_type_id').val();
|
||||
|
||||
if(policy_type_id > 7 && name == "base_premium[]"){
|
||||
checkCDAmountForBasePremium(input);
|
||||
// checkCDAmountForBasePremium(input);
|
||||
}else{
|
||||
console.log("First Skip the Ajax Call these are group policies");
|
||||
}
|
||||
@ -3372,7 +3450,6 @@
|
||||
$('input[name="co_ter_premium[]"]').addClass('readonly-select');
|
||||
$('#co_ter_premium_' + value).removeClass('readonly-select');
|
||||
|
||||
|
||||
$('[name="cd_ac_no_for_child[]"]').hide();
|
||||
$('[id^="cd_current_balance_"]').hide();
|
||||
|
||||
@ -3382,7 +3459,6 @@
|
||||
|
||||
// $('input[name="cd_ac_no_for_child[]"]').addClass('readonly-select');
|
||||
// $('#cd_ac_no_' + value).removeClass('readonly-select');
|
||||
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -4386,11 +4462,11 @@
|
||||
if(policy_type_id == 1 || policy_type_id == 2 || policy_type_id == 3 || policy_type_id == 4 || policy_type_id == 5 || policy_type_id == 6 || policy_type_id == 7){
|
||||
$('#table_tr_34').hide();
|
||||
$('#table_tr_37').hide();
|
||||
$("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||
// $("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||
}else{
|
||||
$('#table_tr_34').show();
|
||||
$('#table_tr_37').show();
|
||||
$("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||
// $("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||
}
|
||||
}
|
||||
|
||||
@ -4468,13 +4544,13 @@
|
||||
$('#owner_branch').prop('required', false);
|
||||
$('#table_tr_34').hide();
|
||||
$('#table_tr_37').hide();
|
||||
$("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||
// $("select[name='cd_ac_no_for_child[]']").removeAttr("required");
|
||||
} else {
|
||||
$('.ownerbranchdiv').show();
|
||||
$('#owner_branch').prop('required', true);
|
||||
$('#table_tr_34').show();
|
||||
$('#table_tr_37').show();
|
||||
$("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||
// $("select[name='cd_ac_no_for_child[]']").attr('required', 'required');
|
||||
}
|
||||
|
||||
// console.log('selected Owner type', selectedClientType);
|
||||
@ -4767,7 +4843,7 @@
|
||||
newCell = `<td><input type="text" class="right-align-input" id="non_comm_per_amt_${insurerCount}" name="non_comm_per_amt[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 8: // Base Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" onchange="checkCDAmountForBasePremium(${insurerCount})" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 9: // TP Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
@ -4912,7 +4988,7 @@
|
||||
newCell = `<td><input type="text" class="right-align-input" id="non_comm_per_amt_${insurerCount}" name="non_comm_per_amt[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 8: // Base Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
newCell = `<td><input type="text" class="right-align-input" id="base_premium_${insurerCount}" name="base_premium[]" onchange="checkCDAmountForBasePremium(${insurerCount})" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
break;
|
||||
case 9: // TP Premium
|
||||
newCell = `<td><input type="text" class="right-align-input" id="tp_premium_${insurerCount}" name="tp_premium[]" oninput="" onkeypress="return onlyNumbers(event)"></td>`;
|
||||
@ -5458,10 +5534,12 @@
|
||||
});
|
||||
|
||||
if(index != 0){
|
||||
if(data.co_share_type != 0 && data.co_share_type != 1){
|
||||
let co_share_index = index + 1;
|
||||
select_leader_disable_premium_amt_in_edit(co_share_index);
|
||||
}
|
||||
// if(data.co_share_type != 0 && data.co_share_type != 1){
|
||||
// let co_share_index = index + 1;
|
||||
// select_leader_disable_premium_amt_in_edit(co_share_index);
|
||||
// }
|
||||
select_leader_disable_premium_amt_in_edit();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -685,13 +685,16 @@ $(document).ready(function() {
|
||||
var totalRewards = getTotal(24);
|
||||
var totalIrda = getTotal(25);
|
||||
var totalBilled = getTotal(26);
|
||||
var totalRevenue = parseFloat(totalIrda) + parseFloat(totalRewards);
|
||||
var totalUnbilled = getTotal(27);
|
||||
|
||||
var totalIrdaAmt = parseFloat(totalBilled) - parseFloat(totalRewards);
|
||||
var totalRevenue = parseFloat(totalIrdaAmt) + parseFloat(totalRewards);
|
||||
|
||||
// Update the totals section above the table
|
||||
$('#total_premium').text(totalPremium.toFixed(2));
|
||||
$('#total_rewards').text(totalRewards.toFixed(2));
|
||||
$('#total_irda').text(totalIrda.toFixed(2));
|
||||
// $('#total_irda').text(totalIrda.toFixed(2));
|
||||
$('#total_irda').text(totalIrdaAmt.toFixed(2));
|
||||
$('#total_revenue').text(totalRevenue.toFixed(2));
|
||||
// $('#total_revenue').text(totalIrda.toFixed(2));
|
||||
$('#total_billed').text(totalBilled.toFixed(2));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user