<div class="modal-header">
    <button type="button" class="close" data-dismiss="modal">&times;</button>
    <h4 class="modal-title">Map Driver</h4>
</div>
 <div id="displayMsg"></div>
<div class="modal-body ">

<?php
$form = $this->form;
$form->prepare();
$form->setAttribute('action', $this->url('vehicle-details', ['action' => 'mapping-driver']));
$form->setAttribute('enctype', 'multipart/form-data');
echo $this->form()->openTag($form);
echo $this->FormElement($form->get('mapped_id')->setValue($mapped_id));
//echo'<pre>';print_r($result);die();

?>
    <div class="col-sm-12" style="float:none;">
        <div class="form-group clearfix margintopbottom20">
            <label class="col-sm-3 control-label labelalign col-sm-3-new" id="Categorie Name"><?php echo $this->translate($this->formLabel($form->get('vehicle_type_name'))); ?></label>
            <div class="col-sm-3 col-sm-4-new">
               <?php if(isset($result['vehicle_type_id'])){

               echo $this->FormElement($form->get('vehicle_type_name')->setValue($result['vehicle_type_id']));

               }
               else{

                    echo $this->FormElement($form->get('vehicle_type_name'));
                    echo $this->formElementErrors($form->get('vehicle_type_name'), ['class' => 'error']);

               }
               ?>
            </div>
            <label class="col-sm-3 control-label labelalign col-sm-3-new" id="point_airport"> Name of Vehicle</label>
            <div class="col-sm-3 col-sm-4-new">
                <?php  if(isset($result['vehicle_name'])){

                       echo $this->FormElement($form->get('vehicle_name_mapping')->setValue($result['vehicle_name']));
                       echo $this->FormElement($form->get('vehicle_model_mapid')->setValue($result['vehicle_model_id']));

               }else{
                        echo $this->FormElement($form->get('vehicle_name_mapping'));
                        echo $this->formElementErrors($form->get('vehicle_name_mapping'), ['class' => 'error']);
                        echo $this->FormElement($form->get('vehicle_model_mapid'));


               } ?>
            </div>
        </div>

        <div class="form-group clearfix margintopbottom20">

            <label class="col-sm-3 control-label labelalign col-sm-3-new" id="point_airport"> Vehicle Number</label>
            <div class="col-sm-3 col-sm-4-new">

                <?php if(isset($result['vehicle_no'])){
                    echo $this->FormElement($form->get('vehicle_number')->setValueOptions(array( $result['vehicle_master_id'] => $result['vehicle_no'])));
                  echo $this->formElementErrors($form->get('vehicle_number'), ['class' => 'error']);
                }
                else{


                echo $this->FormElement($form->get('vehicle_number'));
                  echo $this->formElementErrors($form->get('vehicle_number'), ['class' => 'error']);


                }
                ?>
            </div>


                <?php //if(isset($result['model_year'])){ ?>
<!--                    <label class="col-sm-3 control-label labelalign col-sm-3-new" id="point_airport">Vehicle Model  </label>
            <div class="col-sm-4 col-sm-4-new">-->

                 <?php   //echo $result['model_year'];}
                //else{ //echo $this->FormElement($form->get('model_year'));

                 // echo $this->formElementErrors($form->get('model_year'), ['class' => 'error']);

               // }
                ?>

            </div>

        </div>


        <div class="form-group clearfix margintopbottom20 ">
            <label class="col-sm-3 control-label labelalign col-sm-3-new" id="point_airport"> Driver </label>
            <div class="col-sm-3 col-sm-4-new">
                <div class="col-sm-12 driver_map no-padding">
                            <select class="form-control widthpersent100 driverlist" name="driver_name">
                                <?php
                                if(isset($result['user_id'])) {$userId=$result['user_id'];} else{$userId='';}
                                foreach($vehicleListing as $list){ ?>
                                <option value="<?php echo $list['user_id'];?>" <?php if($list['user_id']==$userId){ echo "selected" ;}?>><?php echo $list['driver_name'];?> (<?php echo $list['email'];?>,<?php echo isset($list['mobile'])?$list['mobile']:'' ;?>)</option>
                                <?php } ?>
                            </select>
                        </div>
            </div>

            <label class="col-sm-3 control-label labelalign col-sm-3-new" id="point_airport">Status </label>
            <div class="col-sm-4 col-sm-4-new">
                <?php

                if(isset($result['mapping_id'])&& $result['mapping_id']!=""){
                    $selectedmap = "selected";
                    $selectedmap1="";
                }else{
                    $selectedmap1 = "selected";
                    $selectedmap ="";
                }
                ?>
                <select class="form-control" name="map_status" id="map_status">
                    <option value="" selected="selected">--Select Status--</option>
                    <option value="1" <?php echo $selectedmap;?>>Mapped</option>
                    <option value="0" <?php echo $selectedmap1;?>>Unmapped</option>
                </select>
            </div>

        </div>

    </div>
    <div class="col-sm-12 " align="right" style="float:none;">

        <a class="reset_btn btn btn-success btn-new-vehile" href="#">
            <i class="fa fa-retweet"></i>
            Reset
        </a>
         <?php echo $this->formElement($form->get('mapping_submit')); ?>

    </div>


 <?php echo $this->form()->closeTag(); ?>
</div>
<div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>