From 8f2152dfda8e21d64879e5ea16eec7ea0fc51417 Mon Sep 17 00:00:00 2001 From: rmroot Date: Thu, 26 Sep 2024 10:07:52 -0500 Subject: [PATCH 01/42] add user portfolio module --- src/app/app-routing.module.ts | 53 ++++++++++-------- src/app/app.module.ts | 4 +- .../user-portfolio.component.css | 15 +++++ .../user-portfolio.component.html | 23 ++++++++ .../user-portfolio.component.spec.ts | 23 ++++++++ .../user-portfolio.component.ts | 56 +++++++++++++++++++ .../user-portfolio/user-portfolio.module.ts | 17 ++++++ 7 files changed, 166 insertions(+), 25 deletions(-) create mode 100644 src/app/user-portfolio/user-portfolio.component.css create mode 100644 src/app/user-portfolio/user-portfolio.component.html create mode 100644 src/app/user-portfolio/user-portfolio.component.spec.ts create mode 100644 src/app/user-portfolio/user-portfolio.component.ts create mode 100644 src/app/user-portfolio/user-portfolio.module.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index aa3fd7e4..20dd1093 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -44,6 +44,7 @@ import { VisitReportComponent } from './setup-wizard/data-evaluation/visit-repor import { AssessmentEvaluationComponent } from './setup-wizard/data-evaluation/assessment-evaluation/assessment-evaluation.component'; import { OnSiteAssessmentResultsComponent } from './setup-wizard/data-collection/on-site-assessment/on-site-assessment-results/on-site-assessment-results.component'; import { FacilityEnergyEquipmentSetupComponent } from './setup-wizard/pre-visit/facility-energy-equipment-setup/facility-energy-equipment-setup.component'; +import { UserPortfolioComponent } from './user-portfolio/user-portfolio.component'; const routes: Routes = [ { @@ -177,31 +178,35 @@ const routes: Routes = [ }, { path: 'user', - component: UserDashboardComponent, - children: [ - { - path: '', - pathMatch: 'full', - redirectTo: 'home' - }, - { - path: 'home', - component: UserDashboardHomeComponent - }, - { - path: 'settings', - component: UserSettingsComponent - }, - { - path: 'help', - component: UserDashboardHelpComponent - }, - { - path: 'nebs-database', - component: ExploreNEBsComponent - } - ] + component: UserPortfolioComponent }, + // { + // path: 'user', + // component: UserDashboardComponent, + // children: [ + // { + // path: '', + // pathMatch: 'full', + // redirectTo: 'home' + // }, + // { + // path: 'home', + // component: UserDashboardHomeComponent + // }, + // { + // path: 'settings', + // component: UserSettingsComponent + // }, + // { + // path: 'help', + // component: UserDashboardHelpComponent + // }, + // { + // path: 'nebs-database', + // component: ExploreNEBsComponent + // } + // ] + // }, { path: 'company/:id', component: CompanyDashboardComponent, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 3e8a9ae6..0fbe9c3f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -20,6 +20,7 @@ import { HelperPipesModule } from './shared/helper-pipes/helper-pipes.module'; import { AssessmentDashboardModule } from './assessment-dashboard/assessment-dashboard.module'; import { SetupWizardModalComponent } from './core-components/setup-wizard-modal/setup-wizard-modal.component'; import { ImportBackupModalComponent } from './core-components/import-backup-modal/import-backup-modal.component'; +import { UserPortfolioModule } from './user-portfolio/user-portfolio.module'; @NgModule({ declarations: [ @@ -44,7 +45,8 @@ import { ImportBackupModalComponent } from './core-components/import-backup-moda FormsModule, SetupWizardModule, HelperPipesModule, - AssessmentDashboardModule + AssessmentDashboardModule, + UserPortfolioModule ], providers: [], bootstrap: [AppComponent] diff --git a/src/app/user-portfolio/user-portfolio.component.css b/src/app/user-portfolio/user-portfolio.component.css new file mode 100644 index 00000000..50012c89 --- /dev/null +++ b/src/app/user-portfolio/user-portfolio.component.css @@ -0,0 +1,15 @@ +.card{ + border-radius: 0; +} + +.card-title{ + font-size: 26px; +} + +.card-title.secondary{ + font-size: 20px; +} + +.card-text{ + font-size: 14px; +} \ No newline at end of file diff --git a/src/app/user-portfolio/user-portfolio.component.html b/src/app/user-portfolio/user-portfolio.component.html new file mode 100644 index 00000000..6adfdb35 --- /dev/null +++ b/src/app/user-portfolio/user-portfolio.component.html @@ -0,0 +1,23 @@ +
+
+
+
+
+
+ + JUSTIFI Portfolio +
+

+ Use this tool to identify and estimate potential non-energy benefits (NEBs) that can be + found while conducting the energy assessments. +

+
+
+
+
+
+
+ +
+
+
diff --git a/src/app/user-portfolio/user-portfolio.component.spec.ts b/src/app/user-portfolio/user-portfolio.component.spec.ts new file mode 100644 index 00000000..58f8a1f7 --- /dev/null +++ b/src/app/user-portfolio/user-portfolio.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserPortfolioComponent } from './user-portfolio.component'; + +describe('UserPortfolioComponent', () => { + let component: UserPortfolioComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [UserPortfolioComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(UserPortfolioComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/user-portfolio.component.ts b/src/app/user-portfolio/user-portfolio.component.ts new file mode 100644 index 00000000..fdf8f7a5 --- /dev/null +++ b/src/app/user-portfolio/user-portfolio.component.ts @@ -0,0 +1,56 @@ +import { Component } from '@angular/core'; +import { faFolderOpen, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { IdbOnSiteVisit } from '../models/onSiteVisit'; +import { Subscription } from 'rxjs'; +import { IdbFacility } from '../models/facility'; +import { IdbCompany } from '../models/company'; +import { OnSiteVisitIdbService } from '../indexed-db/on-site-visit-idb.service'; +import { FacilityIdbService } from '../indexed-db/facility-idb.service'; +import { CompanyIdbService } from '../indexed-db/company-idb.service'; + +@Component({ + selector: 'app-user-portfolio', + templateUrl: './user-portfolio.component.html', + styleUrl: './user-portfolio.component.css' +}) +export class UserPortfolioComponent { + + faFolderOpen: IconDefinition = faFolderOpen; + + + onSiteVisits: Array; + onSiteVisitSub: Subscription; + + facilities: Array; + facilitiesSub: Subscription; + + companies: Array; + companiesSub: Subscription; + constructor( + private onSiteVisitIdbService: OnSiteVisitIdbService, + private facilityIdbService: FacilityIdbService, + private companyIdbService: CompanyIdbService + ) { + + } + + ngOnInit() { + this.onSiteVisitSub = this.onSiteVisitIdbService.onSiteVisits.subscribe(visits => { + this.onSiteVisits = visits; + }); + + this.facilitiesSub = this.facilityIdbService.facilities.subscribe(facilities => { + this.facilities = facilities; + }); + + this.companiesSub = this.companyIdbService.companies.subscribe(companies => { + this.companies = companies; + }) + } + + ngOnDestroy(){ + this.onSiteVisitSub.unsubscribe(); + this.facilitiesSub.unsubscribe(); + this.companiesSub.unsubscribe(); + } +} diff --git a/src/app/user-portfolio/user-portfolio.module.ts b/src/app/user-portfolio/user-portfolio.module.ts new file mode 100644 index 00000000..961c90d6 --- /dev/null +++ b/src/app/user-portfolio/user-portfolio.module.ts @@ -0,0 +1,17 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { UserPortfolioComponent } from './user-portfolio.component'; +import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; + + + +@NgModule({ + declarations: [ + UserPortfolioComponent + ], + imports: [ + CommonModule, + FontAwesomeModule + ] +}) +export class UserPortfolioModule { } From 8ab5563913f8c5feeb3498a042aa522f8cfd374b Mon Sep 17 00:00:00 2001 From: rmroot Date: Thu, 26 Sep 2024 10:59:43 -0500 Subject: [PATCH 02/42] start adding portfolio content --- angular.json | 3 +- .../welcome/welcome.component.css | 32 --------- .../welcome/welcome.component.html | 2 +- .../latest-visits-table.component.css | 0 .../latest-visits-table.component.html | 62 ++++++++++++++++ .../latest-visits-table.component.spec.ts | 23 ++++++ .../latest-visits-table.component.ts | 70 +++++++++++++++++++ .../portfolio-summary-card.component.css | 0 .../portfolio-summary-card.component.html | 63 +++++++++++++++++ .../portfolio-summary-card.component.spec.ts | 23 ++++++ .../portfolio-summary-card.component.ts | 66 +++++++++++++++++ .../user-portfolio.component.html | 10 +-- .../user-portfolio.component.ts | 2 +- .../user-portfolio/user-portfolio.module.ts | 12 ++-- src/assets/styles/dashboards.css | 24 +++++++ 15 files changed, 349 insertions(+), 43 deletions(-) create mode 100644 src/app/user-portfolio/latest-visits-table/latest-visits-table.component.css create mode 100644 src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html create mode 100644 src/app/user-portfolio/latest-visits-table/latest-visits-table.component.spec.ts create mode 100644 src/app/user-portfolio/latest-visits-table/latest-visits-table.component.ts create mode 100644 src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.css create mode 100644 src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.html create mode 100644 src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.spec.ts create mode 100644 src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.ts create mode 100644 src/assets/styles/dashboards.css diff --git a/angular.json b/angular.json index 6eec2ad9..c6184a72 100644 --- a/angular.json +++ b/angular.json @@ -38,7 +38,8 @@ "src/assets/styles/forms.css", "src/assets/styles/sidebar.css", "src/assets/styles/report.css", - "src/assets/styles/helpText.css" + "src/assets/styles/helpText.css", + "src/assets/styles/dashboards.css" ], "scripts": [ "node_modules/bootstrap/dist/js/bootstrap.bundle.js" diff --git a/src/app/core-components/welcome/welcome.component.css b/src/app/core-components/welcome/welcome.component.css index d35d9da9..5eb4d451 100644 --- a/src/app/core-components/welcome/welcome.component.css +++ b/src/app/core-components/welcome/welcome.component.css @@ -1,35 +1,3 @@ -.card{ - border-radius: 0; -} - -.card-title{ - font-size: 26px; -} - -.card-title.secondary{ - font-size: 20px; -} - -.card-text{ - font-size: 14px; -} - -th.actions, td.actions{ - width: 15px; -} - -table th, table td{ - padding: .2rem; - vertical-align: middle; -} - -.align-btn-end{ - text-align: end; -} - -/* .nav-link{ - padding-left: .5em; -} */ .nav-link.facility-link{ padding-left: 2rem; diff --git a/src/app/core-components/welcome/welcome.component.html b/src/app/core-components/welcome/welcome.component.html index 19c0fdee..99b20922 100644 --- a/src/app/core-components/welcome/welcome.component.html +++ b/src/app/core-components/welcome/welcome.component.html @@ -1,4 +1,4 @@ -
+
diff --git a/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.css b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.css new file mode 100644 index 00000000..e69de29b diff --git a/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html new file mode 100644 index 00000000..70d50faa --- /dev/null +++ b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html @@ -0,0 +1,62 @@ +
+
+
+
+ + On-Site Visits +
+
+ +
+
+

+ Below is a list of the on-site visits conducted in JUSTIFI so you can jump back in. + Just click the "" button. +

+ + + + + + + + + + + + + + + + + + +
+ Facility + + Visit Date + + Last Modified + + +
+ {{visit.facilityId | facilityName: facilities}} + + {{visit.visitDate | date}} + + {{visit.modifiedDate | date}} + + +
+
+ +
+ No visits found. Use the setup wizard to add your first on site visit. +
+
+
+
\ No newline at end of file diff --git a/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.spec.ts b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.spec.ts new file mode 100644 index 00000000..a65d5a19 --- /dev/null +++ b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { LatestVisitsTableComponent } from './latest-visits-table.component'; + +describe('LatestVisitsTableComponent', () => { + let component: LatestVisitsTableComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [LatestVisitsTableComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(LatestVisitsTableComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.ts b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.ts new file mode 100644 index 00000000..4280e775 --- /dev/null +++ b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.ts @@ -0,0 +1,70 @@ +import { Component } from '@angular/core'; +import { faStopwatch, faWandMagicSparkles, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Subscription } from 'rxjs'; +import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; +import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; +import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; +import { IdbCompany } from 'src/app/models/company'; +import { IdbFacility } from 'src/app/models/facility'; +import { IdbOnSiteVisit } from 'src/app/models/onSiteVisit'; +import { SharedDataService } from 'src/app/shared/shared-services/shared-data.service'; + +@Component({ + selector: 'app-latest-visits-table', + templateUrl: './latest-visits-table.component.html', + styleUrl: './latest-visits-table.component.css' +}) +export class LatestVisitsTableComponent { + + faWandMagicSparkles: IconDefinition = faWandMagicSparkles; + faStopwatch: IconDefinition = faStopwatch; + + onSiteVisits: Array; + onSiteVisitSub: Subscription; + + facilities: Array; + facilitiesSub: Subscription; + + companies: Array; + companiesSub: Subscription; + constructor( + private onSiteVisitIdbService: OnSiteVisitIdbService, + private facilityIdbService: FacilityIdbService, + private companyIdbService: CompanyIdbService, + private sharedDataService: SharedDataService + ) { + + } + + ngOnInit() { + this.onSiteVisitSub = this.onSiteVisitIdbService.onSiteVisits.subscribe(visits => { + this.onSiteVisits = visits; + }); + + this.facilitiesSub = this.facilityIdbService.facilities.subscribe(facilities => { + this.facilities = facilities; + }); + + this.companiesSub = this.companyIdbService.companies.subscribe(companies => { + this.companies = companies; + }) + } + + ngOnDestroy(){ + this.onSiteVisitSub.unsubscribe(); + this.facilitiesSub.unsubscribe(); + this.companiesSub.unsubscribe(); + } + + + goToVisit(visit: IdbOnSiteVisit) { + this.companyIdbService.setSelectedFromGUID(visit.companyId); + this.facilityIdbService.setSelectedFromGUID(visit.facilityId); + this.onSiteVisitIdbService.setSelectedFromAssessmentGUID(visit.assessmentIds[0]); + this.sharedDataService.createAssessmentModalOpen.next(true); + } + + openWizardModal() { + this.sharedDataService.createAssessmentModalOpen.next(true); + } +} diff --git a/src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.css b/src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.css new file mode 100644 index 00000000..e69de29b diff --git a/src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.html b/src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.html new file mode 100644 index 00000000..1de2078e --- /dev/null +++ b/src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.html @@ -0,0 +1,63 @@ +
+
+
+ + Portfolio Summary +
+ +
+
+
+ Companies +
+
+ + {{companies.length}} + +
+
+
+
+ Facilities +
+
+ + {{companies.length}} + +
+
+
+
+ On-site Visits +
+
+ + {{companies.length}} + +
+
+
+
+ Assessments +
+
+ + {{companies.length}} + +
+
+
+
+ NEBs +
+
+ + {{companies.length}} + +
+
+
+
+
\ No newline at end of file diff --git a/src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.spec.ts b/src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.spec.ts new file mode 100644 index 00000000..c9a0a4e3 --- /dev/null +++ b/src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PortfolioSummaryCardComponent } from './portfolio-summary-card.component'; + +describe('PortfolioSummaryCardComponent', () => { + let component: PortfolioSummaryCardComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [PortfolioSummaryCardComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(PortfolioSummaryCardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.ts b/src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.ts new file mode 100644 index 00000000..48e19d3f --- /dev/null +++ b/src/app/user-portfolio/portfolio-summary-card/portfolio-summary-card.component.ts @@ -0,0 +1,66 @@ +import { Component } from '@angular/core'; +import { faList, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Subscription } from 'rxjs'; +import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; +import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; +import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; +import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; +import { IdbAssessment } from 'src/app/models/assessment'; +import { IdbCompany } from 'src/app/models/company'; +import { IdbFacility } from 'src/app/models/facility'; +import { IdbOnSiteVisit } from 'src/app/models/onSiteVisit'; + +@Component({ + selector: 'app-portfolio-summary-card', + templateUrl: './portfolio-summary-card.component.html', + styleUrl: './portfolio-summary-card.component.css' +}) +export class PortfolioSummaryCardComponent { + + faList: IconDefinition = faList; + + onSiteVisits: Array; + onSiteVisitSub: Subscription; + + facilities: Array; + facilitiesSub: Subscription; + + companies: Array; + companiesSub: Subscription; + + assessments: Array; + assessmentsSub: Subscription; + constructor( + private onSiteVisitIdbService: OnSiteVisitIdbService, + private facilityIdbService: FacilityIdbService, + private companyIdbService: CompanyIdbService, + private assessmentIdbService: AssessmentIdbService + ) { + + } + + ngOnInit() { + this.onSiteVisitSub = this.onSiteVisitIdbService.onSiteVisits.subscribe(visits => { + this.onSiteVisits = visits; + }); + + this.facilitiesSub = this.facilityIdbService.facilities.subscribe(facilities => { + this.facilities = facilities; + }); + + this.companiesSub = this.companyIdbService.companies.subscribe(companies => { + this.companies = companies; + }); + + this.assessmentsSub = this.assessmentIdbService.assessments.subscribe(assessments => { + this.assessments = assessments; + }); + } + + ngOnDestroy(){ + this.onSiteVisitSub.unsubscribe(); + this.facilitiesSub.unsubscribe(); + this.companiesSub.unsubscribe(); + this.assessmentsSub.unsubscribe(); + } +} diff --git a/src/app/user-portfolio/user-portfolio.component.html b/src/app/user-portfolio/user-portfolio.component.html index 6adfdb35..780ddd84 100644 --- a/src/app/user-portfolio/user-portfolio.component.html +++ b/src/app/user-portfolio/user-portfolio.component.html @@ -1,6 +1,6 @@ -
+
-
+
@@ -15,9 +15,11 @@

-
- + +
+
+
diff --git a/src/app/user-portfolio/user-portfolio.component.ts b/src/app/user-portfolio/user-portfolio.component.ts index fdf8f7a5..5e4b71bd 100644 --- a/src/app/user-portfolio/user-portfolio.component.ts +++ b/src/app/user-portfolio/user-portfolio.component.ts @@ -45,7 +45,7 @@ export class UserPortfolioComponent { this.companiesSub = this.companyIdbService.companies.subscribe(companies => { this.companies = companies; - }) + }); } ngOnDestroy(){ diff --git a/src/app/user-portfolio/user-portfolio.module.ts b/src/app/user-portfolio/user-portfolio.module.ts index 961c90d6..588b5417 100644 --- a/src/app/user-portfolio/user-portfolio.module.ts +++ b/src/app/user-portfolio/user-portfolio.module.ts @@ -2,16 +2,20 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { UserPortfolioComponent } from './user-portfolio.component'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; - - +import { LatestVisitsTableComponent } from './latest-visits-table/latest-visits-table.component'; +import { HelperPipesModule } from '../shared/helper-pipes/helper-pipes.module'; +import { PortfolioSummaryCardComponent } from './portfolio-summary-card/portfolio-summary-card.component'; @NgModule({ declarations: [ - UserPortfolioComponent + UserPortfolioComponent, + LatestVisitsTableComponent, + PortfolioSummaryCardComponent ], imports: [ CommonModule, - FontAwesomeModule + FontAwesomeModule, + HelperPipesModule ] }) export class UserPortfolioModule { } diff --git a/src/assets/styles/dashboards.css b/src/assets/styles/dashboards.css new file mode 100644 index 00000000..7063a9fb --- /dev/null +++ b/src/assets/styles/dashboards.css @@ -0,0 +1,24 @@ +.dashboard .card{ + border-radius: 0; +} + +.dashboard .card-title{ + font-size: 26px; +} + +.dashboard .card-title.secondary{ + font-size: 20px; +} + +.dashboard .card-text{ + font-size: 14px; +} + +.dashboard th.actions,.dashboard td.actions{ + width: 15px; +} + +.dashboard table th,.dashboard table td{ + padding: .2rem; + vertical-align: middle; +} From 5dfa91337b5b14dbafc0fd3e45a6a9b57764add3 Mon Sep 17 00:00:00 2001 From: rmroot Date: Thu, 3 Oct 2024 14:42:53 -0500 Subject: [PATCH 03/42] updates --- .../latest-visits-table.component.html | 14 ++++++++++++++ .../user-portfolio/user-portfolio.component.html | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html index 70d50faa..6f152c47 100644 --- a/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html +++ b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html @@ -19,9 +19,15 @@ + + @@ -35,9 +41,17 @@ + + diff --git a/src/app/user-portfolio/user-portfolio.component.html b/src/app/user-portfolio/user-portfolio.component.html index 780ddd84..9239acf4 100644 --- a/src/app/user-portfolio/user-portfolio.component.html +++ b/src/app/user-portfolio/user-portfolio.component.html @@ -8,8 +8,7 @@ JUSTIFI Portfolio

- Use this tool to identify and estimate potential non-energy benefits (NEBs) that can be - found while conducting the energy assessments. + View a summary of the data in your system.

From 2bf121819ef7191aee07eb60b5f7d00eb081beac Mon Sep 17 00:00:00 2001 From: rmroot Date: Wed, 6 Nov 2024 11:34:26 -0600 Subject: [PATCH 04/42] added company, facility and assessment accordion lists to portfolio --- .../assessment-list-item.component.css | 3 + .../assessment-list-item.component.html | 87 +++++++++++++++++++ .../assessment-list-item.component.spec.ts | 23 +++++ .../assessment-list-item.component.ts | 49 +++++++++++ .../company-list-item.component.css | 4 + .../company-list-item.component.html | 43 +++++++++ .../company-list-item.component.spec.ts | 23 +++++ .../company-list-item.component.ts | 58 +++++++++++++ .../facility-list-item.component.css | 3 + .../facility-list-item.component.html | 51 +++++++++++ .../facility-list-item.component.spec.ts | 23 +++++ .../facility-list-item.component.ts | 62 +++++++++++++ .../portfolio-items-list.component.css | 5 ++ .../portfolio-items-list.component.html | 28 ++++++ .../portfolio-items-list.component.spec.ts | 23 +++++ .../portfolio-items-list.component.ts | 44 ++++++++++ .../user-portfolio.component.html | 4 + .../user-portfolio/user-portfolio.module.ts | 10 ++- src/assets/styles/accordion.css | 12 +++ src/assets/styles/dashboards.css | 9 ++ src/styles.css | 3 + 21 files changed, 566 insertions(+), 1 deletion(-) create mode 100644 src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.css create mode 100644 src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.html create mode 100644 src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.spec.ts create mode 100644 src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.ts create mode 100644 src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.css create mode 100644 src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.html create mode 100644 src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.spec.ts create mode 100644 src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.ts create mode 100644 src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.css create mode 100644 src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.html create mode 100644 src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.spec.ts create mode 100644 src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.ts create mode 100644 src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.css create mode 100644 src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html create mode 100644 src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.spec.ts create mode 100644 src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts diff --git a/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.css b/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.css new file mode 100644 index 00000000..8d89b424 --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.css @@ -0,0 +1,3 @@ +th{ + width: 30%; +} \ No newline at end of file diff --git a/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.html b/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.html new file mode 100644 index 00000000..b71afacc --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.html @@ -0,0 +1,87 @@ +
+
+ + + +
+
+
+ +
+ Company + Facility + Assessments + Visit Date
+ {{visit.companyId | companyName: companies}} + {{visit.facilityId | facilityName: facilities}} + + {{visit.assessmentIds.length}} + + {{visit.visitDate | date}}
+ + + + + + + + + + + + + + + + + + + + + + +
+ Assessment Type + + {{assessment.assessmentType}} +
+ Visit Date + + {{assessment.visitDate | date}} +
+ Utility Usage + + + + {{utilityType.utilityType}}: {{utilityType.energyUse | number}}
+
+
+
+ Annual Costs + + + {{assessment.cost | currency}} + + + — + +
+ Energy Opportunities + + + + {{opportunity.name}}
+
+
+ + — + +
\ No newline at end of file diff --git a/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.spec.ts b/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.spec.ts new file mode 100644 index 00000000..86d0cf7b --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AssessmentListItemComponent } from './assessment-list-item.component'; + +describe('AssessmentListItemComponent', () => { + let component: AssessmentListItemComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [AssessmentListItemComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(AssessmentListItemComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.ts b/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.ts new file mode 100644 index 00000000..d6e73369 --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.ts @@ -0,0 +1,49 @@ +import { Component, Input } from '@angular/core'; +import { faExpand, faTrash, faWandMagicSparkles, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Subscription } from 'rxjs'; +import { EnergyOpportunityIdbService } from 'src/app/indexed-db/energy-opportunity-idb.service'; +import { IdbAssessment } from 'src/app/models/assessment'; +import { IdbEnergyOpportunity } from 'src/app/models/energyOpportunity'; + +@Component({ + selector: 'app-assessment-list-item', + templateUrl: './assessment-list-item.component.html', + styleUrl: './assessment-list-item.component.css' +}) +export class AssessmentListItemComponent { + @Input({ required: true }) + assessment: IdbAssessment; + + faExpand: IconDefinition = faExpand; + faTrash: IconDefinition = faTrash; + faWandMagicSparkles: IconDefinition = faWandMagicSparkles; + + energyOpportunitiesSub: Subscription; + energyOpportunities: Array; + constructor(private energyOpportunityIdbService: EnergyOpportunityIdbService) { + } + + ngOnInit() { + this.energyOpportunitiesSub = this.energyOpportunityIdbService.energyOpportunities.subscribe(opportunities => { + this.energyOpportunities = opportunities.filter(opp => { + return opp.assessmentId == this.assessment.guid + }); + }); + } + + ngOnDestroy() { + this.energyOpportunitiesSub.unsubscribe(); + } + + goToAssessmentDashboard() { + + } + + openDeleteAssessmentModal() { + + } + + goToVisit() { + + } +} diff --git a/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.css b/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.css new file mode 100644 index 00000000..2a61c196 --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.css @@ -0,0 +1,4 @@ +.accordion-item.facility-item .accordion-button:not(.collapsed), .accordion-body{ + border-left: solid var(--facility-color) 5px; +} + diff --git a/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.html b/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.html new file mode 100644 index 00000000..defacc16 --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.html @@ -0,0 +1,43 @@ +
+
+ {{company.generalInformation | addressDisplay}} +
+
+ + +
+
+
+ +
+
+

+ +

+
+
+ +
+
+
+
\ No newline at end of file diff --git a/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.spec.ts b/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.spec.ts new file mode 100644 index 00000000..7ca35c5a --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CompanyListItemComponent } from './company-list-item.component'; + +describe('CompanyListItemComponent', () => { + let component: CompanyListItemComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [CompanyListItemComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(CompanyListItemComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.ts b/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.ts new file mode 100644 index 00000000..00328f8e --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.ts @@ -0,0 +1,58 @@ +import { Component, Input } from '@angular/core'; +import { faExpand, faIndustry, faTrash, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Subscription } from 'rxjs'; +import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; +import { IdbCompany } from 'src/app/models/company'; +import { IdbFacility } from 'src/app/models/facility'; +import { BootstrapService } from 'src/app/shared/shared-services/bootstrap.service'; + +@Component({ + selector: 'app-company-list-item', + templateUrl: './company-list-item.component.html', + styleUrl: './company-list-item.component.css' +}) +export class CompanyListItemComponent { + @Input({ required: true }) + company: IdbCompany; + + faIndustry: IconDefinition = faIndustry; + faTrash: IconDefinition = faTrash; + faExpand: IconDefinition = faExpand; + + facilities: Array; + facilitiesSub: Subscription; + accordionGuid: string; + constructor(private facilityIdbService: FacilityIdbService, + private bootstrapService: BootstrapService + ) { + + } + + ngOnInit() { + this.facilitiesSub = this.facilityIdbService.facilities.subscribe(facilities => { + this.facilities = facilities.filter(facility => { return facility.companyId == this.company.guid }); + }); + } + + ngOnDestroy() { + this.facilitiesSub.unsubscribe(); + } + + toggleBS(companyGuid: string) { + this.bootstrapService.bsCollapse('#' + companyGuid); + if (this.accordionGuid != companyGuid) { + this.accordionGuid = companyGuid; + } else { + this.accordionGuid = undefined; + } + // this.localStorageDataService.setNebAccordionGuid(this.accordionGuid); + } + + goToCompanyDashboard() { + + } + + openDeleteCompanyModal() { + + } +} diff --git a/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.css b/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.css new file mode 100644 index 00000000..0489aff0 --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.css @@ -0,0 +1,3 @@ +.accordion-item.assessment-item .accordion-button:not(.collapsed), .accordion-body{ + border-left: solid var(--assessment-color) 5px; +} \ No newline at end of file diff --git a/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.html b/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.html new file mode 100644 index 00000000..e1694a0e --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.html @@ -0,0 +1,51 @@ +
+
+ {{facility.generalInformation | addressDisplay}} +
+
+ + +
+
+
+ + +
+
+

+ +

+
+
+ +
+
+
+
+
+ +
+ No assessments found for this facility. +
+
\ No newline at end of file diff --git a/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.spec.ts b/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.spec.ts new file mode 100644 index 00000000..467782f3 --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FacilityListItemComponent } from './facility-list-item.component'; + +describe('FacilityListItemComponent', () => { + let component: FacilityListItemComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [FacilityListItemComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(FacilityListItemComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.ts b/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.ts new file mode 100644 index 00000000..41320b39 --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.ts @@ -0,0 +1,62 @@ +import { Component, Input } from '@angular/core'; +import { faExpand, faFileLines, faTrash, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Subscription } from 'rxjs'; +import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; +import { IdbAssessment } from 'src/app/models/assessment'; +import { IdbFacility } from 'src/app/models/facility'; +import { BootstrapService } from 'src/app/shared/shared-services/bootstrap.service'; + +@Component({ + selector: 'app-facility-list-item', + templateUrl: './facility-list-item.component.html', + styleUrl: './facility-list-item.component.css' +}) +export class FacilityListItemComponent { + @Input({ required: true }) + facility: IdbFacility; + + + faTrash: IconDefinition = faTrash; + faFileLines: IconDefinition = faFileLines; + faExpand: IconDefinition = faExpand; + + assessments: Array; + assessmentsSub: Subscription; + accordionGuid: string; + constructor(private assessmentIdbService: AssessmentIdbService, + private bootstrapService: BootstrapService + ) { + + } + + ngOnInit() { + this.assessmentsSub = this.assessmentIdbService.assessments.subscribe(assessments => { + this.assessments = assessments.filter(assessment => { + return assessment.facilityId == this.facility.guid; + }) + }); + } + + ngOnDestroy() { + this.assessmentsSub.unsubscribe(); + } + + toggleBS(assessmentGuid: string) { + this.bootstrapService.bsCollapse('#' + assessmentGuid); + if (this.accordionGuid != assessmentGuid) { + this.accordionGuid = assessmentGuid; + } else { + this.accordionGuid = undefined; + } + // this.localStorageDataService.setNebAccordionGuid(this.accordionGuid); + } + + + goToFacilityDashboard() { + + } + + openDeleteFacilityModal() { + + } +} diff --git a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.css b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.css new file mode 100644 index 00000000..bb7eeeef --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.css @@ -0,0 +1,5 @@ + + +.accordion-item.company-item .accordion-button:not(.collapsed), .accordion-body{ + border-left: solid var(--company-color) 5px; +} \ No newline at end of file diff --git a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html new file mode 100644 index 00000000..38cf0189 --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html @@ -0,0 +1,28 @@ +
+
+
+
+ + All Portfolio Content +
+
+
+
+

+ +

+
+
+ +
+
+
+
+
+
\ No newline at end of file diff --git a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.spec.ts b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.spec.ts new file mode 100644 index 00000000..02f82a5f --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PortfolioItemsListComponent } from './portfolio-items-list.component'; + +describe('PortfolioItemsListComponent', () => { + let component: PortfolioItemsListComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [PortfolioItemsListComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(PortfolioItemsListComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts new file mode 100644 index 00000000..c834a928 --- /dev/null +++ b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts @@ -0,0 +1,44 @@ +import { Component } from '@angular/core'; +import { faBuilding, faFolderTree, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Subscription } from 'rxjs'; +import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; +import { IdbCompany } from 'src/app/models/company'; +import { BootstrapService } from 'src/app/shared/shared-services/bootstrap.service'; + +@Component({ + selector: 'app-portfolio-items-list', + templateUrl: './portfolio-items-list.component.html', + styleUrl: './portfolio-items-list.component.css' +}) +export class PortfolioItemsListComponent { + + faFolderTree: IconDefinition = faFolderTree; + faBuilding: IconDefinition = faBuilding; + + companies: Array + companiesSub: Subscription + accordionGuid: string; + constructor(private companyIdbService: CompanyIdbService, + private bootstrapService: BootstrapService + ) { } + + ngOnInit() { + this.companiesSub = this.companyIdbService.companies.subscribe(companies => { + this.companies = companies; + }); + } + + ngOnDestroy() { + this.companiesSub.unsubscribe(); + } + + toggleBS(companyGuid: string) { + this.bootstrapService.bsCollapse('#' + companyGuid); + if (this.accordionGuid != companyGuid) { + this.accordionGuid = companyGuid; + } else { + this.accordionGuid = undefined; + } + // this.localStorageDataService.setNebAccordionGuid(this.accordionGuid); + } +} diff --git a/src/app/user-portfolio/user-portfolio.component.html b/src/app/user-portfolio/user-portfolio.component.html index 9239acf4..4b5b1ad5 100644 --- a/src/app/user-portfolio/user-portfolio.component.html +++ b/src/app/user-portfolio/user-portfolio.component.html @@ -20,5 +20,9 @@
+
+
+ +
diff --git a/src/app/user-portfolio/user-portfolio.module.ts b/src/app/user-portfolio/user-portfolio.module.ts index 588b5417..86334c6b 100644 --- a/src/app/user-portfolio/user-portfolio.module.ts +++ b/src/app/user-portfolio/user-portfolio.module.ts @@ -5,12 +5,20 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { LatestVisitsTableComponent } from './latest-visits-table/latest-visits-table.component'; import { HelperPipesModule } from '../shared/helper-pipes/helper-pipes.module'; import { PortfolioSummaryCardComponent } from './portfolio-summary-card/portfolio-summary-card.component'; +import { PortfolioItemsListComponent } from './portfolio-items-list/portfolio-items-list.component'; +import { CompanyListItemComponent } from './portfolio-items-list/company-list-item/company-list-item.component'; +import { FacilityListItemComponent } from './portfolio-items-list/facility-list-item/facility-list-item.component'; +import { AssessmentListItemComponent } from './portfolio-items-list/assessment-list-item/assessment-list-item.component'; @NgModule({ declarations: [ UserPortfolioComponent, LatestVisitsTableComponent, - PortfolioSummaryCardComponent + PortfolioSummaryCardComponent, + PortfolioItemsListComponent, + CompanyListItemComponent, + FacilityListItemComponent, + AssessmentListItemComponent ], imports: [ CommonModule, diff --git a/src/assets/styles/accordion.css b/src/assets/styles/accordion.css index 6597ca17..931b78b7 100644 --- a/src/assets/styles/accordion.css +++ b/src/assets/styles/accordion.css @@ -17,4 +17,16 @@ .accordion-button{ padding: .25rem; +} + +.portfolio .accordion .accordion-button{ + font-size: 18px; +} + +.accordion-button, .accordion-item:first-of-type>.accordion-header .accordion-button, .accordion-item:last-of-type>.accordion-header .accordion-button.collapsed { + border-radius: 0; + padding-top: .25rem; + padding-bottom: .25rem; + padding-left: .5rem; + padding-right: .5rem; } \ No newline at end of file diff --git a/src/assets/styles/dashboards.css b/src/assets/styles/dashboards.css index 7063a9fb..a418e561 100644 --- a/src/assets/styles/dashboards.css +++ b/src/assets/styles/dashboards.css @@ -22,3 +22,12 @@ padding: .2rem; vertical-align: middle; } + + +.container-fluid.dashboard{ + margin-bottom: 1rem; +} + +.portfolio .btn:hover .d-none{ + display: inline !important; +} \ No newline at end of file diff --git a/src/styles.css b/src/styles.css index 9fb01ac9..1be6c7e5 100644 --- a/src/styles.css +++ b/src/styles.css @@ -5,6 +5,9 @@ --energy-opp-color: #2e4053; --metric-color: #1f618d; --neb-color: #085646; + --company-color: #5b2c6f; + --facility-color: #212f3c; + --assessment-color: #196f3d; } From d5aa9a25fe7b798ed3f388c8ae8c86b0d3a52b2f Mon Sep 17 00:00:00 2001 From: rmroot Date: Wed, 6 Nov 2024 13:20:30 -0600 Subject: [PATCH 05/42] add pagnation to visit table --- .../table-pagination.component.css | 7 +++ .../table-pagination.component.html | 22 ++++++++++ .../table-pagination.component.spec.ts | 23 ++++++++++ .../table-pagination.component.ts | 44 +++++++++++++++++++ .../table-pagination.module.ts | 18 ++++++++ .../latest-visits-table.component.html | 6 ++- .../latest-visits-table.component.ts | 9 +++- .../user-portfolio/user-portfolio.module.ts | 5 ++- 8 files changed, 130 insertions(+), 4 deletions(-) create mode 100644 src/app/shared/table-pagination/table-pagination.component.css create mode 100644 src/app/shared/table-pagination/table-pagination.component.html create mode 100644 src/app/shared/table-pagination/table-pagination.component.spec.ts create mode 100644 src/app/shared/table-pagination/table-pagination.component.ts create mode 100644 src/app/shared/table-pagination/table-pagination.module.ts diff --git a/src/app/shared/table-pagination/table-pagination.component.css b/src/app/shared/table-pagination/table-pagination.component.css new file mode 100644 index 00000000..52851ef9 --- /dev/null +++ b/src/app/shared/table-pagination/table-pagination.component.css @@ -0,0 +1,7 @@ +/* .page-link{ + padding: .35rem !important; +} */ + +.page-link:hover{ + cursor: pointer; +} \ No newline at end of file diff --git a/src/app/shared/table-pagination/table-pagination.component.html b/src/app/shared/table-pagination/table-pagination.component.html new file mode 100644 index 00000000..f38ebc50 --- /dev/null +++ b/src/app/shared/table-pagination/table-pagination.component.html @@ -0,0 +1,22 @@ + +
+ +
+
\ No newline at end of file diff --git a/src/app/shared/table-pagination/table-pagination.component.spec.ts b/src/app/shared/table-pagination/table-pagination.component.spec.ts new file mode 100644 index 00000000..f1ee64c8 --- /dev/null +++ b/src/app/shared/table-pagination/table-pagination.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { TablePaginationComponent } from './table-pagination.component'; + +describe('TablePaginationComponent', () => { + let component: TablePaginationComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [TablePaginationComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(TablePaginationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shared/table-pagination/table-pagination.component.ts b/src/app/shared/table-pagination/table-pagination.component.ts new file mode 100644 index 00000000..243bb8f5 --- /dev/null +++ b/src/app/shared/table-pagination/table-pagination.component.ts @@ -0,0 +1,44 @@ +import { Component, EventEmitter, Input, Output, SimpleChanges } from '@angular/core'; + +@Component({ + selector: 'app-table-pagination', + templateUrl: './table-pagination.component.html', + styleUrl: './table-pagination.component.css' +}) +export class TablePaginationComponent { + @Input({ required: true }) + pageNumber: number; + @Input({ required: true }) + collectionSize: number; + @Input({ required: true }) + itemsPerPage: number; + @Output('emitPageNumber') + emitPageNumber: EventEmitter = new EventEmitter(); + + pageNumberOptions: Array; + numberOfPages: number; + + ngOnInit() { + this.setValues(); + } + + ngOnChanges(changes: SimpleChanges) { + //update values on collection size change or items per page change + if ((changes['collectionSize'] && !changes['collectionSize'].firstChange) || (changes['itemsPerPage'] && !changes['itemsPerPage'].firstChange)) { + this.setValues(); + } + } + + setValues() { + this.numberOfPages = Math.ceil(this.collectionSize / this.itemsPerPage); + this.pageNumberOptions = new Array(); + for (let i = 1; i <= this.numberOfPages; i++) { + this.pageNumberOptions.push(i); + } + } + + setPageNumber(pageNumber: number) { + this.pageNumber = pageNumber; + this.emitPageNumber.emit(this.pageNumber); + } +} diff --git a/src/app/shared/table-pagination/table-pagination.module.ts b/src/app/shared/table-pagination/table-pagination.module.ts new file mode 100644 index 00000000..19d0d986 --- /dev/null +++ b/src/app/shared/table-pagination/table-pagination.module.ts @@ -0,0 +1,18 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { TablePaginationComponent } from './table-pagination.component'; + + + +@NgModule({ + declarations: [ + TablePaginationComponent + ], + imports: [ + CommonModule + ], + exports: [ + TablePaginationComponent + ] +}) +export class TablePaginationModule { } diff --git a/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html index 6f152c47..95d2bd8c 100644 --- a/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html +++ b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.html @@ -40,7 +40,7 @@ - + {{visit.companyId | companyName: companies}} @@ -66,6 +66,10 @@ +
+ +
diff --git a/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.ts b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.ts index 4280e775..fe862730 100644 --- a/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.ts +++ b/src/app/user-portfolio/latest-visits-table/latest-visits-table.component.ts @@ -27,6 +27,7 @@ export class LatestVisitsTableComponent { companies: Array; companiesSub: Subscription; + currentPageNumber: number = 1; constructor( private onSiteVisitIdbService: OnSiteVisitIdbService, private facilityIdbService: FacilityIdbService, @@ -50,7 +51,7 @@ export class LatestVisitsTableComponent { }) } - ngOnDestroy(){ + ngOnDestroy() { this.onSiteVisitSub.unsubscribe(); this.facilitiesSub.unsubscribe(); this.companiesSub.unsubscribe(); @@ -63,8 +64,12 @@ export class LatestVisitsTableComponent { this.onSiteVisitIdbService.setSelectedFromAssessmentGUID(visit.assessmentIds[0]); this.sharedDataService.createAssessmentModalOpen.next(true); } - + openWizardModal() { this.sharedDataService.createAssessmentModalOpen.next(true); } + + setPageCurrentPageNumber(pageNumber: number) { + this.currentPageNumber = pageNumber; + } } diff --git a/src/app/user-portfolio/user-portfolio.module.ts b/src/app/user-portfolio/user-portfolio.module.ts index 86334c6b..09a75d4e 100644 --- a/src/app/user-portfolio/user-portfolio.module.ts +++ b/src/app/user-portfolio/user-portfolio.module.ts @@ -9,6 +9,7 @@ import { PortfolioItemsListComponent } from './portfolio-items-list/portfolio-it import { CompanyListItemComponent } from './portfolio-items-list/company-list-item/company-list-item.component'; import { FacilityListItemComponent } from './portfolio-items-list/facility-list-item/facility-list-item.component'; import { AssessmentListItemComponent } from './portfolio-items-list/assessment-list-item/assessment-list-item.component'; +import { TablePaginationModule } from '../shared/table-pagination/table-pagination.module'; @NgModule({ declarations: [ @@ -23,7 +24,9 @@ import { AssessmentListItemComponent } from './portfolio-items-list/assessment-l imports: [ CommonModule, FontAwesomeModule, - HelperPipesModule + HelperPipesModule, + TablePaginationModule + ] }) export class UserPortfolioModule { } From 74a21697ea372f07279c842f2fb45cba793e147f Mon Sep 17 00:00:00 2001 From: rmroot Date: Wed, 6 Nov 2024 14:43:47 -0600 Subject: [PATCH 06/42] delete old dashboard and add new componet for company --- src/app/app-routing.module.ts | 120 +----------------- src/app/app.component.ts | 2 +- src/app/app.module.ts | 6 - .../assessments-table.component.html | 55 -------- .../assessments-table.component.spec.ts | 59 --------- .../assessments-table.component.ts | 72 ----------- .../company-dashboard-home.component.css | 0 .../company-dashboard-home.component.html | 20 --- .../company-dashboard-home.component.spec.ts | 73 ----------- .../company-dashboard-home.component.ts | 38 ------ .../facilities-table.component.css | 0 .../facilities-table.component.html | 70 ---------- .../facilities-table.component.spec.ts | 58 --------- .../facilities-table.component.ts | 72 ----------- .../company-dashboard-tabs.component.css | 0 .../company-dashboard-tabs.component.html | 31 ----- .../company-dashboard-tabs.component.spec.ts | 35 ----- .../company-dashboard-tabs.component.ts | 37 ------ .../company-dashboard.component.html | 4 - .../company-dashboard.component.spec.ts | 33 ----- .../company-dashboard.component.ts | 25 ---- .../company-dashboard.module.ts | 37 ------ .../company-goals/company-goals.component.css | 0 .../company-goals.component.html | 40 ------ .../company-goals.component.spec.ts | 24 ---- .../company-goals/company-goals.component.ts | 22 ---- .../company-reports.component.css | 0 .../company-reports.component.html | 1 - .../company-reports.component.spec.ts | 23 ---- .../company-reports.component.ts | 10 -- .../company-settings.component.css | 5 - .../company-settings.component.html | 50 -------- .../company-settings.component.spec.ts | 52 -------- .../company-settings.component.ts | 61 --------- .../sidebar/sidebar.component.html | 10 +- .../toast-notifications.component.html | 2 +- .../welcome/welcome.component.html | 2 +- .../explore-nebs/explore-nebs.component.css | 3 - .../explore-nebs/explore-nebs.component.html | 47 ------- .../explore-nebs.component.spec.ts | 33 ----- .../explore-nebs/explore-nebs.component.ts | 24 ---- .../user-dashboard-help.component.css | 0 .../user-dashboard-help.component.html | 7 - .../user-dashboard-help.component.spec.ts | 23 ---- .../user-dashboard-help.component.ts | 10 -- .../assessments-table.component.css | 0 .../assessments-table.component.html | 61 --------- .../assessments-table.component.spec.ts | 60 --------- .../assessments-table.component.ts | 72 ----------- .../companies-table.component.css | 0 .../companies-table.component.html | 70 ---------- .../companies-table.component.spec.ts | 56 -------- .../companies-table.component.ts | 75 ----------- .../facilities-table.component.css | 0 .../facilities-table.component.html | 84 ------------ .../facilities-table.component.spec.ts | 58 --------- .../facilities-table.component.ts | 77 ----------- .../user-dashboard-home.component.css | 0 .../user-dashboard-home.component.html | 11 -- .../user-dashboard-home.component.spec.ts | 61 --------- .../user-dashboard-home.component.ts | 10 -- .../user-dashboard-tabs.component.css | 0 .../user-dashboard-tabs.component.html | 28 ---- .../user-dashboard-tabs.component.spec.ts | 26 ---- .../user-dashboard-tabs.component.ts | 15 --- .../user-dashboard.component.css | 0 .../user-dashboard.component.html | 4 - .../user-dashboard.component.spec.ts | 25 ---- .../user-dashboard.component.ts | 10 -- .../user-dashboard/user-dashboard.module.ts | 39 ------ .../user-settings/user-settings.component.css | 0 .../user-settings.component.html | 7 - .../user-settings.component.spec.ts | 23 ---- .../user-settings/user-settings.component.ts | 10 -- .../company-dashboard.component.css | 0 .../company-dashboard.component.html | 1 + .../company-dashboard.component.spec.ts | 23 ++++ .../company-dashboard.component.ts | 28 ++++ .../company-list-item.component.html | 50 ++++++++ .../company-list-item.component.ts | 44 ++++++- .../portfolio-items-list.component.html | 8 +- .../portfolio-items-list.component.ts | 3 +- .../user-portfolio-home.component.css} | 0 .../user-portfolio-home.component.html | 11 ++ .../user-portfolio-home.component.spec.ts | 23 ++++ .../user-portfolio-home.component.ts | 10 ++ .../user-portfolio.component.html | 48 +++++-- .../user-portfolio.component.ts | 107 +++++++++++----- .../user-portfolio/user-portfolio.module.ts | 10 +- 89 files changed, 327 insertions(+), 2217 deletions(-) delete mode 100644 src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.html delete mode 100644 src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.spec.ts delete mode 100644 src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.ts delete mode 100644 src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.css delete mode 100644 src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.html delete mode 100644 src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.spec.ts delete mode 100644 src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.ts delete mode 100644 src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.css delete mode 100644 src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.html delete mode 100644 src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.spec.ts delete mode 100644 src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.ts delete mode 100644 src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.css delete mode 100644 src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.html delete mode 100644 src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.spec.ts delete mode 100644 src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.ts delete mode 100644 src/app/company-dashboard/company-dashboard.component.html delete mode 100644 src/app/company-dashboard/company-dashboard.component.spec.ts delete mode 100644 src/app/company-dashboard/company-dashboard.component.ts delete mode 100644 src/app/company-dashboard/company-dashboard.module.ts delete mode 100644 src/app/company-dashboard/company-goals/company-goals.component.css delete mode 100644 src/app/company-dashboard/company-goals/company-goals.component.html delete mode 100644 src/app/company-dashboard/company-goals/company-goals.component.spec.ts delete mode 100644 src/app/company-dashboard/company-goals/company-goals.component.ts delete mode 100644 src/app/company-dashboard/company-reports/company-reports.component.css delete mode 100644 src/app/company-dashboard/company-reports/company-reports.component.html delete mode 100644 src/app/company-dashboard/company-reports/company-reports.component.spec.ts delete mode 100644 src/app/company-dashboard/company-reports/company-reports.component.ts delete mode 100644 src/app/company-dashboard/company-settings/company-settings.component.css delete mode 100644 src/app/company-dashboard/company-settings/company-settings.component.html delete mode 100644 src/app/company-dashboard/company-settings/company-settings.component.spec.ts delete mode 100644 src/app/company-dashboard/company-settings/company-settings.component.ts delete mode 100644 src/app/user-dashboard/explore-nebs/explore-nebs.component.css delete mode 100644 src/app/user-dashboard/explore-nebs/explore-nebs.component.html delete mode 100644 src/app/user-dashboard/explore-nebs/explore-nebs.component.spec.ts delete mode 100644 src/app/user-dashboard/explore-nebs/explore-nebs.component.ts delete mode 100644 src/app/user-dashboard/user-dashboard-help/user-dashboard-help.component.css delete mode 100644 src/app/user-dashboard/user-dashboard-help/user-dashboard-help.component.html delete mode 100644 src/app/user-dashboard/user-dashboard-help/user-dashboard-help.component.spec.ts delete mode 100644 src/app/user-dashboard/user-dashboard-help/user-dashboard-help.component.ts delete mode 100644 src/app/user-dashboard/user-dashboard-home/assessments-table/assessments-table.component.css delete mode 100644 src/app/user-dashboard/user-dashboard-home/assessments-table/assessments-table.component.html delete mode 100644 src/app/user-dashboard/user-dashboard-home/assessments-table/assessments-table.component.spec.ts delete mode 100644 src/app/user-dashboard/user-dashboard-home/assessments-table/assessments-table.component.ts delete mode 100644 src/app/user-dashboard/user-dashboard-home/companies-table/companies-table.component.css delete mode 100644 src/app/user-dashboard/user-dashboard-home/companies-table/companies-table.component.html delete mode 100644 src/app/user-dashboard/user-dashboard-home/companies-table/companies-table.component.spec.ts delete mode 100644 src/app/user-dashboard/user-dashboard-home/companies-table/companies-table.component.ts delete mode 100644 src/app/user-dashboard/user-dashboard-home/facilities-table/facilities-table.component.css delete mode 100644 src/app/user-dashboard/user-dashboard-home/facilities-table/facilities-table.component.html delete mode 100644 src/app/user-dashboard/user-dashboard-home/facilities-table/facilities-table.component.spec.ts delete mode 100644 src/app/user-dashboard/user-dashboard-home/facilities-table/facilities-table.component.ts delete mode 100644 src/app/user-dashboard/user-dashboard-home/user-dashboard-home.component.css delete mode 100644 src/app/user-dashboard/user-dashboard-home/user-dashboard-home.component.html delete mode 100644 src/app/user-dashboard/user-dashboard-home/user-dashboard-home.component.spec.ts delete mode 100644 src/app/user-dashboard/user-dashboard-home/user-dashboard-home.component.ts delete mode 100644 src/app/user-dashboard/user-dashboard-tabs/user-dashboard-tabs.component.css delete mode 100644 src/app/user-dashboard/user-dashboard-tabs/user-dashboard-tabs.component.html delete mode 100644 src/app/user-dashboard/user-dashboard-tabs/user-dashboard-tabs.component.spec.ts delete mode 100644 src/app/user-dashboard/user-dashboard-tabs/user-dashboard-tabs.component.ts delete mode 100644 src/app/user-dashboard/user-dashboard.component.css delete mode 100644 src/app/user-dashboard/user-dashboard.component.html delete mode 100644 src/app/user-dashboard/user-dashboard.component.spec.ts delete mode 100644 src/app/user-dashboard/user-dashboard.component.ts delete mode 100644 src/app/user-dashboard/user-dashboard.module.ts delete mode 100644 src/app/user-dashboard/user-settings/user-settings.component.css delete mode 100644 src/app/user-dashboard/user-settings/user-settings.component.html delete mode 100644 src/app/user-dashboard/user-settings/user-settings.component.spec.ts delete mode 100644 src/app/user-dashboard/user-settings/user-settings.component.ts rename src/app/{ => user-portfolio}/company-dashboard/company-dashboard.component.css (100%) create mode 100644 src/app/user-portfolio/company-dashboard/company-dashboard.component.html create mode 100644 src/app/user-portfolio/company-dashboard/company-dashboard.component.spec.ts create mode 100644 src/app/user-portfolio/company-dashboard/company-dashboard.component.ts rename src/app/{company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.css => user-portfolio/user-portfolio-home/user-portfolio-home.component.css} (100%) create mode 100644 src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.html create mode 100644 src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.spec.ts create mode 100644 src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index a3a21d69..3a57f943 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -2,27 +2,9 @@ import { NgModule } from '@angular/core'; import { ExtraOptions, RouterModule, Routes } from '@angular/router'; import { WelcomeComponent } from './core-components/welcome/welcome.component'; import { PageNotFoundComponent } from './core-components/page-not-found/page-not-found.component'; -import { UserDashboardComponent } from './user-dashboard/user-dashboard.component'; -import { UserDashboardHomeComponent } from './user-dashboard/user-dashboard-home/user-dashboard-home.component'; -import { CompanyDashboardComponent } from './company-dashboard/company-dashboard.component'; -import { CompanyDashboardHomeComponent } from './company-dashboard/company-dashboard-home/company-dashboard-home.component'; -import { FacilityDashboardComponent } from './facility-dashboard/facility-dashboard.component'; -import { FacilityDashboardHomeComponent } from './facility-dashboard/facility-dashboard-home/facility-dashboard-home.component'; import { SetupWizardComponent } from './setup-wizard/setup-wizard.component'; import { CompanySetupComponent } from './setup-wizard/pre-visit/company-setup/company-setup.component'; import { FacilitySetupComponent } from './setup-wizard/pre-visit/facility-setup/facility-setup.component'; -import { UserSettingsComponent } from './user-dashboard/user-settings/user-settings.component'; -import { CompanySettingsComponent } from './company-dashboard/company-settings/company-settings.component'; -import { CompanyReportsComponent } from './company-dashboard/company-reports/company-reports.component'; -import { FacilitySettingsComponent } from './facility-dashboard/facility-settings/facility-settings.component'; -import { FacilityReportsComponent } from './facility-dashboard/facility-reports/facility-reports.component'; -import { UserDashboardHelpComponent } from './user-dashboard/user-dashboard-help/user-dashboard-help.component'; -import { ExploreNEBsComponent } from './user-dashboard/explore-nebs/explore-nebs.component'; -import { CompanyGoalsComponent } from './company-dashboard/company-goals/company-goals.component'; -import { FacilityGoalsComponent } from './facility-dashboard/facility-goals/facility-goals.component'; -import { AssessmentDashboardComponent } from './assessment-dashboard/assessment-dashboard.component'; -import { AssessmentDashboardHomeComponent } from './assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component'; -import { AssessmentSettingsComponent } from './assessment-dashboard/assessment-settings/assessment-settings.component'; import { CompanyContactsSetupComponent } from './setup-wizard/pre-visit/company-contacts-setup/company-contacts-setup.component'; import { FacilityProcessEquipmentSetupComponent } from './setup-wizard/pre-visit/facility-process-equipment-setup/facility-process-equipment-setup.component'; import { PreAssessmentSetupComponent } from './setup-wizard/pre-visit/pre-assessment-setup/pre-assessment-setup.component'; @@ -45,6 +27,8 @@ import { AssessmentEvaluationComponent } from './setup-wizard/data-evaluation/as import { OnSiteAssessmentResultsComponent } from './setup-wizard/data-collection/on-site-assessment/on-site-assessment-results/on-site-assessment-results.component'; import { FacilityEnergyEquipmentSetupComponent } from './setup-wizard/pre-visit/facility-energy-equipment-setup/facility-energy-equipment-setup.component'; import { UserPortfolioComponent } from './user-portfolio/user-portfolio.component'; +import { UserPortfolioHomeComponent } from './user-portfolio/user-portfolio-home/user-portfolio-home.component'; +import { CompanyDashboardComponent } from './user-portfolio/company-dashboard/company-dashboard.component'; const routes: Routes = [ { @@ -177,106 +161,16 @@ const routes: Routes = [ ] }, { - path: 'user', - component: UserPortfolioComponent - }, - // { - // path: 'user', - // component: UserDashboardComponent, - // children: [ - // { - // path: '', - // pathMatch: 'full', - // redirectTo: 'home' - // }, - // { - // path: 'home', - // component: UserDashboardHomeComponent - // }, - // { - // path: 'settings', - // component: UserSettingsComponent - // }, - // { - // path: 'help', - // component: UserDashboardHelpComponent - // }, - // { - // path: 'nebs-database', - // component: ExploreNEBsComponent - // } - // ] - // }, - { - path: 'company/:id', - component: CompanyDashboardComponent, - children: [ - { - path: '', - pathMatch: 'full', - redirectTo: 'home' - }, - { - path: 'home', - component: CompanyDashboardHomeComponent - }, - { - path: 'settings', - component: CompanySettingsComponent - }, - { - path: 'reports', - component: CompanyReportsComponent - }, - { - path: 'goals', - component: CompanyGoalsComponent - } - ] - }, - { - path: 'facility/:id', - component: FacilityDashboardComponent, + path: 'portfolio', + component: UserPortfolioComponent, children: [ { path: '', - pathMatch: 'full', - redirectTo: 'home' - }, - { - path: 'home', - component: FacilityDashboardHomeComponent - }, - { - path: 'settings', - component: FacilitySettingsComponent - }, - { - path: 'reports', - component: FacilityReportsComponent - }, - { - path: 'goals', - component: FacilityGoalsComponent - } - ] - }, - { - path: 'assessment/:id', - component: AssessmentDashboardComponent, - children: [ - { - path: '', - pathMatch: 'full', - redirectTo: 'home' - }, - { - path: 'home', - component: AssessmentDashboardHomeComponent + component: UserPortfolioHomeComponent }, { - path: 'settings', - component: AssessmentSettingsComponent + path: 'company/:id', + component: CompanyDashboardComponent } ] }, diff --git a/src/app/app.component.ts b/src/app/app.component.ts index 9162482e..7f4ad8c5 100644 --- a/src/app/app.component.ts +++ b/src/app/app.component.ts @@ -93,7 +93,7 @@ export class AppComponent { let user: IdbUser = this.userIdbService.user.getValue(); if (user.skipSplashScreen) { //if user skips the home screen navigate to dashboard. - this.router.navigateByUrl('/user') + this.router.navigateByUrl('/portfolio') } } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 54a709ad..ef19797f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -6,9 +6,6 @@ import { AppComponent } from './app.component'; import { NavbarComponent } from './core-components/navbar/navbar.component'; import { WelcomeComponent } from './core-components/welcome/welcome.component'; import { PageNotFoundComponent } from './core-components/page-not-found/page-not-found.component'; -import { UserDashboardModule } from './user-dashboard/user-dashboard.module'; -import { CompanyDashboardModule } from './company-dashboard/company-dashboard.module'; -import { FacilityDashboardModule } from './facility-dashboard/facility-dashboard.module'; import { IndexedDbModule } from './indexed-db/indexed-db.module'; import { LoadingComponent } from './core-components/loading/loading.component'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; @@ -40,9 +37,6 @@ import { ToastNotificationsComponent } from './core-components/toast-notificatio imports: [ BrowserModule, AppRoutingModule, - UserDashboardModule, - CompanyDashboardModule, - FacilityDashboardModule, IndexedDbModule, FontAwesomeModule, FormsModule, diff --git a/src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.html b/src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.html deleted file mode 100644 index 8ceae03f..00000000 --- a/src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.html +++ /dev/null @@ -1,55 +0,0 @@ -
-
- - - Assessments - - -
-
- - - - - - - - - - - - - - - - - - -
- Name - - Facility - - Visit Date -
- - {{assessment.name}} - - - {{assessment.facilityId | facilityName:facilities}} - - - {{assessment.visitDate | date:'shortDate'}} - -
-
- - -
- No assessments found. Please click "Add New" to get started. -
-
-
-
\ No newline at end of file diff --git a/src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.spec.ts b/src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.spec.ts deleted file mode 100644 index aec9d4bb..00000000 --- a/src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.spec.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { AssessmentsTableComponent } from './assessments-table.component'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { HelperPipesModule } from 'src/app/shared/helper-pipes/helper-pipes.module'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { SetupWizardService } from 'src/app/setup-wizard/setup-wizard.service'; -import { IdbAssessment, getNewIdbAssessment } from 'src/app/models/assessment'; -import { BehaviorSubject } from 'rxjs'; -import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility'; -import { IdbCompany, getNewIdbCompany } from 'src/app/models/company'; -import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; -import { IdbOnSiteVisit } from 'src/app/models/onSiteVisit'; -import { getDefaultUnitSettings } from 'src/app/models/unitSettings'; - -describe('AssessmentsTableComponent', () => { - let component: AssessmentsTableComponent; - let fixture: ComponentFixture; - - let assessmentIdbService: Partial = { - selectedAssessment: new BehaviorSubject(getNewIdbAssessment('', '', '', getDefaultUnitSettings())), - assessments: new BehaviorSubject>([]) - }; - let facilityIdbService: Partial = { - selectedFacility: new BehaviorSubject(getNewIdbFacility('', '')), - facilities: new BehaviorSubject>([]) - }; - let companyIdbService: Partial = { - selectedCompany: new BehaviorSubject(getNewIdbCompany('')) - }; - let setupWizardService: Partial = {}; - let onSiteVisitIdbService: Partial = { - onSiteVisits: new BehaviorSubject>([]) - }; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [FontAwesomeModule, HelperPipesModule], - declarations: [AssessmentsTableComponent], - providers: [ - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: CompanyIdbService, useValue: companyIdbService }, - { provide: SetupWizardService, useValue: setupWizardService }, - { provide: OnSiteVisitIdbService, useValue: onSiteVisitIdbService }, - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(AssessmentsTableComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.ts b/src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.ts deleted file mode 100644 index 47adaa87..00000000 --- a/src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; -import { IconDefinition, faFileLines, faWandMagicSparkles } from '@fortawesome/free-solid-svg-icons'; -import { Subscription } from 'rxjs'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; -import { IdbAssessment } from 'src/app/models/assessment'; -import { IdbCompany } from 'src/app/models/company'; -import { IdbFacility } from 'src/app/models/facility'; -import { SetupWizardService } from 'src/app/setup-wizard/setup-wizard.service'; -import { SharedDataService } from 'src/app/shared/shared-services/shared-data.service'; - -@Component({ - selector: 'app-assessments-table', - templateUrl: './assessments-table.component.html', - styleUrl: './assessments-table.component.css' -}) -export class AssessmentsTableComponent { - - faWandMagicSparkles: IconDefinition = faWandMagicSparkles; - faFileLines: IconDefinition = faFileLines; - - company: IdbCompany; - companySub: Subscription; - - facilities: Array; - facilitiesSub: Subscription; - - assessments: Array; - assessmentsSub: Subscription; - - constructor(private companyIdbService: CompanyIdbService, - private facilityIdbService: FacilityIdbService, - private assessmentIdbService: AssessmentIdbService, - private sharedDataService: SharedDataService, - private onSiteVisitIdbService: OnSiteVisitIdbService) { - } - - ngOnInit() { - this.companySub = this.companyIdbService.selectedCompany.subscribe(_company => { - this.company = _company; - }); - - this.facilitiesSub = this.facilityIdbService.facilities.subscribe(_facilities => { - this.facilities = _facilities; - }); - this.assessmentsSub = this.assessmentIdbService.assessments.subscribe(_assessments => { - this.assessments = _assessments; - }) - } - - ngOnDestroy() { - this.companySub.unsubscribe(); - this.facilitiesSub.unsubscribe(); - this.assessmentsSub.unsubscribe(); - } - - openAddNewModal() { - this.facilityIdbService.selectedFacility.next(undefined); - this.onSiteVisitIdbService.selectedVisit.next(undefined); - this.sharedDataService.createAssessmentModalOpen.next(true); - } - - goToVisit(assessment: IdbAssessment) { - this.companyIdbService.setSelectedFromGUID(assessment.companyId); - this.facilityIdbService.setSelectedFromGUID(assessment.facilityId); - this.onSiteVisitIdbService.setSelectedFromAssessmentGUID(assessment.guid); - this.sharedDataService.createAssessmentModalOpen.next(true); - } -} diff --git a/src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.css b/src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.html b/src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.html deleted file mode 100644 index 51aa39c4..00000000 --- a/src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.html +++ /dev/null @@ -1,20 +0,0 @@ -
-
- -
-
- -
-
-
-
-
- -
-
\ No newline at end of file diff --git a/src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.spec.ts b/src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.spec.ts deleted file mode 100644 index 6c5de4a6..00000000 --- a/src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.spec.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CompanyDashboardHomeComponent } from './company-dashboard-home.component'; -import { RouterTestingModule } from '@angular/router/testing'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { BehaviorSubject } from 'rxjs'; -import { IdbCompany, getNewIdbCompany } from 'src/app/models/company'; -import { IdbFacility } from 'src/app/models/facility'; -import { FormsModule } from '@angular/forms'; -import { FacilitiesTableComponent } from './facilities-table/facilities-table.component'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { HelperPipesModule } from 'src/app/shared/helper-pipes/helper-pipes.module'; -import { AssessmentsTableComponent } from './assessments-table/assessments-table.component'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { IdbAssessment } from 'src/app/models/assessment'; -import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service'; -import { UserIdbService } from 'src/app/indexed-db/user-idb.service'; -import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; -import { IdbOnSiteVisit } from 'src/app/models/onSiteVisit'; -import { EnergyOpportunityIdbService } from 'src/app/indexed-db/energy-opportunity-idb.service'; -import { IdbEnergyOpportunity } from 'src/app/models/energyOpportunity'; - -describe('CompanyDashboardHomeComponent', () => { - let component: CompanyDashboardHomeComponent; - let fixture: ComponentFixture; - let companyDbServiceStub: Partial = { - companies: new BehaviorSubject>([]), - selectedCompany: new BehaviorSubject(getNewIdbCompany('')) - }; - let facilityDbServiceStub: Partial = { - facilities: new BehaviorSubject>([]), - selectedFacility: new BehaviorSubject(undefined) - } - let energyOpportunityIdbService: Partial = { - energyOpportunities: new BehaviorSubject>([]) - }; - let assessmentIdbService: Partial = { - selectedAssessment: new BehaviorSubject(undefined), - assessments: new BehaviorSubject>([]) - }; - let contactIdbService: Partial = {}; - let userIdbService: Partial = {}; - - let onSiteVisitIdbService: Partial = { - onSiteVisits: new BehaviorSubject>([]) - }; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [RouterTestingModule, FormsModule, FontAwesomeModule, HelperPipesModule], - declarations: [CompanyDashboardHomeComponent, FacilitiesTableComponent, AssessmentsTableComponent], - providers: [ - { provide: CompanyIdbService, useValue: companyDbServiceStub }, - { provide: FacilityIdbService, useValue: facilityDbServiceStub }, - { provide: DbChangesService, useValue: {} }, - { provide: EnergyOpportunityIdbService, useValue: energyOpportunityIdbService }, - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - { provide: ContactIdbService, useValue: contactIdbService }, - { provide: UserIdbService, useValue: userIdbService }, - { provide: OnSiteVisitIdbService, useValue: onSiteVisitIdbService }, - ] - }); - fixture = TestBed.createComponent(CompanyDashboardHomeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.ts b/src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.ts deleted file mode 100644 index e48b8c77..00000000 --- a/src/app/company-dashboard/company-dashboard-home/company-dashboard-home.component.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; -import { IconDefinition, faBuilding } from '@fortawesome/free-solid-svg-icons'; -import { Subscription } from 'rxjs'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { IdbCompany } from 'src/app/models/company'; -@Component({ - selector: 'app-company-dashboard-home', - templateUrl: './company-dashboard-home.component.html', - styleUrls: ['./company-dashboard-home.component.css'] -}) -export class CompanyDashboardHomeComponent { - - faBuilding: IconDefinition = faBuilding; - - selectedCompany: IdbCompany; - selectedCompanySub: Subscription; - constructor(private companyIdbService: CompanyIdbService, - private dbChangesService: DbChangesService, - private router: Router) { - } - - ngOnInit() { - this.selectedCompanySub = this.companyIdbService.selectedCompany.subscribe(_company => { - this.selectedCompany = _company; - }); - } - - ngOnDestroy() { - this.selectedCompanySub.unsubscribe(); - } - - async deleteCompany(){ - await this.dbChangesService.deleteCompany(this.selectedCompany); - this.router.navigateByUrl('/user') - } -} diff --git a/src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.css b/src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.html b/src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.html deleted file mode 100644 index 5ee96d35..00000000 --- a/src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.html +++ /dev/null @@ -1,70 +0,0 @@ -
-
- - - Facilities - - -
-
- - - - - - - - - - - - - - - - - -
- Name - - Location - - Assessments -
- - {{facility.generalInformation.name}} - - - {{facility.generalInformation | addressDisplay}} - - {{(facility.guid | assessmentsList: assessments).length}} -
-
- - -
- No facilities found. Please click "Add New" to get started. -
-
-
-
- - -
- \ No newline at end of file diff --git a/src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.spec.ts b/src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.spec.ts deleted file mode 100644 index a67b076b..00000000 --- a/src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.spec.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { FacilitiesTableComponent } from './facilities-table.component'; -import { UserIdbService } from 'src/app/indexed-db/user-idb.service'; -import { BehaviorSubject } from 'rxjs'; -import { IdbUser, getNewIdbUser } from 'src/app/models/user'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { IdbCompany, getNewIdbCompany } from 'src/app/models/company'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { IdbFacility } from 'src/app/models/facility'; -import { RouterTestingModule } from '@angular/router/testing'; -import { FormsModule } from '@angular/forms'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { HelperPipesModule } from 'src/app/shared/helper-pipes/helper-pipes.module'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { IdbAssessment, getNewIdbAssessment } from 'src/app/models/assessment'; -import { getDefaultUnitSettings } from 'src/app/models/unitSettings'; - -describe('FacilitiesTableComponent', () => { - let component: FacilitiesTableComponent; - let fixture: ComponentFixture; - let userIdbService: Partial = { - user: new BehaviorSubject(getNewIdbUser()) - } - let companyIdbService: Partial = { - companies: new BehaviorSubject>([]), - selectedCompany: new BehaviorSubject(getNewIdbCompany('')) - }; - let facilityIdbService: Partial = { - facilities: new BehaviorSubject>([]) - }; - - let assessmentIdbService: Partial = { - selectedAssessment: new BehaviorSubject(getNewIdbAssessment('', '', '', getDefaultUnitSettings())), - assessments: new BehaviorSubject>([]) - }; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [RouterTestingModule, FormsModule, FontAwesomeModule, HelperPipesModule], - declarations: [FacilitiesTableComponent], - providers: [ - { provide: UserIdbService, useValue: userIdbService }, - { provide: CompanyIdbService, useValue: companyIdbService }, - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(FacilitiesTableComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.ts b/src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.ts deleted file mode 100644 index 02c04c03..00000000 --- a/src/app/company-dashboard/company-dashboard-home/facilities-table/facilities-table.component.ts +++ /dev/null @@ -1,72 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; -import { IconDefinition, faIndustry, faPlus } from '@fortawesome/free-solid-svg-icons'; -import { Subscription, firstValueFrom } from 'rxjs'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { IdbAssessment } from 'src/app/models/assessment'; -import { IdbCompany } from 'src/app/models/company'; -import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility'; - -@Component({ - selector: 'app-facilities-table', - templateUrl: './facilities-table.component.html', - styleUrl: './facilities-table.component.css' -}) -export class FacilitiesTableComponent { - - faPlus: IconDefinition = faPlus; - faIndustry: IconDefinition = faIndustry; - - - facilities: Array; - facilitiesSub: Subscription; - - assessments: Array; - assessmentsSub: Subscription; - - company: IdbCompany; - companySub: Subscription; - displayAddNewModal: boolean = false; - constructor( - private companyIdbService: CompanyIdbService, - private facilityIdbService: FacilityIdbService, - private assessmentIdbService: AssessmentIdbService, - private router: Router) { - } - - ngOnInit() { - this.companySub = this.companyIdbService.selectedCompany.subscribe(_company => { - this.company = _company; - }); - this.facilitiesSub = this.facilityIdbService.facilities.subscribe(_facilities => { - this.facilities = _facilities; - }); - this.assessmentsSub = this.assessmentIdbService.assessments.subscribe(_assessments => { - this.assessments = _assessments; - }) - } - - ngOnDestroy() { - this.facilitiesSub.unsubscribe(); - this.assessmentsSub.unsubscribe(); - this.companySub.unsubscribe(); - } - - - openAddNewModal() { - this.displayAddNewModal = true; - } - - closeAddNewModal() { - this.displayAddNewModal = false; - } - - async confirmCreate() { - let newFacility: IdbFacility = getNewIdbFacility(this.company.userId, this.company.guid); - newFacility = await firstValueFrom(this.facilityIdbService.addWithObservable(newFacility)); - await this.facilityIdbService.setFacilities(); - this.router.navigateByUrl('/facility/' + newFacility.guid + '/settings'); - } -} diff --git a/src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.css b/src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.html b/src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.html deleted file mode 100644 index 67bd04d5..00000000 --- a/src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.html +++ /dev/null @@ -1,31 +0,0 @@ - \ No newline at end of file diff --git a/src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.spec.ts b/src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.spec.ts deleted file mode 100644 index 337cffcd..00000000 --- a/src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.spec.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CompanyDashboardTabsComponent } from './company-dashboard-tabs.component'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { BehaviorSubject } from 'rxjs'; -import { IdbCompany, getNewIdbCompany } from 'src/app/models/company'; -import { RouterTestingModule } from '@angular/router/testing'; - -describe('CompanyDashboardTabsComponent', () => { - let component: CompanyDashboardTabsComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - let companyIdbService: Partial = { - selectedCompany: new BehaviorSubject(getNewIdbCompany('')) - }; - await TestBed.configureTestingModule({ - imports: [FontAwesomeModule, RouterTestingModule], - declarations: [CompanyDashboardTabsComponent], - providers: [ - { provide: CompanyIdbService, useValue: companyIdbService } - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(CompanyDashboardTabsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.ts b/src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.ts deleted file mode 100644 index bea0318e..00000000 --- a/src/app/company-dashboard/company-dashboard-tabs/company-dashboard-tabs.component.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Component } from '@angular/core'; -import { IconDefinition, faBuilding, faBullseye, faChartLine, faChevronLeft, faFolderOpen, faGears } from '@fortawesome/free-solid-svg-icons'; -import { Subscription } from 'rxjs'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { IdbCompany } from 'src/app/models/company'; - -@Component({ - selector: 'app-company-dashboard-tabs', - templateUrl: './company-dashboard-tabs.component.html', - styleUrl: './company-dashboard-tabs.component.css' -}) -export class CompanyDashboardTabsComponent { - - - faBuilding: IconDefinition = faBuilding; - faGears: IconDefinition = faGears; - faFolderOpen: IconDefinition = faFolderOpen; - faChartLine: IconDefinition = faChartLine; - faBullseye: IconDefinition = faBullseye - - company: IdbCompany; - copmanySub: Subscription; - - constructor(private companyIdbService: CompanyIdbService) { - - } - - ngOnInit() { - this.copmanySub = this.companyIdbService.selectedCompany.subscribe(_company => { - this.company = _company; - }); - } - - ngOnDestroy() { - this.copmanySub.unsubscribe(); - } -} diff --git a/src/app/company-dashboard/company-dashboard.component.html b/src/app/company-dashboard/company-dashboard.component.html deleted file mode 100644 index 3bbef2d9..00000000 --- a/src/app/company-dashboard/company-dashboard.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
- - -
\ No newline at end of file diff --git a/src/app/company-dashboard/company-dashboard.component.spec.ts b/src/app/company-dashboard/company-dashboard.component.spec.ts deleted file mode 100644 index e912710d..00000000 --- a/src/app/company-dashboard/company-dashboard.component.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CompanyDashboardComponent } from './company-dashboard.component'; -import { RouterTestingModule } from '@angular/router/testing'; -import { CompanyIdbService } from '../indexed-db/company-idb.service'; -import { BehaviorSubject } from 'rxjs'; -import { IdbCompany, getNewIdbCompany } from '../models/company'; -import { CompanyDashboardTabsComponent } from './company-dashboard-tabs/company-dashboard-tabs.component'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; - -describe('CompanyDashboardComponent', () => { - let component: CompanyDashboardComponent; - let fixture: ComponentFixture; - - beforeEach(() => { - let companyDbServiceStub: Partial = { - companies: new BehaviorSubject>([]), - selectedCompany: new BehaviorSubject(getNewIdbCompany('')) - } - TestBed.configureTestingModule({ - imports: [RouterTestingModule, FontAwesomeModule], - declarations: [CompanyDashboardComponent, CompanyDashboardTabsComponent], - providers: [{ provide: CompanyIdbService, useValue: companyDbServiceStub }], - }); - fixture = TestBed.createComponent(CompanyDashboardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/company-dashboard/company-dashboard.component.ts b/src/app/company-dashboard/company-dashboard.component.ts deleted file mode 100644 index da56887e..00000000 --- a/src/app/company-dashboard/company-dashboard.component.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Component } from '@angular/core'; -import { CompanyIdbService } from '../indexed-db/company-idb.service'; -import { ActivatedRoute, Router } from '@angular/router'; - -@Component({ - selector: 'app-company-dashboard', - templateUrl: './company-dashboard.component.html', - styleUrls: ['./company-dashboard.component.css'] -}) -export class CompanyDashboardComponent { - - constructor(private activatedRoute: ActivatedRoute, private companyIdbService: CompanyIdbService, - private router: Router) { - } - - ngOnInit() { - this.activatedRoute.params.subscribe(params => { - let companyGUID: string = params['id']; - let companyExists: boolean = this.companyIdbService.setSelectedFromGUID(companyGUID); - if (!companyExists) { - this.router.navigateByUrl('/user'); - } - }); - } -} diff --git a/src/app/company-dashboard/company-dashboard.module.ts b/src/app/company-dashboard/company-dashboard.module.ts deleted file mode 100644 index ea87d790..00000000 --- a/src/app/company-dashboard/company-dashboard.module.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { CompanyDashboardComponent } from './company-dashboard.component'; -import { CompanyDashboardHomeComponent } from './company-dashboard-home/company-dashboard-home.component'; -import { RouterModule } from '@angular/router'; -import { FormsModule } from '@angular/forms'; -import { HelperPipesModule } from '../shared/helper-pipes/helper-pipes.module'; -import { SharedSettingsFormsModule } from '../shared/shared-settings-forms/shared-settings-forms.module'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { CompanyGoalsComponent } from './company-goals/company-goals.component'; -import { CompanyDashboardTabsComponent } from './company-dashboard-tabs/company-dashboard-tabs.component'; -import { CompanyReportsComponent } from './company-reports/company-reports.component'; -import { CompanySettingsComponent } from './company-settings/company-settings.component'; -import { FacilitiesTableComponent } from './company-dashboard-home/facilities-table/facilities-table.component'; -import { AssessmentsTableComponent } from './company-dashboard-home/assessments-table/assessments-table.component'; - -@NgModule({ - declarations: [ - CompanyDashboardComponent, - CompanyDashboardHomeComponent, - CompanyGoalsComponent, - CompanyDashboardTabsComponent, - CompanyReportsComponent, - CompanySettingsComponent, - FacilitiesTableComponent, - AssessmentsTableComponent - ], - imports: [ - CommonModule, - RouterModule, - FormsModule, - HelperPipesModule, - SharedSettingsFormsModule, - FontAwesomeModule - ] -}) -export class CompanyDashboardModule { } diff --git a/src/app/company-dashboard/company-goals/company-goals.component.css b/src/app/company-dashboard/company-goals/company-goals.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/company-dashboard/company-goals/company-goals.component.html b/src/app/company-dashboard/company-goals/company-goals.component.html deleted file mode 100644 index a82e8d04..00000000 --- a/src/app/company-dashboard/company-goals/company-goals.component.html +++ /dev/null @@ -1,40 +0,0 @@ -
-
-
-
-

- -

-
-
- -
-
- Strategic Goals -
- -
-
-
- Sustainability Goals -
- -
-
-
- Marketing Goals -
- -
-
-
-
-
-
-
\ No newline at end of file diff --git a/src/app/company-dashboard/company-goals/company-goals.component.spec.ts b/src/app/company-dashboard/company-goals/company-goals.component.spec.ts deleted file mode 100644 index 3d7d4e4a..00000000 --- a/src/app/company-dashboard/company-goals/company-goals.component.spec.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CompanyGoalsComponent } from './company-goals.component'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; - -describe('CompanyGoalsComponent', () => { - let component: CompanyGoalsComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [FontAwesomeModule] - }) - .compileComponents(); - - fixture = TestBed.createComponent(CompanyGoalsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/company-dashboard/company-goals/company-goals.component.ts b/src/app/company-dashboard/company-goals/company-goals.component.ts deleted file mode 100644 index 913fc8d3..00000000 --- a/src/app/company-dashboard/company-goals/company-goals.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Component } from '@angular/core'; -import { IconDefinition, faBullseye } from '@fortawesome/free-solid-svg-icons'; - -@Component({ - selector: 'app-company-goals', - templateUrl: './company-goals.component.html', - styleUrl: './company-goals.component.css' -}) -export class CompanyGoalsComponent { - - faBullseye: IconDefinition = faBullseye; - accordionOpen: boolean = false; - - - constructor(){ - - } - - toggleAccordion(){ - this.accordionOpen = !this.accordionOpen; - } -} diff --git a/src/app/company-dashboard/company-reports/company-reports.component.css b/src/app/company-dashboard/company-reports/company-reports.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/company-dashboard/company-reports/company-reports.component.html b/src/app/company-dashboard/company-reports/company-reports.component.html deleted file mode 100644 index fb8d5aae..00000000 --- a/src/app/company-dashboard/company-reports/company-reports.component.html +++ /dev/null @@ -1 +0,0 @@ -

company-reports works!

diff --git a/src/app/company-dashboard/company-reports/company-reports.component.spec.ts b/src/app/company-dashboard/company-reports/company-reports.component.spec.ts deleted file mode 100644 index 91d1a98b..00000000 --- a/src/app/company-dashboard/company-reports/company-reports.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CompanyReportsComponent } from './company-reports.component'; - -describe('CompanyReportsComponent', () => { - let component: CompanyReportsComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [CompanyReportsComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(CompanyReportsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/company-dashboard/company-reports/company-reports.component.ts b/src/app/company-dashboard/company-reports/company-reports.component.ts deleted file mode 100644 index c3e3fb9a..00000000 --- a/src/app/company-dashboard/company-reports/company-reports.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-company-reports', - templateUrl: './company-reports.component.html', - styleUrl: './company-reports.component.css' -}) -export class CompanyReportsComponent { - -} diff --git a/src/app/company-dashboard/company-settings/company-settings.component.css b/src/app/company-dashboard/company-settings/company-settings.component.css deleted file mode 100644 index 2d909ba7..00000000 --- a/src/app/company-dashboard/company-settings/company-settings.component.css +++ /dev/null @@ -1,5 +0,0 @@ -.settings-content{ - height: calc(100% - 3rem); - /* background-color: red; */ - overflow-y: auto; -} \ No newline at end of file diff --git a/src/app/company-dashboard/company-settings/company-settings.component.html b/src/app/company-dashboard/company-settings/company-settings.component.html deleted file mode 100644 index e5abf0b7..00000000 --- a/src/app/company-dashboard/company-settings/company-settings.component.html +++ /dev/null @@ -1,50 +0,0 @@ -
-
-
-
-
- Company Details -
-
-
- - -
-
- - -
- - -
- -
- -
-
-
-
-
- - - -
- \ No newline at end of file diff --git a/src/app/company-dashboard/company-settings/company-settings.component.spec.ts b/src/app/company-dashboard/company-settings/company-settings.component.spec.ts deleted file mode 100644 index b4c3e59f..00000000 --- a/src/app/company-dashboard/company-settings/company-settings.component.spec.ts +++ /dev/null @@ -1,52 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { CompanySettingsComponent } from './company-settings.component'; -import { SharedSettingsFormsModule } from 'src/app/shared/shared-settings-forms/shared-settings-forms.module'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { BehaviorSubject } from 'rxjs'; -import { IdbCompany, getNewIdbCompany } from 'src/app/models/company'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { FormsModule } from '@angular/forms'; -import { RouterTestingModule } from '@angular/router/testing'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility'; -import { LocalStorageDataService } from 'src/app/shared/shared-services/local-storage-data.service'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { UserIdbService } from 'src/app/indexed-db/user-idb.service'; - -describe('CompanySettingsComponent', () => { - let component: CompanySettingsComponent; - let fixture: ComponentFixture; - let companyIdbService: Partial = { - companies: new BehaviorSubject>([]), - selectedCompany: new BehaviorSubject(getNewIdbCompany('')) - }; - let facilityIdbService: Partial = { - facilities: new BehaviorSubject>([]), - selectedFacility: new BehaviorSubject(getNewIdbFacility('', '')) - }; - let userIdbService: Partial = {}; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [SharedSettingsFormsModule, FontAwesomeModule, FormsModule, RouterTestingModule], - declarations: [CompanySettingsComponent], - providers: [ - { provide: CompanyIdbService, useValue: companyIdbService }, - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: LocalStorageDataService, useValue: {}}, - { provide: DbChangesService, useValue: {}}, - { provide: UserIdbService, useValue: userIdbService} - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(CompanySettingsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/company-dashboard/company-settings/company-settings.component.ts b/src/app/company-dashboard/company-settings/company-settings.component.ts deleted file mode 100644 index d568fed1..00000000 --- a/src/app/company-dashboard/company-settings/company-settings.component.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; -import { IconDefinition, faBuilding, faTrash } from '@fortawesome/free-solid-svg-icons'; -import { Subscription } from 'rxjs'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { IdbCompany } from 'src/app/models/company'; - -@Component({ - selector: 'app-company-settings', - templateUrl: './company-settings.component.html', - styleUrl: './company-settings.component.css' -}) -export class CompanySettingsComponent { - - - faBuilding: IconDefinition = faBuilding; - faTrash: IconDefinition = faTrash; - - company: IdbCompany; - companySub: Subscription; - isFormChange: boolean = false; - displayDeleteModal: boolean = false; - constructor(private companyIdbService: CompanyIdbService, - private dbChangesService: DbChangesService, - private router: Router - ) { - } - - ngOnInit() { - this.companySub = this.companyIdbService.selectedCompany.subscribe(_company => { - if (!this.isFormChange) { - this.company = _company; - } else { - this.isFormChange = false; - } - }); - } - - ngOnDestroy() { - this.companySub.unsubscribe(); - } - - async saveChanges() { - this.isFormChange = true; - await this.companyIdbService.asyncUpdate(this.company); - } - - openDeleteModal() { - this.displayDeleteModal = true; - } - - closeDeleteModal() { - this.displayDeleteModal = false; - } - - async confirmDelete() { - await this.dbChangesService.deleteCompany(this.company); - this.router.navigateByUrl('/user') - } -} diff --git a/src/app/core-components/sidebar/sidebar.component.html b/src/app/core-components/sidebar/sidebar.component.html index ff1abf64..89943dd9 100644 --- a/src/app/core-components/sidebar/sidebar.component.html +++ b/src/app/core-components/sidebar/sidebar.component.html @@ -13,14 +13,16 @@

-
+
+
+
+ + + +
+ + + \ No newline at end of file diff --git a/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.ts b/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.ts index 00328f8e..0e5db295 100644 --- a/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.ts +++ b/src/app/user-portfolio/portfolio-items-list/company-list-item/company-list-item.component.ts @@ -1,6 +1,10 @@ import { Component, Input } from '@angular/core'; -import { faExpand, faIndustry, faTrash, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Router } from '@angular/router'; +import { faCopy, faExpand, faIndustry, faTrash, IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { Subscription } from 'rxjs'; +import { LoadingService } from 'src/app/core-components/loading/loading.service'; +import { ToastNotificationsService } from 'src/app/core-components/toast-notifications/toast-notifications.service'; +import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; import { IdbCompany } from 'src/app/models/company'; import { IdbFacility } from 'src/app/models/facility'; @@ -18,12 +22,20 @@ export class CompanyListItemComponent { faIndustry: IconDefinition = faIndustry; faTrash: IconDefinition = faTrash; faExpand: IconDefinition = faExpand; + faCopy: IconDefinition = faCopy; facilities: Array; facilitiesSub: Subscription; accordionGuid: string; + + showDeleteCompanyModal: boolean = false; + showCreateCopyModal: boolean = false; constructor(private facilityIdbService: FacilityIdbService, - private bootstrapService: BootstrapService + private bootstrapService: BootstrapService, + private dbChangesService: DbChangesService, + private toastNotificationService: ToastNotificationsService, + private loadingService: LoadingService, + private router: Router ) { } @@ -45,14 +57,38 @@ export class CompanyListItemComponent { } else { this.accordionGuid = undefined; } - // this.localStorageDataService.setNebAccordionGuid(this.accordionGuid); } goToCompanyDashboard() { - + this.router.navigateByUrl('/portfolio/company/' + this.company.guid); } openDeleteCompanyModal() { + this.showDeleteCompanyModal = true; + } + + closeDeleteCompanyModal() { + this.showDeleteCompanyModal = false; + } + + openCreateCopyModal() { + this.showCreateCopyModal = true; + } + + closeCreateCopyModal() { + this.showCreateCopyModal = false; + } + + confirmCreateCopy() { + //TODO... + } + async confirmDelete() { + this.showDeleteCompanyModal = false; + this.loadingService.setLoadingMessage('Deleting ' + this.company.generalInformation.name + '...'); + this.loadingService.setLoadingStatus(true); + await this.dbChangesService.deleteCompany(this.company); + this.loadingService.setLoadingStatus(false); + this.toastNotificationService.showToast('Company Deleted!', undefined, 'bg-success', true, false); } } diff --git a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html index 38cf0189..1633ee54 100644 --- a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html +++ b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html @@ -7,7 +7,8 @@
-
+

-
\ No newline at end of file +
+ diff --git a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts index c834a928..3abb3d62 100644 --- a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts +++ b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts @@ -1,5 +1,5 @@ import { Component } from '@angular/core'; -import { faBuilding, faFolderTree, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { faBuilding, faFolderTree, faPlus, IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { Subscription } from 'rxjs'; import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; import { IdbCompany } from 'src/app/models/company'; @@ -14,6 +14,7 @@ export class PortfolioItemsListComponent { faFolderTree: IconDefinition = faFolderTree; faBuilding: IconDefinition = faBuilding; + faPlus: IconDefinition = faPlus; companies: Array companiesSub: Subscription diff --git a/src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.css b/src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.css similarity index 100% rename from src/app/company-dashboard/company-dashboard-home/assessments-table/assessments-table.component.css rename to src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.css diff --git a/src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.html b/src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.html new file mode 100644 index 00000000..a6770bde --- /dev/null +++ b/src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.html @@ -0,0 +1,11 @@ +
+ +
+
+
+ +
+
+ \ No newline at end of file diff --git a/src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.spec.ts b/src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.spec.ts new file mode 100644 index 00000000..5407b7aa --- /dev/null +++ b/src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { UserPortfolioHomeComponent } from './user-portfolio-home.component'; + +describe('UserPortfolioHomeComponent', () => { + let component: UserPortfolioHomeComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [UserPortfolioHomeComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(UserPortfolioHomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.ts b/src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.ts new file mode 100644 index 00000000..f1d33287 --- /dev/null +++ b/src/app/user-portfolio/user-portfolio-home/user-portfolio-home.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-user-portfolio-home', + templateUrl: './user-portfolio-home.component.html', + styleUrl: './user-portfolio-home.component.css' +}) +export class UserPortfolioHomeComponent { + +} diff --git a/src/app/user-portfolio/user-portfolio.component.html b/src/app/user-portfolio/user-portfolio.component.html index 4b5b1ad5..420c2314 100644 --- a/src/app/user-portfolio/user-portfolio.component.html +++ b/src/app/user-portfolio/user-portfolio.component.html @@ -4,8 +4,39 @@

View a summary of the data in your system. @@ -14,15 +45,6 @@


-
- -
-
- -
-
-
- -
+
- + \ No newline at end of file diff --git a/src/app/user-portfolio/user-portfolio.component.ts b/src/app/user-portfolio/user-portfolio.component.ts index 5e4b71bd..0eeb3fb7 100644 --- a/src/app/user-portfolio/user-portfolio.component.ts +++ b/src/app/user-portfolio/user-portfolio.component.ts @@ -1,12 +1,13 @@ -import { Component } from '@angular/core'; +import { ChangeDetectorRef, Component } from '@angular/core'; +import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; import { faFolderOpen, IconDefinition } from '@fortawesome/free-solid-svg-icons'; -import { IdbOnSiteVisit } from '../models/onSiteVisit'; -import { Subscription } from 'rxjs'; -import { IdbFacility } from '../models/facility'; -import { IdbCompany } from '../models/company'; -import { OnSiteVisitIdbService } from '../indexed-db/on-site-visit-idb.service'; -import { FacilityIdbService } from '../indexed-db/facility-idb.service'; import { CompanyIdbService } from '../indexed-db/company-idb.service'; +import { FacilityIdbService } from '../indexed-db/facility-idb.service'; +import { AssessmentIdbService } from '../indexed-db/assessment-idb.service'; +import { IdbCompany } from '../models/company'; +import { IdbFacility } from '../models/facility'; +import { IdbAssessment } from '../models/assessment'; +import { Subscription } from 'rxjs'; @Component({ selector: 'app-user-portfolio', @@ -17,40 +18,82 @@ export class UserPortfolioComponent { faFolderOpen: IconDefinition = faFolderOpen; - - onSiteVisits: Array; - onSiteVisitSub: Subscription; - - facilities: Array; - facilitiesSub: Subscription; - - companies: Array; - companiesSub: Subscription; - constructor( - private onSiteVisitIdbService: OnSiteVisitIdbService, + context: 'home' | 'company' | 'facility' | 'assessment'; + company: IdbCompany; + companySub: Subscription; + facility: IdbFacility; + facilitySub: Subscription; + assessment: IdbAssessment; + assessmentSub: Subscription; + constructor(private activatedRoute: ActivatedRoute, + private router: Router, + private companyIdbService: CompanyIdbService, private facilityIdbService: FacilityIdbService, - private companyIdbService: CompanyIdbService + private assessmentIdbService: AssessmentIdbService, + private cd: ChangeDetectorRef ) { - + this.router.events.subscribe(event => { + if (event instanceof NavigationEnd) { + this.setContext(event.urlAfterRedirects); + } + }); } ngOnInit() { - this.onSiteVisitSub = this.onSiteVisitIdbService.onSiteVisits.subscribe(visits => { - this.onSiteVisits = visits; + this.setContext(this.router.url); + this.companySub = this.companyIdbService.selectedCompany.subscribe(selectedCompany => { + this.company = selectedCompany; + this.cd.detectChanges(); }); - - this.facilitiesSub = this.facilityIdbService.facilities.subscribe(facilities => { - this.facilities = facilities; + this.facilitySub = this.facilityIdbService.selectedFacility.subscribe(selectedFacility => { + this.facility = selectedFacility; + this.cd.detectChanges(); }); + this.assessmentSub = this.assessmentIdbService.selectedAssessment.subscribe(selectedAssessment => { + this.assessment = selectedAssessment; + this.cd.detectChanges(); + }) + } - this.companiesSub = this.companyIdbService.companies.subscribe(companies => { - this.companies = companies; - }); + ngOnDestroy() { + this.companySub.unsubscribe(); + this.facilitySub.unsubscribe(); + this.assessmentSub.unsubscribe(); + } + + setContext(url: string) { + if (url.includes('company')) { + this.context = 'company'; + this.facilityIdbService.selectedFacility.next(undefined); + this.assessmentIdbService.selectedAssessment.next(undefined); + } else if (url.includes('facility')) { + this.context = 'facility'; + this.assessmentIdbService.selectedAssessment.next(undefined); + } else if (url.includes('assessment')) { + this.context = 'assessment'; + } else { + this.context = 'home'; + this.facilityIdbService.selectedFacility.next(undefined); + this.assessmentIdbService.selectedAssessment.next(undefined); + this.companyIdbService.selectedCompany.next(undefined); + } } - ngOnDestroy(){ - this.onSiteVisitSub.unsubscribe(); - this.facilitiesSub.unsubscribe(); - this.companiesSub.unsubscribe(); + setValues(guid: string) { + if (this.context != 'home') { + if (this.context == 'company') { + this.assessment = undefined; + this.facility = undefined; + this.company = this.companyIdbService.getByGUID(guid); + } else if (this.context == 'facility') { + this.assessment = undefined; + this.facility = this.facilityIdbService.getByGUID(guid); + this.company = this.companyIdbService.getByGUID(this.facility.companyId); + } else if (this.context == 'assessment') { + this.assessment = this.assessmentIdbService.getByGuid(guid); + this.facility = this.facilityIdbService.getByGUID(this.assessment.facilityId); + this.company = this.companyIdbService.getByGUID(this.assessment.companyId); + } + } } } diff --git a/src/app/user-portfolio/user-portfolio.module.ts b/src/app/user-portfolio/user-portfolio.module.ts index 09a75d4e..a4ac745c 100644 --- a/src/app/user-portfolio/user-portfolio.module.ts +++ b/src/app/user-portfolio/user-portfolio.module.ts @@ -10,6 +10,9 @@ import { CompanyListItemComponent } from './portfolio-items-list/company-list-it import { FacilityListItemComponent } from './portfolio-items-list/facility-list-item/facility-list-item.component'; import { AssessmentListItemComponent } from './portfolio-items-list/assessment-list-item/assessment-list-item.component'; import { TablePaginationModule } from '../shared/table-pagination/table-pagination.module'; +import { UserPortfolioHomeComponent } from './user-portfolio-home/user-portfolio-home.component'; +import { RouterModule } from '@angular/router'; +import { CompanyDashboardComponent } from './company-dashboard/company-dashboard.component'; @NgModule({ declarations: [ @@ -19,13 +22,16 @@ import { TablePaginationModule } from '../shared/table-pagination/table-paginati PortfolioItemsListComponent, CompanyListItemComponent, FacilityListItemComponent, - AssessmentListItemComponent + AssessmentListItemComponent, + UserPortfolioHomeComponent, + CompanyDashboardComponent ], imports: [ CommonModule, FontAwesomeModule, HelperPipesModule, - TablePaginationModule + TablePaginationModule, + RouterModule ] }) From 82f4095d5b4d385ff80a02148eb0be3a53a9c212 Mon Sep 17 00:00:00 2001 From: rmroot Date: Wed, 6 Nov 2024 19:03:22 -0600 Subject: [PATCH 07/42] initial navigation between portfolio dashboards and deleted old unused components --- src/app/app-routing.module.ts | 10 +++ src/app/app.module.ts | 2 - .../assessment-dashboard-home.component.css | 0 .../assessment-dashboard-home.component.html | 50 --------------- ...ssessment-dashboard-home.component.spec.ts | 55 ---------------- .../assessment-dashboard-home.component.ts | 49 --------------- .../assessment-dashboard-tabs.component.css | 0 .../assessment-dashboard-tabs.component.html | 29 --------- ...ssessment-dashboard-tabs.component.spec.ts | 36 ----------- .../assessment-dashboard-tabs.component.ts | 35 ----------- .../assessment-dashboard.component.html | 4 -- .../assessment-dashboard.component.spec.ts | 38 ----------- .../assessment-dashboard.component.ts | 25 -------- .../assessment-dashboard.module.ts | 31 --------- .../assessment-settings.component.css | 0 .../assessment-settings.component.html | 15 ----- .../assessment-settings.component.spec.ts | 49 --------------- .../assessment-settings.component.ts | 31 --------- .../manage-assessment.component.css | 0 .../manage-assessment.component.html | 40 ------------ .../manage-assessment.component.spec.ts | 53 ---------------- .../manage-assessment.component.ts | 53 ---------------- .../assessments-table.component.css | 0 .../assessments-table.component.html | 49 --------------- .../assessments-table.component.spec.ts | 55 ---------------- .../assessments-table.component.ts | 62 ------------------ .../facility-dashboard-home.component.css | 0 .../facility-dashboard-home.component.html | 14 ----- .../facility-dashboard-home.component.spec.ts | 61 ------------------ .../facility-dashboard-home.component.ts | 51 --------------- .../facility-production-details.component.css | 0 ...facility-production-details.component.html | 44 ------------- ...ility-production-details.component.spec.ts | 25 -------- .../facility-production-details.component.ts | 22 ------- .../facility-dashboard-tabs.component.css | 0 .../facility-dashboard-tabs.component.html | 36 ----------- .../facility-dashboard-tabs.component.spec.ts | 36 ----------- .../facility-dashboard-tabs.component.ts | 37 ----------- .../facility-dashboard.component.html | 4 -- .../facility-dashboard.component.spec.ts | 33 ---------- .../facility-dashboard.component.ts | 25 -------- .../facility-dashboard.module.ts | 39 ------------ .../facility-goals.component.css | 0 .../facility-goals.component.html | 40 ------------ .../facility-goals.component.spec.ts | 44 ------------- .../facility-goals.component.ts | 22 ------- .../facility-reports.component.css | 0 .../facility-reports.component.html | 7 --- .../facility-reports.component.spec.ts | 23 ------- .../facility-reports.component.ts | 10 --- .../facility-settings.component.css | 5 -- .../facility-settings.component.html | 33 ---------- .../facility-settings.component.spec.ts | 63 ------------------- .../facility-settings.component.ts | 58 ----------------- .../assessment-dashboard.component.css | 0 .../assessment-dashboard.component.html | 11 ++++ .../assessment-dashboard.component.spec.ts | 23 +++++++ .../assessment-dashboard.component.ts | 39 ++++++++++++ .../company-dashboard.component.html | 12 +++- .../company-dashboard.component.ts | 9 +-- .../facility-dashboard.component.css | 0 .../facility-dashboard.component.html | 11 ++++ .../facility-dashboard.component.spec.ts | 23 +++++++ .../facility-dashboard.component.ts | 33 ++++++++++ .../assessment-list-item.component.html | 2 +- .../assessment-list-item.component.ts | 9 ++- .../company-list-item.component.html | 2 +- .../company-list-item.component.ts | 2 + .../facility-list-item.component.html | 2 +- .../facility-list-item.component.ts | 8 ++- .../user-portfolio.component.html | 4 +- .../user-portfolio/user-portfolio.module.ts | 6 +- 72 files changed, 191 insertions(+), 1508 deletions(-) delete mode 100644 src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.css delete mode 100644 src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.html delete mode 100644 src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.spec.ts delete mode 100644 src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.ts delete mode 100644 src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.css delete mode 100644 src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.html delete mode 100644 src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.spec.ts delete mode 100644 src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.ts delete mode 100644 src/app/assessment-dashboard/assessment-dashboard.component.html delete mode 100644 src/app/assessment-dashboard/assessment-dashboard.component.spec.ts delete mode 100644 src/app/assessment-dashboard/assessment-dashboard.component.ts delete mode 100644 src/app/assessment-dashboard/assessment-dashboard.module.ts delete mode 100644 src/app/assessment-dashboard/assessment-settings/assessment-settings.component.css delete mode 100644 src/app/assessment-dashboard/assessment-settings/assessment-settings.component.html delete mode 100644 src/app/assessment-dashboard/assessment-settings/assessment-settings.component.spec.ts delete mode 100644 src/app/assessment-dashboard/assessment-settings/assessment-settings.component.ts delete mode 100644 src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.css delete mode 100644 src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.html delete mode 100644 src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.spec.ts delete mode 100644 src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.ts delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.css delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.html delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.spec.ts delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.ts delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.css delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.html delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.spec.ts delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.ts delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.css delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.html delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.spec.ts delete mode 100644 src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.ts delete mode 100644 src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.css delete mode 100644 src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.html delete mode 100644 src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.spec.ts delete mode 100644 src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.ts delete mode 100644 src/app/facility-dashboard/facility-dashboard.component.html delete mode 100644 src/app/facility-dashboard/facility-dashboard.component.spec.ts delete mode 100644 src/app/facility-dashboard/facility-dashboard.component.ts delete mode 100644 src/app/facility-dashboard/facility-dashboard.module.ts delete mode 100644 src/app/facility-dashboard/facility-goals/facility-goals.component.css delete mode 100644 src/app/facility-dashboard/facility-goals/facility-goals.component.html delete mode 100644 src/app/facility-dashboard/facility-goals/facility-goals.component.spec.ts delete mode 100644 src/app/facility-dashboard/facility-goals/facility-goals.component.ts delete mode 100644 src/app/facility-dashboard/facility-reports/facility-reports.component.css delete mode 100644 src/app/facility-dashboard/facility-reports/facility-reports.component.html delete mode 100644 src/app/facility-dashboard/facility-reports/facility-reports.component.spec.ts delete mode 100644 src/app/facility-dashboard/facility-reports/facility-reports.component.ts delete mode 100644 src/app/facility-dashboard/facility-settings/facility-settings.component.css delete mode 100644 src/app/facility-dashboard/facility-settings/facility-settings.component.html delete mode 100644 src/app/facility-dashboard/facility-settings/facility-settings.component.spec.ts delete mode 100644 src/app/facility-dashboard/facility-settings/facility-settings.component.ts rename src/app/{ => user-portfolio}/assessment-dashboard/assessment-dashboard.component.css (100%) create mode 100644 src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.html create mode 100644 src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.spec.ts create mode 100644 src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.ts rename src/app/{ => user-portfolio}/facility-dashboard/facility-dashboard.component.css (100%) create mode 100644 src/app/user-portfolio/facility-dashboard/facility-dashboard.component.html create mode 100644 src/app/user-portfolio/facility-dashboard/facility-dashboard.component.spec.ts create mode 100644 src/app/user-portfolio/facility-dashboard/facility-dashboard.component.ts diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 3a57f943..556b634c 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -29,6 +29,8 @@ import { FacilityEnergyEquipmentSetupComponent } from './setup-wizard/pre-visit/ import { UserPortfolioComponent } from './user-portfolio/user-portfolio.component'; import { UserPortfolioHomeComponent } from './user-portfolio/user-portfolio-home/user-portfolio-home.component'; import { CompanyDashboardComponent } from './user-portfolio/company-dashboard/company-dashboard.component'; +import { FacilityDashboardComponent } from './user-portfolio/facility-dashboard/facility-dashboard.component'; +import { AssessmentDashboardComponent } from './user-portfolio/assessment-dashboard/assessment-dashboard.component'; const routes: Routes = [ { @@ -171,6 +173,14 @@ const routes: Routes = [ { path: 'company/:id', component: CompanyDashboardComponent + }, + { + path: 'facility/:id', + component: FacilityDashboardComponent + }, + { + path: 'assessment/:id', + component: AssessmentDashboardComponent } ] }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index ef19797f..47df2ee6 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -13,7 +13,6 @@ import { FormsModule } from '@angular/forms'; import { SetupWizardModule } from './setup-wizard/setup-wizard.module'; import { SidebarComponent } from './core-components/sidebar/sidebar.component'; import { HelperPipesModule } from './shared/helper-pipes/helper-pipes.module'; -import { AssessmentDashboardModule } from './assessment-dashboard/assessment-dashboard.module'; import { SetupWizardModalComponent } from './core-components/setup-wizard-modal/setup-wizard-modal.component'; import { ImportBackupModalComponent } from './core-components/import-backup-modal/import-backup-modal.component'; import { UserPortfolioModule } from './user-portfolio/user-portfolio.module'; @@ -42,7 +41,6 @@ import { ToastNotificationsComponent } from './core-components/toast-notificatio FormsModule, SetupWizardModule, HelperPipesModule, - AssessmentDashboardModule, UserPortfolioModule, PlotlyViaWindowModule ], diff --git a/src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.css b/src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.html b/src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.html deleted file mode 100644 index 3c0236cf..00000000 --- a/src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.html +++ /dev/null @@ -1,50 +0,0 @@ -
-
- -
-
-
-
- {{assessment.name}} Details -
-
- - - - - - - - - - - - - - - -
- Equipment Type - - -
- Annual Energy Use - - {{assessment.energyUse}} -
- Annual Costs - - {{assessment.cost}} -
-
-
-
-
-
-
-
\ No newline at end of file diff --git a/src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.spec.ts b/src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.spec.ts deleted file mode 100644 index 46c6ddb5..00000000 --- a/src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.spec.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { AssessmentDashboardHomeComponent } from './assessment-dashboard-home.component'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { BehaviorSubject } from 'rxjs'; -import { IdbAssessment, getNewIdbAssessment } from 'src/app/models/assessment'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { SetupWizardService } from 'src/app/setup-wizard/setup-wizard.service'; -import { RouterTestingModule } from '@angular/router/testing'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { HelperPipesModule } from 'src/app/shared/helper-pipes/helper-pipes.module'; -import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; -import { IdbOnSiteVisit } from 'src/app/models/onSiteVisit'; -import { EnergyOpportunityIdbService } from 'src/app/indexed-db/energy-opportunity-idb.service'; -import { getDefaultUnitSettings } from 'src/app/models/unitSettings'; - -describe('AssessmentDashboardHomeComponent', () => { - let component: AssessmentDashboardHomeComponent; - let fixture: ComponentFixture; - - let assessmentIdbService: Partial = { - selectedAssessment: new BehaviorSubject(getNewIdbAssessment('', '', '', getDefaultUnitSettings())) - }; - let companyIdbService: Partial = {}; - let facilityIdbService: Partial = {}; - let setupWizardService: Partial = {}; - let onSiteVisitIdbService: Partial = { - onSiteVisits: new BehaviorSubject>([]) - }; - - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [RouterTestingModule, FontAwesomeModule, HelperPipesModule], - declarations: [AssessmentDashboardHomeComponent], - providers: [ - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - { provide: CompanyIdbService, useValue: companyIdbService }, - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: SetupWizardService, useValue: setupWizardService }, - { provide: OnSiteVisitIdbService, useValue: onSiteVisitIdbService }, - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(AssessmentDashboardHomeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.ts b/src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.ts deleted file mode 100644 index 50ad99f4..00000000 --- a/src/app/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { Component } from '@angular/core'; -import { IconDefinition, faWandMagicSparkles } from '@fortawesome/free-solid-svg-icons'; -import { Subscription } from 'rxjs'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; -import { IdbAssessment } from 'src/app/models/assessment'; -import { SetupWizardService } from 'src/app/setup-wizard/setup-wizard.service'; -import { SharedDataService } from 'src/app/shared/shared-services/shared-data.service'; - -@Component({ - selector: 'app-assessment-dashboard-home', - templateUrl: './assessment-dashboard-home.component.html', - styleUrl: './assessment-dashboard-home.component.css' -}) -export class AssessmentDashboardHomeComponent { - - faWandMagicSparkles: IconDefinition = faWandMagicSparkles; - - assessment: IdbAssessment; - assessmentSub: Subscription; - - constructor(private assessmentIdbService: AssessmentIdbService, - private facilityIdbService: FacilityIdbService, - private companyIdbService: CompanyIdbService, - private onSiteVisitIdbService: OnSiteVisitIdbService, - private sharedDataService: SharedDataService - ) { - - } - - ngOnInit() { - this.assessmentSub = this.assessmentIdbService.selectedAssessment.subscribe(_selectedAssessment => { - this.assessment = _selectedAssessment; - }); - } - - ngOnDestroy() { - this.assessmentSub.unsubscribe(); - } - - openEditModal() { - this.facilityIdbService.setSelectedFromGUID(this.assessment.facilityId); - this.companyIdbService.setSelectedFromGUID(this.assessment.companyId); - this.onSiteVisitIdbService.setSelectedFromAssessmentGUID(this.assessment.guid); - this.sharedDataService.createAssessmentModalOpen.next(true); - } -} diff --git a/src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.css b/src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.html b/src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.html deleted file mode 100644 index 4854e9c0..00000000 --- a/src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.html +++ /dev/null @@ -1,29 +0,0 @@ - \ No newline at end of file diff --git a/src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.spec.ts b/src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.spec.ts deleted file mode 100644 index ef09e7a6..00000000 --- a/src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { AssessmentDashboardTabsComponent } from './assessment-dashboard-tabs.component'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { BehaviorSubject } from 'rxjs'; -import { IdbAssessment, getNewIdbAssessment } from 'src/app/models/assessment'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { RouterTestingModule } from '@angular/router/testing'; -import { getDefaultUnitSettings } from 'src/app/models/unitSettings'; - -describe('AssessmentDashboardTabsComponent', () => { - let component: AssessmentDashboardTabsComponent; - let fixture: ComponentFixture; - - let assessmentIdbService: Partial = { - selectedAssessment: new BehaviorSubject(getNewIdbAssessment('', '', '', getDefaultUnitSettings())) - }; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [RouterTestingModule, FontAwesomeModule], - declarations: [AssessmentDashboardTabsComponent], - providers: [ - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(AssessmentDashboardTabsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.ts b/src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.ts deleted file mode 100644 index a30a459b..00000000 --- a/src/app/assessment-dashboard/assessment-dashboard-tabs/assessment-dashboard-tabs.component.ts +++ /dev/null @@ -1,35 +0,0 @@ -import { Component } from '@angular/core'; -import { IconDefinition, faBuilding, faChartLine, faFileLines, faFolderOpen, faGears, faIndustry } from '@fortawesome/free-solid-svg-icons'; -import { Subscription } from 'rxjs'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { IdbAssessment } from 'src/app/models/assessment'; -@Component({ - selector: 'app-assessment-dashboard-tabs', - templateUrl: './assessment-dashboard-tabs.component.html', - styleUrl: './assessment-dashboard-tabs.component.css' -}) -export class AssessmentDashboardTabsComponent { - - faBuilding: IconDefinition = faBuilding; - faIndustry: IconDefinition = faIndustry; - faGears: IconDefinition = faGears; - faFolderOpen: IconDefinition = faFolderOpen; - faChartLine: IconDefinition = faChartLine; - faFileLines: IconDefinition = faFileLines; - - assessment: IdbAssessment; - assessmentSub: Subscription; - - constructor(private assessmentIdbService: AssessmentIdbService){ - } - - ngOnInit(){ - this.assessmentSub = this.assessmentIdbService.selectedAssessment.subscribe(_assessment => { - this.assessment = _assessment; - }); - } - - ngOnDestroy(){ - this.assessmentSub.unsubscribe(); - } -} diff --git a/src/app/assessment-dashboard/assessment-dashboard.component.html b/src/app/assessment-dashboard/assessment-dashboard.component.html deleted file mode 100644 index 6aaa11ca..00000000 --- a/src/app/assessment-dashboard/assessment-dashboard.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
- - -
\ No newline at end of file diff --git a/src/app/assessment-dashboard/assessment-dashboard.component.spec.ts b/src/app/assessment-dashboard/assessment-dashboard.component.spec.ts deleted file mode 100644 index fafb4006..00000000 --- a/src/app/assessment-dashboard/assessment-dashboard.component.spec.ts +++ /dev/null @@ -1,38 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { AssessmentDashboardComponent } from './assessment-dashboard.component'; -import { AssessmentDashboardTabsComponent } from './assessment-dashboard-tabs/assessment-dashboard-tabs.component'; -import { RouterTestingModule } from '@angular/router/testing'; -import { AssessmentIdbService } from '../indexed-db/assessment-idb.service'; -import { BehaviorSubject } from 'rxjs'; -import { IdbAssessment, getNewIdbAssessment } from '../models/assessment'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { getDefaultUnitSettings } from '../models/unitSettings'; - -describe('AssessmentDashboardComponent', () => { - let component: AssessmentDashboardComponent; - let fixture: ComponentFixture; - let assessmentIdbService: Partial = { - selectedAssessment: new BehaviorSubject(getNewIdbAssessment('', '', '', getDefaultUnitSettings())) - } - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [RouterTestingModule, FontAwesomeModule], - declarations: [AssessmentDashboardComponent, AssessmentDashboardTabsComponent], - providers:[ - { - provide: AssessmentIdbService, useValue: assessmentIdbService - } - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(AssessmentDashboardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/assessment-dashboard/assessment-dashboard.component.ts b/src/app/assessment-dashboard/assessment-dashboard.component.ts deleted file mode 100644 index 266e8422..00000000 --- a/src/app/assessment-dashboard/assessment-dashboard.component.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Component } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { AssessmentIdbService } from '../indexed-db/assessment-idb.service'; - -@Component({ - selector: 'app-assessment-dashboard', - templateUrl: './assessment-dashboard.component.html', - styleUrl: './assessment-dashboard.component.css' -}) -export class AssessmentDashboardComponent { - - constructor(private activatedRoute: ActivatedRoute, private assessmentIdbService: AssessmentIdbService, - private router: Router) { - } - - ngOnInit() { - this.activatedRoute.params.subscribe(params => { - let assessmentGUID: string = params['id']; - let assessmentExists: boolean = this.assessmentIdbService.setSelectedFromGUID(assessmentGUID); - if(!assessmentExists){ - this.router.navigateByUrl('/user'); - } - }); - } -} diff --git a/src/app/assessment-dashboard/assessment-dashboard.module.ts b/src/app/assessment-dashboard/assessment-dashboard.module.ts deleted file mode 100644 index 9e56ad9b..00000000 --- a/src/app/assessment-dashboard/assessment-dashboard.module.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { AssessmentDashboardComponent } from './assessment-dashboard.component'; -import { AssessmentDashboardHomeComponent } from './assessment-dashboard-home/assessment-dashboard-home.component'; -import { AssessmentDashboardTabsComponent } from './assessment-dashboard-tabs/assessment-dashboard-tabs.component'; -import { AssessmentSettingsComponent } from './assessment-settings/assessment-settings.component'; -import { RouterModule } from '@angular/router'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { ManageAssessmentComponent } from './assessment-settings/manage-assessment/manage-assessment.component'; -import { FormsModule } from '@angular/forms'; -import { HelperPipesModule } from '../shared/helper-pipes/helper-pipes.module'; - - - -@NgModule({ - declarations: [ - AssessmentDashboardComponent, - AssessmentDashboardHomeComponent, - AssessmentDashboardTabsComponent, - AssessmentSettingsComponent, - ManageAssessmentComponent - ], - imports: [ - CommonModule, - RouterModule, - FontAwesomeModule, - FormsModule, - HelperPipesModule - ] -}) -export class AssessmentDashboardModule { } diff --git a/src/app/assessment-dashboard/assessment-settings/assessment-settings.component.css b/src/app/assessment-dashboard/assessment-settings/assessment-settings.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/assessment-dashboard/assessment-settings/assessment-settings.component.html b/src/app/assessment-dashboard/assessment-settings/assessment-settings.component.html deleted file mode 100644 index 8038c8ab..00000000 --- a/src/app/assessment-dashboard/assessment-settings/assessment-settings.component.html +++ /dev/null @@ -1,15 +0,0 @@ -
-
-
-
-
- - -
-
-
- -
- -
\ No newline at end of file diff --git a/src/app/assessment-dashboard/assessment-settings/assessment-settings.component.spec.ts b/src/app/assessment-dashboard/assessment-settings/assessment-settings.component.spec.ts deleted file mode 100644 index 241bf80e..00000000 --- a/src/app/assessment-dashboard/assessment-settings/assessment-settings.component.spec.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { AssessmentSettingsComponent } from './assessment-settings.component'; -import { ManageAssessmentComponent } from './manage-assessment/manage-assessment.component'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { BehaviorSubject } from 'rxjs'; -import { IdbAssessment, getNewIdbAssessment } from 'src/app/models/assessment'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { FormsModule } from '@angular/forms'; -import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { getDefaultUnitSettings } from 'src/app/models/unitSettings'; - -describe('AssessmentSettingsComponent', () => { - let component: AssessmentSettingsComponent; - let fixture: ComponentFixture; - - let assessmentIdbService: Partial = { - selectedAssessment: new BehaviorSubject(getNewIdbAssessment('', '', '', getDefaultUnitSettings())) - }; - let companyIdbService: Partial = {}; - let facilityIdbService: Partial = {}; - let contactIdbService: Partial = {}; - let dbChangesService: Partial = {}; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [FontAwesomeModule, FormsModule], - declarations: [AssessmentSettingsComponent, ManageAssessmentComponent], - providers: [ - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - { provide: CompanyIdbService, useValue: companyIdbService }, - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: ContactIdbService, useValue: contactIdbService }, - { provide: DbChangesService, useValue: dbChangesService }, - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(AssessmentSettingsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/assessment-dashboard/assessment-settings/assessment-settings.component.ts b/src/app/assessment-dashboard/assessment-settings/assessment-settings.component.ts deleted file mode 100644 index a53b1e71..00000000 --- a/src/app/assessment-dashboard/assessment-settings/assessment-settings.component.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { Component } from '@angular/core'; -import { Subscription } from 'rxjs'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { IdbAssessment } from 'src/app/models/assessment'; - -@Component({ - selector: 'app-assessment-settings', - templateUrl: './assessment-settings.component.html', - styleUrl: './assessment-settings.component.css' -}) -export class AssessmentSettingsComponent { - selectedAssessment: IdbAssessment; - selectedAssessmentSub: Subscription; - constructor(private assessmentIdbService: AssessmentIdbService) { - } - - ngOnInit() { - this.selectedAssessmentSub = this.assessmentIdbService.selectedAssessment.subscribe(_assessment => { - this.selectedAssessment = _assessment; - }); - } - - ngOnDestroy() { - this.selectedAssessmentSub.unsubscribe(); - } - - - async saveChanges(){ - await this.assessmentIdbService.asyncUpdate(this.selectedAssessment); - } -} diff --git a/src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.css b/src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.html b/src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.html deleted file mode 100644 index 3ed7d71e..00000000 --- a/src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.html +++ /dev/null @@ -1,40 +0,0 @@ - -
-
-

- -

-
-
- -
-
-
-
- - - -
- \ No newline at end of file diff --git a/src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.spec.ts b/src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.spec.ts deleted file mode 100644 index dfaa97d5..00000000 --- a/src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.spec.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ManageAssessmentComponent } from './manage-assessment.component'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { BehaviorSubject } from 'rxjs'; -import { IdbAssessment, getNewIdbAssessment } from 'src/app/models/assessment'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service'; -import { NonEnergyBenefitsIdbService } from 'src/app/indexed-db/non-energy-benefits-idb.service'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { EnergyOpportunityIdbService } from 'src/app/indexed-db/energy-opportunity-idb.service'; -import { getDefaultUnitSettings } from 'src/app/models/unitSettings'; - -describe('ManageAssessmentComponent', () => { - let component: ManageAssessmentComponent; - let fixture: ComponentFixture; - let assessmentIdbService: Partial = { - selectedAssessment: new BehaviorSubject(getNewIdbAssessment('', '', '', getDefaultUnitSettings())), - assessments: new BehaviorSubject>([]) - }; - let companyIdbService: Partial = {}; - let facilityIdbService: Partial = {}; - let energyOpportunityIdbService: Partial = {}; - let contactIdbService: Partial = {}; - let nonEnergyBenefitsIdbService: Partial = {} - let dbChangesService: Partial = {} - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [FontAwesomeModule], - declarations: [ManageAssessmentComponent], - providers: [ - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - { provide: CompanyIdbService, useValue: companyIdbService }, - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: EnergyOpportunityIdbService, useValue: energyOpportunityIdbService }, - { provide: ContactIdbService, useValue: contactIdbService }, - { provide: NonEnergyBenefitsIdbService, useValue: nonEnergyBenefitsIdbService }, - { provide: DbChangesService, useValue: dbChangesService } - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(ManageAssessmentComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.ts b/src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.ts deleted file mode 100644 index 8accdaf3..00000000 --- a/src/app/assessment-dashboard/assessment-settings/manage-assessment/manage-assessment.component.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; -import { IconDefinition, faPenToSquare, faTrash } from '@fortawesome/free-solid-svg-icons'; -import { Subscription } from 'rxjs'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { IdbAssessment } from 'src/app/models/assessment'; - -@Component({ - selector: 'app-manage-assessment', - templateUrl: './manage-assessment.component.html', - styleUrl: './manage-assessment.component.css' -}) -export class ManageAssessmentComponent { - - faPenToSquare: IconDefinition = faPenToSquare; - faTrash: IconDefinition = faTrash; - - accordionOpen: boolean = false; - assessment: IdbAssessment; - assessmentSub: Subscription; - displayDeleteModal: boolean = false; - constructor(private assessmentIdbService: AssessmentIdbService, - private dbChangesService: DbChangesService, private router: Router) { - } - - ngOnInit() { - this.assessmentSub = this.assessmentIdbService.selectedAssessment.subscribe(_assessment => { - this.assessment = _assessment; - }); - } - - ngOnDestroy() { - this.assessmentSub.unsubscribe(); - } - - toggleAccordion() { - this.accordionOpen = !this.accordionOpen; - } - - openDeleteModal() { - this.displayDeleteModal = true; - } - - closeDeleteModal() { - this.displayDeleteModal = false; - } - - async confirmDelete() { - await this.dbChangesService.deleteAssessment(this.assessment); - this.router.navigateByUrl('/user') - } -} diff --git a/src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.css b/src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.html b/src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.html deleted file mode 100644 index 2fe84d5a..00000000 --- a/src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.html +++ /dev/null @@ -1,49 +0,0 @@ -
-
- - - Assessments - - -
-
- - - - - - - - - - - - - - - - -
- Name - - Visit Date -
- - {{assessment.name}} - - - - {{assessment.visitDate | date:'shortDate'}} - -
-
- - -
- No assessments found. Please click "Add New" to get started. -
-
-
-
\ No newline at end of file diff --git a/src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.spec.ts b/src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.spec.ts deleted file mode 100644 index eac829fc..00000000 --- a/src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.spec.ts +++ /dev/null @@ -1,55 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { AssessmentsTableComponent } from './assessments-table.component'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { IdbAssessment, getNewIdbAssessment } from 'src/app/models/assessment'; -import { BehaviorSubject } from 'rxjs'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { SetupWizardService } from 'src/app/setup-wizard/setup-wizard.service'; -import { HelperPipesModule } from 'src/app/shared/helper-pipes/helper-pipes.module'; -import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; -import { IdbOnSiteVisit } from 'src/app/models/onSiteVisit'; -import { getDefaultUnitSettings } from 'src/app/models/unitSettings'; - -describe('AssessmentsTableComponent', () => { - let component: AssessmentsTableComponent; - let fixture: ComponentFixture; - - let assessmentIdbService: Partial = { - selectedAssessment: new BehaviorSubject(getNewIdbAssessment('', '', '', getDefaultUnitSettings())), - assessments: new BehaviorSubject>([]) - }; - let facilityIdbService: Partial = { - selectedFacility: new BehaviorSubject(getNewIdbFacility('', '')) - }; - let companyIdbService: Partial = {}; - let setupWizardService: Partial = {}; - let onSiteVisitIdbService: Partial = { - onSiteVisits: new BehaviorSubject>([]) - }; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [FontAwesomeModule, HelperPipesModule], - declarations: [AssessmentsTableComponent], - providers: [ - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: CompanyIdbService, useValue: companyIdbService }, - { provide: SetupWizardService, useValue: setupWizardService }, - { provide: OnSiteVisitIdbService, useValue: onSiteVisitIdbService }, - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(AssessmentsTableComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.ts b/src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.ts deleted file mode 100644 index bb797d89..00000000 --- a/src/app/facility-dashboard/facility-dashboard-home/assessments-table/assessments-table.component.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; -import { IconDefinition, faFileLines, faWandMagicSparkles } from '@fortawesome/free-solid-svg-icons'; -import { Subscription } from 'rxjs'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; -import { IdbAssessment } from 'src/app/models/assessment'; -import { IdbFacility } from 'src/app/models/facility'; -import { SharedDataService } from 'src/app/shared/shared-services/shared-data.service'; - -@Component({ - selector: 'app-assessments-table', - templateUrl: './assessments-table.component.html', - styleUrl: './assessments-table.component.css' -}) -export class AssessmentsTableComponent { - faWandMagicSparkles: IconDefinition = faWandMagicSparkles; - faFileLines: IconDefinition = faFileLines; - - facility: IdbFacility; - facilitiesSub: Subscription; - - assessments: Array; - assessmentsSub: Subscription; - - constructor( - private facilityIdbService: FacilityIdbService, - private assessmentIdbService: AssessmentIdbService, - private sharedDataService: SharedDataService, - private companyIdbService: CompanyIdbService, - private onSiteVisitIdbService: OnSiteVisitIdbService) { - } - - ngOnInit() { - this.facilitiesSub = this.facilityIdbService.selectedFacility.subscribe(_facility => { - this.facility = _facility; - }); - this.assessmentsSub = this.assessmentIdbService.assessments.subscribe(_assessments => { - this.assessments = _assessments; - }); - } - - ngOnDestroy() { - this.facilitiesSub.unsubscribe(); - this.assessmentsSub.unsubscribe(); - } - - openAddNewModal() { - this.companyIdbService.setSelectedFromGUID(this.facility.companyId); - this.onSiteVisitIdbService.selectedVisit.next(undefined); - this.sharedDataService.createAssessmentModalOpen.next(true); - } - - goToVisit(assessment: IdbAssessment) { - this.companyIdbService.setSelectedFromGUID(assessment.companyId); - this.facilityIdbService.setSelectedFromGUID(assessment.facilityId); - this.onSiteVisitIdbService.setSelectedFromAssessmentGUID(assessment.guid); - this.sharedDataService.createAssessmentModalOpen.next(true); - } -} diff --git a/src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.css b/src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.html b/src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.html deleted file mode 100644 index 89341c1c..00000000 --- a/src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.html +++ /dev/null @@ -1,14 +0,0 @@ -
-
- -
-
- -
-
\ No newline at end of file diff --git a/src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.spec.ts b/src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.spec.ts deleted file mode 100644 index f9a95b52..00000000 --- a/src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.spec.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { FacilityDashboardHomeComponent } from './facility-dashboard-home.component'; -import { RouterTestingModule } from '@angular/router/testing'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { BehaviorSubject } from 'rxjs'; -import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility'; -import { HelperPipesModule } from 'src/app/shared/helper-pipes/helper-pipes.module'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { IdbCompany } from 'src/app/models/company'; -import { FormsModule } from '@angular/forms'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { AssessmentsTableComponent } from './assessments-table/assessments-table.component'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { IdbAssessment } from 'src/app/models/assessment'; -import { UserIdbService } from 'src/app/indexed-db/user-idb.service'; -import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; -import { IdbOnSiteVisit } from 'src/app/models/onSiteVisit'; - -describe('FacilityDashboardHomeComponent', () => { - let component: FacilityDashboardHomeComponent; - let fixture: ComponentFixture; - let facilityIdbService: Partial = { - selectedFacility: new BehaviorSubject(getNewIdbFacility('', '')) - } - let dbChangesService: Partial = {} - let companyIdbService: Partial = { - companies: new BehaviorSubject>([]) - }; - let assessmentIdbService: Partial = { - selectedAssessment: new BehaviorSubject(undefined), - assessments: new BehaviorSubject>([]) - }; - let userIdbService: Partial = {}; - let onSiteVisitIdbService: Partial = { - onSiteVisits: new BehaviorSubject>([]) - }; - - beforeEach(() => { - TestBed.configureTestingModule({ - imports: [RouterTestingModule, HelperPipesModule, FormsModule, FontAwesomeModule], - declarations: [FacilityDashboardHomeComponent, AssessmentsTableComponent], - providers: [ - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: DbChangesService, useValue: dbChangesService }, - { provide: CompanyIdbService, useValue: companyIdbService }, - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - { provide: UserIdbService, useValue: userIdbService }, - { provide: OnSiteVisitIdbService, useValue: onSiteVisitIdbService }, - ] - }); - fixture = TestBed.createComponent(FacilityDashboardHomeComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.ts b/src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.ts deleted file mode 100644 index a596f5c7..00000000 --- a/src/app/facility-dashboard/facility-dashboard-home/facility-dashboard-home.component.ts +++ /dev/null @@ -1,51 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; -import { IconDefinition, faBuilding, faIndustry } from '@fortawesome/free-solid-svg-icons'; -import { Subscription } from 'rxjs'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { IdbCompany } from 'src/app/models/company'; -import { IdbFacility } from 'src/app/models/facility'; - -@Component({ - selector: 'app-facility-dashboard-home', - templateUrl: './facility-dashboard-home.component.html', - styleUrls: ['./facility-dashboard-home.component.css'] -}) -export class FacilityDashboardHomeComponent { - - faBuilding: IconDefinition = faBuilding; - faIndustry: IconDefinition = faIndustry; - selectedFacility: IdbFacility; - selectedFacilitySub: Subscription; - - companies: Array; - companiesSub: Subscription; - constructor(private facilityIdbService: FacilityIdbService, - private dbChangesService: DbChangesService, - private router: Router, - private companyIdbService: CompanyIdbService) { - } - - ngOnInit() { - this.selectedFacilitySub = this.facilityIdbService.selectedFacility.subscribe(_facility => { - this.selectedFacility = _facility; - }); - - this.companiesSub = this.companyIdbService.companies.subscribe(_companies => { - this.companies = _companies; - }); - } - - ngOnDestroy() { - this.selectedFacilitySub.unsubscribe(); - this.companiesSub.unsubscribe(); - } - - - async deleteFacility() { - this.dbChangesService.deleteFacility(this.selectedFacility); - this.router.navigateByUrl('/user/company/' + this.selectedFacility.companyId); - } -} diff --git a/src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.css b/src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.html b/src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.html deleted file mode 100644 index fdc74ff2..00000000 --- a/src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.html +++ /dev/null @@ -1,44 +0,0 @@ -
-
-

- -

-
-
- -
-
- Annual Sales -
- -
-
-
- Output Levels -
- -
-
-
- Significant Process / Functional Areas -
- -
-
-
- Raw Materials Used -
- -
- -
-
-
-
- diff --git a/src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.spec.ts b/src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.spec.ts deleted file mode 100644 index 6951f0aa..00000000 --- a/src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.spec.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { FacilityProductionDetailsComponent } from './facility-production-details.component'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; - -describe('FacilityProductionDetailsComponent', () => { - let component: FacilityProductionDetailsComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [FontAwesomeModule], - declarations: [FacilityProductionDetailsComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(FacilityProductionDetailsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.ts b/src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.ts deleted file mode 100644 index 877dc2bb..00000000 --- a/src/app/facility-dashboard/facility-dashboard-home/facility-production-details/facility-production-details.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Component } from '@angular/core'; -import { IconDefinition, faClipboardCheck, faClipboardList } from '@fortawesome/free-solid-svg-icons'; - -@Component({ - selector: 'app-facility-production-details', - templateUrl: './facility-production-details.component.html', - styleUrl: './facility-production-details.component.css' -}) -export class FacilityProductionDetailsComponent { - - faClipboardList: IconDefinition = faClipboardList; - accordionOpen: boolean = false; - - - constructor(){ - - } - - toggleAccordion(){ - this.accordionOpen = !this.accordionOpen; - } -} diff --git a/src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.css b/src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.html b/src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.html deleted file mode 100644 index 754fe77a..00000000 --- a/src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.html +++ /dev/null @@ -1,36 +0,0 @@ - \ No newline at end of file diff --git a/src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.spec.ts b/src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.spec.ts deleted file mode 100644 index 1d06666e..00000000 --- a/src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.spec.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { FacilityDashboardTabsComponent } from './facility-dashboard-tabs.component'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility'; -import { BehaviorSubject } from 'rxjs'; -import { RouterTestingModule } from '@angular/router/testing'; - -describe('FacilityDashboardTabsComponent', () => { - let component: FacilityDashboardTabsComponent; - let fixture: ComponentFixture; - - let facilityIdbService: Partial = { - facilities: new BehaviorSubject>([]), - selectedFacility: new BehaviorSubject(getNewIdbFacility('', '')) - }; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [FontAwesomeModule, RouterTestingModule], - declarations: [FacilityDashboardTabsComponent], - providers: [ - { provide: FacilityIdbService, useValue: facilityIdbService } - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(FacilityDashboardTabsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.ts b/src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.ts deleted file mode 100644 index 2bd555ae..00000000 --- a/src/app/facility-dashboard/facility-dashboard-tabs/facility-dashboard-tabs.component.ts +++ /dev/null @@ -1,37 +0,0 @@ -import { Component } from '@angular/core'; -import { IconDefinition, faBuilding, faBullseye, faChartLine, faFolderOpen, faGears, faIndustry } from '@fortawesome/free-solid-svg-icons'; -import { Subscription } from 'rxjs'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { IdbFacility } from 'src/app/models/facility'; - -@Component({ - selector: 'app-facility-dashboard-tabs', - templateUrl: './facility-dashboard-tabs.component.html', - styleUrl: './facility-dashboard-tabs.component.css' -}) -export class FacilityDashboardTabsComponent { - - - faBuilding: IconDefinition = faBuilding; - faIndustry: IconDefinition = faIndustry; - faGears: IconDefinition = faGears; - faFolderOpen: IconDefinition = faFolderOpen; - faChartLine: IconDefinition = faChartLine - faBullseye: IconDefinition = faBullseye; - - facility: IdbFacility; - facilitySub: Subscription; - - constructor(private facilityIdbService: FacilityIdbService){ - } - - ngOnInit(){ - this.facilitySub = this.facilityIdbService.selectedFacility.subscribe(_facility => { - this.facility = _facility; - }); - } - - ngOnDestroy(){ - this.facilitySub.unsubscribe(); - } -} diff --git a/src/app/facility-dashboard/facility-dashboard.component.html b/src/app/facility-dashboard/facility-dashboard.component.html deleted file mode 100644 index f535f84f..00000000 --- a/src/app/facility-dashboard/facility-dashboard.component.html +++ /dev/null @@ -1,4 +0,0 @@ -
- - -
\ No newline at end of file diff --git a/src/app/facility-dashboard/facility-dashboard.component.spec.ts b/src/app/facility-dashboard/facility-dashboard.component.spec.ts deleted file mode 100644 index b4687a4c..00000000 --- a/src/app/facility-dashboard/facility-dashboard.component.spec.ts +++ /dev/null @@ -1,33 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { FacilityDashboardComponent } from './facility-dashboard.component'; -import { RouterTestingModule } from '@angular/router/testing'; -import { FacilityIdbService } from '../indexed-db/facility-idb.service'; -import { FacilityDashboardTabsComponent } from './facility-dashboard-tabs/facility-dashboard-tabs.component'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { BehaviorSubject } from 'rxjs'; -import { IdbFacility, getNewIdbFacility } from '../models/facility'; - -describe('FacilityDashboardComponent', () => { - let component: FacilityDashboardComponent; - let fixture: ComponentFixture; - - beforeEach(() => { - let facilityIdbService: Partial = { - facilities: new BehaviorSubject>([]), - selectedFacility: new BehaviorSubject(getNewIdbFacility('', '')) - }; - TestBed.configureTestingModule({ - imports: [RouterTestingModule, FontAwesomeModule], - declarations: [FacilityDashboardComponent, FacilityDashboardTabsComponent], - providers: [{ provide: FacilityIdbService, useValue: facilityIdbService }] - }); - fixture = TestBed.createComponent(FacilityDashboardComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/facility-dashboard/facility-dashboard.component.ts b/src/app/facility-dashboard/facility-dashboard.component.ts deleted file mode 100644 index 063cd260..00000000 --- a/src/app/facility-dashboard/facility-dashboard.component.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { Component } from '@angular/core'; -import { ActivatedRoute, Router } from '@angular/router'; -import { FacilityIdbService } from '../indexed-db/facility-idb.service'; - -@Component({ - selector: 'app-facility-dashboard', - templateUrl: './facility-dashboard.component.html', - styleUrls: ['./facility-dashboard.component.css'] -}) -export class FacilityDashboardComponent { - - constructor(private activatedRoute: ActivatedRoute, private facilityIdbService: FacilityIdbService, - private router: Router) { - } - - ngOnInit() { - this.activatedRoute.params.subscribe(params => { - let facilityGUID: string = params['id']; - let facilityExists: boolean = this.facilityIdbService.setSelectedFromGUID(facilityGUID); - if(!facilityExists){ - this.router.navigateByUrl('/user'); - } - }); - } -} diff --git a/src/app/facility-dashboard/facility-dashboard.module.ts b/src/app/facility-dashboard/facility-dashboard.module.ts deleted file mode 100644 index 5b29992b..00000000 --- a/src/app/facility-dashboard/facility-dashboard.module.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FacilityDashboardComponent } from './facility-dashboard.component'; -import { FacilityDashboardHomeComponent } from './facility-dashboard-home/facility-dashboard-home.component'; -import { RouterModule } from '@angular/router'; -import { FormsModule } from '@angular/forms'; -import { HelperPipesModule } from '../shared/helper-pipes/helper-pipes.module'; -import { SharedSettingsFormsModule } from '../shared/shared-settings-forms/shared-settings-forms.module'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { FacilityProductionDetailsComponent } from './facility-dashboard-home/facility-production-details/facility-production-details.component'; -import { FacilityDashboardTabsComponent } from './facility-dashboard-tabs/facility-dashboard-tabs.component'; -import { FacilitySettingsComponent } from './facility-settings/facility-settings.component'; -import { FacilityReportsComponent } from './facility-reports/facility-reports.component'; -import { FacilityGoalsComponent } from './facility-goals/facility-goals.component'; -import { AssessmentsTableComponent } from './facility-dashboard-home/assessments-table/assessments-table.component'; - - - -@NgModule({ - declarations: [ - FacilityDashboardComponent, - FacilityDashboardHomeComponent, - FacilityProductionDetailsComponent, - FacilityDashboardTabsComponent, - FacilitySettingsComponent, - FacilityReportsComponent, - FacilityGoalsComponent, - AssessmentsTableComponent - ], - imports: [ - CommonModule, - RouterModule, - FormsModule, - HelperPipesModule, - SharedSettingsFormsModule, - FontAwesomeModule - ] -}) -export class FacilityDashboardModule { } diff --git a/src/app/facility-dashboard/facility-goals/facility-goals.component.css b/src/app/facility-dashboard/facility-goals/facility-goals.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/facility-dashboard/facility-goals/facility-goals.component.html b/src/app/facility-dashboard/facility-goals/facility-goals.component.html deleted file mode 100644 index c7973645..00000000 --- a/src/app/facility-dashboard/facility-goals/facility-goals.component.html +++ /dev/null @@ -1,40 +0,0 @@ -
-
-
-
-

- -

-
-
- -
-
- Strategic Goals -
- -
-
-
- Sustainability Goals -
- -
-
-
- Marketing Goals -
- -
-
-
-
-
-
-
\ No newline at end of file diff --git a/src/app/facility-dashboard/facility-goals/facility-goals.component.spec.ts b/src/app/facility-dashboard/facility-goals/facility-goals.component.spec.ts deleted file mode 100644 index 8ed207d0..00000000 --- a/src/app/facility-dashboard/facility-goals/facility-goals.component.spec.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { FacilityGoalsComponent } from './facility-goals.component'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility'; -import { BehaviorSubject } from 'rxjs'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { IdbCompany, getNewIdbCompany } from 'src/app/models/company'; - -describe('FacilityGoalsComponent', () => { - let component: FacilityGoalsComponent; - let fixture: ComponentFixture; - - let facilityIdbService: Partial = { - facilities: new BehaviorSubject>([]), - selectedFacility: new BehaviorSubject(getNewIdbFacility('', '')) - }; - let companyIdbService: Partial = { - companies: new BehaviorSubject>([]), - selectedCompany: new BehaviorSubject(getNewIdbCompany('')) - }; - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [FontAwesomeModule], - declarations: [FacilityGoalsComponent], - providers: [ - { provide: CompanyIdbService, useValue: companyIdbService }, - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: DbChangesService, useValue: {}} - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(FacilityGoalsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/facility-dashboard/facility-goals/facility-goals.component.ts b/src/app/facility-dashboard/facility-goals/facility-goals.component.ts deleted file mode 100644 index 4d6359ab..00000000 --- a/src/app/facility-dashboard/facility-goals/facility-goals.component.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { Component } from '@angular/core'; -import { IconDefinition, faBullseye } from '@fortawesome/free-solid-svg-icons'; - -@Component({ - selector: 'app-facility-goals', - templateUrl: './facility-goals.component.html', - styleUrl: './facility-goals.component.css' -}) -export class FacilityGoalsComponent { - - faBullseye: IconDefinition = faBullseye; - accordionOpen: boolean = false; - - - constructor(){ - - } - - toggleAccordion(){ - this.accordionOpen = !this.accordionOpen; - } -} diff --git a/src/app/facility-dashboard/facility-reports/facility-reports.component.css b/src/app/facility-dashboard/facility-reports/facility-reports.component.css deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/facility-dashboard/facility-reports/facility-reports.component.html b/src/app/facility-dashboard/facility-reports/facility-reports.component.html deleted file mode 100644 index 76301bbb..00000000 --- a/src/app/facility-dashboard/facility-reports/facility-reports.component.html +++ /dev/null @@ -1,7 +0,0 @@ -
-
-
- Facility reports content goes here.. -
-
-
\ No newline at end of file diff --git a/src/app/facility-dashboard/facility-reports/facility-reports.component.spec.ts b/src/app/facility-dashboard/facility-reports/facility-reports.component.spec.ts deleted file mode 100644 index 9cdc9210..00000000 --- a/src/app/facility-dashboard/facility-reports/facility-reports.component.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { FacilityReportsComponent } from './facility-reports.component'; - -describe('FacilityReportsComponent', () => { - let component: FacilityReportsComponent; - let fixture: ComponentFixture; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - declarations: [FacilityReportsComponent] - }) - .compileComponents(); - - fixture = TestBed.createComponent(FacilityReportsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/facility-dashboard/facility-reports/facility-reports.component.ts b/src/app/facility-dashboard/facility-reports/facility-reports.component.ts deleted file mode 100644 index 640a9c21..00000000 --- a/src/app/facility-dashboard/facility-reports/facility-reports.component.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { Component } from '@angular/core'; - -@Component({ - selector: 'app-facility-reports', - templateUrl: './facility-reports.component.html', - styleUrl: './facility-reports.component.css' -}) -export class FacilityReportsComponent { - -} diff --git a/src/app/facility-dashboard/facility-settings/facility-settings.component.css b/src/app/facility-dashboard/facility-settings/facility-settings.component.css deleted file mode 100644 index 2d909ba7..00000000 --- a/src/app/facility-dashboard/facility-settings/facility-settings.component.css +++ /dev/null @@ -1,5 +0,0 @@ -.settings-content{ - height: calc(100% - 3rem); - /* background-color: red; */ - overflow-y: auto; -} \ No newline at end of file diff --git a/src/app/facility-dashboard/facility-settings/facility-settings.component.html b/src/app/facility-dashboard/facility-settings/facility-settings.component.html deleted file mode 100644 index fc64df77..00000000 --- a/src/app/facility-dashboard/facility-settings/facility-settings.component.html +++ /dev/null @@ -1,33 +0,0 @@ -
-
-
-
-
- Facility Details -
-
-
- - -
-
- - -
- - -
- - -
- -
- -
-
-
-
-
\ No newline at end of file diff --git a/src/app/facility-dashboard/facility-settings/facility-settings.component.spec.ts b/src/app/facility-dashboard/facility-settings/facility-settings.component.spec.ts deleted file mode 100644 index 70e7f4d1..00000000 --- a/src/app/facility-dashboard/facility-settings/facility-settings.component.spec.ts +++ /dev/null @@ -1,63 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { FacilitySettingsComponent } from './facility-settings.component'; -import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { SharedSettingsFormsModule } from 'src/app/shared/shared-settings-forms/shared-settings-forms.module'; -import { FormsModule } from '@angular/forms'; -import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { IdbCompany, getNewIdbCompany } from 'src/app/models/company'; -import { BehaviorSubject } from 'rxjs'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility'; -import { LocalStorageDataService } from 'src/app/shared/shared-services/local-storage-data.service'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { UserIdbService } from 'src/app/indexed-db/user-idb.service'; -import { PreAssessmentSetupService } from 'src/app/setup-wizard/pre-visit/pre-assessment-setup/pre-assessment-setup.service'; -import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; -import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; -import { EnergyEquipmentIdbService } from 'src/app/indexed-db/energy-equipment-idb.service'; - -describe('FacilitySettingsComponent', () => { - let component: FacilitySettingsComponent; - let fixture: ComponentFixture; - let companyIdbService: Partial = { - companies: new BehaviorSubject>([]), - selectedCompany: new BehaviorSubject(getNewIdbCompany('')) - }; - let facilityIdbService: Partial = { - facilities: new BehaviorSubject>([]), - selectedFacility: new BehaviorSubject(getNewIdbFacility('', '')) - }; - let userIdbService: Partial = {}; - let onsiteVisitIdbService: Partial = {}; - let preAassessmentSetupService: Partial = {}; - let assessmentIdbService: Partial = {}; - let energyEquipmentIdbService: Partial = {}; - - beforeEach(async () => { - await TestBed.configureTestingModule({ - imports: [FontAwesomeModule, SharedSettingsFormsModule, FormsModule], - declarations: [FacilitySettingsComponent], - providers: [ - { provide: CompanyIdbService, useValue: companyIdbService }, - { provide: FacilityIdbService, useValue: facilityIdbService }, - { provide: LocalStorageDataService, useValue: {}}, - { provide: DbChangesService, useValue: {}}, - { provide: UserIdbService, useValue: userIdbService}, - { provide: OnSiteVisitIdbService, useValue: onsiteVisitIdbService}, - { provide: PreAssessmentSetupService, useValue: preAassessmentSetupService }, - { provide: AssessmentIdbService, useValue: assessmentIdbService }, - { provide: EnergyEquipmentIdbService, useValue: energyEquipmentIdbService } - ] - }) - .compileComponents(); - - fixture = TestBed.createComponent(FacilitySettingsComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/app/facility-dashboard/facility-settings/facility-settings.component.ts b/src/app/facility-dashboard/facility-settings/facility-settings.component.ts deleted file mode 100644 index d3c630bc..00000000 --- a/src/app/facility-dashboard/facility-settings/facility-settings.component.ts +++ /dev/null @@ -1,58 +0,0 @@ -import { Component } from '@angular/core'; -import { Router } from '@angular/router'; -import { IconDefinition, faIndustry, faTrash } from '@fortawesome/free-solid-svg-icons'; -import { Subscription } from 'rxjs'; -import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; -import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; -import { IdbFacility } from 'src/app/models/facility'; - -@Component({ - selector: 'app-facility-settings', - templateUrl: './facility-settings.component.html', - styleUrl: './facility-settings.component.css' -}) -export class FacilitySettingsComponent { - - faTrash: IconDefinition = faTrash; - faIndustry: IconDefinition = faIndustry; - - facility: IdbFacility; - facilitySub: Subscription; - displayDeleteModal: boolean = false; - isFormChange: boolean = false; - constructor(private facilityIdbService: FacilityIdbService, - private dbChangesService: DbChangesService, private router: Router) { - } - - ngOnInit() { - this.facilitySub = this.facilityIdbService.selectedFacility.subscribe(_facility => { - if (!this.isFormChange) { - this.facility = _facility; - } else { - this.facility = undefined; - } - }); - } - - ngOnDestroy() { - this.facilitySub.unsubscribe(); - } - - async saveChanges() { - this.isFormChange = true; - await this.facilityIdbService.asyncUpdate(this.facility); - } - - openDeleteModal() { - this.displayDeleteModal = true; - } - - closeDeleteModal() { - this.displayDeleteModal = false; - } - - async confirmDelete() { - await this.dbChangesService.deleteFacility(this.facility); - this.router.navigateByUrl('/user') - } -} diff --git a/src/app/assessment-dashboard/assessment-dashboard.component.css b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.css similarity index 100% rename from src/app/assessment-dashboard/assessment-dashboard.component.css rename to src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.css diff --git a/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.html b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.html new file mode 100644 index 00000000..37436199 --- /dev/null +++ b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.html @@ -0,0 +1,11 @@ +
+
+
+
+ + {{assessment.name}} +
+
+ +
+
\ No newline at end of file diff --git a/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.spec.ts b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.spec.ts new file mode 100644 index 00000000..4684b667 --- /dev/null +++ b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { AssessmentDashboardComponent } from './assessment-dashboard.component'; + +describe('AssessmentDashboardComponent', () => { + let component: AssessmentDashboardComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [AssessmentDashboardComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(AssessmentDashboardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.ts b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.ts new file mode 100644 index 00000000..8b9452af --- /dev/null +++ b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.ts @@ -0,0 +1,39 @@ +import { Component } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { faFileLines, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; +import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; +import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; +import { IdbAssessment } from 'src/app/models/assessment'; +import { IdbCompany } from 'src/app/models/company'; +import { IdbFacility } from 'src/app/models/facility'; + +@Component({ + selector: 'app-assessment-dashboard', + templateUrl: './assessment-dashboard.component.html', + styleUrl: './assessment-dashboard.component.css' +}) +export class AssessmentDashboardComponent { + + faFileLines: IconDefinition = faFileLines + assessment: IdbAssessment + constructor(private activatedRoute: ActivatedRoute, + private companyIdbService: CompanyIdbService, + private facilityIdbService: FacilityIdbService, + private assessmentIdbService: AssessmentIdbService + ) { + + } + + ngOnInit() { + this.activatedRoute.params.subscribe(params => { + let guid: string = params['id']; + this.assessment = this.assessmentIdbService.getByGuid(guid); + this.assessmentIdbService.selectedAssessment.next(this.assessment); + let facility: IdbFacility = this.facilityIdbService.getByGUID(this.assessment.facilityId); + this.facilityIdbService.selectedFacility.next(facility); + let company: IdbCompany = this.companyIdbService.getByGUID(this.assessment.companyId); + this.companyIdbService.selectedCompany.next(company); + }); + } +} diff --git a/src/app/user-portfolio/company-dashboard/company-dashboard.component.html b/src/app/user-portfolio/company-dashboard/company-dashboard.component.html index 09628b79..1fe2016e 100644 --- a/src/app/user-portfolio/company-dashboard/company-dashboard.component.html +++ b/src/app/user-portfolio/company-dashboard/company-dashboard.component.html @@ -1 +1,11 @@ -

company-dashboard works!

+
+
+
+
+ + {{company.generalInformation.name}} +
+
+ +
+
\ No newline at end of file diff --git a/src/app/user-portfolio/company-dashboard/company-dashboard.component.ts b/src/app/user-portfolio/company-dashboard/company-dashboard.component.ts index 71f452b8..3052ba14 100644 --- a/src/app/user-portfolio/company-dashboard/company-dashboard.component.ts +++ b/src/app/user-portfolio/company-dashboard/company-dashboard.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; +import { faBuilding, IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; import { IdbCompany } from 'src/app/models/company'; @@ -10,7 +11,8 @@ import { IdbCompany } from 'src/app/models/company'; }) export class CompanyDashboardComponent { - + faBuilding: IconDefinition = faBuilding; + company: IdbCompany; constructor(private activatedRoute: ActivatedRoute, private companyIdbService: CompanyIdbService ) { @@ -19,10 +21,9 @@ export class CompanyDashboardComponent { ngOnInit() { this.activatedRoute.params.subscribe(params => { - console.log(params); let guid: string = params['id']; - let company: IdbCompany = this.companyIdbService.getByGUID(guid); - this.companyIdbService.selectedCompany.next(company); + this.company = this.companyIdbService.getByGUID(guid); + this.companyIdbService.selectedCompany.next(this.company); }); } } diff --git a/src/app/facility-dashboard/facility-dashboard.component.css b/src/app/user-portfolio/facility-dashboard/facility-dashboard.component.css similarity index 100% rename from src/app/facility-dashboard/facility-dashboard.component.css rename to src/app/user-portfolio/facility-dashboard/facility-dashboard.component.css diff --git a/src/app/user-portfolio/facility-dashboard/facility-dashboard.component.html b/src/app/user-portfolio/facility-dashboard/facility-dashboard.component.html new file mode 100644 index 00000000..52c58e04 --- /dev/null +++ b/src/app/user-portfolio/facility-dashboard/facility-dashboard.component.html @@ -0,0 +1,11 @@ +
+
+
+
+ + {{facility.generalInformation.name}} +
+
+ +
+
\ No newline at end of file diff --git a/src/app/user-portfolio/facility-dashboard/facility-dashboard.component.spec.ts b/src/app/user-portfolio/facility-dashboard/facility-dashboard.component.spec.ts new file mode 100644 index 00000000..bacf4709 --- /dev/null +++ b/src/app/user-portfolio/facility-dashboard/facility-dashboard.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FacilityDashboardComponent } from './facility-dashboard.component'; + +describe('FacilityDashboardComponent', () => { + let component: FacilityDashboardComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [FacilityDashboardComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(FacilityDashboardComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/facility-dashboard/facility-dashboard.component.ts b/src/app/user-portfolio/facility-dashboard/facility-dashboard.component.ts new file mode 100644 index 00000000..6f382bf2 --- /dev/null +++ b/src/app/user-portfolio/facility-dashboard/facility-dashboard.component.ts @@ -0,0 +1,33 @@ +import { Component } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; +import { faIndustry, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; +import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; +import { IdbCompany } from 'src/app/models/company'; +import { IdbFacility } from 'src/app/models/facility'; + +@Component({ + selector: 'app-facility-dashboard', + templateUrl: './facility-dashboard.component.html', + styleUrl: './facility-dashboard.component.css' +}) +export class FacilityDashboardComponent { + faIndustry: IconDefinition = faIndustry; + facility: IdbFacility; + constructor(private activatedRoute: ActivatedRoute, + private companyIdbService: CompanyIdbService, + private facilityIdbService: FacilityIdbService + ) { + + } + + ngOnInit() { + this.activatedRoute.params.subscribe(params => { + let guid: string = params['id']; + this.facility = this.facilityIdbService.getByGUID(guid); + this.facilityIdbService.selectedFacility.next(this.facility); + let company: IdbCompany = this.companyIdbService.getByGUID(this.facility.companyId); + this.companyIdbService.selectedCompany.next(company); + }); + } +} diff --git a/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.html b/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.html index b71afacc..12192233 100644 --- a/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.html +++ b/src/app/user-portfolio/portfolio-items-list/assessment-list-item/assessment-list-item.component.html @@ -6,7 +6,7 @@ Open {{assessment.name}} In Wizard - - - - +
+ + +
@@ -59,7 +57,8 @@

- +
+ + +
diff --git a/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.ts b/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.ts index 2df3003e..ace5cf1f 100644 --- a/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.ts +++ b/src/app/user-portfolio/portfolio-items-list/facility-list-item/facility-list-item.component.ts @@ -1,6 +1,6 @@ import { Component, Input } from '@angular/core'; import { Router } from '@angular/router'; -import { faExpand, faFileLines, faTrash, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { faArrowRight, faExpand, faFileLines, faTrash, IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { Subscription } from 'rxjs'; import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; import { IdbAssessment } from 'src/app/models/assessment'; @@ -21,7 +21,7 @@ export class FacilityListItemComponent { faTrash: IconDefinition = faTrash; faFileLines: IconDefinition = faFileLines; - faExpand: IconDefinition = faExpand; + faArrowRight: IconDefinition = faArrowRight; assessments: Array; assessmentsSub: Subscription; @@ -52,12 +52,10 @@ export class FacilityListItemComponent { } else { this.accordionGuid = undefined; } - // this.localStorageDataService.setNebAccordionGuid(this.accordionGuid); } - - goToFacilityDashboard() { - this.router.navigateByUrl('/portfolio/facility/' + this.facility.guid); + goToAssessmentDashboard(assessment: IdbAssessment) { + this.router.navigateByUrl('/portfolio/assessment/' + assessment.guid); } openDeleteFacilityModal() { diff --git a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.css b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.css index bb7eeeef..d05eb2ec 100644 --- a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.css +++ b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.css @@ -1,5 +1,5 @@ -.accordion-item.company-item .accordion-button:not(.collapsed), .accordion-body{ +.accordion-body{ border-left: solid var(--company-color) 5px; } \ No newline at end of file diff --git a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html index 1633ee54..6fff6075 100644 --- a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html +++ b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.html @@ -10,12 +10,18 @@

- + +
+ + +

@@ -26,5 +32,4 @@

-
- + \ No newline at end of file diff --git a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts index 3abb3d62..323f3998 100644 --- a/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts +++ b/src/app/user-portfolio/portfolio-items-list/portfolio-items-list.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; -import { faBuilding, faFolderTree, faPlus, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Router } from '@angular/router'; +import { faArrowRight, faBuilding, faFolderTree, faPlus, IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { Subscription } from 'rxjs'; import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; import { IdbCompany } from 'src/app/models/company'; @@ -15,12 +16,14 @@ export class PortfolioItemsListComponent { faFolderTree: IconDefinition = faFolderTree; faBuilding: IconDefinition = faBuilding; faPlus: IconDefinition = faPlus; + faArrowRight: IconDefinition = faArrowRight; companies: Array companiesSub: Subscription accordionGuid: string; constructor(private companyIdbService: CompanyIdbService, - private bootstrapService: BootstrapService + private bootstrapService: BootstrapService, + private router: Router ) { } ngOnInit() { @@ -42,4 +45,8 @@ export class PortfolioItemsListComponent { } // this.localStorageDataService.setNebAccordionGuid(this.accordionGuid); } + + goToCompanyDashboard(company: IdbCompany) { + this.router.navigateByUrl('/portfolio/company/' + company.guid); + } } diff --git a/src/app/user-portfolio/user-portfolio.component.css b/src/app/user-portfolio/user-portfolio.component.css index 50012c89..6bfdbf50 100644 --- a/src/app/user-portfolio/user-portfolio.component.css +++ b/src/app/user-portfolio/user-portfolio.component.css @@ -2,13 +2,13 @@ border-radius: 0; } -.card-title{ +/* .card-title{ font-size: 26px; -} +} */ -.card-title.secondary{ +/* .card-title.secondary{ font-size: 20px; -} +} */ .card-text{ font-size: 14px; diff --git a/src/app/user-portfolio/user-portfolio.component.html b/src/app/user-portfolio/user-portfolio.component.html index eef374db..0ff9d771 100644 --- a/src/app/user-portfolio/user-portfolio.component.html +++ b/src/app/user-portfolio/user-portfolio.component.html @@ -8,12 +8,13 @@ - - - - - - - -
- - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/company-kpi-details.component.ts b/src/app/setup-wizard/pre-visit/company-kpi-details/company-kpi-details.component.ts index ddf61e4f..6c7bcec9 100644 --- a/src/app/setup-wizard/pre-visit/company-kpi-details/company-kpi-details.component.ts +++ b/src/app/setup-wizard/pre-visit/company-kpi-details/company-kpi-details.component.ts @@ -1,20 +1,14 @@ import { Component } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; -import { IconDefinition, faBullseye, faChartBar, faChevronLeft, faChevronRight, faCircleQuestion, faClose, faContactBook, faPlus, faScaleUnbalancedFlip, faSearchPlus, faTrash, faUser } from '@fortawesome/free-solid-svg-icons'; +import { IconDefinition, faBullseye, faChevronLeft, faChevronRight } from '@fortawesome/free-solid-svg-icons'; import { IdbOnSiteVisit } from 'src/app/models/onSiteVisit'; import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; import { KeyPerformanceIndicatorsIdbService } from 'src/app/indexed-db/key-performance-indicators-idb.service'; import { IdbKeyPerformanceIndicator } from 'src/app/models/keyPerformanceIndicator'; import * as _ from 'lodash'; -import { PrimaryKPI, PrimaryKPIs } from 'src/app/shared/constants/keyPerformanceIndicatorOptions'; -import { firstValueFrom, Subscription } from 'rxjs'; +import { Subscription } from 'rxjs'; import { IdbCompany } from 'src/app/models/company'; -import { IdbContact } from 'src/app/models/contact'; -import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service'; -import { KeyPerformanceMetricImpactsIdbService } from 'src/app/indexed-db/key-performance-metric-impacts-idb.service'; -import { getCustomKPM, KeyPerformanceMetric } from 'src/app/shared/constants/keyPerformanceMetrics'; -import { IdbKeyPerformanceMetricImpact } from 'src/app/models/keyPerformanceMetricImpact'; @Component({ selector: 'app-company-kpi-details', @@ -23,55 +17,23 @@ import { IdbKeyPerformanceMetricImpact } from 'src/app/models/keyPerformanceMetr }) export class CompanyKpiDetailsComponent { - faChartBar: IconDefinition = faChartBar; faChevronRight: IconDefinition = faChevronRight; faChevronLeft: IconDefinition = faChevronLeft; - faUser: IconDefinition = faUser; - faContactBook: IconDefinition = faContactBook; - faClose: IconDefinition = faClose; - faTrash: IconDefinition = faTrash; - faSearchPlus: IconDefinition = faSearchPlus; keyPerformanceIndicator: IdbKeyPerformanceIndicator; - primaryKPIs: Array = PrimaryKPIs; - faCircleQuestion: IconDefinition = faCircleQuestion; faBullseye: IconDefinition = faBullseye; - faPlus: IconDefinition = faPlus; - faScaleUnbalancedFlip: IconDefinition = faScaleUnbalancedFlip; companySub: Subscription; company: IdbCompany; - keyPerformanceIndicatorSub: Subscription; - keyPerformanceIndicators: Array; - indicatorIndex: number; numCompanyKpis: number; - displayContactModal: boolean = false; - viewContact: IdbContact; - - contacts: Array; - contactsSub: Subscription; - - displayDeleteKpmModal: boolean = false; - kpmToDelete: KeyPerformanceMetric; - - keyPerformanceMetricImpacts: Array; - keyPerformanceMetricImpactsSub: Subscription; - - timeOptions: Array = ['day', 'week', 'month', 'year']; - dropdownMenuGuid: string; - - displayAddMetricModal: boolean = false; - showAddMetricDropdown: boolean = false; constructor(private router: Router, private onSiteVisitIdbService: OnSiteVisitIdbService, private keyPerformanceIndicatorIdbService: KeyPerformanceIndicatorsIdbService, private activatedRoute: ActivatedRoute, private companyIdbService: CompanyIdbService, - private contactIdbService: ContactIdbService, - private keyPerformanceMetricImpactIdbService: KeyPerformanceMetricImpactsIdbService ) { } @@ -79,48 +41,16 @@ export class CompanyKpiDetailsComponent { this.companySub = this.companyIdbService.selectedCompany.subscribe(_company => { this.company = _company; }); - this.keyPerformanceIndicatorSub = this.keyPerformanceIndicatorIdbService.keyPerformanceIndicators.subscribe(_keyPerformanceIndicators => { - this.keyPerformanceIndicators = _keyPerformanceIndicators; - }); - this.contactsSub = this.contactIdbService.contacts.subscribe(_contacts => { - this.contacts = _contacts; - }); - - this.keyPerformanceMetricImpactsSub = this.keyPerformanceMetricImpactIdbService.keyPerformanceMetricImpacts.subscribe(_keyPerformanceMetricImpacts => { - this.keyPerformanceMetricImpacts = _keyPerformanceMetricImpacts; - }); this.activatedRoute.params.subscribe(params => { let kpiGuid: string = params['id']; this.keyPerformanceIndicator = this.keyPerformanceIndicatorIdbService.getByGuid(kpiGuid); this.setIndexValues(); - this.showAddMetricDropdown = false; }); } ngOnDestroy() { this.companySub.unsubscribe(); - this.keyPerformanceIndicatorSub.unsubscribe(); - this.contactsSub.unsubscribe(); - this.keyPerformanceMetricImpactsSub.unsubscribe(); - } - - async saveChanges() { - if (this.keyPerformanceIndicator.optionValue == 'other') { - this.keyPerformanceIndicator.htmlLabel = this.keyPerformanceIndicator.label; - } - this.keyPerformanceIndicator.performanceMetrics.forEach(metric => { - if (metric.isCustom) { - metric.htmlLabel = metric.label; - } - }) - await this.keyPerformanceIndicatorIdbService.asyncUpdate(this.keyPerformanceIndicator); - await this.keyPerformanceIndicatorIdbService.setKeyPerformanceIndicators(); - } - - async calculateCost(keyPerformanceMetric: KeyPerformanceMetric) { - await this.keyPerformanceMetricImpactIdbService.updatePerformanceMetricBaseline(this.keyPerformanceIndicator, keyPerformanceMetric); - await this.saveChanges(); } goBack() { @@ -161,85 +91,9 @@ export class CompanyKpiDetailsComponent { } getCompanyKPIs(): Array { - return this.keyPerformanceIndicators.filter(kpi => { + let kpis: Array = this.keyPerformanceIndicatorIdbService.keyPerformanceIndicators.getValue(); + return kpis.filter(kpi => { return kpi.companyId == this.company.guid }); } - - openContactModal(contact: IdbContact) { - this.viewContact = contact; - this.displayContactModal = true; - } - - closeContactModal() { - this.displayContactModal = false; - this.viewContact = undefined; - } - - addPerformanceMetric() { - if (this.showAddMetricDropdown) { - this.showAddMetricDropdown = false; - } - let newCustomKPM: KeyPerformanceMetric = getCustomKPM(this.keyPerformanceIndicator.optionValue, this.keyPerformanceIndicator.guid); - this.keyPerformanceIndicator.performanceMetrics.unshift(newCustomKPM); - this.saveChanges(); - } - - openDeleteMetricModal(keyPerformanceMetric: KeyPerformanceMetric) { - this.kpmToDelete = keyPerformanceMetric; - this.displayDeleteKpmModal = true; - } - - closeDeleteKpmModal() { - this.displayDeleteKpmModal = false; - this.kpmToDelete = undefined; - } - - async untrackMetric() { - this.keyPerformanceIndicator.performanceMetrics = this.keyPerformanceIndicator.performanceMetrics.filter(kpm => { - return kpm.guid != this.kpmToDelete.guid - }); - let kpmImpacts: Array = this.keyPerformanceMetricImpacts.filter(kpmImpact => { - return kpmImpact.kpmGuid == this.kpmToDelete.guid; - }); - if (kpmImpacts.length > 0) { - for (let index = 0; index < kpmImpacts.length; index++) { - await firstValueFrom(this.keyPerformanceMetricImpactIdbService.deleteWithObservable(kpmImpacts[index].id)); - } - await this.keyPerformanceMetricImpactIdbService.setKeyPerformanceMetricImpacts(); - } - await this.saveChanges(); - this.closeDeleteKpmModal(); - } - - setDropdownMenuGuid(guid: string) { - if (this.dropdownMenuGuid != guid) { - this.dropdownMenuGuid = guid; - } else { - this.dropdownMenuGuid = undefined; - } - } - - toggleAddMetricDropdown() { - this.showAddMetricDropdown = !this.showAddMetricDropdown; - } - - showSuggestedMetrics() { - if (this.showAddMetricDropdown) { - this.showAddMetricDropdown = false; - } - this.displayAddMetricModal = true; - } - - closeSuggestedMetrics() { - this.displayAddMetricModal = false; - } - - addMetrics(metrics: Array) { - metrics.forEach(metric => { - this.keyPerformanceIndicator.performanceMetrics.unshift(metric); - }) - this.saveChanges(); - } - } diff --git a/src/app/setup-wizard/setup-wizard.module.ts b/src/app/setup-wizard/setup-wizard.module.ts index ed4c8421..4483bdcb 100644 --- a/src/app/setup-wizard/setup-wizard.module.ts +++ b/src/app/setup-wizard/setup-wizard.module.ts @@ -44,14 +44,11 @@ import { ProcessEquipmentFormComponent } from './pre-visit/facility-process-equi import { FacilityEnergyEquipmentSetupComponent } from './pre-visit/facility-energy-equipment-setup/facility-energy-equipment-setup.component'; import { EnergyEquipmentFormComponent } from './pre-visit/facility-energy-equipment-setup/energy-equipment-form/energy-equipment-form.component'; import { PrimaryKpiBadgeModule } from "../shared/primary-kpi-badge/primary-kpi-badge.module"; -import { KpmImpactsTableComponent } from './pre-visit/company-kpi-details/kpm-impacts-table/kpm-impacts-table.component'; import { EnergyOpportunityNebsTableComponent } from './data-collection/on-site-assessment/assessment-nebs-form/energy-opportunity-nebs-table/energy-opportunity-nebs-table.component'; import { EnergyOpportunityNebsListPipe } from './data-collection/on-site-assessment/assessment-nebs-form/energy-opportunity-nebs-table/energy-opportunity-nebs-list.pipe'; import { SetupWizardHelpPanelModule } from './setup-wizard-help-panel/setup-wizard-help-panel.module'; import { LabelWithTooltipModule } from '../shared/label-with-tooltip/label-with-tooltip.module'; import { KpmDetailsFormModule } from '../shared/kpm-details-form/kpm-details-form.module'; -import { KpiDescriptionPipe } from './pre-visit/company-kpi-details/kpi-description.pipe'; -import { KpmDatabaseModalComponent } from './pre-visit/company-kpi-details/kpm-database-modal/kpm-database-modal.component'; import { SharedAssessmentFormsModule } from '../shared/shared-assessment-forms/shared-assessment-forms.module'; import { SharedCompanyFormsModule } from "../shared/shared-company-forms/shared-company-forms.module"; @@ -92,11 +89,8 @@ import { SharedCompanyFormsModule } from "../shared/shared-company-forms/shared- ProcessEquipmentFormComponent, FacilityEnergyEquipmentSetupComponent, EnergyEquipmentFormComponent, - KpmImpactsTableComponent, EnergyOpportunityNebsTableComponent, - EnergyOpportunityNebsListPipe, - KpiDescriptionPipe, - KpmDatabaseModalComponent + EnergyOpportunityNebsListPipe ], imports: [ CommonModule, diff --git a/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.css b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.css new file mode 100644 index 00000000..e69de29b diff --git a/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.html b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.html new file mode 100644 index 00000000..68caa573 --- /dev/null +++ b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.html @@ -0,0 +1,243 @@ +
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+ +
+ + + + +
+ +
+
+
+
+ +
+ +
+ + + + +

+ +

+
+
+
+ +
+
+ + +
+
+
+
+
+
+
+ + +
+
+
+ Associated Key Performance Metrics +
+
+ + + + + + +
+
+
+

+ The below associated key performance metrics () + will be used later on during an assessment to tie Non-Energy Benefits found back to company Key + Performance Indicators. This information can be added to and modified at a later time if not all + of the details are currently known. +

+
+
+
+
+
+ + +
+ + +
+ +
+
+
+ +
+ +
+
+
+
+ + +
+ +
+
+
+
+
+
+
+
+
+
+ +
+ No perfromance metrics connected to this KPI. Click " + Add New Metric" to add a new performance metric. +
+
+
+ + + + + +
+ + + + \ No newline at end of file diff --git a/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.spec.ts b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.spec.ts new file mode 100644 index 00000000..29c4fb5a --- /dev/null +++ b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { CompanyKpiDetailsFormComponent } from './company-kpi-details-form.component'; + +describe('CompanyKpiDetailsFormComponent', () => { + let component: CompanyKpiDetailsFormComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [CompanyKpiDetailsFormComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(CompanyKpiDetailsFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.ts b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.ts new file mode 100644 index 00000000..fde60775 --- /dev/null +++ b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.ts @@ -0,0 +1,181 @@ +import { Component, Input } from '@angular/core'; +import { faBullseye, faCircleQuestion, faContactBook, faPlus, faScaleUnbalancedFlip, faSearchPlus, faTrash, faUser, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { IdbKeyPerformanceIndicator } from 'src/app/models/keyPerformanceIndicator'; +import { PrimaryKPI, PrimaryKPIs } from '../../constants/keyPerformanceIndicatorOptions'; +import { firstValueFrom, Subscription } from 'rxjs'; +import { IdbCompany } from 'src/app/models/company'; +import { IdbContact } from 'src/app/models/contact'; +import { getCustomKPM, KeyPerformanceMetric } from '../../constants/keyPerformanceMetrics'; +import { IdbKeyPerformanceMetricImpact } from 'src/app/models/keyPerformanceMetricImpact'; +import { KeyPerformanceIndicatorsIdbService } from 'src/app/indexed-db/key-performance-indicators-idb.service'; +import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; +import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service'; +import { KeyPerformanceMetricImpactsIdbService } from 'src/app/indexed-db/key-performance-metric-impacts-idb.service'; + +@Component({ + selector: 'app-company-kpi-details-form', + templateUrl: './company-kpi-details-form.component.html', + styleUrl: './company-kpi-details-form.component.css' +}) +export class CompanyKpiDetailsFormComponent { + @Input({ required: true }) + keyPerformanceIndicator: IdbKeyPerformanceIndicator; + + + + faUser: IconDefinition = faUser; + faContactBook: IconDefinition = faContactBook; + faTrash: IconDefinition = faTrash; + faSearchPlus: IconDefinition = faSearchPlus; + + primaryKPIs: Array = PrimaryKPIs; + faCircleQuestion: IconDefinition = faCircleQuestion; + faBullseye: IconDefinition = faBullseye; + faPlus: IconDefinition = faPlus; + faScaleUnbalancedFlip: IconDefinition = faScaleUnbalancedFlip; + + companySub: Subscription; + company: IdbCompany; + + displayContactModal: boolean = false; + viewContact: IdbContact; + + contacts: Array; + contactsSub: Subscription; + + displayDeleteKpmModal: boolean = false; + kpmToDelete: KeyPerformanceMetric; + + keyPerformanceMetricImpacts: Array; + keyPerformanceMetricImpactsSub: Subscription; + + timeOptions: Array = ['day', 'week', 'month', 'year']; + dropdownMenuGuid: string; + + displayAddMetricModal: boolean = false; + showAddMetricDropdown: boolean = false; + constructor( + private keyPerformanceIndicatorIdbService: KeyPerformanceIndicatorsIdbService, + private companyIdbService: CompanyIdbService, + private contactIdbService: ContactIdbService, + private keyPerformanceMetricImpactIdbService: KeyPerformanceMetricImpactsIdbService + ) { + } + + ngOnInit() { + this.companySub = this.companyIdbService.selectedCompany.subscribe(_company => { + this.company = _company; + }); + this.contactsSub = this.contactIdbService.contacts.subscribe(_contacts => { + this.contacts = _contacts; + }); + this.keyPerformanceMetricImpactsSub = this.keyPerformanceMetricImpactIdbService.keyPerformanceMetricImpacts.subscribe(_keyPerformanceMetricImpacts => { + this.keyPerformanceMetricImpacts = _keyPerformanceMetricImpacts; + }); + } + + ngOnDestroy() { + this.companySub.unsubscribe(); + this.contactsSub.unsubscribe(); + this.keyPerformanceMetricImpactsSub.unsubscribe(); + } + + ngOnChanges() { + this.showAddMetricDropdown = false; + } + + async saveChanges() { + if (this.keyPerformanceIndicator.optionValue == 'other') { + this.keyPerformanceIndicator.htmlLabel = this.keyPerformanceIndicator.label; + } + this.keyPerformanceIndicator.performanceMetrics.forEach(metric => { + if (metric.isCustom) { + metric.htmlLabel = metric.label; + } + }) + await this.keyPerformanceIndicatorIdbService.asyncUpdate(this.keyPerformanceIndicator); + await this.keyPerformanceIndicatorIdbService.setKeyPerformanceIndicators(); + } + + async calculateCost(keyPerformanceMetric: KeyPerformanceMetric) { + await this.keyPerformanceMetricImpactIdbService.updatePerformanceMetricBaseline(this.keyPerformanceIndicator, keyPerformanceMetric); + await this.saveChanges(); + } + + openContactModal(contact: IdbContact) { + this.viewContact = contact; + this.displayContactModal = true; + } + + closeContactModal() { + this.displayContactModal = false; + this.viewContact = undefined; + } + + addPerformanceMetric() { + if (this.showAddMetricDropdown) { + this.showAddMetricDropdown = false; + } + let newCustomKPM: KeyPerformanceMetric = getCustomKPM(this.keyPerformanceIndicator.optionValue, this.keyPerformanceIndicator.guid); + this.keyPerformanceIndicator.performanceMetrics.unshift(newCustomKPM); + this.saveChanges(); + } + + openDeleteMetricModal(keyPerformanceMetric: KeyPerformanceMetric) { + this.kpmToDelete = keyPerformanceMetric; + this.displayDeleteKpmModal = true; + } + + closeDeleteKpmModal() { + this.displayDeleteKpmModal = false; + this.kpmToDelete = undefined; + } + + async untrackMetric() { + this.keyPerformanceIndicator.performanceMetrics = this.keyPerformanceIndicator.performanceMetrics.filter(kpm => { + return kpm.guid != this.kpmToDelete.guid + }); + let kpmImpacts: Array = this.keyPerformanceMetricImpacts.filter(kpmImpact => { + return kpmImpact.kpmGuid == this.kpmToDelete.guid; + }); + if (kpmImpacts.length > 0) { + for (let index = 0; index < kpmImpacts.length; index++) { + await firstValueFrom(this.keyPerformanceMetricImpactIdbService.deleteWithObservable(kpmImpacts[index].id)); + } + await this.keyPerformanceMetricImpactIdbService.setKeyPerformanceMetricImpacts(); + } + await this.saveChanges(); + this.closeDeleteKpmModal(); + } + + setDropdownMenuGuid(guid: string) { + if (this.dropdownMenuGuid != guid) { + this.dropdownMenuGuid = guid; + } else { + this.dropdownMenuGuid = undefined; + } + } + + toggleAddMetricDropdown() { + this.showAddMetricDropdown = !this.showAddMetricDropdown; + } + + showSuggestedMetrics() { + if (this.showAddMetricDropdown) { + this.showAddMetricDropdown = false; + } + this.displayAddMetricModal = true; + } + + closeSuggestedMetrics() { + this.displayAddMetricModal = false; + } + + addMetrics(metrics: Array) { + metrics.forEach(metric => { + this.keyPerformanceIndicator.performanceMetrics.unshift(metric); + }) + this.saveChanges(); + } + +} diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/kpi-description.pipe.spec.ts b/src/app/shared/shared-company-forms/company-kpi-details-form/kpi-description.pipe.spec.ts similarity index 100% rename from src/app/setup-wizard/pre-visit/company-kpi-details/kpi-description.pipe.spec.ts rename to src/app/shared/shared-company-forms/company-kpi-details-form/kpi-description.pipe.spec.ts diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/kpi-description.pipe.ts b/src/app/shared/shared-company-forms/company-kpi-details-form/kpi-description.pipe.ts similarity index 100% rename from src/app/setup-wizard/pre-visit/company-kpi-details/kpi-description.pipe.ts rename to src/app/shared/shared-company-forms/company-kpi-details-form/kpi-description.pipe.ts diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/kpm-database-modal/kpm-database-modal.component.css b/src/app/shared/shared-company-forms/company-kpi-details-form/kpm-database-modal/kpm-database-modal.component.css similarity index 100% rename from src/app/setup-wizard/pre-visit/company-kpi-details/kpm-database-modal/kpm-database-modal.component.css rename to src/app/shared/shared-company-forms/company-kpi-details-form/kpm-database-modal/kpm-database-modal.component.css diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/kpm-database-modal/kpm-database-modal.component.html b/src/app/shared/shared-company-forms/company-kpi-details-form/kpm-database-modal/kpm-database-modal.component.html similarity index 100% rename from src/app/setup-wizard/pre-visit/company-kpi-details/kpm-database-modal/kpm-database-modal.component.html rename to src/app/shared/shared-company-forms/company-kpi-details-form/kpm-database-modal/kpm-database-modal.component.html diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/kpm-database-modal/kpm-database-modal.component.spec.ts b/src/app/shared/shared-company-forms/company-kpi-details-form/kpm-database-modal/kpm-database-modal.component.spec.ts similarity index 100% rename from src/app/setup-wizard/pre-visit/company-kpi-details/kpm-database-modal/kpm-database-modal.component.spec.ts rename to src/app/shared/shared-company-forms/company-kpi-details-form/kpm-database-modal/kpm-database-modal.component.spec.ts diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/kpm-database-modal/kpm-database-modal.component.ts b/src/app/shared/shared-company-forms/company-kpi-details-form/kpm-database-modal/kpm-database-modal.component.ts similarity index 100% rename from src/app/setup-wizard/pre-visit/company-kpi-details/kpm-database-modal/kpm-database-modal.component.ts rename to src/app/shared/shared-company-forms/company-kpi-details-form/kpm-database-modal/kpm-database-modal.component.ts diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/kpm-impacts-table/kpm-impacts-table.component.css b/src/app/shared/shared-company-forms/company-kpi-details-form/kpm-impacts-table/kpm-impacts-table.component.css similarity index 100% rename from src/app/setup-wizard/pre-visit/company-kpi-details/kpm-impacts-table/kpm-impacts-table.component.css rename to src/app/shared/shared-company-forms/company-kpi-details-form/kpm-impacts-table/kpm-impacts-table.component.css diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/kpm-impacts-table/kpm-impacts-table.component.html b/src/app/shared/shared-company-forms/company-kpi-details-form/kpm-impacts-table/kpm-impacts-table.component.html similarity index 100% rename from src/app/setup-wizard/pre-visit/company-kpi-details/kpm-impacts-table/kpm-impacts-table.component.html rename to src/app/shared/shared-company-forms/company-kpi-details-form/kpm-impacts-table/kpm-impacts-table.component.html diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/kpm-impacts-table/kpm-impacts-table.component.spec.ts b/src/app/shared/shared-company-forms/company-kpi-details-form/kpm-impacts-table/kpm-impacts-table.component.spec.ts similarity index 100% rename from src/app/setup-wizard/pre-visit/company-kpi-details/kpm-impacts-table/kpm-impacts-table.component.spec.ts rename to src/app/shared/shared-company-forms/company-kpi-details-form/kpm-impacts-table/kpm-impacts-table.component.spec.ts diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/kpm-impacts-table/kpm-impacts-table.component.ts b/src/app/shared/shared-company-forms/company-kpi-details-form/kpm-impacts-table/kpm-impacts-table.component.ts similarity index 100% rename from src/app/setup-wizard/pre-visit/company-kpi-details/kpm-impacts-table/kpm-impacts-table.component.ts rename to src/app/shared/shared-company-forms/company-kpi-details-form/kpm-impacts-table/kpm-impacts-table.component.ts diff --git a/src/app/shared/shared-company-forms/shared-company-forms.module.ts b/src/app/shared/shared-company-forms/shared-company-forms.module.ts index 7f0a5e78..d768d529 100644 --- a/src/app/shared/shared-company-forms/shared-company-forms.module.ts +++ b/src/app/shared/shared-company-forms/shared-company-forms.module.ts @@ -1,26 +1,44 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; -import { ReactiveFormsModule } from '@angular/forms'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { LabelWithTooltipModule } from '../label-with-tooltip/label-with-tooltip.module'; import { SharedSettingsFormsModule } from '../shared-settings-forms/shared-settings-forms.module'; import { CompanySetupFormComponent } from './company-setup-form/company-setup-form.component'; +import { CompanyKpiDetailsFormComponent } from './company-kpi-details-form/company-kpi-details-form.component'; +import { PrimaryKpiBadgeModule } from '../primary-kpi-badge/primary-kpi-badge.module'; +import { HelperPipesModule } from '../helper-pipes/helper-pipes.module'; +import { KpiDescriptionPipe } from './company-kpi-details-form/kpi-description.pipe'; +import { KpmDetailsFormModule } from '../kpm-details-form/kpm-details-form.module'; +import { KpmDatabaseModalComponent } from './company-kpi-details-form/kpm-database-modal/kpm-database-modal.component'; +import { KpmImpactsTableComponent } from './company-kpi-details-form/kpm-impacts-table/kpm-impacts-table.component'; +import { ContactModalModule } from '../contact-modal/contact-modal.module'; @NgModule({ declarations: [ - CompanySetupFormComponent + CompanySetupFormComponent, + CompanyKpiDetailsFormComponent, + KpiDescriptionPipe, + KpmDatabaseModalComponent, + KpmImpactsTableComponent ], imports: [ CommonModule, FontAwesomeModule, ReactiveFormsModule, LabelWithTooltipModule, - SharedSettingsFormsModule + SharedSettingsFormsModule, + FormsModule, + PrimaryKpiBadgeModule, + HelperPipesModule, + KpmDetailsFormModule, + ContactModalModule ], exports: [ - CompanySetupFormComponent + CompanySetupFormComponent, + CompanyKpiDetailsFormComponent ] }) export class SharedCompanyFormsModule { } diff --git a/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.css b/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.css index e69de29b..974d6c9f 100644 --- a/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.css +++ b/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.css @@ -0,0 +1,60 @@ +.navbar{ + /* width: 20rem; */ + /* background-color: #ffffff; */ + overflow-y: auto; + /* height: 100%; */ + /* max-height: 100%; */ + flex-wrap: nowrap; +} + +.navbar.collapsed{ + width: auto; +} + +.nav-item{ + width: 100%; +} + +.nav-link{ + /* padding-left: .5rem; */ + padding: .25rem; + text-wrap-mode: nowrap; + border-bottom: solid 1px; + border-color: black; +} + +.nav-link.active{ + background-color: #0079c2; + color: white; +} + +.nav-link:hover{ + background-color: #8DABBE; + color: black; +} + + +.text-end{ + text-align: right; +} + +.toggle-collapse{ + font-size: x-large; +} + +.toggle-collapse:hover{ + cursor: pointer; + border: so; +} + +.btn.text-left{ + text-align: left; +} + +.nav-link:hover{ + cursor: pointer; +} + +.nav-flex{ + height: fit-content; +} \ No newline at end of file diff --git a/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.html b/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.html index d9c61ed3..7f050f6a 100644 --- a/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.html +++ b/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.html @@ -1 +1,33 @@ -

company-performance-indicators works!

+
+ +
+
+ +
+
+ + +
+
+ +
+ + Heyooo.. + +
+
+
\ No newline at end of file diff --git a/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.ts b/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.ts index 72e5259b..cf576814 100644 --- a/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.ts +++ b/src/app/user-portfolio/company-dashboard/company-performance-indicators/company-performance-indicators.component.ts @@ -1,4 +1,10 @@ import { Component } from '@angular/core'; +import { faBullseye, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Subscription } from 'rxjs'; +import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; +import { KeyPerformanceIndicatorsIdbService } from 'src/app/indexed-db/key-performance-indicators-idb.service'; +import { IdbCompany } from 'src/app/models/company'; +import { IdbKeyPerformanceIndicator } from 'src/app/models/keyPerformanceIndicator'; @Component({ selector: 'app-company-performance-indicators', @@ -7,4 +13,38 @@ import { Component } from '@angular/core'; }) export class CompanyPerformanceIndicatorsComponent { + faBullseye: IconDefinition = faBullseye; + + keyPerformanceIndicators: Array; + keyPerformanceIndicatorsSub: Subscription; + + company: IdbCompany; + companySub: Subscription; + + selectedKpi: IdbKeyPerformanceIndicator; + constructor(private keyPerformanceIndicatorIdbService: KeyPerformanceIndicatorsIdbService, + private companyIdbService: CompanyIdbService + ) { + } + + ngOnInit() { + this.companySub = this.companyIdbService.selectedCompany.subscribe(company => { + this.company = company; + }) + + this.keyPerformanceIndicatorsSub = this.keyPerformanceIndicatorIdbService.keyPerformanceIndicators.subscribe(kpis => { + this.keyPerformanceIndicators = kpis.filter(kpi => { + return kpi.companyId == this.company.guid + }); + }); + } + + ngOnDestroy() { + this.companySub.unsubscribe(); + this.companySub.unsubscribe(); + } + + setSelectedKpi(kpi: IdbKeyPerformanceIndicator) { + this.selectedKpi = kpi; + } } From 91cec2b72df46c5ef772e5af25655df9f90b4a56 Mon Sep 17 00:00:00 2001 From: rmroot Date: Mon, 11 Nov 2024 13:02:54 -0600 Subject: [PATCH 18/42] update kpi list select and add to company dashboard --- src/app/routing/portfolio.routes.ts | 16 +++++++++++-- .../company-kpi-details.component.html | 8 +------ .../company-kpi-select.component.html | 9 +------- .../company-kpi-select.component.spec.ts | 6 ++--- src/app/setup-wizard/setup-wizard.module.ts | 6 ----- .../company-kpi-details-form.component.html | 5 ++++ .../company-kpi-details-form.component.ts | 17 ++++++++++---- .../add-kpi-search.component.css | 0 .../add-kpi-search.component.html | 12 +++++----- .../add-kpi-search.component.spec.ts | 0 .../add-kpi-search.component.ts | 0 .../selected-kpi-option.pipe.spec.ts | 0 .../selected-kpi-option.pipe.ts | 0 .../company-kpi-list.component.css | 0 .../company-kpi-list.component.html | 14 +++++------ .../company-kpi-list.component.spec.ts | 0 .../company-kpi-list.component.ts | 12 ++++++---- .../company-kpi-search-form.component.css | 3 +++ .../company-kpi-search-form.component.html | 8 +++++++ .../company-kpi-search-form.component.spec.ts | 23 +++++++++++++++++++ .../company-kpi-search-form.component.ts | 10 ++++++++ .../shared-company-forms.module.ts | 13 +++++++++-- .../company-dashboard-nav.component.html | 2 +- ...pany-performance-indicators.component.html | 16 ++++++++----- 24 files changed, 124 insertions(+), 56 deletions(-) rename src/app/{setup-wizard/pre-visit/company-kpi-select => shared/shared-company-forms/company-kpi-search-form}/add-kpi-search/add-kpi-search.component.css (100%) rename src/app/{setup-wizard/pre-visit/company-kpi-select => shared/shared-company-forms/company-kpi-search-form}/add-kpi-search/add-kpi-search.component.html (92%) rename src/app/{setup-wizard/pre-visit/company-kpi-select => shared/shared-company-forms/company-kpi-search-form}/add-kpi-search/add-kpi-search.component.spec.ts (100%) rename src/app/{setup-wizard/pre-visit/company-kpi-select => shared/shared-company-forms/company-kpi-search-form}/add-kpi-search/add-kpi-search.component.ts (100%) rename src/app/{setup-wizard/pre-visit/company-kpi-select => shared/shared-company-forms/company-kpi-search-form}/add-kpi-search/selected-kpi-option.pipe.spec.ts (100%) rename src/app/{setup-wizard/pre-visit/company-kpi-select => shared/shared-company-forms/company-kpi-search-form}/add-kpi-search/selected-kpi-option.pipe.ts (100%) rename src/app/{setup-wizard/pre-visit/company-kpi-select => shared/shared-company-forms/company-kpi-search-form}/company-kpi-list/company-kpi-list.component.css (100%) rename src/app/{setup-wizard/pre-visit/company-kpi-select => shared/shared-company-forms/company-kpi-search-form}/company-kpi-list/company-kpi-list.component.html (96%) rename src/app/{setup-wizard/pre-visit/company-kpi-select => shared/shared-company-forms/company-kpi-search-form}/company-kpi-list/company-kpi-list.component.spec.ts (100%) rename src/app/{setup-wizard/pre-visit/company-kpi-select => shared/shared-company-forms/company-kpi-search-form}/company-kpi-list/company-kpi-list.component.ts (89%) create mode 100644 src/app/shared/shared-company-forms/company-kpi-search-form/company-kpi-search-form.component.css create mode 100644 src/app/shared/shared-company-forms/company-kpi-search-form/company-kpi-search-form.component.html create mode 100644 src/app/shared/shared-company-forms/company-kpi-search-form/company-kpi-search-form.component.spec.ts create mode 100644 src/app/shared/shared-company-forms/company-kpi-search-form/company-kpi-search-form.component.ts diff --git a/src/app/routing/portfolio.routes.ts b/src/app/routing/portfolio.routes.ts index fd7f8fff..e805fc8b 100644 --- a/src/app/routing/portfolio.routes.ts +++ b/src/app/routing/portfolio.routes.ts @@ -20,6 +20,8 @@ import { AssessmentReportsComponent } from "../user-portfolio/assessment-dashboa import { AssessmentDetailsComponent } from "../user-portfolio/assessment-dashboard/assessment-details/assessment-details.component"; import { AssessmentEnergyOpportunitiesComponent } from "../user-portfolio/assessment-dashboard/assessment-energy-opportunities/assessment-energy-opportunities.component"; import { CanDeactivateGuard } from "../guards/can-deactivate.guard"; +import { CompanyKpiSearchFormComponent } from "../shared/shared-company-forms/company-kpi-search-form/company-kpi-search-form.component"; +import { CompanyKpiDetailsFormComponent } from "../shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component"; export const PortfolioRoutes: Route = { @@ -39,8 +41,18 @@ export const PortfolioRoutes: Route = { component: CompanyDashboardHomeComponent }, { - path: 'performance-metrics', - component: CompanyPerformanceIndicatorsComponent + path: 'performance-indicators', + component: CompanyPerformanceIndicatorsComponent, + children: [ + { + path: '', + component: CompanyKpiSearchFormComponent + }, + { + path: 'details/:id', + component: CompanyKpiDetailsFormComponent + } + ] }, { path: 'stakeholders', diff --git a/src/app/setup-wizard/pre-visit/company-kpi-details/company-kpi-details.component.html b/src/app/setup-wizard/pre-visit/company-kpi-details/company-kpi-details.component.html index 7d9849ab..bf17b912 100644 --- a/src/app/setup-wizard/pre-visit/company-kpi-details/company-kpi-details.component.html +++ b/src/app/setup-wizard/pre-visit/company-kpi-details/company-kpi-details.component.html @@ -2,13 +2,7 @@
-
- - -
-
- +
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 dd3aa555..f70e221b 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 @@ -6,14 +6,7 @@
Company Key Performance Indicators (KPIs)

-
-
- -
-
- -
-
+ diff --git a/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.spec.ts b/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.spec.ts index ab0ad1ca..4606b5b0 100644 --- a/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.spec.ts +++ b/src/app/setup-wizard/pre-visit/company-kpi-select/company-kpi-select.component.spec.ts @@ -14,14 +14,14 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; import { FormsModule } from '@angular/forms'; import { RouterTestingModule } from '@angular/router/testing'; import { HelperPipesModule } from 'src/app/shared/helper-pipes/helper-pipes.module'; -import { AddKpiSearchComponent } from './add-kpi-search/add-kpi-search.component'; -import { CompanyKpiListComponent } from './company-kpi-list/company-kpi-list.component'; +import { AddKpiSearchComponent } from '../../../shared/shared-company-forms/company-kpi-search-form/add-kpi-search/add-kpi-search.component'; +import { CompanyKpiListComponent } from '../../../shared/shared-company-forms/company-kpi-search-form/company-kpi-list/company-kpi-list.component'; import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility'; import { EnergyOpportunityIdbService } from 'src/app/indexed-db/energy-opportunity-idb.service'; import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; import { NonEnergyBenefitsIdbService } from 'src/app/indexed-db/non-energy-benefits-idb.service'; -import { SelectedKpiOptionPipe } from './add-kpi-search/selected-kpi-option.pipe'; +import { SelectedKpiOptionPipe } from '../../../shared/shared-company-forms/company-kpi-search-form/add-kpi-search/selected-kpi-option.pipe'; import { PrimaryKpiBadgeModule } from 'src/app/shared/primary-kpi-badge/primary-kpi-badge.module'; import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; import { KeyPerformanceMetricImpactsIdbService } from 'src/app/indexed-db/key-performance-metric-impacts-idb.service'; diff --git a/src/app/setup-wizard/setup-wizard.module.ts b/src/app/setup-wizard/setup-wizard.module.ts index 4483bdcb..0dd4f249 100644 --- a/src/app/setup-wizard/setup-wizard.module.ts +++ b/src/app/setup-wizard/setup-wizard.module.ts @@ -13,7 +13,6 @@ import { CompanyContactsSetupComponent } from './pre-visit/company-contacts-setu import { FacilityProcessEquipmentSetupComponent } from './pre-visit/facility-process-equipment-setup/facility-process-equipment-setup.component'; import { PreAssessmentSetupComponent } from './pre-visit/pre-assessment-setup/pre-assessment-setup.component'; import { ReviewPreVisitSetupComponent } from './pre-visit/review-pre-visit-setup/review-pre-visit-setup.component'; -import { CompanyKpiListComponent } from './pre-visit/company-kpi-select/company-kpi-list/company-kpi-list.component'; import { ContactModalModule } from '../shared/contact-modal/contact-modal.module'; import { ReviewOnSiteComponent } from './data-collection/review-on-site/review-on-site.component'; import { CompanyDetailsSummaryComponent } from './pre-visit/review-pre-visit-setup/company-details-summary/company-details-summary.component'; @@ -32,8 +31,6 @@ import { CompanyContactsFormComponent } from './pre-visit/company-contacts-setup import { CompanyKpiSelectComponent } from './pre-visit/company-kpi-select/company-kpi-select.component'; import { CompanyKpiDetailsComponent } from './pre-visit/company-kpi-details/company-kpi-details.component'; import { DataCollectionManageAssessmentsComponent } from './data-collection/data-collection-manage-assessments/data-collection-manage-assessments.component'; -import { AddKpiSearchComponent } from './pre-visit/company-kpi-select/add-kpi-search/add-kpi-search.component'; -import { SelectedKpiOptionPipe } from './pre-visit/company-kpi-select/add-kpi-search/selected-kpi-option.pipe'; import { DataEvaluationComponent } from './data-evaluation/data-evaluation.component'; import { DataFollowUpComponent } from './data-evaluation/data-follow-up/data-follow-up.component'; import { VisitReportComponent } from './data-evaluation/visit-report/visit-report.component'; @@ -62,8 +59,6 @@ import { SharedCompanyFormsModule } from "../shared/shared-company-forms/shared- FacilityProcessEquipmentSetupComponent, PreAssessmentSetupComponent, ReviewPreVisitSetupComponent, - AddKpiSearchComponent, - CompanyKpiListComponent, ReviewOnSiteComponent, CompanyDetailsSummaryComponent, TeamDetailsSummaryComponent, @@ -79,7 +74,6 @@ import { SharedCompanyFormsModule } from "../shared/shared-company-forms/shared- CompanyContactsFormComponent, CompanyKpiSelectComponent, CompanyKpiDetailsComponent, - SelectedKpiOptionPipe, DataCollectionManageAssessmentsComponent, DataEvaluationComponent, DataFollowUpComponent, diff --git a/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.html b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.html index 68caa573..f7490905 100644 --- a/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.html +++ b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.html @@ -1,3 +1,8 @@ +
+ + +
+
diff --git a/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.ts b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.ts index fde60775..10e62a18 100644 --- a/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.ts +++ b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.ts @@ -1,5 +1,5 @@ -import { Component, Input } from '@angular/core'; -import { faBullseye, faCircleQuestion, faContactBook, faPlus, faScaleUnbalancedFlip, faSearchPlus, faTrash, faUser, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Component, Input, SimpleChanges } from '@angular/core'; +import { faBullseye, faChartBar, faChevronRight, faCircleQuestion, faClose, faContactBook, faPlus, faScaleUnbalancedFlip, faSearchPlus, faTrash, faUser, IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { IdbKeyPerformanceIndicator } from 'src/app/models/keyPerformanceIndicator'; import { PrimaryKPI, PrimaryKPIs } from '../../constants/keyPerformanceIndicatorOptions'; import { firstValueFrom, Subscription } from 'rxjs'; @@ -7,6 +7,7 @@ import { IdbCompany } from 'src/app/models/company'; import { IdbContact } from 'src/app/models/contact'; import { getCustomKPM, KeyPerformanceMetric } from '../../constants/keyPerformanceMetrics'; import { IdbKeyPerformanceMetricImpact } from 'src/app/models/keyPerformanceMetricImpact'; +import { ActivatedRoute } from '@angular/router'; import { KeyPerformanceIndicatorsIdbService } from 'src/app/indexed-db/key-performance-indicators-idb.service'; import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service'; @@ -18,10 +19,10 @@ import { KeyPerformanceMetricImpactsIdbService } from 'src/app/indexed-db/key-pe styleUrl: './company-kpi-details-form.component.css' }) export class CompanyKpiDetailsFormComponent { - @Input({ required: true }) - keyPerformanceIndicator: IdbKeyPerformanceIndicator; + // @Input({ required: true }) + keyPerformanceIndicator: IdbKeyPerformanceIndicator; faUser: IconDefinition = faUser; faContactBook: IconDefinition = faContactBook; @@ -56,6 +57,7 @@ export class CompanyKpiDetailsFormComponent { showAddMetricDropdown: boolean = false; constructor( private keyPerformanceIndicatorIdbService: KeyPerformanceIndicatorsIdbService, + private activatedRoute: ActivatedRoute, private companyIdbService: CompanyIdbService, private contactIdbService: ContactIdbService, private keyPerformanceMetricImpactIdbService: KeyPerformanceMetricImpactsIdbService @@ -69,9 +71,16 @@ export class CompanyKpiDetailsFormComponent { this.contactsSub = this.contactIdbService.contacts.subscribe(_contacts => { this.contacts = _contacts; }); + this.keyPerformanceMetricImpactsSub = this.keyPerformanceMetricImpactIdbService.keyPerformanceMetricImpacts.subscribe(_keyPerformanceMetricImpacts => { this.keyPerformanceMetricImpacts = _keyPerformanceMetricImpacts; }); + + this.activatedRoute.params.subscribe(params => { + let kpiGuid: string = params['id']; + this.keyPerformanceIndicator = this.keyPerformanceIndicatorIdbService.getByGuid(kpiGuid); + this.showAddMetricDropdown = false; + }); } ngOnDestroy() { diff --git a/src/app/setup-wizard/pre-visit/company-kpi-select/add-kpi-search/add-kpi-search.component.css b/src/app/shared/shared-company-forms/company-kpi-search-form/add-kpi-search/add-kpi-search.component.css similarity index 100% rename from src/app/setup-wizard/pre-visit/company-kpi-select/add-kpi-search/add-kpi-search.component.css rename to src/app/shared/shared-company-forms/company-kpi-search-form/add-kpi-search/add-kpi-search.component.css diff --git a/src/app/setup-wizard/pre-visit/company-kpi-select/add-kpi-search/add-kpi-search.component.html b/src/app/shared/shared-company-forms/company-kpi-search-form/add-kpi-search/add-kpi-search.component.html similarity index 92% rename from src/app/setup-wizard/pre-visit/company-kpi-select/add-kpi-search/add-kpi-search.component.html rename to src/app/shared/shared-company-forms/company-kpi-search-form/add-kpi-search/add-kpi-search.component.html index f6bd9f00..cf915be9 100644 --- a/src/app/setup-wizard/pre-visit/company-kpi-select/add-kpi-search/add-kpi-search.component.html +++ b/src/app/shared/shared-company-forms/company-kpi-search-form/add-kpi-search/add-kpi-search.component.html @@ -1,11 +1,11 @@
-
-
+
+
Find Potential KPIs -
+
-
+
-
+
-
- Facility name required. -
- -
- - -
- - -
- - +
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 47f81153..da10809e 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 @@ -6,7 +6,7 @@ import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; import { IdbOnSiteVisit } from 'src/app/models/onSiteVisit'; import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; import { FormControl, Validators } from '@angular/forms'; -import { Observable, of } from 'rxjs'; +import { Observable, of, Subscription } from 'rxjs'; import { Icon } from '@fortawesome/fontawesome-svg-core'; @Component({ @@ -21,13 +21,10 @@ export class FacilitySetupComponent implements OnInit { faChevronRight: IconDefinition = faChevronRight; faChevronLeft: IconDefinition = faChevronLeft; - faFilePen: IconDefinition = faFilePen; - faGear: IconDefinition = faGear; - faContactCard: IconDefinition = faContactCard; - faLocationDot: IconDefinition = faLocationDot; faIndustry: IconDefinition = faIndustry; faCircleExclamation: IconDefinition = faCircleExclamation; + facilitySub: Subscription; facility: IdbFacility; routeGuardWarningModal: boolean = false; @@ -38,13 +35,14 @@ export class FacilitySetupComponent implements OnInit { } ngOnInit() { - this.facility = this.facilityIdbService.selectedFacility.getValue(); - - if (this.facility) { + this.facilitySub = this.facilityIdbService.selectedFacility.subscribe(facility => { + this.facility = facility; this.name = new FormControl(this.facility.generalInformation.name, [Validators.required]); - } else { - this.router.navigateByUrl('/welcome'); - } + }); + } + + ngOnDestroy(){ + this.facilitySub.unsubscribe(); } async saveChanges() { diff --git a/src/app/setup-wizard/setup-wizard.module.ts b/src/app/setup-wizard/setup-wizard.module.ts index 75f56fb7..6289c600 100644 --- a/src/app/setup-wizard/setup-wizard.module.ts +++ b/src/app/setup-wizard/setup-wizard.module.ts @@ -47,6 +47,7 @@ import { LabelWithTooltipModule } from '../shared/label-with-tooltip/label-with- import { KpmDetailsFormModule } from '../shared/kpm-details-form/kpm-details-form.module'; import { SharedAssessmentFormsModule } from '../shared/shared-assessment-forms/shared-assessment-forms.module'; import { SharedCompanyFormsModule } from "../shared/shared-company-forms/shared-company-forms.module"; +import { SharedFacilityFormsModule } from '../shared/shared-facility-forms/shared-facility-forms.module'; @NgModule({ declarations: [ @@ -101,7 +102,8 @@ import { SharedCompanyFormsModule } from "../shared/shared-company-forms/shared- LabelWithTooltipModule, KpmDetailsFormModule, SharedAssessmentFormsModule, - SharedCompanyFormsModule + SharedCompanyFormsModule, + SharedFacilityFormsModule ] }) export class SetupWizardModule { } diff --git a/src/app/shared/shared-facility-forms/facility-setup-form/facility-setup-form.component.css b/src/app/shared/shared-facility-forms/facility-setup-form/facility-setup-form.component.css new file mode 100644 index 00000000..e69de29b diff --git a/src/app/shared/shared-facility-forms/facility-setup-form/facility-setup-form.component.html b/src/app/shared/shared-facility-forms/facility-setup-form/facility-setup-form.component.html new file mode 100644 index 00000000..09df0469 --- /dev/null +++ b/src/app/shared/shared-facility-forms/facility-setup-form/facility-setup-form.component.html @@ -0,0 +1,18 @@ + +
+ + +
+ Facility name required. +
+
+
+ + +
+ + +
+ + \ No newline at end of file diff --git a/src/app/shared/shared-facility-forms/facility-setup-form/facility-setup-form.component.spec.ts b/src/app/shared/shared-facility-forms/facility-setup-form/facility-setup-form.component.spec.ts new file mode 100644 index 00000000..57325502 --- /dev/null +++ b/src/app/shared/shared-facility-forms/facility-setup-form/facility-setup-form.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { FacilitySetupFormComponent } from './facility-setup-form.component'; + +describe('FacilitySetupFormComponent', () => { + let component: FacilitySetupFormComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [FacilitySetupFormComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(FacilitySetupFormComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/shared/shared-facility-forms/facility-setup-form/facility-setup-form.component.ts b/src/app/shared/shared-facility-forms/facility-setup-form/facility-setup-form.component.ts new file mode 100644 index 00000000..c94ba4c7 --- /dev/null +++ b/src/app/shared/shared-facility-forms/facility-setup-form/facility-setup-form.component.ts @@ -0,0 +1,35 @@ +import { Component } from '@angular/core'; +import { FormControl, Validators } from '@angular/forms'; +import { Router } from '@angular/router'; +import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; +import { IdbFacility } from 'src/app/models/facility'; + +@Component({ + selector: 'app-facility-setup-form', + templateUrl: './facility-setup-form.component.html', + styleUrl: './facility-setup-form.component.css' +}) +export class FacilitySetupFormComponent { + + name: FormControl; + facilityName: string; + facility: IdbFacility; + constructor(private facilityIdbService: FacilityIdbService, private router: Router + ) { + } + + ngOnInit() { + this.facility = this.facilityIdbService.selectedFacility.getValue(); + if (this.facility) { + this.name = new FormControl(this.facility.generalInformation.name, [Validators.required]); + } else { + this.router.navigateByUrl('/welcome'); + } + } + + async saveChanges() { + let facility: IdbFacility = this.facilityIdbService.selectedFacility.getValue(); + facility.generalInformation.name = this.name.value; + await this.facilityIdbService.asyncUpdate(facility); + } +} diff --git a/src/app/shared/shared-facility-forms/shared-facility-forms.module.ts b/src/app/shared/shared-facility-forms/shared-facility-forms.module.ts new file mode 100644 index 00000000..3b1de908 --- /dev/null +++ b/src/app/shared/shared-facility-forms/shared-facility-forms.module.ts @@ -0,0 +1,23 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FacilitySetupFormComponent } from './facility-setup-form/facility-setup-form.component'; +import { SharedSettingsFormsModule } from '../shared-settings-forms/shared-settings-forms.module'; +import { FormsModule, ReactiveFormsModule } from '@angular/forms'; + + + +@NgModule({ + declarations: [ + FacilitySetupFormComponent + ], + imports: [ + CommonModule, + SharedSettingsFormsModule, + FormsModule, + ReactiveFormsModule + ], + exports: [ + FacilitySetupFormComponent + ] +}) +export class SharedFacilityFormsModule { } diff --git a/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.html b/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.html index 25e6f35b..8e875c5e 100644 --- a/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.html +++ b/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.html @@ -1 +1,90 @@ -

facility-settings works!

+
+
+ +
+
+
+
+ Create Facility Copy +
+

+ Use the button below to create a copy of this facility. A copy of this facility will be added to + your + JUSTIFI portfolio. +

+ +
+
+
+ Delete Facility +
+

+ Use the button below to delete this facility and all of its corresponding data. This action cannot + be + undone. +

+ +
+
+
+
+ + +
+ + + + + \ No newline at end of file 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 99a45c61..4e03689b 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 @@ -1,4 +1,13 @@ import { Component } from '@angular/core'; +import { FormControl, Validators } from '@angular/forms'; +import { faCopy, faTrash, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Observable, of, Subscription } from 'rxjs'; +import { LoadingService } from 'src/app/core-components/loading/loading.service'; +import { ToastNotificationsService } from 'src/app/core-components/toast-notifications/toast-notifications.service'; +import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; +import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; +import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service'; +import { IdbFacility } from 'src/app/models/facility'; @Component({ selector: 'app-facility-settings', @@ -7,4 +16,86 @@ import { Component } from '@angular/core'; }) export class FacilitySettingsComponent { -} + + faTrash: IconDefinition = faTrash; + faCopy: IconDefinition = faCopy; + + showDeleteCompanyModal: boolean = false; + showCreateCopyModal: boolean = false; + + + name: FormControl; + facilityName: string; + facilitySub: Subscription; + facility: IdbFacility; + routeGuardWarningModal: boolean = false; + + constructor(private facilityIdbService: FacilityIdbService, + private loadingService: LoadingService, + private toastNotificationService: ToastNotificationsService, + private dbChangesService: DbChangesService + ) { + + } + + ngOnInit() { + this.facilitySub = this.facilityIdbService.selectedFacility.subscribe(facility => { + this.facility = facility; + this.name = new FormControl(this.facility.generalInformation.name, [Validators.required]); + }); + } + + ngOnDestroy() { + this.facilitySub.unsubscribe(); + } + + async saveChanges() { + let facility: IdbFacility = this.facilityIdbService.selectedFacility.getValue(); + facility.generalInformation.name = this.name.value; + await this.facilityIdbService.asyncUpdate(facility); + } + + canDeactivate(): Observable { + if (this.name && this.name.getError('required')) { + this.dislayWarningModal(); + return of(false); + } + return of(true); + } + + dislayWarningModal() { + this.routeGuardWarningModal = true; + } + closeWarningModal() { + this.routeGuardWarningModal = false; + } + + openDeleteCompanyModal() { + this.showDeleteCompanyModal = true; + } + + closeDeleteCompanyModal() { + this.showDeleteCompanyModal = false; + } + + openCreateCopyModal() { + this.showCreateCopyModal = true; + } + + closeCreateCopyModal() { + this.showCreateCopyModal = false; + } + + confirmCreateCopy() { + //TODO... + } + + async confirmDelete() { + this.showDeleteCompanyModal = false; + this.loadingService.setLoadingMessage('Deleting ' + this.facility.generalInformation.name + '...'); + this.loadingService.setLoadingStatus(true); + await this.dbChangesService.deleteFacility(this.facility); + this.loadingService.setLoadingStatus(false); + this.toastNotificationService.showToast('Facility Deleted!', undefined, 'bg-success', true, false); + } +} \ No newline at end of file diff --git a/src/app/user-portfolio/user-portfolio.module.ts b/src/app/user-portfolio/user-portfolio.module.ts index 831c0436..2817a67f 100644 --- a/src/app/user-portfolio/user-portfolio.module.ts +++ b/src/app/user-portfolio/user-portfolio.module.ts @@ -36,6 +36,7 @@ import { AssessmentDetailsComponent } from './assessment-dashboard/assessment-de import { AssessmentEnergyOpportunitiesComponent } from './assessment-dashboard/assessment-energy-opportunities/assessment-energy-opportunities.component'; import { ReportsModule } from '../shared/reports/reports.module'; import { SharedCompanyFormsModule } from "../shared/shared-company-forms/shared-company-forms.module"; +import { SharedFacilityFormsModule } from '../shared/shared-facility-forms/shared-facility-forms.module'; @NgModule({ declarations: [ @@ -77,7 +78,8 @@ import { SharedCompanyFormsModule } from "../shared/shared-company-forms/shared- RouterModule, SharedAssessmentFormsModule, ReportsModule, - SharedCompanyFormsModule + SharedCompanyFormsModule, + SharedFacilityFormsModule ] }) export class UserPortfolioModule { } From b2f48ba2a6f748c54567c64cad785663b36268ce Mon Sep 17 00:00:00 2001 From: rmroot Date: Mon, 11 Nov 2024 15:30:37 -0600 Subject: [PATCH 23/42] code cleanup --- .../company-settings.component.ts | 5 ++++- .../facility-reports.component.html | 8 +++++++- .../facility-settings.component.html | 10 +++++----- .../facility-settings.component.ts | 18 ++++++++++-------- 4 files changed, 26 insertions(+), 15 deletions(-) diff --git a/src/app/user-portfolio/company-dashboard/company-settings/company-settings.component.ts b/src/app/user-portfolio/company-dashboard/company-settings/company-settings.component.ts index 6b281284..38a16fdd 100644 --- a/src/app/user-portfolio/company-dashboard/company-settings/company-settings.component.ts +++ b/src/app/user-portfolio/company-dashboard/company-settings/company-settings.component.ts @@ -1,5 +1,6 @@ import { Component } from '@angular/core'; import { FormControl, Validators } from '@angular/forms'; +import { Router } from '@angular/router'; import { faCopy, faTrash, IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { Observable, of, Subscription } from 'rxjs'; import { LoadingService } from 'src/app/core-components/loading/loading.service'; @@ -32,7 +33,8 @@ export class CompanySettingsComponent { private companyIdbService: CompanyIdbService, private dbChangesService: DbChangesService, private loadingService: LoadingService, - private toastNotificationService: ToastNotificationsService + private toastNotificationService: ToastNotificationsService, + private router: Router ) { } @@ -94,5 +96,6 @@ export class CompanySettingsComponent { await this.dbChangesService.deleteCompany(this.company); this.loadingService.setLoadingStatus(false); this.toastNotificationService.showToast('Company Deleted!', undefined, 'bg-success', true, false); + this.router.navigateByUrl('/portfolio'); } } diff --git a/src/app/user-portfolio/facility-dashboard/facility-reports/facility-reports.component.html b/src/app/user-portfolio/facility-dashboard/facility-reports/facility-reports.component.html index b40e75f0..645f3d08 100644 --- a/src/app/user-portfolio/facility-dashboard/facility-reports/facility-reports.component.html +++ b/src/app/user-portfolio/facility-dashboard/facility-reports/facility-reports.component.html @@ -1 +1,7 @@ -

facility-reports works!

+
+
+
+ Facility level reports coming soon. +
+
+
\ No newline at end of file diff --git a/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.html b/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.html index 8e875c5e..e3359fa1 100644 --- a/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.html +++ b/src/app/user-portfolio/facility-dashboard/facility-settings/facility-settings.component.html @@ -26,7 +26,7 @@
be undone.

- @@ -36,7 +36,7 @@
-
+
- \ No newline at end of file diff --git a/src/app/setup-wizard/data-collection/on-site-assessment/on-site-assessment.component.ts b/src/app/setup-wizard/data-collection/on-site-assessment/on-site-assessment.component.ts index 49ad2ebb..3d0a7220 100644 --- a/src/app/setup-wizard/data-collection/on-site-assessment/on-site-assessment.component.ts +++ b/src/app/setup-wizard/data-collection/on-site-assessment/on-site-assessment.component.ts @@ -32,8 +32,6 @@ export class OnSiteAssessmentComponent { displayAddNebsModal: { energyOpportunityId: string, assessmentId: string }; displayAddNebsModalSub: Subscription; - displayContactModal: { context: ContactContext, viewContact: IdbContact, contextGuid: string }; - displayContactModalSub: Subscription; constructor(private router: Router, private assessmentIdbService: AssessmentIdbService, private activatedRoute: ActivatedRoute, private onSiteVisitIdbService: OnSiteVisitIdbService, @@ -53,9 +51,6 @@ export class OnSiteAssessmentComponent { this.displayAddNebsModal = _displayAddNebsModal; }); - this.displayContactModalSub = this.sharedDataService.displayContactModal.subscribe(_displayContactModal => { - this.displayContactModal = _displayContactModal; - }); this.activatedRoute.params.subscribe(params => { let assessmentGUID: string = params['id']; @@ -79,7 +74,6 @@ export class OnSiteAssessmentComponent { this.assessmentSub.unsubscribe(); this.onSiteVisitSub.unsubscribe(); this.displayAddNebsModalSub.unsubscribe(); - this.displayContactModalSub.unsubscribe(); } goToNextAssessment() { @@ -110,10 +104,6 @@ export class OnSiteAssessmentComponent { this.sharedDataService.displayAddNebsModal.next({ assessmentId: this.assessment.guid, energyOpportunityId: undefined }); } - closeContactModal() { - this.sharedDataService.displayContactModal.next(undefined); - } - goToNext() { if (this.router.url.includes('details')) { this.router.navigateByUrl('/setup-wizard/data-collection/' + this.onSiteVisit.guid + '/assessment/' + this.assessment.guid + '/energy-opportunities'); diff --git a/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.html b/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.html index 3c5eb9dd..d81b4c31 100644 --- a/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.html +++ b/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.html @@ -66,8 +66,4 @@
- - - \ No newline at end of file + \ No newline at end of file diff --git a/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.ts b/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.ts index 7a4013f7..8e9e1b59 100644 --- a/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.ts +++ b/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.ts @@ -6,8 +6,7 @@ import { DbChangesService } from 'src/app/indexed-db/db-changes.service'; import { ProcessEquipmentIdbService } from 'src/app/indexed-db/process-equipment-idb.service'; import { IdbContact } from 'src/app/models/contact'; import { IdbProcessEquipment } from 'src/app/models/processEquipment'; -import { EquipmentType, EquipmentTypes } from 'src/app/shared/constants/equipmentTypes'; -import { UtilityType, UtilityTypes } from 'src/app/shared/constants/utilityTypes'; +import { SharedDataService } from 'src/app/shared/shared-services/shared-data.service'; @Component({ selector: 'app-process-equipment-form', @@ -15,7 +14,7 @@ import { UtilityType, UtilityTypes } from 'src/app/shared/constants/utilityTypes styleUrl: './process-equipment-form.component.css' }) export class ProcessEquipmentFormComponent { - @Input({required: true}) + @Input({ required: true }) processEquipmentGuid: string; @Output('emitInitialized') emitInitialized = new EventEmitter(); @@ -28,11 +27,10 @@ export class ProcessEquipmentFormComponent { displayDeleteModal: boolean = false; contacts: Array; contactSub: Subscription; - viewContact: IdbContact; - displayContactModal: boolean = false; constructor(private processEquipmentIdbService: ProcessEquipmentIdbService, private dbChangesService: DbChangesService, - private contactIdbService: ContactIdbService + private contactIdbService: ContactIdbService, + private sharedDataService: SharedDataService ) { } ngOnInit() { @@ -69,12 +67,10 @@ export class ProcessEquipmentFormComponent { } openContactModal(viewContact: IdbContact) { - this.viewContact = viewContact; - this.displayContactModal = true; + this.sharedDataService.displayContactModal.next({ context: 'processEquipment', viewContact: viewContact, contextGuid: this.processEquipment.guid, companyId: this.processEquipment.companyId }); } closeContactModal() { - this.displayContactModal = false; - this.viewContact = undefined; + this.sharedDataService.displayContactModal.next(undefined) } } diff --git a/src/app/setup-wizard/pre-visit/pre-assessment-setup/pre-assessment-setup.component.html b/src/app/setup-wizard/pre-visit/pre-assessment-setup/pre-assessment-setup.component.html index 3a6c9883..4381b3cd 100644 --- a/src/app/setup-wizard/pre-visit/pre-assessment-setup/pre-assessment-setup.component.html +++ b/src/app/setup-wizard/pre-visit/pre-assessment-setup/pre-assessment-setup.component.html @@ -200,12 +200,12 @@
Utility Types
@@ -264,9 +264,4 @@
Utility Types
- - - - \ No newline at end of file + \ No newline at end of file diff --git a/src/app/setup-wizard/pre-visit/pre-assessment-setup/pre-assessment-setup.component.ts b/src/app/setup-wizard/pre-visit/pre-assessment-setup/pre-assessment-setup.component.ts index 81d81aab..fcc23cc8 100644 --- a/src/app/setup-wizard/pre-visit/pre-assessment-setup/pre-assessment-setup.component.ts +++ b/src/app/setup-wizard/pre-visit/pre-assessment-setup/pre-assessment-setup.component.ts @@ -17,13 +17,11 @@ import { UtilityOption, UtilityOptions } from 'src/app/shared/constants/utilityT import { BootstrapService } from 'src/app/shared/shared-services/bootstrap.service'; import { LocalStorageDataService } from 'src/app/shared/shared-services/local-storage-data.service'; import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; -import { IdbCompany } from 'src/app/models/company'; import { ConvertValue } from 'src/app/shared/conversions/convertValue'; import { UtilityEnergyUse } from 'src/app/models/utilityEnergyUses'; -import { SharedSettingsFormsService } from 'src/app/shared/shared-settings-forms/shared-settings-forms.service'; -import { FormGroup } from '@angular/forms'; import { UnitSettings } from 'src/app/models/unitSettings'; import { EnergyUnitOptions, UnitOption } from 'src/app/shared/constants/unitOptions'; +import { SharedDataService } from 'src/app/shared/shared-services/shared-data.service'; @Component({ selector: 'app-pre-assessment-setup', @@ -54,12 +52,9 @@ export class PreAssessmentSetupComponent { assessmentTypes: Array = AssessmentTypes; utilityOptions: Array = UtilityOptions; - + displayDeleteModal: boolean = false; assessmentToDelete: IdbAssessment; - displayContactModal: boolean = false; - contactAssessmentIndex: number; - viewContact: IdbContact; onSiteVisit: IdbOnSiteVisit; onSiteVisitSub: Subscription; @@ -83,6 +78,7 @@ export class PreAssessmentSetupComponent { private bootstrapService: BootstrapService, private localStorageDataService: LocalStorageDataService, private cd: ChangeDetectorRef, + private sharedDataService: SharedDataService ) { } @@ -125,7 +121,7 @@ export class PreAssessmentSetupComponent { this.companySub.unsubscribe(); this.facilitySub.unsubscribe(); } - + ngAfterViewInit() { //open the accordion for last viewed neb let lastAssessmentGuid: string = this.localStorageDataService.assessmentAccordionGuid; @@ -156,7 +152,7 @@ export class PreAssessmentSetupComponent { let selectedUnitOption = selectedUtilityOption.energyUnitOptions.find( _unitOption => _unitOption.value == utilityEnergyUse.energyUnit); // calculate use - if (selectedUtilityOption.isStandardEnergyUnit + if (selectedUtilityOption.isStandardEnergyUnit && selectedUnitOption.isStandard !== false) { convertedUse = this.convertValue.convertValue( utilityEnergyUse.energyUse, @@ -223,16 +219,12 @@ export class PreAssessmentSetupComponent { this.closeDeleteModal(); } - openContactModal(assessmentIndex: number, viewContact: IdbContact) { - this.contactAssessmentIndex = assessmentIndex; - this.viewContact = viewContact; - this.displayContactModal = true; + openContactModal(assessment: IdbAssessment, viewContact: IdbContact) { + this.sharedDataService.displayContactModal.next({ context: 'assessment', viewContact: viewContact, contextGuid: assessment.guid, companyId: assessment.companyId }) } closeContactModal() { - this.displayContactModal = false; - this.contactAssessmentIndex = undefined; - this.viewContact = undefined; + this.sharedDataService.displayContactModal.next(undefined); } async setVisitDate() { diff --git a/src/app/setup-wizard/setup-wizard.component.html b/src/app/setup-wizard/setup-wizard.component.html index 8b8ef9b1..4c3ee648 100644 --- a/src/app/setup-wizard/setup-wizard.component.html +++ b/src/app/setup-wizard/setup-wizard.component.html @@ -4,4 +4,10 @@ - \ No newline at end of file + + + + + \ No newline at end of file diff --git a/src/app/setup-wizard/setup-wizard.component.ts b/src/app/setup-wizard/setup-wizard.component.ts index f6081a8a..79b02630 100644 --- a/src/app/setup-wizard/setup-wizard.component.ts +++ b/src/app/setup-wizard/setup-wizard.component.ts @@ -1,4 +1,7 @@ import { Component } from '@angular/core'; +import { SharedDataService } from '../shared/shared-services/shared-data.service'; +import { Subscription } from 'rxjs'; +import { ContactContext, IdbContact } from '../models/contact'; @Component({ selector: 'app-setup-wizard', @@ -7,4 +10,24 @@ import { Component } from '@angular/core'; }) export class SetupWizardComponent { + + displayContactModal: { context: ContactContext, viewContact: IdbContact, contextGuid: string, companyId: string }; + displayContactModalSub: Subscription; + constructor(private sharedDataService: SharedDataService) { + + } + + ngOnInit() { + this.displayContactModalSub = this.sharedDataService.displayContactModal.subscribe(_displayContactModal => { + this.displayContactModal = _displayContactModal; + }); + } + + ngOnDestroy() { + this.displayContactModalSub.unsubscribe(); + } + + closeContactModal() { + this.sharedDataService.displayContactModal.next(undefined); + } } diff --git a/src/app/setup-wizard/setup-wizard.module.ts b/src/app/setup-wizard/setup-wizard.module.ts index 9e32a29b..547caa45 100644 --- a/src/app/setup-wizard/setup-wizard.module.ts +++ b/src/app/setup-wizard/setup-wizard.module.ts @@ -38,7 +38,6 @@ import { AssessmentEvaluationComponent } from './data-evaluation/assessment-eval import { OnSiteAssessmentResultsComponent } from './data-collection/on-site-assessment/on-site-assessment-results/on-site-assessment-results.component'; import { ProcessEquipmentFormComponent } from './pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component'; import { FacilityEnergyEquipmentSetupComponent } from './pre-visit/facility-energy-equipment-setup/facility-energy-equipment-setup.component'; -import { EnergyEquipmentFormComponent } from './pre-visit/facility-energy-equipment-setup/energy-equipment-form/energy-equipment-form.component'; import { PrimaryKpiBadgeModule } from "../shared/primary-kpi-badge/primary-kpi-badge.module"; import { EnergyOpportunityNebsTableComponent } from './data-collection/on-site-assessment/assessment-nebs-form/energy-opportunity-nebs-table/energy-opportunity-nebs-table.component'; import { EnergyOpportunityNebsListPipe } from './data-collection/on-site-assessment/assessment-nebs-form/energy-opportunity-nebs-table/energy-opportunity-nebs-list.pipe'; @@ -82,7 +81,6 @@ import { AssessmentEnergyOpportunitiesFormComponent } from './data-collection/on OnSiteAssessmentResultsComponent, ProcessEquipmentFormComponent, FacilityEnergyEquipmentSetupComponent, - EnergyEquipmentFormComponent, EnergyOpportunityNebsTableComponent, EnergyOpportunityNebsListPipe, AssessmentEnergyOpportunitiesFormComponent diff --git a/src/app/shared/shared-assessment-forms/assessment-details-form/assessment-details-form.component.ts b/src/app/shared/shared-assessment-forms/assessment-details-form/assessment-details-form.component.ts index 61f37482..e0ed1aec 100644 --- a/src/app/shared/shared-assessment-forms/assessment-details-form/assessment-details-form.component.ts +++ b/src/app/shared/shared-assessment-forms/assessment-details-form/assessment-details-form.component.ts @@ -67,7 +67,7 @@ export class AssessmentDetailsFormComponent { private facilityIdbService: FacilityIdbService, private energyOpportunityIdbService: EnergyOpportunityIdbService, private assessmentEnergyOpportunitiesFormService: AssessmentEnergyOpportunitiesFormService, - + ) { } ngOnInit() { @@ -135,7 +135,7 @@ export class AssessmentDetailsFormComponent { let selectedUnitOption = selectedUtilityOption.energyUnitOptions.find( _unitOption => _unitOption.value == utilityEnergyUse.energyUnit); // calculate use - if (selectedUtilityOption.isStandardEnergyUnit + if (selectedUtilityOption.isStandardEnergyUnit && selectedUnitOption.isStandard !== false) { convertedUse = this.convertValue.convertValue( utilityEnergyUse.energyUse, @@ -170,7 +170,9 @@ export class AssessmentDetailsFormComponent { openContactModal(viewContact: IdbContact) { this.sharedDataService.displayContactModal.next( - { context: 'assessment', viewContact: viewContact, contextGuid: this.assessment.guid }); + { + context: 'assessment', viewContact: viewContact, contextGuid: this.assessment.guid, companyId: this.assessment.companyId + }); } } diff --git a/src/app/shared/shared-assessment-forms/neb-forms-accordion/neb-setup-form/neb-setup-form.component.ts b/src/app/shared/shared-assessment-forms/neb-forms-accordion/neb-setup-form/neb-setup-form.component.ts index f5143938..1e3d9676 100644 --- a/src/app/shared/shared-assessment-forms/neb-forms-accordion/neb-setup-form/neb-setup-form.component.ts +++ b/src/app/shared/shared-assessment-forms/neb-forms-accordion/neb-setup-form/neb-setup-form.component.ts @@ -140,7 +140,7 @@ export class NebSetupFormComponent { } openContactModal(viewContact: IdbContact) { - this.sharedDataService.displayContactModal.next({ context: 'nonEnergyBenefit', viewContact: viewContact, contextGuid: this.nonEnergyBenefit.guid }); + this.sharedDataService.displayContactModal.next({ context: 'nonEnergyBenefit', viewContact: viewContact, contextGuid: this.nonEnergyBenefit.guid, companyId: this.nonEnergyBenefit.companyId }); } toggleUntrackedNebs() { diff --git a/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.html b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.html index f7490905..e717a7d4 100644 --- a/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.html +++ b/src/app/shared/shared-company-forms/company-kpi-details-form/company-kpi-details-form.component.html @@ -201,12 +201,6 @@
- - - -
- - - \ No newline at end of file + \ No newline at end of file diff --git a/src/app/setup-wizard/pre-visit/facility-energy-equipment-setup/energy-equipment-form/energy-equipment-form.component.spec.ts b/src/app/shared/shared-facility-forms/energy-equipment-form/energy-equipment-form.component.spec.ts similarity index 100% rename from src/app/setup-wizard/pre-visit/facility-energy-equipment-setup/energy-equipment-form/energy-equipment-form.component.spec.ts rename to src/app/shared/shared-facility-forms/energy-equipment-form/energy-equipment-form.component.spec.ts diff --git a/src/app/setup-wizard/pre-visit/facility-energy-equipment-setup/energy-equipment-form/energy-equipment-form.component.ts b/src/app/shared/shared-facility-forms/energy-equipment-form/energy-equipment-form.component.ts similarity index 84% rename from src/app/setup-wizard/pre-visit/facility-energy-equipment-setup/energy-equipment-form/energy-equipment-form.component.ts rename to src/app/shared/shared-facility-forms/energy-equipment-form/energy-equipment-form.component.ts index 29758615..c4173a43 100644 --- a/src/app/setup-wizard/pre-visit/facility-energy-equipment-setup/energy-equipment-form/energy-equipment-form.component.ts +++ b/src/app/shared/shared-facility-forms/energy-equipment-form/energy-equipment-form.component.ts @@ -1,4 +1,5 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; import { faContactBook, faTrash, faUser, IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { Subscription } from 'rxjs'; import { CompanyIdbService } from 'src/app/indexed-db/company-idb.service'; @@ -13,6 +14,7 @@ import { EquipmentType, EquipmentTypeOptions, EquipmentTypes } from 'src/app/sha import { EnergyUnitOptions, ProcessCoolingUnitOptions, UnitOption, VolumeGasOptions, VolumeLiquidOptions } from 'src/app/shared/constants/unitOptions'; import { UtilityOption, UtilityOptions, UtilityType, UtilityTypes } from 'src/app/shared/constants/utilityTypes'; import { ConvertValue } from 'src/app/shared/conversions/convertValue'; +import { SharedDataService } from '../../shared-services/shared-data.service'; @Component({ selector: 'app-energy-equipment-form', @@ -30,12 +32,14 @@ export class EnergyEquipmentFormComponent { faContactBook: IconDefinition = faContactBook; equipmentTypes: Array = EquipmentTypes; - equipmentTypeOptions: Array<{ equipmentType: EquipmentType, - utilityTypes: Array, - defaultUnit: string }> = EquipmentTypeOptions; + equipmentTypeOptions: Array<{ + equipmentType: EquipmentType, + utilityTypes: Array, + defaultUnit: string + }> = EquipmentTypeOptions; utilityOptions: Array = UtilityOptions; - fuelVolumeUnitOptions:Array = [...VolumeLiquidOptions, ...VolumeGasOptions]; + fuelVolumeUnitOptions: Array = [...VolumeLiquidOptions, ...VolumeGasOptions]; fuelEnergyUnitOptions: Array = EnergyUnitOptions; processCoolingUnitOptions: Array = ProcessCoolingUnitOptions @@ -46,8 +50,6 @@ export class EnergyEquipmentFormComponent { displayDeleteModal: boolean = false; contacts: Array; contactSub: Subscription; - viewContact: IdbContact; - displayContactModal: boolean = false; companySub: Subscription; companyEnergyUnit: string; @@ -59,10 +61,20 @@ export class EnergyEquipmentFormComponent { private contactIdbService: ContactIdbService, private companyIdbService: CompanyIdbService, private facilityIdbService: FacilityIdbService, + private activatedRoute: ActivatedRoute, + private sharedDataService: SharedDataService ) { } ngOnInit() { - this.energyEquipment = this.energyEquipmentIdbService.getByGuid(this.energyEquipmentGuid); + if (!this.energyEquipmentGuid) { + this.activatedRoute.params.subscribe(params => { + this.energyEquipmentGuid = params['id']; + this.energyEquipment = this.energyEquipmentIdbService.getByGuid(this.energyEquipmentGuid); + }); + } else { + this.energyEquipment = this.energyEquipmentIdbService.getByGuid(this.energyEquipmentGuid); + } + this.contactSub = this.contactIdbService.contacts.subscribe(_contacts => { this.contacts = _contacts; }); @@ -109,8 +121,8 @@ export class EnergyEquipmentFormComponent { autoCalculateFuelPower() { if (this.energyEquipment.utilityType === 'Other Fuels' && this.energyEquipment.autoCalculate) { let result = this.energyEquipment.fuelConsumption * this.energyEquipment.fuelHHV; - let unitConv = this.convertValue.convertValue(1, this.energyEquipment.fuelEnergyUnit).convertedValue/ - this.convertValue.convertValue(1, this.energyEquipment.sizeUnit).convertedValue /3600; // J/hr to W + let unitConv = this.convertValue.convertValue(1, this.energyEquipment.fuelEnergyUnit).convertedValue / + this.convertValue.convertValue(1, this.energyEquipment.sizeUnit).convertedValue / 3600; // J/hr to W result = result * unitConv; this.energyEquipment.size = Number(result.toFixed(3)); // Round to 3 decimal places } @@ -136,13 +148,13 @@ export class EnergyEquipmentFormComponent { updateFacilityUtilityUnit() { const utilityType = this.energyEquipment.utilityType.replace(/\s+/g, ''); const camelCaseType = utilityType.charAt(0).toLowerCase() - + utilityType.slice(1); // Lowercase first letter + + utilityType.slice(1); // Lowercase first letter if (this.facilityUnitSettings[`include${camelCaseType}`]) { let selectedUtilityOption = this.utilityOptions.find( _option => _option.utilityType == utilityType); let selectedUnitOption = selectedUtilityOption.energyUnitOptions.find( _unitOption => _unitOption.value == this.energyEquipment.facilityUtilityUnit); - if (selectedUtilityOption.isStandardEnergyUnit + if (selectedUtilityOption.isStandardEnergyUnit && selectedUnitOption.isStandard !== false) { // Standard unit this.energyEquipment.facilityUtilityUnit = this.facilityUnitSettings[`${camelCaseType}Unit`]; } else { // Non-standard unit @@ -159,12 +171,12 @@ export class EnergyEquipmentFormComponent { this.companyEnergyUnit, this.energyEquipment.facilityUtilityUnit ).convertedValue; - if (!this.energyEquipment.annualEnergyUseByUtility || + if (!this.energyEquipment.annualEnergyUseByUtility || this.energyEquipment.annualEnergyUseByUtility === Infinity) { this.energyEquipment.annualEnergyUseByUtility = 0; } } - + ngAfterViewInit() { //emit after initialized. //When adding new energy equipment this will trigger the form to open @@ -188,12 +200,10 @@ export class EnergyEquipmentFormComponent { } openContactModal(viewContact: IdbContact) { - this.viewContact = viewContact; - this.displayContactModal = true; + this.sharedDataService.displayContactModal.next({ context: 'energyEquipment', viewContact: viewContact, contextGuid: this.energyEquipment.guid, companyId: this.energyEquipment.companyId }); } closeContactModal() { - this.displayContactModal = false; - this.viewContact = undefined; + this.sharedDataService.displayContactModal.next(undefined); } } \ No newline at end of file diff --git a/src/app/shared/shared-facility-forms/shared-facility-forms.module.ts b/src/app/shared/shared-facility-forms/shared-facility-forms.module.ts index 3b1de908..35f530df 100644 --- a/src/app/shared/shared-facility-forms/shared-facility-forms.module.ts +++ b/src/app/shared/shared-facility-forms/shared-facility-forms.module.ts @@ -3,21 +3,28 @@ import { CommonModule } from '@angular/common'; import { FacilitySetupFormComponent } from './facility-setup-form/facility-setup-form.component'; import { SharedSettingsFormsModule } from '../shared-settings-forms/shared-settings-forms.module'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; +import { EnergyEquipmentFormComponent } from './energy-equipment-form/energy-equipment-form.component'; +import { HelperPipesModule } from '../helper-pipes/helper-pipes.module'; +import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; @NgModule({ declarations: [ - FacilitySetupFormComponent + FacilitySetupFormComponent, + EnergyEquipmentFormComponent ], imports: [ CommonModule, SharedSettingsFormsModule, FormsModule, - ReactiveFormsModule + ReactiveFormsModule, + HelperPipesModule, + FontAwesomeModule ], exports: [ - FacilitySetupFormComponent + FacilitySetupFormComponent, + EnergyEquipmentFormComponent ] }) export class SharedFacilityFormsModule { } diff --git a/src/app/shared/shared-services/shared-data.service.ts b/src/app/shared/shared-services/shared-data.service.ts index 3c0394fa..64aa6aef 100644 --- a/src/app/shared/shared-services/shared-data.service.ts +++ b/src/app/shared/shared-services/shared-data.service.ts @@ -18,12 +18,13 @@ export class SharedDataService { displayContactModal: BehaviorSubject<{ context: ContactContext, viewContact: IdbContact, - contextGuid: string + contextGuid: string, + companyId: string }>; constructor() { this.createAssessmentModalOpen = new BehaviorSubject(false); this.sidebarOpen = new BehaviorSubject(false); this.displayAddNebsModal = new BehaviorSubject<{ assessmentId: string, energyOpportunityId: string }>(undefined); - this.displayContactModal = new BehaviorSubject<{ context: ContactContext, viewContact: IdbContact, contextGuid: string }>(undefined); + this.displayContactModal = new BehaviorSubject<{ context: ContactContext, viewContact: IdbContact, contextGuid: string, companyId: string }>(undefined); } } diff --git a/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.html b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.html index cd985bc9..a4a16c6e 100644 --- a/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.html +++ b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.html @@ -20,8 +20,8 @@
Reports - + - \ No newline at end of file diff --git a/src/app/user-portfolio/facility-dashboard/facility-dashboard-nav/facility-dashboard-nav.component.html b/src/app/user-portfolio/facility-dashboard/facility-dashboard-nav/facility-dashboard-nav.component.html index 4beae459..8f37e2d1 100644 --- a/src/app/user-portfolio/facility-dashboard/facility-dashboard-nav/facility-dashboard-nav.component.html +++ b/src/app/user-portfolio/facility-dashboard/facility-dashboard-nav/facility-dashboard-nav.component.html @@ -4,20 +4,30 @@ [routerLinkActiveOptions]="{exact: true}">Facility Dashboard + - \ No newline at end of file diff --git a/src/app/user-portfolio/facility-dashboard/facility-dashboard-nav/facility-dashboard-nav.component.ts b/src/app/user-portfolio/facility-dashboard/facility-dashboard-nav/facility-dashboard-nav.component.ts index af185499..7aec86d1 100644 --- a/src/app/user-portfolio/facility-dashboard/facility-dashboard-nav/facility-dashboard-nav.component.ts +++ b/src/app/user-portfolio/facility-dashboard/facility-dashboard-nav/facility-dashboard-nav.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import { faDiagramProject, faFile, faGears, faList, IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { Subscription } from 'rxjs'; import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; import { IdbFacility } from 'src/app/models/facility'; @@ -10,6 +11,11 @@ import { IdbFacility } from 'src/app/models/facility'; }) export class FacilityDashboardNavComponent { + faGears: IconDefinition = faGears; + faFile: IconDefinition = faFile; + faList: IconDefinition = faList; + faDiagramProject: IconDefinition = faDiagramProject; + facility: IdbFacility; facilitySub: Subscription; constructor(private facilityIdbService: FacilityIdbService) { } diff --git a/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component.css b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component.css new file mode 100644 index 00000000..e69de29b diff --git a/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component.html b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component.html new file mode 100644 index 00000000..c9a2c20a --- /dev/null +++ b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component.html @@ -0,0 +1 @@ +

industrial-system-inventory-home works!

diff --git a/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component.spec.ts b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component.spec.ts new file mode 100644 index 00000000..d6f9997c --- /dev/null +++ b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { IndustrialSystemInventoryHomeComponent } from './industrial-system-inventory-home.component'; + +describe('IndustrialSystemInventoryHomeComponent', () => { + let component: IndustrialSystemInventoryHomeComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [IndustrialSystemInventoryHomeComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(IndustrialSystemInventoryHomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component.ts b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component.ts new file mode 100644 index 00000000..d0e9b254 --- /dev/null +++ b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-industrial-system-inventory-home', + templateUrl: './industrial-system-inventory-home.component.html', + styleUrl: './industrial-system-inventory-home.component.css' +}) +export class IndustrialSystemInventoryHomeComponent { + +} diff --git a/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.css b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.css index e69de29b..086d2eac 100644 --- a/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.css +++ b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.css @@ -0,0 +1,70 @@ +.navbar{ + /* width: 20rem; */ + /* background-color: #ffffff; */ + overflow-y: auto; + /* height: 100%; */ + /* max-height: 100%; */ + flex-wrap: nowrap; +} + +.navbar.collapsed{ + width: auto; +} + +.nav-item{ + width: 100%; +} + +.nav-link{ + /* padding-left: .5rem; */ + padding: .25rem; + text-wrap-mode: nowrap; + border-bottom: solid 1px; + border-color: black; +} + +.nav-link.active{ + background-color: #0079c2; + color: white; +} + +.nav-link:hover{ + background-color: #8DABBE; + color: black; +} + + +.text-end{ + text-align: right; +} + +.toggle-collapse{ + font-size: x-large; +} + +.toggle-collapse:hover{ + cursor: pointer; + border: so; +} + +.btn.text-left{ + text-align: left; +} + +.nav-link:hover{ + cursor: pointer; +} + +.nav-flex{ + height: fit-content; +} + +.chevron.float-right{ + /* display: none; */ + color: white; + float: right; +} + +/* .active .chevron.float-right{ + display: block; +} */ \ No newline at end of file diff --git a/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.html b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.html index 977002aa..a7462de7 100644 --- a/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.html +++ b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.html @@ -1 +1,39 @@ -

industrial-system-inventory works!

+ \ No newline at end of file diff --git a/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.ts b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.ts index d9787d0c..466c1c03 100644 --- a/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.ts +++ b/src/app/user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory.component.ts @@ -1,4 +1,10 @@ import { Component } from '@angular/core'; +import { faChevronRight, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Subscription } from 'rxjs'; +import { EnergyEquipmentIdbService } from 'src/app/indexed-db/energy-equipment-idb.service'; +import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; +import { IdbEnergyEquipment } from 'src/app/models/energyEquipment'; +import { IdbFacility } from 'src/app/models/facility'; @Component({ selector: 'app-industrial-system-inventory', @@ -7,4 +13,33 @@ import { Component } from '@angular/core'; }) export class IndustrialSystemInventoryComponent { + faChevronRight: IconDefinition = faChevronRight; + + facility: IdbFacility; + facilitySub: Subscription; + + + energyEquipmentsSub: Subscription + energyEquipments: Array; + + constructor(private facilityIdbService: FacilityIdbService, + private energyEquipmentIdbService: EnergyEquipmentIdbService + ) { } + + ngOnInit() { + this.facilitySub = this.facilityIdbService.selectedFacility.subscribe(facility => { + this.facility = facility; + }); + + this.energyEquipmentsSub = this.energyEquipmentIdbService.energyEquipments.subscribe(energyEquipments => { + this.energyEquipments = energyEquipments.filter(equipment => { + return equipment.facilityId == this.facility.guid; + }); + }); + } + + ngOnDestroy() { + this.energyEquipmentsSub.unsubscribe(); + this.facilitySub.unsubscribe(); + } } diff --git a/src/app/user-portfolio/user-portfolio.component.html b/src/app/user-portfolio/user-portfolio.component.html index f1d94251..e1dfb265 100644 --- a/src/app/user-portfolio/user-portfolio.component.html +++ b/src/app/user-portfolio/user-portfolio.component.html @@ -41,4 +41,4 @@ + [selectedContact]="displayContactModal.viewContact" [companyGuid]="displayContactModal.companyId"> diff --git a/src/app/user-portfolio/user-portfolio.component.ts b/src/app/user-portfolio/user-portfolio.component.ts index 04d9fc53..27a693c5 100644 --- a/src/app/user-portfolio/user-portfolio.component.ts +++ b/src/app/user-portfolio/user-portfolio.component.ts @@ -36,7 +36,7 @@ export class UserPortfolioComponent { energyOpportunityId: string }; displayAddNebsModalSub: Subscription; - displayContactModal: { context: ContactContext, viewContact: IdbContact, contextGuid: string }; + displayContactModal: { context: ContactContext, viewContact: IdbContact, contextGuid: string, companyId: string }; displayContactModalSub: Subscription; constructor( private router: Router, diff --git a/src/app/user-portfolio/user-portfolio.module.ts b/src/app/user-portfolio/user-portfolio.module.ts index 4214b959..eef65acb 100644 --- a/src/app/user-portfolio/user-portfolio.module.ts +++ b/src/app/user-portfolio/user-portfolio.module.ts @@ -41,6 +41,7 @@ import { AssessmentEnergyOpportunitiesHomeComponent } from './assessment-dashboa import { AssessmentNebsComponent } from './assessment-dashboard/assessment-nebs/assessment-nebs.component'; import { AssessmentNebsHomeComponent } from './assessment-dashboard/assessment-nebs/assessment-nebs-home/assessment-nebs-home.component'; import { ContactModalModule } from '../shared/contact-modal/contact-modal.module'; +import { IndustrialSystemInventoryHomeComponent } from './facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component'; @NgModule({ declarations: [ @@ -75,7 +76,8 @@ import { ContactModalModule } from '../shared/contact-modal/contact-modal.module AssessmentEnergyOpportunitiesComponent, AssessmentEnergyOpportunitiesHomeComponent, AssessmentNebsComponent, - AssessmentNebsHomeComponent + AssessmentNebsHomeComponent, + IndustrialSystemInventoryHomeComponent ], imports: [ CommonModule, From 05c5eeae9a0c19922d83121d9ba80ea175c488f8 Mon Sep 17 00:00:00 2001 From: rmroot Date: Tue, 12 Nov 2024 10:39:10 -0600 Subject: [PATCH 28/42] add end use inventory to facility dashboard --- src/app/routing/portfolio.routes.ts | 14 +++- src/app/setup-wizard/setup-wizard.module.ts | 2 - .../process-equipment-form.component.css | 0 .../process-equipment-form.component.html | 0 .../process-equipment-form.component.spec.ts | 0 .../process-equipment-form.component.ts | 13 +++- .../shared-facility-forms.module.ts | 7 +- .../end-use-inventory-home.component.css | 0 .../end-use-inventory-home.component.html | 1 + .../end-use-inventory-home.component.spec.ts | 23 ++++++ .../end-use-inventory-home.component.ts | 10 +++ .../end-use-inventory.component.css | 70 +++++++++++++++++++ .../end-use-inventory.component.html | 40 ++++++++++- .../end-use-inventory.component.ts | 35 ++++++++++ .../user-portfolio/user-portfolio.module.ts | 4 +- 15 files changed, 210 insertions(+), 9 deletions(-) rename src/app/{setup-wizard/pre-visit/facility-process-equipment-setup => shared/shared-facility-forms}/process-equipment-form/process-equipment-form.component.css (100%) rename src/app/{setup-wizard/pre-visit/facility-process-equipment-setup => shared/shared-facility-forms}/process-equipment-form/process-equipment-form.component.html (100%) rename src/app/{setup-wizard/pre-visit/facility-process-equipment-setup => shared/shared-facility-forms}/process-equipment-form/process-equipment-form.component.spec.ts (100%) rename src/app/{setup-wizard/pre-visit/facility-process-equipment-setup => shared/shared-facility-forms}/process-equipment-form/process-equipment-form.component.ts (82%) create mode 100644 src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.css create mode 100644 src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.html create mode 100644 src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.spec.ts create mode 100644 src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.ts diff --git a/src/app/routing/portfolio.routes.ts b/src/app/routing/portfolio.routes.ts index 80bf7544..1fe2f8d5 100644 --- a/src/app/routing/portfolio.routes.ts +++ b/src/app/routing/portfolio.routes.ts @@ -29,6 +29,8 @@ import { AssessmentNebsHomeComponent } from "../user-portfolio/assessment-dashbo import { NebSetupFormComponent } from "../shared/shared-assessment-forms/neb-forms-accordion/neb-setup-form/neb-setup-form.component"; import { IndustrialSystemInventoryHomeComponent } from "../user-portfolio/facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component"; import { EnergyEquipmentFormComponent } from "../shared/shared-facility-forms/energy-equipment-form/energy-equipment-form.component"; +import { EndUseInventoryHomeComponent } from "../user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component"; +import { ProcessEquipmentFormComponent } from "../shared/shared-facility-forms/process-equipment-form/process-equipment-form.component"; export const PortfolioRoutes: Route = { @@ -101,7 +103,17 @@ export const PortfolioRoutes: Route = { }, { path: 'end-use-inventory', - component: EndUseInventoryComponent + component: EndUseInventoryComponent, + children: [ + { + path: '', + component: EndUseInventoryHomeComponent + }, + { + path: ':id', + component: ProcessEquipmentFormComponent + } + ] }, { path: 'reports', diff --git a/src/app/setup-wizard/setup-wizard.module.ts b/src/app/setup-wizard/setup-wizard.module.ts index 547caa45..095e6fb8 100644 --- a/src/app/setup-wizard/setup-wizard.module.ts +++ b/src/app/setup-wizard/setup-wizard.module.ts @@ -36,7 +36,6 @@ import { VisitReportComponent } from './data-evaluation/visit-report/visit-repor import { ReportsModule } from '../shared/reports/reports.module'; import { AssessmentEvaluationComponent } from './data-evaluation/assessment-evaluation/assessment-evaluation.component'; import { OnSiteAssessmentResultsComponent } from './data-collection/on-site-assessment/on-site-assessment-results/on-site-assessment-results.component'; -import { ProcessEquipmentFormComponent } from './pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component'; import { FacilityEnergyEquipmentSetupComponent } from './pre-visit/facility-energy-equipment-setup/facility-energy-equipment-setup.component'; import { PrimaryKpiBadgeModule } from "../shared/primary-kpi-badge/primary-kpi-badge.module"; import { EnergyOpportunityNebsTableComponent } from './data-collection/on-site-assessment/assessment-nebs-form/energy-opportunity-nebs-table/energy-opportunity-nebs-table.component'; @@ -79,7 +78,6 @@ import { AssessmentEnergyOpportunitiesFormComponent } from './data-collection/on VisitReportComponent, AssessmentEvaluationComponent, OnSiteAssessmentResultsComponent, - ProcessEquipmentFormComponent, FacilityEnergyEquipmentSetupComponent, EnergyOpportunityNebsTableComponent, EnergyOpportunityNebsListPipe, diff --git a/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.css b/src/app/shared/shared-facility-forms/process-equipment-form/process-equipment-form.component.css similarity index 100% rename from src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.css rename to src/app/shared/shared-facility-forms/process-equipment-form/process-equipment-form.component.css diff --git a/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.html b/src/app/shared/shared-facility-forms/process-equipment-form/process-equipment-form.component.html similarity index 100% rename from src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.html rename to src/app/shared/shared-facility-forms/process-equipment-form/process-equipment-form.component.html diff --git a/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.spec.ts b/src/app/shared/shared-facility-forms/process-equipment-form/process-equipment-form.component.spec.ts similarity index 100% rename from src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.spec.ts rename to src/app/shared/shared-facility-forms/process-equipment-form/process-equipment-form.component.spec.ts diff --git a/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.ts b/src/app/shared/shared-facility-forms/process-equipment-form/process-equipment-form.component.ts similarity index 82% rename from src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.ts rename to src/app/shared/shared-facility-forms/process-equipment-form/process-equipment-form.component.ts index 8e9e1b59..aa2efe41 100644 --- a/src/app/setup-wizard/pre-visit/facility-process-equipment-setup/process-equipment-form/process-equipment-form.component.ts +++ b/src/app/shared/shared-facility-forms/process-equipment-form/process-equipment-form.component.ts @@ -1,4 +1,5 @@ import { Component, EventEmitter, Input, Output } from '@angular/core'; +import { ActivatedRoute } from '@angular/router'; import { faContactBook, faTrash, faUser, IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { Subscription } from 'rxjs'; import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service'; @@ -30,11 +31,19 @@ export class ProcessEquipmentFormComponent { constructor(private processEquipmentIdbService: ProcessEquipmentIdbService, private dbChangesService: DbChangesService, private contactIdbService: ContactIdbService, - private sharedDataService: SharedDataService + private sharedDataService: SharedDataService, + private activatedRoute: ActivatedRoute ) { } ngOnInit() { - this.processEquipment = this.processEquipmentIdbService.getByGuid(this.processEquipmentGuid); + if (!this.processEquipmentGuid) { + this.activatedRoute.params.subscribe(params => { + this.processEquipmentGuid = params['id']; + this.processEquipment = this.processEquipmentIdbService.getByGuid(this.processEquipmentGuid); + }); + } else { + this.processEquipment = this.processEquipmentIdbService.getByGuid(this.processEquipmentGuid); + } this.contactSub = this.contactIdbService.contacts.subscribe(_contacts => { this.contacts = _contacts; }); diff --git a/src/app/shared/shared-facility-forms/shared-facility-forms.module.ts b/src/app/shared/shared-facility-forms/shared-facility-forms.module.ts index 35f530df..bb659c00 100644 --- a/src/app/shared/shared-facility-forms/shared-facility-forms.module.ts +++ b/src/app/shared/shared-facility-forms/shared-facility-forms.module.ts @@ -6,13 +6,15 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { EnergyEquipmentFormComponent } from './energy-equipment-form/energy-equipment-form.component'; import { HelperPipesModule } from '../helper-pipes/helper-pipes.module'; import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; +import { ProcessEquipmentFormComponent } from './process-equipment-form/process-equipment-form.component'; @NgModule({ declarations: [ FacilitySetupFormComponent, - EnergyEquipmentFormComponent + EnergyEquipmentFormComponent, + ProcessEquipmentFormComponent ], imports: [ CommonModule, @@ -24,7 +26,8 @@ import { FontAwesomeModule } from '@fortawesome/angular-fontawesome'; ], exports: [ FacilitySetupFormComponent, - EnergyEquipmentFormComponent + EnergyEquipmentFormComponent, + ProcessEquipmentFormComponent ] }) export class SharedFacilityFormsModule { } diff --git a/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.css b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.css new file mode 100644 index 00000000..e69de29b diff --git a/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.html b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.html new file mode 100644 index 00000000..5f3b7ef0 --- /dev/null +++ b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.html @@ -0,0 +1 @@ +

end-use-inventory-home works!

diff --git a/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.spec.ts b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.spec.ts new file mode 100644 index 00000000..dd183f2e --- /dev/null +++ b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.spec.ts @@ -0,0 +1,23 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { EndUseInventoryHomeComponent } from './end-use-inventory-home.component'; + +describe('EndUseInventoryHomeComponent', () => { + let component: EndUseInventoryHomeComponent; + let fixture: ComponentFixture; + + beforeEach(async () => { + await TestBed.configureTestingModule({ + declarations: [EndUseInventoryHomeComponent] + }) + .compileComponents(); + + fixture = TestBed.createComponent(EndUseInventoryHomeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.ts b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.ts new file mode 100644 index 00000000..4c3dd59f --- /dev/null +++ b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component.ts @@ -0,0 +1,10 @@ +import { Component } from '@angular/core'; + +@Component({ + selector: 'app-end-use-inventory-home', + templateUrl: './end-use-inventory-home.component.html', + styleUrl: './end-use-inventory-home.component.css' +}) +export class EndUseInventoryHomeComponent { + +} diff --git a/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.css b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.css index e69de29b..086d2eac 100644 --- a/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.css +++ b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.css @@ -0,0 +1,70 @@ +.navbar{ + /* width: 20rem; */ + /* background-color: #ffffff; */ + overflow-y: auto; + /* height: 100%; */ + /* max-height: 100%; */ + flex-wrap: nowrap; +} + +.navbar.collapsed{ + width: auto; +} + +.nav-item{ + width: 100%; +} + +.nav-link{ + /* padding-left: .5rem; */ + padding: .25rem; + text-wrap-mode: nowrap; + border-bottom: solid 1px; + border-color: black; +} + +.nav-link.active{ + background-color: #0079c2; + color: white; +} + +.nav-link:hover{ + background-color: #8DABBE; + color: black; +} + + +.text-end{ + text-align: right; +} + +.toggle-collapse{ + font-size: x-large; +} + +.toggle-collapse:hover{ + cursor: pointer; + border: so; +} + +.btn.text-left{ + text-align: left; +} + +.nav-link:hover{ + cursor: pointer; +} + +.nav-flex{ + height: fit-content; +} + +.chevron.float-right{ + /* display: none; */ + color: white; + float: right; +} + +/* .active .chevron.float-right{ + display: block; +} */ \ No newline at end of file diff --git a/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.html b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.html index 7975d9ef..ed6faeeb 100644 --- a/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.html +++ b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.html @@ -1 +1,39 @@ -

end-use-inventory works!

+ \ No newline at end of file diff --git a/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.ts b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.ts index 1c60e34e..7aec8019 100644 --- a/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.ts +++ b/src/app/user-portfolio/facility-dashboard/end-use-inventory/end-use-inventory.component.ts @@ -1,4 +1,10 @@ import { Component } from '@angular/core'; +import { faChevronRight, IconDefinition } from '@fortawesome/free-solid-svg-icons'; +import { Subscription } from 'rxjs'; +import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service'; +import { ProcessEquipmentIdbService } from 'src/app/indexed-db/process-equipment-idb.service'; +import { IdbFacility } from 'src/app/models/facility'; +import { IdbProcessEquipment } from 'src/app/models/processEquipment'; @Component({ selector: 'app-end-use-inventory', @@ -7,4 +13,33 @@ import { Component } from '@angular/core'; }) export class EndUseInventoryComponent { + faChevronRight: IconDefinition = faChevronRight; + + facility: IdbFacility; + facilitySub: Subscription; + + + processEquipmentSub: Subscription + processEquipments: Array; + + constructor(private facilityIdbService: FacilityIdbService, + private processEquipmentIdbService: ProcessEquipmentIdbService + ) { } + + ngOnInit() { + this.facilitySub = this.facilityIdbService.selectedFacility.subscribe(facility => { + this.facility = facility; + }); + + this.processEquipmentSub = this.processEquipmentIdbService.processEquipments.subscribe(processEquipments => { + this.processEquipments = processEquipments.filter(equipment => { + return equipment.facilityId == this.facility.guid; + }); + }); + } + + ngOnDestroy() { + this.processEquipmentSub.unsubscribe(); + this.facilitySub.unsubscribe(); + } } diff --git a/src/app/user-portfolio/user-portfolio.module.ts b/src/app/user-portfolio/user-portfolio.module.ts index eef65acb..bc23dbb3 100644 --- a/src/app/user-portfolio/user-portfolio.module.ts +++ b/src/app/user-portfolio/user-portfolio.module.ts @@ -42,6 +42,7 @@ import { AssessmentNebsComponent } from './assessment-dashboard/assessment-nebs/ import { AssessmentNebsHomeComponent } from './assessment-dashboard/assessment-nebs/assessment-nebs-home/assessment-nebs-home.component'; import { ContactModalModule } from '../shared/contact-modal/contact-modal.module'; import { IndustrialSystemInventoryHomeComponent } from './facility-dashboard/industrial-system-inventory/industrial-system-inventory-home/industrial-system-inventory-home.component'; +import { EndUseInventoryHomeComponent } from './facility-dashboard/end-use-inventory/end-use-inventory-home/end-use-inventory-home.component'; @NgModule({ declarations: [ @@ -77,7 +78,8 @@ import { IndustrialSystemInventoryHomeComponent } from './facility-dashboard/ind AssessmentEnergyOpportunitiesHomeComponent, AssessmentNebsComponent, AssessmentNebsHomeComponent, - IndustrialSystemInventoryHomeComponent + IndustrialSystemInventoryHomeComponent, + EndUseInventoryHomeComponent ], imports: [ CommonModule, From 23c1709b408a321754eb1f36b9a235659504fa85 Mon Sep 17 00:00:00 2001 From: rmroot Date: Tue, 12 Nov 2024 11:59:40 -0600 Subject: [PATCH 29/42] updates to tab styles --- src/app/routing/portfolio.routes.ts | 5 - .../add-kpi-search.component.html | 2 +- .../company-kpi-list.component.html | 2 +- .../assessment-dashboard-nav.component.html | 25 +++-- .../assessment-dashboard-nav.component.ts | 5 + .../assessment-dashboard.component.html | 2 +- ...essment-energy-opportunities.component.css | 70 ------------- ...ssment-energy-opportunities.component.html | 5 +- .../assessment-nebs.component.css | 70 ------------- .../assessment-nebs.component.html | 6 +- .../assessment-settings.component.css | 0 .../assessment-settings.component.html | 1 - .../assessment-settings.component.spec.ts | 23 ----- .../assessment-settings.component.ts | 10 -- .../company-dashboard.component.html | 2 +- ...mpany-performance-indicators.component.css | 70 ------------- ...pany-performance-indicators.component.html | 5 +- .../end-use-inventory.component.css | 70 ------------- .../end-use-inventory.component.html | 5 +- .../facility-dashboard.component.html | 2 +- .../industrial-system-inventory.component.css | 70 ------------- ...industrial-system-inventory.component.html | 5 +- .../latest-visits-table.component.html | 2 +- .../portfolio-summary-card.component.html | 2 +- .../user-portfolio.component.html | 2 +- .../user-portfolio/user-portfolio.module.ts | 2 - src/assets/styles/dashboards.css | 14 --- src/assets/styles/tabs.css | 98 +++++++++++++++++++ src/styles.css | 1 + 29 files changed, 149 insertions(+), 427 deletions(-) delete mode 100644 src/app/user-portfolio/assessment-dashboard/assessment-settings/assessment-settings.component.css delete mode 100644 src/app/user-portfolio/assessment-dashboard/assessment-settings/assessment-settings.component.html delete mode 100644 src/app/user-portfolio/assessment-dashboard/assessment-settings/assessment-settings.component.spec.ts delete mode 100644 src/app/user-portfolio/assessment-dashboard/assessment-settings/assessment-settings.component.ts diff --git a/src/app/routing/portfolio.routes.ts b/src/app/routing/portfolio.routes.ts index 1fe2f8d5..fe19ef15 100644 --- a/src/app/routing/portfolio.routes.ts +++ b/src/app/routing/portfolio.routes.ts @@ -15,7 +15,6 @@ import { EndUseInventoryComponent } from "../user-portfolio/facility-dashboard/e import { FacilityReportsComponent } from "../user-portfolio/facility-dashboard/facility-reports/facility-reports.component"; import { FacilitySettingsComponent } from "../user-portfolio/facility-dashboard/facility-settings/facility-settings.component"; import { AssessmentDashboardHomeComponent } from "../user-portfolio/assessment-dashboard/assessment-dashboard-home/assessment-dashboard-home.component"; -import { AssessmentSettingsComponent } from "../user-portfolio/assessment-dashboard/assessment-settings/assessment-settings.component"; import { AssessmentReportsComponent } from "../user-portfolio/assessment-dashboard/assessment-reports/assessment-reports.component"; import { AssessmentDetailsComponent } from "../user-portfolio/assessment-dashboard/assessment-details/assessment-details.component"; import { AssessmentEnergyOpportunitiesComponent } from "../user-portfolio/assessment-dashboard/assessment-energy-opportunities/assessment-energy-opportunities.component"; @@ -138,10 +137,6 @@ export const PortfolioRoutes: Route = { path: 'details', component: AssessmentDetailsComponent }, - { - path: 'manage', - component: AssessmentSettingsComponent - }, { path: 'energy-opportunities', component: AssessmentEnergyOpportunitiesComponent, diff --git a/src/app/shared/shared-company-forms/company-kpi-search-form/add-kpi-search/add-kpi-search.component.html b/src/app/shared/shared-company-forms/company-kpi-search-form/add-kpi-search/add-kpi-search.component.html index cf915be9..a428a45b 100644 --- a/src/app/shared/shared-company-forms/company-kpi-search-form/add-kpi-search/add-kpi-search.component.html +++ b/src/app/shared/shared-company-forms/company-kpi-search-form/add-kpi-search/add-kpi-search.component.html @@ -35,7 +35,7 @@
-
+
diff --git a/src/app/shared/shared-company-forms/company-kpi-search-form/company-kpi-list/company-kpi-list.component.html b/src/app/shared/shared-company-forms/company-kpi-search-form/company-kpi-list/company-kpi-list.component.html index 6dcc2df2..bda2b278 100644 --- a/src/app/shared/shared-company-forms/company-kpi-search-form/company-kpi-list/company-kpi-list.component.html +++ b/src/app/shared/shared-company-forms/company-kpi-search-form/company-kpi-list/company-kpi-list.component.html @@ -25,7 +25,7 @@
-
+
diff --git a/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.html b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.html index a4a16c6e..02e5ace0 100644 --- a/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.html +++ b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.html @@ -1,3 +1,4 @@ + \ No newline at end of file diff --git a/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.ts b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.ts index f5b36788..bde016a1 100644 --- a/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.ts +++ b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard-nav/assessment-dashboard-nav.component.ts @@ -1,4 +1,5 @@ import { Component } from '@angular/core'; +import { faFile, faGears, faWeightHanging, IconDefinition } from '@fortawesome/free-solid-svg-icons'; import { Subscription } from 'rxjs'; import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service'; import { IdbAssessment } from 'src/app/models/assessment'; @@ -10,6 +11,10 @@ import { IdbAssessment } from 'src/app/models/assessment'; }) export class AssessmentDashboardNavComponent { + faGears: IconDefinition = faGears; + faFile: IconDefinition = faFile; + faWeightHanging: IconDefinition = faWeightHanging; + assessment: IdbAssessment; assessmentSub: Subscription; constructor(private assessmentIdbService: AssessmentIdbService) { } diff --git a/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.html b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.html index 7122a123..a528b642 100644 --- a/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.html +++ b/src/app/user-portfolio/assessment-dashboard/assessment-dashboard.component.html @@ -1,6 +1,6 @@
-
+
\ No newline at end of file diff --git a/src/app/user-portfolio/assessment-dashboard/assessment-energy-opportunities/assessment-energy-opportunities.component.css b/src/app/user-portfolio/assessment-dashboard/assessment-energy-opportunities/assessment-energy-opportunities.component.css index 086d2eac..e69de29b 100644 --- a/src/app/user-portfolio/assessment-dashboard/assessment-energy-opportunities/assessment-energy-opportunities.component.css +++ b/src/app/user-portfolio/assessment-dashboard/assessment-energy-opportunities/assessment-energy-opportunities.component.css @@ -1,70 +0,0 @@ -.navbar{ - /* width: 20rem; */ - /* background-color: #ffffff; */ - overflow-y: auto; - /* height: 100%; */ - /* max-height: 100%; */ - flex-wrap: nowrap; -} - -.navbar.collapsed{ - width: auto; -} - -.nav-item{ - width: 100%; -} - -.nav-link{ - /* padding-left: .5rem; */ - padding: .25rem; - text-wrap-mode: nowrap; - border-bottom: solid 1px; - border-color: black; -} - -.nav-link.active{ - background-color: #0079c2; - color: white; -} - -.nav-link:hover{ - background-color: #8DABBE; - color: black; -} - - -.text-end{ - text-align: right; -} - -.toggle-collapse{ - font-size: x-large; -} - -.toggle-collapse:hover{ - cursor: pointer; - border: so; -} - -.btn.text-left{ - text-align: left; -} - -.nav-link:hover{ - cursor: pointer; -} - -.nav-flex{ - height: fit-content; -} - -.chevron.float-right{ - /* display: none; */ - color: white; - float: right; -} - -/* .active .chevron.float-right{ - display: block; -} */ \ No newline at end of file diff --git a/src/app/user-portfolio/assessment-dashboard/assessment-energy-opportunities/assessment-energy-opportunities.component.html b/src/app/user-portfolio/assessment-dashboard/assessment-energy-opportunities/assessment-energy-opportunities.component.html index 995fc6d5..ea0dfd08 100644 --- a/src/app/user-portfolio/assessment-dashboard/assessment-energy-opportunities/assessment-energy-opportunities.component.html +++ b/src/app/user-portfolio/assessment-dashboard/assessment-energy-opportunities/assessment-energy-opportunities.component.html @@ -2,7 +2,7 @@