<div class="widget-box ">
<div class="clearfix"></div>

<div class="hr dotted"></div>

<div>
<div class="alert alert-block alert-info">
 <h4 class="lighter arial red" style="text-align:center;"><b>Employee Leave List</b></h4>
 </div>
									<div id="user-profile-1" class="user-profile row">
									    <div class="col-xs-12 col-sm-4">

											<div class="space-12"></div>

											<div class="widget-box">
                                             <?php
                                                    $message = $this->session->userdata('message');
                                                    if (!empty($message)) {
                                                        ?>
                                                        <div class="alert alert-block alert-success">
                                                            <h6 class="lighter arial green" style="text-align:center;"><b>
                                                                    <?php echo $message;
                                                                    $this->session->unset_userdata('message');
                                                                    ?>
                                                                </b></h6>
                                                        </div>  
                                                        <?php
                                                    }
                                                    $errormessage = $this->session->userdata('errormessage');
                                                    if (!empty($errormessage)) {
                                                        ?>
                                                        <div class="alert alert-block alert-danger">
                                                            <h6 class="lighter arial red" style="text-align:center;"><b>
                                                                    <?php echo $errormessage;
                                                                    $this->session->unset_userdata('errormessage');
                                                                    ?>
                                                                </b></h6>
                                                        </div> 
                                                        <?php
                                                    }
                                                    ?>
                                <div class="widget-header">
                                    <h4 class="widget-title">Add Leaves</h4>
                                </div>
                    
                                <div class="widget-body">
                                    <div class="widget-main no-padding">
                                        <form action="<?php echo admin_url()?>/employeesetup/addLeave" method="post">
                                            <!-- <legend>Form</legend> -->
                                            <fieldset >
                                                <label class="col-xs-4 col-sm-4">Employee</label>
                                                <?php echo form_error('data[lv_employee]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                                                 
                                                 <select  name="data[lv_employee]" class="col-xs-8 col-sm-8" id="form-field-select-3" data-placeholder="Choose a State...">
                                                     <option value=""> Select Employee Id......  </option>
                                                     <?php if(!empty($allEmployeeId)){
                                                            foreach($allEmployeeId as $value){
                                                        ?>
                                                        <option value="<?php echo $value['userId'];?>" <?php echo set_select('data[lv_employee]',$value['userId'],FALSE);?>>
                                                            <?php 
                                                                echo $value['userId']; $emp_usrname=getEmployeeById($value['userId']); echo "(".$emp_usrname['userName']." ) ";
                                                               
                                                            ?>
                                                        </option>
                                                        <?php }
                                                            }
                                                        ?>
                                                </select>
                                                
                                             </fieldset>
                                            <fieldset>
                                                <label class="col-xs-4 col-sm-4">Type </label>
                                                <!--<input type="hidden" name="data[lv_employee]" value="<?php if(!empty($employeeById['userId'])){ echo $employeeById['userId'];}?>">-->
                                                <select class="col-xs-8 col-sm-8" name="data[lv_type]">
                                                    <option value="1">Casual Leave</option>
                                                    <option value="2">Sick Leave</option>
                                                    <option value="3">Maternity Leave</option>
                                                    <option value="4">Earned Leave</option>
                                                    <option value="5">Quarantine Leave</option>
                                                    <option value="6">Half Pay Leave</option>
                                                    <option value="7">Study Leave</option>
                                                    <option value="8">Other Leave</option>
                                                </select>
                                            </fieldset>
                                            <fieldset>
                                                <label class="col-xs-4 col-sm-4">Start Date </label>
                                                <?php echo form_error('data[lv_start]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                                                <input type="date" name="data[lv_start]" autocomplete="off" value="" placeholder="" class="col-xs-8 col-sm-8" />
                                               
                                            </fieldset>
                                            <fieldset>
                                                <label class="col-xs-4 col-sm-4">Days </label>
                                                <?php echo form_error('data[lv_days]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                                                <input type="text" name="data[lv_days]" autocomplete="off" value="" placeholder="3,4 & 5 Jun" class="col-xs-8 col-sm-8" />
                                               
                                            </fieldset>
                                            
                                            <fieldset>
                                                <label class="col-xs-4 col-sm-4">No. of Leave </label>
                                                <?php echo form_error('data[lv_number]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                                                <input type="number" name="data[lv_number]" autocomplete="off" value="" placeholder="1 or 2 or 3 etc." class="col-xs-8 col-sm-8" />
                                               
                                            </fieldset>
                                            <fieldset>
                                                <label class="col-xs-4 col-sm-4">Year </label>
                                                <!--<input type="hidden" name="data[lv_employee]" value="<?php if(!empty($employeeById['userId'])){ echo $employeeById['userId'];}?>">-->
                                                <select class="col-xs-8 col-sm-8" name="data[lv_year]">
                                                    <?php 
                                                        $currentyear=date('Y'); $nextfiveyear=$currentyear +5; 
                                                        for($i=$currentyear; $currentyear <= $nextfiveyear; $currentyear++ ){
                                                            echo '<option value="'.$currentyear.'">'.$currentyear.'</option>';
                                                        }
                                                    ?>
                                                </select>
                                            </fieldset>
                                            <fieldset>
                                                <label class="col-xs-4 col-sm-4">Note </label>
                                                <?php echo form_error('data[lv_note]', '<div style="color: rgb(255, 0, 0);">', '</div>'); ?>
                                                <input type="text" name="data[lv_note]" autocomplete="off" value="" placeholder="Eg. Urgent meeting (keep short)" class="col-xs-8 col-sm-8" />
                                               
                                            </fieldset>
                    
                                            <div class="form-actions center">
                                                <button type="submit" class="btn btn-sm btn-success">
                                                     <i class="ace-icon fa fa-check bigger-110"></i>Save</button>
                                            </div>
                                        </form>
                                    </div>
                                </div>
                            </div>
										</div>
										
										<div class="col-xs-12 col-sm-8">
										    <div class="space-12"></div>
										    
        <!--<div class="widget-box">-->
        <!--    <div class="widget-header" style="height:40px;">-->
        <!--        <h5 style="text-align:center; color:red;"><b> Search By DateRange </h5>-->
        <!--    </div>-->

        <!--    <div class="widget-body">-->
        <!--        <div class="widget-main no-padding">-->
        <!--            <form action="http://ccare.hasanhomesltd.com/admin/extraincomesetup/searchBydaterange " method="post">-->
                    
        <!--                <fieldset class="col-xs-6 col-sm-4">-->
        <!--                        <div class="col-xs-4 col-sm-4"><label>From</label></div>-->
        <!--                                                        <div class="input-group col-xs-8 col-sm-8">-->
        <!--                            <input class="form-control date-picker" id="id-date-picker-1" type="text" name="data[fromdate]" value="" placeholder="dd-mm-yyyy" data-date-format="dd-mm-yyyy">-->
        <!--                            <span class="input-group-addon">-->
        <!--                                <i class="fa fa-calendar bigger-110"></i>-->
        <!--                            </span>-->
        <!--                        </div>-->
        <!--                </fieldset>-->

        <!--                <fieldset class="col-xs-6 col-sm-4">-->
        <!--                        <div class="col-xs-4 col-sm-4"><label>To</label></div>-->
        <!--                                                        <div class="input-group col-xs-8 col-sm-8">-->
        <!--                            <input class="form-control date-picker" id="id-date-picker-1" type="text" name="data[todate]" value="" placeholder="dd-mm-yyyy" data-date-format="dd-mm-yyyy">-->
        <!--                            <span class="input-group-addon">-->
        <!--                                <i class="fa fa-calendar bigger-110"></i>-->
        <!--                            </span>-->
        <!--                        </div>-->
        <!--                </fieldset>-->
        <!--                <fieldset class="col-xs-6 col-sm-4">-->
        <!--                    <button type="submit" name="btnSdateRange" class="btn btn-sm btn-success">-->
        <!--                         <i class="ace-icon fa fa-undo bigger-110"></i>Search By DateRange -->
        <!--                    </button>-->
        <!--                    </fieldset>-->
        <!--            </form>-->
        <!--        </div>-->
        <!--    </div>-->
        <!--</div>-->
  
    
    
    
    
    
    

											

											<table id="dynamic-table" class="table table-striped table-bordered table-hover">
                                                <thead>
                                                    <tr style="color:red;">
                                                       
                                                        <th>Employee</th>
                                                        <th>Type</th>
                                                        <th>Leave</th>
                                                        <!--<th>Start Date</th>-->
                                                        <th>Days</th>
                                                        <th>Note</th>
                                                        <th>Year</th>
                                                        <th>Action</th>
                                                    </tr>
                                                </thead>
                                                <tbody>
                                                    <?php 
                                                        $i=1;
                                                        if(!empty($allLeaves)){
                                                    foreach($allLeaves as $leaves){ ?>
                                                    <tr>
                                                        <td>
                                                        <?php 
                                                        if(!empty($leaves['lv_employee'])){
                                                                $userId = $this->employeemodel->getEmployeeById($leaves['lv_employee']);
                                                                //echo "<a href='".base_url('admin/employeesetup/leaves').'/'.$leaves['lv_employee']."'>".$userId['userName']."</a>";
                                                                echo $userId['userName'];
                                                        }
                                                    ?>
                                                        </td>
                                                        <td><?php 
                                                            if($leaves['lv_type'] ==1)
                                                                {  echo "Casual Leave"; }
                                                            elseif($leaves['lv_type'] ==2)
                                                                {  echo "Sick Leave"; }
                                                            elseif($leaves['lv_type'] ==3)
                                                                {  echo "Maternity Leave"; }
                                                            elseif($leaves['lv_type'] ==4)
                                                                {  echo "Earned Leave"; }
                                                            elseif($leaves['lv_type'] ==5)
                                                                {  echo "Quarantine Leave"; }
                                                            elseif($leaves['lv_type'] ==6)
                                                                {  echo "Half Pay Leave"; }
                                                            elseif($leaves['lv_type'] ==7)
                                                                {  echo "Study Leave"; }
                                                            elseif($leaves['lv_type'] ==8)
                                                                {  echo "Other Leave"; }
                                                            else
                                                                {  echo "No leave type"; }
                                                        
                                                        ?></td>
                                                        <td><?php echo $leaves['lv_number'] ?></td>
                                                        <!--<td><?php // echo $leaves['lv_start'] ?></td>-->
                                                        <td><?php echo $leaves['lv_days'] ?></td>
                                                        <td><?php echo $leaves['lv_note'] ?></td>
                                                        <td><?php echo $leaves['lv_year'] ?></td>
                                                        <td> 
                                                        
                                                                <a class="green" href="<?php echo admin_url()?>/employeesetup/edit_leave/<?php echo $leaves['lv_id'];?> ">
                                                                    <i class="ace-icon fa fa-pencil bigger-130"></i>
                                                                </a>

                                                                <a class="red" href="<?php echo admin_url()?>/employeesetup/delete_leave/<?php echo $leaves['lv_id'];?> " onclick="return ConfirmDelete()">
                                                                    <i class="ace-icon fa fa-trash-o bigger-130"></i>
                                                                </a>
                                                                
                                                                
                                                        </td>
                                                    </tr>
                                                    
                                                    <?php }} ?>
                                                </tbody>
                                            </table>
										</div>
										
										
									</div>
								</div>
								
								</div>