[HIMA-1145] fixed issue with Anrede dropdown also fixed issue with customer create data was not cleared up when closing process

This commit is contained in:
Eraldo Hasanaj
2020-03-11 15:38:04 +01:00
parent 76fd75b230
commit 3f7ded5e28
3 changed files with 16 additions and 1 deletions

View File

@@ -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) {

View File

@@ -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');
}

View File

@@ -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);
}