FIX_Velmurugan told me to add postDB[encrypt] in DataBase.php config Folder And View Member Client dropdown fixes and Dashbaord SSession Enrollment_data removed
This commit is contained in:
parent
5e3c7c4f33
commit
64ac479c30
@ -134,6 +134,10 @@ class Database extends Config
|
|||||||
'ssl_ca' => ROOTPATH . 'ca.pem',
|
'ssl_ca' => ROOTPATH . 'ca.pem',
|
||||||
'ssl_verify' => true,
|
'ssl_verify' => true,
|
||||||
];
|
];
|
||||||
|
$this->preDB['encrypt'] = [
|
||||||
|
'ssl_ca' => ROOTPATH . 'ca.pem',
|
||||||
|
'ssl_verify' => true,
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -238,7 +238,7 @@ class DashboardController extends AdminController
|
|||||||
|
|
||||||
$data['client_branch_emp_list'] = $results;
|
$data['client_branch_emp_list'] = $results;
|
||||||
$session = \Config\Services::session();
|
$session = \Config\Services::session();
|
||||||
$session->set('enrollment_data', json_encode($data));
|
// $session->set('enrollment_data', json_encode($data));
|
||||||
|
|
||||||
$data['pendingActionsData'] = $pendingActionsData;
|
$data['pendingActionsData'] = $pendingActionsData;
|
||||||
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
$data['businessTeamCount'] = count($businessTeamData) ?? 0;
|
||||||
|
|||||||
@ -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
|
// Declare a global variable to store API response data
|
||||||
var clientPolicies = [];
|
// var clientPolicies = [];
|
||||||
var clientPoliciesWithBranch = {
|
// var clientPoliciesWithBranch = {
|
||||||
policies: []
|
// policies: []
|
||||||
};
|
// };
|
||||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||||
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
var client_branch_id = '<?= isset($getData) ? $getData['branch_id'] : '0' ?>';
|
||||||
|
|
||||||
@ -376,91 +419,91 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
$(document).ready(function() {
|
// $(document).ready(function() {
|
||||||
console.log("document loaded");
|
// console.log("document loaded");
|
||||||
//fetchClientPolicies();
|
// //fetchClientPolicies();
|
||||||
});
|
// });
|
||||||
|
|
||||||
$(window).on("load", function() {
|
// $(window).on("load", function() {
|
||||||
console.log("window loaded");
|
// console.log("window loaded");
|
||||||
fetchClientPolicies();
|
// fetchClientPolicies();
|
||||||
});
|
// });
|
||||||
|
|
||||||
function fetchClientPolicies() {
|
// function fetchClientPolicies() {
|
||||||
$('#loader').show();
|
// $('#loader').show();
|
||||||
var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
|
// var apiURL = '<?php echo base_url(); ?>' + 'util/clients-with-policies';
|
||||||
console.log('fetchClientPolicies');
|
// console.log('fetchClientPolicies');
|
||||||
// console.log(apiURL);
|
// // console.log(apiURL);
|
||||||
$.ajax({
|
// $.ajax({
|
||||||
url: apiURL,
|
// url: apiURL,
|
||||||
method: 'GET',
|
// method: 'GET',
|
||||||
headers: {
|
// headers: {
|
||||||
"Content-Type": "application/json",
|
// "Content-Type": "application/json",
|
||||||
"X-Requested-With": "XMLHttpRequest"
|
// "X-Requested-With": "XMLHttpRequest"
|
||||||
},
|
// },
|
||||||
success: function(response) {
|
// success: function(response) {
|
||||||
// console.log(response.code);
|
// // console.log(response.code);
|
||||||
// console.log(response.dataStatus);
|
// // console.log(response.dataStatus);
|
||||||
// console.log(response.data);
|
// // console.log(response.data);
|
||||||
if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
// if (response.code === 200 && response.dataStatus === true && response.data !== "") {
|
||||||
try {
|
// try {
|
||||||
clientPolicies = (response.data);
|
// clientPolicies = (response.data);
|
||||||
|
|
||||||
response.data.forEach(policy => {
|
// response.data.forEach(policy => {
|
||||||
// console.log('policies', policy.policies);
|
// // console.log('policies', policy.policies);
|
||||||
policy.policies.forEach(p => {
|
// policy.policies.forEach(p => {
|
||||||
clientPoliciesWithBranch.policies.push(p);
|
// clientPoliciesWithBranch.policies.push(p);
|
||||||
});
|
// });
|
||||||
});
|
// });
|
||||||
|
|
||||||
// console.log('1',clientPolicies);
|
// // console.log('1',clientPolicies);
|
||||||
appendClients(clientPolicies);
|
// appendClients(clientPolicies);
|
||||||
|
|
||||||
//this function for reselect the policy
|
// //this function for reselect the policy
|
||||||
setTimeout(function() {
|
// setTimeout(function() {
|
||||||
if (client_id != 0) {
|
// if (client_id != 0) {
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
// var foundPolicies = clientPolicies.find(function(item) {
|
||||||
// console.log(typeof item.id)
|
// // console.log(typeof item.id)
|
||||||
return item.id == client_id;
|
// return item.id == client_id;
|
||||||
});
|
// });
|
||||||
appendBranch(foundPolicies.branchs);
|
// appendBranch(foundPolicies.branchs);
|
||||||
}
|
// }
|
||||||
}, 500);
|
// }, 500);
|
||||||
|
|
||||||
setTimeout(function() {
|
// setTimeout(function() {
|
||||||
if (client_branch_id != 0) {
|
// if (client_branch_id != 0) {
|
||||||
|
|
||||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
// var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||||
// console.log('item', item);
|
// // console.log('item', item);
|
||||||
return item.branch_id === client_branch_id;
|
// return item.branch_id === client_branch_id;
|
||||||
});
|
// });
|
||||||
|
|
||||||
if (foundPolicies) {
|
// if (foundPolicies) {
|
||||||
// console.log('foundPolicies', foundPolicies);
|
// // console.log('foundPolicies', foundPolicies);
|
||||||
appendPolicies(foundPolicies);
|
// appendPolicies(foundPolicies);
|
||||||
} else {
|
// } else {
|
||||||
console.log('No policies found for the selected client');
|
// console.log('No policies found for the selected client');
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
}, 500);
|
// }, 500);
|
||||||
//end
|
// //end
|
||||||
|
|
||||||
} catch (error) {
|
// } catch (error) {
|
||||||
console.error('Error parsing API response data:', error);
|
// console.error('Error parsing API response data:', error);
|
||||||
}
|
// }
|
||||||
} else if (response.code === 404 && response.dataStatus === false) {
|
// } else if (response.code === 404 && response.dataStatus === false) {
|
||||||
console.error('no data found', response);
|
// console.error('no data found', response);
|
||||||
} else {
|
// } else {
|
||||||
console.error('Something went wrong!');
|
// console.error('Something went wrong!');
|
||||||
}
|
// }
|
||||||
},
|
// },
|
||||||
error: function(xhr, status, error) {
|
// error: function(xhr, status, error) {
|
||||||
console.error('Error fetching data from API:', error);
|
// console.error('Error fetching data from API:', error);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
|
|
||||||
$('#loader').hide();
|
// $('#loader').hide();
|
||||||
}
|
// }
|
||||||
|
|
||||||
function appendClients(data) {
|
function appendClients(data) {
|
||||||
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||||
@ -507,8 +550,9 @@
|
|||||||
// console.log(PolicyID)
|
// console.log(PolicyID)
|
||||||
$.each(data, function(index, item) {
|
$.each(data, function(index, item) {
|
||||||
var option = $('<option>', {
|
var option = $('<option>', {
|
||||||
value: item.client_policy_id,
|
// value: item.client_policy_id,
|
||||||
// text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
// text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||||
|
value: item.id,
|
||||||
text: `${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
text: `${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
||||||
});
|
});
|
||||||
if (PolicyID == item.client_policy_id) {
|
if (PolicyID == item.client_policy_id) {
|
||||||
@ -522,6 +566,9 @@
|
|||||||
|
|
||||||
$('#clients').on('change', function() {
|
$('#clients').on('change', function() {
|
||||||
|
|
||||||
|
$('#branch_id').empty();
|
||||||
|
$('#branch_id').append($('<option>', { value: '0', text: 'Select'}));
|
||||||
|
|
||||||
$('#policies').empty();
|
$('#policies').empty();
|
||||||
$('#policies').append($('<option>', {
|
$('#policies').append($('<option>', {
|
||||||
value: '0',
|
value: '0',
|
||||||
@ -529,15 +576,16 @@
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
var selectedClient = $(this).val();
|
var selectedClient = $(this).val();
|
||||||
// console.log('selectedClient', selectedClient);
|
// alert(selectedClient);
|
||||||
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
|
// console.log(branch_list);
|
||||||
|
var filteredBranch = branch_list[selectedClient];
|
||||||
|
|
||||||
// Check if the selected option exists in apiData
|
if (filteredBranch) {
|
||||||
var foundPolicies = clientPolicies.find(function(item) {
|
console.log("Found Data for Client " + selectedClient, filteredBranch);
|
||||||
return item.id === selectedClient;
|
appendBranch(filteredBranch);
|
||||||
});
|
} else {
|
||||||
// console.log(foundPolicies.branchs);
|
console.warn("No data found for client ID: " + selectedClient);
|
||||||
appendBranch(foundPolicies.branchs);
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -545,26 +593,23 @@
|
|||||||
|
|
||||||
$('#branch_id').on('change', function() {
|
$('#branch_id').on('change', function() {
|
||||||
|
|
||||||
var selectedClient = $(this).val();
|
var selectedBranch = $(this).val();
|
||||||
|
var selectedClient = $('#clients').val();
|
||||||
// console.log('selectedBranch', selectedClient);
|
var filteredPoliciesByClient = policy_list_by_client[selectedClient];
|
||||||
// console.log('clientPolicies', clientPoliciesWithBranch);
|
|
||||||
|
var filteredPoliciesByBranch = filteredPoliciesByClient.filter(function(item) {
|
||||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
|
||||||
// console.log('item', 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) {
|
if (Array.isArray(filteredPoliciesByBranch) && filteredPoliciesByBranch.length === 0) {
|
||||||
|
appendPolicies(filteredPoliciesByBranch);
|
||||||
appendPolicies(foundPolicies);
|
|
||||||
toastr.warning('No policies found for the selected client branch.');
|
toastr.warning('No policies found for the selected client branch.');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
appendPolicies(filteredPoliciesByBranch);
|
||||||
// console.log('foundPolicies', foundPolicies);
|
|
||||||
appendPolicies(foundPolicies);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@ -412,7 +412,7 @@
|
|||||||
|
|
||||||
function appendBranch2(data) {
|
function appendBranch2(data) {
|
||||||
|
|
||||||
// console.log(data)
|
// console.log(data)
|
||||||
|
|
||||||
$('#client_branch_id').empty();
|
$('#client_branch_id').empty();
|
||||||
$('#client_branch_id').append($('<option>', {
|
$('#client_branch_id').append($('<option>', {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user