<div class="row">

			<div class="col-sm-12">
				  	<div class="panel panel-info">
                            <div class="panel-heading"> <i class="fa fa-list"></i>&nbsp;&nbsp;<?php echo get_phrase('list_leave'); ?></div>
							


<div class="panel-wrapper collapse in" aria-expanded="true">
                                <div class="panel-body table-responsive">
 								<table id="example23" class="display nowrap" cellspacing="0" width="100%">    <thead>
        <tr>
            <th><div>#</div></th>
            <th><div><?php echo get_phrase('employee'); ?></div></th>
            <th><div><?php echo get_phrase('start_date'); ?></div></th>
            <th><div><?php echo get_phrase('end_date'); ?></div></th>
            <th><div><?php echo get_phrase('reason'); ?></div></th>
            <th><div><?php echo get_phrase('status'); ?></div></th>
            <th><div><?php echo get_phrase('options'); ?></div></th>
        </tr>
    </thead>
    <tbody>

    			<?php 
				$count = 1;
				$leave = $this->db->get('leave')->result_array();
				foreach($leave as $key =>$leave): 
				$user = explode('-', $leave['teacher_id']);
				$user_type  = $user[0];
				$user_id = $user[1];
				$user = $this->db->get_where($user_type, array($user_type . '_id' => $user_id))->row();
			
			?>
   
            <tr>
                <td><?php echo $count++;?></td>
                <td><?=$user->name;?></td>
                <td><?php echo $leave['start_date'];?></td>
                <td><?php echo $leave['end_date'];?></td>
                <td><?php echo substr($leave['reason'], 0, 50) . '...';?></td>
                <td>
                
                <?php if($leave['status'] == 1) 
                echo '<div class="label label-success">' . get_phrase('approved') .'</div>';
                if($leave['status'] == 0) 
                echo '<div class="label label-warning">' . get_phrase('pending') . '</div>';
                if($leave['status'] == 2) 
                echo '<div class="label label-danger">' . get_phrase('declined') . '</div>';?>
				 <a onclick="showAjaxModal('<?php echo base_url();?>modal/popup/leave_reasons/<?php echo $leave['leave_code'];?>')" class="btn btn-info btn-sm btn-rounded">Reasons...</a>
                </td>

                <td>
                
                <a onclick="showAjaxModal('<?php echo base_url();?>modal/popup/edit_leave/<?php echo $leave['leave_code'];?>')" class="btn btn-info btn-circle btn-xs"><i class="fa fa-edit"></i></a>
                <a onclick="confirm_modal('<?php echo base_url();?>admin/leave/delete/<?php echo $leave['leave_code'];?>')" class="btn btn-danger btn-circle btn-xs" style="color:white"><i class="fa fa-times"></i></a>
                
                </td>
            </tr>

            <?php endforeach;?>

    </tbody>
</table>

</div>
			</div>
			</div>
			</div>
			</div>
            <!----TABLE LISTING ENDS--->