<div class="row">
    <div class="col-md-7 my-2">
        <h3 class="fmon">Customers</h3>
    </div>
    <div class="col-md-5 my-2">
        <div class="row">
            <div class="col-md-6 ">
                <a href="<?php echo base_url('Customer'); ?>" class="btn btnC w-100">New Customers</a>
            </div>
            <div class="col-md-6 ">
                <a href="<?php echo base_url('Customer/approvedcustomer'); ?>" class="btn btnC2 w-100">Approved
                    Customers</a>
            </div>
        </div>
    </div>

</div>

<div class="row">
    <div class="col-md-12">
        <table class="table table-striped" id="tablecustomer">
            <thead class="thead-dark">
                <tr>
                    <th scope="col">Name</th>
                    <th scope="col">Email</th>
                    <th scope="col">Phone</th>
                    <th scope="col">Front Id</th>
                    <th scope="col">Back Id</th>
                    <th scope="col">Loyalty Coins</th>
                    <th scope="col">Actions</th>
                </tr>
            </thead>
            <tbody>

                <?php
                if (!empty($customerlist)) {

                    $count = 1;
                    foreach ($customerlist as $id => $user) {
                        

                ?>
                        <tr>
                            <td><?php echo $user['firstName'] . ' ' . $user['lastName']; ?></td>
                            <td><?php echo $user['email']; ?></td>
                            <td><?php echo $user['phoneNumber']; ?></td>
                            <td>
                            <?php if($user['idFront'] !=""){?>
                                <a href="<?php echo  $user['idFront'];?>" target="blank"><img class="img-thumbnail" style="max-height:75px;max-width:75px;" src="<?php echo  $user['idFront'];?>"/></a>
                            <?php } ?>

                            
                            </td>
                            <td>
                            <?php if($user['idBack'] !=""){?>
                                <a href="<?php echo  $user['idBack'];?>" target="blank"><img class="img-thumbnail" style="max-height:75px;max-width:75px;" src="<?php echo  $user['idBack'];?>"/></a>
                            <?php } ?>

                            
                            </td>
                            <td><?php echo $user['points']; ?></td>
                            <td>

                                <div class="dropdown">
                                    <button class="btn btnelep2" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                                        <img src="./assets/images/ellep.png" alt="">
                                    </button>
                                    <ul class="dropdown-menu">
                                        <?php if ($user['isApproved']==true) { ?>
                                            <li><a class="dropdown-item"
                                                    href="<?php echo base_url('Customer/suspendCustomer/') . $id; ?>">Disable</a>

                                            <?php } else { ?>
                                            <li><a class="dropdown-item"
                                                    href="<?php echo base_url('Customer/unSuspendCustomer/') . $id; ?>">Approve </a>
                                            <?php } ?>
                                            <li><a class="dropdown-item"
                                                    href="<?php echo base_url('Customer/editcustomers/') . $id; ?>">edit</a></li>
                                            <li><a class="dropdown-item"
                                                    href="<?php echo base_url('Customer/deleteCustomer/') . $id; ?>">delete</a></li>

                                    </ul>
                                </div>

                            </td>
                        </tr>
                <?php }
                } ?>


            </tbody>
        </table>
    </div>
</div>

<script src="<?php echo base_url('assets/js/jquery.min.js'); ?>"></script>
<script>
    $(document).ready(function() {
        $('#tablecustomer').DataTable();
    });
</script>