<?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>
 ********************************************************************************/
?>

<style type="text/css">
.division_new input[type="text"]{ width:230px;}

</style>

<?php if(empty($this->empdata)){?>
   <div class="ml-alert-1-info m1-info-set">
				<div class="style-1-icon info"></div>
				<?php if($this->rowexist == 'norows'){?>
						No data found.
				<?php }else{?>
						Employee inactivated.
				<?php }?>
	</div>

<?php	}	else	{
if($this->emptyFlag != 0)
	{
?>	 <div class="ml-alert-1-info">
		<div class="style-1-icon info"></div>
			The employee configurations are not yet set.Please configure them to add an employee.	
	</div>	
<?php	}
 $baseUrl = $this->serverUrl().$this->baseUrl();

 if (count($this->messages)) {?>
	<div id="dispmsgempholidays" class="settingssuccess">
		<?php 
			foreach ($this->messages as $message)
			{
				$flag = array();				
				$flag = array_keys($message);
				echo "<div id='messageData' class='ml-alert-1-$flag[0]'><div style='display:block;'><span class='style-1-icon $flag[0]'></span>";
				echo $message[$flag[0]];
				echo "</div></div>";
			} 
		?>
	</div>	
	
<?php } ?>
<?php if($this->call != 'ajaxcall'){ ?>
<?php if(!empty($this->employeedata))
 {
       	echo $this->employeedetails($this->employeedata,'edit',$this->id); 
 } 
?>


<div class="right-block-data"> 
<div id="error_message" style="display:none;"></div>
	<form name="<?php echo $this->form->getName(); ?>" id="<?php echo $this->form->getId(); ?>" action="<?php echo $this->form->getAction();?>" method="<?php echo $this->form->getMethod(); ?>">
		<?php echo $this->form->id;
                sapp_Global::generateClientValidations($this->form);
                ?>
			<div class="total-form-controller">
            <div class="view-form-detail fullwidth">
			    <div class="new-form-ui inputheight" style="width:400px;">
				  <label class="required">Holiday Group Name</label>
				  <div class="division division_new"><?php echo $this->form->holiday_group_name; ?></div>
				</div>
			 </div>	
			 <div class="position_rel">
				<div class="new-form-ui inputheight">
				  <label class="required">Holiday Group</label>
				<div class="division"><?php echo $this->form->holiday_group; ?>
                                    <?php if(isset($this->msgarray['holiday_group'])){?>
				   <span class="errors" id="errors-<?php echo $this->form->holiday_group->getId(); ?>"><?php echo $this->msgarray['holiday_group'];?></span>
				<?php }?>
				  <?php if($this->holidayGroupConfigPermission == 'Yes') { ?>	
					<span class="add-coloum" onclick="displaydeptform('<?php echo BASE_URL.'holidaygroups/addpopup' ?>','Holiday Group');"> Add Holiday Group</span>			
				<?php } ?>
                </div>
				
				</div>
            
			<div class="new-form-ui-submit empedit-submit-setup">
					<?php echo $this->form->submit; ?>
					<button onclick="window.location.href='<?php echo BASE_URL; ?>employee';" type="button" id="Cancel" name="Cancel">Cancel</button>
			</div>
            </div>
			<input type="hidden" id="userid" name="userid" value="<?php echo $this->id;?>" />
	</div>    
	</form>
	
	<?php } 
if($this->call == 'ajaxcall'){
	$div = ''; $endDiv = ''; 
	echo $div.'<div id="msg" style="display:none;font-style: oblique; font-weight: bold; color: green;""></div>'.$this->employeegrid($this->dataArray[0]).$endDiv;
} else { 
    if(!empty($this->dataArray))
	{
		$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->employeegrid($this->dataArray[0]).$endDiv;
	}else
    {
	    $div = '<div style="display:none;" id="grid_empholidays" class="all-grid-control">'; $endDiv = '</div>';
		echo $div.'<div id="msg" style="display:none;font-style: oblique; font-weight: bold; color: green;""></div>';
    }   	
}
	


if($this->call != 'ajaxcall'){ ?>
</div>	
</div>
</div>
<div id="empholidaysContainer"  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="empholidaysCont" class="business_units_iframe" frameborder="0"></iframe>

</div>
<?php	}	?>

<div id="holidaygroupsContainer"  style="display: none; overflow: auto;">
	<div class="heading">
		<a href="javascript:void(0)">
	    <img src="<?php echo $this->baseUrl().'/public/media/';?>images/close.png" name="" align="right" border="0" hspace="3" vspace="5" class="closeAttachPopup" style="margin: -24px 8px 0 0;"> </a>
	</div>

	<iframe id="holidaygroupsCont" class="business_units_iframe" frameborder="0"></iframe>
</div>

<script type='text/javascript'>
$(document).ready(function(){

<?php if (count($this->messages)) {?>
      setTimeout(function(){
			$('#dispmsgempholidays').fadeOut('slow');
		},3000);

<?php } ?>
if($('#holiday_group').val() == '')
{
    $('#grid_empholidays').hide();	
}        
    $("#emp_holidays").addClass('active');
    $("#emp_holidays").removeAttr("onclick");

})
</script>
<?php	}	?>