{% if settings.PAF_ENABLED %}

    {% if address_type is defined and address_type == 'shipping'%}

        <paf inline-template inputpostcode="{{ postcode }}" v-cloak>

            <section>

                <div class="row"
                     v-bind:class="{
                    'errorWrap showError': hasField('errors.address.shipping.postcode')
                }"
                >
                    <label for="shippingPostcodeSearch">
                        Postcode/Zip
                    </label>

                    <div class="inputWrap buttonInline">
                        <input maxlength="10"
                               type="text"
                               name="shipping_postcode"
                               id="shippingPostcodeSearch"
                               v-on:focus="clearError('postcode_error')"
                               v-model="postcode"
                               class="text postcode-search"
                        />
                        <button type="submit"
                                id="shippingPostCodeSubmit"
                                @click.prevent="triggerPAF()"
                                name="submit[shipping_postcode]"
                                class="buttonAlt"
                        >
                            Find Address
                        </button>
                    </div>
                    <div class="validationMessage"
                         v-if="hasField('postcode_error')"
                    >
                        <span>[% postcode_error %]</span>
                    </div>

                </div>

                <div class="row errorWrap showError" v-show="search_started && address_list.length < 1">
                    <div class="validationMessage">
                        We could not find your address.
                    </div> <!-- .validationMessage -->
                </div> <!-- .row -->

                <div class="row"
                     v-show="search_started && address_list.length > 0"
                >

                    <label for="shipping_address_list">
                        Please select<sup>*</sup>
                    </label>


                    <div class="inputWrap">

                        <chosen
                                :options="address_list"
                                placeholder="Select address"
                                class="no-chosen"
                                @input="setPafAddress('shipping')"
                                id="shipping_address_list"
                                name="shipping_address_list"
                                v-model="paf_address"

                        ></chosen>


                        {#
                        <button class="button"
                                type="submit"
                                @click.prevent="setPafAddress('shipping')"
                                name="submit[shipping_paf]"
                                id="setPafAddressShipping"
                        >
                            Use
                        </button>
                        #}
                    </div>
                </div> <!-- .row -->

            </section>

        </paf>

    {% else %}

        <paf inline-template inputpostcode="{{ postcode }}" v-cloak>

            <section>

                <div class="row"
                     v-bind:class="{
                    'errorWrap showError': hasField('errors.address.billing.postcode')
                }"
                >
                    <label for="billingPostcodeSearch">
                        Postcode/Zip
                    </label>

                    <div class="inputWrap buttonInline">
                        <input maxlength="10"
                               type="text"
                               name="billing_postcode"
                               id="billingPostcodeSearch"
                               v-on:focus="clearError('postcode_error')"
                               v-model="postcode"
                               class="text postcode-search"
                        />
                        <button type="submit"
                                id="billingPostCodeSubmit"
                                @click.prevent="triggerPAF()"
                                name="submit[billing_postcode]"
                                class="buttonAlt"
                        >
                            Find Address
                        </button>
                    </div>

                    <div class="validationMessage"
                         v-if="hasField('postcode_error')"
                    >
                        <span>[% postcode_error %]</span>
                    </div>

                </div>

                <div class="row errorWrap showError" v-show="search_started && address_list.length < 1">
                    <div class="validationMessage">
                        We could not find your address.
                    </div> <!-- .validationMessage -->
                </div> <!-- .row -->

                <div class="row"
                     v-show="search_started && address_list.length > 0"
                >
                    <label for="billing_address_list">
                        Please select<sup>*</sup>
                    </label>


                    <div class="inputWrap">


                        <chosen
                                :options="address_list"
                                placeholder="Select address"
                                class="no-chosen"
                                @input="setPafAddress('billing')"
                                id="billing_address_list"
                                name="billing_address_list"
                                v-model="paf_address"

                        ></chosen>



                        {#
                        <button class="button"
                                type="submit"
                                @click.prevent="setPafAddress('billing')"
                                name="submit[billing_paf]"
                                id="setPafAddressBilling"
                        >
                            Use
                        </button>
                        #}
                    </div>

                </div> <!-- .row -->

                {#
                <div class="row checkboxRow {{ checkbox_class }}">
                    <input id="cant_find_address" name="billing[cant_find_address]" type="checkbox" value="1" v-model="fields_active" v-bind:change="toggleReadonly('billing')">
                    <label for="cant_find_address">I can't find my address</label>
                </div>
                #}

            </section>

        </paf>

    {% endif %}

{% endif %}
