<!-- Begin Page Content -->
<div class="container-fluid">

    <!-- Page Heading -->
 <h1 class="h3 mb-2 text-gray-800">All Users (<?php echo $startdate; ?> - <?php echo $enddate; ?>)</h1>

    <!-- DataTales Example -->
    <div class="card shadow mb-4">
          <div class="card-header py-3">
        
            <div class="">
  
                <form id="dateFilterForm" >
                    <div class="form-row">
                        <!--
                        <div class="form-group col-md-6">
                        <label for="startDate">Start Date</label>
                        <input type="date" id="startDate" name="startDate" class="form-control">
                        </div>
                        <div class="form-group col-md-6">
                        <label for="endDate">End Date</label>
                        <input type="date" id="endDate" name="endDate" class="form-control">
                        </div>
-->
<div class="form-group col-md-6">
                        <label for="startDate">Year</label>
                        <select name="year" required class="form-control">
                        <option value="">Select Year</option>    
                        <option <?php if($selectyear=="2018"){echo 'selected';} ?> value="2018">2018</option>
                        <option <?php if($selectyear=="2019"){echo 'selected';} ?> value="2019">2019</option>
                        <option <?php if($selectyear=="2020"){echo 'selected';} ?> value="2020">2020</option>
                        <option <?php if($selectyear=="2021"){echo 'selected';} ?> value="2021">2021</option>
                        <option <?php if($selectyear=="2022"){echo 'selected';} ?> value="2022">2022</option>
                        <option <?php if($selectyear=="2023"){echo 'selected';} ?> value="2023">2023</option>
                        <option <?php if($selectyear=="2024"){echo 'selected';} ?> value="2024">2024</option>
                        <option <?php if($selectyear=="2025"){echo 'selected';} ?> value="2025">2025</option>
                        </select>

                        </div>
                        <div class="form-group col-md-6">
                        <label for="endDate">Month</label>
                        <select name="month" required class="form-control">
                        <option value="">Select Month</option>    
                        <option <?php if($selectmonth=="01"){echo 'selected';} ?> value="01">Jan</option>
                        <option <?php if($selectmonth=="02"){echo 'selected';} ?> value="02">Feb</option>
                        <option <?php if($selectmonth=="03"){echo 'selected';} ?> value="03">March</option>
                        <option <?php if($selectmonth=="04"){echo 'selected';} ?> value="04">Aprail</option>
                        <option <?php if($selectmonth=="05"){echo 'selected';} ?> value="05">May</option>
                        <option <?php if($selectmonth=="06"){echo 'selected';} ?> value="06">June</option>
                        <option <?php if($selectmonth=="07"){echo 'selected';} ?> value="07">July</option>
                        <option <?php if($selectmonth=="08"){echo 'selected';} ?> value="08">Auguest</option>
                        <option <?php if($selectmonth=="09"){echo 'selected';} ?> value="09">Septembar</option>
                        <option <?php if($selectmonth=="10"){echo 'selected';} ?> value="10">Octobar</option>
                        <option <?php if($selectmonth=="11"){echo 'selected';} ?> value="11">November</option>
                        <option <?php if($selectmonth=="12"){echo 'selected';} ?> value="12">December</option>
                        </select>
                        
                        </div>
                        <button type="submit" class="btn btn-primary">Filter</button>
                    </div>
                    
                    
                </form>

            </div>

        </div>
        <div class="card-body">
            <div class="table-responsive">
                <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
                    <thead>
                        <tr>
                            <th>Full Name</th>
                            <th>UserName</th>
                            <th>Phone</th>
                            <th>Total Reminder</th>
                            <th>Archived Reminder</th>
                            <th>Email</th>
                            <th>Country</th>
                            <th>Login</th>

                            <th>Image</th>
                            <th>Actions</th>
                        </tr>
                    </thead>
                    <tfoot>
                        <tr>
                            <th>Full Name</th>
                            <th>UserName</th>
                            <th>Phone</th>
                            <th>Total Reminder</th>
                            <th>Archived Reminder</th>
                            <th>Email</th>
                            <th>Country</th>
                            <th>Login</th>
                            <th>Image</th>
                            <th>Actions</th>
                        </tr>
                    </tfoot>
                    <tbody>
                        <?php



                           if (!empty($customerlist)) {
                              $count = 1;
                              foreach ($customerlist as  $customerlists) {
                                $totalreminder=0;
                                $archiver=0;
                                foreach($reminderlist as $r){
                                    if($customerlists['id']==$r['userId']){
                                       $totalreminder=$totalreminder+1;
                                       if($r['isArchive']==true){
                                        $archiver=$archiver+1;
                                        } 
                                    }

                                }
                                
                        ?>
                        <tr>
                        <td> <?php echo output($customerlists['firstName']." ".$customerlists['lastName']); ?></td>
                        <td> <?php echo output($customerlists['userName']); ?></td>
                            <td> <?php echo output($customerlists['phoneNumber']); ?></td>
                            <td> <?php echo output($totalreminder); ?></td>
                            <td> <?php echo output($archiver); ?></td>
                            <td><?php echo output($customerlists['email']); ?></td>
                            <td><?php echo output($customerlists['country']); ?></td>
                            <td><?php echo output($customerlists['deviceType']); ?></td>


                            <td>
                                <?php if ($customerlists['image'] != "") { ?>

                                <img class="img-thumbnail" width="100" height="100" src="<?php echo output($customerlists['image']); ?>">
                                <?php } else { ?>
                                <img class="img-thumbnail" src="http://placehold.jp/100x100.png">
                                <?php } ?>
                            </td>
                            <td>
                                 <?php if ($customerlists["isActive"] == false) {
                                    ?>
                                <a class="icon" style="text-decoration: none;" href="<?php echo base_url(); ?>customer/lettsunSuspendCustomer/<?php echo output($customerlists['id']); ?>">
                                    <button class="btn btn-success btn-block mt-2">Activate</button>
                                </a>
                                <?php
                                    } else {
                                    ?>
                                <a class="icon" style="text-decoration: none;" href="<?php echo base_url(); ?>customer/lettssuspendCustomers/<?php echo output($customerlists['id']); ?>">
                                    <button class="btn btn-warning btn-block mt-2">Suspend</button>
                                </a>
                                <?php
                                    } ?> 
                                <!-- <a class="icon" style="text-decoration: none;" href="<?php echo base_url(); ?>customer/editcustomer/<?php echo output($id); ?>">
                                    <button class="btn btn-info btn-block mt-2">Update</button>
                                </a> -->
                                <a class="icon" style="text-decoration: none;" href="<?php echo base_url(); ?>customer/lettdeleteCustomer/<?php echo output($customerlists['id']); ?>">
                                    <button class="btn btn-danger btn-block mt-2">Delete</button>
                                </a>
                            </td>
                        </tr>
                        <?php  } } ?>
                    </tbody>
                </table>
            </div>
        </div>
    </div>

</div>
<!-- /.container-fluid -->