<table id="myTable" class="table table-bordered table-striped">
    <thead>
        <tr>
            <th><input type="checkbox" class="selectall">All</th>
            <th>S.No</th>
            <th>City</th>
            <th>Client</th>
            <th>Package</th>
            <th>Vehicle</th>
            <th>Price/KM</th>
            <th>Beyond/KM</th>
            <th>Charges/Min</th>
            <th>Dispatch</th>
            <th>Till Date</th>
            <th>Market</th>
            <th>Status</th>
            <th>Action</th>
        </tr>
    </thead>
    <tbody>

        <?php
        if (count($cabfareListing) > 0) {
            $i = 1;
            foreach ($cabfareListing as $listing) {
                    $base_combination_id = $listing['base_combination_id'];
                    $fareData = $listing['fare_data'];
                    if(!empty($fareData)){
                        $minimum_charge   = (isset($fareData['minimum_charge']))?$fareData['minimum_charge']:'0';
                        $minimum_distance = (isset($fareData['minimum_distance']))?$fareData['minimum_distance']:'0';
                        $per_km_charge    = (isset($fareData['per_km_charge']))?$fareData['per_km_charge']:'0'; 
                        $minimum_hrs      = (isset($fareData['minimum_hrs']))?$fareData['minimum_hrs']:'0'; 
                        if($listing['master_package_mode_id']==2){
                         $per_km_charge     = (isset($fareData['per_hr_charge']))?$fareData['per_hr_charge']:'0'; 
                        }
                    }
                if($listing['garage_type']==1){
                    $garage_type="Own";
                }elseif($listing['garage_type']==2){
                    $garage_type="Company";
                }else{
                    $garage_type="NA";
                }

                ?>

                <tr class="odd">
                    <td class="sorting_1"><input type="checkbox" class="check" rel="<?php echo $listing['base_combination_id']; ?>"></td>
                    <td class="sorting_1"><?php echo $i; ?></td>
                    <td><?php echo $listing['city_name'].'<br> ('.$listing['county_name'].', '.$listing['state_name'].')';?></td>
                    <td><?php if($listing['client_name']!=""){ echo $listing['client_name'];}else{ echo "Public";}?></td>
                    <td><?php echo $listing['package_name'];?></td>
                    <td><?php echo $listing['vehicle_type'].'<br> ('.$listing['package_mode'].')';?></td>
                    <td><?php echo $minimum_charge;?>/<?php echo $per_km_charge; ?>KM</td>
                    <td><?php echo $minimum_distance; ?>/KM</td>
                    <td><?php echo $minimum_hrs; ?>/Hours</td>
                    <td><?php echo ($listing['type_of_dispatch'] == '1' ? 'Point To Point' : 'Garage To Garage'); ?></td>
                    <td><?php echo date('d-m-Y',strtotime($listing['date_to'])); ?></td>
                    <td><div id="changestatus1" class="<?php if($listing['market_place']==1) echo "aprovestatus";else{ echo "unapproved";}?> iconsize" name="ChangeStatus"></div></td>
                    <td class=" "><?php echo ($listing['bs_status'] == '1' ? 'Publish' : 'Un-Publish'); ?></td>
                    <td>
                        <a href="<?php echo $this->url().'/add-fare/'.$base_combination_id; ?>" style="color:#333; font-size:18px;" title='Edit Fare'>
                            <i class="fa fa-edit" style="height:20px;"></i>
                        </a>
                        <a target="_blank" href="<?php echo $this->url().'/view-vendor-fare/'.$base_combination_id; ?>" style="color:#333; font-size:18px;" title='View Fare'>
                            <i class="fa fa-eye"></i>
                        </a>

                    </td>
                </tr>

                <?php
                $i++;
            }
        } else {
            ?>
            <tr>
                <td colspan="10" style="text-align: center;">No Records Found</td>
            </tr>
        <?php } ?>
    </tbody>
</table>