added edit fonction

This commit is contained in:
2025-11-27 17:15:35 +01:00
parent 8d95127a46
commit 40b1c2620a
8 changed files with 77 additions and 15 deletions

View File

@@ -1,10 +1,11 @@
import { Component } from '@angular/core';
import {Component, effect, input} from '@angular/core';
import {FormControl, FormGroup, FormsModule, ReactiveFormsModule, Validators} from "@angular/forms";
import {NzColDirective} from "ng-zorro-antd/grid";
import {NzFlexDirective} from "ng-zorro-antd/flex";
import {NzFormControlComponent, NzFormDirective, NzFormItemComponent, NzFormLabelComponent} from "ng-zorro-antd/form";
import {NzInputDirective} from "ng-zorro-antd/input";
import {NzOptionComponent, NzSelectComponent} from "ng-zorro-antd/select";
import {GetUserDto} from "../../services/api";
@Component({
selector: 'app-profil-form',
@@ -31,4 +32,18 @@ export class ProfilForm {
fonction: new FormControl<string>(null, [Validators.required]),
password: new FormControl<string>(null, [Validators.required])
})
user = input<GetUserDto | null>(null);
constructor() {
effect(() => {
if (this.user()) {
this.profilForm.patchValue({
name: this.user().name,
email: this.user().email,
fonction: this.user().fonction,
password: this.user().password
});
}
});
}
}