<?xml version="1.0"?>
<t name="Address Details" t-name="portal.address_form_fields">
        <div id="div_name" class="col-lg-12 mb-2">
            <label class="col-form-label" for="o_name">Your name</label>
            <input id="o_name" type="text" name="name" t-att-value="partner_sudo.name" class="form-control"/>
        </div>
        <div class="w-100"/>
        <div id="div_email" class="col-lg-6 mb-2">
            <label class="col-form-label" for="o_email">Email</label>
            <input id="o_email" type="email" name="email" t-att-value="partner_sudo.email" class="form-control"/>
        </div>
        <div id="div_phone" class="col-lg-6 mb-2">
            <label class="col-form-label" for="o_phone">Phone</label>
            <input id="o_phone" type="tel" name="phone" t-att-value="partner_sudo.phone" class="form-control"/>
        </div>
        <t name="b2b_fields">
            <div class="w-100"/>
            <t t-if="is_used_as_billing">
                <t t-set="vat_warning" t-value="current_partner.vat and not current_partner.can_edit_vat()"/>
                <div id="company_name_div" class="col-lg-6 mb-2">
                    <label class="col-form-label fw-normal label-optional" for="o_company_name">
                        Company Name
                    </label>
                    <input id="o_company_name" type="text" name="company_name" t-att-value="current_partner.commercial_company_name" t-att-readonly="'1' if not is_main_address else None" class="form-control"/>
                </div>
                <div id="div_vat" class="col-lg-6 mb-2">
                    <label class="col-form-label fw-normal label-optional" for="o_vat">
                        <t t-out="vat_label"/>
                    </label>
                    <input type="text" id="o_vat" name="vat" t-att-value="current_partner.vat" t-att-readonly="'1' if (not is_commercial_address or vat_warning) else None" class="form-control"/>
                    <!-- Even on new addresses, first tell the customer if their VAT cannot be changed,
                        then tell them to update it elsewhere if it can be. -->
                    <div t-if="not is_commercial_address and commercial_partner.is_company and is_main_address" class="col-12 d-none d-lg-block mb-1">
                        <small class="form-text text-muted">
                            The VAT number can only be updated on the company account.
                        </small>
                    </div>
                    <div t-elif="vat_warning and is_main_address" class="col-12 d-none d-lg-block mb-1">
                        <small class="form-text text-muted">
                            Changing VAT number is not allowed once document(s) have
                            been issued for your account. Please contact us directly for this
                            operation.
                        </small>
                    </div>
                </div>
                <div t-if="not (is_commercial_address or is_main_address)" class="col-12 d-none d-lg-block mb-1">
                    <small class="form-text text-muted">
                        The company name and VAT number can only be updated on your main account.
                        <t t-if="commercial_address_update_url">
                            If you want to modify it, update
                            <a t-att-href="commercial_address_update_url">your account details</a>.
                        </t>
                    </small>
                </div>
            </t>
        </t>
        <div id="div_street" class="col-lg-12 mb-2">
            <label class="col-form-label" for="o_street">
                Street and Number
            </label>
            <input name="street" id="o_street" type="text" class="form-control" t-att-value="partner_sudo.street"/>
        </div>
        <div id="div_street2" class="col-lg-12 mb-2">
            <label class="col-form-label label-optional" for="o_street2">
                Apartment, suite, etc.
            </label>
            <input id="o_street2" type="text" name="street2" class="form-control" t-att-value="partner_sudo.street2"/>
        </div>
        <div class="w-100"/>
        <t t-if="zip_before_city">
            <div id="div_zip" class="col-md-4 mb-2">
                <label class="col-form-label" for="o_zip">
                    Zip Code
                </label>
                <input id="o_zip" type="text" name="zip" class="form-control" t-att-value="partner_sudo.zip"/>
            </div>
        </t>
        <div id="div_city" class="col-md-8 mb-2">
            <label class="col-form-label" for="o_city">City</label>
            <input id="o_city" type="text" name="city" class="form-control" t-att-value="partner_sudo.city"/>
        </div>
        <t t-if="not zip_before_city">
            <div id="div_zip" class="col-md-4 mb-2">
                <label class="col-form-label" for="o_zip">
                    Zip Code
                </label>
                <input id="o_zip" type="text" name="zip" class="form-control" t-att-value="partner_sudo.zip"/>
            </div>
        </t>
        <div class="w-100"/>
        <div id="div_country" class="col-lg-6 mb-2">
            <label class="col-form-label" for="o_country_id">
                Country
            </label>
            <select id="o_country_id" name="country_id" t-att-class="'pe-none opacity-50 form-select' if not can_edit_country else 'form-select'">
                <option value="">Country...</option>
                <option t-foreach="countries" t-as="c" t-att-value="c.id" t-att-selected="c.id == (country.id if country else partner_sudo.country_id.id)" t-att-code="c.code" t-out="c.name"/>
            </select>
            <div t-if="not can_edit_country" class="col-12 d-none d-lg-block mb-1">
                <small class="form-text text-muted">
                    Changing country is not allowed once document(s) have
                    been issued for your account. Please contact us directly for this
                    operation.
                </small>
            </div>
        </div>
        <div id="div_state" class="col-lg-6 mb-2" t-att-style="not country_states and 'display: none'">
            <label class="col-form-label label-optional" for="o_state_id">
                State / Province
            </label>
            <select id="o_state_id" name="state_id" class="form-select">
                <option value="">State / Province...</option>
                <option t-foreach="country_states" t-as="s" t-att-value="s.id" t-att-selected="s.id == (int(state_id) if state_id else partner_sudo.state_id.id)" t-out="s.name"/>
            </select>
        </div>
        <input type="hidden" name="csrf_token" t-att-value="request.csrf_token()" t-nocache="The csrf token must always be up to date."/>
        <input type="hidden" name="address_type" t-att-value="address_type"/>
        <input type="hidden" name="use_delivery_as_billing" t-att-value="use_delivery_as_billing"/>
        <input type="hidden" name="parent_id" t-att-value="parent_id"/>
        <t t-if="partner_id">
            <input type="hidden" name="partner_id" t-att-value="partner_id"/>
        </t>
        <t t-if="callback">
            <input type="hidden" name="callback" t-att-value="callback"/>
        </t>
        <input type="hidden" name="required_fields" t-att-value="'name,email'"/>
    </t>

    