ESH/dept_list.php

434 lines
8.1 KiB
PHP
Raw Normal View History

2024-10-23 18:28:06 +05:30
<?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="#">Data Setup</li>
<li class="#">Master</li>
<li class="active">Department</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_dept_list.php" />
<input type="hidden" name="excel_action" id="excel_action" value="excel_dept_list.php" />
</form>
<form name="f1" method="post" action="" id="flex_form_department">
<div id="flex1" style="width:100%">
</div>
<input type="hidden" name="flex_patient_id" id="flex_patient_id" />
</form>
</div>
</div><!-- /.page-content -->
</div>
</div><!-- /.main-content -->
<script type="text/javascript">
$(function() {
var w = screen.width * .90;
var h = 0;
h = (window.innerHeight - ($("#navbar").height() + $(".breadcrumbs").height())) * .75;
$("#flex1").flexigrid({
url: 'dept_list_script.php',
dataType: 'json',
colModel: [
{
display: 'Sr',
name: 'count',
width: w * .04,
sortable: false,
align: 'left'
},
{
display: 'Department ID',
name: 'dept_id',
width: w * .2,
sortable: true,
align: 'left'
},
{
display: 'Divsion',
name: 'bu_id',
width: w * .1,
sortable: true,
align: 'left'
},
{
display: 'Department Name',
name: 'dept_name',
width: w * .2,
sortable: true,
align: 'left'
},
{
display: 'Department Head Name',
name: 'dept_headname',
width: w * .2,
sortable: true,
align: 'left'
},
{
display: 'Department Head Email',
name: 'dept_email',
width: w * .2,
sortable: true,
align: 'left'
},
{
display: '',
name: '',
width: w * .2,
sortable: true,
align: 'left'
},
],
buttons: [{
name: 'PDF',
bclass: 'print',
onpress: pdf
},
{
separator: true
},
{
name: 'Excel',
bclass: 'print_excel',
onpress: excel
},
{
separator: true
},
{
name: 'Add',
bclass: 'add',
onpress: add
},
{
separator: true
},
],
searchitems: [
{
display: 'Department Name',
name: 'dept_name',
isdefault: true
},
{
display: 'Department Head Name ',
name: 'dept_headname'
},
{
display: 'Department Head Email',
name: 'dept_email'
}
],
sortname: "bu_id",
sortorder: "asc",
usepager: true, //pagination
useRp: true,
rp: 50, //records per page
showTableToggleBtn: false, //toggle button for the whole table
resizable: true,
//width: w,
height: h,
singleSelect: true
});
});
function excel()
{
window.open('ajax_excel.php', 'Department List');
}
function pdf() {
//window.open('pdf_manage_item.php');
window.open('ajax_pdf.php', 'Department List');
}
function add() {
$(".save_button").show();
$("#dept_id").val("");
$("#dept_name").val("");
$("#dept_headname").val("");
$("#dept_email").val("");
$('#modal-add-patient').modal("show");
}
function save_department() {
$.ajax({
url: 'save_dept.php ',
type: "POST",
data: $("#department_form").serialize(),
success: function(data) {
BootstrapDialog.alert('Department Saved Successfully.');
$("#flex1").flexReload();
return;
},
error: function(data) {
BootstrapDialog.alert('Error In Saving Department');
return;
}
});
$('.close').click();
}
function open_dept(dept_id, action) {
if (action == "V") {
$(".save_button").hide();
} else {
$(".save_button").show();
}
$.ajax({
url: 'select_dept.php',
type: 'POST',
data: {
dept_id: dept_id
},
dataType: 'json',
success: function(data) {
//alert(data);
//alert(data);
$("#dept_id").val(data.dept_id);
$("#dept_name").val(data.dept_name);
$("#dept_headname").val(data.dept_headname);
$("#dept_email").val(data.dept_email);
// $("#department_code").val(data.dept_code);
$('#modal-add-patient').modal("show");
},
error: function(data) {
BootstrapDialog.alert('Error Populating Department');
return;
}
});
}
function delete_dept(dept_id) {
$("#flex_patient_id").val(dept_id);
BootstrapDialog.confirm('Are you sure to delete the Item?', function(result) {
if (result) {
$.ajax({
url: 'delete_dept_list.php',
type: "POST",
data: $("#flex_form_department").serialize(),
success: function(data) {
if (data.indexOf("SUCCESS") != -1) {
BootstrapDialog.alert('Item Deleted Successfully.');
$("#flex1").flexReload();
} else {
BootstrapDialog.alert('Error Deleting Item');
}
return;
},
error: function(data) {
BootstrapDialog.alert('Error Deleting Item');
return;
}
});
}
});
}
</script>
<?php include('techsyn_footer.php'); ?>
<?php include('form/add_department_form.php');?>