diff --git a/src/app/core/models/user.model.ts b/src/app/core/models/user.model.ts index ddb6643..f940feb 100644 --- a/src/app/core/models/user.model.ts +++ b/src/app/core/models/user.model.ts @@ -5,7 +5,8 @@ export class User { firstName: string; lastName: string; - role: UserRole = UserRole.writer; + role = UserRole.writer; createdAt: string; disabled: boolean; + endDate = "9999-12-31"; } diff --git a/src/app/modules/configuration/chatbot-users/user-form/user-form.component.html b/src/app/modules/configuration/chatbot-users/user-form/user-form.component.html index 5ed7818..7290f69 100644 --- a/src/app/modules/configuration/chatbot-users/user-form/user-form.component.html +++ b/src/app/modules/configuration/chatbot-users/user-form/user-form.component.html @@ -2,11 +2,7 @@
Prénom - + Vous n'avez pas saisi de prénom. @@ -17,11 +13,7 @@ Nom - + Vous n'avez pas saisi de nom. @@ -32,11 +24,7 @@ Email - + Vous n'avez pas saisi d'email. @@ -50,27 +38,30 @@ Rôle - + {{ userRole_Fr[role] }} Vous n'avez pas choisi de rôle. + + + Date de fin de validité + + + + + La date de fin de validité est obligatoire. + + +
- -
diff --git a/src/app/modules/configuration/chatbot-users/user-form/user-form.component.ts b/src/app/modules/configuration/chatbot-users/user-form/user-form.component.ts index a7645c2..06a031d 100644 --- a/src/app/modules/configuration/chatbot-users/user-form/user-form.component.ts +++ b/src/app/modules/configuration/chatbot-users/user-form/user-form.component.ts @@ -15,11 +15,11 @@ export class UserFormComponent implements OnInit { userRole = Object.keys(UserRole); userRole_Fr = UserRole_Fr; - @Input() user: User = new User(); + @Input() user = new User(); @Output() cancel: EventEmitter = new EventEmitter(); constructor(private _fb: FormBuilder, - private _userService: UserService) { + private _userService: UserService) { } ngOnInit(): void { @@ -50,8 +50,9 @@ export class UserFormComponent implements OnInit { isNewUser: [!this.user.email], firstName: [this.user.firstName, [Validators.required, Validators.maxLength(50)]], lastName: [this.user.lastName, [Validators.required, Validators.maxLength(50)]], - email: [{value: this.user.email, disabled: !!this.user.email}, [Validators.required, Validators.maxLength(255), Validators.email]], - role: [this.user.role, [Validators.required]] + email: [{ value: this.user.email, disabled: !!this.user.email }, [Validators.required, Validators.maxLength(255), Validators.email]], + role: [this.user.role, [Validators.required]], + endDate: [this.user.endDate, [Validators.required]], }); } diff --git a/src/app/modules/material/material.module.ts b/src/app/modules/material/material.module.ts index ab22f45..578dc3a 100644 --- a/src/app/modules/material/material.module.ts +++ b/src/app/modules/material/material.module.ts @@ -18,7 +18,7 @@ import { MatExpansionModule } from '@angular/material/expansion'; import { MatLegacyAutocompleteModule as MatAutocompleteModule } from '@angular/material/legacy-autocomplete'; import { MatBadgeModule } from '@angular/material/badge'; import { MatLegacyTableModule as MatTableModule } from '@angular/material/legacy-table'; -import { MatMomentDateModule } from '@angular/material-moment-adapter'; +import { MAT_MOMENT_DATE_ADAPTER_OPTIONS, MatMomentDateModule } from '@angular/material-moment-adapter'; import { MatLegacyMenuModule as MatMenuModule } from '@angular/material/legacy-menu'; import { MatLegacySlideToggleModule as MatSlideToggleModule } from '@angular/material/legacy-slide-toggle'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; @@ -30,6 +30,9 @@ import { MatButtonToggleModule } from '@angular/material/button-toggle'; MatTooltipModule, MatDialogModule, MatExpansionModule, MatAutocompleteModule, MatBadgeModule, MatTableModule, MatMenuModule, MatSlideToggleModule, MatButtonToggleModule ], + providers: [ + { provide: MAT_MOMENT_DATE_ADAPTER_OPTIONS, useValue: { useUtc: true } } + ], exports: [ MatFormFieldModule, MatSelectModule, MatInputModule, MatButtonModule, MatIconModule, MatCardModule, MatDividerModule, MatSidenavModule, MatProgressSpinnerModule, MatRadioModule, MatProgressBarModule, MatCheckboxModule, MatDatepickerModule,