891 lines
31 KiB
PHP
891 lines
31 KiB
PHP
<style>
|
|
.accordion {
|
|
margin-bottom: 1rem;
|
|
}
|
|
|
|
.accordion h4 {
|
|
font-weight: bold;
|
|
cursor: pointer;
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
background-color: #438e96;
|
|
color: #fff;
|
|
border-radius: 10px;
|
|
font-size: 17px;
|
|
padding-left: 13px;
|
|
padding-top: 3px;
|
|
padding-bottom: 3px;
|
|
padding-right: 12px;
|
|
}
|
|
|
|
.accordion-content {
|
|
display: none;
|
|
padding: 10px;
|
|
background-color: #bfe0e2;
|
|
margin-top: 5px;
|
|
border-radius: 7px;
|
|
margin: 5px;
|
|
}
|
|
|
|
.accordion-content.show {
|
|
display: block;
|
|
}
|
|
|
|
.arrow {
|
|
transition: transform 0.2s;
|
|
}
|
|
|
|
.arrow.rotate {
|
|
transform: rotate(90deg);
|
|
}
|
|
</style>
|
|
|
|
|
|
<?php
|
|
if (!isset($view_ticket_page)) {
|
|
if ($selected_ticket_type == 1) {
|
|
include('ticket_form_gmc.php');
|
|
} else {
|
|
include('ticket_form_gpa.php');
|
|
}
|
|
}
|
|
|
|
?>
|
|
|
|
<div class="modal fade" id="empDetailsModal" tabindex="-1" role="dialog" aria-labelledby="empDetailsModalLabel"
|
|
aria-hidden="true" aria-modal="true" data-backdrop="static">
|
|
<div class="modal-dialog modal-lg" role="document">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="empDetailsModalLabel">Fetch Employee Data</h5>
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"
|
|
onclick="toResetTheModelFields()">
|
|
<span aria-hidden="true">×</span>
|
|
</button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<div class="accordion">
|
|
<!-- Search by Mobile Number -->
|
|
<div>
|
|
<h4 onclick="toggleAccordion('mobileAccordion')">
|
|
Search by Mobile Number
|
|
<span class="arrow" id="mobileArrow">➤</span>
|
|
</h4>
|
|
<div class="accordion-content" id="mobileAccordion">
|
|
<div id="mobileSearch" class="search-method">
|
|
<div class="row">
|
|
|
|
<div class="col-md-3" style="display:true;">
|
|
<div class="form-group">
|
|
<label>Employee Data Points</label>
|
|
<select name="employee_data_points" id="employee_data_points"
|
|
class="form-control">
|
|
<option value="mobile">Mobile Number</option>
|
|
<option value="emp_code">Employee ID</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-3">
|
|
<div class="form-group">
|
|
<label>Client</label>
|
|
<select id="mobile_emp_client_data_list" name="client"
|
|
class="form-control custom-select">
|
|
<option value="0">Select Client</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label id="employee_data_points_label">Mobile Number</label>
|
|
<input class="form-control" type="text" id="emp_mobile_number_for_claim"
|
|
name="mobile_numbers" onkeypress="return onlyNumbers(event)"
|
|
maxlength="10">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>Insured List</label>
|
|
<select name="employee_by_number" id="member_by_number"
|
|
class="form-control SelExample" onchange="setMemberData(this)">
|
|
<option value="0">Select Member</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-4">
|
|
</div>
|
|
|
|
<div class="col-md-2">
|
|
<div class="form-group" style="margin-top: 9px; float:right;">
|
|
<br>
|
|
<button class="btn btn-primary"
|
|
onclick="getTheEmpDataForClaimSearchByMobile(this)">Search</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Search by Client, Branch, and Policy -->
|
|
<div class="mt-4">
|
|
<h4 onclick="toggleAccordion('clientBranchAccordion')">
|
|
Search by Client, Branch, and Policy
|
|
<span class="arrow" id="clientBranchArrow">➤</span>
|
|
</h4>
|
|
<div class="accordion-content" id="clientBranchAccordion">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>Client</label>
|
|
<select id="emp_client_data_list" name="client"
|
|
class="form-control custom-select">
|
|
<option value="0">Select Client</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>Branch</label>
|
|
<select id="emp_client_branch_data_list" name="branch"
|
|
class="form-control custom-select">
|
|
<option value="0">Select Branch</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>Policy</label>
|
|
<select id="emp_client_policy_data_list" name="policy_client_branch"
|
|
class="form-control custom-select" onchange="getEmpData(this)">
|
|
<option value="0">Select Policy</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>Employee</label>
|
|
<select name="search_by_client_employee" id="search_by_client_employee"
|
|
class="form-control SelExample"
|
|
onchange="getTheEmpDataForClaimSearchByMobile(this, 'client')">
|
|
<option value="0">Select Employee</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<div class="form-group">
|
|
<label>Insured List</label>
|
|
<select name="member" id="search_by_client_member"
|
|
class="form-control SelExample" onchange="setMemberData(this)">
|
|
<option value="0">Select Member</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<a class="btn btn-primary close" data-dismiss="modal" aria-label="Close"
|
|
onclick="toResetTheModelFields()">Submit</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
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
|
|
|
|
$(document).ready(function() {
|
|
getClientAndBranchAndPolicy();
|
|
$('#emp_client_data_list').select2();
|
|
$('#emp_client_branch_data_list').select2();
|
|
$('#emp_client_policy_data_list').select2();
|
|
$('#search_by_client_member').select2();
|
|
$('#search_by_client_employee').select2();
|
|
$('#employee_by_number').select2();
|
|
$('#member_by_number').select2();
|
|
})
|
|
|
|
//on change functions
|
|
$(document).ready(function() {
|
|
|
|
$('#emp_client_data_list').change(function() {
|
|
|
|
let client_id = $(this).val();
|
|
let client_name = $('#emp_client_data_list option:selected').data('name');
|
|
|
|
console.log('client_id', client_id);
|
|
console.log('client_name', client_name);
|
|
|
|
if (branch_list != '') {
|
|
// console.log(branch_list[client_id]);
|
|
let data = branch_list[client_id];
|
|
appendBranch(data);
|
|
}
|
|
|
|
})
|
|
|
|
$('#emp_client_branch_data_list').change(function() {
|
|
|
|
let branch_id = $(this).val();
|
|
|
|
console.log('branch_id', branch_id);
|
|
|
|
if (policy_list != '') {
|
|
// console.log(branch_list[client_id]);
|
|
let data = policy_list[branch_id];
|
|
console.log(data);
|
|
appendPolicy(data);
|
|
}
|
|
|
|
})
|
|
|
|
})
|
|
|
|
function toggleAccordion(id) {
|
|
const content = document.getElementById(id);
|
|
const arrow = document.querySelector(`#${id === 'mobileAccordion' ? 'mobileArrow' : 'clientBranchArrow'}`);
|
|
|
|
// Define the other accordion to close
|
|
const otherId = id === 'mobileAccordion' ? 'clientBranchAccordion' : 'mobileAccordion';
|
|
const otherContent = document.getElementById(otherId);
|
|
const otherArrow = document.querySelector(`#${id === 'mobileAccordion' ? 'clientBranchArrow' : 'mobileArrow'}`);
|
|
|
|
// Close the other accordion
|
|
otherContent.classList.remove('show');
|
|
otherArrow.classList.remove('rotate');
|
|
|
|
// Toggle the current accordion
|
|
if (content.classList.contains('show')) {
|
|
content.classList.remove('show');
|
|
arrow.classList.remove('rotate');
|
|
} else {
|
|
content.classList.add('show');
|
|
arrow.classList.add('rotate');
|
|
}
|
|
}
|
|
|
|
|
|
function openFetchEmpDataodal() {
|
|
var myModal = new bootstrap.Modal(document.getElementById('empDetailsModal'));
|
|
myModal.show();
|
|
}
|
|
|
|
//get client , branch, policy data
|
|
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;
|
|
appendClients(res.client_data);
|
|
appendClientsForMobileSearch(res.client_data);
|
|
} else {
|
|
console.log('No data found');
|
|
}
|
|
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
console.error(status, error);
|
|
}
|
|
});
|
|
}
|
|
|
|
//append the clients data to the modal
|
|
function appendClients(data) {
|
|
$('#emp_client_data_list').empty();
|
|
|
|
$('#emp_client_data_list').append($('<option>', {
|
|
value: '0',
|
|
text: 'Select Client'
|
|
}));
|
|
|
|
$.each(data, function(index, item) {
|
|
var option = $('<option>', {
|
|
value: item.id,
|
|
text: item.client_name,
|
|
'data-name': item.client_name,
|
|
});
|
|
|
|
$('#emp_client_data_list').append(option).select2();
|
|
});
|
|
|
|
}
|
|
|
|
//append the clients data for mobile search to the modal
|
|
function appendClientsForMobileSearch(data) {
|
|
$('#mobile_emp_client_data_list').empty();
|
|
|
|
$('#mobile_emp_client_data_list').append($('<option>', {
|
|
value: '0',
|
|
text: 'Select Client'
|
|
}));
|
|
|
|
$.each(data, function(index, item) {
|
|
var option = $('<option>', {
|
|
value: item.id,
|
|
text: item.short_name,
|
|
});
|
|
|
|
$('#mobile_emp_client_data_list').append(option).select2();
|
|
});
|
|
|
|
}
|
|
|
|
//append the clients branch data to the modal
|
|
function appendBranch(data) {
|
|
$('#emp_client_branch_data_list').empty();
|
|
|
|
$('#emp_client_branch_data_list').append($('<option>', {
|
|
value: '0',
|
|
text: 'Select Branch'
|
|
}));
|
|
|
|
$.each(data, function(index, item) {
|
|
var option = $('<option>', {
|
|
value: item.id,
|
|
text: item.branch_name,
|
|
'data-name': item.branch_name,
|
|
});
|
|
|
|
$('#emp_client_branch_data_list').append(option).select2();
|
|
});
|
|
|
|
}
|
|
|
|
//append the clients policy data to the modal
|
|
function appendPolicy(data) {
|
|
|
|
console.log("function called appendPOlicy : ", data);
|
|
let ticket_type = $('#ticket_type_id').val();
|
|
$('#emp_client_policy_data_list').empty();
|
|
|
|
$('#emp_client_policy_data_list').append($('<option>', {
|
|
value: '0',
|
|
text: 'Select Policy'
|
|
}));
|
|
|
|
$.each(data, function(index, item) {
|
|
|
|
if (ticket_type == 1) {
|
|
console.log("inside if 1");
|
|
if (item.policy_type_id == 2 || item.policy_type_id == 3 || item.policy_type_id == 4 || item
|
|
.policy_type_id == 5) {
|
|
console.log("inside if 2");
|
|
var option = $('<option>', {
|
|
value: item.id,
|
|
text: item.policy_type + '-' + item.policy_no,
|
|
});
|
|
|
|
$('#emp_client_policy_data_list').append(option).select2();
|
|
}
|
|
|
|
} else if (ticket_type == 2) {
|
|
console.log("inside if 3");
|
|
if (item.policy_type_id == 1) {
|
|
console.log("inside if 4");
|
|
var option = $('<option>', {
|
|
value: item.id,
|
|
text: item.policy_type + '-' + item.policy_no,
|
|
});
|
|
|
|
$('#emp_client_policy_data_list').append(option).select2();
|
|
}
|
|
|
|
} else if (ticket_type == 3) {
|
|
|
|
if (item.policy_type_id == 6) {
|
|
var option = $('<option>', {
|
|
value: item.id,
|
|
text: item.policy_type + '-' + item.policy_no,
|
|
});
|
|
|
|
$('#emp_client_policy_data_list').append(option).select2();
|
|
}
|
|
|
|
} else if (ticket_type == 4) {
|
|
|
|
if (item.policy_type == 7) {
|
|
var option = $('<option>', {
|
|
value: item.id,
|
|
text: item.policy_type + '-' + item.policy_no,
|
|
});
|
|
|
|
$('#emp_client_policy_data_list').append(option).select2();
|
|
}
|
|
|
|
} else {
|
|
console.log("inside else condition");
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
function submitClaimForm(event, form) {
|
|
|
|
event.preventDefault();
|
|
|
|
var isValid = $('#ticket_form_data').parsley().validate();
|
|
|
|
if (!isValid) {
|
|
toastr.warning('Form validation failed. Please check the required fields.', 'WARNING');
|
|
return false;
|
|
}
|
|
|
|
const formAction = '<?= isset($view_ticket_page) ? base_url("ticket/update") : base_url("ticket/create"); ?>';
|
|
|
|
// Show loader
|
|
$('.loader').fadeIn();
|
|
$('.loader-mask').fadeIn();
|
|
|
|
// Collect IDs and form data
|
|
const formData = new FormData(form);
|
|
|
|
// AJAX request
|
|
$.ajax({
|
|
data: formData,
|
|
url: formAction,
|
|
type: "POST",
|
|
dataType: 'json',
|
|
processData: false,
|
|
contentType: false,
|
|
success: function(response) {
|
|
// Hide loader
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
|
|
console.log('Form submitted response:', response);
|
|
|
|
if (response.status === true) {
|
|
toastr.success(response.message, 'SUCCESS');
|
|
} else {
|
|
toastr.error(response.message, 'ERROR');
|
|
}
|
|
|
|
window.location.href = '<?= base_url('ticket/list') ?>';
|
|
},
|
|
error: function(xhr, status, error) {
|
|
console.error(xhr.responseText);
|
|
console.error(status, error);
|
|
|
|
// Hide loader
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
}
|
|
});
|
|
}
|
|
|
|
function getEmpData(input) {
|
|
|
|
console.log(input)
|
|
let param = $(input).val();
|
|
let url = '<?= base_url('util/getTheEmpDataForClaim/') ?>' + param;
|
|
|
|
// Data to send in the AJAX request
|
|
let requestData = {
|
|
param: param,
|
|
};
|
|
|
|
// Show loader
|
|
$('.loader').fadeIn();
|
|
$('.loader-mask').fadeIn();
|
|
|
|
// Send AJAX request
|
|
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
|
console.log('Data fetched successfully:', response);
|
|
|
|
if (response.status) {
|
|
console.log(response.message, 'SUCCESS');
|
|
appendEmployee(response.data, 'search_by_client_employee');
|
|
setClientAndInsurerData(response.dataForClientAndInsurer);
|
|
setClientPolicyData(input);
|
|
} else {
|
|
toastr.warning(response.message, 'WARNING');
|
|
}
|
|
|
|
// Hide loader
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
|
|
}, function(xhr, status, error) {
|
|
console.error('Error fetching data:', error);
|
|
console.error(xhr.responseText);
|
|
toastr.error('An error occurred while fetch data.', 'ERROR');
|
|
|
|
// Hide loader
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
});
|
|
}
|
|
|
|
function getTheEmpDataForClaimSearchByMobile(input, searchType = null) {
|
|
|
|
console.log(input);
|
|
let type = $('#employee_data_points').val()
|
|
let param = $('#emp_mobile_number_for_claim').val()
|
|
let client_policy_id = $('#emp_client_policy_data_list').val()
|
|
let client_id = $('#mobile_emp_client_data_list').val()
|
|
|
|
if (searchType == 'client') {
|
|
type = 'emp_code';
|
|
param = $(input).val();
|
|
client_id = $('#emp_client_data_list').val()
|
|
}
|
|
let url = '<?= base_url('util/getTheEmpDataForClaimSearchByMobile/') ?>' + param + '/' + type + '/' +
|
|
client_policy_id + '/' + client_id;
|
|
|
|
// Data to send in the AJAX request
|
|
let requestData = {
|
|
param: param,
|
|
type: type,
|
|
client_policy_id: client_policy_id,
|
|
client_id: client_id,
|
|
};
|
|
|
|
// Show loader
|
|
$('.loader').fadeIn();
|
|
$('.loader-mask').fadeIn();
|
|
|
|
|
|
// Send AJAX request
|
|
sendAjaxRequestForGlobal(url, 'GET', requestData, function(response) {
|
|
console.log('Data fetched successfully:', response);
|
|
|
|
if (response.status == true) {
|
|
console.log(response.message, 'SUCCESS');
|
|
if (searchType == 'client') {
|
|
appendMember(response.memberData, 'search_by_client_member');
|
|
} else {
|
|
appendMember(response.memberData, 'member_by_number');
|
|
}
|
|
// if (response.data.emp_id == null || response.data.emp_id == ''){
|
|
unSetClientPolicy();
|
|
// }
|
|
setClientAndInsurerData(response.data);
|
|
setClientBranchPolicy(response.data.emp_id, searchType ?? null, response.data.policy_id ?? null);
|
|
appendACMS(response.acms)
|
|
|
|
} else {
|
|
toastr.warning(response.message, 'WARNING');
|
|
appendACMS(response.acms);
|
|
unSetClientPolicy();
|
|
unSetClientAndInsurerData()
|
|
}
|
|
|
|
// Hide loader
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
}, function(xhr, status, error) {
|
|
console.error('Error fetching data:', error);
|
|
console.error(xhr.responseText);
|
|
toastr.error('An error occurred while fetch data.', 'ERROR');
|
|
|
|
// Hide loader
|
|
$('.loader').fadeOut();
|
|
$('.loader-mask').delay(350).fadeOut('slow');
|
|
});
|
|
}
|
|
|
|
function setClientBranchPolicy(emp_id, searchType = null, policy_id = null) {
|
|
|
|
data = {
|
|
// branch_id : branch_id,
|
|
// policy_id : policy_id,
|
|
emp_id: emp_id,
|
|
searchType: searchType ?? null,
|
|
policy_id: policy_id ?? null
|
|
}
|
|
|
|
data = JSON.stringify(data);
|
|
console.log("set client branch function is called : ", data);
|
|
console.log("hidden input value before is ", $("#empIDHidden").val());
|
|
$("#empIDHidden").val(data).trigger('change');;
|
|
console.log("hidden input value after is ", $("#empIDHidden").val());
|
|
|
|
}
|
|
|
|
function appendEmployee(data, attrId) {
|
|
|
|
console.log('data', data)
|
|
|
|
$('#' + attrId).empty();
|
|
$('#' + attrId).append($('<option>', {
|
|
value: '0',
|
|
text: 'Select Employee'
|
|
}));
|
|
|
|
$.each(data, function(index, item) {
|
|
console.log(item)
|
|
var option = $('<option>', {
|
|
value: item.emp_code,
|
|
text: item.emp_name + ' - ' + item.emp_code,
|
|
});
|
|
|
|
$('#' + attrId).append(option).select2();
|
|
});
|
|
|
|
}
|
|
|
|
function appendMember(data, attrId) {
|
|
|
|
console.log('data', data);
|
|
|
|
// Clear the existing options
|
|
$('#' + attrId).empty();
|
|
|
|
// Add the default 'Select Member' option
|
|
$('#' + attrId).append($('<option>', {
|
|
value: '0',
|
|
text: 'Select Member'
|
|
}));
|
|
|
|
// Append options dynamically with data attributes
|
|
$.each(data, function(index, item) {
|
|
console.log('Item:', item); // Log each item to debug
|
|
|
|
// Ensure all properties exist, set fallback if necessary
|
|
var empID = item.emp_id ?? '';
|
|
var empName = item.emp_name ?? '';
|
|
var policyNo = item.policy_no ?? '';
|
|
var tpaNo = item.tpa_no ?? '';
|
|
var relationship = item.emp_relationship ?? '';
|
|
|
|
// Create an option and set data attributes
|
|
var option = $('<option>', {
|
|
value: item.emp_code,
|
|
text: empName + " - " + relationship
|
|
}).attr({
|
|
'data-empID': empID,
|
|
'data-empName': empName,
|
|
'data-policyNo': policyNo,
|
|
'data-tpaNo': tpaNo,
|
|
'data-relationship': relationship
|
|
});
|
|
|
|
$('#' + attrId).append(option);
|
|
});
|
|
|
|
// Reinitialize select2
|
|
$('#' + attrId).select2();
|
|
}
|
|
|
|
function appendACMS(data) {
|
|
|
|
console.log("account manger data : ",data);
|
|
|
|
$('#acm_id').empty();
|
|
|
|
$('#acm_id').append($('<option>', {
|
|
value: '',
|
|
text: 'Select Account Manager'
|
|
}));
|
|
|
|
$.each(data, function(index, item) {
|
|
var option = $('<option>', {
|
|
value: item.id,
|
|
text: item.first_name,
|
|
});
|
|
|
|
$('#acm_id').append(option);
|
|
});
|
|
|
|
}
|
|
|
|
function onlyNumbers(event) {
|
|
var charcode;
|
|
charcode = event.which || event.keyCode;
|
|
if (charcode >= 48 && charcode <= 57 || charcode == 46) return true;
|
|
return false;
|
|
}
|
|
|
|
function setClientPolicyData(input) {
|
|
|
|
// console.log('policy_value ',input);
|
|
var selectedValue = $(input).val(); // Get selected value
|
|
var selectedText = $(input).find(":selected").text();
|
|
console.log('Selected value ', selectedValue, " selected text ", selectedText);
|
|
|
|
var targetDropdown = $("#emp_client_policy");
|
|
|
|
targetDropdown.select2();
|
|
targetDropdown.empty();
|
|
targetDropdown.append(new Option(selectedText, selectedValue));
|
|
targetDropdown.addClass('readonly-select ').select2('destroy');
|
|
let ticket_type = $('#ticket_type_id').val();
|
|
if (ticket_type == 1) {
|
|
setMinDateDOA(selectedValue);
|
|
}else{
|
|
setDateValidation(selectedValue,false);
|
|
}
|
|
// targetDropdown.attr("readonly");
|
|
|
|
}
|
|
|
|
function setClientAndInsurerData(data) {
|
|
|
|
$('#insurer_id').val(data.insurer_id);
|
|
$('#insurer_name').val(data.insurer_name);
|
|
$('#tpa_id').val(data.tpa_id);
|
|
$('#tpa_name').val(data.tpa_name);
|
|
$('#client_id').val(data.client_id);
|
|
$('#client_name').val(data.client_name);
|
|
|
|
$('#emp_code').val(data.emp_code);
|
|
$('#emp_id').val(data.emp_id);
|
|
$('#emp_name').val(data.emp_name);
|
|
$('#emp_mobile').val(data.emp_mobile);
|
|
$('#emp_mail').val(data.emp_email);
|
|
}
|
|
|
|
function unSetClientPolicy() {
|
|
var targetDropdown = $("#emp_client_policy");
|
|
|
|
if (targetDropdown.hasClass("readonly-select")) {
|
|
console.log("Class exists, removing...");
|
|
targetDropdown.removeClass("readonly-select");
|
|
targetDropdown.select2();
|
|
} else {
|
|
console.log("Class not found.");
|
|
}
|
|
var targetDropdown2 = $("#doa");
|
|
if (targetDropdown2.hasClass("readonly-select")) {
|
|
console.log("Class exists, removing...");
|
|
targetDropdown2.removeClass("readonly-select");
|
|
// targetDropdown.select2();
|
|
} else {
|
|
console.log("Class not found.");
|
|
}
|
|
var targetDropdown3 = $("#date_of_joininig");
|
|
if (targetDropdown3.hasClass("readonly-select")) {
|
|
console.log("Class exists, removing...");
|
|
targetDropdown3.removeClass("readonly-select");
|
|
// targetDropdown.select2();
|
|
} else {
|
|
console.log("Class not found.");
|
|
}
|
|
|
|
}
|
|
|
|
function unSetClientAndInsurerData() {
|
|
|
|
$('#insurer_id').val("");
|
|
$('#insurer_name').val("");
|
|
$('#tpa_id').val("");
|
|
$('#tpa_name').val("");
|
|
$('#client_id').val("");
|
|
$('#client_name').val("");
|
|
|
|
$('#emp_code').val("");
|
|
$('#emp_id').val("");
|
|
$('#emp_name').val("");
|
|
$('#emp_mobile').val("");
|
|
$('#emp_mail').val("");
|
|
}
|
|
|
|
function setMemberData(input) {
|
|
|
|
var selectedOption = $(input).find(':selected');
|
|
|
|
// Retrieve the data-* attributes
|
|
var empId = selectedOption.data('empid');
|
|
var empName = selectedOption.data('empname');
|
|
var policyNo = selectedOption.data('policyno');
|
|
var tpaNo = selectedOption.data('tpano');
|
|
var relationship = selectedOption.data('relationship');
|
|
|
|
$('#tpa_no').val(tpaNo);
|
|
$('#insured_emp_id').val(empId);
|
|
$('#insured_name').val(empName);
|
|
// $('#policy_no').val(policyNo);
|
|
|
|
$('#relationship option').each(function() {
|
|
if ($(this).text() === relationship) {
|
|
$(this).prop('selected', true);
|
|
}
|
|
});
|
|
|
|
if (tpaNo == "") {
|
|
|
|
$('#claim_status_id').val(1)
|
|
$('#non_id_reason').attr('required', true);
|
|
var $label = $("#non_id_reason_lable_id");
|
|
$label.text('*');
|
|
|
|
} else {
|
|
$('#claim_status_id').val(2)
|
|
$('#non_id_reason').attr('required', false);
|
|
var $label = $("#non_id_reason_lable_id");
|
|
$label.text("");
|
|
}
|
|
}
|
|
|
|
// $('#employee_data_points').on('change', function() {
|
|
|
|
// let value = $(this).val()
|
|
// if (value == "mobile") {
|
|
// $('#employee_data_points_label').text('Employee Mobile Number')
|
|
// } else {
|
|
// $('#employee_data_points_label').text('Employee ID')
|
|
// }
|
|
// })
|
|
|
|
$('#employee_data_points').on('change', function() {
|
|
let value = $(this).val();
|
|
let $label = $('#employee_data_points_label');
|
|
let $input = $('#emp_mobile_number_for_claim');
|
|
|
|
if (value == "mobile") {
|
|
$label.text('Employee Mobile Number');
|
|
$input.attr('onkeypress', 'return onlyNumbers(event)').attr('maxlength', '10');
|
|
} else {
|
|
$label.text('Employee ID');
|
|
$input.removeAttr('onkeypress maxlength');
|
|
}
|
|
});
|
|
|
|
|
|
function toResetTheModelFields() {
|
|
|
|
$('#emp_mobile_number_for_claim').val('');
|
|
$('#employee_data_points').val();
|
|
$('#employee_by_number').val('');
|
|
$('#member_by_number').val('0').select2();
|
|
$('#emp_client_data_list').val('0').select2();
|
|
$('#emp_client_branch_data_list').val('0').select2();
|
|
$('#emp_client_policy_data_list').val('0').select2();
|
|
$('#search_by_client_employee').val('0').select2();
|
|
$('#search_by_client_member').val('0').select2();
|
|
}
|
|
|
|
$('#tpa_no').on('input', function() {
|
|
let tpaNo = $(this).val().trim();
|
|
console.log('tpaNo:', tpaNo);
|
|
|
|
let isEmpty = tpaNo === "";
|
|
$('#claim_status_id').val(isEmpty ? 1 : 2);
|
|
$('#non_id_reason').prop('required', isEmpty);
|
|
$('#non_id_reason_lable_id').text(isEmpty ? '*' : '');
|
|
});
|
|
|
|
</script>
|