<?php 
	require "_headerhome_feedback.php";	
	
// reset all session-------------
error_reporting(~E_ALL);

	//session_save_path('sessions');
	session_start();
$_SESSION['f_student_id']="";
$_SESSION['f_studentname'] ="";
$_SESSION['f_cur_branchid'] = "";
$_SESSION['f_cur_semesterid'] = "";
$_SESSION['f_student_mobile'] = "";
$_SESSION['f_branch_name'] = "";
$_SESSION['f_semester_name'] = "";
$_SESSION['f_code'] = "";
session_unregister($_SESSION["f_student_id"]);
session_unregister($_SESSION["f_studentname"]);
session_unregister($_SESSION["f_cur_branchid"]);
session_unregister($_SESSION["f_cur_semesterid"]);
session_unregister($_SESSION["f_student_mobile"]);
session_unregister($_SESSION["f_branch_name"]);
session_unregister($_SESSION["f_semester_name"]);
session_unregister($_SESSION['f_code']);

session_unset();
session_destroy();
?>
<!-- start custom CSS/JS -->

<script type="text/javascript">
Ext.onReady(function(){	

						
	
	Ext.QuickTips.init();	
	var gtuno = new Ext.form.NumberField({
		name: 'student_gturegno',
		id:'student_gturegno',
		labelSeparator:'',	
		tabIndex:1,
		fieldLabel :'Enrollment No :<span class="comp">*</span>' ,
		allowBlank:false,
		allowNegative: false,
		allowDecimals: false,
		width: 150,
		listeners: {'blur': function(){
			var gturegno = this.getValue();
			if(gturegno!="" ){
				
				/*Ext.Ajax.request({
					loadMask: true,
					sync : true,
					url: 'data/getgtunodata.php',
					params: {gturegno:gturegno},
					success: function(resp){
						var value=Ext.decode(resp.responseText).count;
						if(value==',,,'){
							grid.stopEditing();
									
							Ext.getCmp('student_name').reset();
							Ext.getCmp('student_gturegno').reset();
							Ext.getCmp('cheque_no').reset();
							Ext.getCmp('cash').reset();
							Ext.getCmp('bank_name').reset();
							Ext.getCmp('division_id').reset();
							Ext.getCmp('receive_amt').reset();
							Ext.getCmp('comment').reset();
							Ext.getCmp('receipt_date').reset();
							Ext.getCmp('receipt_no').reset();
							feeshead_grid_store.removeAll();
							receivedfees_grid_store.removeAll();
							
							Ext.MessageBox.show({
								title: 'Message',
								msg: 'GTU Registration Number '+gturegno +' Does Not Exist...',
								buttons: Ext.MessageBox.OK,
								icon:Ext.MessageBox.INFO
							});
							
						} else{
							var arr_data = new Array();
							arr_data =  value.split(",");
							student_id = arr_data[0];
							student_name = arr_data[1];
							branch_id = arr_data[2];
							semester_id = arr_data[3];
							division_id= arr_data[4];
							Ext.getCmp('student_name').setValue(student_id);
							Ext.getCmp('student_name').setRawValue(student_name);
							
							Ext.getCmp('branch_name').setValue(branch_id);
							Ext.getCmp('semester_name').setValue(semester_id);
							Ext.getCmp('division_id').setValue(division_id);
							divisionstore.filter('division_id',branch_id+semester_id,false,true,true);
							get_feeshead_data();
							get_receivedfees_data();
						}					
					}				
				});*/
				
			}
		}}
	
	});
var birthdate = new Ext.form.DateField({
    id: 'birthdate',
	name:'birthdate',
	labelSeparator:'',	
	fieldLabel :'Birth Date :<span class="comp">*</span>' ,
	name: 'birthdate',
	tabIndex:2,
	emptyText:'dd/mm/yyyy',
	allowBlank:false,
	width: 150

});	
    var loginForm = new Ext.FormPanel ({
       	url:'logincheck.php',
        method:'post',
		standardSubmit:true,
		frame:true,
		layout:'column',
		items:[{
			columnWidth: .30,
			layout: 'form',				
			items:[{ 
				xtype: 'box', 
				autoEl:{ 
					tag: 'div',
					html:'<div align="left"><img  src="images/login.png" heigth="100" width="100" /></div>'
				}
			}]				
		},{
			columnWidth: 0.7,
			layout: 'form',	
			labelWidth:85,				
			items:[{
				height:5
			},
			gtuno,birthdate,
			{				
			 xtype: 'numberfield',
			 name: 'student_mobile',
			 id: 'student_mobile',
			 width:150,
			 tabIndex:3,
			 labelSeparator:'',	
			  minLength:10,			
			 fieldLabel :'Mobile :<span class="comp">*</span> ' ,
			allowBlank:false,
			autoCreate: {tag: 'input', type: 'text',  maxlength: '10'}
										 
			},
			{
			   xtype:'label',
			   text:'(On this mobile number the security code will be send)'
			}
			
		]
		}]
	});
	var loginWindow = new Ext.Window({
    	title: 'Feedback Login',
		width:380,		
		height:200,		
		closeAction:'close',
		closeable:false,
		collapsible:true,
		items: loginForm,
		buttonAlign: 'center',
	    buttons: [{
			text: 'Continue',
			iconCls:'icon-login',
			tabIndex: 4,
			width:60,
			handler: function(){
				formsubmit();
			}
		},{
			text: 'Reset',
			iconCls:'icon-reset',
			width:60,
			tabIndex: 5,
			handler: function(){
				loginForm.getForm().reset();
			}
		}]
	});
	var varWidth =  (screen.width - loginWindow.width)/2;
	loginWindow.setPosition(varWidth,((screen.height/4)-30));
	loginWindow.show();

	
	Ext.getCmp('student_gturegno').focus(true,500);
	function formsubmit(){
		// loginForm.getForm().findField('yearname').setValue(Ext.getCmp('year_id1').getRawValue());
	var gturegno = Ext.getCmp('student_gturegno');
	var birthdate = Ext.getCmp('birthdate');
	var student_mobile = Ext.getCmp('student_mobile');
	if(gturegno.isValid() && birthdate.isValid() &&  student_mobile.isValid())
	{
		Ext.Ajax.request({
						loadMask: true,
						sync : true,
						url: 'data/chkgtustudent.php',
						params: {gturegno:gturegno.getValue(),birthdate:birthdate.getValue(),student_mobile:student_mobile.getValue()},
						success: function(resp){
							var value=Ext.decode(resp.responseText).success;
							var msg=Ext.decode(resp.responseText).msg;
							if(value=='true'){
								        //loginForm.getForm().reset();
										//alert(msg);
										window.location = 'feedback_code.php';							
							} else{
								alert(msg);
								
							}
												
						}	,
						failure: function () {
									Ext.MessageBox.show({
										title: 'Error',
										msg: 'Invalid Login',
										buttons: Ext.MessageBox.OK,
										icon:Ext.MessageBox.ERROR
									});
							}			
					}); 
		
	}
	/*loginForm.getForm().submit({
			waitMsg: 'Checking...',
			success: function () {
				loginForm.getForm().reset();
				window.location = 'logincheck.php';
			},
			failure: function () {
				Ext.MessageBox.show({
					title: 'Error',
					msg: 'Invalid User ID or Password',
					buttons: Ext.MessageBox.OK,
					icon:Ext.MessageBox.ERROR
				});
			}
		});*/
	}
});
</script>
<!-- end custom CSS/JS -->
<div align="center">
	<div id="abcdhome" align="center" style="width:300px"></div>
</div>
<?php require "_footerhome.php";?>