  <div class="content-header">
    <div class="container-fluid">
      <div class="row mb-2">
        <div class="col-sm-6">
          <h1 class="m-0 text-dark">Profile
          </h1>
        </div><!-- /.col -->
        <div class="col-sm-6">
          <ol class="breadcrumb float-sm-right">
            <li class="breadcrumb-item"><a href="<?= base_url(); ?>/dashboard">Home</a></li>
            <li class="breadcrumb-item active">Profile</li>
          </ol>
        </div><!-- /.col -->
      </div><!-- /.row -->
    </div><!-- /.container-fluid -->
  </div>
  <!-- Main content -->

  <!-- Main content -->
  
  <form id="addnewservice" role="form" action="profile_update" enctype="multipart/form-data" method="post" class="basicvalidation container-fluid">
    <section class="content">
      <div class="container-fluid">
        <div class="row">
          <div class="col-md-3">


           
          </div>
          <!-- /.col -->
          <div class="col-md-12">
            <div class="card">
              <div class="card-header p-2">
                <ul class="nav nav-pills">
                 <li class="nav-item"><a class="nav-link active" href="#basicinfo" data-toggle="tab">Profile Info</a></li>
                 
               </ul>
             </div><!-- /.card-header -->
             <div class="card-body">
              <div class="tab-content">
                <div class="tab-pane " id="bookings">
                 <table id="bookingstbl" class="table table-striped projects">
                  <thead>
                    <tr>
                      <th class="percent1">
                        #
                      </th>
                      <th class="percent25">
                        Name
                      </th>
                      <th class="percent25">
                        User Name
                      </th>
                      <th class="percent25">
                       Email
                     </th>
                     <th class="percent25">
                       Organization Code
                     </th>                                 
                     <th class="percent25">
                       Organization Name
                     </th>
                     <th class="percent25">
                       Organization Email
                     </th> <th class="percent25">
                       Organization Phone
                     </th> <th class="percent25">
                       Organization city
                     </th> 
                     <th class="percent25">
                      Organization state
                    </th> 
                    <th class="percent25">
                     Admin Name
                   </th>
                   <th class="percent25">
                     Admin Email
                   </th>
                   <th class="percent25">
                     Admin Phone
                   </th> 
                   <th class="percent25">
                     Organization GST
                   </th> 
                   <th class="percent25">
                     Organization Created Date
                   </th>
                   <th class="percent25">
                    Action
                  </th>
                </tr>
              </thead> 
              <tbody>
                <?php if(!empty($bookings)) {
                  $count=1;
                  foreach($bookings as $bookingsdata){
                    ?>
                    <tr>
                      <td>
                       <?php echo output($count); $count++; ?>
                     </td>
                     <td><?= (isset($bookingsdata['t_driver_details']->d_name))?$bookingsdata['t_driver_details']->d_name:'<span class="badge badge-danger">Yet to Assign</span>'; ?></td>
                     <td>
                       <?php echo output($bookingsdata['t_customer_details']->c_name);?>
                     </td>
                     <td>
                       <?php echo '<small>'.output($bookingsdata['t_trip_fromlocation']).'</small>'; echo '<br><span class="badge badge-success">to</span><br>';?>
                       <?php echo '<small>'.output($bookingsdata['t_trip_tolocation']).'</small>';?>
                     </td>
                     <td>
                       <?php echo output($bookingsdata['t_trip_amount']);?>
                     </td>
                     
                     <td>
                       <?php 
                       switch($bookingsdata['t_trip_status']){
                        case 'ongoing':
                        $status = '<span class="badge badge-info">Ongoing</span>';
                        break;
                        case 'completed':
                        $status = '<span class="badge badge-success">Completed</span>';
                        break;
                        case 'yettostart':
                        $status = '<span class="badge badge-warning">Yet to start</span>';
                        break;
                        case 'cancelled':
                        $status = '<span class="badge badge-danger">Cancelled</span>'; 
                        break; 
                        case 'yettoconfirm':
                        $status = '<span class="badge badge-danger">Yet to Confirm</span>'; 
                        break;    
                      }

                      ?>
                      <?=  $status ?>  
                    </td>
                    <td> <a class="icon" target="_blank" href="<?php echo base_url(); ?>trips/details/<?php echo output($bookingsdata['t_id']); ?>">
                     <i class="fa fa-eye"></i>
                   </a> 
                 </td>
               </tr>
             <?php } } ?>
           </tbody>
         </table>

       </div>
       <!-- /.tab-pane -->
       <div class="tab-pane" id="vechicle_geofence">
        <!-- The timeline -->
        <table id="vgeofencetbl" class="table table-striped projects">
          <thead>
            <tr>
              <th class="percent1">
                #
              </th>
              <th class="percent25">
                Name
              </th>
              <th class="percent25">
                Description
              </th>
              <th class="percent25">
                Action
              </th>
              
            </tr>
          </thead>
          <tbody>
            <?php if(!empty($vechicle_geofence)){ 
              $count=1;
              foreach($vechicle_geofence as $vechicle_geofence){
                ?>
                <tr>
                  <td>
                   <?php echo output($count); $count++; ?>
                 </td>
                 <td>
                  <?php echo output($vechicle_geofence['geo_name']);?>
                </td>
                <td>
                 <?php echo output($vechicle_geofence['geo_description']);?>
               </td>
               <td> <a class="icon" href="<?php echo base_url(); ?>geofence">
                 <i class="fa fa-eye"></i>
               </a> 
             </td>
           </tr>
         <?php } } ?>
       </tbody>
     </table>
   </div>

   <div class="tab-pane" id="vechicle_incomexpense">
     <table id="incomexpenstbl" class="table table-striped projects">
      <thead>
        <tr>
          <th class="percent1">
            #
          </th>
          <th class="percent25">
            Date
          </th>
          <th class="percent25">
            Description
          </th>
          <th class="percent25">
            Amount
          </th>
          <th class="percent25">
            Type
          </th>
          <th class="percent25">
            Action
          </th>
        </tr>
      </thead>
      <tbody>
        <?php if(!empty($vechicle_incomexpense)){ 
          $count=1;
          foreach($vechicle_incomexpense as $incomexpensdata){
            ?>
            <tr>
              <td>
               <?php echo output($count); $count++; ?>
             </td>
             <td>
              <?php echo output($incomexpensdata['ie_date']);?>
            </td>
            <td>
             <?php echo output($incomexpensdata['ie_description']);?>
           </td>
           <td>
             <?php echo output($incomexpensdata['ie_amount']);?>
           </td>
           <td>
             <?php echo ($incomexpensdata['ie_type']=='income')?'<span class="right badge badge-success">Income</span>':'<span class="right badge badge-danger">Expense</span>'; ?>
           </td>
           <td> <a class="icon" href="<?php echo base_url(); ?>incomexpense">
             <i class="fa fa-eye"></i>
           </a> 
         </td>                                 
       </tr>
     <?php } } ?>
   </tbody>
 </table>
</div>
<!-- /.tab-pane -->
<div class="tab-pane active" id="basicinfo">
  <table class="table table-sm table-bordered">
    <tbody>
      <tr>
        <td>Name</td>
        <td> <?php
        echo $userlist['u_name'];?></td>
      </tr>
      <tr>
        <td> User Name</td>
        <td><?php
        echo $userlist['u_username'];?></td>
      </tr>
      <tr>
        <td>Email</td>
        <td> <?php
        echo $userlist['u_email'];?></td>
      </tr>
      <tr>
        <td>Organization Code</td>
        <td> <?php
        echo $userlist['org_code'];?></td>
      </tr>
      <tr>
        <td>Organization Name</td>
        <td> <?php
        echo $userlist['org_name'];?>
      </div> </td>
    </tr>
    <tr>
      <td>Organization Phone</td>
      <td><?php
      echo $userlist['org_phone'];?></td>
    </tr>
    <tr>
      <td>Organization Email </td>
      <td><?php
      echo $userlist['org_email'];?>
    </div></td>
  </tr>
  <tr>
    <td> Organization Pincode</td>
    <td><?php
    echo $userlist['org_pincode'];?></td>
  </tr>
  <tr>
    <td> Organization Country</td>
    <td><?php
    echo $userlist['country_name'];?></td>
  </tr> <tr>
    <td> Organization State</td>
    <td>  <?php
    echo $userlist['state_name'];?></td>
  </tr>
  <tr>
    <td> Organization City</td>
    <td>  <?php
    echo $userlist['city_name'];?></td>
  </tr>
  <tr>
    <td> Organization GST</td>
    <td> <?php
    echo $userlist['org_gst'];?></td>
  </tr>
  <tr>
    <td>Admin Name</td>
    <td><?php
    echo $userlist['org_admin_name'];?></td>
  </tr>
  <tr>
    <td>Admin Email</td>
    <td> <?php
    echo $userlist['org_admin_email'];?></td>
  </tr>
  <tr>
    <td>Admin Phone</td>
    <td><?php
    echo $userlist['org_admin_phone'];?></td>
  </tr>
  <tr>
    <td>Organization Created Date</td>
    <td><?php
    echo $userlist['org_created_date'];?></td>
  </tr>
  <tr>
    <td>Logo</td>

    <td> <input type="file" class="form-control" required="true" id="logo" name="logo" accept=".jpg,.jpeg,.png" onchange="validateFileType()" /></td>

    <input type="hidden" name="org_id" value="<?php echo $userlist['org_id']; ?>">
  </tr>
</tbody>

</table>

<div class="col-sm-3">
 <!-- <span  class="bg-gradient-success btn-xs">Image sholud be in 2MB  and jpg jpeg png format</span> -->
 <button type="submit" class="btn btn-primary">Submit</button>
</a>
</div>
</div>
<!-- /.tab-pane -->
</div>
<!-- /.tab-content -->
</div><!-- /.card-body -->
</div>
<!-- /.nav-tabs-custom -->
</div>
<!-- /.col -->
</div>
<!-- /.row -->
</div><!-- /.container-fluid -->
</section>
<script type="text/javascript">
  function validateFileType(){
    var fileName = document.getElementById("logo").value;
const oFile = document.getElementById("logo").files[0]; // <input type="file" id="fileUpload" accept=".jpg,.png,.gif,.jpeg"/>

if (oFile.size > 2097152) // 2 MiB for bytes.
{
 event.target.value = '';
 alert("File size must under 2MiB!");
 return;
}
var idxDot = fileName.lastIndexOf(".") + 1;
var extFile = fileName.substr(idxDot, fileName.length).toLowerCase();

if (extFile=="jpg" || extFile=="jpeg" || extFile=="png"){
            //TO DO
          }else{
           event.target.value = '';
           alert("Only jpg/jpeg and png files are allowed!");
           
           
         }   
       }
     </script>