140 lines
6.0 KiB
HTML
140 lines
6.0 KiB
HTML
<!--
|
|
Copyright since 2025 Mifos Initiative
|
|
|
|
This Source Code Form is subject to the terms of the Mozilla Public
|
|
License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
-->
|
|
|
|
<div class="container">
|
|
<mat-card>
|
|
<form [formGroup]="editUserForm" (ngSubmit)="submit()">
|
|
<mat-card-content>
|
|
<div class="layout-row-wrap gap-2px responsive-column">
|
|
<mat-form-field class="flex-48">
|
|
<mat-label>{{ 'labels.inputs.Username' | translate }}</mat-label>
|
|
<input matInput required formControlName="username" />
|
|
@if (editUserForm.controls.username.hasError('required')) {
|
|
<mat-error>
|
|
{{ 'labels.inputs.Username' | translate }} {{ 'labels.commons.is' | translate }}
|
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
|
|
<mat-form-field class="flex-48">
|
|
<mat-label>{{ 'labels.inputs.Email' | translate }}</mat-label>
|
|
<input matInput required formControlName="email" />
|
|
@if (editUserForm.controls.email.hasError('email')) {
|
|
<mat-error>
|
|
{{ 'labels.inputs.Email' | translate }} {{ 'labels.commons.is' | translate }}
|
|
<strong>{{ 'labels.commons.invalid' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
@if (editUserForm.controls.email.hasError('required')) {
|
|
<mat-error>
|
|
{{ 'labels.inputs.Email' | translate }} {{ 'labels.commons.is' | translate }}
|
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
|
|
<mat-form-field class="flex-48">
|
|
<mat-label>{{ 'labels.inputs.First Name' | translate }}</mat-label>
|
|
<input matInput required formControlName="firstname" />
|
|
@if (editUserForm.controls.firstname.hasError('pattern')) {
|
|
<mat-error>
|
|
{{ 'labels.inputs.First Name' | translate }}
|
|
<strong>{{ 'labels.commons.cannot begin with a special character or number' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
@if (editUserForm.controls.firstname.hasError('required')) {
|
|
<mat-error>
|
|
{{ 'labels.inputs.First Name' | translate }} {{ 'labels.commons.is' | translate }}
|
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
|
|
<mat-form-field class="flex-48">
|
|
<mat-label>{{ 'labels.inputs.Last Name' | translate }}</mat-label>
|
|
<input matInput required formControlName="lastname" />
|
|
@if (editUserForm.controls.lastname.hasError('pattern')) {
|
|
<mat-error>
|
|
{{ 'labels.inputs.Last Name' | translate }}
|
|
<strong>{{ 'labels.commons.cannot begin with a special character or number' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
@if (editUserForm.controls.lastname.hasError('required')) {
|
|
<mat-error>
|
|
{{ 'labels.inputs.Last Name' | translate }} {{ 'labels.commons.is' | translate }}
|
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
|
|
<div class="password-never-expires-wrapper flex-48">
|
|
<mat-checkbox labelPosition="before" formControlName="passwordNeverExpires">
|
|
{{ 'labels.inputs.Password never expires' | translate }}
|
|
</mat-checkbox>
|
|
</div>
|
|
|
|
<mat-form-field class="flex-48">
|
|
<mat-label>{{ 'labels.inputs.Office' | translate }}</mat-label>
|
|
<mat-select required formControlName="officeId" (selectionChange)="officeChanged($event.value)">
|
|
@for (office of officesData; track office) {
|
|
<mat-option [value]="office.id">
|
|
{{ office.name }}
|
|
</mat-option>
|
|
}
|
|
</mat-select>
|
|
@if (editUserForm.controls.officeId.hasError('required')) {
|
|
<mat-error>
|
|
{{ 'labels.inputs.Office' | translate }} {{ 'labels.commons.is' | translate }}
|
|
<strong>{{ 'labels.commons.required' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
|
|
<mat-form-field class="flex-48">
|
|
<mat-label>{{ 'labels.inputs.Staff' | translate }}</mat-label>
|
|
<mat-select formControlName="staffId">
|
|
@for (staff of staffData; track staff) {
|
|
<mat-option [value]="staff.id">
|
|
{{ staff.displayName }}
|
|
</mat-option>
|
|
}
|
|
</mat-select>
|
|
</mat-form-field>
|
|
|
|
<mat-form-field class="flex-48">
|
|
<mat-label>{{ 'labels.inputs.Roles' | translate }}</mat-label>
|
|
<mat-select required formControlName="roles" multiple>
|
|
@for (role of rolesData; track role) {
|
|
<mat-option [value]="role.id">
|
|
{{ role.name }}
|
|
</mat-option>
|
|
}
|
|
</mat-select>
|
|
@if (editUserForm.controls.roles.hasError('required')) {
|
|
<mat-error>
|
|
{{ 'labels.commons.At least one role' | translate }}
|
|
<strong>{{ 'labels.commons.must be selected' | translate }}</strong>
|
|
</mat-error>
|
|
}
|
|
</mat-form-field>
|
|
</div>
|
|
</mat-card-content>
|
|
|
|
<mat-card-actions class="layout-row align-center gap-5px responsive-column">
|
|
<button type="button" mat-raised-button [routerLink]="['../']">
|
|
{{ 'labels.buttons.Cancel' | translate }}
|
|
</button>
|
|
<button mat-raised-button color="primary" [disabled]="!editUserForm.valid">
|
|
{{ 'labels.buttons.Submit' | translate }}
|
|
</button>
|
|
</mat-card-actions>
|
|
</form>
|
|
</mat-card>
|
|
</div>
|