<?php 
/********************************************************************************* 
 *  This file is part of Sentrifugo.
 *  Copyright (C) 2014 Sapplica
 *   
 *  Sentrifugo is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Sentrifugo is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Sentrifugo.  If not, see <http://www.gnu.org/licenses/>.
 *
 *  Sentrifugo Support <support@sentrifugo.com>
 ********************************************************************************/
 ?>
 
<?php 
	if(($this->editpermission == 'Yes')) { 
	$msgtitle = $this->controllername.'_delete';
	sapp_Helper::editdeleteForView(BUSINESSUNITS,$this->controllername,$this->id,$msgtitle); 
	}?>

<?php // Start :Condition to check whether organisation is created or not
    if($this->orgdata !='' && $this->orgdata == 'noorgdata'){?>
    <div class="ml-alert-1-info m1-info-set"><div class="style-1-icon info"></div>	
	Organization information is not added yet.
			
</div>
<?php
}else
{
		 if($this->ermsg == 'nodata') { ?>
		<div class="ml-alert-1-info m1-info-set"><div class="style-1-icon info"></div>No data found.</div>
		<?php } else { 
		$baseUrl = $this->serverUrl().$this->baseUrl();
		echo $this->form->id; ?>
		<!-- <span id="error_message"></span> -->
	<?php 
$startdate=$this->form->start_date->getValue();
sapp_Helper::viewHeader();
sapp_Helper::viewBody('alt','Name',(!empty($this->data['unitname']))?$this->data['unitname']:"...",'Code',(!empty($this->data['unitcode']))?$this->data['unitcode']:"...");
sapp_Helper::viewBody('nor','Description',(!empty($this->data['description']))?$this->data['description']:"...",'Started On',(!empty($startdate))? $this->form->start_date->getValue():"...");
sapp_Helper::viewBody('alt','Time Zone',(!empty($this->data['timezone']))?$this->data['timezone']:"...",'Country',(!empty($this->data['country']))?$this->data['country']:"...");
sapp_Helper::viewBody('nor','State',(!empty($this->data['state']))?$this->data['state']:"...",'City',(!empty($this->data['city']))?$this->data['city']:"...");
sapp_Helper::viewBody('alt','Street Address 1',(!empty($this->data['address1']))?$this->data['address1']:"...",'Street Address 2',(!empty($this->data['address2']))?$this->data['address2']:"...");
sapp_Helper::viewBody('nor','Street Address 3',(!empty($this->data['address3']))?$this->data['address3']:"...",'','');
sapp_Helper::viewFooter();
?>
				
		
		<?php 
		if($this->deptData>0) { 
		if($this->call == 'ajaxcall'){
			$div = ''; $endDiv = ''; 
		} else { 
			$div = '<div id="grid_'.$this->dataArray[0]['objectname'].'" class="all-grid-control">'; $endDiv = '</div>';
		}
			echo $div.'<div id="msg" style="display:none;font-style: oblique; font-weight: bold; color: green;""></div>'.$this->grid($this->dataArray[0]).$endDiv;
		}
		?>

		<div id="departmentsContainer"  style="display: none; overflow: auto;">
			<div class="heading">
				<a href="javascript:void(0)">
				<img src="<?php echo MEDIA_PATH; ?>images/close.png" name="" align="right"
					border="0" hspace="3" vspace="5" class="closeAttachPopup"
					style="margin: -24px 8px 0 0;"> </a>
			</div>
				<iframe id="departmentsCont" class="business_units_iframe" frameborder="0"></iframe>
		</div>
		<script type='text/javascript'>
		$(document).ready(function(){
				<?php 
					for($i=1;$i<=3;$i++)
					{	
						if (!empty($this->msgarray)) 
						{?>
							$('#country').val('');
							$('#state').val('');
							$('#s2id_state .select2-choice span').html('Select state');
							$('#s2id_country .select2-choice span').html('Select country');										   
				<?php 	
						} 
					}	?>
			});
		</script>
<?php } 
}// End :Condition to check whether organisation is created or not
?>