Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
commit
1e1b8a5301
@ -134,6 +134,10 @@ class Database extends Config
|
||||
'ssl_ca' => ROOTPATH . 'ca.pem',
|
||||
'ssl_verify' => true,
|
||||
];
|
||||
$this->preDB['encrypt'] = [
|
||||
'ssl_ca' => ROOTPATH . 'ca.pem',
|
||||
'ssl_verify' => true,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -92,13 +92,25 @@ class ApiServiceController extends BaseController
|
||||
|
||||
}
|
||||
|
||||
// $employee_policy = $this->employeePolicyModel
|
||||
// ->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
||||
// ->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
// ->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
||||
// ->where('employee_polices.employee_id',$id)
|
||||
// ->where('employee_polices.client_policy_id',$client_policy_id)
|
||||
// ->where('employee_polices.is_active', 1 )->findAll();
|
||||
|
||||
$employee_policy = $this->employeePolicyModel
|
||||
->select('employees.*, employee_polices.tpa_id , employee_polices.rand_string , employee_polices.uhid as uhid , client_policy.tpa_id as tpa_primary_id ')
|
||||
->join('employees', 'employee_polices.employee_id = employees.id', 'left')
|
||||
->join('client_policy', 'employee_polices.client_policy_id = client_policy.id', 'left')
|
||||
->where('employee_polices.employee_id',$id)
|
||||
->where('employee_polices.client_policy_id',$client_policy_id)
|
||||
->where('employee_polices.is_active', 1 )->findAll();
|
||||
->where('employees.emp_code', $emp_code)
|
||||
->where('employee_polices.client_policy_id', $client_policy_id)
|
||||
->where('employee_polices.is_active', 1)
|
||||
->where('employees.is_active', 1)
|
||||
->where('employee_polices.status', 'active')
|
||||
->where('employees.emp_status', 'active')
|
||||
->findAll();
|
||||
|
||||
|
||||
if(count($employee_policy) > 0)
|
||||
|
||||
@ -2726,7 +2726,9 @@ class ClientController extends AdminController
|
||||
$search_term = 'GMC';
|
||||
} else if (preg_match($gpa_pattern, $subject) || $policy_type_id == 6 || $policy_type_id == 7) {
|
||||
$search_term = 'GPA';
|
||||
} else {
|
||||
} else if($policy_type_id == 72){
|
||||
$search_term = 'GMC';
|
||||
}else {
|
||||
$search_term = "";
|
||||
}
|
||||
|
||||
@ -2736,7 +2738,7 @@ class ClientController extends AdminController
|
||||
if ($search_term === 'GPA' || $policy_type_id == 6 || $policy_type_id == 7) {
|
||||
|
||||
$premiumData = $this->policyPremium1Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||
} else if ($search_term === 'GMC') {
|
||||
} else if ($search_term === 'GMC' || $policy_type_id == 72) {
|
||||
|
||||
$premiumData = $this->policyPremium2Model->where(['client_id' => $record['client_id'], 'client_policy_id' => $client_policy_id, 'is_active' => 1])->findAll();
|
||||
|
||||
@ -2766,7 +2768,7 @@ class ClientController extends AdminController
|
||||
// echo '<pre>';
|
||||
// echo $family_floater;
|
||||
|
||||
if ($search_term === 'GMC') {
|
||||
if ($search_term === 'GMC' || $policy_type_id == 72 ) {
|
||||
|
||||
// $resultss = [];
|
||||
$resultss = $results;
|
||||
@ -3400,6 +3402,7 @@ class ClientController extends AdminController
|
||||
[
|
||||
'Status' => true,
|
||||
'code' => 200,
|
||||
'policy_type_id' => $record['policy_type_id'],
|
||||
'data' => $record['policy_terms'],
|
||||
'policy_addon' => $record['is_addon'],
|
||||
'emp_count_by_policy' => $emp_count_by_policy
|
||||
@ -4225,34 +4228,41 @@ class ClientController extends AdminController
|
||||
$client_policy_id = $this->request->getPost("client_policy_id");
|
||||
$policy_terms = $this->request->getPost("policy_terms");
|
||||
$policy_terms = json_decode($policy_terms, true);
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($policy_terms as $key => $value) {
|
||||
|
||||
if (str_ends_with($key, '_display')) {
|
||||
|
||||
$original_key = substr($key, 0, -8);
|
||||
|
||||
$newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
|
||||
|
||||
$data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
|
||||
} else {
|
||||
|
||||
$data[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
$policy_terms['is_payable_employee']['self'] = 0;
|
||||
$policy_terms = json_encode($data);
|
||||
}
|
||||
|
||||
|
||||
$record = $this->clientPolicyModel->where('id', $client_policy_id)->first();
|
||||
// print_r($policy_terms); die;
|
||||
|
||||
if(empty($policy_terms)){
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Policy terms data could not be empty', 'formdata' => $this->request->getPost()], 200);
|
||||
}
|
||||
|
||||
if ($record) {
|
||||
|
||||
$data = [];
|
||||
|
||||
foreach ($policy_terms as $key => $value) {
|
||||
|
||||
if (str_ends_with($key, '_display')) {
|
||||
|
||||
$original_key = substr($key, 0, -8);
|
||||
|
||||
$newKey = implode(' ', array_map('ucfirst', explode('_', $original_key)));
|
||||
|
||||
$data['enrollment_display_key'][$newKey] = $policy_terms[$original_key] ?? " ";
|
||||
} else {
|
||||
|
||||
$data[$key] = $value;
|
||||
}
|
||||
}
|
||||
|
||||
if($record['policy_type_id'] == 72){
|
||||
$data['enrollment_display_key'] = $this->otherPolicyTermsDisplayKeyConstruct($policy_terms);
|
||||
}
|
||||
|
||||
if (!empty($data)) {
|
||||
$policy_terms['is_payable_employee']['self'] = 0;
|
||||
$policy_terms = json_encode($data);
|
||||
}
|
||||
|
||||
$update = $this->clientPolicyModel->where('id', $client_policy_id)->set('policy_terms', $policy_terms)->update();
|
||||
|
||||
if ($update) {
|
||||
@ -4260,12 +4270,34 @@ class ClientController extends AdminController
|
||||
} else {
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to update data', 'formdata' => $this->request->getPost()], 200);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
return $this->respond(['status' => false, 'code' => 404, 'message' => 'Failed to store data. The client policy does not exist', 'formdata' => $this->request->getPost()], 200);
|
||||
}
|
||||
}
|
||||
|
||||
public function otherPolicyTermsDisplayKeyConstruct($data)
|
||||
{
|
||||
$labels = $data['special_condition_label'] ?? [];
|
||||
$values = $data['special_condition_input'] ?? [];
|
||||
|
||||
$special_conditions = [];
|
||||
|
||||
foreach ($labels as $i => $label) {
|
||||
$value = $values[$i] ?? '';
|
||||
|
||||
// skip if label or value is empty
|
||||
if (trim($label) === '' || trim($value) === '') {
|
||||
continue;
|
||||
}
|
||||
|
||||
$special_conditions[$label] = $value;
|
||||
}
|
||||
|
||||
return $special_conditions;
|
||||
}
|
||||
|
||||
public function checkPolicyType($policy_type_id, $client_branch_id, $client_id)
|
||||
{
|
||||
|
||||
@ -5971,8 +6003,8 @@ class ClientController extends AdminController
|
||||
// ---------- EMP SERVICE CONTROLLER --------------------------------------------------------------------------------
|
||||
|
||||
$empServiceController = new EmployeeServiceController();
|
||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '1126']);
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '865']);
|
||||
// $res = $empServiceController->excelFileFormatValidation(['file_id' => '1248']);
|
||||
// $res = $empServiceController->excelFileDataValidation(['file_id' => '1248']);
|
||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1183]);
|
||||
// $res = $empServiceController->employeesOnboardPreprocess(['file_id' => 1169]);
|
||||
// $res = $empServiceController->employeesOnboardProcess(['file_id' => 835]);
|
||||
|
||||
@ -238,7 +238,7 @@ class DashboardController extends AdminController
|
||||
|
||||
$data['client_branch_emp_list'] = $results;
|
||||
$session = \Config\Services::session();
|
||||
$session->set('enrollment_data', json_encode($data));
|
||||
// $session->set('enrollment_data', json_encode($data));
|
||||
|
||||
$data['pendingActionsData'] = $pendingActionsData;
|
||||
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
||||
|
||||
@ -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);
|
||||
@ -985,11 +990,11 @@
|
||||
$data['co_share'] = 1;
|
||||
}
|
||||
|
||||
if (!isset($data['bro_payable_by'])) {
|
||||
$data['bro_payable_by'] = 0;
|
||||
} elseif ($data['bro_payable_by']) {
|
||||
$data['bro_payable_by'] = 1;
|
||||
}
|
||||
// if (!isset($data['bro_payable_by'])) {
|
||||
// $data['bro_payable_by'] = 0;
|
||||
// } elseif ($data['bro_payable_by']) {
|
||||
// $data['bro_payable_by'] = 1;
|
||||
// }
|
||||
|
||||
if (!isset($data['same_as_proposer'])) {
|
||||
$data['same_as_proposer'] = 0;
|
||||
@ -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;
|
||||
|
||||
@ -238,7 +238,7 @@ if (!function_exists('generate_download_link')) {
|
||||
}
|
||||
|
||||
if (!function_exists('generate_random_alphanumeric')) {
|
||||
function generate_random_alphanumeric($length = 6) {
|
||||
function generate_random_alphanumeric($length = 12) {
|
||||
$random_string = '';
|
||||
for ($i = 0; $i < $length; $i++) {
|
||||
$random_ascii = rand(0, 61);
|
||||
|
||||
@ -88,6 +88,7 @@
|
||||
'salse_person_manager_id',
|
||||
'service_person_manager_id',
|
||||
'service_person_branch_id',
|
||||
'pos_id',
|
||||
];
|
||||
|
||||
|
||||
|
||||
@ -355,11 +355,54 @@
|
||||
// }
|
||||
});
|
||||
|
||||
|
||||
var client_list = ''; // local variable for storing the client branch list
|
||||
var branch_list = ''; // local variable for storing the client branch list
|
||||
var policy_list = ''; // local variable for storing the client policy list
|
||||
var branch_policy = '';
|
||||
var policy_list_by_client = '';
|
||||
|
||||
$(document).ready(function() {
|
||||
getClientAndBranchAndPolicy();
|
||||
})
|
||||
|
||||
//featch client and branch and policy
|
||||
function getClientAndBranchAndPolicy() {
|
||||
$.ajax({
|
||||
url: '<?= base_url("/util/getClientAndBranchAndPolicy") ?>',
|
||||
type: "GET",
|
||||
dataType: 'json',
|
||||
success: function(res) {
|
||||
|
||||
console.log('getClientAndBranchAndPolicy', res);
|
||||
if (res.status == true) {
|
||||
|
||||
client_list = res.client_data;
|
||||
branch_list = res.branch_data;
|
||||
policy_list = res.policy_data;
|
||||
policy_list_by_client = res.policyListByClient;
|
||||
|
||||
appendClients(client_list);
|
||||
// appendBranch(branch_list);
|
||||
// appendPolicies(policy_list);
|
||||
|
||||
} else {
|
||||
console.log('No data found');
|
||||
}
|
||||
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error(xhr.responseText);
|
||||
console.error(status, error);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
var clientPoliciesWithBranch = {
|
||||
policies: []
|
||||
};
|
||||
// var clientPolicies = [];
|
||||
// var clientPoliciesWithBranch = {
|
||||
// policies: []
|
||||
// };
|
||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
||||
|
||||
@ -376,91 +419,91 @@
|
||||
});
|
||||
|
||||
|
||||
$(document).ready(function() {
|
||||
console.log("document loaded");
|
||||
//fetchClientPolicies();
|
||||
});
|
||||
// $(document).ready(function() {
|
||||
// console.log("document loaded");
|
||||
// //fetchClientPolicies();
|
||||
// });
|
||||
|
||||
$(window).on("load", function() {
|
||||
console.log("window loaded");
|
||||
fetchClientPolicies();
|
||||
});
|
||||
// $(window).on("load", function() {
|
||||
// console.log("window loaded");
|
||||
// fetchClientPolicies();
|
||||
// });
|
||||
|
||||
function fetchClientPolicies() {
|
||||
$('#loader').show();
|
||||
var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
|
||||
console.log('fetchClientPolicies');
|
||||
// console.log(apiURL);
|
||||
$.ajax({
|
||||
url: apiURL,
|
||||
method: 'GET',
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"X-Requested-With": "XMLHttpRequest"
|
||||
},
|
||||
success: function(response) {
|
||||
// console.log(response.code);
|
||||
// console.log(response.dataStatus);
|
||||
// console.log(response.data);
|
||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
try {
|
||||
clientPolicies = (response.data);
|
||||
// function fetchClientPolicies() {
|
||||
// $('#loader').show();
|
||||
// var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
|
||||
// console.log('fetchClientPolicies');
|
||||
// // console.log(apiURL);
|
||||
// $.ajax({
|
||||
// url: apiURL,
|
||||
// method: 'GET',
|
||||
// headers: {
|
||||
// "Content-Type": "application/json",
|
||||
// "X-Requested-With": "XMLHttpRequest"
|
||||
// },
|
||||
// success: function(response) {
|
||||
// // console.log(response.code);
|
||||
// // console.log(response.dataStatus);
|
||||
// // console.log(response.data);
|
||||
// if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||
// try {
|
||||
// clientPolicies = (response.data);
|
||||
|
||||
response.data.forEach(policy => {
|
||||
// console.log('policies', policy.policies);
|
||||
policy.policies.forEach(p => {
|
||||
clientPoliciesWithBranch.policies.push(p);
|
||||
});
|
||||
});
|
||||
// response.data.forEach(policy => {
|
||||
// // console.log('policies', policy.policies);
|
||||
// policy.policies.forEach(p => {
|
||||
// clientPoliciesWithBranch.policies.push(p);
|
||||
// });
|
||||
// });
|
||||
|
||||
// console.log('1',clientPolicies);
|
||||
appendClients(clientPolicies);
|
||||
// // console.log('1',clientPolicies);
|
||||
// appendClients(clientPolicies);
|
||||
|
||||
//this function for reselect the policy
|
||||
setTimeout(function() {
|
||||
if (client_id != 0) {
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
// console.log(typeof item.id)
|
||||
return item.id == client_id;
|
||||
});
|
||||
appendBranch(foundPolicies.branchs);
|
||||
}
|
||||
}, 500);
|
||||
// //this function for reselect the policy
|
||||
// setTimeout(function() {
|
||||
// if (client_id != 0) {
|
||||
// var foundPolicies = clientPolicies.find(function(item) {
|
||||
// // console.log(typeof item.id)
|
||||
// return item.id == client_id;
|
||||
// });
|
||||
// appendBranch(foundPolicies.branchs);
|
||||
// }
|
||||
// }, 500);
|
||||
|
||||
setTimeout(function() {
|
||||
if (client_branch_id != 0) {
|
||||
// setTimeout(function() {
|
||||
// if (client_branch_id != 0) {
|
||||
|
||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||
// console.log('item', item);
|
||||
return item.branch_id === client_branch_id;
|
||||
});
|
||||
// var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||
// // console.log('item', item);
|
||||
// return item.branch_id === client_branch_id;
|
||||
// });
|
||||
|
||||
if (foundPolicies) {
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendPolicies(foundPolicies);
|
||||
} else {
|
||||
console.log('No policies found for the selected client');
|
||||
}
|
||||
}
|
||||
}, 500);
|
||||
//end
|
||||
// if (foundPolicies) {
|
||||
// // console.log('foundPolicies', foundPolicies);
|
||||
// appendPolicies(foundPolicies);
|
||||
// } else {
|
||||
// console.log('No policies found for the selected client');
|
||||
// }
|
||||
// }
|
||||
// }, 500);
|
||||
// //end
|
||||
|
||||
} catch (error) {
|
||||
console.error('Error parsing API response data:', error);
|
||||
}
|
||||
} else if (response.code === 404 && response.dataStatus === false) {
|
||||
console.error('no data found', response);
|
||||
} else {
|
||||
console.error('Something went wrong!');
|
||||
}
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
console.error('Error fetching data from API:', error);
|
||||
}
|
||||
});
|
||||
// } catch (error) {
|
||||
// console.error('Error parsing API response data:', error);
|
||||
// }
|
||||
// } else if (response.code === 404 && response.dataStatus === false) {
|
||||
// console.error('no data found', response);
|
||||
// } else {
|
||||
// console.error('Something went wrong!');
|
||||
// }
|
||||
// },
|
||||
// error: function(xhr, status, error) {
|
||||
// console.error('Error fetching data from API:', error);
|
||||
// }
|
||||
// });
|
||||
|
||||
$('#loader').hide();
|
||||
}
|
||||
// $('#loader').hide();
|
||||
// }
|
||||
|
||||
function appendClients(data) {
|
||||
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||
@ -507,8 +550,9 @@
|
||||
// console.log(PolicyID)
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.client_policy_id,
|
||||
// value: item.client_policy_id,
|
||||
// text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||
value: item.id,
|
||||
text: `${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
||||
});
|
||||
if (PolicyID == item.client_policy_id) {
|
||||
@ -522,6 +566,9 @@
|
||||
|
||||
$('#clients').on('change', function() {
|
||||
|
||||
$('#branch_id').empty();
|
||||
$('#branch_id').append($('<option>', { value: '0', text: 'Select'}));
|
||||
|
||||
$('#policies').empty();
|
||||
$('#policies').append($('<option>', {
|
||||
value: '0',
|
||||
@ -529,15 +576,16 @@
|
||||
}));
|
||||
|
||||
var selectedClient = $(this).val();
|
||||
// console.log('selectedClient', selectedClient);
|
||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
||||
// alert(selectedClient);
|
||||
// console.log(branch_list);
|
||||
var filteredBranch = branch_list[selectedClient];
|
||||
|
||||
// Check if the selected option exists in apiData
|
||||
var foundPolicies = clientPolicies.find(function(item) {
|
||||
return item.id === selectedClient;
|
||||
});
|
||||
// console.log(foundPolicies.branchs);
|
||||
appendBranch(foundPolicies.branchs);
|
||||
if (filteredBranch) {
|
||||
console.log("Found Data for Client " + selectedClient, filteredBranch);
|
||||
appendBranch(filteredBranch);
|
||||
} else {
|
||||
console.warn("No data found for client ID: " + selectedClient);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
@ -545,26 +593,23 @@
|
||||
|
||||
$('#branch_id').on('change', function() {
|
||||
|
||||
var selectedClient = $(this).val();
|
||||
|
||||
// console.log('selectedBranch', selectedClient);
|
||||
// console.log('clientPolicies', clientPoliciesWithBranch);
|
||||
|
||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||
var selectedBranch = $(this).val();
|
||||
var selectedClient = $('#clients').val();
|
||||
var filteredPoliciesByClient = policy_list_by_client[selectedClient];
|
||||
|
||||
var filteredPoliciesByBranch = filteredPoliciesByClient.filter(function(item) {
|
||||
// console.log('item', item);
|
||||
return item.branch_id === selectedClient;
|
||||
return item.client_branch_id === selectedBranch;
|
||||
});
|
||||
|
||||
console.log("filteredPoliciesByClient => ",filteredPoliciesByClient);
|
||||
console.log("filteredPoliciesByBranch => ",filteredPoliciesByBranch);
|
||||
|
||||
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||
|
||||
appendPolicies(foundPolicies);
|
||||
if (Array.isArray(filteredPoliciesByBranch) && filteredPoliciesByBranch.length === 0) {
|
||||
appendPolicies(filteredPoliciesByBranch);
|
||||
toastr.warning('No policies found for the selected client branch.');
|
||||
|
||||
} else {
|
||||
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendPolicies(foundPolicies);
|
||||
appendPolicies(filteredPoliciesByBranch);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -3,6 +3,33 @@
|
||||
position: absolute;
|
||||
}
|
||||
.dataTables_length label {height: 21px !important;}
|
||||
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
color: #212529 !important;
|
||||
text-decoration: none !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- End ADD and EDIT Page HTML -->
|
||||
@ -16,13 +43,15 @@
|
||||
<th class="font-weight-medium">S.No.</th>
|
||||
<th class="font-weight-medium">Category</th>
|
||||
<th class="font-weight-medium">Question</th>
|
||||
<th class="font-weight-medium">Answer</th>
|
||||
<!-- <th class="font-weight-medium">Answer</th> -->
|
||||
<th class="font-weight-medium">Status</th>
|
||||
<th class="font-weight-medium">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(isset($faq_list)) { $slno = 1; ?>
|
||||
<?php if(!empty($faq_list)) {
|
||||
// <?php if(isset($faq_list)) {
|
||||
$slno = 1; ?>
|
||||
<?php foreach($faq_list as $index => $row) { ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= $slno++; ?></td>
|
||||
@ -36,11 +65,11 @@
|
||||
? htmlspecialchars(substr($question, 0, 50)) . "..."
|
||||
: htmlspecialchars($question);
|
||||
?></td>
|
||||
<td><?php $answer = $row['answer'] ? $row['answer'] : 'N/A';
|
||||
<!-- <td><?php $answer = $row['answer'] ? $row['answer'] : 'N/A';
|
||||
echo (strlen($answer) > 50)
|
||||
? htmlspecialchars(substr($answer, 0, 50)) . "..."
|
||||
: htmlspecialchars($answer);
|
||||
?></td>
|
||||
?></td> -->
|
||||
<td>
|
||||
<span class="<?php if($row['is_active'] == 1){ echo 'badge badge-primary'; }else{ echo 'badge badge-danger'; } ?>">
|
||||
<?php if($row['is_active'] == 1){ echo 'Active'; }else{ echo 'In-Active'; } ?>
|
||||
@ -62,12 +91,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<!-- <tr>
|
||||
<td colspan="6" class="text-center">No data available</td>
|
||||
</tr> -->
|
||||
<?php } ?>
|
||||
<?php } } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
@ -353,4 +377,93 @@
|
||||
});
|
||||
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("user-table");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
|
||||
// Append the custom dropdown to the body
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -3,6 +3,32 @@
|
||||
position: absolute;
|
||||
}
|
||||
.dataTables_length label {height: 21px !important;}
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
color: #212529 !important;
|
||||
text-decoration: none !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- End ADD and EDIT Page HTML -->
|
||||
@ -23,7 +49,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(isset($data['fe_list'])) { $slno = 1; ?>
|
||||
<?php if(!empty($data['fe_list'])) { $slno = 1; ?>
|
||||
<?php foreach($data['fe_list'] as $index => $row) { ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= $slno++; ?></td>
|
||||
@ -51,12 +77,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<!-- <tr>
|
||||
<td colspan="6" class="text-center">No data available</td>
|
||||
</tr> -->
|
||||
<?php } ?>
|
||||
<?php } } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
@ -503,4 +524,93 @@
|
||||
}
|
||||
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("user-table");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
|
||||
// Append the custom dropdown to the body
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -412,7 +412,7 @@
|
||||
|
||||
function appendBranch2(data) {
|
||||
|
||||
// console.log(data)
|
||||
// console.log(data)
|
||||
|
||||
$('#client_branch_id').empty();
|
||||
$('#client_branch_id').append($('<option>', {
|
||||
|
||||
@ -72,6 +72,11 @@
|
||||
margin-left: 30px;
|
||||
width: 689px;
|
||||
}
|
||||
|
||||
.other-speciial-condition{
|
||||
margin-left: 150px;
|
||||
width: 564px;
|
||||
}
|
||||
</style>
|
||||
|
||||
<div id="OtherPolicyTermsForm" style="display:none">
|
||||
@ -83,35 +88,180 @@
|
||||
|
||||
<form role="form" class="parsley-examples" method="post" id="otherPolicyTerms" enctype="multipart/form-data">
|
||||
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>"/>
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>" />
|
||||
<input type="hidden" name="client_id" id="Client_id" value="<?= isset($client['id']) ? $client['id'] : '' ?>" />
|
||||
<input type="hidden" name="client_policy_id" id="other_client_policy_id" />
|
||||
<input type="hidden" name="policy_id" id="gpa_policy_id" />
|
||||
<input type="hidden" id="emp_count" />
|
||||
|
||||
<div id="sumInsuredDiv" class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||
</div>
|
||||
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordOthers' class="text-danger-2" ></div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="sumInsuredDiv" class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-6">
|
||||
<label for="sumInsured">Sum Insured</label>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress="return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||
</div>
|
||||
<div class="col-md-2" style="position: relative;left: 88px;">
|
||||
<button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div id='numberToWordOthers' class="text-danger-2"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="margin-top: 10px;margin-bottom:15px;" id="sum_insured_add_more" ></div>
|
||||
<div style="margin-top: 10px;margin-bottom:15px;" id="sum_insured_add_more"></div>
|
||||
<div id="append_html_for_other_policy_terms"></div>
|
||||
|
||||
<hr>
|
||||
<div id="familyFloaterDiv_others" class="row mb-2">
|
||||
<div class="col-md-4">
|
||||
<label class="form-label">Family Floater</label>
|
||||
</div>
|
||||
|
||||
<div class="col-md-6">
|
||||
<div class="form-check form-check-inline">
|
||||
<input class="form-check-input" type="radio" id="familyFloaterYes_others" name="family_floater" value="1">
|
||||
<label class="form-check-label" for="familyFloaterYes_others" style="width: 52px !important">Yes</label>
|
||||
|
||||
<input class="form-check-input" type="radio" id="familyFloaterNo_others" name="family_floater" value="0">
|
||||
<label class="form-check-label" for="familyFloaterNo_others">No</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="familyFloaterDiv_others_two" class="row" style="margin-bottom: 10px;">
|
||||
|
||||
<div class="col" style="background-color:#F5FFFF;border-radius:10px;box-shadow:0px 2px 2px 0px #00000040;padding:20px;">
|
||||
|
||||
<!-- SELF -->
|
||||
<div class="d-flex align-items-center policy-base-info">
|
||||
<input type="checkbox" name="family_floaters[]" value="self" id="self_others" checked>
|
||||
|
||||
<span style="margin-right:150px;color:black;">Self:</span>
|
||||
|
||||
<div class="self-age">
|
||||
<span style="margin-right:10px;color:black;">Min Age:</span>
|
||||
<input class="underline-input min_age"
|
||||
type="number"
|
||||
name="self_min_age"
|
||||
id="self_min_age_others"
|
||||
value="<?= isset($self_min_age) && $self_min_age > 0 ? $self_min_age : '18'; ?>"
|
||||
onchange="lowerIsEighteenOthers(this)">
|
||||
</div>
|
||||
|
||||
<div class="self-age">
|
||||
<span style="margin-right:10px;color:black;">Max Age:</span>
|
||||
<input class="underline-input max_age"
|
||||
type="number"
|
||||
name="self_max_age"
|
||||
id="self_max_age_others"
|
||||
value="<?= isset($self_max_age) ? $self_max_age : '60'; ?>"
|
||||
onchange="lowerIsEighteenOthers(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- SPOUSE -->
|
||||
<div class="d-flex align-items-center policy-base-info">
|
||||
<input type="checkbox" name="family_floaters[]" value="spouse" id="spouse_others">
|
||||
|
||||
<span style="margin-right:125px;color:black;">Spouse:</span>
|
||||
|
||||
<div class="spouse-age">
|
||||
<span style="margin-right:10px;color:black;">Min Age:</span>
|
||||
<input class="underline-input min_age"
|
||||
type="number"
|
||||
name="spouse_min_age"
|
||||
id="spouse_min_age_others"
|
||||
value="<?= isset($spouse_min_age) ? $spouse_min_age : '18'; ?>"
|
||||
onchange="lowerIsEighteenOthers(this)">
|
||||
</div>
|
||||
|
||||
<div class="spouse-age">
|
||||
<span style="margin-right:10px;color:black;">Max Age:</span>
|
||||
<input class="underline-input max_age"
|
||||
type="number"
|
||||
name="spouse_max_age"
|
||||
id="spouse_max_age_others"
|
||||
value="<?= isset($spouse_max_age) ? $spouse_max_age : '60'; ?>"
|
||||
onchange="lowerIsEighteenOthers(this)">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- CHILDREN -->
|
||||
<div class="d-flex align-items-center policy-base-info">
|
||||
<span style="color:black;" class="mr-2">Children:</span>
|
||||
|
||||
<select name="family_floaters[]" id="children_others" class="px-1" style="margin-right:60px;">
|
||||
<option value="0">None</option>
|
||||
<option value="1">1</option>
|
||||
<option value="2">2</option>
|
||||
<option value="3">3</option>
|
||||
<option value="4">4</option>
|
||||
</select>
|
||||
|
||||
<div class="child-age">
|
||||
<span style="margin-right:10px;color:black;">Min Age:</span>
|
||||
<input class="underline-input min_age"
|
||||
type="number"
|
||||
name="child_min_age"
|
||||
id="child_min_age_others"
|
||||
value="<?= isset($child_min_age) ? $child_min_age : '0'; ?>">
|
||||
</div>
|
||||
|
||||
<div class="child-age">
|
||||
<span style="margin-right:10px;color:black;">Max Age:</span>
|
||||
<input class="underline-input max_age"
|
||||
type="number"
|
||||
name="child_max_age"
|
||||
id="child_max_age_others"
|
||||
value="<?= isset($child_max_age) ? $child_max_age : '25'; ?>">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- OTHER MEMBERS -->
|
||||
<div class="d-flex align-items-center policy-base-info flex-nowrap">
|
||||
|
||||
<span class="fw-bold text-dark mr-3"><b>Select Other Members:</b></span>
|
||||
|
||||
<select name="family_floaters[]" id="family_floaters_others" class="form-select mr-3 px-1">
|
||||
<option value="0">None</option>
|
||||
<option value="1P">Only one parent</option>
|
||||
<option value="2P">Only two parents</option>
|
||||
<option value="1PIL">Only one parent in law</option>
|
||||
<option value="2PIL">Only two parents in law</option>
|
||||
<option value="2EPORPIL">Parents or PIL (Any two)</option>
|
||||
<option value="EPORPIL">Either Parents or PIL</option>
|
||||
<option value="4EPORPIL">Parents + PIL</option>
|
||||
</select>
|
||||
|
||||
<span class="text-dark mr-2">Elders Count:</span>
|
||||
<input class="underline-input"
|
||||
type="number"
|
||||
name="elder_member_count"
|
||||
id="member_count_others"
|
||||
readonly>
|
||||
|
||||
<span class="text-dark mr-2">Min Age:</span>
|
||||
<input class="underline-input"
|
||||
type="number"
|
||||
name="other_member_min_age"
|
||||
id="other_member_min_age_others"
|
||||
value="<?= isset($other_member_min_age) ? $other_member_min_age : '18'; ?>">
|
||||
|
||||
<span class="text-dark mr-2">Max Age:</span>
|
||||
<input class="underline-input"
|
||||
type="number"
|
||||
name="other_member_max_age"
|
||||
id="other_member_max_age_others"
|
||||
value="<?= isset($other_member_max_age) ? $other_member_max_age : '60'; ?>">
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="other_special_condition">
|
||||
|
||||
</div>
|
||||
|
||||
<br>
|
||||
@ -126,7 +276,6 @@
|
||||
</div>
|
||||
|
||||
<script>
|
||||
|
||||
$("#otherPolicyTerms").submit(function(event) {
|
||||
|
||||
event.preventDefault();
|
||||
@ -162,10 +311,9 @@
|
||||
formObject[baseKey] = [];
|
||||
}
|
||||
formObject[baseKey].push(value.replace(/,/g, ''));
|
||||
} else if(key == 'sum_insureds'){
|
||||
} else if (key == 'sum_insureds') {
|
||||
formObject['sum_insured'] = value.replace(/,/g, '');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
formObject[key] = value;
|
||||
}
|
||||
}
|
||||
@ -215,7 +363,10 @@
|
||||
}
|
||||
});
|
||||
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
window.scrollTo({
|
||||
top: 0,
|
||||
behavior: 'smooth'
|
||||
});
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
@ -295,7 +446,7 @@
|
||||
if (key.includes("special_condition_label") || key.includes(
|
||||
"special_condition_input")) {
|
||||
if (key.includes("special_condition_label")) {
|
||||
|
||||
|
||||
for (let index = 0; index <
|
||||
otherTermsJsonObjectSpecialCondition[key].length; index++) {
|
||||
specialConditionForOthers();
|
||||
@ -319,12 +470,12 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!key.startsWith("special_condition") && !key.startsWith('multiple_sum_insured') && !key.startsWith("sum_insured") && !key.startsWith("enrollment_display_key") ) {
|
||||
|
||||
termsHTML = `
|
||||
if (!key.startsWith("special_condition") && !key.startsWith('multiple_sum_insured') && !key.startsWith("sum_insured") && !key.startsWith("enrollment_display_key")) {
|
||||
|
||||
termsHTML = `
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="col-md-1">
|
||||
<input type="checkbox" style="margin-top: 12px" name="${key}_display"
|
||||
@ -350,7 +501,7 @@
|
||||
value.forEach(item => appendOtherSIAddMore(item));
|
||||
} else if (typeof value === 'object' && value !== null) {
|
||||
Object.values(value).forEach(item => appendOtherSIAddMore(item));
|
||||
}
|
||||
}
|
||||
// else if (typeof value === 'string') {
|
||||
// appendOtherSIAddMore(value); // Use directly, no loop
|
||||
// }
|
||||
@ -368,10 +519,10 @@
|
||||
|
||||
let elements = document.getElementsByName(key);
|
||||
|
||||
if(key == 'sum_insured'){
|
||||
if (key == 'sum_insured') {
|
||||
elements = document.getElementsByName('sum_insureds')
|
||||
}
|
||||
|
||||
|
||||
console.log(elements)
|
||||
|
||||
if (elements && elements.length > 0) {
|
||||
@ -424,17 +575,19 @@
|
||||
|
||||
}
|
||||
|
||||
if(policy_type_id > 7) {
|
||||
if (policy_type_id > 7 && policy_type_id != 72) {
|
||||
$("#sumInsuredDiv").empty();
|
||||
}
|
||||
|
||||
$("#sumInsuredDiv").empty();
|
||||
if(policy_type_id != 72){
|
||||
$("#familyFloaterDiv_others").empty();
|
||||
$("#familyFloaterDiv_others_two").empty();
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
||||
document.getElementById('otherButtonSpecialCondition').addEventListener('click', function(event) {
|
||||
|
||||
console.log('specialConditionForOthers callback clicked')
|
||||
@ -461,7 +614,7 @@
|
||||
<span class="specialConditionClose" style="color: red; float: right;position: relative;bottom: 28px;left: 15px;">X</span>
|
||||
</label>
|
||||
|
||||
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control s special_condition_input[]">
|
||||
<input type="text" name="special_condition_input[]" id="special_condition_input[]" class="form-control other-speciial-condition special_condition_input[]">
|
||||
</div>`;
|
||||
console.log($(this));
|
||||
$('.other_special_condition').each(function() {
|
||||
@ -475,7 +628,7 @@
|
||||
|
||||
$(document).on('click', '#otherPolicyTermsClose', function() {
|
||||
|
||||
//clear the intervel for the autosave
|
||||
//clear the intervel for the autosave
|
||||
stopAutoSubmit();
|
||||
|
||||
$('#OtherPolicyTermsForm').css('display', 'none');
|
||||
@ -528,27 +681,27 @@
|
||||
|
||||
if (policy_type == 7) {
|
||||
|
||||
|
||||
|
||||
// <div class="row" style="margin-bottom: 10px;">
|
||||
// <div class="col-md-6">
|
||||
// <label for="sumInsured">Sum Insured</label>
|
||||
// </div>
|
||||
// <div class="col-md-4">
|
||||
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||
// </div>
|
||||
// <div class="col-md-2" style="position: relative;left: 88px;">
|
||||
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||
// </div>
|
||||
// <div class="col-md-6">
|
||||
// </div>
|
||||
// <div class="col-md-6">
|
||||
// <div id='numberToWordOthers' class="text-danger-2" ></div>
|
||||
// </div>
|
||||
// </div>
|
||||
|
||||
// <div id="sum_insured_add_more" ></div>
|
||||
termsHTML = `
|
||||
// <div class="row" style="margin-bottom: 10px;">
|
||||
// <div class="col-md-6">
|
||||
// <label for="sumInsured">Sum Insured</label>
|
||||
// </div>
|
||||
// <div class="col-md-4">
|
||||
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||
// </div>
|
||||
// <div class="col-md-2" style="position: relative;left: 88px;">
|
||||
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||
// </div>
|
||||
// <div class="col-md-6">
|
||||
// </div>
|
||||
// <div class="col-md-6">
|
||||
// <div id='numberToWordOthers' class="text-danger-2" ></div>
|
||||
// </div>
|
||||
// </div>
|
||||
|
||||
// <div id="sum_insured_add_more" ></div>
|
||||
termsHTML = `
|
||||
|
||||
<div class="form-group">
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
@ -646,27 +799,27 @@
|
||||
|
||||
} else if (policy_type == 6) {
|
||||
|
||||
|
||||
|
||||
// <div class="row" style="margin-bottom: 10px;">
|
||||
// <div class="col-md-6">
|
||||
// <label for="sumInsured">Sum Insured</label>
|
||||
// </div>
|
||||
// <div class="col-md-4" >
|
||||
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||
// </div>
|
||||
// <div class="col-md-2" style="position: relative;left: 88px;">
|
||||
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||
// </div>
|
||||
// <div class="col-md-6">
|
||||
// </div>
|
||||
// <div class="col-md-6">
|
||||
// <div id='numberToWordOthers' class="text-danger-2" ></div>
|
||||
// </div>
|
||||
// </div>
|
||||
|
||||
// <div id="sum_insured_add_more" ></div>
|
||||
termsHTML = `
|
||||
// <div class="row" style="margin-bottom: 10px;">
|
||||
// <div class="col-md-6">
|
||||
// <label for="sumInsured">Sum Insured</label>
|
||||
// </div>
|
||||
// <div class="col-md-4" >
|
||||
// <input style="width: 128%;" type="text" name="sum_insureds" id="sum_insured_others" class="form-control" onkeypress = "return onlyNumbers(event)" onkeyup=" formatNumber(this); si_keup_num_to_word2(this)">
|
||||
// </div>
|
||||
// <div class="col-md-2" style="position: relative;left: 88px;">
|
||||
// <button type="button" class="btn btn-primary si-add-more" onclick="appendOtherSIAddMore()">+</button>
|
||||
// </div>
|
||||
// <div class="col-md-6">
|
||||
// </div>
|
||||
// <div class="col-md-6">
|
||||
// <div id='numberToWordOthers' class="text-danger-2" ></div>
|
||||
// </div>
|
||||
// </div>
|
||||
|
||||
// <div id="sum_insured_add_more" ></div>
|
||||
termsHTML = `
|
||||
|
||||
<div class="form-group EDLI">
|
||||
|
||||
@ -765,14 +918,14 @@
|
||||
|
||||
function beautifyString(str) {
|
||||
return str
|
||||
.split('_') // Split the string by underscores
|
||||
.map(word =>
|
||||
word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() // Capitalize each word
|
||||
.split('_') // Split the string by underscores
|
||||
.map(word =>
|
||||
word.charAt(0).toUpperCase() + word.slice(1).toLowerCase() // Capitalize each word
|
||||
)
|
||||
.join(' '); // Join with spaces instead of underscores
|
||||
.join(' '); // Join with spaces instead of underscores
|
||||
}
|
||||
|
||||
function autoSaveOtherTerms(){
|
||||
function autoSaveOtherTerms() {
|
||||
|
||||
console.log('autoSaveOtherTerms function called');
|
||||
|
||||
@ -789,10 +942,10 @@
|
||||
var formData = new FormData(form);
|
||||
var hasData = false;
|
||||
|
||||
|
||||
|
||||
for (let [key, value] of formData.entries()) {
|
||||
console.log("Key:", key, "Value:", value);
|
||||
if(key == "sum_insureds"){
|
||||
if (key == "sum_insureds") {
|
||||
if (value && value.toString().trim() !== '') {
|
||||
hasData = true;
|
||||
break;
|
||||
@ -820,10 +973,9 @@
|
||||
formObject[baseKey] = [];
|
||||
}
|
||||
formObject[baseKey].push(value.replace(/,/g, ''));
|
||||
} else if(key == 'sum_insureds'){
|
||||
} else if (key == 'sum_insureds') {
|
||||
formObject['sum_insured'] = value.replace(/,/g, '');
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
formObject[key] = value;
|
||||
}
|
||||
}
|
||||
@ -853,7 +1005,7 @@
|
||||
|
||||
if (res.status == true) {
|
||||
showTinyToast();
|
||||
}else{
|
||||
} else {
|
||||
console.log('Policy terms Dose Not save', 'Error');
|
||||
return;
|
||||
}
|
||||
@ -867,19 +1019,19 @@
|
||||
}
|
||||
|
||||
function debounceothers(fn, delay) {
|
||||
let timeout;
|
||||
return function () {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(fn, delay);
|
||||
};
|
||||
let timeout;
|
||||
return function() {
|
||||
clearTimeout(timeout);
|
||||
timeout = setTimeout(fn, delay);
|
||||
};
|
||||
}
|
||||
|
||||
$(document).ready(function () {
|
||||
$(document).ready(function() {
|
||||
const form = document.querySelector("#otherPolicyTerms");
|
||||
|
||||
// MutationObserver (always runs)
|
||||
const observer = new MutationObserver(() => {
|
||||
$("#otherPolicyTerms").find("input, select, textarea").each(function () {
|
||||
$("#otherPolicyTerms").find("input, select, textarea").each(function() {
|
||||
if (other_auto_save_enable) { // only bind autosave if enabled
|
||||
if (!$(this).attr("data-observed")) {
|
||||
const debouncedSave = debounceothers(autoSaveOtherTerms, 1000);
|
||||
@ -890,18 +1042,103 @@
|
||||
});
|
||||
});
|
||||
|
||||
observer.observe(form, { childList: true, subtree: true });
|
||||
observer.observe(form, {
|
||||
childList: true,
|
||||
subtree: true
|
||||
});
|
||||
|
||||
// Bind for existing fields (only if enabled)
|
||||
if (other_auto_save_enable) {
|
||||
const debouncedSave = debounceothers(autoSaveOtherTerms, 1000);
|
||||
$("#otherPolicyTerms").find("input, select, textarea").each(function () {
|
||||
$("#otherPolicyTerms").find("input, select, textarea").each(function() {
|
||||
$(this).on("input change", debouncedSave);
|
||||
$(this).attr("data-observed", "true");
|
||||
});
|
||||
} else {
|
||||
console.log("This policy has employee processed (autosave disabled) -- OTHERS") ;
|
||||
console.log("This policy has employee processed (autosave disabled) -- OTHERS");
|
||||
}
|
||||
});
|
||||
|
||||
$('#self_others').change(function() {
|
||||
if ($(this).prop('checked')) {
|
||||
$('.self-age').css('display', '');
|
||||
} else {
|
||||
$('.self-age').css('display', 'none');
|
||||
}
|
||||
});
|
||||
|
||||
$('#spouse_others').change(function() {
|
||||
console.log('spouse changed')
|
||||
if ($(this).prop('checked')) {
|
||||
$('.spouse-age').css('display', '');
|
||||
if ($('#spouse_min_age_others').val() < 17 || $('#spouse_min_age_others').val() == '') {
|
||||
$('#spouse_min_age_others').val(18);
|
||||
}
|
||||
if ($('#spouse_max_age_others').val() < 17 || $('#spouse_max_age_others').val() == '') {
|
||||
$('#spouse_max_age_others').val(60);
|
||||
}
|
||||
} else {
|
||||
$('.spouse-age').css('display', 'none');
|
||||
}
|
||||
});
|
||||
|
||||
$('#children_others').change(function() {
|
||||
if ($(this).val() != 0) {
|
||||
$('.child-age').css('display', '');
|
||||
|
||||
if ($('#child_min_age_others').val() < 0 || $('#child_min_age_others').val() == '') {
|
||||
$('#child_min_age_others').val(0);
|
||||
}
|
||||
if ($('#child_max_age_others').val() < 24 || $('#child_max_age_others').val() == '') {
|
||||
$('#child_max_age_others').val(25);
|
||||
}
|
||||
} else {
|
||||
$('.child-age').css('display', 'none');
|
||||
}
|
||||
});
|
||||
|
||||
$('#family_floaters_others').change(function() {
|
||||
|
||||
checkAdditionPremiumJSON()
|
||||
|
||||
var family_floaters = $(this).val();
|
||||
if ($('#family_floaters').val() != 0) {
|
||||
$('.other-member-age').css('display', '');
|
||||
if ($('#other_member_min_age_others').val() < 17 || $('#other_member_min_age_others').val() == '') {
|
||||
$('#other_member_min_age_others').val(18);
|
||||
}
|
||||
if ($('#other_member_max_age_others').val() < 79 || $('#other_member_max_age_others').val() == '') {
|
||||
$('#other_member_max_age_others').val(60);
|
||||
}
|
||||
|
||||
} else {
|
||||
$('.other-member-age').css('display', 'none');
|
||||
}
|
||||
|
||||
if (family_floaters == '1P') {
|
||||
$('#member_count_others').val(1);
|
||||
} else if (family_floaters == '2P') {
|
||||
$('#member_count_others').val(2);
|
||||
} else if (family_floaters == '1PIL') {
|
||||
$('#member_count_others').val(1);
|
||||
} else if (family_floaters == '2PIL') {
|
||||
$('#member_count_others').val(2);
|
||||
} else if (family_floaters == '2EPORPIL') {
|
||||
$('#member_count_others').val(2);
|
||||
} else if (family_floaters == 'EPORPIL') {
|
||||
$('#member_count_others').val(2);
|
||||
} else if (family_floaters == '4EPORPIL') {
|
||||
$('#member_count_others').val(4);
|
||||
}
|
||||
});
|
||||
|
||||
function lowerIsEighteenOthers(params) {
|
||||
var value = $(params).val();
|
||||
|
||||
if (value < 18) {
|
||||
$(params).val(18);
|
||||
} else if (value > 99) {
|
||||
$(params).val(99);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -3522,7 +3522,7 @@ function hideShowPolicyPremium(policy_type_string, unique_id = null)
|
||||
individual = $('#individual_' + unique_id);
|
||||
}
|
||||
|
||||
if (policy_type_string == 'GMC') {
|
||||
if (policy_type_string == 'GMC' || policy_type_string == 'OPD') {
|
||||
premium_type.show();
|
||||
individual.prop('checked', true)
|
||||
} else {
|
||||
|
||||
@ -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();
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@ -3,6 +3,32 @@
|
||||
position: absolute;
|
||||
}
|
||||
.dataTables_length label {height: 21px !important;}
|
||||
.custom-dropdown-menu {
|
||||
display: none;
|
||||
position: absolute;
|
||||
background-color: #ffffff !important;
|
||||
border: 1px solid rgba(0, 0, 0, 0.15);
|
||||
border-radius: 0.25rem;
|
||||
padding: 0.5rem 0;
|
||||
min-width: 10rem;
|
||||
z-index: 9999;
|
||||
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item {
|
||||
display: block !important;
|
||||
width: 100% !important;
|
||||
padding: 0.5rem 1rem !important;
|
||||
color: #212529 !important;
|
||||
text-decoration: none !important;
|
||||
background-color: transparent !important;
|
||||
}
|
||||
|
||||
.custom-dropdown-menu .dropdown-item:hover {
|
||||
background-color: #f8f9fa !important;
|
||||
color: #16181b !important;
|
||||
cursor: pointer !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
<!-- End ADD and EDIT Page HTML -->
|
||||
@ -24,7 +50,7 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php if(isset($data['pos_list'])) { $slno = 1; ?>
|
||||
<?php if(!empty($data['pos_list'])) { $slno = 1; ?>
|
||||
<?php foreach($data['pos_list'] as $index => $row) { ?>
|
||||
<tr>
|
||||
<td class="text-center"><?= $slno++; ?></td>
|
||||
@ -54,12 +80,7 @@
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } else { ?>
|
||||
<tr>
|
||||
<td colspan="3" class="text-center">No data available</td>
|
||||
</tr>
|
||||
<?php } ?>
|
||||
<?php } } ?>
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
@ -480,5 +501,94 @@
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function() {
|
||||
const table = document.getElementById("user-table");
|
||||
|
||||
// Create custom dropdown
|
||||
function createCustomDropdown(row) {
|
||||
// Get the original dropdown items
|
||||
const originalDropdown = row.querySelector('.dropdown-menu');
|
||||
if (!originalDropdown) return null;
|
||||
|
||||
// Create new dropdown with proper background and spacing
|
||||
const customDropdown = document.createElement('div');
|
||||
customDropdown.className = 'custom-dropdown-menu';
|
||||
|
||||
// Copy inner content while maintaining icon alignment
|
||||
customDropdown.innerHTML = originalDropdown.innerHTML;
|
||||
|
||||
return customDropdown;
|
||||
}
|
||||
|
||||
let activeDropdown = null;
|
||||
|
||||
// Add click event listener to rows
|
||||
table.querySelectorAll("tbody tr").forEach(row => {
|
||||
const customDropdown = createCustomDropdown(row);
|
||||
if (!customDropdown) return;
|
||||
|
||||
// Append the custom dropdown to the body
|
||||
document.body.appendChild(customDropdown);
|
||||
|
||||
row.addEventListener("click", function(event) {
|
||||
// Ignore clicks on the action column
|
||||
if (event.target.closest('td:last-child')) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hide any active dropdown
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
}
|
||||
|
||||
// Get click position
|
||||
const rect = event.target.getBoundingClientRect();
|
||||
|
||||
// Position the dropdown with some offset
|
||||
customDropdown.style.display = 'block';
|
||||
customDropdown.style.position = 'fixed';
|
||||
customDropdown.style.left = `${rect.left}px`;
|
||||
customDropdown.style.top = `${rect.bottom + 5}px`; // Add 5px gap
|
||||
|
||||
// Set as active dropdown
|
||||
activeDropdown = customDropdown;
|
||||
|
||||
event.stopPropagation();
|
||||
});
|
||||
|
||||
// Preserve click handlers and add auto-close
|
||||
customDropdown.querySelectorAll('.dropdown-item').forEach(item => {
|
||||
item.addEventListener('click', function(e) {
|
||||
const onclickAttr = this.getAttribute('onclick');
|
||||
if (onclickAttr) {
|
||||
eval(onclickAttr);
|
||||
}
|
||||
|
||||
const href = this.getAttribute('href');
|
||||
if (href && href !== '#') {
|
||||
window.location.href = href;
|
||||
}
|
||||
|
||||
// Close the dropdown after handling the click
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
|
||||
e.stopPropagation();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Close dropdown when clicking outside
|
||||
document.addEventListener("click", function() {
|
||||
if (activeDropdown) {
|
||||
activeDropdown.style.display = 'none';
|
||||
activeDropdown = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@ -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