<vdr-action-bar>
    <vdr-ab-left>
        <vdr-entity-info [entity]="entity$ | async"></vdr-entity-info>
    </vdr-ab-left>
    <vdr-ab-right>
        <vdr-action-bar-items locationId="administrator-detail"></vdr-action-bar-items>
        <button
            class="btn btn-primary"
            (click)="save()"
            [disabled]="detailForm.invalid || detailForm.pristine"
        >
            {{ 'common.update' | translate }}
        </button>
    </vdr-ab-right>
</vdr-action-bar>

<form class="form" [formGroup]="detailForm">
    <vdr-form-field [label]="'settings.email-address' | translate" for="emailAddress">
        <input id="emailAddress" type="text" formControlName="emailAddress"/>
    </vdr-form-field>
    <vdr-form-field [label]="'settings.first-name' | translate" for="firstName">
        <input id="firstName" type="text" formControlName="firstName"/>
    </vdr-form-field>
    <vdr-form-field [label]="'settings.last-name' | translate" for="lastName">
        <input id="lastName" type="text" formControlName="lastName"/>
    </vdr-form-field>
    <vdr-form-field *ngIf="isNew$ | async" [label]="'settings.password' | translate" for="password">
        <input id="password" type="password" formControlName="password"/>
    </vdr-form-field>
    <vdr-form-field [label]="'settings.password' | translate" for="password" [readOnlyToggle]="true">
        <input id="password" type="password" formControlName="password"/>
    </vdr-form-field>
    <section formGroupName="customFields" *ngIf="customFields.length">
        <label>{{ 'common.custom-fields' | translate }}</label>
        <vdr-tabbed-custom-fields
            entityName="Administrator"
            [customFields]="customFields"
            [customFieldsFormGroup]="detailForm.get('customFields')"
        ></vdr-tabbed-custom-fields>
    </section>
    <vdr-custom-detail-component-host
        locationId="administrator-profile"
        [entity$]="entity$"
        [detailForm]="detailForm"
    ></vdr-custom-detail-component-host>
</form>
