<?php
 $mealPlanId = [];
if(!empty($activityMealsData)){
 foreach($activityMealsData as $val){
     $mealPlanId[$val['id']] = $val['meal_type_id'];
 }
}

 $weekDaysId = [];
if(!empty($activityWeekDaysData)){
 foreach($activityWeekDaysData as $val){
     $weekDaysId[$val['id']] = $val['weekdays_id'];
 }
}
 //echo "<pre>"; print_r($vehicleData); die;
 $ssTypeChecked1 = "";
 $ssTypeChecked2 = "";
 $ssDisplay = "";
 $rateTypeChecked1 = "";
 $rateTypeChecked2 = "";
 $rateTypeDisplay = "";
 $ratePerChecked1 = "";
 $ratePerChecked2 = "";
 $taxTypeChecked1 = "";
 $taxTypeChecked2 = "";
 $taxTypeDisplay = "";
 $taxPerChecked1 = "";
 $taxPerChecked2 = "";
 $passDisplay = "";
 if(!empty($vehicleData)){
     if(isset($vehicleData['tour_type']) && !empty($vehicleData['tour_type'])){
         if($vehicleData['tour_type']==1){
             $ssTypeChecked1 = "checked=checked";
             $ssDisplay = "block";
         }else if($vehicleData['tour_type']==2){
             $ssTypeChecked2 = "checked=checked";
             $ssDisplay = "none";
         }
     }
     
     if(isset($vehicleData['rate_type']) && !empty($vehicleData['rate_type'])){
         if($vehicleData['rate_type']==1){
             $rateTypeChecked1 = "checked=checked";
             $rateTypeDisplay = "block";
         }else if($vehicleData['rate_type']==2){
             $rateTypeChecked2 = "checked=checked";
             $rateTypeDisplay = "none";
         }
     }
     
     if(isset($vehicleData['rate_per_fixed']) && !empty($vehicleData['rate_per_fixed'])){
         if($vehicleData['rate_per_fixed']==1){
             $ratePerChecked1 = "checked=checked";
         }else if($vehicleData['rate_per_fixed']==2){
             $ratePerChecked2 = "checked=checked";
         }
     }
     
     if(isset($vehicleData['tax_type']) && !empty($vehicleData['tax_type'])){
         if($vehicleData['tax_type']==1){
             $taxTypeChecked1 = "checked=checked";
             $taxTypeDisplay = "block";
         }else if($vehicleData['tax_type']==2){
             $taxTypeChecked2 = "checked=checked";
             $taxTypeDisplay = "none";
         }
     }
     
     if(isset($vehicleData['tax_per_fixed']) && !empty($vehicleData['tax_per_fixed'])){
         if($vehicleData['tax_per_fixed']==1){
             $taxPerChecked1 = "checked=checked";
         }else if($vehicleData['tax_per_fixed']==2){
             $taxPerChecked2 = "checked=checked";
         }
     }
 }
?>
<!-- Main content -->
<section class="content">
    <div class="row">
        <div class="col-sm-12">
            <div class="tabbable">
                <div class="tab-content no-border padding-24">
                    <div class="tab-pane fade in active" id="faq-tab-1">
                        <div class="space-8"></div>
                        <div class="panel-group accordion-style1 accordion-style2" id="faq-list-1">
                            <div class="panel panel-default">
                                <div class="panel-headingnew">General Information</div>
                                <div class="left_panel col-sm-12 padding_margin0 pull-left bg-white" id="add_detail">
                                    <ul class="nav nav-tabs nav-tabs1 tab_ul col-sm-2 paddig-right0 margin-top15px">
                                        <?php echo $this->partial('menu.phtml'); ?>
                                    </ul>
                                    <div class="tab-content tab_editprofile col-sm-10 padding-left0 marginbott10px margintop10px">


                                        <div id="room-rate" class="tab-pane tab_editprofile1 active in">
                                            <div class="col-sm-col-sm-offset-1 margin-10auto0 paddingRL10px">


                                                <div class="row">
                                                    <?php
                                       $form = $this->form;
                                       $form->prepare();
                                       $form->setAttribute('action', $this->url('sightseeing', ['action' => 'edit-rate']));
                                       $form->setAttribute('method', 'post');
                                       $form->setAttribute('id', 'rate-form');
                                       echo $this->form()->openTag($form);
                                       ?>

                                                    <div class="col-sm-12">

                                                         <fieldset class="">
                            <legend>Contract Rate</legend>

<div class="form-group clearfix margintopbottom20">
    <label class="col-sm-3 control-label labelalign col-sm-3-new" id="point_airport"><?php echo $this->translate($this->formLabel($form->get('sightseeing_name'))); ?> </label>
    <div class="col-sm-3 col-sm-4-new">
       <?php echo $this->FormElement($form->get('sightseeing_name')); ?>
        <?php  echo $this->formElementErrors($form->get('sightseeing_name'), ['class' => 'error']); ?>
    </div>
    <label class="col-sm-3 control-label labelalign col-sm-3-new" id="point_airport">  <?php echo $this->translate($this->formLabel($form->get('vendor_name'))); ?> &nbsp;&nbsp;<a href="<?php echo $this->url('usermanagement', ['action' => 'add']); ?>" style="color: blue;">Add Vendor</a> </label>
    <div class="col-sm-3 col-sm-4-new">
         <?php echo $this->FormElement($form->get('vendor_name')); ?>
        <?php echo $this->formElementErrors($form->get('vendor_name'), ['class' => 'error']); ?>

    </div>
</div>

<div class="form-group clearfix margintopbottom20">
    <label class="col-sm-2 control-label labelalign col-sm-2-new" id="point_airport">  Type: <span class="defaultcolor">*</span> </label>
    <div class="col-sm-2 no-padding">

        <div class="carbooking" style="margin-left: 99px;">

            <input type="radio" name="ss_type" id="private" value="1" checked="checked" <?php echo $ssTypeChecked1;?>>
            <label for="private"><span class="radio">Private</span></label>
        </div>

    </div>

    <div class="col-sm-2">
        <div class="carbooking" style="margin-left: 45px;">
            <input type="radio" name="ss_type" value="2" id="sic"  <?php echo $ssTypeChecked2;?>>
            <label for="sic"><span class="radio">Seat In Coach</span></label>
        </div>
      
    </div>
</div>

<div class="form-group clearfix margintopbottom20" id="ss-type" style="display:<?php echo $ssDisplay;?>">
    <div class="col-sm-12">
        <?php   foreach( $vehicleType as $key=>$val){
                 
            if(!empty($vehicleData)){
                    if(isset($vehicleData['tour_type']) && !empty($vehicleData['tour_type'])){
                        if($vehicleData['tour_type']==1){
                            if($vehicleData['passenger']==$val){
                               $passDisplay = "checked=checked";
                            }else{
                                $passDisplay = "";
                            }
                        }
                    }
                 }
            
            ?>
        <div class="col-sm-2 no-padding">
           
            <div class="carbooking" >
          
 <input type="radio" name="vehicle_type" id="<?php echo 'min_'.$val.'_pax'?>" value="<?php echo $val;?>" <?php if($key==1){?> checked="checked" <?php }?>  <?php echo $passDisplay;?>>
                <label for="<?php echo 'min_'.$val.'_pax'?>"><span class="radio"><?php echo "Min $val Pax."?></span></label>
            </div>
               
        </div><?php } ?>
    </div>
</div>  

<div class="form-group clearfix margintopbottom20">
    <label class="col-sm-3 control-label labelalign col-sm-3-new" id="point_airport"><?php echo $this->translate($this->formLabel($form->get('valid_from'))); ?> </label>
    <div class="col-sm-3 col-sm-4-new">
          <?php echo $this->FormElement($form->get('valid_from')); ?>
        <?php echo $this->formElementErrors($form->get('valid_from'), ['class' => 'error']); ?>
    </div>
    <label class="col-sm-3 control-label labelalign col-sm-3-new" id="point_airport"><?php echo $this->translate($this->formLabel($form->get('valid_to'))); ?> </label>
    <div class="col-sm-3 col-sm-4-new">
<?php echo $this->FormElement($form->get('valid_to')); ?>
        <?php echo $this->formElementErrors($form->get('valid_to'), ['class' => 'error']); ?>
    </div>
</div>


<div class="form-group clearfix margintop20 marginbottom20">

    <div class="col-sm-12">

        <div class="col-sm-3 no-padding">

            <div class="carbooking">
                <input type="radio" name="commissionable_type" value="1" id="net-rate" checked="checked" <?php echo $rateTypeChecked1;?>>
                <label for="net-rate"><span class="radio">Net rate</span></label>
            </div>

        </div>

        <div class="col-sm-3">
            <div class="carbooking">
                <input type="radio" name="commissionable_type" value="2" id="commission-rate" <?php echo $rateTypeChecked2;?>>
                <label for="commission-rate"><span class="radio">commissionable Rate</span></label>
            </div>

        </div>

        <div class="col-sm-6 no-padding" id="type_of_commission" <?php echo $rateTypeDisplay;?>>

            <div class="col-sm-3">
                <div class="carbooking">
                    <input type="radio" name="commission_type" id="commission-percent" value="1" checked="checked"  <?php echo $ratePerChecked1;?>>
                    <label for="commission-percent"><span class="radio">Percent</span></label>
                </div>


            </div>

            <div class="col-sm-3">
                <div class="carbooking">
                    <input type="radio" name="commission_type" value="2" id="commission-fixed" <?php echo $ratePerChecked2;?>>
                    <label for="commission-fixed"><span class="radio">Fixed</span></label>
                </div>

            </div>

            <div class="col-sm-6">
                <?php echo $this->FormElement($form->get('commission_value')); ?>
        <?php echo $this->formElementErrors($form->get('commission_value'), ['class' => 'error']); ?>
            </div>

        </div>

    </div>
    <div class="col-sm-12">

        <div class="col-sm-3 no-padding">

            <div class="carbooking">
                <input type="radio" name="tax" id="tax-inclusive" value="1" checked="checked" <?php echo $taxTypeChecked1;?>>
                <label for="tax-inclusive"><span class="radio">Tax Inclusive</span></label>
            </div>

        </div>

        <div class="col-sm-3">
            <div class="carbooking">
                <input type="radio" name="tax" id="tax-extra" value="2" <?php echo $taxTypeChecked2;?>>
                <label for="tax-extra"><span class="radio">Tax Extra</span></label>
            </div>

        </div>

        <div class="col-sm-6 no-padding" id="tax-cat" <?php echo $taxTypeDisplay;?>>

            <div class="col-sm-3">
                <div class="carbooking">
                    <input type="radio" name="taxextratype" id="percent" value="1" checked="checked"  <?php echo $taxPerChecked1;?>>
                    <label for="percent"><span class="radio">Percent</span></label>
                </div>


            </div>

            <div class="col-sm-3">
                <div class="carbooking">
                    <input type="radio" name="taxextratype" id="fixed" value="2"  <?php echo $taxPerChecked2;?>>
                    <label for="fixed"><span class="radio">Fixed</span></label>
                </div>

            </div>

            <div class="col-sm-6">
                <?php echo $this->FormElement($form->get('tax_value')); ?>
        <?php echo $this->formElementErrors($form->get('tax_value'), ['class' => 'error']); ?>
            </div>

        </div>

    </div>


</div>   
                            
                            
    <div class="form-group clearfix margintopbottom20">        
    <?php //echo $this->partial('service-charge-edit.phtml'); ?>        
    </div>
    <div class="form-group clearfix margintopbottom20">        
    <?php //echo $this->partial('discount-rate-edit.phtml'); ?>        
    </div>


<div class="form-group clearfix margintopbottom20">
    
    <label class="col-sm-3 control-label labelalign col-sm-3-new" for="meal_plan_id">
                        <?php echo $this->translate($this->formLabel($form->get('meal_plan_id'))); ?>
                    </label>
                    <div class="col-sm-3 col-sm-4-new">
                        <?php echo $this->FormElement($form->get('meal_plan_id')->setValue($mealPlanId)); ?>
                        <?php echo $this->formElementErrors($form->get('meal_plan_id'), ['class' => 'error']); ?>
                    </div>

    <label class="col-sm-3 control-label labelalign col-sm-3-new" for="weekdays"> 
                        <?php echo $this->translate($this->formLabel($form->get('weekdays'))); ?>
                    </label>
                    <div class="col-sm-3 col-sm-4-new">                                    
                        <?php echo $this->FormElement($form->get('weekdays')->setValue($weekDaysId)); ?>
                        <?php echo $this->formElementErrors($form->get('weekdays'), ['class' => 'error']); ?>
                    </div>

</div>


<?php echo $this->partial('price-edit.phtml'); ?>


<div class="form-group clearfix margintopbottom20">
    <label class="col-sm-3 control-label labelalign col-sm-3-new" >
        Operating Time<span class="defaultcolor">*</span> </label>
    <div class="col-sm-3 col-sm-4-new nopadding">
        <div class="col-sm-4 padding-left0">
            <?php echo $this->formElement($form->get('operating_time_from')); ?>
            <?php echo $this->formElementErrors($form->get('operating_time_from'), ['class' => 'error']); ?>
        </div>
        <div class="col-sm-4 paddig-right0">
            <?php echo $this->formElement($form->get('operating_time_to')); ?>
            <?php echo $this->formElementErrors($form->get('operating_time_to'), ['class' => 'error']); ?>
        </div>
        <div class="col-sm-4 padding-right0">
            <input type="hidden" name="max_duration" id="max-duration">
            <?php echo $this->formElement($form->get('duration')); ?>
            <?php echo $this->formElementErrors($form->get('duration'), ['class' => 'error']); ?>
        </div>
    </div>

    <label class="col-sm-3 control-label labelalign col-sm-3-new"> Allowed Age Group (Years) <span class="defaultcolor">*</span> </label>
    <div class="col-sm-3 col-sm-4-new nopadding">
   <div class="col-sm-1"><?php //echo $this->translate($this->formLabel($form->get('allowed_age_group_from'))); ?></div>
        <div class="col-sm-4 padding-left0">
            <?php echo $this->formElement($form->get('allowed_age_group_from')); ?>
            <?php echo $this->formElementErrors($form->get('allowed_age_group_from'), ['class' => 'error']); ?>
        </div>
        <div class="col-sm-1"><?php //echo $this->translate($this->formLabel($form->get('allowed_age_group_to'))); ?></div>
        <div class="col-sm-4 paddig-right0">
            <?php echo $this->formElement($form->get('allowed_age_group_to')); ?>
            <?php echo $this->formElementErrors($form->get('allowed_age_group_to'), ['class' => 'error']); ?>
        </div>
    </div>

</div>


                                                        <div class="form-group clearfix margintopbottom20">
                                                            <label class="col-sm-3 control-label labelalign col-sm-3-new"> <?php echo $this->translate($this->formLabel($form->get('transfers'))); ?></label>
                                                            <div class="col-sm-3 col-sm-4-new">
                                                                <?php echo $this->formElement($form->get('transfers')); ?>
                                                                <?php echo $this->formElementErrors($form->get('transfers'), ['class' => 'error']); ?>
                                                            </div>

                                                            <label class="col-sm-3 control-label labelalign col-sm-3-new"> <?php echo $this->translate($this->formLabel($form->get('pick_up_point'))); ?></label>
                                                            <div class="col-sm-3 col-sm-4-new">
                                                                <?php echo $this->formElement($form->get('pick_up_point')); ?>
                                                                <?php echo $this->formElementErrors($form->get('pick_up_point'), ['class' => 'error']); ?>
                                                            </div>


                                                        </div>


<div class="form-group clearfix margintopbottom20">
<label class="col-sm-3 control-label labelalign col-sm-3-new" ><?php echo $this->translate($this->formLabel($form->get('allocation'))); ?>  </label>
<div class="col-sm-4 col-sm-4-new">
     <?php echo $this->formElement($form->get('allocation')); ?>
                            <?php echo $this->formElementErrors($form->get('allocation'), ['class' => 'error']); ?>
  </div>

<label class="col-sm-3 control-label labelalign col-sm-3-new"><?php echo $this->translate($this->formLabel($form->get('cut_off_days'))); ?></label>
<div class="col-sm-4 col-sm-4-new">
     <?php echo $this->formElement($form->get('cut_off_days')); ?>
                            <?php echo $this->formElementErrors($form->get('cut_off_days'), ['class' => 'error']); ?>
  </div>
</div>

<?php echo $this->partial('promotion-rate-edit.phtml'); ?>


</div>
</fieldset>
</div>


<div class="col-sm-10  " align="right">

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

</div>
</div>
                                    
                                    
                                    <br/>
                            <div class="tool-bar margin-bottom margintopnew40">
                                <?php echo $this->partial('rate-middle-links.phtml'); ?>
                            </div>
<span class="checkbox_error"></span>
                            <div class="panel panel-default">
                                <div class="panel-headingnew"> View/Update Records </div>
                                <div id="faq-1-3" class="panel-collapse collapse in" aria-expanded="false">
                                    <div class="box">
                                        <div class="box-body table-responsive listing-data">
                                            <?php echo $this->partial('sightseeing-rate-listing.phtml'); ?>
                                        </div>
                                    </div>
                                </div>
                            </div>


</div>


</div>



</div>

</div>
</div>
</div>
</div>
<br>

</div>
</div>
</section>
