csrtechnew.ohctech.in/leave_application_list.php
2025-04-14 13:28:09 +05:30

189 lines
5.9 KiB
PHP

<?php include('techsyn_header.php'); ?>
<!-- Main Content Container for side bar and body-->
<div class="main-container ace-save-state" id="main-container">
<script type="text/javascript">
try {
ace.settings.loadState('main-container')
} catch (e) {}
</script>
<?php include('techsyn_sidebar.php'); ?>
<!--breadcrumb-->
<div class="main-content">
<div class="main-content-inner">
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
<li class="#">Leave</li>
<li class="#">Leave Application List</li>
</ul>
</div>
<!-- End of breadcrumb -->
<div class="page-content">
<div id="flexigridDiv" class="table-responsive">
<form name="export_form" method="post" id="export_form" action="">
<input type="hidden" name="pdf_action" id="pdf_action" value="pdf_State_Master_list.php" />
<input type="hidden" name="excel_action" id="excel_action" value="excel_State_Master_list.php" />
</form>
<form name="f1" method="post" action="" id="flex_form_State_Master">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="flex_State_Master_id" id="flex_State_Master_id" />
</form>
</div>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<script type="text/javascript">
$(function() {
var w = screen.width * .90;
var h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
$("#flex1").flexigrid({
url: 'leave_application_script.php',
dataType: 'json',
colModel: [
{
display: 'Actions',
name: 'actions',
width: w * .1,
sortable: false,
align: 'center'
},
{
display: 'Sr no.',
name: 'count',
width: w * .04,
sortable: false,
align: 'center'
},
{
display: 'Batch Name',
name: 'batch_id',
width: w * .15,
sortable: true,
align: 'left'
},
{
display: 'Beneficiary Name',
name: 'beneficiary_id',
width: w * .15,
sortable: true,
align: 'left'
},
{
display: 'Last Application Status',
name: 'pid',
width: w * .15,
sortable: true,
align: 'left'
},
{
display: 'Leave Count',
name: 'apply_date',
width: w * .15,
sortable: true,
align: 'left'
},
],
buttons: [{
name: 'New Leave Request',
bclass: 'add',
onpress: add
}
],
searchitems: [{
display: 'Batch Name',
name: 'batch_id',
isdefault: true
},
{
display: 'Beneficiary Name',
name: 'beneficiary_id',
isdefault: true
},
],
sortname: "pid",
sortorder: "asc",
usepager: true, //pagination
useRp: true,
rp: 50, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
height: h,
singleSelect: true
});
});
function add() {
location.href = "leave_application.php";
}
function delete_section(pid) {
BootstrapDialog.confirm('Are you sure you want to delete all leaves for this beneficiary?', function(result) {
if (result) {
$.ajax({
url: 'delete_leave.php',
type: "POST",
data: { pid: pid },
success: function(data) {
const response = JSON.parse(data);
if (response.status === "SUCCESS") {
BootstrapDialog.alert('Leave deleted successfully.');
$("#flex1").flexReload(); // Refresh the table or data as needed
} else {
BootstrapDialog.alert('Error deleting leave application: ' + response.message);
}
},
error: function(xhr, status, error) {
BootstrapDialog.alert('Error deleting leave application: ' + error);
}
});
}
});
}
function open_section(batch_id, beneficiary_id, action) {
var form = document.createElement('form');
form.method = 'POST';
form.action = 'leave_application.php';
var exmIdInput = document.createElement('input');
exmIdInput.type = 'hidden';
exmIdInput.name = 'batch_id';
exmIdInput.value = batch_id;
form.appendChild(exmIdInput);
var actionInput = document.createElement('input');
actionInput.type = 'hidden';
actionInput.name = 'beneficiary_id';
actionInput.value = beneficiary_id;
form.appendChild(actionInput);
document.body.appendChild(form);
form.submit();
}
</script>
<?php include('techsyn_footer.php'); ?>