feat(user-update): Konstante Variablen zur Bestimmung der zulässigen Datumsformate in den Umgebungen erstellt.
- Zugelassene Datumsformate in Combobox als Optionen mit Angular for-Schleife hinzugefügt
This commit is contained in:
parent
2800392be3
commit
faac31b3bb
@ -43,11 +43,11 @@
|
||||
<mat-form-field>
|
||||
<mat-label>Datumsformat</mat-label>
|
||||
<mat-select [(value)]="user.dateFormat" [(ngModel)]="user.dateFormat">
|
||||
<mat-option value="dd.MM.yyyy">dd.MM.yyyy</mat-option>
|
||||
<mat-option value="MM.dd.yyyy">MM.dd.yyyy</mat-option>
|
||||
<mat-option value="yyyy-MM-dd">yyyy-MM-dd</mat-option>
|
||||
@for (format of allowedDateFormats; track format) {
|
||||
<mat-option [value]="format.value">{{format.name}}</mat-option>
|
||||
}
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
</mat-form-field>
|
||||
</div>
|
||||
<!-- comment -->
|
||||
<div class="dd-row input-row">
|
||||
|
||||
@ -15,6 +15,7 @@ import { UserService } from '../../../services/api/user.service';
|
||||
import { RefreshService } from '../../../services/button/refresh.service';
|
||||
import Swal from 'sweetalert2';
|
||||
import { MatSelectModule } from '@angular/material/select';
|
||||
import { env } from '../../../../environments/environment'
|
||||
|
||||
@Component({
|
||||
selector: 'app-user-update-form',
|
||||
@ -29,6 +30,10 @@ export class UserUpdateFormComponent {
|
||||
|
||||
readonly user: User = inject(MAT_DIALOG_DATA);
|
||||
|
||||
get allowedDateFormats(): Array<{ value: string, name: string }> {
|
||||
return env.constants.date_formats;
|
||||
}
|
||||
|
||||
readonly username = new FormControl(this.user.username, [Validators.required]);
|
||||
readonly email = new FormControl(this.user.email, [Validators.required, Validators.email]);
|
||||
readonly name = new FormControl(this.user.prename, [Validators.required]);
|
||||
@ -79,7 +84,7 @@ export class UserUpdateFormComponent {
|
||||
this.user.name = this.surname.value!;
|
||||
this.user.shortname = this.shortname.value!;
|
||||
this.user.comment = this.comment.value!;
|
||||
|
||||
|
||||
this.uService.update(this.user).subscribe({
|
||||
next: () => {
|
||||
this.rService.executeAll();
|
||||
|
||||
@ -53,7 +53,7 @@ export const env = {
|
||||
field: 'email'
|
||||
},
|
||||
{
|
||||
header:'Kommentar',
|
||||
header: 'Kommentar',
|
||||
field: 'comment'
|
||||
},
|
||||
{
|
||||
@ -199,5 +199,21 @@ export const env = {
|
||||
},
|
||||
]
|
||||
},
|
||||
config_url: "/assets/config.json"
|
||||
config_url: "/assets/config.json",
|
||||
constants: {
|
||||
date_formats: [
|
||||
{
|
||||
value: "dd.MM.yyyy",
|
||||
name: "dd.MM.yyyy",
|
||||
},
|
||||
{
|
||||
value: "MM.dd.yyyy",
|
||||
name: "MM.dd.yyyy",
|
||||
},
|
||||
{
|
||||
value: "yyyy-MM-dd",
|
||||
name: "yyyy-MM-dd",
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
@ -53,7 +53,7 @@ export const env = {
|
||||
field: 'email'
|
||||
},
|
||||
{
|
||||
header:'Kommentar',
|
||||
header: 'Kommentar',
|
||||
field: 'comment'
|
||||
},
|
||||
{
|
||||
@ -195,5 +195,21 @@ export const env = {
|
||||
},
|
||||
]
|
||||
},
|
||||
config_url: "/assets/config.json"
|
||||
};
|
||||
config_url: "/assets/config.json",
|
||||
constants: {
|
||||
date_formats: [
|
||||
{
|
||||
value: "dd.MM.yyyy",
|
||||
name: "dd.MM.yyyy",
|
||||
},
|
||||
{
|
||||
value: "MM.dd.yyyy",
|
||||
name: "MM.dd.yyyy",
|
||||
},
|
||||
{
|
||||
value: "yyyy-MM-dd",
|
||||
name: "yyyy-MM-dd",
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
Loading…
x
Reference in New Issue
Block a user