<?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
$baseUrl = $this->serverUrl().$this->baseUrl();
if($this->rowexist !=''){?>
     <div class="ml-alert-1-info m1-info-set">
				<div class="style-1-icon info"></div>
						No data found.
	</div>

<?php 
}else
{

sapp_Global::generateClientValidations($this->form);?>
<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; ?>
        
		    <div class="new-form-ui">
			  <label class="required"><?php echo $this->form->managerstatus->getLabel(); ?></label>
			<div class="division"><?php echo $this->form->managerstatus; ?></div>
			<?php if(isset($this->msgarray['managerstatus'])){?>
			   <span class="errors" id="errors-<?php echo $this->form->managerstatus->getId(); ?>"><?php echo $this->msgarray['managerstatus'];?></span>
			<?php }?>
			</div>
			<div class="new-form-ui textareaheight">
			  <label>Comments</label>
			<div class="division"><?php echo $this->form->comments; ?></div>
			<?php if(isset($this->msgarray['comments'])){?>
			   <span class="errors" id="errors-<?php echo $this->form->reason->getId(); ?>"><?php echo $this->msgarray['comments'];?></span>
			<?php }?>
			</div>
			<?php 
sapp_Helper::viewHeader();
sapp_Helper::viewBody('alt','Employee Name',$this->form->employeename->getValue(),'Leave Type',$this->data['leavetypeid']);
sapp_Helper::viewBody('nor','From Date',$this->form->from_date->getValue(),'To Date',$this->form->to_date->getValue());
sapp_Helper::viewBody('alt','Leave For',$this->data['leaveday'],'Days',$this->form->appliedleavesdaycount->getValue());
if($this->data['leavestatus']=='Approved') {
		sapp_Helper::viewBody('alt','Approved On',sapp_Global::change_date($this->data['modifieddate'],'view'),'Comments',$this->data['approver_comments']);
	}

sapp_Helper::viewFooter();
?> 

			<div class="new-form-ui-submit">
			<?php echo $this->form->submit; ?>
			<button onclick="window.location.href='<?php echo BASE_URL; ?>manageremployeevacations';" type="button" id="Cancel" name="Cancel">Cancel</button>
			</div>
		
       </div>
</form>
<?php } ?>
	
<?php if(count($this->leave_history)>0) {?>
<div class="history-info-div">
    <div class="history-div">
    	<h2>Leave Request History</h2>
<?php 

    foreach($this->leave_history as $history)
    {       
?>
        <div class="history-flow">
            <div class="history-img"><img width="28" height="28" border="0" src="<?php echo $baseUrl; ?>/public/uploads/profile/<?php echo $history['emp_profile_img'];?>" onerror="this.src='<?php echo MEDIA_PATH; ?>images/profile_pic.png'" /></div>
            <div class="history-text"><span><?php echo trim($history['history']);?></span><b><?php echo sapp_Global::change_date($history['hdate'], 'view');?>  <?php echo sapp_Global::getDisplaySDTime($history['htime']);?></b></div>
        </div>
<?php         
    }
?>                
    </div>
 </div>   
 <?php         
    }
?>   
<script type='text/javascript'>
$(document).ready(function(){
   <?php if($this->data['leaveday'] == 2){?>
           $("#todate_employeeedit").hide();
   <?php }?>
});
</script>

