<?php 
//print_r($blog_article_details);exit; 
?>
    <section class="content-header">
      <h1>
        Hotshot Picture
      </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>
              
            </div>
               
            <div></div>
            <!-- /.box-header -->
            <div class="box-body">
              <table id="example1" class="table table-bordered table-striped">
                <thead>
                <tr>
                  <th>#</th>
                  <th>Username</th>
                  <th>Email</th>
                  <th>Total Hotshot</th>
                  <th>Age</th>
                  <th>Image</th>
        				  <th>Total Uploaded Images</th>
                  <th>Attended Parties</th>
                </tr>
                </thead>
                 <?php if(count($receive_hotshot)>0)
                {?>
                <tbody>
               <?php
                $i=1;
                foreach ($receive_hotshot as $data) 
                {
                  $age = 0;
                  if($data['dob_gentleman']>0 && ($data['dob_lady']=='' || $data['dob_lady']==0))
                  {
                    $age = (time() - $data['dob_gentleman'])/(365*24*60*60);
                  }
                  if($data['dob_lady']>0 && ($data['dob_gentleman']=='' || $data['dob_gentleman']==0))
                  {
                    $age = (time() - $data['dob_lady'])/(365*24*60*60);
                  }
                  if($data['dob_lady']>0 && $data['dob_gentleman']>0)
                  {
                    $lady_age = (time() - $data['dob_lady'])/(365*24*60*60);
                    $gentleman_age = (time() - $data['dob_gentleman'])/(365*24*60*60);
                    $age = ($lady_age+$gentleman_age)/2;
                  }
                ?>
                <tr>
                    <td><?php echo $i;?></td>
                    <td><?php echo $data['username']; ?></td>
                    <td><?php echo $data['email']; ?></td>
                    <td><?php echo $data['count']; ?></td>
                    <td><?php if($age>0) { echo round($age); }else{ echo 'NA'; } ?></td>
                    <td><?php if($data['filename']>0) { echo '<img src="'.base_url().'assets/userfiles/'.$data['path'].'/80/'.$data['filename'].'.'.$data['extension'].'" >'; }else { echo '<img src="'.base_url().'assets/images/crown_log.svg" height="80">'; } ?></td>
          					<td><?php echo $data['images']; ?></td>
                    <td><?php echo $data['attend']; ?></td>
                </tr>

               <?php $i++; } ?>

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

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