Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 1x 1x 1x 1x 1x 2x 2x 2x 2x 2x 2x 1x 1x 1x 1x 4x | import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core'; import { UntypedFormGroup } from '@angular/forms'; import { Observable } from 'rxjs'; import { HttpError } from 'ish-core/models/http-error/http-error.model'; import { markAsDirtyRecursive } from 'ish-shared/forms/utils/form-utils'; import { OrganizationManagementFacade } from '../../facades/organization-management.facade'; import { B2bUser } from '../../models/b2b-user/b2b-user.model'; @Component({ selector: 'ish-user-edit-profile-page', templateUrl: './user-edit-profile-page.component.html', changeDetection: ChangeDetectionStrategy.OnPush, }) export class UserEditProfilePageComponent implements OnInit { loading$: Observable<boolean>; userError$: Observable<HttpError>; selectedUser$: Observable<B2bUser>; private submitted = false; profileForm = new UntypedFormGroup({}); constructor(private organizationManagementFacade: OrganizationManagementFacade) {} ngOnInit() { this.loading$ = this.organizationManagementFacade.usersLoading$; this.userError$ = this.organizationManagementFacade.usersError$; this.selectedUser$ = this.organizationManagementFacade.selectedUser$; } submitForm(b2bUser: B2bUser) { Iif (this.profileForm.invalid) { this.submitted = true; markAsDirtyRecursive(this.profileForm); return; } const formValue = this.profileForm.value; const user: B2bUser = { ...b2bUser, title: formValue.title, firstName: formValue.firstName, lastName: formValue.lastName, active: formValue.active, phoneHome: formValue.phoneHome, }; this.organizationManagementFacade.updateUser(user); } get formDisabled() { return this.profileForm.invalid && this.submitted; } } |