<?php 
	require "_header.php"; 
	require "data/combo_semester.php"; 
?>
<div id="main-content">
<script type="text/javascript" src="jquery/ux/CheckColumn.js"></script>
<link rel="stylesheet" type="text/css" href="css/Ext.css">
<script type="text/javascript" src="js/Ext.js"></script>
<script type="text/javascript" src="js/Ext_002.js"></script>	
<script language="javascript" type="text/javascript">
Ext.override(Ext.ux.form.LovCombo, {
	beforeBlur: Ext.emptyFn
});

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

var semester_name = new Ext.ux.form.LovCombo({
	name: 'semester_name',
	id:'semester_name',
	hiddenName:'semester_hidden',
	labelSeparator:'',	
	fieldLabel :'Semester' ,
	displayField:'semester_name',
	displayFieldTpl:'{semester_name}',
	valueField: 'semester_id',
	editable:true,
	width:120,
	triggerAction:'all',
	mode:'local',
	lastQuery:'',
	store: semesterstore,
	navigateItemsWithTab: false,
    listeners: {'select': function(cmb, rec, idx){
		
	}}
});

Ext.onReady(function(){
	Ext.QuickTips.init();
    var SMSForm = new Ext.FormPanel({
		method:'post',
        frame:true,
		url:'save-feedback_setup.php',
		standardSubmit:false,    
		autoHeight:true,	   
        layout:'form',        
		items :[{xtype: 'datefield',
					fieldLabel: 'Start Date',
					id: 'feedback_start_date',
					name: 'feedback_start_date',
					width:120,
					allowBlank:false	
				 },{xtype: 'datefield',
					fieldLabel: 'End Date',
					id: 'feedback_end_date',
					name: 'feedback_end_date',
					width:120,
					allowBlank:false
				 },
				 semester_name,
				 {xtype: 'checkbox',
					fieldLabel: 'Active',
					id: 'feedback_active',
					name: 'feedback_active',
					width:120,
					allowBlank:false
				 }
							 
               ]		   
    });
	


var SMSWindow = new Ext.Window({
        title: 'Feedback Setting',
		width:350,		
		autoHeight:true,	
		modal:true,	
		border: false,
		layout: 'fit',
		closeAction:'close',
		collapsible:true,
		items: SMSForm,
		buttonAlign: 'center',
	    buttons: [
					{text: 'Save',iconCls:'icon-save', name:'btnSave',id:'btnSave',		
						handler: function ()
						{
								
									SMSForm.getForm().submit({					
											waitMsg: 'Saving...',
											success: function () {
											Ext.MessageBox.show({
									   title: 'Message',
									   msg: 'Data has been saved..',
									   buttons: Ext.MessageBox.OK,
									   icon:Ext.MessageBox.INFO
				                      });
										},
											failure: function (){
												Ext.MessageBox.show({
													title: 'Error',
													msg: 'Please fill complete form',
													buttons: Ext.MessageBox.OK,
													icon:Ext.MessageBox.ERROR
												});
											}
										});
						}
					},
					{text: 'Close',iconCls:'icon-close', name:'btncancle',id:'btncancle',
								handler: function ()
								{
									SMSWindow.close();
									
								}
							  }
				]

	});
	var varWidth =  (screen.width - SMSWindow.width)/2;
	SMSWindow.setPosition(varWidth,((screen.height/4)-85));
	SMSWindow.show();
			   
	Ext.getCmp('feedback_start_date').setValue('<?php echo $feedback_start_date ; ?>');
	Ext.getCmp('feedback_end_date').setValue('<?php echo $feedback_end_date ; ?>');
	Ext.getCmp('feedback_active').setValue('<?php echo $feedback_active ; ?>');
	Ext.getCmp('semester_name').setValue('<?php echo $feedback_semester ; ?>');
			
	   

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