<?php 
	require "_header.php"; 
?>
<div id="main-content">
<script language="javascript" type="text/javascript">
Ext.onReady(function(){
	Ext.QuickTips.init();
    var SMSForm = new Ext.FormPanel({
		method:'post',
        frame:true,
		url:'save-sms-setting.php',
		standardSubmit:false,       
        layout:'column',        
		items :[{columnWidth:1,
				layout: 'form',
				labelWidth:75,
				items:[{xtype: 'textfield',
								fieldLabel: 'User Name',
								id: 'smsusername',
								name: 'smsusername',
								allowBlank:false,
								listeners:{select:{fn:function(combo, value) 
									{						
									}}						   } 
							 }]},
			   {columnWidth:1,
				layout: 'form',
				labelWidth:75,
				items:[{xtype: 'textfield',
								fieldLabel: 'Password',
								id: 'smspassword',
								name: 'smspassword',
								allowBlank:false,
								listeners:{select:{fn:function(combo, value) 
									{						
									}}						   } 
							 }]},
				{columnWidth: 0.33,
				layout: 'form',
				labelWidth:75,
				items:[{xtype: 'checkbox',
								fieldLabel: 'Fee SMS',
								id: 'FeeSms',
								name: 'FeeSms',
								allowBlank:false,
								handler: function(){
											if(this.getValue()==true)
												{
													Ext.getCmp('FeeSmsS').enable();	
													Ext.getCmp('FeeSmsP').enable();
												}
											else
												{
													Ext.getCmp('FeeSmsS').disable();
													Ext.getCmp('FeeSmsS').reset();
													Ext.getCmp('FeeSmsP').disable();
													Ext.getCmp('FeeSmsP').reset();
												}
										   }	
							 },
					   {xtype: 'checkbox',
								fieldLabel: 'Present SMS',
								id: 'PresentSMS',
								name: 'PresentSMS',
								allowBlank:false,
								handler: function(){
											if(this.getValue()==true)
												{
													Ext.getCmp('PresentSMSS').enable();	
													Ext.getCmp('PresentSMSP').enable();
												}
											else
												{
													Ext.getCmp('PresentSMSS').disable();
													Ext.getCmp('PresentSMSS').reset();
													Ext.getCmp('PresentSMSP').disable();
													Ext.getCmp('PresentSMSP').reset();
												}
										   }	
							 },{xtype: 'checkbox',
								fieldLabel: 'Library SMS',
								id: 'librarySms',
								name: 'librarySms',
								allowBlank:false,
								handler: function(){
											if(this.getValue()==true)
												{
													Ext.getCmp('librarysmsS').enable();	
													Ext.getCmp('librarysmsP').enable();
												}
											else
												{
													Ext.getCmp('librarysmsS').disable();
													Ext.getCmp('librarysmsS').reset();
													Ext.getCmp('librarysmsP').disable();
													Ext.getCmp('librarysmsP').reset();
												}
										   }	
							 },]},
				{columnWidth: 0.33,
				layout: 'form',
				labelWidth:75,
				items:[{xtype: 'checkbox',
								name: 'FeeSmsS',
			   					id:'FeeSmsS',
								fieldLabel: 'To Student'
								},
								{xtype: 'checkbox',
								name: 'PresentSMSS',
			   					id:'PresentSMSS',
								fieldLabel: 'To Student'
								},{xtype: 'checkbox',
								name: 'librarysmsS',
			   					id:'librarysmsS',
								fieldLabel: 'To Student'
								}
								]},
				{columnWidth: 0.34,
				layout: 'form',
				labelWidth:75,
				items:[{xtype: 'checkbox',
								name: 'FeeSmsP',
			   					id:'FeeSmsP',
								fieldLabel: 'To Parents' 
								},
								
								{xtype: 'checkbox',
								name: 'PresentSMSP',
			   					id:'PresentSMSP',
								fieldLabel: 'To Parents' 
								},
								{xtype: 'checkbox',
								name: 'librarysmsP',
			   					id:'librarysmsP',
								fieldLabel: 'To Parents' 
								}
								]}
               ]		   
    });
	


var SMSWindow = new Ext.Window({
        title: 'SMS Setting',
		width:350,		
		height:200,	
		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 ()
						{
								if(Ext.getCmp('FeeSms').getValue()==true && (Ext.getCmp('FeeSmsS').getValue()==false && Ext.getCmp('FeeSmsP').getValue()==false) )
								{
									 Ext.MessageBox.show({
												   title: 'Error',
												   msg: 'Please Select Whome To sent Fee Sms.',
												   buttons: Ext.MessageBox.OK,
												   icon:Ext.MessageBox.ERROR
												});
								}
								else if(Ext.getCmp('PresentSMS').getValue()==true && (Ext.getCmp('PresentSMSS').getValue()==false && Ext.getCmp('PresentSMSP').getValue()==false) )
								{
									 Ext.MessageBox.show({
												   title: 'Error',
												   msg: 'Please Select Whome To sent Present Sms.',
												   buttons: Ext.MessageBox.OK,
												   icon:Ext.MessageBox.ERROR
												});
								}
								else
								{
									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('smsusername').setValue('<?php echo $smsusername ; ?>');
			Ext.getCmp('smspassword').setValue('<?php echo $smspassword ; ?>');
			
			Ext.getCmp('FeeSms').setValue('<?php echo $FeeSms ; ?>');
			Ext.getCmp('FeeSmsS').setValue('<?php echo $FeeSmsS ; ?>');
			Ext.getCmp('FeeSmsP').setValue('<?php echo $FeeSmsP ; ?>');
			
			Ext.getCmp('PresentSMS').setValue('<?php echo $PresentSMS ; ?>');
			Ext.getCmp('PresentSMSS').setValue('<?php echo $PresentSMSS ; ?>');
			Ext.getCmp('PresentSMSP').setValue('<?php echo $PresentSMSP ; ?>');
			
			Ext.getCmp('librarySms').setValue('<?php echo $librarySms ; ?>');
			Ext.getCmp('librarysmsS').setValue('<?php echo $librarysmsS ; ?>');
			Ext.getCmp('librarysmsP').setValue('<?php echo $librarysmsP ; ?>');
	   

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