<vn-watcher
    vn-id="watcher"
    url="/client/api/Accounts"
    id-field="id"
    data="$ctrl.account"
    form="form">
</vn-watcher>
<form name="form" ng-submit="watcher.submit()" compact>
    <vn-card pad-large>
        <vn-horizontal pad-small-v>
            <vn-check
                vn-one
                label="Enable web access"
                field="$ctrl.account.active"
                vn-acl="employee">
            </vn-check>
        </vn-horizontal>
        <vn-horizontal>
            <vn-textfield
                vn-focus
                vn-one
                label="User"
                field="$ctrl.account.name">
            </vn-textfield>
        </vn-horizontal>
    </vn-card>
    <vn-button-bar>
        <vn-submit label="Save"></vn-submit>
        <vn-button ng-if="$ctrl.canChangePassword" label="Change password" vn-dialog="change-pass"></vn-button>
    </vn-button-bar>
</form>
<vn-dialog
    vn-id="change-pass"
    on-open="$ctrl.onPassOpen()"
    on-response="$ctrl.onPassChange(response)">
    <tpl-body>
        <vn-textfield
            type="password"
            label="New password"
            model="$ctrl.newPassword">
        </vn-textfield>
        <vn-textfield
            type="password"
            label="Repeat password"
            model="$ctrl.repeatPassword">
        </vn-textfield>
    </tpl-body>
    <tpl-buttons>
        <input type="button" response="CANCEL" translate-attr="{value: 'Cancel'}"/>
        <button response="ACCEPT" translate>Change password</button>
    </tpl-buttons>
</vn-dialog>