FIX_PRE_ENROLL : RV

This commit is contained in:
VENKATESHWARAN 2025-02-28 10:00:57 +05:30
parent e589580b48
commit 3f963f06e6
6 changed files with 399 additions and 96 deletions

View File

@ -1021,7 +1021,12 @@ class ClientController extends AdminController
$insurerValue = (string) $this->request->getPost('insurer');
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
if ($insurerValue === null || $insurerValue === '') {
$insurerBranchId = null;
$insurerId = null;
} else {
list($insurerBranchId, $insurerId) = explode('-', $insurerValue);
}
$data['insurer_branch_id'] = $insurerBranchId;

View File

@ -114,6 +114,10 @@ class EmployeeController extends AdminController
// log_message('error',json_encode($data['employees']));
// Set getData in $data array with the processed $filterData
$data['getData'] = $filterData;
$html = view('employee_data_list', $data);
return $this->respond(['status' => true, 'html' => $html], 200);
}
// dd($this->employeeModel->getLastQuery());

View File

@ -76,10 +76,10 @@
<option value="" selected>Select Base Policy</option>
</select>
</div>
<div class="form-group col-md-4">
<!-- <div class="form-group col-md-4">
<label for="policy_no">Policy No<span class="text-danger">*</span></label>
<input value="" type="text" class="form-control" placeholder="Enter Policy Number " name="policy_no" id="policy_no" required>
</div>
</div> -->
</div>

View File

@ -38,6 +38,44 @@
text-align: right;
}
.readonly-select {
pointer-events: none;
background-color: #f0f0f0;
color: #666;
}
</style>
<style>
/* Timeline Design */
.timeline {
position: relative;
padding-left: 30px;
border-left: 3px solid #007bff;
}
.timeline-item {
position: relative;
margin-bottom: 20px;
padding-left: 20px;
}
.timeline-dot {
position: absolute;
left: -10px;
top: 5px;
width: 15px;
height: 15px;
background: #007bff;
border-radius: 50%;
}
.timeline-content {
background: #f8f9fa;
padding: 10px;
border-radius: 5px;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
}
</style>
<?php $pro_rata_total = 0; $gst_total = 0 ?>
@ -141,15 +179,22 @@
<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">
<?php if(in_array($employee['emp_status'], ['draft', 'enrolled', 'active']) && in_array($employee['status'], ['draft', 'enrolled', 'active'])) { ?>
<a class="dropdown-item" onclick="get_emp_master_data_for_update(this, '<?= $employee['employee_id'];?>')" ><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<?php
if
(
(in_array($employee['emp_status'], ['draft', 'enrolled', 'active']) && in_array($employee['status'], ['draft', 'enrolled', 'active']))
) {
?>
<a class="dropdown-item" onclick="get_emp_master_data_for_update(this, '<?= $employee['employee_id'];?>', '<?= $employee['status'];?>')" ><i class="mdi mdi-pencil mr-2 text-muted font-18 vertical-middle"></i>Edit</a>
<!-- <a class="dropdown-item" onclick="get_emp_history(this, '<?= $employee['employee_id'];?>')" > <i class="mdi mdi-history mr-2 text-muted font-18 vertical-middle"></i>Employee History</a> -->
<?php } ?>
<?php if(in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
<a href="<?= base_url('download-e-card/'). $employee['rand_string'] ?>" class="dropdown-item" target="_blank"><i class="mdi mdi-eye mr-2 text-muted font-18 vertical-middle"></i>View E-Card</a>
<?php } ?>
<?php if(in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['email_corporate'] != '' && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
<?php if($employee['relationship'] == 'Self' && in_array($employee['policy_type_id'], [2,3,4,5]) && $employee['email_corporate'] != '' && $employee['emp_status'] == 'active' && $employee['status'] == 'active' && !empty($employee['tpa_id'])) { ?>
<a class="dropdown-item" onclick="send_mail_for_individual_employee_ecard('<?= $employee['id'];?>')" ><i class="mdi mdi-email-alert mr-2 text-muted font-18 vertical-middle"></i>Send E-Card Mail</a>
<?php } ?>
@ -238,12 +283,12 @@
<div class="form-group col-md-12">
<label for="email">Email<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="email_corporate" placeholder="Enter Email" name="email_corporate" data-parsley-trigger="change" data-parsley-type="email" required>
<input type="text" class="form-control" id="email_corporate" placeholder="Enter Email" name="email_corporate" data-parsley-trigger="change" data-parsley-type="email" onchange="validateInput(this, 'employees', 'email_corporate')" required>
</div>
<div class="form-group col-md-12">
<label for="mobile">Mobile Number<span class="text-danger">*</span></label>
<input type="text" class="form-control" id="mobile" placeholder="Enter Mobile Number" name="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" required>
<input type="text" class="form-control" id="mobile" placeholder="Enter Mobile Number" name="mobile" onkeypress = "return onlyNumbers(event)" maxlength="10" minlength="10" onchange="validateInput(this, 'employees', 'mobile')" required>
</div>
</div>
@ -259,14 +304,30 @@
</div>
</div><!-- /.modal -->
<!-- Modal content for Emp History -->
<div class="modal fade" id="emp_history_modal" tabindex="-1" aria-labelledby="emp_history_modal_label" aria-hidden="true">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title" id="emp_history_modal_label">Employee History</h4>
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div>
<div id = "emp_history_content"></div>
</div>
</div>
</div>
<script>
$(document).ready(function(){
var dob = flatpickr("#dob", {
dateFormat: "d/M/Y",
allowInput: false
dateFormat: "d/m/Y",
allowInput: false, // Allows manual input
yearSelector: true, // Ensures year can be selected manually
});
})
$(document).ready(function() {
@ -353,6 +414,7 @@
myModal.show();
}else{
$('#employee_primary_id').val('');
$('#emp_code_for_edit').val('');
$('#name').val('');
@ -424,7 +486,8 @@
$('#email_corporate').val('');
$('#mobile').val('');
window.location.reload();
// window.location.reload();
fetchEmpolyeeList();
}else{
toastr.error(response.message, 'ERROR');
@ -503,4 +566,135 @@
});
}
function validateInput(input, table, field){
let value = $(input).val();
let label = $(input).closest('.form-group').find('label').text().replace('*', '').trim();
let message = "Value is duplicate!";
if(label){
message = label + " already exists!";
}
checkDuplicateTableFieldValue(table, field, value, function(isDuplicate) {
if (isDuplicate) {
toastr.warning(message, 'WARNING');
$(input).val('')
}
});
}
function onlyNumbers(event) {
var charcode;
charcode = event.which || event.keyCode;
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
return false;
}
var modalInstance; // Store the modal instance globally
function showModal() {
var myModalEl = document.getElementById('emp_history_modal');
modalInstance = new bootstrap.Modal(myModalEl, {
backdrop: true, // Ensures the backdrop is shown
keyboard: true // Allows closing with the Escape key
});
modalInstance.show();
}
function closeModal() {
if (modalInstance) {
modalInstance.hide(); // Hide the modal and its backdrop
// Manually remove backdrop if it's still visible
setTimeout(function () {
document.querySelector('.modal-backdrop').classList.remove('show');
}, 150); // Wait for animation to finish
}
}
function get_emp_history(input, emp_id) {
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
let url = '<?= base_url("employee/get_emp_history")?>';
let requestData = { emp_id: emp_id };
sendAjaxRequestForGlobal(url, 'POST', requestData, function(response) {
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
if (response.status === true) {
console.log('response data length', response.data.emp_history.length);
// **Clear old data**
$('#emp_history_content').html('');
// **Check if data exists**
if (response.data.emp_history.length > 0) {
let historyTable = `
<div class="card-body">
<div class="table-responsive">
<table class="table w-100">
<thead class="bg-light">
<tr>
<th>Field</th>
<th>Change</th>
<th>User</th>
<th>Date/Time</th>
</tr>
</thead>
<tbody>
`;
// **Loop through the data dynamically**
response.data.emp_history.forEach(row => {
historyTable += `
<tr>
<td>${row.field_name}</td>
<td>${row.old_value} => ${row.new_value}</td>
<td>${row.created_by}</td>
<td>${row.created_at}</td>
</tr>
`;
});
historyTable += `
</tbody>
</table>
</div>
</div>
`;
// **Append to modal**
$('#emp_history_content').append(historyTable);
} else {
$('#emp_history_content').html('<p class="text-center text-muted">No history available.</p>');
}
// **Show the modal**
showModal();
} else {
let message = response.message;
toastr.error(message, 'ERROR');
}
}, function(xhr, status, error) {
console.error('Error fetching data:', error);
console.error(xhr.responseText);
toastr.error('An error occurred while fetching the report page.', 'ERROR');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
});
}
// function closeModal(){
// var myModalEl = document.getElementById('emp_history_modal');
// var modalInstance = bootstrap.Modal.getInstance(myModalEl);
// if (modalInstance) {
// modalInstance.hide();
// }
// }
</script>

View File

@ -135,31 +135,105 @@ table.dataTable tbody td {
<?php include('employee_data_list.php');?>
<?php // include('employee_data_list.php');?>
<div id="employee_table_list"></div>
<!-- end row -->
<div id="loader" class="loader" style="display:none;">SPINNER</div>
<script>
document.addEventListener("DOMContentLoaded", function () {
const table = document.getElementById("tickets-table");
// document.addEventListener("DOMContentLoaded", function () {
// const table = document.getElementById("tickets-table");
// Create custom dropdown
function createCustomDropdown(row) {
// Get the original dropdown items
const originalDropdown = row.querySelector('.dropdown-menu');
if (!originalDropdown) return null;
// // 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';
// // 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;
// // Copy inner content while maintaining icon alignment
// customDropdown.innerHTML = originalDropdown.innerHTML;
return customDropdown;
}
// return customDropdown;
// }
// let activeDropdown = null;
// // Add click event listener to rows
// table.querySelectorAll("tbody tr").forEach(row => {
// const customDropdown = createCustomDropdown(row);
// if (!customDropdown) return;
// 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;
// }
// });
// });
document.addEventListener("DOMContentLoaded", init);
function init() {
const table = document.getElementById("tickets-table");
let activeDropdown = null;
// Add click event listener to rows
@ -170,63 +244,75 @@ document.addEventListener("DOMContentLoaded", function () {
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();
handleRowClick(event, customDropdown);
});
// 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();
handleItemClick(e, item);
});
});
});
// Close dropdown when clicking outside
document.addEventListener("click", function() {
document.addEventListener("click", handleDocumentClick);
function createCustomDropdown(row) {
const originalDropdown = row.querySelector('.dropdown-menu');
if (!originalDropdown) return null;
const customDropdown = document.createElement('div');
customDropdown.className = 'custom-dropdown-menu';
customDropdown.innerHTML = originalDropdown.innerHTML;
return customDropdown;
}
function handleRowClick(event, customDropdown) {
if (event.target.closest('td:last-child')) return;
if (activeDropdown) {
activeDropdown.style.display = 'none';
}
const rect = event.target.getBoundingClientRect();
customDropdown.style.display = 'block';
customDropdown.style.position = 'fixed';
customDropdown.style.left = `${rect.left}px`;
customDropdown.style.top = `${rect.bottom + 5}px`;
activeDropdown = customDropdown;
event.stopPropagation();
}
function handleItemClick(e, item) {
const onclickAttr = item.getAttribute('onclick');
if (onclickAttr) {
eval(onclickAttr);
}
const href = item.getAttribute('href');
if (href && href !== '#') {
window.location.href = href;
}
if (activeDropdown) {
activeDropdown.style.display = 'none';
activeDropdown = null;
}
});
});
e.stopPropagation();
}
function handleDocumentClick() {
if (activeDropdown) {
activeDropdown.style.display = 'none';
activeDropdown = null;
}
}
}
</script>
<script>
@ -468,8 +554,11 @@ function objectToQueryString(obj) {
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
}
function fetchEmpolyeeList(event) {
event.preventDefault(); // Prevent default action
function fetchEmpolyeeList(event = null) {
if(event){
event.preventDefault(); // Prevent default action
}
var client_id = $('#clients').val();
var policy_id = $('#policies').val();
@ -502,24 +591,35 @@ function fetchEmpolyeeList(event) {
const queryString = objectToQueryString(queryParams);
const apiURL = $('#get-emp-list').attr('href') + "?" + queryString;
// console.log(apiURL);
window.location.href = apiURL;
// window.location.href = apiURL;
$('.loader').fadeIn();
$('.loader-mask').fadeIn();
// var apiURL2 = $('#get-emp-list').attr('href'); // Get href attribute value
// console.log(apiURL);
// $.ajax({
// url: apiURL,
// method: 'GET',
// data: queryParams,
// success: function(response) {
// // Assuming response is a JSON array
// // displayDataTables(response);
// console.log(response);
// },
// error: function(xhr, status, error) {
// console.error('Error:', error);
// }
// });
console.log(apiURL);
$.ajax({
url: apiURL,
method: 'GET',
data: queryParams,
success: function(response) {
if(response.status == true){
$('#employee_table_list').html(response.html);
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
setTimeout(function(){
init()
}, 1000)
}
},
error: function(xhr, status, error) {
console.error('Error:', error);
toastr.error('Failed to fetch Data','Error');
$('.loader').fadeOut();
$('.loader-mask').delay(350).fadeOut('slow');
}
});
}

View File

@ -602,19 +602,19 @@
</a>
<div class="collapse" id="sidebarDashboards">
<ul class="nav-second-level">
<!-- <li>
<li>
<a href="<?= base_url('/master/insurer/list') ?>">Insurer</a>
</li>
<li>
<a href="<?= base_url('/master/tpa/list') ?>">TPA</a>
</li>
<li>
<!-- <li>
<a href="<?= base_url('/master/kyc/list') ?>">KYC</a>
</li>
</li> -->
<li>
<a href="<?= base_url('/master/policy/list') ?>">Policy</a>
</li>
<li>
<!-- <li>
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
</li>
<li>
@ -644,7 +644,7 @@
</a>
</li> -->
<li>
<!-- <li>
<a id="app_content_management" href="#sidebarDashboardsmenu" data-toggle="collapse" class="waves-effect" style="color: grey;">
<i class="fa fa-info-circle" aria-hidden="true"></i>
<span class="badge badge-success badge-pill float-right">2</span>
@ -660,7 +660,7 @@
</li>
</ul>
</div>
</li>
</li> -->
<!-- leads -->
<!-- <li>
@ -672,7 +672,7 @@
<?php if((get_role_id() == 1 || get_role_id() == 5) && (in_array(BUSINESS_TEAM_ID, user_team()) || in_array(FINANCE_TEAM_ID, user_team()) || in_array(MANAGEMENT_TEAM_ID, user_team()))) { ?>
<li>
<!-- <li>
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect">
<i class="mdi mdi-format-list-bulleted"></i>
<span class="badge badge-success badge-pill float-right">2</span>
@ -693,9 +693,9 @@
<a href="<?= base_url('/policy_tranction/statement/list') ?>">Statement upload</a>
</li>
<!-- <li>
<li>
<a href="<?= base_url('/policy_tranction/report/list') ?>">BDS</a>
</li> -->
</li>
<li>
<a href="<?= base_url('/policy_tranction/report/report-varience-list') ?>">Variance</a>
</li>
@ -726,7 +726,7 @@
</li>
</ul>
</div>
</li>
</li> -->
<?php } ?>