<?php //print_r($usertype);exit; ?>
    <section class="content-header">
      <h1>
        Newsletter activity users
      </h1>
      <ol class="breadcrumb">
        <li><a href="<?php echo base_url().'admin';?>"><i class="fa fa-dashboard"></i> Home</a></li>
        <li class="active">List</li>
      </ol>
    </section>
    <form action="" method="post">
    <section class="content">
      <div class="row">
        <?php echo $this->utility->showMsg();?>
        <div class="col-xs-12">
          <div class="box">
            <div class="box-header">
              <h3 class="box-title">Management</h3>
              <?php if(chkWritePermission('Newslettter_activity_users',$this->session->userdata('admin_id'))!=0 || $this->session->userdata('admin_id')=='19624' ){ ?>
                <a class="btn btn-primary margin-right pull-right" href="<?php echo base_url()?>admin/activity/add">Add</a>
              <?php } ?>
              </div>
               
              <div></div>
            <!-- /.box-header -->
            <div class="box-body">
            <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>#</th>
                  <th>Date</th>
                  <th>Couple of the week</th>
                  <th>Lady of the week</th>
                  <th>Gentleman of the week</th>
                  <th>Status</th>
                  <?php if(chkWritePermission('Newslettter_activity_users',$this->session->userdata('admin_id'))!=0 || $this->session->userdata('admin_id')=='19624' ){ ?>
                  <th>Action</th>
                  <?php } ?>
                </tr>
                </thead>
                 <?php  if(count($couple_lady)>0)
                {?>
                <tbody>
               <?php
                $sent=0;
                $i=1;
                $ladyImage = array();
                $lady = array();
                foreach ($couple_lady as $key=>$data) 
                {
                  $lady = getValue('feu_userdetails',array('user_id'=>$data['lady']));
                  if(!empty($lady) && $lady['avatar_file_id']>0)
                  {
                    $ladyImage = getValue('sys_files',array('id'=>$lady['avatar_file_id']));
                    //echo $this->db->last_query();
                  }
                  $gentleman = getValue('feu_userdetails',array('user_id'=>$data['gentleman']));
                  if(!empty($gentleman) && $gentleman['avatar_file_id']>0)
                  {
                    $gentlemanImage = getValue('sys_files',array('id'=>$gentleman['avatar_file_id']));
                    //echo $this->db->last_query();
                  }
                ?>
                <tr>
                    <td><?php echo $i; ?></td>
                    <td><?php if($key == 0){ echo '<span style="color:green">Yet to be sent</span>'; } elseif(strtotime($data['end_date'].'10:00:00')>time()){ echo '<span style="color:green">'.$data['end_date'].'</span>'; } else { echo '<span style="color:red">'.$data['end_date'].'</span>';} ?></td>
                    <td>
                    <?php echo $data['username'].' <div style="width:150px; height:150px; overflow: hidden; display: inline-block; vertical-align: top; -webkit-border-radius:100%; -moz-border-radius:100%; -ms-border-radius:100%; -khtml-border-radius:100%; border-radius:100%;">
                             <img src="'.base_url().'assets/userfiles/'.$data['path'].'/'.$data['filename'].'.'.$data['extension'].'" aria-hidden="true" width="100%" height="150px" alt="alt_text" border="0"  style="display:block;">
                          </div>'; ?></td>
                    <td><?php echo $lady['username'].' <div style="width:150px; height:150px; overflow: hidden; display: inline-block; vertical-align: top; -webkit-border-radius:100%; -moz-border-radius:100%; -ms-border-radius:100%; -khtml-border-radius:100%; border-radius:100%;">
                             <img src="'.base_url().'assets/userfiles/'.$ladyImage['path'].'/'.$ladyImage['filename'].'.'.$ladyImage['extension'].'" aria-hidden="true" width="100%" height="150px" alt="alt_text" border="0"  style="display:block;">
                          </div>'; ?></td>
                    <td><?php echo $gentleman['username'].' <div style="width:150px; height:150px; overflow: hidden; display: inline-block; vertical-align: top; -webkit-border-radius:100%; -moz-border-radius:100%; -ms-border-radius:100%; -khtml-border-radius:100%; border-radius:100%;">
                             <img src="'.base_url().'assets/userfiles/'.$gentlemanImage['path'].'/'.$gentlemanImage['filename'].'.'.$gentlemanImage['extension'].'" aria-hidden="true" width="100%" height="150px" alt="alt_text" border="0"  style="display:block;">
                          </div>'; ?></td>
                    <td><?php if(time()<=strtotime($data['end_date'].'10:00:00')){ echo 'Yet to be send'; }else{ echo 'Sent'; } ?></td>
                    <?php if(chkWritePermission('Newslettter_activity_users',$this->session->userdata('admin_id'))!=0 || $this->session->userdata('admin_id')=='19624' ){ ?>
                    <td><a href="<?php echo base_url();?>admin/activity/delete/<?php echo base64_encode($data['id']);?>" title="Delete" onclick="return confirm('Are you sure to delete ?');"><span class="fa fa-ban"></span></a></td>
                    <?php } ?>
                </tr>

               <?php $i++; } ?>

                </tbody>
                <?php } ?>
                <tfoot>
               
                </tfoot>
              </table>
              
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->

    </section>
    </form>
    <style type="text/css">
      .dataTables_info, .dataTables_paginate {   
      /*display: none;*/
      }
    </style>

    
<script>
  $(function () {
    $("#example1").DataTable();

    $('.custom_pagination a').click(function(e){
      e.preventDefault();
      $('#search_frm').attr('action',$(this).attr('href'));
      $('#search_frm').submit();
    })
  });
</script>
<style type="text/css">
  .dataTables_length, .dataTables_filter{ display: none; }
</style>