<?php defined('BASEPATH') OR exit('No direct script access allowed'); ?>
<!doctype html>
<html lang="en">
<head>
 <?php $this->load->view('admin/includes/header-script')?>
 <title><?=TITLE?></title>
 <style type="text/css">
 .button {
   margin-top: -6px;
   padding: 4px 10px;
   text-align: center;
   font-family: 'HelveticaNeue-Condensed';
   font-size: 16px;
   position: relative;
   border: 0;
   background: #0070c0;
   color: #fff;
   top: -6px;
 }
</style>
</head>
<body class="pushmenu-push pushmenu-push-toright">
  <?php $this->load->view('admin/includes/left-menu')?> 
  <?php $this->load->view('admin/includes/header')?>
  <section class="admin-content">
   <div class="container">
    <h2>Order List</h2>
    <?php
    $success_msg= $this->session->flashdata('success_msg');
    $error_msg= $this->session->flashdata('error_msg');
    if($success_msg) { ?>
     <div class="alert alert-success">
      <?php echo $success_msg; ?>
      <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
    </div>
  <?php } if($error_msg){ ?>
   <div class="alert alert-danger">
    <?php echo $error_msg; ?>
    <a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
  </div>
<?php } ?>
<div class="col-md-12">
  <?php echo form_open('admin/order-search'); ?>
  <div class="form-group d-flex">
    <h3>Search</h3>
    <div class="col-md-3">
      <input class="form-control" type="text" name="orderno" placeholder="Order Number" value="<?= set_value('orderno') ?>">
    </div>
    <div class="col-md-3">
      <input class="form-control datepicker" type="text" name="fromedate" placeholder="Order From Date" value="<?= set_value('fromedate') ?>">
    </div>
    <h3>-</h3>
    <div class="col-md-3">
      <input class="form-control datepicker" type="text" name="todate" placeholder="Order To Date" value="<?= set_value('todate') ?>">
    </div>
    <div class="search-class col-md-3">
      <input class="search submitLink" name="submit" value="Search" style="cursor: pointer;" type="submit">
    </div>
  </div>
  <?php echo form_close(); ?>
  <div class="table-responsive ">
   <table class="table" >
    <thead>
      <tr style="font-weight: bold;">
        <th>Order Number</th>
        <th>Class Location</th>
        <th>Total Class</th>
        <th>Total Registrants</th>
        <th>Total Amonut</th>
        <th>Date Ordered</th>
        <th>Status</th>
        <th style="width: 170px">Action</th>
      </tr>
    </thead>
    <tbody>
     <?php foreach($all_order as $val) { ?>
      <tr>
        <td><?=$val->reg_id?></td>
        <td><?=$val->locat_name?></td>
        <td><?=$val->reg_class_count?></td>
        <td><?=$val->att_total_count?></td>
        <td><?='$ '.$val->reg_total.'.00'?></td>
        <td><?=date("d-m-Y",strtotime($val->reg_date))?></td>
        <td><?php if($val->status == "paid") { ?><span class="alert-success">Paid</span><?php } elseif ($val->status == "unpaid") { ?><span class="alert-danger"> Unpaid</span><?php } ?></td>
        <td>&nbsp<a href="<?=base_url();?>admin/view-order/<?=$val->reg_id?>/0" title="view"><img src="<?=base_url();?>assets/admin/img/eye.png" alt=""><a>&nbsp
          <a href="<?=base_url();?>admin/view-order/<?=$val->reg_id?>/1" title="print"><img src="<?=base_url();?>assets/admin/img/print.png" alt=""><a>&nbsp
            <a href="<?=base_url();?>order-delete/<?=$val->reg_id?>" onclick="return confirm('Are you sure want to Delete?')" title="Delete"><img src="<?=base_url();?>assets/admin/img/delete.png" alt=""><a>
              <?php if($val->status == "unpaid") { ?>
               <a href="<?=base_url();?>order-paid/<?=$val->reg_id?>"><input style="cursor: pointer;" class="button" type="submit" value="Paid" name=""></a>
             <?php } ?>
           </td>
         </tr>
       <?php } ?>
     </tbody>
   </table>
 </div>
 <div align="right">
  <ul class="pagination">
    <?php foreach ($links as $link) {
      echo "<li>". $link."</li>";
    } ?>    
  </ul>
</div>
</div>

<?php $this->load->view('admin/includes/footer-script')?> 
</body>
</html>