<mg-ajax path="/client/api/Clients/{{patch.params.id}}/updateFiscalData" options="vnPatch"></mg-ajax>
<vn-watcher
    vn-id="watcher"
    data="$ctrl.client"
    form="form"
    save="patch">
</vn-watcher>
<form name="form" ng-submit="$ctrl.submit()" compact>
    <vn-card pad-large>
        <vn-title>Fiscal data</vn-title>
        <vn-horizontal>
            <vn-textfield
                vn-two
                vn-focus
                label="Social name"
                field="$ctrl.client.socialName">
            </vn-textfield>
            <vn-textfield
                vn-one
                label="Tax number"
                field="$ctrl.client.fi">
            </vn-textfield>
        </vn-horizontal>
        <vn-horizontal>
            <vn-textfield
                vn-two
                label="Street"
                field="$ctrl.client.street">
            </vn-textfield>
        </vn-horizontal>
        <vn-horizontal>
            <vn-textfield
                vn-one
                label="Postcode"
                field="$ctrl.client.postcode">
            </vn-textfield>
            <vn-textfield
                vn-one
                label="City"
                field="$ctrl.client.city">
            </vn-textfield>
        </vn-horizontal>
        <vn-horizontal>
            <vn-autocomplete
                vn-one
                initial-data="$ctrl.client.country"
                field="$ctrl.client.countryFk"
                url="/client/api/Countries"
                show-field="country"
                value-field="id"
                label="Country">
            </vn-autocomplete>
            <vn-autocomplete
                vn-one
                initial-data="$ctrl.client.province"
                field="$ctrl.client.provinceFk"
                url="/client/api/Provinces"
                show-field="name"
                value-field="id"
                label="Province">
            </vn-autocomplete>
        </vn-horizontal>
        <vn-horizontal pad-small-v>
            <vn-check
                vn-one
                label="Active"
                field="$ctrl.client.isActive">
            </vn-check>
            <vn-check
                vn-one
                label="Frozen"
                field="$ctrl.client.isFreezed">
            </vn-check>
        </vn-horizontal>
        <vn-horizontal pad-small-v>
            <vn-check
                vn-one
                label="Has to invoice"
                field="$ctrl.client.hasToInvoice">
            </vn-check>
            <vn-check
                vn-one
                label="Vies"
                field="$ctrl.client.isVies">
            </vn-check>
        </vn-horizontal>
        <vn-horizontal pad-small-v>
            <vn-check
                vn-one
                label="Invoice by mail"
                field="$ctrl.client.isToBeMailed">
            </vn-check>
            <vn-check
                vn-one
                label="Invoice by address"
                field="$ctrl.client.hasToInvoiceByAddress">
            </vn-check>
        </vn-horizontal>
        <vn-horizontal pad-small-v>
            <vn-check
                vn-one
                label="Is equalizated"
                field="$ctrl.client.isEqualizated"
                info="In order to invoice, this field is not consulted, but the consignee's ET. When modifying this field if the invoice by address option is not checked, the change will be automatically propagated to all addresses, otherwise the user will be asked if he wants to propagate it or not.">
            </vn-check>
            <vn-check
                vn-one
                label="Verified data"
                field="$ctrl.client.isTaxDataChecked"
                vn-acl="salesAssistant">
            </vn-check>
        </vn-horizontal>
    </vn-card>
    <vn-button-bar>
        <vn-submit label="Save">
        </vn-submit>
    </vn-button-bar>
</form>
<vn-confirm 
    vn-id="propagate-isEqualizated"
    question="You changed the equalization tax"
    message="Do you want to spread the change?"
    on-response="$ctrl.returnDialogEt(response)">
</vn-confirm>