<table id="myTable" class="table table-bordered table-striped">
    <thead>
        <tr>
            <th><input type="checkbox" class="selectall">All</th>
            <th>S.No</th>
            <th>Vehicle Model</th>
            <th>Vehicle Name</th>
            <th>Vehicle Number</th>
            <th>Vehicle Type</th>
            <th>State</th>
            <th>City</th>
            <th>Driver</th>
            <th>Status</th>
            <th>Action</th>
        </tr>
    </thead>
    <tbody>
        <?php
       // echo '<pre>';print_r($vehicleListing);die();
        if (count($vehicleListing)>0) {
            $i = 1;
            foreach ($vehicleListing as $listing) {
                $vehicle_master_id = $listing['vehicle_master_id'];
                $driver_id         = $listing['user_id'];
                $mapping_id         = $listing['mapping_id'];
                $status=    ($listing['mapping_id'] == '' ? 'Unmaped' : 'maped');
                ?>
                <tr>
                    <td class="center"><label class="pos-rel">
                        <input type="checkbox" rel="<?php echo $listing['mapping_id']; ?>" name="checkbox-<?php echo $listing['mapping_id']?>" id="checkbox-<?php echo $listing['mapping_id']?>" class="ace list-checkbox check" />
                            <span class="lbl"></span> </label>
                    </td>
                    <td><?php echo $i; ?></td>
                    <td><?php echo $listing['model_year']; ?></td>
                    <td><?php echo $listing['vehicle_name']; ?></td>
                    <td><?php echo $listing['vehicle_no']; ?></td>
                    <td><?php echo $listing['vehicle_type']; ?></td>
                    <td><?php echo $listing['state_name']; ?></td>
                    <td><?php echo $listing['city_name']; ?></td>
                    <!--<td class="edit-Mapped" id="edit-<?php echo $listing['user_id']; ?>" value="<?php echo ($listing['mapping_id'] == '' ? 'Un-Mapped' : 'Mapped'); ?>" ><?php echo $listing['driver_name']; ?></td>
                    <td class="map-maped" id="insert-<?php echo $listing['user_id']; ?>" value="<?php echo ($listing['mapping_id'] == '' ? 'Un-Mapped' : 'Mapped'); ?>">
                        <?php echo ($listing['mapping_id'] == '' ? 'Un-Mapped' : 'Mapped'); ?>
                        <input type="text" name="maped_status" value="<?php echo ($listing['mapping_id'] == '' ? 'Un-Mapped' : 'Mapped'); ?>" id="insert-<?php echo $listing['user_id']; ?>" >
                    </td>-->


                    <td class="edit-maped" id="<?php echo $i; ?>"  value="<?php echo $status; ?>" >

                        <?php if(isset($listing['user_id'])){ ?>

                        <span href="#" class="map_driver map_text pointer edit-<?php echo $i; ?>"><?php echo $listing['driver_name'];?> </span>

                        <div class="col-sm-12 driver_map no-padding display-none insert-<?php echo $i; ?>">

        <select class="form-control widthpersent100 driverlist" onchange="mappeddriver(this.value,<?php echo $mapping_id;?>,<?php echo $vehicle_master_id;?>);">
                                <?php foreach($vehicleListing as $list){ ?>

                                <option value="<?php echo $list['user_id'];?>" <?php if($list['user_id']==$listing['user_id']){ echo "selected" ;}?>><?php echo $list['driver_name'];?> (<?php echo $list['email'];?>,<?php echo isset($list['mobile'])?$list['mobile']:'' ;?>)</option>

                                <?php } ?>
                            </select>

                        </div>

                        <?php }  ?>
                    </td>
                    <td class="map-maped" id="insert-<?php echo $listing['user_id']; ?>" value="<?php echo $status; ?>">
                        <?php echo $status; ?>
                        <input type="hidden" name="maped_status" value="<?php echo $status; ?>" id="insert-<?php echo $listing['user_id']; ?>" >
                    </td>

                    <td>
                    <div class="hidden-sm hidden-xs action-buttons">
                        <a class="red " href="javascript:void(0)" onclick="mapDriver('<?php echo $vehicle_master_id;?>','<?php echo $mapping_id;?>')"> <i class="ace-icon fa fa-edit bigger-130"></i> </a>
                                <a class="red" href="<?php echo $this->url('vehicle-details', ['action'=>'deleteVehicleMap', 'id'=>
                                $listing['vehicle_master_id']]); ?>" onclick="return confirm('are you sure you want to delete');">
                                    <i class="ace-icon fa fa-trash-o bigger-130"></i>
                                </a>
                    </div>
                    </td>
                </tr>
                <?php $i++;
            }
        } else { ?>
            <tr></tr>
<?php } ?>
    </tbody>
</table>
