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

This commit is contained in:
velz 2024-03-29 17:08:07 +05:30
commit 2c1de1d2bf
5 changed files with 192 additions and 149 deletions

View File

@ -1,3 +1,14 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
</style>
<div class="row" id="client_list">
<div class="col-12">
<div class="card">

View File

@ -1,53 +1,62 @@
<style>
.table th,
.table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
</style>
<br>
<div class="row">
<div class="col-12">
<div class="card">
<div class="card-body">
<!-- <div class="text-center"> -->
<div class="row">
<div class="col-md-6 col-xl-3">
<div class="form-group mb-3">
<label>Client</label> <br/>
<select class="form-control" id="clients">
<option value="0">Select</option>
</select>
</div>
</div>
<div class="col-md-6 col-xl-3">
<div class="form-group mb-3">
<label>Policy</label> <br/>
<select class="form-control" id="policies">
<option value="0">Select</option>
</select>
</div>
</div>
</div>
<div class="row">
<div class="col-12" style="text-align: right;">
<a href="<?= base_url("employee/list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
</div>
</div>
<!-- </div> -->
</div>
</div>
<div class="row">
<div class="col-xl-6">
<div id="accordion" class="mb-3">
<div class="card mb-1">
<h5 class="m-1">
<a id="toggleIcon" class="text-dark float-right" data-toggle="collapse" href="#collapseOne"
aria-expanded="true">
<i id="icon" class="mdi mdi-chevron-down mr-1 text-primary" style="font-size: 28px;"></i>
</a>
</h5>
<div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
<div class="card-body">
<!-- <div class="text-center"> -->
<div class="row">
<div class="col-md-6 col-xl-3">
<div class="form-group mb-3">
<label>Client</label> <br />
<select class="form-control" id="clients">
<option value="0">Select</option>
</select>
</div>
</div>
<div class="col-md-6 col-xl-3">
<div class="form-group mb-3">
<label>Policy</label> <br />
<select class="form-control" id="policies">
<option value="0">Select</option>
</select>
</div>
</div>
</div>
<!-- start page title -->
<div class="row">
<div class="col-12">
<div class="page-title-box page-title-box-alt">
<h4 class="page-title"></h4>
<div class="page-title-right">
<div class="row">
<div class="col-12" style="text-align: right;">
<a href="<?= base_url("employee/list"); ?>"
class="btn btn-primary waves-effect waves-light" id="get-emp-list"
onclick="fetchEmpolyeeList(event);">Submit</a>
</div>
</div>
<!-- </div> -->
</div>
</div>
</div>
</div>
</div>
</div>
<!-- end page title -->
</div>
<div class="row" id="client_list">
<div class="col-12">
<div class="card">
@ -56,22 +65,23 @@
<div class="col-6" style="align-self: center;">
<h4 class="header-title" style="position: relative;">Employees</h4>
</div>
</div>
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0" id="tickets-table">
<table class="table table-hover m-0 table-centered dt-responsive nowrap w-100" cellspacing="0"
id="tickets-table">
<thead class="bg-light">
<tr>
<th class="font-weight-medium">SNO</th>
<th class="font-weight-medium">Employee code</th>
<th class="font-weight-medium">Name</th>
<th class="font-weight-medium">Policy name</th>
<th class="font-weight-medium">Insurar name</th>
<th class="font-weight-medium">TPA ID</th>
<th class="font-weight-medium">UHID ID</th>
<th class="font-weight-medium">Policy status</th>
<th class="font-weight-medium">Premium</th>
<th class="font-weight-medium">Action</th>
</tr>
<tr>
<th class="font-weight-medium">SNO</th>
<!-- <th class="font-weight-medium">Employee code</th> -->
<th class="font-weight-medium">Name/code</th>
<th class="font-weight-medium">Policy name</th>
<th class="font-weight-medium">Insurar name</th>
<th class="font-weight-medium">TPA ID</th>
<th class="font-weight-medium">UHID ID</th>
<th class="font-weight-medium">Policy status</th>
<th class="font-weight-medium">Premium</th>
<th class="font-weight-medium">Action</th>
</tr>
</thead>
<tbody class="font-12">
@ -79,11 +89,11 @@
if(isset($employees))
{
foreach ($employees as $key => $employee) { ?>
<tr>
<td><b><?php echo ($key + 1)?></b></td>
<td><?php echo $employee['emp_code']?></td>
<td><?php echo $employee['name']?></td>
<!-- <td><?php echo $employee['emp_code']?></td> -->
<td><?php echo $employee['name']?>( <?php echo $employee['emp_code']?> )</td>
<td><?php echo $employee['policy_name']?></td>
<td><?php echo $employee['insurer_short_name']?></td>
<td><?php echo $employee['tpa_id']?></td>
@ -92,18 +102,26 @@
<td><?php echo $employee['premium']?></td>
<td>
<div class="btn-group dropdown">
<a href="javascript: void(0);" class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown" aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<a href="javascript: void(0);"
class="dropdown-toggle arrow-none btn btn-light btn-sm" data-toggle="dropdown"
aria-expanded="false"><i class="mdi mdi-dots-horizontal"></i></a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item" href="#"><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit Ticket</a>
<a class="dropdown-item" href="#"><i class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
<a class="dropdown-item" href="#"><i class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
<a class="dropdown-item" href="#"><i class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as Unread</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit
Ticket</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-check-all mr-2 text-muted font-18 vertical-middle"></i>Close</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-delete mr-2 text-muted font-18 vertical-middle"></i>Remove</a>
<a class="dropdown-item" href="#"><i
class="mdi mdi-star mr-2 font-18 text-muted vertical-middle"></i>Mark as
Unread</a>
</div>
</div>
</td>
</tr>
<?php }}?>
</tbody>
</table>
</div>
@ -114,98 +132,97 @@
<div id="loader" class="loader" style="display:none;">SPINNER</div>
<script>
// Declare a global variable to store API response data
var clientPolicies = [];
// Declare a global variable to store API response data
var clientPolicies = [];
$( document ).ready(function() {
console.log( "document loaded" );
//fetchClientPolicies();
});
$( window ).on( "load", function() {
console.log( "window loaded" );
fetchClientPolicies();
});
$(document).ready(function() {
console.log("document loaded");
//fetchClientPolicies();
});
$(window).on("load", function() {
console.log("window loaded");
fetchClientPolicies();
});
function 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);
// console.log(clientPolicies);
appendClients(clientPolicies);
} catch (error)
{
console.error('Error parsing API response data:', error);
}
} else if(response.code === 404 && response.dataStatus === false){
console.error('no data found', response);
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);
// console.log(clientPolicies);
appendClients(clientPolicies);
} 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);
}
else
{
console.error('Something went wrong!');
}
},
error: function(xhr, status, error) {
console.error('Error fetching data from API:', error);
}
});
$('#loader').hide();
}
}
function appendClients(data) {
function appendClients(data) {
$.each(data, function(index, item) {
$('#clients').append($('<option>', {
value: item.id,
text: item.client_name
}));
$('#clients').append($('<option>', {
value: item.id,
text: item.client_name
}));
});
}
}
function appendPolicies(data) {
function appendPolicies(data) {
$('#policies').empty();
$('#policies').append($('<option>', { value: '0',text: 'Select'}));
$('#policies').append($('<option>', {
value: '0',
text: 'Select'
}));
$.each(data, function(index, item) {
$('#policies').append($('<option>', {
value: item.id,
text: item.name
}));
$('#policies').append($('<option>', {
value: item.id,
text: item.name
}));
});
}
}
$('#clients').on('change', function() {
var selectedClient = $(this).val();
console.log(selectedClient);
// $('#selectedOptionInfo').text('Selected option: ' + selectedOption);
// Check if the selected option exists in apiData
var foundPolicies = clientPolicies.find(function(item) {
return item.id === selectedClient;
return item.id === selectedClient;
});
console.log(foundPolicies.policies);
appendPolicies(foundPolicies.policies);
});
console.log(foundPolicies.policies);
appendPolicies(foundPolicies.policies);
});
// Function to convert object to query parameters
function objectToQueryString(obj) {
@ -214,25 +231,25 @@ function objectToQueryString(obj) {
function fetchEmpolyeeList(event) {
event.preventDefault(); // Prevent default action
var client_id = $('#clients').val();
var policy_id = $('#policies').val();
console.log(client_id+'-'+policy_id);
if (client_id == '0' || policy_id == '0' ) {
console.log(client_id + '-' + policy_id);
if (client_id == '0' || policy_id == '0') {
alert('Please select values in both dropdowns.');
return;
}
var queryParams = {
client_id: client_id,
policy_id: policy_id
};
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href')+"?" + queryString;
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
console.log(apiURL);
window.location.href = apiURL;
// var apiURL2 = $('#get-emp-list').attr('href'); // Get href attribute value
// console.log(apiURL);
@ -251,5 +268,9 @@ function fetchEmpolyeeList(event) {
// });
}
</script>
document.getElementById('toggleIcon').addEventListener('click', function() {
var icon = document.getElementById('icon');
icon.classList.toggle('mdi-chevron-down');
icon.classList.toggle('mdi-chevron-up');
});
</script>

View File

@ -1,4 +1,14 @@
<style>
.table th, .table td {
padding: 8px;
}
table.dataTable tbody td {
padding: 4px 4px !important;
}
</style>
<div class="row" id="client_add" style="position: relative; bottom: 25px;">
<div class="col-12">

View File

@ -393,7 +393,7 @@
<li class="dropdown notification-list topbar-dropdown">
<a class="nav-link dropdown-toggle nav-user mr-0 waves-effect waves-light" data-toggle="dropdown" href="#" role="button" aria-haspopup="false" aria-expanded="false">
<img src="<?= get_userProfile() != null && !empty(get_userProfile()) ? get_userProfile() : base_url() . 'public/assets/images/avatar_2x.png' ?>" alt="user-image" class="rounded-circle">
<img src="<?php echo (get_userProfile() != null && !empty(get_userProfile())) ? get_userProfile() : base_url() . 'public/assets/images/avatar_2x.png'; ?>" alt="user-image" class="rounded-circle">
<span class="pro-user-name ml-1" style="font-size: 16px;" >
<?= (isset(get_session_userdata()->first_name) ? get_session_userdata()->first_name : 'NOT SET') ?>
<!-- <i class="mdi mdi-chevron-down"></i> -->

View File

@ -13,11 +13,12 @@
.radiobuttondiv{
margin-left: 32px;
}
.{
/* .{
width:62% !important;
margin-left: 30px;
margin-top: 3px
}
} */
/* .form-group.col-md-6 */
.form-group-client-policy-master{
display:-webkit-box;
@ -48,14 +49,14 @@
.jodit-status-bar{
display:none;
}
.jodit-container{
/* width: 821px !important; */
/* margin-top: 3px; */
/* margin-bottom: 3px; */
/* margin-left: 30px; */
/* height: 0px !important; */
/* min-height: 100px !important; */
}
/* .jodit-container{
width: 821px !important;
margin-top: 3px;
margin-bottom: 3px;
margin-left: 30px;
height: 0px !important;
min-height: 100px !important;
} */
.input-group {
width: 64.5% !important;
}
@ -643,7 +644,7 @@ var grid_html = '';
var gmc_policy_type_id = $(this).attr('id');
if(gmc_policy_type_id >= '2'){
if(gmc_policy_type_id >= 2){
$('#policyGMCTerms').css('display', '');
$('#police-tab').css('display', 'none');