<?php //print_r($usertype);exit; ?>
    <section class="content-header">
      <h1>
        Free Lady Pictures
      </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>

    <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>
                <a class="btn btn-primary margin-right pull-right" href="<?php echo base_url()?>admin/dashboard/confirmed_images">Confirmed Images</a>
              </div>
               
              <div></div>
            <!-- /.box-header -->
            <div class="box-body">
            <input class="check" type="checkbox" name="check_all" value="1"> Check All Unconfirmed
            <form action="" method="post" id="form" >
              <input type="submit" name="Approve" value="APPROVE" style="display:none;" class="approve btn btn-primary">
              <input type="submit" name="Reject" value="REJECT" style="display:none;" class="reject btn btn-primary">
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>#</th>
                  <th></th>
                  <th>Pseudonym</th>
                  <th>Registered</th>
                  <th>Images</th>
                  <th>Status</th>
                  <th>Action</th>
                </tr>
                </thead>
                 <?php if(count($userImage)>0)
                {?>
                <tbody>
               <?php
                $i=1;
                foreach ($userImage as $data) 
                {
                ?>
                <tr>
                    <td><?php echo $i; ?></td>
                    <td><?php if($data['accepted']==0){ ?><input class="check" type="checkbox" name="selected[]" value="<?php echo $data['id']; ?>"><?php } ?></td>
                    <td><?php echo $data['username']; ?></td>
                    <td><?php echo date('d-m-Y h:i:s',$data['created']);?></td>
                    <td><img src="<?php echo base_url().'assets/userfiles/'.$data['path'].'/'.$data['filename'].'.'.$data['extension'] ;?>" width="100"></td>
                    <td><?php if($data['accepted']==1){ echo 'Confirmed'; } ?></td>
                    <td>
                    <?php if($data['accepted']==0){ ?>
                      <a href="<?php echo base_url();?>admin/dashboard/free_picture_approve/<?php echo base64_encode($data['id']);?>/<?php echo str_replace('/','-',uri_string()); ?>" title="Approve" onclick="return confirm('Are you sure to approve ?');"><span class="fa fa-check"></span></a>
                      <a href="<?php echo base_url();?>admin/dashboard/free_picture_reject/<?php echo base64_encode($data['id']);?>/<?php echo str_replace('/','-',uri_string()); ?>" title="Reject" onclick="return confirm('Are you sure to reject ?');"><span class="fa fa-ban"></span></a>
                    <?php } ?>
                    </td> 
                </tr>

               <?php $i++; } ?>

                </tbody>
                <?php } ?>
                <tfoot>
               
                </tfoot>
              </table>
              </form>
                <div class="custom_pagination"><?php echo $link; ?></div>
              
            </div>
            <!-- /.box-body -->
          </div>
          <!-- /.box -->
        </div>
        <!-- /.col -->
      </div>
      <!-- /.row -->
    </section>
    

    
<script>
  $(function () {
    $("#example1").DataTable({
      "pageLength": 100
    });

    $('.check').click(function(){
      if($('#form input:checked').length > 0)
      {
        $('.approve').show();
        $('.reject').show();
      }
      else
      {
        $('.approve').hide();
        $('.reject').hide();
      }
    })

    $('.custom_pagination a').click(function(e){
      e.preventDefault();
      $('#search_frm').attr('action',$(this).attr('href'));
      $('#search_frm').submit();
    })
    $('input[name="check_all"]').click(function(){
      if($(this).is(':checked')){
        $('.check').prop('checked','checked');
        $('.approve').show();
        $('.reject').show();
      }
      else
      {
        $('.check').prop('checked',false);
        $('.approve').hide();
        $('.reject').hide();
      }
    })
  });
</script>
<style type="text/css">
  .dataTables_length, .dataTables_filter{ display: none; }
</style>