From 3f7ded5e28c91e90fe5d073a88af925874b5f1a2 Mon Sep 17 00:00:00 2001 From: Eraldo Hasanaj Date: Wed, 11 Mar 2020 15:38:04 +0100 Subject: [PATCH] [HIMA-1145] fixed issue with Anrede dropdown also fixed issue with customer create data was not cleared up when closing process --- .../app/components/process-tab/process-tab.component.ts | 9 +++++++++ .../create-customer-card.component.ts | 2 ++ libs/ui/src/lib/select/select.component.ts | 6 +++++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/apps/sales/src/app/components/process-tab/process-tab.component.ts b/apps/sales/src/app/components/process-tab/process-tab.component.ts index 975ef19c4..28f2d2dcf 100644 --- a/apps/sales/src/app/components/process-tab/process-tab.component.ts +++ b/apps/sales/src/app/components/process-tab/process-tab.component.ts @@ -22,6 +22,8 @@ import { AppSetCurrentProcess } from '../../core/store/actions/app.actions'; import { ProcessSelectors } from '../../core/store/selectors/process.selectors'; import { ModuleSwitcher } from '../../core/models/app-switcher.enum'; import { ViewRef_ } from '@angular/core/src/view'; +import { USER_FORM_STATE_KEY, USER_EXTRAS_FORM_STATE_KEY, USER_ERRORS_FORM_STATE_KEY } from '../../core/utils/app.constants'; +import { DeleteFormState } from '../../core/store/actions/forms.actions'; @Component({ selector: 'app-process-tab', @@ -69,6 +71,7 @@ export class ProcessTabComponent implements OnInit, OnDestroy, AfterViewInit { this.store.dispatch(new Notify(1)); const processes = this.store.selectSnapshot(ProcessSelectors.getProcesses) as Process[]; if (processes) { + this.processDeleteCleanUp(); if (processes.length < 1) { this.router.navigate(['/dashboard']); } else { @@ -173,6 +176,12 @@ export class ProcessTabComponent implements OnInit, OnDestroy, AfterViewInit { this.router.navigate(['/cart/review']); } + private processDeleteCleanUp() { + this.store.dispatch(new DeleteFormState(USER_FORM_STATE_KEY)); + this.store.dispatch(new DeleteFormState(USER_EXTRAS_FORM_STATE_KEY)); + this.store.dispatch(new DeleteFormState(USER_ERRORS_FORM_STATE_KEY)); + } + detectChanges() { setTimeout(() => { if (this.cdr !== null && this.cdr !== undefined && !(this.cdr as ViewRef_).destroyed) { diff --git a/apps/sales/src/app/modules/customer/components/create-customer-card/create-customer-card.component.ts b/apps/sales/src/app/modules/customer/components/create-customer-card/create-customer-card.component.ts index 49a717beb..5abd0e362 100644 --- a/apps/sales/src/app/modules/customer/components/create-customer-card/create-customer-card.component.ts +++ b/apps/sales/src/app/modules/customer/components/create-customer-card/create-customer-card.component.ts @@ -749,10 +749,12 @@ export class CreateCustomerCardComponent implements OnInit, OnDestroy { } genderSelect(gender: string) { + console.log('gender', gender); this.updateDataForSelectedOption('gender', gender, 'Andrede'); } titelSelect(title: string) { + console.log('title', title); this.updateDataForSelectedOption('title', title, 'Titel'); } diff --git a/libs/ui/src/lib/select/select.component.ts b/libs/ui/src/lib/select/select.component.ts index a0999e9b7..02641508d 100644 --- a/libs/ui/src/lib/select/select.component.ts +++ b/libs/ui/src/lib/select/select.component.ts @@ -25,7 +25,11 @@ export class SelectComponent implements OnInit { @Input() set isDirty(value: boolean) { clearInterval(this.timer); this.timer = setTimeout(() => { - this.dirty = value; + if (this.value === this.label) { + this.dirty = false; + } else { + this.dirty = value; + } this.detectChanges(); }, 500); }