<?php 
	require "_header.php";
	require "data/combo_semester.php";
?>
<script type="text/javascript">
var labelArray;
labelArray = [
	['Branch:<span class="comp">*</span>'],
	['Semester:'],
	['Enrollment Reg No:'],
	['Order By:']
];

 var genderstore = new Ext.data.ArrayStore({
           fields: ['gender'],
	       data: [['Male'],['Female']]
});

 var categorystore = new Ext.data.ArrayStore({
    	fields: ['category'],
	    data: [['GENERAL'],['OBC'], ['SC'], ['ST'], ['MINORITY']]
}); 

var admtypestore = new Ext.data.ArrayStore({
    	fields: ['admtype'],
	    data: [['ACPDC'],['V.Q'], ['M.Q'], ['ACPDC-Certificate'], ['Transfered Students']]
}); 

var admyearstore = new Ext.data.ArrayStore({
		fields: ['AYEAR'],
		data: Ext.semester.admyear
  	}); 
        
var branchstore = new Ext.data.ArrayStore({		
	fields: ['branch_id','branch_name'],
	data:Ext.semester.branchall
});

var semesterstore = new Ext.data.ArrayStore({		
	fields: ['semester_id','semester_name'],
	data:Ext.semester.semester
});

var divisionstore = new Ext.data.ArrayStore({
    	fields:['division_id','division_name'],
		data: Ext.semester.division
	});	

var branch = new Ext.form.ComboBox({
	name: 'branch_name',
	id:'branch_name',
	hiddenName:'branch_hidden',
	labelSeparator:'',	
	fieldLabel :labelArray[0] ,
	displayField:'branch_name',
	valueField: 'branch_id',
	editable:true,
	triggerAction:'all',
	width:198,
	mode:'local',
	allowBlank:false,
	store: branchstore,
    listeners: {'select': function(cmb, rec, idx){
		Ext.getCmp('branch_disp').setValue(this.getRawValue());
		Ext.getCmp('semester_name').reset();
		Ext.getCmp('division_id').reset();
	}}
});

var branch_disp = new Ext.form.TextField({
	name: 'branch_disp',
	id:'branch_disp',
	hidden:true
});

var semester_disp = new Ext.form.TextField({
	name: 'semester_disp',
	id:'semester_disp',
	hidden:true
});



var semester = new Ext.form.ComboBox({
	name: 'semester_name',
	id:'semester_name',
	hiddenName:'semester_hidden',
	labelSeparator:'',	
	fieldLabel :labelArray[1] ,
	displayField:'semester_name',
	valueField: 'semester_id',
	editable:true,
	triggerAction:'all',
	width:198,
	mode:'local',
	store: semesterstore,
    listeners: {'select': function(cmb, rec, idx){
		Ext.getCmp('semester_disp').setValue(this.getRawValue());
		Ext.getCmp('division_id').reset();
		var branch=Ext.getCmp('branch_name').getValue();
		divisionstore.filter('division_id',branch+cmb.getValue(),false,true,true);
		var cnt=divisionstore.getCount();
		if(cnt==1)
		{
			Ext.getCmp('division_id').setValue(divisionstore.getAt(0).data.division_name);
		}
	}}
});

var divisionCombo = {		
						xtype: 'combo',
						name: 'division_id',
						id:'division_id',
						labelSeparator:'',	
						fieldLabel :'Division :<span class="comp"></span>' ,
						forceSelection:true,				
						displayField:'division_name',
						valueField: 'division_name'
						,width:198
						,tabIndex:3
						,lastQuery:''
						,allowBlank:true
						,triggerAction:'all'
						,mode:'local'
						,store:divisionstore
						,selectOnFocus: true,
						listeners: {'select': function(cmb, rec, idx) {
						}
    }}

var orderbystore = new Ext.data.ArrayStore({
	fields: ['order_by2','order_by1'],
	data: [['student_gturegno','Enrollment Reg No'],
		   ['student_surname','Surname'],
		   ['student_firstname','First Name'],
		   ['student_gender,student_surname','Gender,Surname'],
		   ['student_gender,student_gturegno','Gender,Enrollment Reg No']]
}); 

var orderby = new Ext.form.ComboBox({
	name: 'orderby',
	id:'orderby',
	hiddenName:'hid_orderby',
	labelSeparator:'',	
	fieldLabel :labelArray[3] ,
	displayField:'order_by1',
	valueField: 'order_by2',
	editable:true,
	width:198,
	triggerAction:'all',
	mode:'local',
	store:orderbystore
});

var gturegno_start = new Ext.form.NumberField({
    labelSeparator:'',	
	fieldLabel :labelArray[2] ,
	name: 'gturegno_start',
	id:'gturegno_start',
	width:95,
	emptyText:'Start From',
	allowNegative: false,
	allowDecimals: false
});	

var gturegno_end = new Ext.form.NumberField({
    fieldLabel: '',
	name: 'gturegno_end',
	id:'gturegno_end',
	width:95,
	emptyText:'End To',
	allowNegative: false,
	allowDecimals: false
});

Ext.onReady(function(){
	Ext.QuickTips.init();
	
	var StudentListForm = new Ext.FormPanel({
    	labelWidth: 80,
        url:'report-student-list-result.php',
		frame:true,
		standardSubmit:true,
        title: '',
        bodyStyle:'padding:6px 6px 0',
        layout:'form',
		defaultType: 'textfield',
        items :[branch,semester,divisionCombo,{
			xtype:'container',
			autoEl:{},
			border:false,
			layout:'column',
			anchor:'100%',
			defaultType:'field',
			items:[{
				xtype:'container',
				autoEl:{},
				layout:'form',
				columnWidth:.62,
				items:[gturegno_start]
			},{
				xtype:'container',
				autoEl:{},
				layout:'form',
				columnWidth:.38,
				labelWidth:1,
				items:[gturegno_end]
			}]
		},{
											xtype: 'combo',
											name: 'gender',
											id:'gender',
											labelSeparator:'',	
											fieldLabel :'Gender: <span class="comp"></span>' ,
											forceSelection:true,				
											displayField:'gender',
											valueField: 'gender',
											width: 160,
											triggerAction:'all',
											mode:'local',
											store: genderstore
								},{
											xtype: 'combo',
											name: 'cast',
											id:'cast',
											labelSeparator:'',	
											fieldLabel :'Cast:' ,
											displayField:'category',
											valueField: 'category',
											forceSelection:false,
											width: 150
											,triggerAction:'all'
											,mode:'local'
											,selectOnFocus: true,	
											store: categorystore,
											editable:true
										
								},{
										xtype: 'combo',
										name: 'AYEAR',
										id:'AYEAR',
										labelSeparator:'',	
										fieldLabel :'Adm Year:<span class="comp"></span>' ,
										forceSelection:true,				
										displayField:'AYEAR',
										valueField:'AYEAR',
										width: 150,	
										triggerAction:'all',
										mode:'local',
										store: admyearstore
                                 },{
										xtype: 'combo',
										name: 'admtype',
										id:'admtype',
										labelSeparator:'',	
										fieldLabel :'Adm Type:<span class="comp"></span>' ,
										forceSelection:true,				
										displayField:'admtype',
										valueField:'admtype',
										width: 150,	
										triggerAction:'all',
										mode:'local',
										store: admtypestore
                                 },orderby,branch_disp,semester_disp]
 	});
	
	var StudentListWindow = new Ext.Window({
        title: 'Student List Report',
        height: 330,
        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){	
				StudentListForm.getForm().submit();	
			}
		},{
			text: 'Reset', 
			iconCls: 'icon-reset',
			handler: function(){   
			  	StudentListForm.getForm().reset();
				Ext.getCmp('branch_name').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('branch_name').focus(true,1000);
});
</script>
<div id="abcd"></div>
<?php require "_footer.php";?>
