FIX_Header
This commit is contained in:
parent
708fe8f5a5
commit
fc2981c9a3
@ -61,7 +61,6 @@ $routes->get('download-kyc-docs/(:segment)', 'ClientController::downloadKYCDocum
|
||||
$routes->get('claim-form-download/(:any)', 'TicketController::downloadClaimForm/$1');
|
||||
$routes->match (['get','post'],"claims-feedback-form/(:any)/(:any)", "TicketController::viewClaimFeedbackForm/$1/$2");
|
||||
$routes->match (['get','post'],"claims-feedback-form/(:any)", "TicketController::viewClaimFeedbackForm/$1");
|
||||
$routes->get('downloadClaimFile/(:any)', 'TicketController::downloadClaimFile/$1');
|
||||
|
||||
|
||||
|
||||
@ -185,7 +184,8 @@ $routes->group("/employee", ["filter" => "authMVC"], function ($routes) {
|
||||
$routes->post("test-rack-rate", "EmployeeController::testRackRate");
|
||||
$routes->get('test_members_list', 'EmployeeController::test_members_list');
|
||||
$routes->post('get_emp_history','EmployeeController::getEmpHistory');
|
||||
$routes->get("retail-endorsement-list", "EmployeeController::retailendorsementList");
|
||||
// $routes->get("retail-endorsement-list", "EmployeeController::retailendorsementlist");
|
||||
// $routes->post("retail-endorsement-save", "EmployeeController::retailendorsementsave");
|
||||
});
|
||||
|
||||
|
||||
|
||||
@ -3017,24 +3017,5 @@ class EmployeeController extends AdminController
|
||||
* based on the provided filters such as client ID, policy ID, and status.
|
||||
*/
|
||||
|
||||
public function retailendorsementList()
|
||||
{
|
||||
|
||||
// $data = [];
|
||||
// $data['status'] = ['open' => 'Open', 'inprogress' => 'In-Progress', 'complete' => 'Complete'];
|
||||
// if (count($this->request->getGet())) {
|
||||
// $filterData = $this->request->getGet();
|
||||
// $data['employees'] = $this->partnerEndorsementRequestModel->getRetailEndorsementList(
|
||||
// client_id: $filterData['client_id'],
|
||||
// insurer_id: $filterData['insurer_id'],
|
||||
// status: $filterData['status']
|
||||
// );
|
||||
// $data['getData'] = $filterData;
|
||||
// // echo "<pre>";
|
||||
// // print_r($data); die;
|
||||
// }
|
||||
// $this->myLogger->logme('error', 'list called');
|
||||
// $this->loadLayout('retail_endorsement_list', $data);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1424,74 +1424,6 @@
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<!-- Enrollment process -->
|
||||
<?php if (in_array(get_role_id(), [1, 2, 3, 5]) || in_array(ENROLLMENT_TEAM_ID, user_team())) { ?>
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class="waves-effect img-inactive-not-working">
|
||||
<img style="border-radius: 5px;"
|
||||
src="<?= base_url() . "public"; ?>/assets/images/action_on_policies_sb.png" alt="Logo" height="20">
|
||||
<span> Action on Policies </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboards">
|
||||
<ul class="nav-second-level">
|
||||
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/upload') ?>">View Inception</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/list') ?>">View Members</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/endorsement-list') ?>">View Endorsement</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/enrollment-list') ?>">View Enrolment</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/test_members_list') ?>">Test Members List</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
<?php } ?>
|
||||
|
||||
<!-- Masters -->
|
||||
<?php if (get_role_id() == 1 || get_role_id() == 5) { ?>
|
||||
|
||||
<li>
|
||||
<a href="#sidebarDashboards" data-toggle="collapse" class=" img-inactive-not-working">
|
||||
<img
|
||||
src="<?= base_url() . "public"; ?>/assets/images/masters_sb.png" alt="Logo" height="20">
|
||||
<span> Masters </span>
|
||||
</a>
|
||||
<div class="collapse" id="sidebarDashboards">
|
||||
<ul class="nav-second-level">
|
||||
<li>
|
||||
<a href="<?= base_url('/master/insurer/list') ?>">Insurer</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/tpa/list') ?>">TPA</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/kyc/list') ?>">KYC</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/policy/list') ?>">Policy</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/cash_deposite/list') ?>">CD Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/master/vehicle/list') ?>">Vehicle Master</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/user/list') ?>"> Users </a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
<!-- Enrollment process -->
|
||||
<?php if (in_array(get_role_id(), [1,2,3,5]) || in_array(ENROLLMENT_TEAM_ID, user_team())) { ?>
|
||||
@ -1519,9 +1451,6 @@
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/test_members_list') ?>">Test Members List</a>
|
||||
</li>
|
||||
<li>
|
||||
<a href="<?= base_url('/employee/retail-endorsement-list') ?>">Retail Endorsement</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@ -33,6 +33,11 @@
|
||||
<label>Client</label> <br />
|
||||
<select class="form-control" id="clients">
|
||||
<option value="0">Select</option>
|
||||
<!-- <?php foreach ($client as $key => $value) { ?>
|
||||
<option value="<?= $value['id'] ?>" <?= (isset($getData) && $getData['client_id'] == $value['id']) ? 'selected' : '' ?>>
|
||||
<?= $value['client_name'] . (!empty($value['short_name']) ? ' ( ' . $value['short_name'] . ' )' : '') ?>
|
||||
</option>
|
||||
<?php } ?> -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -40,6 +45,11 @@
|
||||
<label>Insurer</label> <br />
|
||||
<select class="form-control" id="insurer">
|
||||
<option value="0">Select</option>
|
||||
<!-- <?php foreach ($insurer as $key => $value) { ?>
|
||||
<option value="<?= $value['id'] ?>" <?= (isset($getData) && $getData['client_id'] == $value['id']) ? 'selected' : '' ?>>
|
||||
<?= $value['name'] . (!empty($value['short_name']) ? ' ( ' . $value['short_name'] . ' )' : '') ?>
|
||||
</option>
|
||||
<?php } ?> -->
|
||||
</select>
|
||||
</div>
|
||||
|
||||
@ -58,7 +68,7 @@
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-12" style="text-align: right;">
|
||||
<a href="<?= base_url("employee/endorsement-list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
<a href="<?= base_url("employee/retail-endorsement-list"); ?>" class="btn btn-primary waves-effect waves-light" id="get-emp-list" onclick="fetchEmpolyeeList(event);">Submit</a>
|
||||
</div>
|
||||
</div>
|
||||
<!-- </div> -->
|
||||
@ -138,21 +148,48 @@
|
||||
|
||||
|
||||
|
||||
<div class="modal fade app-text-black " id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" data-backdrop="static">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<form id="retailEndorsementForm">
|
||||
<div class="modal-header">
|
||||
<h4 class="modal-title title-text" id="myCenterModalLabel" style="font-size:27px !important">Edit Endorsement Details <span id="heading"></span></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
</div>
|
||||
|
||||
<!-- Center modal content -->
|
||||
<div class="modal fade" id="centermodal" tabindex="-1" role="dialog" aria-hidden="true" aria-modal="true" data-backdrop="static">
|
||||
<div class="modal-dialog modal-dialog-centered">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header" style="background-color: gainsboro;">
|
||||
<h4 class="modal-title" id="myCenterModalLabel">Edit Endorsement Details <span id="heading"></span></h4>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
|
||||
<div class="modal-body">
|
||||
<div class="form-row">
|
||||
<input type="hidden" id="edit_id" name="id">
|
||||
<input type="hidden" id="updated_by" name="updated_by" value="<?= get_session_userid(); ?>">
|
||||
<input type="hidden" value="<?= csrf_hash() ?>" name="<?= csrf_token() ?>"/>
|
||||
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="endorsement_no" class="sub-title-text ">Endorsement Number<span class="text-danger">*</span></label>
|
||||
<input type="text" class="form-control" id="endorsement_no" placeholder="Enter Endorsement Number" name="endorsement_no" required>
|
||||
</div>
|
||||
<div class="modal-body" id="modal_body">
|
||||
</div>
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
|
||||
|
||||
<div class="form-group col-md-12">
|
||||
<label for="edit_status" class="sub-title-text ">Status<span class="text-danger">*</span></label>
|
||||
<select class="form-control" id="edit_status" name="status" required>
|
||||
<option value="">Select Status</option>
|
||||
<?php foreach ($status as $key => $value) { ?>
|
||||
<option value="<?= $key ?>"><?= $value ?></option>
|
||||
<?php } ?>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
<button class="btn app-btn-outline-secondary mr-2 " type="button" data-dismiss="modal" aria-hidden="true">Cancel</button>
|
||||
<button class="btn app-btn-secondary waves-effect waves-light" id="btnSubmit">Submit</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
@ -162,98 +199,19 @@
|
||||
$("#insurer").select2();
|
||||
});
|
||||
|
||||
// Declare a global variable to store API response data
|
||||
var clientPolicies = [];
|
||||
|
||||
var client_id = '<?= isset($getData) ? $getData['client_id'] : '0' ?>';
|
||||
var insurer_id = '<?= isset($getData) ? $getData['insurer_id'] : '0' ?>';
|
||||
var status_id = '<?= isset($getData) ? $getData['status'] : '0' ?>';
|
||||
|
||||
|
||||
$(window).on("load", function() {
|
||||
console.log("window loaded");
|
||||
fetchClientPolicies();
|
||||
appendClients();
|
||||
appendInsurer();
|
||||
});
|
||||
|
||||
|
||||
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);
|
||||
});
|
||||
});
|
||||
|
||||
// console.log(clientPolicies);
|
||||
appendClients(clientPolicies);
|
||||
|
||||
setTimeout(function() {
|
||||
if (client_id) {
|
||||
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) {
|
||||
|
||||
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);
|
||||
|
||||
} 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();
|
||||
}
|
||||
|
||||
|
||||
function appendClients(data) {
|
||||
|
||||
function appendClients() {
|
||||
let data = <?= json_encode($client) ?>;
|
||||
var clientID = <?= isset($getData) ? $getData['client_id'] : '0' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
@ -267,103 +225,22 @@
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function appendBranch(data) {
|
||||
|
||||
$('#branch_id').empty();
|
||||
$('#branch_id').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
function appendInsurer() {
|
||||
let data = <?= json_encode($insurer) ?>;
|
||||
var insurerID = <?= isset($getData) ? $getData['insurer_id'] : '0' ?>;
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.id,
|
||||
text: item.branch_name
|
||||
text: item.name
|
||||
});
|
||||
if (client_branch_id == item.id) {
|
||||
if (insurerID == item.id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#branch_id').append(option);
|
||||
$('#insurer').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
function appendPolicies(data) {
|
||||
|
||||
$('#policies').empty();
|
||||
$('#policies').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
var PolicyID = <?= isset($getData) ? $getData['policy_id'] : '0' ?>;
|
||||
// console.log(PolicyID)
|
||||
$.each(data, function(index, item) {
|
||||
var option = $('<option>', {
|
||||
value: item.client_policy_id,
|
||||
// text: `${item.name ?? ''} - ${item.policy_no ?? ''} - ${item.policy_type ?? ''}`
|
||||
text:`${item.policy_type ?? ''} - ${item.policy_no ?? ''}`
|
||||
});
|
||||
if (PolicyID == item.client_policy_id) {
|
||||
option.attr('selected', true);
|
||||
}
|
||||
$('#policies').append(option);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#clients').on('change', function() {
|
||||
|
||||
$('#policies').empty();
|
||||
$('#policies').append($('<option>', {
|
||||
value: '0',
|
||||
text: 'Select'
|
||||
}));
|
||||
|
||||
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;
|
||||
});
|
||||
// console.log(foundPolicies.branchs);
|
||||
appendBranch(foundPolicies.branchs);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$('#branch_id').on('change', function() {
|
||||
|
||||
var selectedClient = $(this).val();
|
||||
|
||||
// console.log('selectedBranch', selectedClient);
|
||||
// console.log('clientPolicies', clientPoliciesWithBranch);
|
||||
|
||||
var foundPolicies = clientPoliciesWithBranch.policies.filter(function(item) {
|
||||
// console.log('item', item);
|
||||
return item.branch_id === selectedClient;
|
||||
});
|
||||
|
||||
|
||||
if (Array.isArray(foundPolicies) && foundPolicies.length === 0) {
|
||||
|
||||
appendPolicies(foundPolicies);
|
||||
toastr.warning('No policies found for the selected client branch.');
|
||||
|
||||
} else {
|
||||
|
||||
// console.log('foundPolicies', foundPolicies);
|
||||
appendPolicies(foundPolicies);
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
|
||||
// Function to convert object to query parameters
|
||||
function objectToQueryString(obj) {
|
||||
return Object.keys(obj).map(key => `${encodeURIComponent(key)}=${encodeURIComponent(obj[key])}`).join('&');
|
||||
@ -373,19 +250,12 @@
|
||||
event.preventDefault(); // Prevent default action
|
||||
|
||||
var client_id = $('#clients').val();
|
||||
var policy_id = $('#policies').val();
|
||||
var insurer_id = $('#insurer').val();
|
||||
var status = $('#status1').val();
|
||||
var branch_id = $('#branch_id').val();
|
||||
// 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,
|
||||
branch_id: branch_id,
|
||||
insurer_id: insurer_id,
|
||||
status: status,
|
||||
};
|
||||
|
||||
@ -408,160 +278,73 @@
|
||||
var eno = $(this).data('eno');
|
||||
var status = $(this).data('status');
|
||||
// console.log(val);
|
||||
fetchEmpEndorsementData(id,eno,status)
|
||||
fetchRetailEndorsementData(id,eno,status)
|
||||
|
||||
});
|
||||
|
||||
|
||||
function fetchEmpEndorsementData(id,eno,status) {
|
||||
function submitRetailEndorsement() {
|
||||
|
||||
var form = document.getElementById("retailEndorsementForm");
|
||||
var id = form.querySelector("[name='id']").value;
|
||||
var formData = new FormData(form);
|
||||
form.classList.remove('was-validated');
|
||||
var btn = document.querySelector("button[onclick='submitRetailEndorsement()']");
|
||||
btn.disabled = true;
|
||||
btn.innerText = "Saving...";
|
||||
|
||||
alert("id");
|
||||
alert(id);
|
||||
alert(eno);
|
||||
alert(status);
|
||||
// $('.loader').fadeIn();
|
||||
// $('.loader-mask').fadeIn();
|
||||
|
||||
// var apiURL = '<?php echo base_url(); ?>' + 'util/get-emp-endorsement/' + id;
|
||||
// console.log('fetchEmpEndorsementData');
|
||||
// // console.log(apiURL);
|
||||
// $.ajax({
|
||||
// url: apiURL,
|
||||
// method: 'GET',
|
||||
// headers: {
|
||||
// "Content-Type": "application/json",
|
||||
// "X-Requested-With": "XMLHttpRequest"
|
||||
// },
|
||||
// success: function(response) {
|
||||
// // console.log(response);
|
||||
// if (response.code === 200 && response.dataStatus === true) {
|
||||
// try {
|
||||
// endorsementData = (response.data);
|
||||
// endorsementData2 = (response.data2);
|
||||
|
||||
// e_actions = endorsementData2[0]['actions'];
|
||||
|
||||
|
||||
// var heading = "";
|
||||
// if (endorsementData2[0]['actions'] == 'si') {
|
||||
// heading = ' - ' + 'SI Enhancement';
|
||||
// heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||
// } else if (endorsementData2[0]['actions'] == 'd') {
|
||||
// heading = ' - ' + 'Deletion';
|
||||
// heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||
// } else if (endorsementData2[0]['actions'] == 'c') {
|
||||
// heading = ' - ' + 'Correction';
|
||||
// heading += ' - ' + (endorsementData2[0]['endorsement_id'] !== null ? endorsementData2[0]['endorsement_id'] : endorsementData2[0]['status']);
|
||||
// }
|
||||
|
||||
// $('#heading').html(heading);
|
||||
|
||||
// $('#table_data').empty();
|
||||
// $('#table_head_data').empty();
|
||||
|
||||
|
||||
// if (e_actions == 'd') {
|
||||
|
||||
// $.each(endorsementData, function(index, item) {
|
||||
// var tableHtml = `
|
||||
// <tr>
|
||||
// <td>${item.field_name}</td>
|
||||
// <td>${formatNumberToIndianLocale(item.data, item.field_name, e_actions)}</td>
|
||||
// </tr>
|
||||
// `;
|
||||
// $('#table_data').append(tableHtml);
|
||||
// });
|
||||
|
||||
|
||||
|
||||
// } else {
|
||||
|
||||
// var table_head = `
|
||||
// <tr>
|
||||
// <th class="font-weight-medium"></th>
|
||||
// <th class="font-weight-medium">Old Value</th>
|
||||
// <th class="font-weight-medium">New Value</th>
|
||||
// </tr>
|
||||
// `;
|
||||
// $('#table_head_data').append(table_head);
|
||||
|
||||
// $.each(endorsementData, function(index, item) {
|
||||
// var tableHtml = `
|
||||
// <tr>
|
||||
// <td>${item.field_name}</td>
|
||||
// <td>${formatNumberToIndianLocale(item.old_value, item.field_name)}</td>
|
||||
// <td>${formatNumberToIndianLocale(item.new_value, item.field_name, e_actions)}</td>
|
||||
// </tr>
|
||||
// `;
|
||||
// $('#table_data').append(tableHtml);
|
||||
// });
|
||||
|
||||
// }
|
||||
|
||||
|
||||
// } 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);
|
||||
// }
|
||||
// });
|
||||
|
||||
// setTimeout(function() {
|
||||
// $('.loader').fadeOut();
|
||||
// $('.loader-mask').delay(350).fadeOut('slow');
|
||||
// }, 200);
|
||||
}
|
||||
|
||||
function formatNumberToIndianLocale(value, field_name, action) {
|
||||
|
||||
// Check if the value is a valid number (either as a number or as a string)
|
||||
if (!isNaN(value) && !isNaN(parseFloat(value)) && field_name != 'No of Days') {
|
||||
|
||||
// Convert the value to a number and format it using Indian English locale
|
||||
var return_val = parseFloat(value).toLocaleString('en-IN');
|
||||
|
||||
if (field_name == 'Period of non coverage') {
|
||||
|
||||
return value + ' days';
|
||||
}
|
||||
|
||||
if (field_name == 'Total Amount') {
|
||||
|
||||
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||
}
|
||||
|
||||
if (field_name == 'Total') {
|
||||
|
||||
if (action == 'd') {
|
||||
|
||||
return '₹ ' + return_val + ' ( To be Refunded )';
|
||||
|
||||
} else if (action == 'si') {
|
||||
|
||||
return '₹ ' + return_val + ' ( To be paid )';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return '₹ ' + return_val;
|
||||
|
||||
} else {
|
||||
// Return the original value if it's not a valid number
|
||||
return value;
|
||||
var ticketType = document.getElementById('ticket_type').value.trim();
|
||||
if (ticketType === "") {
|
||||
toastr.warning('Please fill all required fields.', 'Warning');
|
||||
form.classList.add('was-validated');
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "<?= base_url('retail-endorsement-save') ?>",
|
||||
type: "POST",
|
||||
data: formData,
|
||||
processData: false,
|
||||
contentType: false,
|
||||
dataType: 'json',
|
||||
success: function(response) {
|
||||
if (response.status === "success") {
|
||||
toastr.success(response.message, 'Success');
|
||||
$('.emp_data_model').modal('hide');
|
||||
form.reset();
|
||||
window.location.href = "<?= base_url('/employee/retail-endorsement-list') ?>";
|
||||
} else {
|
||||
toastr.error(response.message, 'Error');
|
||||
}
|
||||
},
|
||||
error: function(xhr) {
|
||||
toastr.error("Something went wrong!", 'Error');
|
||||
console.error(xhr.responseText);
|
||||
},
|
||||
complete: function() {
|
||||
btn.disabled = false;
|
||||
btn.innerText = "Save";
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
$('.close').click(function() {
|
||||
function fetchRetailEndorsementData(id,eno,status) {
|
||||
|
||||
$('.loader').fadeIn();
|
||||
$('.loader-mask').fadeIn();
|
||||
var form = document.getElementById('retailEndorsementForm');
|
||||
form.reset();
|
||||
|
||||
$("#edit_id").val(id);
|
||||
$("#endorsement_no").val(eno);
|
||||
$("#edit_status").val(status);
|
||||
|
||||
setTimeout(function() {
|
||||
$('.loader').fadeOut();
|
||||
$('.loader-mask').delay(350).fadeOut('slow');
|
||||
}, 200);
|
||||
}
|
||||
|
||||
$('#table_data').empty();
|
||||
})
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
@ -572,7 +355,7 @@
|
||||
buttons: [{
|
||||
extend: 'csv',
|
||||
text: 'CSV',
|
||||
title: 'Endorsement-List',
|
||||
title: 'Retail-Endorsement-List',
|
||||
className: 'my_class',
|
||||
exportOptions: {
|
||||
columns: ':not(:last-child)',
|
||||
@ -590,7 +373,7 @@
|
||||
initComplete: function(settings, json) {
|
||||
$('.my_class').css({
|
||||
"position": "relative",
|
||||
"left": "79px"
|
||||
"left": "15px"
|
||||
});
|
||||
},
|
||||
language: {
|
||||
|
||||
Loading…
Reference in New Issue
Block a user