<vn-dialog class="edit"
    vn-id="postcodeDialog"
    on-open="$ctrl.onOpen()"
    on-accept="$ctrl.onAccept()"
    message="New postcode">
    <tpl-body>
        <p translate>Please, ensure you put the correct data!</p>
        <vn-horizontal>
            <vn-textfield
                vn-one
                vn-focus
                vn-id="postcode"
                label="Postcode"
                ng-model="$ctrl.location.code"
                required="true">
            </vn-textfield>
            <vn-autocomplete vn-one
                label="City"
                url="Towns/location"
                show-field="name"
                value-field="id"
                ng-model="$ctrl.location.townFk"
                selection="$ctrl.townSelection"
                required="true">
                <append>
                    <vn-icon-button
                        icon="add_circle"
                        vn-tooltip="New city"
                        ng-click="city.open($event)"
                        vn-acl="deliveryBoss"
                        vn-acl-action="remove">
                    </vn-icon-button>
                </append>
            </vn-autocomplete>
        </vn-horizontal>
        <vn-horizontal>
            <vn-autocomplete vn-one
                ng-model="$ctrl.location.provinceFk"
                url="Provinces"
                show-field="name"
                value-field="id"
                label="Province">
                <append>
                    <vn-icon-button
                        icon="add_circle"
                        vn-tooltip="New province"
                        ng-click="province.open($event)"
                        vn-acl="deliveryBoss"
                        vn-acl-action="remove">
                    </vn-icon-button>
                </append>
            </vn-autocomplete>
            <vn-autocomplete vn-one
                ng-model="$ctrl.location.countryFk"
                url="Countries"
                show-field="country"
                value-field="id"
                label="Country">
            </vn-autocomplete>
        </vn-horizontal>
    </tpl-body>
    <tpl-buttons>
        <input type="button" response="cancel" translate-attr="{value: 'Cancel'}"/>
        <button id= "savePostcode" response="accept" translate>Save</button>
    </tpl-buttons>
</vn-dialog>
<!-- New province dialog -->
<vn-geo-province
    vn-id="province"
    on-response="$ctrl.onProvinceResponse($response)">
</vn-geo-province>
<!-- New city dialog -->
<vn-geo-city
    vn-id="city"
    on-response="$ctrl.onCityResponse($response)">
</vn-geo-city>