From a27169d8fea85b978beb740b8f54b129d5a0f1b1 Mon Sep 17 00:00:00 2001 From: Muskan Khedia <36980003+muskankhedia@users.noreply.github.com> Date: Sun, 9 Aug 2020 18:44:05 +0530 Subject: [PATCH] feat: add view incentives (recurring deposits account) (#1187) Fixes: #1186 --- ...nt-interest-rate-chart-step.component.html | 191 +++++++++++++----- ...nt-interest-rate-chart-step.component.scss | 29 ++- ...ount-interest-rate-chart-step.component.ts | 28 ++- ...posits-account-preview-step.component.html | 121 +++++++++-- ...posits-account-preview-step.component.scss | 29 +++ ...deposits-account-preview-step.component.ts | 31 ++- .../interest-rate-chart-tab.component.html | 110 ++++++++-- .../interest-rate-chart-tab.component.scss | 16 ++ .../interest-rate-chart-tab.component.ts | 31 ++- 9 files changed, 461 insertions(+), 125 deletions(-) diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.html index 481b89413..c8f876699 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.html +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.html @@ -1,69 +1,154 @@ - -
+
-
-
- Name: - {{ recurringDepositsAccountProductTemplate?.accountChart.name | date }} -
+
+ Name: + {{ recurringDepositsAccountProductTemplate.accountChart.name }} +
-
- Valid from Date: - {{ recurringDepositsAccountProductTemplate?.accountChart.fromDate | date }} -
+
+ Valid from Date: + {{ recurringDepositsAccountProductTemplate?.accountChart.fromDate | date }} +
-
- End Date: - {{ recurringDepositsAccountProductTemplate?.accountChart.endDate | date }} -
+
+ End Date: + {{ recurringDepositsAccountProductTemplate?.accountChart.endDate | date }} +
-
- Description: - {{ recurringDepositsAccountProductTemplate?.accountChart.description }} -
+
+ Description: + {{ recurringDepositsAccountProductTemplate?.accountChart.description }} +
-
- Primary Grouping by Amount: - {{ recurringDepositsAccountProductTemplate?.accountChart.isPrimaryGroupingByAmount ? 'Yes' : 'No' }} -
+
+ Primary Grouping by Amount: + {{ recurringDepositsAccountProductTemplate?.accountChart.isPrimaryGroupingByAmount ? 'Yes' : 'No' }} +
- +
- - - - + + + + - - - - + + + + - - - - + + + + - - - - + + + + - - - + - + + +    + Hide Incentives + + + + - - + + + + + + + + +
Period - {{rateChart.fromPeriod}}-{{rateChart.toPeriod}} {{rateChart.periodType.value}} Period + {{chartSlab.fromPeriod}}-{{chartSlab.toPeriod}} {{chartSlab.periodType.value}} Amount Range {{rateChart.amountRangeFrom}}-{{rateChart.amountRangeTo}} Amount Range {{chartSlab.amountRangeFrom}}-{{chartSlab.amountRangeTo}} Interest {{ rateChart.annualInterestRate }} Interest {{ chartSlab.annualInterestRate }} Description {{ rateChart.description }} Description {{ chartSlab.description }} Incentives - Actions + -
+ +
+ + + +

+ Incentives +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Entity Type + {{ incentive.entityType.value }} + Attribute Name + {{ incentive.attributeName.value }} + Condition Type + {{ incentive.conditionType.value | titlecase }} + Attribute Value + {{ incentive.attributeValueDesc }} + Incentive Type + {{ incentive.incentiveType.value }} + Interest + {{ incentive.amount }} +
+ +
+
+
- -
+
+ +
+ +
diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.scss b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.scss index be9328c80..bc815c2d2 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.scss +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.scss @@ -1,10 +1,23 @@ -.tab-container { - padding: 1%; - margin: 1%; - h3 { - margin:1% auto; - } - table { - width: 100%; +.margin-t { + margin-top: 2em; +} + +table { + width: 100%; + + tr.incentives-row { + height: 0; + + > td { + padding: 0; + } + + .incentives { + overflow: hidden; + } + + .mat-card { + border-radius: 0; + } } } diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.ts index 57acf98e7..2d03243bd 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.ts +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-interest-rate-chart-step/recurring-deposits-account-interest-rate-chart-step.component.ts @@ -1,6 +1,7 @@ /** Angular Imports */ -import { Component, OnInit, Input, OnChanges } from '@angular/core'; -import { MatTableDataSource } from '@angular/material'; +import { Component, OnInit, Input, OnChanges, ViewChild } from '@angular/core'; +import { MatTable } from '@angular/material'; +import { trigger, state, style, transition, animate } from '@angular/animations'; /** * Recurring Deposits Account Interest Rate Chart Step @@ -8,7 +9,14 @@ import { MatTableDataSource } from '@angular/material'; @Component({ selector: 'mifosx-recurring-deposits-account-interest-rate-chart-step', templateUrl: './recurring-deposits-account-interest-rate-chart-step.component.html', - styleUrls: ['./recurring-deposits-account-interest-rate-chart-step.component.scss'] + styleUrls: ['./recurring-deposits-account-interest-rate-chart-step.component.scss'], + animations: [ + trigger('expandChartSlab', [ + state('collapsed', style({ height: '0px', minHeight: '0' })), + state('expanded', style({ height: '*' })), + transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')) + ]) + ] }) export class RecurringDepositsAccountInterestRateChartStepComponent implements OnInit, OnChanges { @@ -16,11 +24,17 @@ export class RecurringDepositsAccountInterestRateChartStepComponent implements O @Input() recurringDepositsAccountProductTemplate: any; /** Interest Rate Chart Data */ - interestRateChartData: any; + interestRateChartData: any = []; /** Columns to be displayed in interest rate chart table. */ - displayedColumns: string[] = ['period', 'amountRange', 'interest', 'description', 'incentives']; - /** Data source for interest rate chart table. */ - dataSource: MatTableDataSource; + chartSlabsDisplayedColumns: any[] = ['period', 'amountRange', 'interest', 'description', 'actions']; + /** Columns to be displayed in incentives sub-table. */ + incentivesDisplayedColumns: string[] = ['entityType', 'attributeName', 'conditionType', 'attributeValue', 'incentiveType', 'amount']; + /** Additional Column to disblac incentives table */ + chartSlabsIncentivesDisplayedColumns: string[] = ['incentives']; + /** Expand Chart Slab Index used in the view */ + expandChartSlabIndex: number; + + @ViewChild('chartsTable') chartsTableRef: MatTable; constructor() { } diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.html index 805c9caac..d697ce2ae 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.html +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.html @@ -35,10 +35,10 @@ {{ recurringDepositsAccountProductTemplate.currency.decimalPlaces }}
-
- Currency In Multiples Of - {{ recurringDepositsAccountProductTemplate.currency.inMultiplesOf }} -
+
+ Currency In Multiples Of + {{ recurringDepositsAccountProductTemplate.currency.inMultiplesOf }} +

Terms

@@ -127,12 +127,14 @@

Interest Rate Chart

+ -
-
+
+ +
Name: - {{ recurringDepositsAccountProductTemplate?.accountChart.name | date }} + {{ recurringDepositsAccountProductTemplate?.accountChart.name }}
@@ -156,43 +158,120 @@ fxFlex="60%">{{ recurringDepositsAccountProductTemplate?.accountChart.isPrimaryGroupingByAmount ? 'Yes' : 'No' }}
- +
- + - + - + - + - - - + - - + + + + + + +
Period - {{rateChart.fromPeriod}}-{{rateChart.toPeriod}} {{rateChart.periodType.value}} + {{chartSlab.fromPeriod}}-{{chartSlab.toPeriod}} {{chartSlab.periodType.value}} Amount Range {{rateChart.amountRangeFrom}}-{{rateChart.amountRangeTo}}{{chartSlab.amountRangeFrom}}-{{chartSlab.amountRangeTo}} Interest {{ rateChart.annualInterestRate }} {{ chartSlab.annualInterestRate }} Description {{ rateChart.description }} {{ chartSlab.description }} Incentives - Actions +
+ +
+ + + +

+ Incentives +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Entity Type + {{ incentive.entityType.value }} + Attribute Name + {{ incentive.attributeName.value }} + Condition Type + {{ incentive.conditionType.value | titlecase }} + Attribute Value + {{ incentive.attributeValueDesc }} + Incentive Type + {{ incentive.incentiveType.value }} + Interest + {{ incentive.amount }} +
+ +
+
+
+
diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.scss b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.scss index 87258dacb..6161bd600 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.scss +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.scss @@ -22,3 +22,32 @@ mat-divider { .margin-t { margin-top: 1em; } + +.margin-t { + margin-top: 1em; +} + +.margin-b { + margin-bottom: 0.25em; +} + +.irc-table { + width: 100%; + + tr.incentives-row { + height: 0; + + > td { + padding: 0; + } + + .incentives { + overflow: hidden; + } + + .mat-card { + border-radius: 0; + } + } +} + diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.ts index 915da3d59..a3ce0ae92 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.ts +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-stepper/recurring-deposits-account-preview-step/recurring-deposits-account-preview-step.component.ts @@ -1,5 +1,6 @@ /** Angular Imports */ -import { Component, OnInit, Input, Output, EventEmitter, OnChanges } from '@angular/core'; +import { Component, Input, Output, EventEmitter, OnChanges } from '@angular/core'; +import { animate, state, style, transition, trigger } from '@angular/animations'; /** * Recurring Deposit Preview Step @@ -7,9 +8,16 @@ import { Component, OnInit, Input, Output, EventEmitter, OnChanges } from '@angu @Component({ selector: 'mifosx-recurring-deposits-account-preview-step', templateUrl: './recurring-deposits-account-preview-step.component.html', - styleUrls: ['./recurring-deposits-account-preview-step.component.scss'] + styleUrls: ['./recurring-deposits-account-preview-step.component.scss'], + animations: [ + trigger('expandChartSlab', [ + state('collapsed', style({ height: '0px', minHeight: '0' })), + state('expanded', style({ height: '*' })), + transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')) + ]) + ] }) -export class RecurringDepositsAccountPreviewStepComponent implements OnInit, OnChanges { +export class RecurringDepositsAccountPreviewStepComponent implements OnChanges { /** Input Data */ @Input() recurringDepositsAccountTemplate: any; @@ -20,10 +28,16 @@ export class RecurringDepositsAccountPreviewStepComponent implements OnInit, OnC /** Charges Displayed Columns */ chargesDisplayedColumns: string[] = ['name', 'chargeCalculationType', 'amount', 'chargeTimeType', 'date', 'repaymentsEvery']; - /** Interest Rate Chart Displayed Columns */ - interestRateChartDisplayedColumns: string[] = ['period', 'amountRange', 'interest', 'description', 'incentives']; /** Interest Rate Chart Data */ - interestRateChartData: any; + interestRateChartData: any = []; + /** Columns to be displayed in interest rate chart table. */ + chartSlabsDisplayedColumns: any[] = ['period', 'amountRange', 'interest', 'description', 'actions']; + /** Columns to be displayed in incentives sub-table. */ + incentivesDisplayedColumns: string[] = ['entityType', 'attributeName', 'conditionType', 'attributeValue', 'incentiveType', 'amount']; + /** Additional Column to disblac incentives table */ + chartSlabsIncentivesDisplayedColumns: string[] = ['incentives']; + /** Expand Chart Slab Index used in the view */ + expandChartSlabIndex: number; constructor() { } @@ -33,9 +47,4 @@ export class RecurringDepositsAccountPreviewStepComponent implements OnInit, OnC } } - ngOnInit() { - this.interestRateChartData = []; - } - - } diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.html index 4ee13c170..3df305050 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.html +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.html @@ -1,42 +1,124 @@
+
+
+

All Interest Rates

+
+
+
- +
- + - + - + - + - - - + - - + + + + + + +
Period - {{rateChart.fromPeriod}}-{{rateChart.toPeriod}} {{rateChart.periodType.value}} + {{chartSlab.fromPeriod}}-{{chartSlab.toPeriod}} {{chartSlab.periodType.value}} Amount Range {{rateChart.amountRangeFrom}}-{{rateChart.amountRangeTo}}{{chartSlab.amountRangeFrom}}-{{chartSlab.amountRangeTo}} Interest {{ rateChart.annualInterestRate }} {{ chartSlab.annualInterestRate }} Description {{ rateChart.description }} {{ chartSlab.description }} Incentives - Actions +
+ +
+ + + +

+ Incentives +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Entity Type + {{ incentive.entityType.value }} + Attribute Name + {{ incentive.attributeName.value }} + Condition Type + {{ incentive.conditionType.value | titlecase }} + Attribute Value + {{ incentive.attributeValueDesc }} + Incentive Type + {{ incentive.incentiveType.value }} + Interest + {{ incentive.amount }} +
+ +
+
+
diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.scss b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.scss index be9328c80..21f16ed44 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.scss +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.scss @@ -6,5 +6,21 @@ } table { width: 100%; + + tr.incentives-row { + height: 0; + + > td { + padding: 0; + } + + .incentives { + overflow: hidden; + } + + .mat-card { + border-radius: 0; + } + } } } diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.ts index cac0d811e..b096ce3c8 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.ts +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/interest-rate-chart-tab/interest-rate-chart-tab.component.ts @@ -1,7 +1,7 @@ /** Angular Imports */ -import { Component, OnInit } from '@angular/core'; -import { MatTableDataSource } from '@angular/material'; +import { Component } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; +import { animate, state, style, transition, trigger } from '@angular/animations'; /** * Interest Rate Chart Tab Component. @@ -9,16 +9,28 @@ import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'mifosx-interest-rate-chart-tab', templateUrl: './interest-rate-chart-tab.component.html', - styleUrls: ['./interest-rate-chart-tab.component.scss'] + styleUrls: ['./interest-rate-chart-tab.component.scss'], + animations: [ + trigger('expandChartSlab', [ + state('collapsed', style({ height: '0px', minHeight: '0' })), + state('expanded', style({ height: '*' })), + transition('expanded <=> collapsed', animate('225ms cubic-bezier(0.4, 0.0, 0.2, 1)')) + ]) + ] }) -export class InterestRateChartTabComponent implements OnInit { +export class InterestRateChartTabComponent { /** Interest Rate Chart Data */ - interestRateChartData: any; + interestRateChartData: any = []; /** Columns to be displayed in interest rate chart table. */ - displayedColumns: string[] = ['period', 'amountRange', 'interest', 'description', 'incentives']; - /** Data source for interest rate chart table. */ - dataSource: MatTableDataSource; + chartSlabsDisplayedColumns: any[] = ['period', 'amountRange', 'interest', 'description', 'actions']; + /** Columns to be displayed in incentives sub-table. */ + incentivesDisplayedColumns: string[] = ['entityType', 'attributeName', 'conditionType', 'attributeValue', 'incentiveType', 'amount']; + /** Additional Column to display in incentives table */ + chartSlabsIncentivesDisplayedColumns: string[] = ['incentives']; + /** Expand Chart Slab Index used in the view */ + expandChartSlabIndex: number; + /** * Retrieves recurring deposits account data from `resolve`. @@ -30,7 +42,4 @@ export class InterestRateChartTabComponent implements OnInit { }); } - ngOnInit() { - } - }