163 lines
5.4 KiB
PHP
163 lines
5.4 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="#">Master</li><li class="#">Users</li><li class="active">Users Roles</li>
|
|
</ul>
|
|
</div>
|
|
<!-- End of breadcrumb -->
|
|
|
|
|
|
<div>
|
|
|
|
<form name="f1" method="post" action="">
|
|
<div id="flex1" style="width:100%">
|
|
</div>
|
|
</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: 'role_list_script.php',
|
|
dataType: 'json',
|
|
colModel: [
|
|
{display: 'Sr', name: 'count', width: w*.04, sortable: false, align: 'left'},
|
|
{display: 'Role ID', name: 'role_id', width: w*.06, sortable: true, align: 'left'},
|
|
{display: 'Role', name: 'role_name', width: w*.2, sortable: true, align: 'left'},
|
|
{display: 'Role Description', name: 'role_description', width: w*.2, sortable: true, align: 'left'},
|
|
{display: 'Assign Menu', name: 'assign_link', width:w*.18, sortable: false, align: 'left'},
|
|
//{display: 'Assign Warehouse', name : 'assign_link', width :100, sortable : false, align: 'center'},
|
|
{display: 'View', name: 'view_link', width: w*.1, sortable: false, align: 'left'},
|
|
{display: 'Edit', name: 'edit_link', width: w*.1, sortable: false, align: 'left'},
|
|
{display: 'Delete', name: 'delete_link', width: w*.1, sortable: false, align: 'left'}
|
|
],
|
|
buttons: [
|
|
|
|
{name: 'Add', bclass: 'add', onpress: doCommand},
|
|
|
|
{separator: true}
|
|
],
|
|
searchitems: [
|
|
{display: 'Role ID', name: 'role_id'},
|
|
{display: 'Role', name: 'role_name', isdefault: true},
|
|
{display: 'Role Description', name: 'role_description'}
|
|
],
|
|
sortname: "role_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 doCommand(com, grid) {
|
|
if (com == 'Add') {
|
|
window.open('role_master.php?acn=add', 'DoSubmit', 'width=300,height=150,screenX=50,left=350,screenY=50,top=150');
|
|
}
|
|
if (com == 'Edit') {
|
|
$('.trSelected', grid).each(function () {
|
|
var id = $(this).attr('id');
|
|
id = id.substring(id.lastIndexOf('row') + 3);
|
|
alert("Edit row " + id);
|
|
});
|
|
location.href = "menu_master.php?acn=update";
|
|
|
|
} else if (com == 'Delete') {
|
|
$('.trSelected', grid).each(function () {
|
|
var id = $(this).attr('id');
|
|
alert((this));
|
|
alert(id);
|
|
id = id.substring(id.lastIndexOf('row') + 3);
|
|
alert("Delete row " + id);
|
|
});
|
|
}
|
|
}
|
|
|
|
function delete_menu(button, grid) {
|
|
var total_count = $('.trSelected', grid).length;
|
|
var deleted = 0;
|
|
|
|
$.each($('.trSelected', grid), function () {
|
|
var id = $('td:nth-child(1) div', this).html();
|
|
$.ajax({
|
|
url: '/api/book/' + id,
|
|
type: 'DELETE',
|
|
data: {},
|
|
dataType: 'json',
|
|
success: function () {
|
|
deleted++;
|
|
if (deleted == total_count) {
|
|
$('#books_grid').flexReload();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
function add_menu(button, grid) {
|
|
var form_div = $('#book_form');
|
|
|
|
form_div.load('/ajax/book_form_add', null, function () {
|
|
$('#book_form form').ajaxForm({
|
|
url: '/ajax/book_form_add',
|
|
success: function () {
|
|
form_div.hide();
|
|
$('#books_grid').flexReload();
|
|
}
|
|
});
|
|
form_div.show();
|
|
});
|
|
}
|
|
|
|
function edit_menu(button, grid) {
|
|
var id = $('.trSelected td:nth-child(1) div', grid).html();
|
|
var form_div = $('#book_form');
|
|
var url = '/ajax/book_form_edit/' + id;
|
|
|
|
form_div.load(url, null, function () {
|
|
$('#book_form form').ajaxForm({
|
|
url: url,
|
|
success: function () {
|
|
form_div.hide();
|
|
$('#books_grid').flexReload();
|
|
}
|
|
});
|
|
form_div.show();
|
|
});
|
|
}
|
|
|
|
</script>
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
|