<?php $form = $this->fixedrouteform;
$form->setAttribute('action', $this->url('cabfare', ['action' => 'add-price-fixed-routes']));
$form->setAttribute('method', 'post');
echo $this->form()->openTag($form);

if(isset($VndViewFare)){
    
    foreach ($form->getElements() as $element) {
    $element->setAttribute('disabled', true);
    $element->setAttribute('readonly',true);
    }
}

$fix_route_data = isset($fareDetails['fix_route'])?$fareDetails['fix_route']:$userFareSettingAllData['userFixRouteData'];
$postcode_fare = isset($fareDetails['postal_fare'])?$fareDetails['postal_fare']:$userFareSettingAllData['userPostalCodeData'];
$kmRateString="";

if($postcode_fare!=''){
    foreach($postcode_fare as $key=>$value){
        $counter = $key;
        $kmRateString  .='<div class="row form-group clearfix"><div class="col-sm-12"><div class="col-sm-3"><input type="text" class="form-control" id="kms_'.$counter.'" name="pickup_postcode[]" value="'.$value['pickup_postcode'].'"></div><div class="col-sm-3" ><input type="text" class="form-control" id="rs_'.$counter.'" value="'.$value['drop_postcode'].'" name="drop_off_postcode[]" ></div><div class="col-sm-3"><div class="input-group"><span class="input-group-addon postcodeRupees_fixedRoute">Rs</span><input type="text" class="form-control" id="rs_'.$counter.'" value="'.$value['price'].'" name="value[]" ></div></div><div class="col-sm-1 removeDistanceFields"  id="removeDistanceFields_"'.$counter.'><a href="#"><i class="fa fa-trash-o fa-2x"></i></a></div><div class="col-sm-2">&nbsp;</div></div></div>';
   }
}

echo $this->formElement($form->get('fix_route_id')->setValue(isset($fix_route_data['id'])?$fix_route_data['id']:''));

?>
<div class="row">
    <div class="col-sm-12 col-md-12">
        <div class="portlet-body">
            <div class="col-sm-6 col-md-6 col-lg-12 padding10px">

                    <h4 class="frequentPostcode_fixedRoute">Frequent Location to Postcode</h4> 
                    <div class="pull-right" onclick="enableform('fixed-route');">                           
                            <ul><li><i class="ace-icon fa fa-edit bigger-130 bold"></i>Edit</li></ul>
                    </div>
                    <p class="frequentPostcodeDetail_fixedRoute">You must define
                        Frequent locations in
                        Preferences &gt; Frequent Locations before you can set custom
                        price share. Use a complete postcode / Zip code, or just a prefix for
                        postcode areas.</p>


                    <div class="row">
                        <div class="col-sm-2 margin-left15">
                            <label class="frequentLocation_fixedRoute"><?php echo $this->translate($form->get('frequent_location')->getLabel()); ?></label>
                            <?php echo $this->formElement($form->get('frequent_location')->setValue(isset($fix_route_data['frequent_location'])?$fix_route_data['frequent_location']:''));?>
                        </div>
                    </div>
                    <hr>
                    <h4 class="postcode_fixedRoute">Postcode To Postcode</h4>
                    <p class="postcodeDetail__fixedRoute">Fix rates from one Postcode (or Zip code) to
                        another; this can be done using exact Postcodes
                        or postcode areas (prefix only)</p>
                    <div>
                        <div class="form-group clearfix">
                            <div class="col-sm-3">
                                <label class="pickUpPostcode_fixedRoute"><?php echo $this->translate($form->get('pickup_postcode[]')->getLabel()); ?></label>
                                <?php echo $this->formElement($form->get('pickup_postcode[]')); ?>
                            </div>
                            <div class="col-sm-3">
                                <label class="dropOffPostcode_fixedRoute"><?php echo $this->translate($form->get('drop_off_postcode[]')->getLabel()); ?></label>
                                 <?php echo $this->formElement($form->get('drop_off_postcode[]')); ?>
                            </div>
                            <div class="col-sm-3">
                                <label class="value_fixedRoute"><?php echo $this->translate($form->get('value[]')->getLabel()); ?></label>
                                <div class="input-group"> <span class="input-group-addon postcodeRupees_fixedRoute">Rs</span>
                                     <?php echo $this->formElement($form->get('value[]')); ?>
                                </div>
                            </div>
                            <div class="col-sm-2">
                                <div class="row margin-top26px">
                                    <?php if(!isset($VndViewFare)){ ?>
                                    <div class="col-sm-2"> <a class="btn btn-info addPostCodes" id="addPostCodes_1">Add</a> </div>
                                    <?php }?>
                                </div>
                            </div>

                        </div>
                        <div id="append_postCodes" class="form-group clearfix"></div>

                    </div>
<?php echo $kmRateString;?>

                <div class="row ">
                    <div class="col-sm-3"></div>
                    <div class="col-sm-3"></div>
<!--                    <div class="col-sm-2 pull-right margin-r-10" id="fixed_route_next">
                        <a href="#Different_Shares" data-toggle="tab">
                            <button class="btn btn-info form-control margin-bttom10px widthpersent100">Next</button>
                        </a>
                    </div>-->
                    <?php if(!isset($VndViewFare)){ ?>
                    <div class="col-sm-2 pull-right margin-bottom15" >
                        <a href="#" data-toggle="tab">
                            <?php echo $this->formElement($form->get('save')); ?>
                        </a>
                    </div>
                    <?php } ?>
                    <div class="col-sm-2 pull-right no-padding display-none" id="fixed_route_fair_manage_vehicle">
                        <a href="#" data-toggle="tab">
                            <button class="btn btn-info form-control margin-bottom15">Save</button>
                        </a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<?php echo $this->form()->closeTag($form); ?>