<div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h5 class="m-0 text-dark"><?php 
            $first= str_replace("00:00:00", " ", $pageheadingtitle);
            $last= str_replace("23:59:59", "", $first);
            echo $last;
             ?>
            </h5>
          </div><!-- /.col -->
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="<?= base_url(); ?>/dashboard">Dashboard</a></li>
              <li class="breadcrumb-item active"><?php echo $pageheadingtitlre2; ?></li>
            </ol>
          </div><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
      <form method="GET" id="incomeexpense_report" class="card basicvalidation" action="<?php echo base_url().'trips/completeride/'?>">
         <div class="card-body">
            <div class="row">
               <div class="col-md-3">
                  <div class="form-group row">
                     <label for="incomeexpense_from" class="col-sm-5 col-form-label">Start Date</label>
                     <div class="col-sm-6 form-group">
                        <input type="date" required="true" class="form-control form-control-sm " value="<?php echo isset($_GET['startdate']) ? $_GET['startdate'] : ''; ?>" id="startdate" name="startdate" placeholder="Date From">
                     </div>
                  </div>
               </div>
               <div class="col-md-3">
                  <div class="form-group row">
                     <label for="incomeexpense_to" class="col-sm-5 col-form-label">End Date</label>
                     <div class="col-sm-6 form-group">
                        <input type="date" required="true" class="form-control form-control-sm " value="<?php echo isset($_GET['enddate']) ? $_GET['enddate'] : ''; ?>" id="enddate" name="enddate" placeholder="Date To">
                     </div>
                  </div>
               </div>
              
               <input type="hidden" id="incomeexpensereport" name="incomeexpensereport" value="1">
               <div class="col-md-2">
                  <button type="submit" class="btn btn-block btn-outline-info btn-sm"> Generate Report</button>
               </div>
            </div>
         </div>
   </form>
   </div>

 
      <div class="container-fluid">
        <div class="card">

          <div class="card-body p-0">



            <div class="table-responsive">
              <table id="triptbl" class="table card-table table-vcenter text-nowrap">
                <thead>
                  <tr>
                    <th class="w-1">S.No</th>
                    <th>Date/Time</th>
                
                    <th>Customer</th>
                    <th>Type</th>
                    <th>Driver</th>
                    <th>Trip Status</th>
                    <th>Action</th>
                  </tr>
                </thead>
                <tbody>

                  <?php if (!empty($tripsData)) {
                    $count = 1;
                    foreach ($tripsData as $tripId => $data) {
                      // echo "<pre>";
                      // print_r($data);
                      // echo "</pre>";
                  ?>
                      <tr>
                        <td> <?php echo "#KonnectTransit".$data['bookingDetails']["bookingDate"]; ?></td>
                        <td> <?php
                      //  echo $data['bookingDetails']["bookingDate"];
                       // echo "<br>";
                        echo convertTime($data['bookingDetails']["pickupDate"]); ?>
                        
                        <?php //echo convertTime(isset($data['bookingDetails']["pickupDate"])) ? date("Y-m-d h:i:s", $data['bookingDetails']["pickupDate"]/1000):'' ?>
                      </td>
                       
                        <td> <?php echo $data['customerDetails']["firstName"]; ?></td>
                        
                        <td><?php if(!empty($data['bookingDetails']["carType"]))
                        {
                          echo 'KonnectTransit';

                        } ?></td>
                        <td> <?php
                            //echo $data['bookingDetails']["status"]; 
                          if($data['bookingDetails']["status"]=="booked" || $data['bookingDetails']["status"]=="cancelled" || $data['bookingDetails']["status"]=="disputed" || $data['bookingDetails']["status"]=="dispute"){
                                echo "---";   
                          }else{
                            if(isset($data['bookingDetails']['driverId'])){
                            echo (getusername($data['bookingDetails']['driverId']));
                          }
                          }
                         //echo (getusername($data['driverId']));


                          ?></td>
                        <td> 
                          <?php
//echo $data['bookingDetails']["status"];

                              switch ($data['bookingDetails']["status"]) {
                                case 'rideStarted':
                                  $status = '<span class="badge badge-info">Ongoing</span>';
                                  break;
                                case 'rideCompleted':
                                  $status = '<span class="badge badge-success">Completed</span>';
                                  break;
                                case 'booked':
                                  $status = '<span class="badge badge-warning">Booked - Yet to start</span>';
                                  break;
                                case 'cancelled':
                                  $status = '<span class="badge badge-danger">Cancelled</span>';
                                  break;
                                case 'disputed':
                                  $status = '<span class="badge badge-danger">Cancelled</span>';
                                  break;
                                case 'driverAccepted':
                                  $status = '<span class="badge badge-warning">Driver is Arriving</span>';
                                  break;
                                case 'driverDriverReached':
                                  $status = '<span class="badge badge-warning">Driver Arrived</span>';
                                  break;
                                case 'rated':

                                  $status = '<span class="badge badge-success">Rated</span>';
                                  break;
                              }

                              echo $status;
                              ?>
                        </td>
                        <td>
                          <a class="icon" href="<?php echo base_url(); ?>trips/details/<?php echo output($tripId); ?>">
                            <i class="fa fa-eye"></i>
                          </a>
                          <?php if($data['bookingDetails']["status"] == 'booked' || $data['bookingDetails']["status"] == 'rideStarted'||$data['bookingDetails']["status"] == 'driverAccepted' || $data['bookingDetails']["status"] == 'driverDriverReached'){?>
                          <a class="icon" href="<?php echo base_url(); ?>trips/edittrip/<?php echo output($tripId); ?>">
                            <i class="fa fa-edit"></i>
                          </a>
<a class="icon" href="<?php echo base_url(); ?>trips/canceltripbyadmin/<?php echo output($tripId); ?>">
                            <i class="fa fa-times"></i>
                          </a>

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

            </div>
          </div>
          <!-- /.card-body -->
        </div>

      </div>
    </section>
    <!-- /.content -->


    