From 47d2636cc97677a902319f6c29772e5be06394f0 Mon Sep 17 00:00:00 2001 From: Sonlis Date: Thu, 15 Aug 2024 19:57:02 +0300 Subject: [PATCH] Make the loading general for rules --- .../app/components/rule/rule.component.html | 10 +-- .../app/components/rules/rules.component.html | 4 +- .../app/components/rules/rules.component.ts | 3 +- .../portfolio/fire/fire-page.component.ts | 3 + .../app/pages/portfolio/fire/fire-page.html | 73 +++++++++---------- 5 files changed, 45 insertions(+), 48 deletions(-) diff --git a/apps/client/src/app/components/rule/rule.component.html b/apps/client/src/app/components/rule/rule.component.html index a3ef7a4b5..db2d45a8a 100644 --- a/apps/client/src/app/components/rule/rule.component.html +++ b/apps/client/src/app/components/rule/rule.component.html @@ -47,22 +47,18 @@ } @else {
{{ rule?.name }}
-
- @if (rule?.evaluation) { - {{ rule?.evaluation }} - } -
+
{{ rule?.evaluation }}
- +
diff --git a/apps/client/src/app/components/rules/rules.component.ts b/apps/client/src/app/components/rules/rules.component.ts index ec62251ef..ec8aad7c2 100644 --- a/apps/client/src/app/components/rules/rules.component.ts +++ b/apps/client/src/app/components/rules/rules.component.ts @@ -17,13 +17,14 @@ import { }) export class RulesComponent { @Input() hasPermissionToCreateOrder: boolean; + @Input() isLoading: boolean; @Input() rules: PortfolioReportRule[]; @Output() rulesUpdated = new EventEmitter(); public constructor() {} - public onRulesUpdated(event: UpdateUserSettingDto) { + public onRuleUpdated(event: UpdateUserSettingDto) { this.rulesUpdated.emit(event); } } diff --git a/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts b/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts index 18c5c2a34..6c9239c70 100644 --- a/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts +++ b/apps/client/src/app/pages/portfolio/fire/fire-page.component.ts @@ -105,6 +105,7 @@ export class FirePageComponent implements OnDestroy, OnInit { public initializePortfolioReport() { this.isLoadingPortfolioReport = true; + this.dataService .fetchPortfolioReport() .pipe(takeUntil(this.unsubscribeSubject)) @@ -125,6 +126,7 @@ export class FirePageComponent implements OnDestroy, OnInit { this.feeRules = portfolioReport.rules['fees'].filter((rule) => rule.isActive) || null; this.isLoadingPortfolioReport = false; + this.changeDetectorRef.markForCheck(); }); } @@ -170,6 +172,7 @@ export class FirePageComponent implements OnDestroy, OnInit { public onRulesUpdated(event: UpdateUserSettingDto) { this.isLoading = true; + this.dataService .putUserSetting(event) .pipe(takeUntil(this.unsubscribeSubject)) diff --git a/apps/client/src/app/pages/portfolio/fire/fire-page.html b/apps/client/src/app/pages/portfolio/fire/fire-page.html index ff2e70662..e24add5dd 100644 --- a/apps/client/src/app/pages/portfolio/fire/fire-page.html +++ b/apps/client/src/app/pages/portfolio/fire/fire-page.html @@ -124,13 +124,12 @@ } - @if (!isLoadingPortfolioReport) { - - } +

@@ -139,13 +138,12 @@ }

- @if (!isLoadingPortfolioReport) { - - } +

@@ -154,13 +152,12 @@ }

- @if (!isLoadingPortfolioReport) { - - } +

@@ -169,29 +166,29 @@ }

- @if (!isLoadingPortfolioReport) { - - } +
-
-

- Inactive - @if (user?.subscription?.type === 'Basic') { - - } -

- @if (!isLoadingPortfolioReport) { + @if (inactiveRules?.length > 0) { +
+

+ Inactive + @if (user?.subscription?.type === 'Basic') { + + } +

- } -
+
+ }