267 lines
7.2 KiB
PHP
267 lines
7.2 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="#">Data Setup</li>
|
|
<li class="#">Masters</li>
|
|
<li class="active">First Aid Box</li>
|
|
</ul>
|
|
</div>
|
|
<!-- End of breadcrumb -->
|
|
|
|
<div class="page-content">
|
|
<div id="flexigridDiv" class="table-responsive">
|
|
|
|
<form name="f1" method="post" action="" id="flex_form_first_aid_box">
|
|
<div id="flex1" style="width:100%">
|
|
</div>
|
|
<input type="hidden" name="flex_first_aid_box_id" id="flex_first_aid_box_id" />
|
|
</form>
|
|
</div>
|
|
</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: 'firstaidbox_script.php',
|
|
dataType: 'json',
|
|
colModel: [{
|
|
display: '',
|
|
name: '',
|
|
width: w * .1,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Sr',
|
|
name: 'count',
|
|
width: w * .04,
|
|
sortable: false,
|
|
align: 'left'
|
|
},
|
|
|
|
//{display: 'Box Id', name: 'box_id', width: w*.2, sortable: true, align: 'left'},
|
|
{
|
|
display: 'Box Name',
|
|
name: 'box_name',
|
|
width: w * .2,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Box Code',
|
|
name: 'box_code',
|
|
width: w * .2,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'Box Location',
|
|
name: 'box_loc',
|
|
width: w * .2,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
{
|
|
display: 'First Aiders',
|
|
name: 'first_aider',
|
|
width: w * .2,
|
|
sortable: true,
|
|
align: 'left'
|
|
},
|
|
//{display: 'Last Modified', name: 'last_modified', width: w*.2, sortable: true, align: 'left'},
|
|
|
|
|
|
|
|
],
|
|
buttons: [
|
|
|
|
{
|
|
name: 'Add',
|
|
bclass: 'add',
|
|
onpress: add
|
|
},
|
|
{
|
|
separator: true
|
|
},
|
|
{
|
|
name: 'PDF',
|
|
bclass: 'print',
|
|
onpress: pdf
|
|
},
|
|
{
|
|
separator: true
|
|
},
|
|
{
|
|
name: 'Excel',
|
|
bclass: 'print_excel',
|
|
onpress: excel
|
|
},
|
|
{
|
|
separator: true
|
|
}
|
|
],
|
|
searchitems: [
|
|
|
|
// {display: 'Box Id', name: 'box_id', isdefault: true},
|
|
{
|
|
display: 'Box Name',
|
|
name: 'box_name',
|
|
isdefault: true
|
|
},
|
|
{
|
|
display: 'Box Code',
|
|
name: 'box_code'
|
|
},
|
|
{
|
|
display: 'Box Location',
|
|
name: 'box_loc'
|
|
},
|
|
// {display: 'Last Modified', name: 'last_modified'},
|
|
// {display: 'Modified By', name: 'modified_by'}
|
|
|
|
],
|
|
sortname: "box_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 pdf() {
|
|
window.open('firstaidbox_pdf.php');
|
|
}
|
|
|
|
function excel() {
|
|
window.location = 'firstaidbox_excel.php';
|
|
}
|
|
|
|
function add() {
|
|
$(".save_button").show();
|
|
$("#box_id").val("");
|
|
$("#box_name").val("");
|
|
$("#box_code").val("");
|
|
$("#box_loc").val("");
|
|
$('#modal-add-first_aid_box').modal("show");
|
|
}
|
|
|
|
function delete_first_aid_box(first_aid_boxId) {
|
|
$("#flex_first_aid_box_id").val(first_aid_boxId);
|
|
|
|
BootstrapDialog.confirm('Are you sure to delete the First-Aid box?', function(result) {
|
|
if (result) {
|
|
$.ajax({
|
|
url: 'delete_firstaidbox.php',
|
|
type: "POST",
|
|
data: $("#flex_form_first_aid_box").serialize(),
|
|
success: function(data) {
|
|
if (data.indexOf("SUCCESS") != -1) {
|
|
BootstrapDialog.alert('First-Aid box Deleted Successfully.');
|
|
$("#flex1").flexReload();
|
|
|
|
} else {
|
|
BootstrapDialog.alert('Error Deleting First-Aid box');
|
|
}
|
|
return;
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Deleting First-Aid box');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function save_first_aid_box() {
|
|
var sub_category_id;
|
|
|
|
$('#first_aiders').val($("#first_aider").val());
|
|
$.ajax({
|
|
url: 'save_firstaidbox.php',
|
|
type: 'POST',
|
|
data: $("#first_aid_box_form").serialize(),
|
|
success: function(data) {
|
|
BootstrapDialog.alert('First-Aid box Saved Successfully');
|
|
$("#flex1").flexReload();
|
|
return;
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Saving First-Aid box');
|
|
return;
|
|
}
|
|
});
|
|
$('.close').click();
|
|
}
|
|
|
|
|
|
|
|
function open_first_aid_box(first_aid_boxId, action) {
|
|
|
|
if (action == "V") {
|
|
$(".save_button").hide();
|
|
|
|
} else {
|
|
$(".save_button").show();
|
|
}
|
|
$.ajax({
|
|
url: 'select_firstaidbox.php?box_id=' + first_aid_boxId + ' ',
|
|
type: 'POST',
|
|
success: function(data) {
|
|
|
|
var data = $.parseJSON(data);
|
|
|
|
$("#box_id").val(data.box_id);
|
|
|
|
$("#box_name").val(data.box_name);
|
|
$("#box_code").val(data.box_code);
|
|
|
|
$("#box_loc").val(data.box_loc);
|
|
var complaint_names = data.first_aider;
|
|
dataarray = complaint_names.split(",");
|
|
$("#first_aider").val(dataarray);
|
|
$('#first_aider').trigger('chosen:updated');
|
|
$('#modal-add-first_aid_box').modal("show");
|
|
},
|
|
error: function(data) {
|
|
BootstrapDialog.alert('Error Populating First-Aid box');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
</script>
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
<?php include('add_firstaidbox.php');?>
|