From ca8b9518a307d99e149f80fde2d1b1525f003d36 Mon Sep 17 00:00:00 2001 From: rmroot Date: Tue, 19 Nov 2024 08:29:58 -0600 Subject: [PATCH 1/2] fix typo on warning modal --- .../company-contacts-setup.component.ts | 4 ++-- .../pre-visit/facility-setup/facility-setup.component.ts | 4 ++-- .../company-contacts-form/company-contacts-form.component.ts | 4 ++-- .../facility-settings/facility-settings.component.ts | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/app/setup-wizard/pre-visit/company-contacts-setup/company-contacts-setup.component.ts b/src/app/setup-wizard/pre-visit/company-contacts-setup/company-contacts-setup.component.ts index bf5c7820..89b6c4b9 100644 --- a/src/app/setup-wizard/pre-visit/company-contacts-setup/company-contacts-setup.component.ts +++ b/src/app/setup-wizard/pre-visit/company-contacts-setup/company-contacts-setup.component.ts @@ -53,7 +53,7 @@ export class CompanyContactsSetupComponent implements OnInit, OnDestroy { canDeactivate(): Observable { if (this.hasInvalidContacts) { - this.dislayWarningModal(); + this.displayWarningModal(); return of(false); } return of(true); @@ -99,7 +99,7 @@ export class CompanyContactsSetupComponent implements OnInit, OnDestroy { this.hasInvalidContacts = hasInvalidContacts; } } - dislayWarningModal() { + displayWarningModal() { this.routeGuardWarningModal = true; } closeWarningModal() { diff --git a/src/app/setup-wizard/pre-visit/facility-setup/facility-setup.component.ts b/src/app/setup-wizard/pre-visit/facility-setup/facility-setup.component.ts index 510a64d7..69d49cfe 100644 --- a/src/app/setup-wizard/pre-visit/facility-setup/facility-setup.component.ts +++ b/src/app/setup-wizard/pre-visit/facility-setup/facility-setup.component.ts @@ -67,13 +67,13 @@ export class FacilitySetupComponent implements OnInit { canDeactivate(): Observable { if (this.name && this.name.getError('required')) { this.name.markAsTouched(); - this.dislayWarningModal(); + this.displayWarningModal(); return of(false); } return of(true); } - dislayWarningModal() { + displayWarningModal() { this.routeGuardWarningModal = true; } closeWarningModal() { diff --git a/src/app/shared/shared-company-forms/company-contacts-form/company-contacts-form.component.ts b/src/app/shared/shared-company-forms/company-contacts-form/company-contacts-form.component.ts index ec000517..185d5342 100644 --- a/src/app/shared/shared-company-forms/company-contacts-form/company-contacts-form.component.ts +++ b/src/app/shared/shared-company-forms/company-contacts-form/company-contacts-form.component.ts @@ -82,13 +82,13 @@ export class CompanyContactsFormComponent { this.contactForm.controls['lastname'].invalid ) { this.contactForm.markAllAsTouched(); - this.dislayWarningModal(); + this.displayWarningModal(); return of(false); } return of(true); } - dislayWarningModal() { + displayWarningModal() { this.routeGuardWarningModal = true; } diff --git a/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.ts b/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.ts index d7a05051..d55bac2c 100644 --- a/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.ts +++ b/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.ts @@ -58,13 +58,13 @@ export class FacilitySettingsComponent { canDeactivate(): Observable { if (this.name && this.name.getError('required')) { - this.dislayWarningModal(); + this.displayWarningModal(); return of(false); } return of(true); } - dislayWarningModal() { + displayWarningModal() { this.routeGuardWarningModal = true; } closeWarningModal() { From 85f558245c1b086c43de19b77e97599ff3424465 Mon Sep 17 00:00:00 2001 From: rmroot Date: Tue, 19 Nov 2024 08:36:46 -0600 Subject: [PATCH 2/2] update button label on select kpi page --- .../company-kpi-select.component.html | 7 ++++- .../company-kpi-select.component.ts | 27 +++++++++++++------ 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.html b/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.html index 3fbee5e4..3187e4fe 100644 --- a/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.html +++ b/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.html @@ -18,7 +18,12 @@
Go Back diff --git a/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.ts b/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.ts index 120229b3..df5fbe7e 100644 --- a/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.ts +++ b/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.ts @@ -5,6 +5,7 @@ import { IdbOnSiteVisit } from 'src/app/models/onSiteVisit'; import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; import { KeyPerformanceIndicatorsIdbService } from 'src/app/indexed-db/key-performance-indicators-idb.service'; import { IdbKeyPerformanceIndicator } from 'src/app/models/keyPerformanceIndicator'; +import { Subscription } from 'rxjs'; @Component({ selector: 'app-company-kpi-select', @@ -15,12 +16,27 @@ export class CompanyKpiSelectComponent { faChartBar: IconDefinition = faChartBar; faChevronRight: IconDefinition = faChevronRight; faChevronLeft: IconDefinition = faChevronLeft; + + companyKpiSub: Subscription; + companyKpis: Array; + onSiteVisit: IdbOnSiteVisit; constructor(private router: Router, private onSiteVisitIdbService: OnSiteVisitIdbService, private keyPerformanceIndicatorIdbService: KeyPerformanceIndicatorsIdbService, ) { } ngOnInit() { + this.onSiteVisit = this.onSiteVisitIdbService.selectedVisit.getValue(); + this.companyKpiSub = this.keyPerformanceIndicatorIdbService.keyPerformanceIndicators.subscribe(kpis => { + let keyPerformanceIndicators: Array = this.keyPerformanceIndicatorIdbService.keyPerformanceIndicators.getValue(); + this.companyKpis = keyPerformanceIndicators.filter(kpi => { + return kpi.companyId == this.onSiteVisit.companyId + }); + }); + } + + ngOnDestroy(){ + this.companyKpiSub.unsubscribe(); } goBack() { @@ -29,15 +45,10 @@ export class CompanyKpiSelectComponent { } goToKpiDetails() { - let onSiteVisit: IdbOnSiteVisit = this.onSiteVisitIdbService.selectedVisit.getValue(); - let keyPerformanceIndicators: Array = this.keyPerformanceIndicatorIdbService.keyPerformanceIndicators.getValue(); - let companyKpis: Array = keyPerformanceIndicators.filter(kpi => { - return kpi.companyId == onSiteVisit.companyId - }); - if (companyKpis.length > 0) { - this.router.navigateByUrl('setup-wizard/pre-visit/' + onSiteVisit.guid + '/company-kpi-detail/' + companyKpis[0].guid); + if (this.companyKpis.length > 0) { + this.router.navigateByUrl('setup-wizard/pre-visit/' + this.onSiteVisit.guid + '/company-kpi-detail/' + this.companyKpis[0].guid); } else { - this.router.navigateByUrl('setup-wizard/pre-visit/' + onSiteVisit.guid + '/facility-setup'); + this.router.navigateByUrl('setup-wizard/pre-visit/' + this.onSiteVisit.guid + '/facility-setup'); } } }