<div class="content-wrapper">
   <div class="content-header">
     <div class="container-fluid">
        <div class="row mb-2">
           <div class="col-sm-6">
              <h1 class="m-0 text-dark">View All Workforce</h1>
           </div>
           <div class="col-sm-6">
              <ol class="breadcrumb float-sm-right">
                 <li class="breadcrumb-item"><a href="<?php echo base_url() ?>admin/admin/dashboard">Dashboard</a></li>
                 <li class="breadcrumb-item"><a href="#">Workforce Management</a></li>
                 <li class="breadcrumb-item active">View All Workforce</li>
              </ol>
           </div>
        </div>
     </div>
  </div>
   <section class="content">
      <div class="container-fluid">
         <div class="row">
            <div class="col-md-12">
               <div class="card">
                  <div class="card-header">
                     <h3 class="card-title">View All Workforce</h3>
                     <div class="float-right">
                        <a href="<?php echo base_url() ?>/admin/employee/add_new_employee" class="btn btn-success btn-sm">Add New Workforce</a>
                     </div>
                  </div>
                  <div class="card-body">
                     <table id="example1" class="example2 table table-bordered table-striped">
                        <thead>
                           <tr>
                              <th>Workforce Name</th>
                              <th>Details</th>
                              <th>Address</th>
                              <?php if(check_user_permission('delete') || check_user_permission('edit')): ?>
                                 <th></th>
                              <?php endif;?>
                           </tr>
                        </thead>
                        <tbody>
                           <?php $i=1; foreach ($all_users as $user): ?>
                           <tr>
                              <td><?php echo $user->user_name; ?></td>
                              <td>
                                 <span class="badge badge-success">Role : <?php echo $user->user_role; ?></span><br/>
                                 <span class="badge badge-secondary">Designation : <?php echo $user->user_designation; ?></span><br/>
                                 <span class="badge badge-info">Email : <?php echo $user->user_email; ?></span><br/>
                                 <span class="badge badge-primary">Mob : <?php echo $user->user_mobile; ?></span><br/>
                                 <span class="badge badge-warning">Date : <?php echo date('d-m-Y', strtotime($user->created_at)); ?></span>
                              </td>
                              <td><?php echo $user->user_address; ?>, <?php echo $user->user_post; ?>, <?php echo $user->user_dist; ?>, <?php echo $user->user_state; ?>-<?php echo $user->user_pin_code; ?></td>
                              <?php if(check_user_permission('delete') || check_user_permission('edit')): ?>
                                 <td>
                                    <!-- <a href="<?php echo base_url()?>/admin/user/login_user/<?php echo $user->user_id; ?>" onclick="return confirm('Are you sure?')" class="btn btn-info btn-sm"><i class="fas fa-sign-in-alt"></i></a> -->
                                    <?php if(check_user_permission('edit')): ?>
                                       <a href="<?php echo base_url()?>/admin/employee/update_employee/<?php echo $user->user_id; ?>" class="btn btn-success btn-sm"><i class="fas fa-edit"></i></a>
                                    <?php endif; ?>
                                    <?php if(check_user_permission('delete')): ?>
                                       <a href="<?php echo base_url()?>/admin/employee/delete_employee/<?php echo $user->user_id; ?>" onclick="return confirm('Are you sure?')" class="btn btn-danger btn-sm"><i class="fas fa-trash"></i></a>
                                    <?php endif; ?>
                                 </td>
                              <?php endif;?>
                           </tr>
                           <?php $i++; endforeach ?>
                        </tbody>
                     </table>
                  </div>
               </div>
            </div> 
         </div>
      </div>
   </section>
</div>
