<?php 
	require "_header.php";
	require "data/combo_employee.php";
	require "data/combo_student.php";
?>
<div id="main-content">
<script type="text/javascript">
var labelArray;

var designationstore = new Ext.data.ArrayStore({
			fields:['designation_id','designation_nameeng','dept_type'],
			data:Ext.employee.designation
	});

var teachingstore = new Ext.data.ArrayStore({
    	fields: ['employee_isteaching'],
	    data: [['Teaching Staff'],['Non-Teaching Staff'],['Technical Staff'],['Hostel Staff']]
  	});
	
var branchstore = new Ext.data.ArrayStore({
		fields: ['branch_id','branch_name'],
		data: Ext.student.branch2
	});

var orderbystore = new Ext.data.ArrayStore({
	fields: ['order_by2','order_by1'],
	data: [['employee_name','Employee Name'],
		   ['employee_deptjoindate','Joining Date'],
		   ['designation_priority','Designation']]
}); 

var orderby = new Ext.form.ComboBox({
	name: 'orderby',
	id:'orderby',
	hiddenName:'hid_orderby',
	labelSeparator:'',	
	fieldLabel :'Order BY' ,
	displayField:'order_by1',
	valueField: 'order_by2',
	editable:true,
	width:158,
	forceSelection:true,
	triggerAction:'all',
	mode:'local',
	store:orderbystore
});


var report_type_list = new Ext.form.Radio({	
	name: 'report_type',
	inputValue: 'report_type_list',	
	checked: true,		
	boxLabel: 'List Report'
});

var report_type_detail = new Ext.form.Radio({	
	hideLabel: true,
	name: 'report_type',
	inputValue: 'report_type_detail',		
	boxLabel: 'Detail Report'
});

Ext.onReady(function(){
	Ext.QuickTips.init();
	
	var StudentListForm = new Ext.FormPanel({
    	labelWidth: 85,
        url:'report-employee-detail-result.php',
		frame:true,
		standardSubmit:true,
        title: '',
		autoHeight:true,
        bodyStyle:'padding:6px 6px 0',
        layout:'form',
		defaultType: 'textfield',
        items :[{
						xtype: 'combo',
						name: 'employee_isteaching',
						id:'employee_isteaching',
						labelSeparator:'',	
						fieldLabel :'Dept. Type' ,
						forceSelection:true,				
						displayField:'employee_isteaching',
						valueField: 'employee_isteaching',
						width:158,
						tabIndex:2,
						allowBlank:true,
						triggerAction:'all',
						mode:'local',
						editable:false,
						store: teachingstore,
						listeners: {'select': function(cmb, rec, idx){
							Ext.getCmp('employee_designation').reset();
							designationstore.filter('dept_type',Ext.getCmp('employee_isteaching').getValue());
					}}},{
						xtype:'combo',
						name:'employee_designation',
						id:'employee_designation',
						labelSeparator:'',	
						hiddenName: 'employeedesignation',
						fieldLabel :'Designation' ,			
						displayField:'designation_nameeng',
						valueField: 'designation_id',
						blankText: 'Please enter or select Employee Designation',
						width:158,										
						tabIndex:3,
						allowBlank:true,
						triggerAction:'all',
						mode:'local',
						store: designationstore,
						editable:true,
						forceSelection:true
					},{				
						        xtype: 'combo',
								name: 'branch_id',
								id:'branch_id',
								labelSeparator:'',	
								fieldLabel :'Branch' ,
								displayField:'branch_name',
								valueField:'branch_id',
								hiddenName:'branch_id_hid',
								width:158,	
								tabIndex:4,	
								allowBlank:true,
								editable :true,
								triggerAction:'all',
								blankText : 'Please enter or select Branch Name.',
								mode:'local',
								forceSelection:true,
								store: branchstore
					},orderby,report_type_list,report_type_detail]
 	});
	
	var StudentListWindow = new Ext.Window({
        title: 'Employee Detail List',
        autoHeight:true,
        width: 330,
		modal:true,
        layout: 'fit',
		border: false,
		closeAction:'close',
		collapsible:'true',
		items: StudentListForm,
		buttonAlign: 'center',
	    buttons: [{
			text:'View Report',
			iconCls: 'new-tab',
			handler: function(b, e){	
			

			var employee_isteaching=StudentListForm.getForm().findField('employee_isteaching').getValue();

			var employeedesignation=StudentListForm.getForm().findField('employeedesignation').getValue();

			var branch_id_hid=StudentListForm.getForm().findField('branch_id_hid').getValue();

			var hid_orderby=StudentListForm.getForm().findField('hid_orderby').getValue();

			
			var report_type=StudentListForm.getForm().findField('report_type').getGroupValue();
			
	//alert(report_type);
			
var redirect = 'report-employee-detail-result.php?employee_isteaching='+employee_isteaching + '&employeedesignation='+employeedesignation + '&branch_id_hid='+branch_id_hid + '&report_type='+report_type + '&hid_orderby='+hid_orderby; 
                window.location = redirect;


			}
		},{
			text: 'Reset', 
			iconCls: 'icon-reset',
			handler: function(){   
			  	StudentListForm.getForm().reset();
				Ext.getCmp('employee_isteaching').focus(true,500);
			}
		},{
		  	text: 'Close',
			iconCls: 'icon-close',
			handler: function () {    
				StudentListWindow.close();
			}
      	}]
	});
	
	var varWidth =  (screen.width - StudentListWindow.width)/2;
	StudentListWindow.setPosition(varWidth,((screen.height/4)-85));
	StudentListWindow.show();
	Ext.getCmp('employee_isteaching').focus(true,1000);
});
</script>
<div id="abcd"></div>
</div>
<?php require "_footer.php";?>
