<div class="content-wrapper">
   <section class="content-header">
      <div class="container-fluid">
         <div class="row mb-2">
            <div class="col-sm-6">
               <h1>All Shop</h1>
            </div>
            <div class="col-sm-6">
               <ol class="breadcrumb float-sm-right">
                  <li class="breadcrumb-item"><a href="#">Home</a></li>
                  <li class="breadcrumb-item active">All Shop </li>
               </ol>
            </div>
         </div>
      </div>
   </section>
   <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 Shop</h3>
                     <div class="float-right">
                        <a href="<?php echo base_url() ?>/admin/vendor/add_new_user" class="btn btn-success btn-sm">Add New Shop</a>
                     </div>
                  </div>
                  <div class="card-body">
                     <table id="example1" class="example2 table table-bordered table-striped">
                        <thead>
                           <tr>
                              <th>Code</th>
                              <th>Shop Name</th>
                              <th>Details</th>
                              <th>Address</th>
                              <th>Total Order</th>
                              <?php if(user()->user_role == 'Admin' || user()->user_role == 'State Head' || user()->user_role == 'Dist Head'): ?>
                                 <th></th>
                              <?php endif; ?>
                           </tr>
                        </thead>
                        <tbody>
                           <?php $i=1; foreach ($all_users as $user): ?>
                           <tr>
                              <td><?php echo $user->user_stock_point_code; ?></td>
                              <td><?php echo $user->user_stock_point_name; ?></td>
                              <td>
                                 <span class="badge badge-success">Name : <?php echo $user->user_name; ?></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; ?></td>
                              <td><span class="badge badge-secondary"><i style="font-size:9px" class="fas fa-rupee-sign"></i> <?php if($user->order_value->order_price){echo $user->order_value->order_price;}else{echo 0;} ?></span></td>
                             
                                 <?php if(user()->user_role == 'Taluka Head' ||user()->user_role == 'State Head' || user()->user_role == 'Dist Head'): ?>
                                 <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>
                                    <a href="<?php echo base_url()?>/admin/vendor/update_user/<?php echo $user->user_id; ?>" class="btn btn-success btn-sm"><i class="fas fa-edit"></i></a>
                                 </td>
                                 <?php endif; 
                                 if(user()->user_role == 'Admin'): ?>
                                 <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>
                                    <a href="<?php echo base_url()?>/admin/vendor/update_user/<?php echo $user->user_id; ?>" class="btn btn-success btn-sm"><i class="fas fa-edit"></i></a>
                                    <a href="<?php echo base_url()?>/admin/vendor/delete_user/<?php echo $user->user_id; ?>" onclick="return confirm('Are you sure?')" class="btn btn-danger btn-sm"><i class="fas fa-trash"></i></a>
                                 </td>
                                 <?php endif; ?>
                              
                           </tr>
                           <?php $i++; endforeach ?>
                        </tbody>
                     </table>
                  </div>
               </div>
            </div> 
         </div>
      </div>
   </section>
</div>
