updated user form for create all user
This commit is contained in:
@@ -27,9 +27,7 @@ import {NzIconDirective} from "ng-zorro-antd/icon";
|
|||||||
export class UserTable implements OnInit {
|
export class UserTable implements OnInit {
|
||||||
private usersService = inject(UsersService);
|
private usersService = inject(UsersService);
|
||||||
private notificationService = inject(NzNotificationService)
|
private notificationService = inject(NzNotificationService)
|
||||||
|
|
||||||
users = signal<GetUserDto[]>([]);
|
users = signal<GetUserDto[]>([]);
|
||||||
|
|
||||||
usersLoading = signal<boolean>(false);
|
usersLoading = signal<boolean>(false);
|
||||||
|
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
|||||||
@@ -17,18 +17,13 @@ import { format } from 'date-fns';
|
|||||||
templateUrl: './user.html',
|
templateUrl: './user.html',
|
||||||
styleUrl: './user.css',
|
styleUrl: './user.css',
|
||||||
})
|
})
|
||||||
export class User implements OnInit {
|
export class User {
|
||||||
modal = viewChild.required<Modal>('modal');
|
modal = viewChild.required<Modal>('modal');
|
||||||
createUser = viewChild.required<CreateUser>('createUser');
|
createUser = viewChild.required<CreateUser>('createUser');
|
||||||
usersTable = viewChild.required<UserTable>('userTable');
|
usersTable = viewChild.required<UserTable>('userTable');
|
||||||
|
|
||||||
private usersService = inject(UsersService);
|
private usersService = inject(UsersService);
|
||||||
private notificationService = inject(NzNotificationService)
|
private notificationService = inject(NzNotificationService)
|
||||||
|
|
||||||
async ngOnInit() {
|
|
||||||
await this.addUser();
|
|
||||||
}
|
|
||||||
|
|
||||||
async onModalOk() {
|
async onModalOk() {
|
||||||
await this.addUser()
|
await this.addUser()
|
||||||
this.createUser().createUserForm.reset();
|
this.createUser().createUserForm.reset();
|
||||||
@@ -43,7 +38,10 @@ export class User implements OnInit {
|
|||||||
async addUser() {
|
async addUser() {
|
||||||
if (this.createUser().createUserForm.invalid)
|
if (this.createUser().createUserForm.invalid)
|
||||||
{
|
{
|
||||||
return
|
this.notificationService.error(
|
||||||
|
'Erreur',
|
||||||
|
'Erreur d\'écriture dans le formulaire'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const rawDate = this.createUser().createUserForm.get('birthDate')?.value;
|
const rawDate = this.createUser().createUserForm.get('birthDate')?.value;
|
||||||
|
|||||||
Reference in New Issue
Block a user