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

  <!-- Page Heading -->
  <h1 class="h3 mb-2 text-gray-800">Daftar Order</h1>

  <!-- DataTales Example -->
  <div class="card shadow mb-4">
    <div class="card-header py-3">
      <a href="<?php echo base_url(); ?>admin/order/cetakall" target="_blank">
        <button type="button" name="button" class="btn btn-primary float-right">Cetak</button>
      </a>
    </div>
    <div class="card-body">
      <div class="table-responsive">
        <table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
          <thead>
            <tr>
              <th>No</th>
              <th>Username</th>
              <th>Keterangan</th>
              <th>Jumlah</th>
              <th>Harga</th>
              <th>Status</th>
              <th>File</th>
              <th>Created At</th>
              <th>Edit</th>
            </tr>
          </thead>
          <tbody>
            <?php
            $no = 1;
            foreach ($orders as $data) {
            ?>
            <tr>
              <td><?php echo $no; ?></td>
              <td><?php echo $data->username; ?></td>
              <td><?php echo $data->nama; ?></td>
              <td><?php echo $data->jumlah; ?></td>
              <td>
                <?= $data->price; ?>
              </td>
              <td><form method="post" action="<?php echo base_url(); ?>admin/order/update/<?php echo $data->id; ?>">
                <select class="form-control" name="status">
                  <option <?php echo $data->status=="Pending"?"selected":""; ?>>Pending</option>
                  <option <?php echo $data->status=="Proses"?"selected":""; ?>>Proses</option>
                  <option <?php echo $data->status=="Pembayaran Valid"?"selected":""; ?>>Pembayaran Valid</option>
                  <option <?php echo $data->status=="Selesai"?"selected":""; ?>>Selesai</option>
                </select>
                
              </td>
              <td>
                <a style='width: 50px; height: 50px; padding: 0px;  display: flex; align-items: center;justify-content: center;border-radius: 5px; background: lightgrey;border: 0px solid; filter: drop-shadow(2px 2px 5px lightgrey);' href="<?php echo base_url(); ?>assets/file/<?= $data->file;?>" download='<?= $data->file;?>'>
                  <img style='width: 50px; height: 50px;' src="<?php echo base_url(); ?>assets/img/download-icon.png" alt="" srcset="">
                </a></td>
              <td><?php echo date('d-m-Y H:i:s',strtotime($data->created_at)); ?></td>
              <td>
                <button type="submit" class="btn btn-warning btn-icon-split btn-sm">
                    <span class="icon text-white-50">
                      <i class="fas fa-edit"></i>
                    </span>
                    <span class="text">Update</span>
                </button>
              </form>
                <a href="<?php echo base_url(); ?>admin/order/wa/<?php echo $data->id; ?>" class="btn btn-info btn-icon-split btn-sm">
                    <span class="icon text-white-50">
                      <i class="fas fa-message"></i>
                    </span>
                    <span class="text">Send WA</span>
                </a>
                <a href="<?php echo base_url(); ?>admin/order/cetak/<?php echo $data->id; ?>" class="btn btn-success btn-icon-split btn-sm">
                    <span class="icon text-white-50">
                      <i class="fas fa-edit"></i>
                    </span>
                    <span class="text">Cetak Invoice</span>
                </a>
              </td>
            </tr>
            <?php
            $no++;
            }
             ?>
          </tbody>
        </table>
      </div>
    </div>
  </div>

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