<?php  $bookingMode = $this->bookingMode;
    $masterlocalpkg = $this->masterLocalPkg;

$distance_hour_fare = isset($fareDetails['booking_mode_fare_data'])?$fareDetails['booking_mode_fare_data']:'';
$local_package_fare = isset($fareDetails['local_package_fare'])?$fareDetails['local_package_fare']:'';
if(!empty($local_package_fare)){
    $package_fare_data = array_column($local_package_fare, 'local_pkg_fare','local_pkg_id');
}
?>
<div id="displayMsg"></div>
<div class="row">
    <div class="col-sm-12">
        <div class="col-sm-12 col-md-12 mrgin20auto5 padding10px">
            <?php $form = $this->distancehourform;
                $form->prepare();
                $form->setAttribute('action', $this->url('cabfare', ['action' => 'add-price-distance-hour']));
                $form->setAttribute('method', 'post');
                echo $this->form()->openTag($form);
                echo $this->formHidden($form->get('distancehourid')->setValue(isset($distance_hour_fare['id'])?$distance_hour_fare['id']:''));
                ?>
            <div class="portlet-body">
                <h4 class="distanceRates_distanceHour">Distance Hour Rates</h4>
                <div class="form-group clearfix">
                    <div class="col-sm-2" >
                        <label class="ratePerKm_distanceHour"><?php echo $this->translate($form->get('rate_per_km')->getLabel()); ?></label>
                        <div class="input-group"> <span class="input-group-addon ratePerKmRupees_distanceHour">Rs</span>
                            <?php echo $this->formElement($form->get('rate_per_km')->setValue(isset($distance_hour_fare['per_km_charge'])?$distance_hour_fare['per_km_charge']:'')); ?>
                        </div>
                    </div>
                    <div class="col-sm-3">
                        <label class="firstKmRate_distanceHour"><?php echo $this->translate($form->get('ignore_first_km_after')->getLabel()); ?></label>
                        <div class="input-group"> <span class="input-group-addon">Km</span>
                            <?php echo $this->formElement($form->get('ignore_first_km_after')->setValue(isset($distance_hour_fare['minimum_distance'])?$distance_hour_fare['minimum_distance']:'')); ?>
                        </div>
                    </div>
                    <div class="col-sm-3">
                        <label><?php echo $this->translate($form->get('ignore_first_hours')->getLabel()); ?></label>
                        <div class="input-group"> <span class="input-group-addon">Hrs</span>
                             <?php echo $this->formElement($form->get('ignore_first_hours')->setValue(isset($distance_hour_fare['minimum_hrs'])?$distance_hour_fare['minimum_hrs']:'')); ?>
                        </div>
                    </div>
                    <div class="col-sm-2">
                        <label class="minimumFare_distanceHour"><?php echo $this->translate($form->get('minimum_fare')->getLabel()); ?></label>
                        <div class="input-group"> <span class="input-group-addon minimumFareRupees_distanceHour">Rs</span>
                            <?php echo $this->formElement($form->get('minimum_fare')->setValue(isset($distance_hour_fare['minimum_charge'])?$distance_hour_fare['minimum_charge']:'')); ?>
                        </div>
                    </div>
                </div>
                <hr>
                <form class="form-inline col-sm-12" role="form">
                    <h4 class="hourlyRates_distanceHour">Hourly Rates</h4>
                    <h5 class="ratePerHour_distanceHour">Rate Per Hour</h5>
                    <div class="input-group col-sm-2"> <span class="input-group-addon ratePerHourRupees_distanceHour">Rs</span>
                        <?php echo $this->formElement($form->get('rate_per_hour')->setValue(isset($distance_hour_fare['per_hr_charge'])?$distance_hour_fare['per_hr_charge']:'')); ?>
                    </div>
                </form>
                <div class="col-sm-12 text-left"><br>
                    <label class="booking-check"><?php echo $this->translate($form->get('update_all_rows')->getLabel()); ?>
                       <?php echo $this->formElement($form->get('update_all_rows')); ?>
                        <span class="checkmark"></span>
                    </label>

                </div>
                <?php
                        if(!empty($masterlocalpkg) && $bookingMode==3){

                ?>
                <div class="col-sm-12 no-padding">
                    <div class="col-sm-2"><label><?php echo $this->translate($form->get('distance_hour_package_name[]')->getLabel()); ?></div>
                    <div class="col-sm-2"><label><?php echo $this->translate($form->get('distance_hour_ignore_hours[]')->getLabel()); ?></label></div>
                    <div class="col-sm-2"><label><?php echo $this->translate($form->get('distance_hour_ignore_km[]')->getLabel()); ?></label></div>
                    <div class="col-sm-2"><label><?php echo $this->translate($form->get('distance_hour_amount[]')->getLabel()); ?></label></div>
                    <div class="col-sm-2 margin-left15"></div>
                    <div class="col-sm-3">&nbsp;</div>
                </div>
                        <?php }?>
<!--                <div id="Dis_Hourly_Div_package">
                    <div class="col-sm-12 no-padding margin-bttom10px">
                        <div class="col-sm-2"><?php //echo $this->formElement($form->get('distance_hour_package_name[]')); ?></div>
                        <div class="col-sm-2"><?php //echo $this->formElement($form->get('distance_hour_ignore_hours[]')); ?></div>
                        <div class="col-sm-2"><?php //echo $this->formElement($form->get('distance_hour_ignore_km[]')); ?> </div>
                        <div class="col-sm-2"><?php //echo $this->formElement($form->get('distance_hour_amount[]')); ?></div>
                        <div class="col-sm-4"><div class="col-sm-4 addPKG_loc_Dist_hourly no-padding" id="addPKg_DisT_Hourly_4"><a href="#" class="btn btn-info form-control">Add More</a></div></div>
                        <div class="col-sm-2"></div>

                    </div></div>-->
                    <!--<div id="appended_Dist_Hourly_package"></div>-->
                     <?php
                        if(!empty($masterlocalpkg) && $bookingMode==3){
                            foreach($masterlocalpkg as $val){
                                $localId = $val['id'];
                               $fare_value =  isset($package_fare_data[$localId])?$package_fare_data[$localId]:'';
                                ?>
                   <div class="col-sm-12 no-padding margin-bttom10px">
                            <div class="col-sm-2"><?php echo $val['name']; ?></div>
                            <div class="col-sm-2"><?php echo $val['hrs']; ?></div>
                            <div class="col-sm-2"><?php echo $val['km']; ?></div>
                            <div class="col-sm-2"><?php echo $this->formElement($form->get('distance_hour_amount[]')->setValue($fare_value)); ?></div>
                            <input type="hidden" name="localpkgid[]" value="<?php echo $localId;?>"/>
                    </div>
                <?php }} ?>
                <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">
                        <a href="#Distance_Waiting" id="Distance_Hourn" data-toggle="tab">
                            <?php echo $this->formElement($form->get('next')); ?>
                        </a>
                    </div>-->
                    <?php if(!isset($VndViewFare)){ ?>
                    <div class="col-sm-2 pull-right margin-bttom10px">
                        <a href="#" data-toggle="tab">

                            <?php echo $this->formElement($form->get('save')); ?>
                        </a>
                    </div>
                    <?php }?>
                    <div class="col-sm-2 pull-right display-none margin-bttom10px no-padding" id="vehicle_distance_hour_save"> <a href="#" data-toggle="tab">
                            <button class="btn btn-info form-control">Save</button>
                        </a> </div>
                </div>
            </div>
            <?php echo $this->form()->closeTag(); ?>
        </div>

    </div>
</div>
