Merge branch 'dev' of bitbucket.org:jubilian/nhance into dev

This commit is contained in:
Gowtham M 2025-12-16 17:38:33 +05:30
commit dc3075a383
11 changed files with 478 additions and 197 deletions

View File

@ -726,7 +726,7 @@ class ClientController extends AdminController
if ($requestFrom == 'rest') {
return $data;
}
// print_rr($data);die();
// Load the view for the new list page;
echo view('layout/header', $headerData);
echo view('view_deposit', $data);
@ -741,12 +741,14 @@ class ClientController extends AdminController
$client_id = $this->request->getPost('client_id');
$insurer_id = $this->request->getPost('insurer_id');
$record_date = $this->request->getPost('record_date');
$cd_ac_pk = $this->request->getPost('cd_ac_pk');
$cd_ac_no = $this->request->getPost('cd_ac_no');
$CD_Account_Number = $this->CDMasterModel
->where('client_id', $client_id)
->where('insurer_id', $insurer_id)
->where('is_active', 1)
->first();
// $CD_Account_Number = $this->CDMasterModel
// ->where('client_id', $client_id)
// ->where('insurer_id', $insurer_id)
// ->where('is_active', 1)
// ->first();
if (!empty($record_date)) {
@ -762,8 +764,8 @@ class ClientController extends AdminController
'sub_type_id' => $this->request->getPost('sub_type_id'),
'client_id' => $this->request->getPost('client_id'),
'client_policy_id' => null,
'cd_ac_no' => $CD_Account_Number['cd_ac_no'] ?? null,
'cd_ac_pk' => $CD_Account_Number['id'] ?? null,
'cd_ac_no' => $cd_ac_no ?? null,
'cd_ac_pk' => $cd_ac_pk ?? null,
'endorsement_no' => null,
'insurer_id' => $this->request->getPost('insurer_id'),
'description' => $this->request->getPost('description'),
@ -1099,6 +1101,8 @@ class ClientController extends AdminController
$kyc_id = $this->request->getPost('id');
$client_id = $this->request->getPost('client_id');
// echo "KID".$kyc_id;
// echo "CID".$client_id;
if (empty($kyc_id)) {
return $this->respond(['status' => false, 'code' => 400, 'message' => 'Missing document ID.'], 200);
@ -1107,7 +1111,7 @@ class ClientController extends AdminController
$updateData['is_active'] = $this->request->getPost('is_active');
$delete = $this->clientKYCDocsModel->update($kyc_id, $updateData);
// $delete = 1;
if ($delete) {
$html = $this->generateKycSingleTable($client_id);
$dropdown = $this->fetch_dropdown($client_id);

View File

@ -5022,7 +5022,7 @@ class EmpDataServiceController extends BaseController
$processedCount++;
// Send batch emails or handle single email
if ($count == 20 || $processedCount == count($ids)) {
if ($count == 20 || $processedCount == count($emp_details)) {
if (!empty($wholeData)) {
if ($single_mail == 1) {
$this->myLogger->logme('error', 'sendMailForDownloadingECard - Sending single mail');
@ -5035,7 +5035,12 @@ class EmpDataServiceController extends BaseController
$wholeData = [];
$count = 0;
}
}else{
$this->myLogger->logme('error', 'sendMailForDownloadingECard - Whole mail data is empty');
}
}else{
$idscount = count($ids);
$this->myLogger->logme('error', "sendMailForDownloadingECard - processedCount not equal to ids count, processedCount : {$processedCount} and ids count : {$idscount}");
}
}
@ -5048,9 +5053,19 @@ class EmpDataServiceController extends BaseController
return ['status' => false , 'message' => 'Employee Data not found'];
}
} catch (\Exception $e) {
$this->myLogger->logme('error', 'sendMailForDownloadingECard - Exception occurred: {message}', ['message' => $e->getMessage()]);
return ['status' => false , 'message' => 'Exception occurred' . $e->getMessage()];
} catch (\Exception $th) {
$errorData = [
'message' => $th->getMessage(),
'file' => $th->getFile(),
'line' => $th->getLine(),
'code' => $th->getCode(),
'trace' => $th->getTraceAsString(),
'trace_array' => $th->getTrace(), // full array version (optional)
'function' => $th->getTrace()[0]['function'] ?? null,
'class' => $th->getTrace()[0]['class'] ?? null,
];
$this->myLogger->logme('error', 'sendMailForDownloadingECard - Exception occurred: {message}', ['message' => $th->getMessage()]);
return ['status' => false , 'message' => 'Exception occurred' . $th->getMessage(), 'error_data' => $errorData];
}
}

View File

@ -3608,9 +3608,9 @@ class EmployeeRestController extends AdminController
cl_rm.user_id as acm_id,
cp.insurer_id as insurer_id,
cp.tpa_id as tpa_id,
emp.client_id ,
emp.client_id,
emp.id as emp_id,
emp_pol.uhid as policy_no,
cp.policy_no,
emp.emp_code,
emp_pol.tpa_id as tpa_no,
emp.name as emp_name,
@ -4408,7 +4408,8 @@ class EmployeeRestController extends AdminController
{
$client = \Config\Services::curlrequest();
$url = env('PRE_ENROLLMENT_BASEURL') . $endPoint;
$response = $client->post($url, ['json' => $postData, 'http_errors' => false]);
$headers = [ 'App-Signature' => getenv('APP_SIGNATURE') ];
$response = $client->post($url, ['json' => $postData,'headers' => $headers,'http_errors' => false]);
// return json_decode($response->getBody(), true);
return $response->getBody();
}

View File

@ -297,7 +297,8 @@ class PayoutController extends BaseController
'agent_id' => $json['agent_id'],
'invoice_date' => $json['invoice_date'],
'invoice_amount' => $json['invoice_amount'],
'payout_status' => 1
'payout_status' => 1,
'broker_id' => 1
];
$invoiceId = $this->invoiceModel->insert($invoiceData);
@ -438,7 +439,7 @@ class PayoutController extends BaseController
$agentCode = $agent["agent_code"];
$today = date("Ymd");
$likePattern = "INV/$agentCode/$today/%";
$likePattern = "NIIB/$agentCode/$today/%";
$count = $this->invoiceModel
->like("invoice_no", $likePattern)
@ -446,7 +447,7 @@ class PayoutController extends BaseController
$nextNumber = $count + 1;
return "INV/$agentCode/$today/$nextNumber";
return "NIIB/$agentCode/$today/$nextNumber";
}
// private function generateInvoiceNumber()

View File

@ -1917,6 +1917,7 @@
$data['client_kyc_primary_table'] = $clientController->generateKycPrimaryTable($data['client_id']);
$data['client_kyc_other_table'] = $clientController->generateKycOthersTable($data['client_id']);
$data['client_kyc_single_table'] = $clientController->generateKycSingleTable($data['client_id']);
$data['client_kyc_dd_data'] = $clientController->fetch_dropdown($data['client_id']);
$data['vehicle_docs'] = $this->clientKYCDocsModel
->where('client_id', $data['client_id'])

View File

@ -10,7 +10,7 @@ class CommissionApiFilter implements FilterInterface
{
public function before(RequestInterface $request, $arguments = null)
{
// return null;
return null;
// Read API key from header
$authHeader = $request->getHeaderLine('AUTHORIZATION');
if(empty($authHeader))

View File

@ -23,6 +23,7 @@ class InvoiceModel extends Model
'created_by',
'updated_at',
'payout_status',
'broker_id'
];
// Timestamps
@ -107,7 +108,8 @@ class InvoiceModel extends Model
partner_agent.name as agent_name
")
->join('partner_agent', 'partner_invoice.agent_id = partner_agent.id')
->where('partner_invoice.is_active', 1);
->where('partner_invoice.is_active', 1)
->where('partner_invoice.broker_id', 1);
if(!empty($agent_id)){
$data->where('partner_invoice.agent_id', $agent_id);
@ -218,7 +220,8 @@ class InvoiceModel extends Model
if ($flag == 1) { // Add mode
// EXCLUDE all policies that exist in partner_invoice_items
$builder->where("pt.id NOT IN (SELECT policy_id FROM partner_invoice_items)", null, false);
$builder->where("pp.id NOT IN (SELECT policy_id FROM partner_invoice_items)", null, false);
$builder->where("pt.policy_no NOT IN (SELECT policy_no FROM partner_invoice_items)", null, false);
}
if ($flag == 2) { // Edit mode

View File

@ -35,7 +35,7 @@
<div class="form-group col-md-3 file-input-group">
<label for="file_input">Browser File<span class="text-danger">*</span></label>
<input type="file" class="form-control file-input" id="kyc_docs_file" name="file_name" required accept=".pdf, .jpeg, .jpg, .png"
<input type="file" class="form-control file-input" id="kyc_docs_file" name="file_name" required
style="box-shadow: none !important; outline: none !important; border: none; height: unset !important;padding: 0px !important;background: transparent !important;">
</div>
@ -318,5 +318,29 @@
});
}
// Centralized Validation Function
function validateFile(fileInput) {
var file = fileInput.files[0];
if (!file) {
return true; // No file selected, considered valid or neutral
}
var type = file.type;
// Check if the type is PDF or starts with 'image/'
if (type === 'application/pdf' || type.startsWith('image/')) {
return true; // Valid
}
// Invalid format
toastr.warning('Invalid file format. Only PDF or Image files are allowed.', 'WARNING!');
$(fileInput).val(''); // clear file
return false; // Invalid
}
// Attach the centralized handler to BOTH classes
$(document).on('change', '.file-input, .edit_file-input', function () {
validateFile(this);
});
</script>

View File

@ -24,6 +24,7 @@
<a class="mdi mdi-delete mr-1 btn-delete-kyc"
data-id="<?= $value['id'] ?>"
data-client_id="<?= $value['client_id'] ?>"
style="font-size:18px;"></a>
</td>
</tr>
@ -45,7 +46,7 @@
<input type="file"
name="file_name"
id="kyc_docs_file_<?= $value['id'] ?>"
class="form-control"
class="form-control edit-file-input"
style="box-shadow:none!important; outline:none!important; border:none; height:unset!important;padding: 0px !important;background: transparent !important;">
</div>

View File

@ -1702,7 +1702,7 @@
$('#follower_policy_no_' + uniqueid).prop('readonly', false);
$('#calc_policy_issue_date_1').val(policy_issue_date).addClass('readonly-select');
}
});
$(document).on('change', 'select[name="relationship[]"]', function() {
@ -2612,141 +2612,203 @@
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
console.log('Number of inputs:', inputs.length);
// console.log('input', input)
// var inputs = $('input[name="co_share_per[]"]'); // Specifically select input elements
// console.log('Number of inputs:', inputs.length);
let insurer_count = insurer_count_array.length;
console.log('insurer_count', insurer_count);
console.log('insurer_count_array', insurer_count_array);
// let insurer_count = insurer_count_array.length;
// console.log('insurer_count', insurer_count);
// console.log('insurer_count_array', insurer_count_array);
if(input){
if(insurer_count == 2){
// if ($('#cop_yes').is(':checked')) {
// console.log('cop_yes checked', $('#cop_yes').is(':checked'));
// if(input){
// if(insurer_count == 2){
// Find the index of the value
let index = insurer_count_array.indexOf(Number(input));
let second_value_index = "";
// // Find the index of the value
// let index = insurer_count_array.indexOf(Number(input));
// let second_value_index = "";
if (index !== -1) {
// if (index !== -1) {
console.log(`Value ${input} exists at index ${index}.`);
// console.log(`Value ${input} exists at index ${index}.`);
let beforeValue = index > 0 ? insurer_count_array[index - 1] : null;
let afterValue = index < insurer_count_array.length - 1 ? insurer_count_array[index + 1] : null;
// let beforeValue = index > 0 ? insurer_count_array[index - 1] : null;
// let afterValue = index < insurer_count_array.length - 1 ? insurer_count_array[index + 1] : null;
if (beforeValue != null) {
second_value_index = beforeValue;
} else if (afterValue != null) {
second_value_index = afterValue;
}
// if (beforeValue != null) {
// second_value_index = beforeValue;
// } else if (afterValue != null) {
// second_value_index = afterValue;
// }
}
// }
let value1 = $('#co_share_per_' + input).val();
let value2 = $('#co_share_per_' + second_value_index).val();
// let value1 = $('#co_share_per_' + input).val();
// let value2 = $('#co_share_per_' + second_value_index).val();
value1 = Number(value1);
value2 = Number(value2);
// value1 = Number(value1);
// value2 = Number(value2);
console.log('value1', value1);
console.log('value2', value2);
// console.log('value1', value1);
// console.log('value2', value2);
if(extra == "add"){
// if(extra == "add"){
if(value2 == 0){
value1 = 50;
value2 = 50;
}else{
if(value2 == 100){
value1 = 50;
value2 = 50;
}else{
value1 = 100 - value2;
}
}
// if(value2 == 0){
// value1 = 50;
// value2 = 50;
// }else{
// if(value2 == 100){
// value1 = 50;
// value2 = 50;
// }else{
// value1 = 100 - value2;
// }
// }
}else{
// }else{
if(value1 == 100){
value2 = 0;
}else{
value2 = 100 - value1;
}
}
// if(value1 == 100){
// value2 = 0;
// }else{
// value2 = 100 - value1;
// }
// }
console.log('value1', value1);
console.log('value2', value2);
// console.log('value1', value1);
// console.log('value2', value2);
$('#co_share_per_' + input).val(value1);
$('#co_share_per_' + second_value_index).val(value2);
// $('#co_share_per_' + input).val(value1);
// $('#co_share_per_' + second_value_index).val(value2);
}else if(insurer_count > 2){
// }else if(insurer_count > 2){
let total_val = 0;
// let total_val = 0;
// Calculate the total sum of input values
inputs.each(function () {
let val = Number($(this).val()) || 0;
if(val == 0){
$(this).val(0)
}
total_val += val;
});
// // Calculate the total sum of input values
// inputs.each(function () {
// let val = Number($(this).val()) || 0;
// if(val == 0){
// $(this).val(0)
// }
// total_val += val;
// });
// if (total_val < 100) {
// let remaining_val = 100 - total_val; // Calculate the remaining value
// // if (total_val < 100) {
// // let remaining_val = 100 - total_val; // Calculate the remaining value
// // Assign the remaining value to the first empty input
// let assigned = false;
// inputs.each(function () {
// let current_val = Number($(this).val()) || 0;
// if (current_val === 0 && !assigned) { // Assign only once
// $(this).val(remaining_val);
// assigned = true;
// } else if (current_val === 0) {
// $(this).val(0); // Set other empty inputs to 0
// }
// });
// } else if (total_val > 100) {
// toastr.warning('Sum of the co-share is greater than 100');
// }
// // // Assign the remaining value to the first empty input
// // let assigned = false;
// // inputs.each(function () {
// // let current_val = Number($(this).val()) || 0;
// // if (current_val === 0 && !assigned) { // Assign only once
// // $(this).val(remaining_val);
// // assigned = true;
// // } else if (current_val === 0) {
// // $(this).val(0); // Set other empty inputs to 0
// // }
// // });
// // } else if (total_val > 100) {
// // toastr.warning('Sum of the co-share is greater than 100');
// // }
}
}else{
inputs.each(function (index) {
if (inputs.length === 1) {
$(this).val(100);
} else if(inputs.length === 2) {
let first = $('#co_share_per_1').val();
first = Number(first)
let second_val = 100 - first;
// }
// }else{
// inputs.each(function (index) {
// if (inputs.length === 1) {
// $(this).val(100);
// } else if(inputs.length === 2) {
// let first = $('#co_share_per_1').val();
// first = Number(first)
// let second_val = 100 - first;
if (index === 1) {
$(this).val(second_val);
}
}
});
// if (index === 1) {
// $(this).val(second_val);
// }
// }
// });
}
// }
// }
let val_sum = 0;
// let val_sum = 0;
inputs.each(function () {
let val = Number($(this).val()) || 0;
val_sum += val;
});
// inputs.each(function () {
// let val = Number($(this).val()) || 0;
// val_sum += val;
// });
if (val_sum > 100) {
toastr.warning('Sum of the co-share is greater than 100', 'WARNING');
}
// if ($('#cop_yes').is(':checked')) {
// if (val_sum > 100) {
// toastr.warning('Sum of the co-share is greater than 100', 'WARNING');
// }
// }
// }
function co_share_percentage_calculation(changedEl = null) {
let inputs = $('input[name="co_share_per[]"]');
let count = inputs.length;
let copChecked = $('#cop_yes').is(':checked');
/* =========================
COP UNCHECKED
========================= */
if (!copChecked) {
inputs.val('');
return;
}
/* =========================
AUTO MODE (default / fetch / add / remove)
========================= */
if (changedEl === null) {
// Single card → empty (means 100)
if (count === 1) {
inputs.val('');
return;
}
// Multiple cards → auto split
let split = (100 / count).toFixed(2);
inputs.val(split);
return;
}
/* =========================
USER MODE (manual edit)
========================= */
let sum = 0;
let userTouched = false;
inputs.each(function () {
let v = $(this).val();
if (v !== '') {
userTouched = true;
sum += Number(v) || 0;
}
});
// Show warning ONLY if user changed something
if (userTouched && sum > 100) {
toastr.warning(
'Sum of the co-share is greater than 100',
'WARNING'
);
}
}
$(document).on('change', '[name="base_premium"], [name="co_share_per[]"]', function() {
console.log('Triggered change event.');
console.log('Triggered change event. base_premium');
// Get the first non-empty base premium value
// let basePremium = $('input[name="base_premium[]"]').toArray()
@ -3276,7 +3338,7 @@
});
}
function addCDAccountNumber(input)
function addCDAccountNumber_old(input)
{
var val = $(input).val();
var uniqueid = $(input).data('count');
@ -3328,6 +3390,93 @@
}
}
function addCDAccountNumber(input)
{
var $input = $(input);
var val = $input.val();
var uniqueid = $input.data('count');
var client_id = $('#client_id').val();
var insurer_id = $('#follow_insurer_id_' + uniqueid).val();
var isCurrentLeader = $('#co_share_type_' + uniqueid).is(':checked');
var isAnyLeaderSelected = $('input[name="co_share_type[]"]:checked').length > 0;
var cop_yes = $('#cop_yes').is(':checked');
// Missing base data
if (!client_id || !insurer_id) {
toastr.warning('Client or Insurer does not exist.', 'WARNING!');
return;
}
// COP enabled but no leader selected
if (cop_yes && !isAnyLeaderSelected) {
toastr.warning('Please select a Leader.', 'WARNING!');
$input.val('');
return;
}
// CD allowed only for leader
if (cop_yes && !isCurrentLeader) {
toastr.warning(
'CD account number allowed only for Leader.',
'WARNING!'
);
// Clear current select
$input.val('');
// Disable CD for NON-leaders, enable only leader, clear balance div
$('select.follow_insurer_cd').each(function () {
var count = $(this).data('count');
var isLeaderRow = $('#co_share_type_' + count).is(':checked');
// Get the corresponding balance div
var balanceDiv = document.getElementById('cd_current_balance_info_' + count);
if (!isLeaderRow) {
$(this)
.prop('disabled', true)
.removeAttr('required')
.val('');
// Clear balance div if it exists
if (balanceDiv) {
balanceDiv.innerHTML = "";
}
} else {
$(this)
.prop('disabled', false)
.attr('required', true);
}
});
return;
}
// Add CD
if (val === 'add_cd') {
$('#premium_details_unique_id').val(uniqueid);
new bootstrap.Modal(
document.getElementById('cd_form_modal')
).show();
$input.val('');
return;
}
// ✅ Valid selection (leader only)
$('#cd_ac_pk_for_leader').val(val);
getCdAmount(val, uniqueid);
}
function restrictCDACNO(currentSelect){
const selectedValue = $(currentSelect).val();
@ -3780,85 +3929,160 @@
//-----------------------------------------------------------------------------------------------------------
$('#cop_yes').change(function() {
// $('#cop_yes').change(function() {
if ($(this).is(':checked')) {
$('.add-insurer-button').removeClass('d-none');
$('.payby').removeClass('d-none');
$('.card_group_2').show()
$('.card_group_3').show()
$('.card_group_7').show()
$('.card_group_35').removeClass('d-none');
// if ($(this).is(':checked')) {
// $('.add-insurer-button').removeClass('d-none');
// $('.payby').removeClass('d-none');
// $('.card_group_2').show()
// $('.card_group_3').show()
// $('.card_group_7').show()
// $('.card_group_35').removeClass('d-none');
var selectedOption = $('#policy_type_id').find('option:selected');
var bap = selectedOption.data('bap');
var allocg = selectedOption.data('allocg');
// console.log('allocg:', allocg);
// var selectedOption = $('#policy_type_id').find('option:selected');
// var bap = selectedOption.data('bap');
// var allocg = selectedOption.data('allocg');
// // console.log('allocg:', allocg);
// do not remove this commented items
// if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
// $('.hidecoter').show()
// $('.hidecotp').hide()
// }else{
// // do not remove this commented items
// // if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
// // $('.hidecoter').show()
// // $('.hidecotp').hide()
// // }else{
// if(bap == 'Motor'){
// $('.hidecotp').show()
// $('.hidecoter').hide()
// }else{
// $('.hidecoter').hide()
// $('.hidecotp').hide()
// }
// }
// // if(bap == 'Motor'){
// // $('.hidecotp').show()
// // $('.hidecoter').hide()
// // }else{
// // $('.hidecoter').hide()
// // $('.hidecotp').hide()
// // }
// // }
if(allocg == "EB"){
$('.hideter').hide();
$('.hidetp').hide();
$('.hidecoter').hide()
$('.hidecotp').hide()
}else{
// if(allocg == "EB"){
// $('.hideter').hide();
// $('.hidetp').hide();
// $('.hidecoter').hide()
// $('.hidecotp').hide()
// }else{
$('.hidetp').show();
if($(this).is(':checked')){
$('.hidecotp').show();
}else{
$('.hidecotp').hide();
}
// $('.hidetp').show();
// if($(this).is(':checked')){
// $('.hidecotp').show();
// }else{
// $('.hidecotp').hide();
// }
if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
$('.hideter').show();
if($(this).is(':checked')){
$('.hidecoter').show();
}else{
$('.hidecoter').hide();
}
}else{
$('.hideter').hide();
}
}
// if(bap == 'Fire' || bap == 'Marine Cargo' || bap == 'Marine Hull'){
// $('.hideter').show();
// if($(this).is(':checked')){
// $('.hidecoter').show();
// }else{
// $('.hidecoter').hide();
// }
// }else{
// $('.hideter').hide();
// }
// }
// $('input[name="co_share_per[]"], input[name="co_premium[]"]').each(function () {
// $(this).val(''); // Clear value
// console.log('Input cleared:', $(this).attr('name')); // Log cleared input
// });
// // $('input[name="co_share_per[]"], input[name="co_premium[]"]').each(function () {
// // $(this).val(''); // Clear value
// // console.log('Input cleared:', $(this).attr('name')); // Log cleared input
// // });
} else {
$('.add-insurer-button').addClass('d-none');
$('.payby').addClass('d-none');
// $('#bro_payable_by').prop('checked', false);
$('.card_group_2').hide()
$('.card_group_3').hide()
$('.card_group_7').hide()
$('.card_group_35').addClass('d-none');
$('.hidecoter').hide()
$('.hidecotp').hide()
// } else {
// $('.add-insurer-button').addClass('d-none');
// $('.payby').addClass('d-none');
// // $('#bro_payable_by').prop('checked', false);
// $('.card_group_2').hide()
// $('.card_group_3').hide()
// $('.card_group_7').hide()
// $('.card_group_35').addClass('d-none');
// $('.hidecoter').hide()
// $('.hidecotp').hide()
// $('input[name="co_share_per[]"], input[name="co_premium[]"]').each(function () {
// $(this).val(''); // Clear value
// console.log('Input cleared:', $(this).attr('name')); // Log cleared input
// });
// // $('input[name="co_share_per[]"], input[name="co_premium[]"]').each(function () {
// // $(this).val(''); // Clear value
// // console.log('Input cleared:', $(this).attr('name')); // Log cleared input
// // });
// }
// });
$('#cop_yes').change(function () {
const isCoPayYes = $(this).is(':checked');
const selectedOption = $('#policy_type_id option:selected');
const bap = selectedOption.data('bap');
const allocg = selectedOption.data('allocg');
const $allPremiumCols = $('.csslabel, .cssbp, .csstp, .csstep');
/* =========================
VISIBILITY LOGIC
========================= */
if (isCoPayYes) {
$('.add-insurer-button, .payby').removeClass('d-none');
$('.card_group_2, .card_group_3, .card_group_7').show();
$('.card_group_35').removeClass('d-none');
if (allocg === "EB") {
$('.hideter, .hidetp, .hidecoter, .hidecotp').hide();
} else {
$('.hidetp').show();
$('.hidecotp').show();
if (['Fire','Marine Cargo','Marine Hull'].includes(bap)) {
$('.hideter, .hidecoter').show();
} else {
$('.hideter, .hidecoter').hide();
}
}
});
} else {
$('.add-insurer-button, .payby').addClass('d-none');
$('.card_group_2, .card_group_3, .card_group_7').hide();
$('.card_group_35').addClass('d-none');
$('.hideter, .hidetp, .hidecoter, .hidecotp').hide();
}
/* =========================
COLUMN LAYOUT LOGIC
========================= */
$allPremiumCols
.filter(':visible')
.removeClass('col-3 col-4 col-6');
if (allocg === "EB") {
$allPremiumCols
.filter(':visible')
.addClass('col-6');
} else if (['Fire','Marine Cargo','Marine Hull'].includes(bap)) {
$allPremiumCols
.filter(':visible')
.addClass('col-3');
} else {
$allPremiumCols
.filter(':visible')
.addClass('col-4');
}
/* =========================
CO-SHARE RECALC
========================= */
co_share_percentage_calculation();
});
$('#client_type').change(function() {
@ -4348,7 +4572,7 @@
style="font-size: x-small;">
</small>
</label>
<select class="form-control follow_insurer_cd" data-count="${insurerCount}" id="cd_ac_no_${insurerCount}" name="cd_ac_no_for_child[]" onchange="addCDAccountNumber(this); restrictCDACNO(this);">
<select class="form-control follow_insurer_cd" data-count="${insurerCount}" id="cd_ac_no_${insurerCount}" name="cd_ac_no_for_child[]" onchange="addCDAccountNumber(this);">
<option value="" selected>Select CD No</option>
<option value="add_cd"> + Add CD No</option>
</select>

View File

@ -212,6 +212,8 @@
<label for="description" class="control-label">Description<span class="text-danger">*</span></label>
<textarea class="form-control" id="description"
placeholder="Write something about the transaction" required></textarea>
<input type="hidden" id="cd_ac_pk" value="<?php echo $depositdata[0]->cd_ac_pk?>">
<input type="hidden" id="cd_ac_no" value="<?php echo $depositdata[0]->cd_ac_no?>">
</div>
</div>
</div>
@ -392,6 +394,8 @@
var transactionTypeValue = $('input[name="transactionMode"]:checked').val();
var subType = "";
var record_date = $('#record_date').val();
var cd_ac_no = $('#cd_ac_no').val();
var cd_ac_pk = $('#cd_ac_pk').val();
if (amount == "") {
toastr.warning('Amount field is required')
@ -432,7 +436,8 @@
console.log('clientId ', clientId)
console.log('insurerId ', insurerId)
console.log('subType ', subType)
console.log('cd_ac_pk ', cd_ac_pk)
console.log('cd_ac_no ', cd_ac_no)
// Send data to the server using Ajax
$.ajax({
@ -445,7 +450,9 @@
sub_type_id: subType, // Include sub_type_id
client_id: clientId,
insurer_id: insurerId,
record_date: record_date
record_date: record_date,
cd_ac_pk: cd_ac_pk,
cd_ac_no: cd_ac_no
},
success: function(response) {
// Handle success response