<section class="content-header">
    <ol class="breadcrumb">
        <li><a href="<?php echo $this->url('home');?>"><i class="fa fa-home"></i>Home</a></li>
        <li class="active"><a href="<?php echo $this->url('dashboard');?>">Dashboard</a></li>
        <li class="active">Edit Profile</li>
    </ol>
</section>

<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"><?php echo $this->translate('Edit Profile'); ?> </div>
                                <div class="left_panel col-sm-12 padding_margin0 pull-left bgwhite">
                                    <?php echo $this->partial('profile-menu.phtml'); ?>
                                    <div class="tab-content tab_editprofile col-sm-10 padding-left0 marginbott10px margintop10px">
                                        <div id="common-tab" class="tab-pane fade in tab_editprofile tab_editprofile1 active">

                                            <div class="col-sm-col-sm-offset-1 margin-10auto0 paddingRL10px">
                                                <?php
                                                $form = $this->form;
                                                $form->prepare();
                                                $form->setAttribute('action', $this->url('profile', ['action' => 'license-detail']));
                                                $form->setAttribute('method', 'post');
                                                $form->setAttribute('id', 'profile-license-detail');
//        $form->setAttributes(['name'=>'license_detail_form', 'id'=>'license-detail-form',
//        'onsubmit'=>"return formSubmit2('license-detail-form','license-detail')"]);
                                                echo $this->form()->openTag($form);
                                                ?>
                                                <div class="row">
                                                    <div class="col-sm-10">
                                                        <span style="color:<?php echo $msg_color; ?>"><?php echo $msg; ?></span><br/>
                                                        <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('license_state'))); ?></label>
                                                            <div class="col-sm-3 col-sm-4-new">
                                                                <?php echo $this->FormElement($form->get('license_state')); ?>
                                                                <?php echo $this->formElement($form->get('license_state_value')); ?>
                                                                <?php echo $this->formElementErrors($form->get('license_state'), ['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('license_proof'))); ?>
                                                            </label>
                                                            <div class="col-sm-3 col-sm-4-new">
                                                                <?php echo $this->FormElement($form->get('license_proof')); ?>
                                                                <?php echo $this->formElementErrors($form->get('license_proof'), ['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">
                                                                <?php echo $this->translate($this->formLabel($form->get('driving_license_no'))); ?>
                                                            </label>
                                                            <div class="col-sm-3 col-sm-4-new">
                                                                <?php echo $this->FormElement($form->get('driving_license_no')); ?>
                                                                <?php echo $this->formElementErrors($form->get('driving_license_no'), ['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('police_proof'))); ?>
                                                            </label>
                                                            <div class="col-sm-3 col-sm-4-new">
                                                                <?php echo $this->FormElement($form->get('police_proof')); ?>
                                                                <?php echo $this->formElementErrors($form->get('police_proof'), ['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">
                                                            <?php echo $this->translate($this->formLabel($form->get('insurance_validity'))); ?>
                                                                            </label>
                                                            <div class="col-sm-3 col-sm-4-new">
                                                            <?php echo $this->FormElement($form->get('insurance_validity')); ?>
                                                            <?php echo $this->formElementErrors($form->get('insurance_validity'), ['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('license_validity'))); ?>
                                                            </label>
                                                            <div class="col-sm-4 col-sm-4-new">
                                                                <?php echo $this->FormElement($form->get('license_validity')); ?>
                                                                <?php echo $this->formElementErrors($form->get('license_validity'), ['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">
                                                                <?php echo $this->translate($this->formLabel($form->get('pancard_no'))); ?>
                                                            </label>
                                                            <div class="col-sm-3 col-sm-4-new">
                                                                <?php echo $this->FormElement($form->get('pancard_no')); ?>
                                                                <?php echo $this->formElementErrors($form->get('pancard_no'), ['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('pancard_proof'))); ?>
                                                            </label>
                                                            <div class="col-sm-4 col-sm-4-new">
                                                                <?php echo $this->FormElement($form->get('pancard_proof')); ?>
                                                                <?php echo $this->formElementErrors($form->get('pancard_proof'), ['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">
                                                                <?php echo $this->translate($this->formLabel($form->get('gps'))); ?>
                                                            </label>
                                                            <div class="col-sm-4 col-sm-4-new">
                                                                <?php echo $this->FormElement($form->get('gps')); ?>
                                                                <?php echo $this->formElementErrors($form->get('gps'), ['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('audit_proof'))); ?>
                                                            </label>
                                                            <div class="col-sm-4 col-sm-4-new">
                                                                <?php echo $this->FormElement($form->get('audit_proof')); ?>
                                                                <?php echo $this->formElementErrors($form->get('audit_proof'), ['class' => 'error']); ?>
                                                            </div>
                                                        </div>

                                                        <div class="form-group clearfix margintopbottom20">
                                                            <label class="col-sm-3 control-label labelalign col-sm-3-new" id="">  </label>
                                                            <div class="col-sm-4 col-sm-4-new">

                                                            </div>
                                                            <label class="col-sm-3 control-label labelalign col-sm-3-new" id="update_profiel"></label>
                                                            <div class="col-sm-3 col-sm-4-new " align="right">

                                                                <!--<a class="reset_btn btn btn-success btn-new-vehile" href="#">
                                                                    <i class="fa fa-retweet"></i>
                                                                    Reset
                                                                </a>
                                                                <button type="button" class="save_data_btn btn btn-primary btn-new-vehile butoon_save btn-warning" >Save</button>-->


                                                                <?php echo $this->FormElement($form->get('submit_type')); ?>
                                                                <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('license_save')); ?>

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


                                                    <div class="col-sm-12 col-md-8 col-lg-12 clearfix userprofileimg">
                                                        <div id="crop-avatar">

                                                            <!-- Current avatar -->
                                                            <?php
                                                            if (count($getdoc) > 0) {

                                                                for ($docid = 0; $docid < count($getdoc); $docid++) {
                                                                    $image_name = isset($getdoc[$docid]['doc_file_upload']) ? $getdoc[$docid]['doc_file_upload'] : '';
                                                                    $image_title = isset($getdoc[$docid]['document_name']) ? $getdoc[$docid]['document_name'] : '';

                                                                    $filepath = getcwd() . "/public/upload/$id/" . $image_name;
                                                                    $imagepath = "/upload/$id/" . $image_name;
                                                                    if (file_exists($filepath)) {
                                                                        ?>
                                                                        <div class="avatar-view userimg_byratio preview_img" title="<?php echo $image_title; ?>">
                                                                        <img src="<?php echo $imagepath; ?>" id="residential_proof" alt="<?php echo $image_title; ?>">
                                                                            <h6><center><b><a download href="<?php echo $imagepath; ?>"><?php echo $image_title; ?></a></b></center></h6><br/>
                                                                            <a download href="<?php echo $imagepath; ?>">Download</a>
                                                                        </div>

                                                                    <?php }
                                                                }
                                                            }
                                                            ?>



                                                        </div>
                                                    </div>


                                                </div>
<?php echo $this->form()->closeTag(); ?>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <br>
        <!-- /.widget-box -->
    </div>
    <!-- /.col -->
</section>

<script>
//state name called...
    $("#license-state").autocomplete({
        source: function (request, response) {
            $.ajax({
                url: '/profile/state-list',
                dataType: "json",
                type: "POST",
                data: {
                    term: request.term
                },
                success: function (data) {
                    response(data);
                }
            });
        },
        min_length: 3,
        delay: 300,

        focus: function (event, ui) {
            $("#state-aa").val(ui.item.label);
            return false;
        },
        select: function (event, ui) {
            $("#license-state").val(ui.item.label);
            $("#license-state-value").val(ui.item.value);

            return false;
        }
    });
</script>