FIX_BDS_ENDORSEMENT_EDIT

This commit is contained in:
VENKATESHWARAN 2025-10-24 12:01:36 +05:30
parent f0beaa720b
commit a48e6c0793
3 changed files with 42 additions and 12 deletions

View File

@ -1271,9 +1271,10 @@ class PolicyTransactionController extends BaseController
$data['tsi'] = generate_tsi_code($issue_type['issue_type'] ?? 1);
$client_branch_id = $data['client_branch_id'];
if ($data['client_branch_id'] == "") {
if (!isset($data['client_branch_id']) || $data['client_branch_id'] == "") {
$client_branch_id = $issue_type['client_branch_id'];
}else{
$client_branch_id = $data['client_branch_id'];
}
$data['is_cd_reduce_from_bds'] = (isset($issue_type['policy_type_id']) && $issue_type['policy_type_id'] > 7 && $data['client_type'] == 1) ? 1 : 0;
@ -1431,7 +1432,11 @@ class PolicyTransactionController extends BaseController
$pt_id = null;
if(!empty($data)){
$inception_data = $this->policyTransactionModel->where('policy_no', $data['policy_no'])->where('client_id', $data['client_id'])->first();
$inception_data = $this->policyTransactionModel
->where('policy_no', $data['policy_no'])
->where('client_id', $data['client_id'])
->where('action_type', 'inception')
->first();
$pt_id = $inception_data['id'];
}

View File

@ -868,7 +868,6 @@
$('.branchdiv').show();
$('#table_tr_34').show();
$('#table_tr_37').show();
}
console.log('selectedClientType', selectedClientType);
@ -895,10 +894,12 @@
}
$('#client_policy_id').empty().append($('<option>', {
value: '',
text: 'Select Policy'
}))
if(selectedClientType == 1){
$('#client_policy_id').empty().append($('<option>', {
value: '',
text: 'Select Policy'
}));
}
// Initialize or refresh Select2 for both dropdowns
$('#client_id').select2();
@ -975,8 +976,8 @@
}
$('#policy_tranction_primarykey').val(res.data.id);
$('#client_type').val(res.data.client_type).trigger('change');
$('#client_id').val(res.data.client_id).change();
$('#client_type').val(res.data.client_type);
$('#base_cd_amount').val(res.data.base_cd_amount);
var tpaValue = '';
@ -985,13 +986,22 @@
}
$('#tpa').val(tpaValue).change();
setTimeout(function(){
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
$('#client_branch_id').val(res.data.client_branch_id).change();
$('#client_policy_id').val(res.pt_id).select2();
$('#client_branch_id').val(res.data.client_branch_id).select2();
// $('#client_policy_id').val(res.pt_id).select2();
}, 1000)
if(res.data.client_type == 2){
let data1 = policyListByClient[res.data.client_id];
appendPolicies(data1, res.pt_id);
}else{
let data2 = policy_list[res.data.client_branch_id];
appendPolicies(data2, res.pt_id);
}
setTimeout(function(){
$('#policy_start_date').val(res.data.policy_start_date);
$('#policy_end_date').val(res.data.policy_end_date);
@ -1042,6 +1052,16 @@
addInsurerColumn();
}
if (res.data.client_type == 2) {
$('.branchdiv').hide();
$('#table_tr_34').hide();
$('#table_tr_37').hide();
} else {
$('.branchdiv').show();
$('#table_tr_34').show();
$('#table_tr_37').show();
}
// if(res.data.policy_type_id == 1 || res.data.policy_type_id == 2 || res.data.policy_type_id == 3 || res.data.policy_type_id == 4 || res.data.policy_type_id == 5 || res.data.policy_type_id == 6 || res.data.policy_type_id == 7){
// $('#is_cd_reduce_from_bds').prop('disabled',true).prop('checked', false);
// }else{

View File

@ -692,7 +692,7 @@ table.dataTable thead th {
});
}
function appendPolicies(data) {
function appendPolicies(data, policy_id=null) {
if (!data) {
toastr.warning("There are no policies in Inception for the selected client and branch.");
@ -724,6 +724,11 @@ table.dataTable thead th {
'data-tpa': item.tpa_branch_id + '-' + item.tpa_id,
'data-ptid': item.policy_type_id,
});
if (policy_id == item.id) {
option.attr('selected', true);
}
$('#client_policy_id').append(option);
});
}