From b2bf04888c5429bed98e4c156563ff33c3a46106 Mon Sep 17 00:00:00 2001 From: Owen Yamauchi Date: Tue, 8 Aug 2023 14:45:11 -0400 Subject: [PATCH] Add project selection This only includes projects that have RI-specific incentives, whether from utilities or the state. --- src/calculator-form.ts | 35 ++++++++++++++++++++++++++++++++++- src/calculator.ts | 1 + src/state-calculator.ts | 12 +++++++++++- 3 files changed, 46 insertions(+), 2 deletions(-) diff --git a/src/calculator-form.ts b/src/calculator-form.ts index 5aea7c5..66c3ecb 100644 --- a/src/calculator-form.ts +++ b/src/calculator-form.ts @@ -72,6 +72,19 @@ const HOUSEHOLD_SIZE_OPTIONS: OptionParam[] = [1, 2, 3, 4, 5, 6, 7, 8].map( }, ); +const PROJECT_OPTIONS: OptionParam[] = [ + { value: 'heat_pump_clothes_dryer', label: 'Clothes dryer' }, + { + value: 'heat_pump_air_conditioner_heater', + label: 'Heating, ventilation & cooling', + }, + { value: 'new_electric_vehicle', label: 'New electric vehicle' }, + { value: 'rooftop_solar_installation', label: 'Rooftop solar installation' }, + { value: 'used_electric_vehicle', label: 'Used electric vehicle' }, + { value: 'heat_pump_water_heater', label: 'Water heater' }, + { value: 'weatherization', label: 'Weatherization' }, +]; + export const formTemplate = ( [ zip, @@ -79,13 +92,33 @@ export const formTemplate = ( householdIncome, taxFiling, householdSize, + project, utility, ]: Array, + showProjectsField: boolean, showUtilityField: boolean, utilityOptions: OptionParam[], onSubmit: (e: SubmitEvent) => void, onZipChanged: (e: InputEvent) => void, ) => { + const projectsField = showProjectsField + ? html`
+ +
` + : nothing; + const utilityField = showUtilityField ? html`
- ${utilityField} + ${projectsField} ${utilityField}
diff --git a/src/calculator.ts b/src/calculator.ts index 06b766e..6988b5a 100644 --- a/src/calculator.ts +++ b/src/calculator.ts @@ -157,6 +157,7 @@ export class RewiringAmericaCalculator extends LitElement { this.householdSize, ], false, + false, [], (event: SubmitEvent) => this.submit(event), () => {}, diff --git a/src/state-calculator.ts b/src/state-calculator.ts index a9bd150..4751b5e 100644 --- a/src/state-calculator.ts +++ b/src/state-calculator.ts @@ -73,6 +73,9 @@ export class RewiringAmericaStateCalculator extends LitElement { @property({ type: String, attribute: 'household-size' }) householdSize: string = '1'; + @property({ type: String, attribute: 'project' }) + project: string = 'heat_pump_air_conditioner_heater'; + @property({ type: String, attribute: 'utility' }) utility: string = ''; @@ -85,6 +88,7 @@ export class RewiringAmericaStateCalculator extends LitElement { this.taxFiling = (formData.get('tax_filing') as FilingStatus) || ''; this.householdSize = (formData.get('household_size') as string) || ''; this.utility = (formData.get('utility') ?? '') as string; + this.project = (formData.get('project') ?? '') as string; } get hideResult() { @@ -93,7 +97,8 @@ export class RewiringAmericaStateCalculator extends LitElement { this.ownerStatus && this.taxFiling && this.householdIncome && - this.householdSize + this.householdSize && + this.project ); } @@ -106,6 +111,7 @@ export class RewiringAmericaStateCalculator extends LitElement { household_income, tax_filing, household_size, + project, utility, ]) => { if (this.hideResult) { @@ -118,6 +124,7 @@ export class RewiringAmericaStateCalculator extends LitElement { household_income, tax_filing, household_size, + items: project, }); query.append('authority_types', 'federal'); query.append('authority_types', 'state'); @@ -140,6 +147,7 @@ export class RewiringAmericaStateCalculator extends LitElement { this.householdIncome, this.taxFiling, this.householdSize, + this.project, this.utility, ], }); @@ -182,9 +190,11 @@ export class RewiringAmericaStateCalculator extends LitElement { this.householdIncome, this.taxFiling, this.householdSize, + this.project, this.utility, ], true, + true, this._utilityOptionsTask.render({ initial: () => [BLANK_UTILITY], pending: () => [BLANK_UTILITY],