<?php $this->load->view("partial/header"); ?>
<div id="page_title"><?php echo "Synchronization"; ?></div>
<?php
//echo form_open('config/save/',array('id'=>'config_form'));
echo form_open_multipart('dbbackup/periodic_sync/',array('id'=>'dbbackup_form'));
if(count($message)){
	if($message['success']==false){
?>
<div style="background-color:#FF0000;height:30px; font-weight:bold;text-align:center;color:#FFFFFF;font-size: 16px;">
<?php echo $message['message'];?>

</div>
<?php
	}
	else if($message['success']==true){

?>
<div style="background-color:#24BD06;height:30px; font-weight:bold;text-align:center;color:#000000;font-size: 16px;">
<?php echo $message['message'];?>

</div>
<?php
	}
}
?>

<div id="config_wrapper">
<fieldset id="dbbackup_info">
<legend></legend>

<?php /*
echo form_submit(array(
'name'=>'submit',
'id'=>'submit',
'value'=>$this->lang->line('common_submit'),
'class'=>'submit_button float_right')
);*/

echo'</br></br></br><a href="' . base_url('index.php/dbbackup/challan_sync') . '" onclick="return confirm(\'Are you sure to challan sync?\')">Sync Challan</a></br></br></br>';
echo'<a href="' . base_url('index.php/dbbackup/regular_sync') . '" onclick="return confirm(\'Are you sure to regular sync?\')">Sync Regular</a></br></br></br>';
echo'<a href="' . base_url('index.php/dbbackup/periodic_sync') . '" onclick="return confirm(\'Are you sure to periodic sync?\')">Sync Periodic</a></br></br></br>';
?>
</fieldset>
</div>
<?php
echo form_close();
?>

<div id="feedback_bar"></div>
<script type='text/javascript'>

//validation and submit handling
$(document).ready(function()
{
	$('#dbbackup_form').validate({
		submitHandler:function(form)
		{
			$(form).ajaxSubmit({
				success:function(response)
				{
					if(response.success)
					{
						set_feedback(response.message,'success_message',false);
					}
					else
					{
						set_feedback(response.message,'error_message',true);
					}
				},
				dataType:'json'
			});

		},
		errorLabelContainer: "#error_message_box",
		wrapper: "li",
		rules:
		{
			company: "required",
			address: "required",
			phone: "required",
			default_tax_rate:
			{
				required:true,
				number:true
			},
			email:"email",
			return_policy: "required"
		},
		messages:
		{
			company: "<?php echo $this->lang->line('config_company_required'); ?>",
			address: "<?php echo $this->lang->line('config_address_required'); ?>",
			phone: "<?php echo $this->lang->line('config_phone_required'); ?>",
			default_tax_rate:
			{
				required:"<?php echo $this->lang->line('config_default_tax_rate_required'); ?>",
				number:"<?php echo $this->lang->line('config_default_tax_rate_number'); ?>"
			},
			email: "<?php echo $this->lang->line('common_email_invalid_format'); ?>",
			return_policy:"<?php echo $this->lang->line('config_return_policy_required'); ?>"

		}
	});
});
</script>
<?php $this->load->view("partial/footer"); ?>
