<?php
$shareFare    =   isset($fareDetails['share_fare'])?$fareDetails['share_fare']:'';
//echo '<pre>';print_r($shareFare);die();
//echo $shareFare[0]['share_type_id'];
?>
<?php
$form = $this->shareform;
$form->setAttribute('action', $this->url('cabfare', ['action' => 'add-price-share']));
$form->setAttribute('method', 'post');
echo $this->form()->openTag($form);
echo $this->formHidden($form->get('comp_share_id')->setValue(isset($shareFare[0]['id'])?$shareFare[0]['id']:''));
echo $this->formHidden($form->get('partner_share_id')->setValue(isset($shareFare[1]['id'])?$shareFare[1]['id']:''));
echo $this->formHidden($form->get('driver_share_id')->setValue(isset($shareFare[2]['id'])?$shareFare[2]['id']:''));

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

<div class="row">
    <div class="col-sm-12 margin20auto5 padding10px">
        <div class="col-sm-12 col-md-12">
            <div class="portlet-body">

                <h4 class="different_share"><?php echo $this->translate('Different Shares'); ?></h4>
                <br>

                <div class="form-inline form-group">

                    <h5 class="company_share"><?php echo $this->translate($form->get('company_share')->getLabel()); ?></h5>

                    <div class="col-sm-2 no-padding margin-top10px">
                        <div class="carbooking">
                            <input type="radio" value="1" name="company_share_type" id="company-share-per" <?php if(isset($shareFare[0]['share_value_type']) && $shareFare[0]['share_value_type'] =='1'){ ?>  <?php echo 'checked="checked"';}else {echo 'checked="checked"'; }?>/>
                            <label for="company-share-per"><span class="radio">%</span></label>
                        </div>

                    </div>

                    <div class="col-sm-2 no-padding margin-top10px">
                        <div class="carbooking">
                            <input type="radio" value="2" name="company_share_type" id="company-share-rs" <?php if(isset($shareFare[0]['share_value_type']) && $shareFare[0]['share_value_type'] =='2'){ ?>  <?php echo 'checked="checked"';}?>/>
                            <label for="company-share-rs"><span class="radio">Rs</span></label>
                        </div>

                    </div>

                    <div class="input-group">
                        <?php echo $this->FormElement($form->get('company_share')->setValue(isset($shareFare[0]['share_value'])?$shareFare[0]['share_value']:'')); ?>
                        <?php echo $this->FormElement($form->get('company_share_type_id')); ?>
                    </div>

                </div>

                <hr>


                <div class="form-inline form-group">

                    <h5 class="company_share"><?php echo $this->translate($form->get('partner_share')->getLabel()); ?></h5>

                    <div class="col-sm-2 no-padding margin-top10px">
                        <div class="carbooking">
                            <input type="radio" value="1" name="partner_share_type" id="partner-share-per"  <?php if(isset($shareFare[1]['share_value_type']) && $shareFare[1]['share_value_type'] =='1'){ ?>  <?php echo 'checked="checked"';}else {echo 'checked="checked"'; }?>/>
                            <label for="partner-share-per"><span class="radio">%</span></label>
                        </div>

                    </div>

                    <div class="col-sm-2 no-padding margin-top10px">
                        <div class="carbooking">
                            <input type="radio" value="2" name="partner_share_type" id="partner-share-rs" <?php if(isset($shareFare[1]['share_value_type']) && $shareFare[1]['share_value_type'] =='2'){ ?>  <?php echo 'checked="checked"';}?>/>
                            <label for="partner-share-rs"><span class="radio">Rs</span></label>
                        </div>

                    </div>

                    <div class="input-group">
                        <?php echo $this->FormElement($form->get('partner_share')->setValue(isset($shareFare[1]['share_value'])?$shareFare[1]['share_value']:'')); ?>
                        <?php echo $this->FormElement($form->get('partner_share_type_id')); ?>
                    </div>

                </div>

                <hr>

                <div class="form-inline form-group">

                    <h5 class="company_share"><?php echo $this->translate($form->get('driver_share')->getLabel()); ?></h5>

                    <div class="col-sm-2 no-padding margin-top10px">
                        <div class="carbooking">
                            <input type="radio" value="1" name="driver_share_type" id="driver-share-per" <?php if(isset($shareFare[2]['share_value_type']) && $shareFare[2]['share_value_type'] =='1'){ ?>  <?php echo 'checked="checked"';}else {echo 'checked="checked"'; }?>/>
                            <label for="driver-share-per"><span class="radio">%</span></label>
                        </div>

                    </div>

                    <div class="col-sm-2 no-padding margin-top10px">
                        <div class="carbooking">
                            <input type="radio" value="2" name="driver_share_type" id="driver-share-rs" <?php if(isset($shareFare[2]['share_value_type']) && $shareFare[2]['share_value_type'] =='2'){ ?>  <?php echo 'checked="checked"';}?>/>
                            <label for="driver-share-rs"><span class="radio">Rs</span></label>
                        </div>

                    </div>

                    <div class="input-group">
                        <?php echo $this->FormElement($form->get('driver_share')->setValue(isset($shareFare[2]['share_value'])?$shareFare[2]['share_value']:'')); ?>
                        <?php echo $this->FormElement($form->get('driver_share_type_id')); ?>
                    </div>

                </div>

                <hr>




                <div class="row ">
                    <div class="col-sm-3"></div>
                    <div class="col-sm-3"></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>
            </div>
        </div>
        <div class="col-sm-4 col-md-4"></div>
    </div>
</div>
<?php echo $this->form()->closeTag(); ?>