Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 159: Update review pre-visit #339

Merged
merged 3 commits into from
Dec 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ <h5 class="bold w-100 text-center">
<fa-icon [icon]="faBuilding" class="me-2"></fa-icon> {{company.generalInformation.name}}
</h5>

<table class="table table-bordered table-hover">
<table class="table table-bordered table-hover table-sm">
<tbody>
<tr>
<td class="w-25">
rmroot marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
@@ -1,29 +1,81 @@
<h5 class="bold w-100 text-center">
<fa-icon [icon]="faChartBar" class="me-2"></fa-icon> Key Performance Indicators
</h5>
<div class="row">
<div class="col-lg-6 col-md-12 pb-2" *ngFor="let kpi of (company.guid | companyKpiList:keyPerformanceIndicators)">
<div class="card">
<div class="card-header">
<fa-icon [icon]="faBullseye" class="pe-1"></fa-icon>
<span [innerHTML]="kpi.htmlLabel"></span>
</div>
<div class="card-body">

<table class="table table-sm">
<tbody>
<tr>
<td class="w-50">
KPI Category
</td>
<td>
<app-primary-kpi-badge [kpiOption]="kpi"></app-primary-kpi-badge>
</td>
</tr>
</tbody>
</table>
<table class="table table-bordered savings-table table-hover table-sm">
<thead>
<tr>
<th>
<!-- KPM -->
</th>
<th>
Units
</th>
<th>
Cost<br> Per Unit
</th>
<th>
Baseline<br> Amount
</th>
<th>
Baseline Cost<br> (&dollar;/yr)
</th>
</tr>
</thead>
<tbody>
<ng-container *ngFor="let kpi of keyPerformanceIndicators">
<tr>
<th colspan="5">
<span [innerHTML]="kpi.htmlLabel"></span>
</th>
</tr>
<tr *ngFor="let keyPerformanceMetric of kpi.performanceMetrics">
<td class="ps-3">
<span [innerHTML]="keyPerformanceMetric.htmlLabel"></span>
</td>
<ng-template [ngIf]="keyPerformanceMetric.isQuantitative" [ngIfElse]="qualitativeBlock">

</div>
</div>
</div>
</div>
<td>
<ng-template [ngIf]="keyPerformanceMetric.calculationMethod == 'costPerUnit'"
[ngIfElse]="unitMdash">
<app-single-cell-item [strValue]="keyPerformanceMetric.totalUnit"
[isCurrency]="false"></app-single-cell-item>
</ng-template>
<ng-template #unitMdash>
&mdash;
</ng-template>
</td>
<td>
<ng-template [ngIf]="keyPerformanceMetric.calculationMethod == 'costPerUnit'"
[ngIfElse]="costPerMdash">
<app-single-cell-item [numValue]="keyPerformanceMetric.costPerValue"
[isCurrency]="true"></app-single-cell-item>
</ng-template>
<ng-template #costPerMdash>
&mdash;
</ng-template>
</td>
<td>
<ng-template [ngIf]="keyPerformanceMetric.calculationMethod == 'costPerUnit'"
[ngIfElse]="baselineValueMdash">
<app-single-cell-item [numValue]="keyPerformanceMetric.baselineValue"
[isCurrency]="false"></app-single-cell-item>
</ng-template>
<ng-template #baselineValueMdash>
&mdash;
</ng-template>
</td>
<td>
<app-single-cell-item [numValue]="keyPerformanceMetric.baselineCost"
[isCurrency]="true"></app-single-cell-item>
</td>
</ng-template>
<ng-template #qualitativeBlock>
<td colspan="4">
Qualitative Metric
</td>
</ng-template>
</tr>
</ng-container>
</tbody>
</table>
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ export class CompanyKpisSummaryComponent {

ngOnInit(){
this.company = this.companyIdbService.selectedCompany.getValue();
this.keyPerformanceIndicators = this.keyPerformanceIndicatorIdbService.keyPerformanceIndicators.getValue();
this.keyPerformanceIndicators = this.keyPerformanceIndicatorIdbService.keyPerformanceIndicators.getValue().filter(kpi => {
return kpi.companyId == this.company.guid;
});
this.contacts = this.contactsIdbService.contacts.getValue();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ <h5 class="bold w-100 text-center">
<fa-icon [icon]="faIndustry" class="me-2"></fa-icon> {{facility.generalInformation.name}}
</h5>

<table class="table table-bordered table-hover">
<table class="table table-bordered table-hover table-sm">
<tbody>
<tr>
<td class="w-25">
rmroot marked this conversation as resolved.
Show resolved Hide resolved
Expand Down
Original file line number Diff line number Diff line change
@@ -1,71 +1,76 @@
<h5 class="bold w-100 text-center">
<fa-icon [icon]="faToolbox" class="me-2"></fa-icon> Pre-Assessments for {{onSiteVisit.visitDate| date}}
</h5>
<div class="row">
<div class="col-lg-6 col-md-12 pb-2" *ngFor="let assessment of (onSiteVisit.assessmentIds | assessmentListOnSite: assessments)">
<div class="card">
<div class="card-header">
<fa-icon [icon]="faScrewdriverWrench" class="pe-1"></fa-icon>
{{assessment.name}}
</div>
<div class="card-body">

<table class="table table-sm">
<tbody>
<!-- <tr>
<td>
Process Equipment
</td>
<td>
<ng-template [ngIf]="assessment.equipmentId" [ngIfElse]="equipmentMdash">
{{assessment.equipmentId | processEquipmentDisplay: processEquipment}}
</ng-template>
<ng-template #equipmentMdash>
&mdash;
</ng-template>
</td>
</tr> -->
<tr>
<td>
Annual Energy Use
</td>
<td>
<app-single-cell-item [numValue]="assessment.energyUse"></app-single-cell-item>
</td>
</tr>
<tr>
<td>
Annual Costs
</td>
<td>
<app-single-cell-item [numValue]="assessment.cost" [isCurrency]="true"></app-single-cell-item>
</td>
</tr>
<tr>
<td>
Contacts
</td>
<td>
<ng-template [ngIf]="(assessment.guid| associatedContacts:'assessment': contacts).length != 0"
[ngIfElse]="contactMdash">
<div class="d-flex">
<div class="pe-1"
*ngFor="let contact of assessment.guid| associatedContacts:'assessment': contacts;">
<span class="badge bg-primary">
<fa-icon [icon]="faUser"></fa-icon>
{{contact | contactNameDisplay}}
</span>
</div>
</div>
</ng-template>
<ng-template #contactMdash>
&mdash;
</ng-template>
</td>
</tr>
</tbody>
</table>
</div>
</div>
@let preAssessments = (onSiteVisit.assessmentIds | assessmentListOnSite: assessments);
<ng-template [ngIf]="preAssessments.length > 0" [ngIfElse]="noPreAssessmentsBlock">
<table class="table table-bordered table-hover table-sm">
<thead>
<tr>
<th>
Name
</th>
<th>
Type
</th>
<th>
Utility Types
</th>
<th>
Baseline<br>
Energy Use<br>
<span class="fw-light">({{companyEnergyUnit}}/yr)</span>
</th>
<th>
Baseline<br>
Energy Cost<br>
<span class="fw-light">
(&dollar;/yr)
</span>
</th>
<th>
Stakeholders
</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let assessment of preAssessments">
<td>
{{assessment.name}}
</td>
<td>
<app-single-cell-item [strValue]="assessment.assessmentType"></app-single-cell-item>
</td>
<td>
<ng-container *ngFor="let utilityType of assessment.utilityEnergyUses">
<ng-container *ngIf="utilityType.include">
{{utilityType.utilityType}}<br>
</ng-container>
</ng-container>
</td>
<td>
<app-single-cell-item [numValue]="assessment.energyUse"></app-single-cell-item>
</td>
<td>
<app-single-cell-item [numValue]="assessment.cost" [isCurrency]="true"></app-single-cell-item>
</td>
<td>
@let associatedContacts = assessment.guid | associatedContacts:'assessment': contacts;
<ng-template [ngIf]="associatedContacts.length > 0" [ngIfElse]="noContactsBlock">
<span *ngFor="let contact of associatedContacts">
{{contact | contactNameDisplay}} <br>
</span>
</ng-template>
<ng-template #noContactsBlock>
&mdash;
</ng-template>
</td>
</tr>
</tbody>
</table>
</ng-template>
<ng-template #noPreAssessmentsBlock>
<div class="alert alert-info small p-2">
No pre-assessments added for this visit.
</div>
</div>
</ng-template>
Original file line number Diff line number Diff line change
Expand Up @@ -4,45 +4,17 @@ import { PreAssessmentSummaryComponent } from './pre-assessment-summary.componen
import { FontAwesomeModule } from '@fortawesome/angular-fontawesome';
import { HelperPipesModule } from 'src/app/shared/helper-pipes/_helper-pipes.module';
import { TableEntriesModule } from 'src/app/shared/table-entries/table-entries.module';
import { FacilityIdbService } from 'src/app/indexed-db/facility-idb.service';
import { IdbFacility, getNewIdbFacility } from 'src/app/models/facility';
import { BehaviorSubject } from 'rxjs';
import { AssessmentIdbService } from 'src/app/indexed-db/assessment-idb.service';
import { IdbAssessment } from 'src/app/models/assessment';
import { OnSiteVisitIdbService } from 'src/app/indexed-db/on-site-visit-idb.service';
import { IdbOnSiteVisit, getNewIdbOnSiteVisit } from 'src/app/models/onSiteVisit';
import { ContactIdbService } from 'src/app/indexed-db/contact-idb.service';
import { IdbContact } from 'src/app/models/contact';
import { stubServiceProviders } from 'src/app/spec-helpers/spec-test-service-stub';

describe('PreAssessmentSummaryComponent', () => {
let component: PreAssessmentSummaryComponent;
let fixture: ComponentFixture<PreAssessmentSummaryComponent>;


let facilityIdbService: Partial<FacilityIdbService> = {
facilities: new BehaviorSubject<Array<IdbFacility>>([]),
selectedFacility: new BehaviorSubject<IdbFacility>(getNewIdbFacility('', ''))
};
let assessmentIdbService: Partial<AssessmentIdbService> = {
assessments: new BehaviorSubject<Array<IdbAssessment>>([])
};
let onSiteVisitIdbService: Partial<OnSiteVisitIdbService> = {
selectedVisit: new BehaviorSubject<IdbOnSiteVisit>(getNewIdbOnSiteVisit('', '', ''))
};
let contactIdbService: Partial<ContactIdbService> = {
contacts: new BehaviorSubject<Array<IdbContact>>([])
};
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [ FontAwesomeModule, HelperPipesModule, TableEntriesModule],
declarations: [PreAssessmentSummaryComponent],
providers: [
{ provide: FacilityIdbService, useValue: facilityIdbService },
{ provide: AssessmentIdbService, useValue: assessmentIdbService },
{ provide: OnSiteVisitIdbService, useValue: onSiteVisitIdbService },
{ provide: ContactIdbService, useValue: contactIdbService }

]
providers: stubServiceProviders
})
.compileComponents();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { Component } from '@angular/core';
import { IconDefinition, faScrewdriverWrench, faToolbox, faUser } 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 { ContactIdbService } from 'src/app/indexed-db/contact-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 { IdbContact } from 'src/app/models/contact';
import { IdbOnSiteVisit } from 'src/app/models/onSiteVisit';
// import { ProcessEquipment } from 'src/app/shared/constants/processEquipment';

@Component({
selector: 'app-pre-assessment-summary',
Expand All @@ -20,19 +20,20 @@ export class PreAssessmentSummaryComponent {
assessments: Array<IdbAssessment>;
faToolbox: IconDefinition = faToolbox;
faScrewdriverWrench: IconDefinition = faScrewdriverWrench;
// processEquipment: Array<ProcessEquipment>;
contacts: Array<IdbContact>;
faUser: IconDefinition = faUser;
onSiteVisit: IdbOnSiteVisit;
constructor(private facilityIdbService: FacilityIdbService, private contactIdbService: ContactIdbService,
companyEnergyUnit: string;
constructor(private companyIdbService: CompanyIdbService, private contactIdbService: ContactIdbService,
private assessmentIdbService: AssessmentIdbService, private onSiteVisitIdbService: OnSiteVisitIdbService
) {
}

ngOnInit() {
let company: IdbCompany = this.companyIdbService.selectedCompany.getValue();
this.companyEnergyUnit = company.companyEnergyUnit;
this.onSiteVisit = this.onSiteVisitIdbService.selectedVisit.getValue();
this.assessments = this.assessmentIdbService.assessments.getValue();
// this.processEquipment = this.facilityIdbService.selectedFacility.getValue().processEquipment;
this.contacts = this.contactIdbService.contacts.getValue();
}
}
Loading
Loading