210 lines
5.7 KiB
PHP
210 lines
5.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 class="#">Data Setup</li><li class="#">Medical Items</li><li class="active">Sub-Category</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_sub_category">
|
|
<div id="flex1" style="width:100%">
|
|
</div>
|
|
<input type="hidden" name="flex_sub_category_id" id="flex_sub_category_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: 'subcategory_script.php',
|
|
dataType: 'json',
|
|
colModel: [
|
|
{display: 'Sr', name: 'count', width: w*.04, sortable: false, align: 'left'},
|
|
|
|
{display: 'Category Name', name: 'cat_id', width: w*.08, sortable: true, align: 'left'},
|
|
{display: 'Sub-Category Name', name: 'sub_cat_name', width: w*.2, sortable: true, align: 'left'},
|
|
{display: 'Remarks', name: 'remarks', width: w*.2, sortable: true, align: 'left'},
|
|
{display: 'Status', name: 'status', width: w*.2, sortable: true, align: 'left'},
|
|
{display: '', name: '', 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: 'Sub-Category Name', name: 'sub_cat_name', isdefault: true},
|
|
{display: 'Category ID', name: 'cat_id'}
|
|
],
|
|
sortname: "sub_cat_name",
|
|
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('pdf_subcategory.php');
|
|
}
|
|
function excel(){
|
|
window.location = 'excel_subcategory.php';
|
|
}
|
|
|
|
function add(){
|
|
$(".save_button").show();
|
|
$("#sub_cat_id").val("");
|
|
$("#cat_id").val("");
|
|
$("#sub_cat_name").val("");
|
|
$("#remarks").val("");
|
|
$("#status").val("");
|
|
|
|
|
|
$('#modal-add-sub_category').modal("show");
|
|
}
|
|
|
|
function delete_subcategory(categoryId){
|
|
$("#flex_sub_category_id").val(categoryId);
|
|
|
|
BootstrapDialog.confirm('Are you sure to delete the Category?', function(result){
|
|
if(result) {
|
|
$.ajax({
|
|
url : 'delete_subcategory.php',
|
|
type : "POST",
|
|
data : $("#flex_form_sub_category").serialize(),
|
|
success : function(data) {
|
|
if(data.indexOf("SUCCESS")!=-1){
|
|
BootstrapDialog.alert('Sub Category Deleted Successfully.');
|
|
$("#flex1").flexReload();
|
|
|
|
}else{
|
|
BootstrapDialog.alert('Error Deleting Sub Category');
|
|
}
|
|
return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Deleting Sub Category');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
});
|
|
|
|
}
|
|
|
|
function save_subcategory(){
|
|
var sub_category_id;
|
|
$.ajax({
|
|
url : 'save_subcategory.php',
|
|
type : 'POST',
|
|
data : $("#subcategory_form").serialize(),
|
|
success : function(data) {
|
|
BootstrapDialog.alert('Sub-Category Saved Successfully');
|
|
$("#flex1").flexReload();
|
|
return;
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Saving Sub-Category');
|
|
return;
|
|
}
|
|
});
|
|
$('.close').click();
|
|
}
|
|
|
|
|
|
|
|
function open_subcategory(subcategoryId, action) {
|
|
|
|
if(action=="V"){
|
|
$(".save_button").hide();
|
|
|
|
}else{
|
|
$(".save_button").show();
|
|
}
|
|
$.ajax({
|
|
url : 'select_subcategory.php?subcategoryId='+subcategoryId+' ',
|
|
type : 'POST',
|
|
success : function(data) {
|
|
|
|
var data = $.parseJSON(data);
|
|
|
|
$("#sub_cat_id").val(data.sub_cat_id);
|
|
$("#cat_id").val(data.cat_id);
|
|
$("#sub_cat_name").val(data.sub_cat_name);
|
|
$("#remarks").val(data.remarks);
|
|
$("#status").val(data.status);
|
|
$('#modal-add-sub_category').modal("show");
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Populating Sub-Category');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
function loadcatList(cat_id, selectId) {
|
|
$("#"+selectId).empty();
|
|
var o= new Option("","")
|
|
$("#"+selectId).append(o);
|
|
$.ajax({
|
|
url : 'getDynamicData.php?tableName=sub_category&where_clause_field=cat_id&where_clause_value='+cat_id,
|
|
type : 'GET',
|
|
success : function(data) {
|
|
|
|
var data = $.parseJSON(data);
|
|
|
|
for(i=0;i<data.length;i++){
|
|
o= new Option(data[i].sub_cat_name,data[i].sub_cat_id)
|
|
$("#"+selectId).append(o);
|
|
}
|
|
|
|
},
|
|
error : function(data) {
|
|
BootstrapDialog.alert('Error Populating Section');
|
|
return;
|
|
}
|
|
});
|
|
}
|
|
|
|
</script>
|
|
|
|
<?php include('techsyn_footer.php'); ?>
|
|
<?php include('form/add_subcategory.php');?>
|