From 9a069d4c46f3e5cab10cfae79fa36e0ea8ef11d5 Mon Sep 17 00:00:00 2001 From: chrismclarke Date: Thu, 14 Sep 2023 11:16:32 -0700 Subject: [PATCH] chore: code tidying --- .../src/app/components/components.module.ts | 3 +- .../components/editor/editor.component.html | 107 ++-------- .../components/editor/editor.component.scss | 51 +++-- .../app/components/editor/editor.component.ts | 188 +++++++++--------- .../src/app/pages/home/home.component.html | 62 +----- 5 files changed, 147 insertions(+), 264 deletions(-) diff --git a/apps/picsa-tools/option-tool/src/app/components/components.module.ts b/apps/picsa-tools/option-tool/src/app/components/components.module.ts index f3c2f54e6..171b86355 100644 --- a/apps/picsa-tools/option-tool/src/app/components/components.module.ts +++ b/apps/picsa-tools/option-tool/src/app/components/components.module.ts @@ -9,10 +9,11 @@ import { PicsaTranslateModule } from '@picsa/shared/modules'; // Local components import { EditorComponent } from './editor/editor.component'; import { GenderInputComponent } from './editor/inputs/gender/gender-input'; +import { InvestmentInputComponent } from './editor/inputs/investment/investment-input'; import { PerformanceInputComponent } from './editor/inputs/performance/performance-input'; import { OptionMaterialModule } from './material.module'; -const Components = [EditorComponent, GenderInputComponent, PerformanceInputComponent]; +const Components = [EditorComponent, GenderInputComponent, InvestmentInputComponent, PerformanceInputComponent]; @NgModule({ imports: [ diff --git a/apps/picsa-tools/option-tool/src/app/components/editor/editor.component.html b/apps/picsa-tools/option-tool/src/app/components/editor/editor.component.html index f23d00afc..d6a009489 100644 --- a/apps/picsa-tools/option-tool/src/app/components/editor/editor.component.html +++ b/apps/picsa-tools/option-tool/src/app/components/editor/editor.component.html @@ -1,4 +1,4 @@ -
+
@@ -65,8 +65,8 @@

{{ step.title | translate }}

-
-
+
+
@@ -75,9 +75,10 @@

{{ step.title | translate }}

- +
+ {{ step.title | translate }} -
-
-
-
{{ condition.label | translate }}
-
+
+
+
+
{{ condition.label | translate }}
+
@@ -119,87 +121,16 @@

{{ step.title | translate }}

-
-
(); constructor(private dialog: PicsaDialogService) {} - handleBenficiaryGender(index: number, value: string[]) { - this.values.benefits[index].beneficiary = value; - } - handleRemovingBenefits(index: number) { + public handleRemovingBenefits(index: number) { this.values.benefits.splice(index, 1); } - handleMoreBenefits() { + public handleMoreBenefits() { this.values.benefits.push({ benefit: '', beneficiary: [], }); } - async submitForm() { + public async submitForm() { // minimum for auto save should be at least a name if (!this.values.practice) { this.dataTransfer.emit(null); @@ -105,34 +115,11 @@ export class EditorComponent { this.resetVariables(); this.resetStepper(); } - resetVariables() { - this.values = ENTRY_TEMPLATE(); - } - //incase of edits - presetVariables(rowData: IOptionsToolEntry) { + // Allow update from home copmonent + public presetVariables(rowData: IOptionsToolEntry) { this.values = rowData; } - resetStepper(): void { - this.stepper.reset(); - } - - updateInvestmentEffort(event: any, investment: string) { - const selectedValue = event.target.value; - if (investment === 'time') { - this.values.investment = { - ...this.values.investment, - time: this.investmentOptions[selectedValue], - }; - } - if (investment === 'money') { - this.values.investment = { - ...this.values.investment, - money: this.investmentOptions[selectedValue], - }; - } - } - - async promptDelete() { + public async promptDelete() { const dialogRef = await this.dialog.open('delete'); dialogRef.afterClosed().subscribe((shouldDelete) => { if (shouldDelete) { @@ -140,4 +127,11 @@ export class EditorComponent { } }); } + private resetVariables() { + this.values = ENTRY_TEMPLATE(); + } + + private resetStepper(): void { + this.stepper.reset(); + } } diff --git a/apps/picsa-tools/option-tool/src/app/pages/home/home.component.html b/apps/picsa-tools/option-tool/src/app/pages/home/home.component.html index d5994ec9e..985f24f80 100644 --- a/apps/picsa-tools/option-tool/src/app/pages/home/home.component.html +++ b/apps/picsa-tools/option-tool/src/app/pages/home/home.component.html @@ -69,57 +69,17 @@ {{ 'Investment' | translate }} - - + +
+ + +