<div class="panel panel-default">
    <div class="panel-heading panel-heading-view-pg">Users
        <?php if(isViewable('add')){?>
    <a type="button" class="btn btn-primary pull-right" href="<?php echo base_url('users/add');?>">Add Users</a>
    <?php }?>
    </div>
    <div class="panel-body">
        <div class="table-responsive">
                <table class="table jstablesecprtsec">
                    <thead>
                    <tr>
                        <th>S.no.</th>
                        <th>User Name</th>
                        <th>User Email</th>
                        <th>User Password</th>
                        <th>Action</th>
                    </tr>
                    </thead>
                    <tbody>
                    <?php $i=0;foreach ($Users as $user): $i++;?>
                    <tr>
                        <td><?php echo $i;?></td>
                        <td><?php echo $user->user_name;?></td>
                        <td><?php echo $user->user_email;?></td>
                        <td><?php echo $user->user_password;?></td>
                        <td class="flx-prt">

                            <?php if (isViewable('edit')){?>
                            <a href="<?php echo base_url('users/edit/'.$user->user_id);?>" class="btn btn-info" role="button" title="Edit <?php echo $user->user_name?>"><i class="fa fa-pencil" aria-hidden="true"></i>Edit</a>
                            <?php } ?>
                            <?php if (isViewable('delete')){?>
                              <a class="btn btn-danger" title="Delete" role="button" data-toggle="modal" data-target="#exampleModal<?php echo $i+1;?>"><i class="fa fa-trash" aria-hidden="true"></i>Delete</a>
                            <?php } ?>
                        </td>
                    </tr>

                           <!-- Modal -->
                            <div class="modal fade" id="exampleModal<?php echo $i+1;?>" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true" style="top: 20%;">
                              <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                  <div class="modal-header">
                                    <h5 class="modal-title" id="exampleModalLabel"><?php echo $user->user_name?> Delete</h5>
                                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                                      <span aria-hidden="true">&times;</span>
                                    </button>
                                  </div>
                                  <div class="modal-body">
                                    Are You Sure Want to Delete?
                                  </div>
                                  <div class="modal-footer">
                                    
                                    <a href="<?php echo base_url('users/delete/'.$user->user_id);?>"><button type="button" class="btn btn-primary"> Yes</button></a>
                                    <button type="button" class="btn btn-secondary" data-dismiss="modal">No</button>
                                  </div>
                                </div>
                              </div>
                            </div>
                    
                    <?php endforeach;?>
                    </tbody>
                </table>
            </div>
    </div>
</div>