<?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="#">Waste Category</li><li class="active"> Waste Category</li>
            </ul>
			
			
        </div>
        <!-- End of breadcrumb -->
           
        	<div class="page-content">
			<div id="flexigridDiv" class="table-responsive">
			
					<form name="f1" method="post" id="flex_appointment_form" action="">
					<div id="flex1" style="width:100%">
				     <input type="hidden" name="flex_employee_appointment_id" id="flex_employee_appointment_id"/>
					</div>
					
				</form>	
				
				<form name="export_form" method="post" id="export_form" action="">
				   
					    <input type="hidden" name="pdf_action" id="pdf_action" value="waste_category_pdf.php"/>
						<input type="hidden" name="excel_action" id="excel_action" value="waste_category_excel.php"/>
				</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: 'waste_category_list_script.php',
            dataType: 'json',
            colModel : [
                    {display: 'Sr', name : 'count', width : w*.05, sortable : false, align: 'left'},
				

			
					{display: 'Waste Cateogry Name ', name : 'waste_category_name', width : w*.15, sortable : true, align: 'left'},
					{display: 'Waste Cateogry Description ', name : 'waste_category_desc', width : w*.15, sortable : true, align: 'left'},
				
                  
					
					{display: '', name : 'link', width : w*.07, sortable : false, 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: 'Appointment Id', name : 'appointment_id',isdefault: true},
                 
                   
					{display: 'Waste Category Name', name : 'waste_category_name'},
					{display: 'Waste Category Description', name : 'waste_category_desc'},
			
					
                   
            ],
            sortname: "waste_category_name",
            sortorder: "asc",
            usepager: true,//pagination
			//title:"Employee OPD",
            useRp: true,
           rp: 50,//records per page
            showTableToggleBtn: false,//toggle button for the whole table
            resizable: true,
		//	width: w, 
            height: h,
            singleSelect: true
    });
});

function add(){
	            $("#waste_category_id").val("")
	            $("#waste_category_name").val("")
	             $("#waste_category_desc").val("")
	         
	            									
	$('#modal-add-waste-category-form').modal("show");
	
}
function save_waste_category(){

	$.ajax({
		url : 'save_waste_category.php',
		type : "POST",
		data : $("#waste_category_form").serialize(),
		success : function(data) {
			BootstrapDialog.alert(' Waste Category Record Saved Successfully.');
			$("#flex1").flexReload();
			return;
		},
		error : function(data) {
			BootstrapDialog.alert('Error Saving Waste Category  Record');
			return;
		}
});
$('.close').click();

	
}

function delete_waste_category(waste_category_id){
	
	$.ajax({
		url : 'delete_waste_category.php',
	     data:{waste_category_id:waste_category_id},	
		type : 'POST',
		dataType:'json',
		success : function(data) {
             
            if(data=='SUCCESS')	{

            	BootstrapDialog.alert('Waste Category Delete Successfully'); 																		 
    			$("#flex1").flexReload();
    			return;
            }									
			
			
		
				
		},
		error : function(data) {
			BootstrapDialog.alert('Error Deleleting Waste Category ');
			return;
		}
	});
	


	
}

function open_waste_category(waste_category_id,access){
	if(access=='V'){
		 $("#save_button").hide()
	}else if(access=='E')
	 $("#save_button").show()

	$.ajax({
		url : 'select_waste_category.php',
	     data:{waste_category_id:waste_category_id},	
		type : 'POST',
		dataType:'json',
		success : function(data) {
             $("#waste_category_id").val(data.waste_category_id);
             $("#waste_category_name").val(data.waste_category_name);
             $('#waste_category_desc').val(data.waste_category_desc);
         
            										
                    																		 

			
			$('#modal-add-waste-category-form').modal("show");
				
		},
		error : function(data) {
			BootstrapDialog.alert('Error Populating Waste Category Details');
			return;
		}
	});


	
}
function pdf(){
	window.open('ajax_pdf.php','Category Waste List');

	
}
function excel(){
	window.open('ajax_excel.php','Category Waste List');
} 



				
</script>

<?php  include('techsyn_footer.php'); ?> 
<?php  include('form/add_waste_category.php'); ?>