<div class="row">
    <div class="col-md-7 my-2">
        <h3 class="fmon">Orders</h3>
    </div>
    <div class="col-md-5 my-2">
        <div class="row">

        </div>
    </div>

</div>

<div class="row">
    <div class="col-md-12">
        <table class="table table-striped" id="vendortable">
            <thead class="thead-dark">
                <tr>
                    <th scope="col">Date</th>

                    <th scope="col">Venodor</th>
                    <th scope="col">Address</th>
                    <th scope="col" class="text-nowrap">Status</th>
                    <th scope="col">TotalProducts</th>
                    <th scope="col">Price</th>
                    <th scope="col">Actions</th>

                </tr>
            </thead>
            <tbody>
                <?php foreach ($trips as $v => $d) {
                    $name="";
                    if($d['vendorId'] !=""){
                  //$vendorinfo=$this->common->readdatadocument("Bookings", $d['vendorId']);
                  
                    }


                ?>
                <tr>
                    <td class="text-nowrap"><?php echo date("Y-m-d",$d['date']/1000) ; ?></td>
                    <td><?php echo getusername($d['vendorId']); ?></td>
                    <td><?php echo $d['address']['address'] ?></td>
                    <td>
                        <?php


                              switch ($d['orderStatus']) {
                                case 'process':
                                  $status = '<span class="badge badge-info bg-info">Process</span>';
                                  break;
                                case 'processing':
                                  $status = '<span class="badge badge-warning bg-warning">Processing</span>';
                                  break;
                                case 'booked':
                                  $status = '<span class="badge badge-warning bg-warning">Booked - Yet to start</span>';
                                  break;
                                case 'dispute':
                                    $status = '<span class="badge badge-info bg-info">Dispute</span>';
                                    break;
                                case 'disputed':
                                    $status = '<span class="badge badge-info bg-info">Disputed</span>';
                                    break;
   
                                case 'cancel':
                                  $status = '<span class="badge badge-danger bg-danger">Cancelled</span>';
                                  break;
                                case 'cancelled':
                                  $status = '<span class="badge badge-danger bg-danger">Cancelled</span>';
                                  break;
                                case 'driverAccepted':
                                  $status = '<span class="badge badge-warning bg-warning">Driver is Arriving</span>';
                                  break;
                                case 'deliver':
                                  $status = '<span class="badge badge-primary bg-primary">Deliver</span>';
                                  break;
                                  case 'delivered':
                                    $status = '<span class="badge badge-success bg-success">delivered</span>';
                                    break;
                                case 'proccessed':
                                  $status = '<span class="badge badge-success bg-success">proccessed</span>';
                                  break;
                                  case 'rated':
                                    $status = '<span class="badge badge-success bg-success">rated</span>';
                                    break;

                              }
                              echo $status;
                              ?>
                    </td>
                    <td><?php echo $d['totalQuantity'] ?></td>
                    <td><?php echo $d['price'] ?></td>

                    <td>
                        <div class="dropdown">
                            <button class="btn btnelep" type="button" data-bs-toggle="dropdown" aria-expanded="false">
                                <img src="./assets/images/ellep.png" alt="">
                            </button>
                            <ul class="dropdown-menu">

                                <li><a class="dropdown-item" href="<?php echo base_url('Orders/vieworder/').$v; ?>">View
                                        Order</a>

                                </li>

                            </ul>
                        </div>
                    </td>
                </tr>
                <?php } ?>
            </tbody>
        </table>
    </div>
</div>



<script src="<?php echo base_url('assets/js/jquery.min.js'); ?>"></script>
<script>
$(document).ready(function() {
    $('#vendortable').DataTable();
});
</script>