CHANGE_BDS
This commit is contained in:
parent
7bc0d3a41c
commit
41ae567a9a
@ -1590,6 +1590,7 @@ class MasterController extends AdminController
|
||||
'status' => true,
|
||||
'cd_ac_pk' => $insert,
|
||||
'data' => $cd_data,
|
||||
'received_data' => $data,
|
||||
'cd_ac_no'=>$data['cd_ac_no'],
|
||||
'message' => 'CD Account number created successfully',
|
||||
"FOR BDS PURPOSE"
|
||||
|
||||
@ -339,7 +339,7 @@ class PolicyTransactionController extends BaseController
|
||||
$data['policy_with_corr'] = 1;
|
||||
}
|
||||
|
||||
$data['is_cd_reduce_from_bds'] = ($data['policy_type_id'] > 7 && $data['client_type'] === 1) ? 1 : 0;
|
||||
$data['is_cd_reduce_from_bds'] = ($data['policy_type_id'] > 7 && $data['client_type'] == 1) ? 1 : 0;
|
||||
|
||||
|
||||
if ($data['ct_type'] == "") {
|
||||
@ -1189,7 +1189,7 @@ class PolicyTransactionController extends BaseController
|
||||
// $data['is_cd_reduce_from_bds'] = 1;
|
||||
// }
|
||||
|
||||
$data['is_cd_reduce_from_bds'] = ($data['policy_type_id'] > 7 && $data['client_type'] === 1) ? 1 : 0;
|
||||
$data['is_cd_reduce_from_bds'] = ($data['policy_type_id'] > 7 && $data['client_type'] == 1) ? 1 : 0;
|
||||
|
||||
|
||||
if (empty($data['data_received_date'])) {
|
||||
|
||||
@ -390,6 +390,24 @@
|
||||
<input id="ref" value="" type="text" class="form-control" name="ref">
|
||||
</div>
|
||||
|
||||
<div class="form-group col-md-3">
|
||||
<label for="addon_policy"> Status <span id="base_danger"class="text-danger">*</span></label>
|
||||
<select class="form-control" id="policy_status" name="status" required>
|
||||
<option value="" selected>Select Status</option>
|
||||
<?php
|
||||
if (isset($policy_status) && count($policy_status)) {
|
||||
foreach ($policy_status as $key => $value) {
|
||||
if($key == 'pending'){
|
||||
echo "<option value=" . $key . " selected>" . $value . "</option>";
|
||||
}else{
|
||||
echo "<option value=" . $key . ">" . $value . "</option>";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="ppteam">PP Team</label>
|
||||
<select class="form-control" id="ppteam" name="ppteam">
|
||||
@ -422,9 +440,9 @@
|
||||
</div> -->
|
||||
|
||||
</div>
|
||||
<hr>
|
||||
<!-- <hr> -->
|
||||
<div class="row">
|
||||
<div class="form-group col-md-3">
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="addon_policy"> Status <span id="base_danger"class="text-danger">*</span></label>
|
||||
<select class="form-control" id="policy_status" name="status" required>
|
||||
<option value="" selected>Select Status</option>
|
||||
@ -440,7 +458,7 @@
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<!-- <div class="form-group col-md-3">
|
||||
<label for="bp_cgst">Latest Action Date</label>
|
||||
@ -1185,14 +1203,13 @@
|
||||
return group;
|
||||
}
|
||||
|
||||
var team_id = [];
|
||||
var role_id = <?php echo get_role_id(); ?>;
|
||||
let isClientFormSubmitting = false;
|
||||
let isVehicleFormSubmitting = false;
|
||||
var insurer_count_array = [];
|
||||
|
||||
var team_id = [];
|
||||
var role_id = <?php echo get_role_id(); ?>;
|
||||
let isClientFormSubmitting = false;
|
||||
let isVehicleFormSubmitting = false;
|
||||
var insurer_count_array = [];
|
||||
|
||||
$(document).ready(function(){
|
||||
$(document).ready(function(){
|
||||
|
||||
document.getElementById('vehicle_form').addEventListener('reset', function(event) {
|
||||
console.log('vehicle_form reset called', event.type);
|
||||
@ -1338,13 +1355,13 @@ $(document).ready(function(){
|
||||
});
|
||||
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
$(document).ready(function(){
|
||||
$(document).ready(function(){
|
||||
getURLParamsForReport();
|
||||
})
|
||||
})
|
||||
|
||||
$(document).ready(function(){
|
||||
$(document).ready(function(){
|
||||
|
||||
$('#vehicle_no').change(function(){
|
||||
|
||||
@ -1643,9 +1660,9 @@ $(document).ready(function(){
|
||||
|
||||
});
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
$(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', function() {
|
||||
$(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', function() {
|
||||
|
||||
// $('[name="base_premium[]"]').val("");
|
||||
// $('[name="co_premium[]"]').val("");
|
||||
@ -1656,9 +1673,9 @@ $(document).on('change', 'input[type="checkbox"][name="co_share_type[]"]', funct
|
||||
toastr.warning('Only one leader can be selected.', 'WARNING!');
|
||||
$(this).prop('checked', false);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('click', '[name="co_share_type[]"]', function() {
|
||||
$(document).on('click', '[name="co_share_type[]"]', function() {
|
||||
|
||||
let val = $(this).val();
|
||||
let uniqueid = $(this).data('id');
|
||||
@ -1678,9 +1695,9 @@ $(document).on('click', '[name="co_share_type[]"]', function() {
|
||||
$('#insurer_id').val(insurer)
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('change', 'select[name="relationship[]"]', function() {
|
||||
$(document).on('change', 'select[name="relationship[]"]', function() {
|
||||
var selectedValues = [];
|
||||
var hasDuplicate = false;
|
||||
var currentSelect = $(this);
|
||||
@ -1714,9 +1731,9 @@ $(document).on('change', 'select[name="relationship[]"]', function() {
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
$(document).ready(function() {
|
||||
|
||||
$(document).on('change', '[name="follow_insurer_id[]"]', function() {
|
||||
|
||||
@ -1737,12 +1754,12 @@ $(document).ready(function() {
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
//edit function
|
||||
function getPolicyTransactionDataForEdit(input) {
|
||||
//edit function
|
||||
function getPolicyTransactionDataForEdit(input) {
|
||||
|
||||
console.log('############################# Get Policy Transaction Data For Edit #############################');
|
||||
|
||||
@ -2073,12 +2090,12 @@ function getPolicyTransactionDataForEdit(input) {
|
||||
|
||||
console.log('############################# END Get Policy Transaction Data For Edit #############################');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
//-------- CALCULATION PART -------------------------------------------------------------------------------------------------
|
||||
//-------- CALCULATION PART -------------------------------------------------------------------------------------------------
|
||||
|
||||
function checkAndDistributeTax(input)
|
||||
{
|
||||
function checkAndDistributeTax(input)
|
||||
{
|
||||
const event = window.event;
|
||||
// console.log("Event type:", event.type);
|
||||
// console.log("Event target:", event.target);
|
||||
@ -2115,9 +2132,9 @@ function checkAndDistributeTax(input)
|
||||
$('#cgst_' + input).val(isFinite($('#cgst_' + input).val()) ? $('#cgst_' + input).val() : 0);
|
||||
$('#sgst_' + input).val(isFinite($('#sgst_' + input).val()) ? $('#sgst_' + input).val() : 0);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function amountCalculation(input) {
|
||||
function amountCalculation(input) {
|
||||
|
||||
console.log('############################## AMOUNT CALCULATION ############################################')
|
||||
console.log('amountCalculation : ' + input);
|
||||
@ -2299,9 +2316,9 @@ function amountCalculation(input) {
|
||||
|
||||
console.log('############################## END AMOUNT CALCULATION ############################################')
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function actualAmountCalculation(input, field = null){
|
||||
function actualAmountCalculation(input, field = null){
|
||||
|
||||
console.log('actualAmountCalculation function called')
|
||||
console.log('actualAmountCalculation function input', input)
|
||||
@ -2512,9 +2529,9 @@ function actualAmountCalculation(input, field = null){
|
||||
|
||||
// console.log('expectedAmount', expectedAmount);
|
||||
console.log('variance', variance);
|
||||
}
|
||||
}
|
||||
|
||||
function co_share_percentage_calculation(input, extra = null){
|
||||
function co_share_percentage_calculation(input, extra = null){
|
||||
|
||||
console.log('input', input)
|
||||
var inputs = $('input[name="co_share_per[]"]'); // Specifically select input elements
|
||||
@ -2671,9 +2688,9 @@ function co_share_percentage_calculation(input, extra = null){
|
||||
// emptyInputs.val(balance_per);
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('change', '[name="base_premium[]"], [name="co_share_per[]"]', function() {
|
||||
$(document).on('change', '[name="base_premium[]"], [name="co_share_per[]"]', function() {
|
||||
|
||||
console.log('Triggered change event.');
|
||||
|
||||
@ -2695,9 +2712,9 @@ $(document).on('change', '[name="base_premium[]"], [name="co_share_per[]"]', fun
|
||||
// Update corresponding co_premium field
|
||||
$('input[name="co_premium[]"]').eq(index).val(coPremium.toFixed(2));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('change', '[name="tp_premium[]"], [name="co_share_per[]"]', function() {
|
||||
$(document).on('change', '[name="tp_premium[]"], [name="co_share_per[]"]', function() {
|
||||
|
||||
console.log('Triggered change event.');
|
||||
|
||||
@ -2719,9 +2736,9 @@ $(document).on('change', '[name="tp_premium[]"], [name="co_share_per[]"]', funct
|
||||
// Update corresponding co_premium field
|
||||
$('input[name="co_tp_premium[]"]').eq(index).val(coPremium.toFixed(2));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('change', '[name="ter_premium[]"], [name="co_share_per[]"]', function() {
|
||||
$(document).on('change', '[name="ter_premium[]"], [name="co_share_per[]"]', function() {
|
||||
|
||||
console.log('Triggered change event.');
|
||||
|
||||
@ -2743,9 +2760,9 @@ $(document).on('change', '[name="ter_premium[]"], [name="co_share_per[]"]', func
|
||||
// Update corresponding co_premium field
|
||||
$('input[name="co_ter_premium[]"]').eq(index).val(coPremium.toFixed(2));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function setCoPremiums(input) {
|
||||
function setCoPremiums(input) {
|
||||
|
||||
let bp = $('input[name="base_premium[]"]').toArray()
|
||||
.map(input => parseFloat($(input).val()) || 0)
|
||||
@ -2779,9 +2796,9 @@ function setCoPremiums(input) {
|
||||
$('#co_premium_' + input).val(cop.toFixed(2));
|
||||
$('#co_tp_premium_' + input).val(cotp.toFixed(2));
|
||||
$('#co_ter_premium_' + input).val(cotep.toFixed(2));
|
||||
}
|
||||
}
|
||||
|
||||
function select_leader_disable_premium_amt(input, value) {
|
||||
function select_leader_disable_premium_amt(input, value) {
|
||||
|
||||
if ($(input).is(':checked')) {
|
||||
// Disable and add readonly-select class to all premiums except the one with the given value
|
||||
@ -2817,9 +2834,9 @@ function select_leader_disable_premium_amt(input, value) {
|
||||
$('input[name="co_ter_premium[]"]').removeClass('readonly-select');
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function select_leader_disable_premium_amt_in_edit() {
|
||||
function select_leader_disable_premium_amt_in_edit() {
|
||||
|
||||
$('#insurerTable thead th').each(function(value) {
|
||||
|
||||
@ -2856,14 +2873,14 @@ function select_leader_disable_premium_amt_in_edit() {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function validateRange(input) {
|
||||
function validateRange(input) {
|
||||
// if (input.value < 1) input.value = 1;
|
||||
if (input.value > 100) input.value = 100;
|
||||
}
|
||||
}
|
||||
|
||||
function setRenewalPolicyData(input) {
|
||||
function setRenewalPolicyData(input) {
|
||||
|
||||
var selectedOption = $(input).find('option:selected');
|
||||
|
||||
@ -2884,9 +2901,9 @@ function setRenewalPolicyData(input) {
|
||||
$('#renewal_policy_start_date').val(policy_start_date);
|
||||
$('#renewal_policy_end_date').val(policy_end_date);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function appendInsured(data = null) {
|
||||
function appendInsured(data = null) {
|
||||
const container = document.getElementById('dynamic-form-container-for-insured');
|
||||
// console.log(container);
|
||||
const newRow = document.createElement('div');
|
||||
@ -2937,9 +2954,9 @@ function appendInsured(data = null) {
|
||||
newRow.querySelector('#emp_id').value = data.id;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeRemoveInsured(element) {
|
||||
function removeRemoveInsured(element) {
|
||||
const container = document.getElementById('dynamic-form-container');
|
||||
const rows = container.querySelectorAll('.insured-dynamic-form-row');
|
||||
|
||||
@ -2947,9 +2964,9 @@ function removeRemoveInsured(element) {
|
||||
const row = element.closest('.insured-dynamic-form-row');
|
||||
row.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function appendOwner(data) {
|
||||
function appendOwner(data) {
|
||||
|
||||
$('#owner').empty();
|
||||
|
||||
@ -2980,9 +2997,9 @@ function appendOwner(data) {
|
||||
$('#owner').append(option);
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function appendOwnerBranch(data) {
|
||||
function appendOwnerBranch(data) {
|
||||
|
||||
$('#owner_branch').empty();
|
||||
|
||||
@ -2999,9 +3016,9 @@ function appendOwnerBranch(data) {
|
||||
});
|
||||
$('#owner_branch').append(option);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function selectListedInsurers(listedInsurers) {
|
||||
function selectListedInsurers(listedInsurers) {
|
||||
listedInsurers = JSON.parse(listedInsurers);
|
||||
// Loop through each insurer-branch combination
|
||||
$.each(listedInsurers, function(index, value) {
|
||||
@ -3014,9 +3031,9 @@ function selectListedInsurers(listedInsurers) {
|
||||
});
|
||||
// Trigger change for plugins (like Select2)
|
||||
$('#listed_insurers').trigger('change');
|
||||
}
|
||||
}
|
||||
|
||||
function checkInvoiceStatusToHideSubmitBtn(id){
|
||||
function checkInvoiceStatusToHideSubmitBtn(id){
|
||||
|
||||
$.ajax({
|
||||
url: '<?php echo base_url('util/checkInvoiceStatus/');?>'+ id,
|
||||
@ -3042,10 +3059,10 @@ function checkInvoiceStatusToHideSubmitBtn(id){
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function getCDAccountNumber(input)
|
||||
{
|
||||
function getCDAccountNumber(input)
|
||||
{
|
||||
console.log('##########################################')
|
||||
console.log('getCDAccountNumber')
|
||||
console.log('##########################################')
|
||||
@ -3118,10 +3135,10 @@ function getCDAccountNumber(input)
|
||||
console.log('client_id', client_id);
|
||||
console.log('insurer_id', insurer_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function appendCDAccountNumber(data, unique_id, new_cd_ac_no = null)
|
||||
{
|
||||
function appendCDAccountNumber(data, unique_id, new_cd_ac_no = null)
|
||||
{
|
||||
console.log('appendCDAccountNumber', data);
|
||||
|
||||
$('#cd_ac_no_'+unique_id).empty();
|
||||
@ -3146,10 +3163,10 @@ function appendCDAccountNumber(data, unique_id, new_cd_ac_no = null)
|
||||
}
|
||||
$('#cd_ac_no_'+unique_id).append(option);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function addCDAccountNumber(input)
|
||||
{
|
||||
function addCDAccountNumber(input)
|
||||
{
|
||||
var val = $(input).val();
|
||||
var uniqueid = $(input).data('count');
|
||||
$('#premium_details_unique_id').val(uniqueid);
|
||||
@ -3198,9 +3215,9 @@ function addCDAccountNumber(input)
|
||||
$('#cd_ac_pk_for_leader').val(val)
|
||||
getCdAmount(val, uniqueid);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function restrictCDACNO(currentSelect){
|
||||
function restrictCDACNO(currentSelect){
|
||||
|
||||
const selectedValue = $(currentSelect).val();
|
||||
|
||||
@ -3209,9 +3226,9 @@ function restrictCDACNO(currentSelect){
|
||||
} else {
|
||||
$('.follow_insurer_cd').prop('disabled', false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeAllColumnsExceptFirst(tableId) {
|
||||
function removeAllColumnsExceptFirst(tableId) {
|
||||
|
||||
console.log('######################################')
|
||||
console.log('removeAllColumnsExceptFirst function called');
|
||||
@ -3234,11 +3251,11 @@ function removeAllColumnsExceptFirst(tableId) {
|
||||
});
|
||||
|
||||
insurerCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
//---------------------------------------------------------------------------------------------------------
|
||||
|
||||
function convertToMySQLDate(dateString) {
|
||||
function convertToMySQLDate(dateString) {
|
||||
|
||||
// console.log('convertToMySQLDate' + dateString);
|
||||
if(dateString !== "" && dateString !== undefined)
|
||||
@ -3250,9 +3267,9 @@ function convertToMySQLDate(dateString) {
|
||||
return `${year}-${month}-${day}`;
|
||||
}
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
function convertMonthYearToMySQLDate(dateString) {
|
||||
function convertMonthYearToMySQLDate(dateString) {
|
||||
console.log('convertMonthYearToMySQLDate: ' + dateString);
|
||||
|
||||
if(dateString !== "" && dateString !== undefined) {
|
||||
@ -3275,9 +3292,9 @@ function convertMonthYearToMySQLDate(dateString) {
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
}
|
||||
|
||||
$("#inception_form_id").submit(function(event) {
|
||||
$("#inception_form_id").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
@ -3443,9 +3460,9 @@ $("#inception_form_id").submit(function(event) {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$("#vehicle_form").submit(function(event) {
|
||||
$("#vehicle_form").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
@ -3527,9 +3544,9 @@ $("#vehicle_form").submit(function(event) {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$("#CDMasterForm").submit(function(event) {
|
||||
$("#CDMasterForm").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
@ -3569,13 +3586,16 @@ $("#CDMasterForm").submit(function(event) {
|
||||
contentType: false,
|
||||
success: function(res) {
|
||||
|
||||
console.log("CD FORM SUBMIT RESPONSE : ", res);
|
||||
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
|
||||
if(res.status == true){
|
||||
appendCDAccountNumber(res.data, unique_id, res.cd_ac_pk)
|
||||
$('#cd_ac_pk_for_leader').val(res.id)
|
||||
$('#cd_current_balance_'+unique_id).val(res.opening_bal);
|
||||
appendCDAccountNumber(res.data, unique_id, res.cd_ac_pk);
|
||||
$('#cd_ac_pk_for_leader').val(res.cd_ac_pk)
|
||||
console.log('cd_current_balance instance', $('#cd_current_balance_'+unique_id))
|
||||
$('#cd_current_balance_'+unique_id).val(res.received_data.opening_bal);
|
||||
|
||||
toastr.success(res.message, 'Success');
|
||||
}else{
|
||||
@ -3592,11 +3612,11 @@ $("#CDMasterForm").submit(function(event) {
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
$('#cop_yes').change(function() {
|
||||
$('#cop_yes').change(function() {
|
||||
|
||||
if ($(this).is(':checked')) {
|
||||
$('#add_more_row').removeClass('d-none');
|
||||
@ -3645,9 +3665,9 @@ $('#cop_yes').change(function() {
|
||||
// console.log('Input cleared:', $(this).attr('name')); // Log cleared input
|
||||
// });
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#client_type').change(function() {
|
||||
$('#client_type').change(function() {
|
||||
|
||||
let policy_type_id = $('#policy_type_id').val();
|
||||
console.log("client_policy_type_id", policy_type_id);
|
||||
@ -3742,9 +3762,9 @@ $('#client_type').change(function() {
|
||||
$('[name="standard_bp[]"]').val(std_bp);
|
||||
$('[name="standard_tp[]"]').val(std_tp);
|
||||
$('[name="standard_ter[]"]').val(std_tep);
|
||||
});
|
||||
});
|
||||
|
||||
$('#same_as_proposer').change(function() {
|
||||
$('#same_as_proposer').change(function() {
|
||||
var client_type = $('#client_type').val()
|
||||
var policy_type = $('#policy_type_id').val()
|
||||
if ($(this).is(':checked')) {
|
||||
@ -3759,9 +3779,9 @@ $('#same_as_proposer').change(function() {
|
||||
$('#family_details').hide();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#client_type').on('change', function() {
|
||||
$('#client_type').on('change', function() {
|
||||
var selectedClientType = $(this).val();
|
||||
|
||||
// console.log('selectedClientType', selectedClientType);
|
||||
@ -3800,9 +3820,9 @@ $('#client_type').on('change', function() {
|
||||
|
||||
// Initialize or refresh Select2 for both dropdowns
|
||||
$('#client_id').select2();
|
||||
});
|
||||
});
|
||||
|
||||
$('#Owner_type').on('change', function() {
|
||||
$('#Owner_type').on('change', function() {
|
||||
|
||||
var selectedClientType = $(this).val();
|
||||
|
||||
@ -3867,9 +3887,9 @@ $('#Owner_type').on('change', function() {
|
||||
|
||||
// Initialize or refresh Select2 for both dropdowns
|
||||
$('#owner').select2();
|
||||
});
|
||||
});
|
||||
|
||||
$('#policy_status').change(function(){
|
||||
$('#policy_status').change(function(){
|
||||
|
||||
var pt_id = $('#policy_tranction_primarykey').val();
|
||||
var status = $(this).val()
|
||||
@ -3930,9 +3950,9 @@ $('#policy_status').change(function(){
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
$('#policy_no').change(function(){
|
||||
$('#policy_no').change(function(){
|
||||
|
||||
var policy_no = $(this).val();
|
||||
policy_no = policy_no.trim();
|
||||
@ -3997,24 +4017,24 @@ $('#policy_no').change(function(){
|
||||
$('#tpa').val('').select2();
|
||||
console.log("This is new policy Could not get policy data")
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('.close').on('click', function(){
|
||||
$('#client_form')[0].reset();
|
||||
$('#vehicle_form')[0].reset();
|
||||
$('.close').on('click', function(){
|
||||
// $('#client_form')[0].reset();
|
||||
// $('#vehicle_form')[0].reset();
|
||||
$('#CDMasterForm')[0].reset();
|
||||
});
|
||||
});
|
||||
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------------------------------------
|
||||
|
||||
var insurerCount = 0;
|
||||
var insurerCount = 0;
|
||||
|
||||
$('#setInsurerCount').on('click', function() {
|
||||
$('#setInsurerCount').on('click', function() {
|
||||
addInsurerColumn();
|
||||
getColumnIndexes(1);
|
||||
});
|
||||
});
|
||||
|
||||
function addInsurerColumn() {
|
||||
function addInsurerColumn() {
|
||||
|
||||
insurerCount = insurerCount + 1;
|
||||
|
||||
@ -4375,9 +4395,9 @@ function addInsurerColumn() {
|
||||
// });
|
||||
|
||||
co_share_percentage_calculation(insurerCount, "add");
|
||||
}
|
||||
}
|
||||
|
||||
function removeInsurerColumn(index, count_index) {
|
||||
function removeInsurerColumn(index, count_index) {
|
||||
|
||||
console.log('#################################### Remove Insurer Column ####################################');
|
||||
|
||||
@ -4408,9 +4428,9 @@ function removeInsurerColumn(index, count_index) {
|
||||
|
||||
console.log('#################################### END Remove Insurer Column ####################################');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function populateTable(dataArray, cd_ac_pk) {
|
||||
function populateTable(dataArray, cd_ac_pk) {
|
||||
|
||||
console.log('#################################### Populate Table ####################################');
|
||||
|
||||
@ -4456,12 +4476,12 @@ function populateTable(dataArray, cd_ac_pk) {
|
||||
var selectElement = cell.find('select');
|
||||
console.log('selectElement', selectElement);
|
||||
selectElement.val(cd_ac_pk).prop('selected', true);
|
||||
selectElement.toggleClass('readonly-select', !!disable_td)
|
||||
selectElement.toggleClass('readonly-select', !!disable_td);
|
||||
setTimeout(function(){
|
||||
console.log('selectElement setTimeout', selectElement);
|
||||
selectElement.find('option[value="' + cd_ac_pk + '"]').prop('selected', true);
|
||||
selectElement.toggleClass('readonly-select', !!disable_td)
|
||||
}, 2000)
|
||||
}, 2000);
|
||||
break;
|
||||
case 3: // CD AMOUNT
|
||||
console.log('------- CD AMOUNT -------')
|
||||
@ -4677,18 +4697,18 @@ function populateTable(dataArray, cd_ac_pk) {
|
||||
|
||||
console.log('#################################### END Populate Table ####################################');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$(document).on('click', '.delete-insurer', function() {
|
||||
$(document).on('click', '.delete-insurer', function() {
|
||||
const index = $(this).closest('th').index();
|
||||
const count_index = $(this).data('count') || $(this).attr('data-count'); // Ensure data attribute is retrieved
|
||||
removeInsurerColumn(index, count_index);
|
||||
getColumnIndexes(1); // Remove setTimeout unless necessary
|
||||
});
|
||||
});
|
||||
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
//-----------------------------------------------------------------------------------------------------------
|
||||
|
||||
function getURLParamsForReport() {
|
||||
function getURLParamsForReport() {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const pt_id = params.get('pt_id') ?? 0;
|
||||
|
||||
@ -4702,9 +4722,9 @@ function getURLParamsForReport() {
|
||||
}
|
||||
|
||||
console.log('getURLParamsForReport pt_id', pt_id); // Retain the log if necessary
|
||||
}
|
||||
}
|
||||
|
||||
function validateInput(input, table, field){
|
||||
function validateInput(input, table, field){
|
||||
|
||||
let value = $(input).val();
|
||||
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
|
||||
@ -4721,9 +4741,9 @@ function validateInput(input, table, field){
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function saveFormDataToLocalStorage(formSelector, storageKey) {
|
||||
function saveFormDataToLocalStorage(formSelector, storageKey) {
|
||||
// Initialize an empty object to store form data
|
||||
let formData = {};
|
||||
|
||||
@ -4745,9 +4765,9 @@ function saveFormDataToLocalStorage(formSelector, storageKey) {
|
||||
localStorage.setItem(storageKey, JSON.stringify(formData));
|
||||
|
||||
console.log("Form data saved to local storage:", formData);
|
||||
}
|
||||
}
|
||||
|
||||
function setFormDataFromLocalStorage(formSelector, storageKey) {
|
||||
function setFormDataFromLocalStorage(formSelector, storageKey) {
|
||||
// Retrieve the saved form data from localStorage
|
||||
let savedData = JSON.parse(localStorage.getItem(storageKey));
|
||||
|
||||
@ -4767,9 +4787,9 @@ function setFormDataFromLocalStorage(formSelector, storageKey) {
|
||||
});
|
||||
|
||||
console.log("Form data loaded from local storage:", savedData);
|
||||
}
|
||||
}
|
||||
|
||||
function checkCDAmountForBasePremium(input) {
|
||||
function checkCDAmountForBasePremium(input) {
|
||||
|
||||
console.log('#################################### Check CD Amount For Base Premium ####################################');
|
||||
|
||||
@ -4860,9 +4880,9 @@ function checkCDAmountForBasePremium(input) {
|
||||
|
||||
console.log('#################################### END Check CD Amount For Base Premium ####################################');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function getCdAmount(cd_ac_pk, increment){
|
||||
function getCdAmount(cd_ac_pk, increment){
|
||||
|
||||
console.log('#################################### Get CD Amount ####################################');
|
||||
|
||||
@ -4900,9 +4920,9 @@ function getCdAmount(cd_ac_pk, increment){
|
||||
|
||||
console.log('#################################### END Get CD Amount ####################################');
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$('#bro_payable_by').on('change', function(){
|
||||
$('#bro_payable_by').on('change', function(){
|
||||
|
||||
var columnIndexes = [];
|
||||
$('#insurerTable thead th').each(function(index) {
|
||||
@ -4913,14 +4933,14 @@ $('#bro_payable_by').on('change', function(){
|
||||
}
|
||||
columnIndexes.push(index);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
$(document).on('change', '#insurerTable input, #insurerTable select, #insurerTable textarea', function() {
|
||||
$(document).on('change', '#insurerTable input, #insurerTable select, #insurerTable textarea', function() {
|
||||
// console.log('Changed in table:', $(this).attr('name'), 'Value:', $(this).val());
|
||||
getColumnIndexes()
|
||||
});
|
||||
});
|
||||
|
||||
function getColumnIndexes(count = 0) {
|
||||
function getColumnIndexes(count = 0) {
|
||||
$('#insurerTable thead th').each(function(index) {
|
||||
if (index === 0) {
|
||||
console.log("Premium Table columnIndexes is", index);
|
||||
@ -4932,9 +4952,9 @@ function getColumnIndexes(count = 0) {
|
||||
co_share_percentage_calculation(index);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$('#new_vehicle_switch').change(function () {
|
||||
$('#new_vehicle_switch').change(function () {
|
||||
if ($(this).is(':checked')) {
|
||||
$('#modal_vehicle_no').prop('required', false);
|
||||
$('label[for="modal_vehicle_no"] span.text-danger').remove(); // Remove the asterisk
|
||||
@ -4945,12 +4965,12 @@ $('#new_vehicle_switch').change(function () {
|
||||
$('label[for="modal_vehicle_no"]').append('<span class="text-danger">*</span>');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
// ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
function toggleClient(input) {
|
||||
function toggleClient(input) {
|
||||
let btn = $("#vehicle_client_btn");
|
||||
let client_type = $('#client_type').val();
|
||||
|
||||
@ -5015,18 +5035,18 @@ function toggleClient(input) {
|
||||
$('#owner').select2();
|
||||
$('#owner_branch').select2();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function removeVehicleForm(){
|
||||
function removeVehicleForm(){
|
||||
$('#vehicle_row_div').empty();
|
||||
$('#actcual_clients').show();
|
||||
}
|
||||
}
|
||||
|
||||
function removeClientForm(){
|
||||
function removeClientForm(){
|
||||
$('#client_row_div').empty();
|
||||
}
|
||||
}
|
||||
|
||||
function getVehicleFormData() {
|
||||
function getVehicleFormData() {
|
||||
|
||||
console.log("🔹 Collecting Vehicle Form Data...");
|
||||
let vhno = $('#modal_vehicle_no').val();
|
||||
@ -5102,9 +5122,9 @@ function getVehicleFormData() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getClientFormData() {
|
||||
function getClientFormData() {
|
||||
|
||||
let client_type = $('#client_type').val();
|
||||
console.log("🔹 Collecting Client Form Data...");
|
||||
@ -5163,9 +5183,9 @@ function getClientFormData() {
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function appendVehicleForm(){
|
||||
function appendVehicleForm(){
|
||||
$('#vehicle_row_div').empty();
|
||||
|
||||
let html = `
|
||||
@ -5387,9 +5407,9 @@ function appendVehicleForm(){
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function appendClientForm(){
|
||||
function appendClientForm(){
|
||||
let client_type = $('#client_type').val();
|
||||
$('#client_row_div').empty();
|
||||
|
||||
@ -5470,9 +5490,9 @@ function appendClientForm(){
|
||||
$(".individual_client").find("select, input, textarea").val("").prop("required", true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function validateInputForClient(input, table, field) {
|
||||
function validateInputForClient(input, table, field) {
|
||||
|
||||
let owner_type = $('#Owner_type').val();
|
||||
let client_type = $('#client_type').val();
|
||||
@ -5509,9 +5529,9 @@ function validateInputForClient(input, table, field) {
|
||||
});
|
||||
|
||||
$('#hide_smbt_btn button').prop('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
$('#client_type').on('change', function() {
|
||||
$('#client_type').on('change', function() {
|
||||
|
||||
let client_type = $(this).val();
|
||||
|
||||
@ -5527,6 +5547,6 @@ $('#client_type').on('change', function() {
|
||||
$(".individual_client").find("select, input, textarea").val("").prop("required", true);
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
Loading…
Reference in New Issue
Block a user