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

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

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

var subjectstore = new Ext.data.JsonStore({
	url:'data/get-subject.php',
    root: 'data',
	totalProperty: 'total',
	fields: ['subject_id','subject_name'] 
});

var examstore = new Ext.data.ArrayStore({		
	fields: ['exam_id','exam_name'],
	data:Ext.semester.exam
});

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,
	tabIndex:'1',
	forceSelection:true,
	triggerAction:'all',
	mode:'local',
	allowBlank:false,
	store:branchstore,
    listeners:{'select': function(cmb, rec, idx){
		LoadData();
	}}
});

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,
	forceSelection:true,
	triggerAction:'all',
	mode:'local',
	tabIndex:'2',
	allowBlank:false,
	store:semesterstore,
    listeners:{'select': function(cmb, rec, idx){
		LoadData();
	}}
});

var subject = new Ext.form.ComboBox({
	name: 'subject_name',
	id:'subject_name',
	hiddenName:'subject_hidden',
	labelSeparator:'',	
	fieldLabel :labelArray[3] ,
	displayField:'subject_name',
	valueField: 'subject_id',
	editable:true,
	forceSelection:true,	
	triggerAction:'all',
	mode:'local',
	tabIndex:'4',
	allowBlank:true,
	store: subjectstore,
    listeners:{'select': function(cmb, rec, idx){
		
	}}
});

var exam = new Ext.form.ComboBox({
	name: 'exam_name',
	id:'exam_name',
	hiddenName:'exam_hidden',
	labelSeparator:'',	
	fieldLabel :labelArray[2] ,
	displayField:'exam_name',
	valueField: 'exam_id',
	editable:true,
	triggerAction:'all',
	forceSelection:true,
	mode:'local',
	tabIndex:'3',
	allowBlank:false,
	store: examstore,
    listeners:{'select': function(cmb, rec, idx){
		
	}}
});	

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 exam_disp = new Ext.form.TextField({
	name: 'exam_disp',
	id:'exam_disp',
	hidden:true
});

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

function LoadData(){
	var branch_name = Ext.getCmp('branch_name').getValue();
	var semester_name = Ext.getCmp('semester_name').getValue();
	var exam_name = Ext.getCmp('exam_name').getValue();

	if(branch_name != '' && semester_name != ''){	
		Ext.getCmp('subject_name').reset();
		subjectstore.load({params:{
			branch_name:branch_name,
			semester_name:semester_name
		}});
	}}

Ext.onReady(function(){
	Ext.QuickTips.init();
	
	var ExamFailForm = new Ext.FormPanel({
    	labelWidth: 80,
        //url:'report-fees-dueamt-result.php',
		frame:true,
		standardSubmit:true,
        title: '',
        bodyStyle:'padding:6px 6px 0',
        layout:'form',
		defaultType: 'textfield',
        items :[branch,semester,exam,subject,branch_disp,semester_disp,exam_disp,subject_disp]
    });
	 
	var ExamFailWindow = new Ext.Window({
        title: 'Exam Fail Student Report',
        height: 190,
        width: 290,
		modal:true,
        layout: 'fit',
		border: false,
		closeAction:'close',
		collapsible:'true',
		items: ExamFailForm,
		buttonAlign: 'center',
	    buttons: [{
			text:'View Report',iconCls: 'new-tab',
			handler: function(b, e){	
				ExamFailForm.getForm().submit();	
			}
		},{
			text: 'Reset', iconCls: 'icon-reset',
			handler: function () {   
				ExamFailForm.getForm().reset();
				Ext.getCmp('branch_name').focus(true,500);
			}
		},{
			text: 'Close',iconCls: 'icon-close',
			handler: function () {    
				ExamFailWindow.close();
			}
      	}]
 	});
	
	var varWidth =  (screen.width - ExamFailWindow.width)/2;
	ExamFailWindow.setPosition(varWidth,((screen.height/4)-85));
	ExamFailWindow.show();
	
	Ext.getCmp('branch_name').focus(true,1000);

});
</script>
<div id="abcd" align="center"></div>
<?php require "_footer.php";?>