172 lines
4.7 KiB
PHP
172 lines
4.7 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>
|
||
|
<i class="ace-icon fa fa-home home-icon"></i>
|
||
|
<a href="#">Home</a>
|
||
|
</li>
|
||
|
<li class="#">Settings</li><li class="#">User Management</li><li class="active">Roles</li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<!-- End of breadcrumb -->
|
||
|
|
||
|
|
||
|
<div>
|
||
|
|
||
|
<form name="f1" method="post" action=""id="flex_form_role">
|
||
|
<div id="flex1" style="width:100%">
|
||
|
</div>
|
||
|
<input type="hidden" name="role_id" id="flex_role_id"/>
|
||
|
</form>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
</div><!-- /.page-content -->
|
||
|
</div>
|
||
|
</div><!-- /.main-content -->
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<script type="text/javascript">
|
||
|
$(function () {
|
||
|
var w=screen.width*.90;
|
||
|
var h =$(".main-content").height()+100;
|
||
|
$("#flex1").flexigrid({
|
||
|
url: 'ailment_list_script.php',
|
||
|
dataType: 'json',
|
||
|
colModel: [
|
||
|
{display: 'Sr', name: 'count', width: w*.04, sortable: false, align: 'left'},
|
||
|
{display: 'Ailment ID', name: 'ailment_id', width: w*.06, sortable: true, align: 'left'},
|
||
|
{display: 'Ailment', name: 'ailment_name', width: w*.2, sortable: true, align: 'left'},
|
||
|
{display: 'Ailment Desc', name: 'ailment_desc', width: w*.2, sortable: true, align: 'left'},
|
||
|
{display: '', name: '', width: w*.3, sortable: false, align: 'left'},
|
||
|
|
||
|
],
|
||
|
buttons: [
|
||
|
|
||
|
{name: 'Add', bclass: 'add', onpress : add},
|
||
|
|
||
|
{separator: true}
|
||
|
],
|
||
|
searchitems: [
|
||
|
{display: 'Ailment ID', name: 'ailment_id'},
|
||
|
{display: 'ailment', name: 'ailment_name', isdefault: true},
|
||
|
{display: 'ailment Desc', name: 'ailment_desc'}
|
||
|
],
|
||
|
sortname: "ailment_name",
|
||
|
sortorder: "asc",
|
||
|
usepager: true, //pagination
|
||
|
|
||
|
useRp: true,
|
||
|
rp: 25, //records per page
|
||
|
showTableToggleBtn: false, //toggle button for the whole table
|
||
|
resizable: true,
|
||
|
//width: w,
|
||
|
height: h,
|
||
|
singleSelect: true
|
||
|
});
|
||
|
});
|
||
|
|
||
|
|
||
|
|
||
|
function add(){
|
||
|
$(".save_button").show();
|
||
|
$("#ailment_id").val("");
|
||
|
$("#ailment_name").val("");
|
||
|
$("#ailment_description").val("");
|
||
|
$('#modal-add-ailment').modal("show");
|
||
|
}
|
||
|
|
||
|
function delete_ailment(ailmentId){
|
||
|
$("#flex_ailment_id").val(ailmentId);
|
||
|
|
||
|
BootstrapDialog.confirm('Are you sure to delete the ailment?', function(result){
|
||
|
if(result) {
|
||
|
$.ajax({
|
||
|
url : 'delete_ailment.php',
|
||
|
type : "POST",
|
||
|
data : $("#flex_form_ailment").serialize(),
|
||
|
success : function(data) {
|
||
|
if(data.indexOf("SUCCESS")!=-1){
|
||
|
BootstrapDialog.alert('Ailment Deleted Successfully.');
|
||
|
$("#flex1").flexReload();
|
||
|
|
||
|
}else{
|
||
|
BootstrapDialog.alert('Error Deleting Ailment');
|
||
|
}
|
||
|
return;
|
||
|
},
|
||
|
error : function(data) {
|
||
|
BootstrapDialog.alert('Error Deleting ailment');
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
}
|
||
|
|
||
|
function save_ailment(){
|
||
|
$.ajax({
|
||
|
url : 'save_ailment.php?role_id='+ailment_id+' ',
|
||
|
type : "POST",
|
||
|
data : $("#ailment_form").serialize(),
|
||
|
success : function(data) {
|
||
|
BootstrapDialog.alert('ailment Saved Successfully.');
|
||
|
$("#flex1").flexReload();
|
||
|
return;
|
||
|
},
|
||
|
error : function(data) {
|
||
|
BootstrapDialog.alert('Error Saving Role');
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
$('.close').click();
|
||
|
}
|
||
|
|
||
|
|
||
|
var ailment_id = "";
|
||
|
function open_ailment(ailmentId, action) {
|
||
|
if(action=="V"){
|
||
|
$(".save_button").hide();
|
||
|
|
||
|
}else{
|
||
|
$(".save_button").show();
|
||
|
}
|
||
|
$.ajax({
|
||
|
url : 'select_ailment.php?ailmentId='+ailmentId+' ',
|
||
|
type : 'POST',
|
||
|
success : function(data) {
|
||
|
//alert(data);
|
||
|
var data = $.parseJSON(data);
|
||
|
//alert(data);
|
||
|
role_id = data.role_id;
|
||
|
$("#ailment_id").val(data.ailment_id);
|
||
|
$("#ailment_name").val(data.ailment_name);
|
||
|
$("#ailment_desc").val(data.ailment_description);
|
||
|
$('#modal-add-ailment').modal("show");
|
||
|
},
|
||
|
error : function(data) {
|
||
|
BootstrapDialog.alert('Error Populating Role');
|
||
|
return;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
|
||
|
</script>
|
||
|
|
||
|
<?php include('techsyn_footer.php'); ?>
|
||
|
<?php include('form/add_ailment.php');?>
|