diff --git a/src/app/savings/common-resolvers/savings-account-charge.resolver.ts b/src/app/savings/common-resolvers/savings-account-charge.resolver.ts new file mode 100644 index 000000000..751320825 --- /dev/null +++ b/src/app/savings/common-resolvers/savings-account-charge.resolver.ts @@ -0,0 +1,33 @@ +/** Angular Imports */ +import { Injectable } from '@angular/core'; +import { Resolve, ActivatedRouteSnapshot } from '@angular/router'; + +/** rxjs Imports */ +import { Observable } from 'rxjs'; + +/** Custom Services */ +import { SavingsService } from '../savings.service'; + +/** + * Savings Account Charge data resolver. + */ +@Injectable() +export class SavingsAccountChargeResolver implements Resolve { + + /** + * @param {SavingsService} SavingsService Savings service. + */ + constructor(private savingsService: SavingsService) { } + + /** + * Returns the Savings Account Charge data. + * @param {ActivatedRouteSnapshot} route Route Snapshot + * @returns {Observable} + */ + resolve(route: ActivatedRouteSnapshot): Observable { + const savingAccountId = route.parent.paramMap.get('savingAccountId'); + const chargeId = route.paramMap.get('id'); + return this.savingsService.getSavingsAccountCharge(savingAccountId, chargeId); + } + +} diff --git a/src/app/savings/common-resolvers/savings-account-view.resolver.ts b/src/app/savings/common-resolvers/savings-account-view.resolver.ts index b01f4346c..1eb6c420d 100644 --- a/src/app/savings/common-resolvers/savings-account-view.resolver.ts +++ b/src/app/savings/common-resolvers/savings-account-view.resolver.ts @@ -25,7 +25,7 @@ export class SavingsAccountViewResolver implements Resolve { * @returns {Observable} */ resolve(route: ActivatedRouteSnapshot): Observable { - const savingAccountId = route.paramMap.get('savingAccountId'); + const savingAccountId = route.paramMap.get('savingAccountId') || route.parent.parent.paramMap.get('savingAccountId'); return this.savingsService.getSavingsAccountData(savingAccountId); } diff --git a/src/app/savings/savings-account-view/charges-tab/charges-tab.component.html b/src/app/savings/savings-account-view/charges-tab/charges-tab.component.html index 126e58e58..0f78f94cf 100644 --- a/src/app/savings/savings-account-view/charges-tab/charges-tab.component.html +++ b/src/app/savings/savings-account-view/charges-tab/charges-tab.component.html @@ -79,16 +79,16 @@ @@ -97,7 +97,7 @@ - + diff --git a/src/app/savings/savings-account-view/charges-tab/charges-tab.component.scss b/src/app/savings/savings-account-view/charges-tab/charges-tab.component.scss index aaafd7b18..33f34ec09 100644 --- a/src/app/savings/savings-account-view/charges-tab/charges-tab.component.scss +++ b/src/app/savings/savings-account-view/charges-tab/charges-tab.component.scss @@ -15,5 +15,8 @@ margin: 4px; line-height: 25px; } + .select-row:hover { + cursor: pointer; + } } } diff --git a/src/app/savings/savings-account-view/charges-tab/charges-tab.component.ts b/src/app/savings/savings-account-view/charges-tab/charges-tab.component.ts index fd725011b..7ea7f5b57 100644 --- a/src/app/savings/savings-account-view/charges-tab/charges-tab.component.ts +++ b/src/app/savings/savings-account-view/charges-tab/charges-tab.component.ts @@ -1,7 +1,21 @@ /** Angular Imports */ import { Component, OnInit, ViewChild } from '@angular/core'; -import { MatTableDataSource, MatTable } from '@angular/material'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; +import { MatDialog, MatTableDataSource, MatTable } from '@angular/material'; +import { DatePipe } from '@angular/common'; + +/** Custom Services */ +import { SavingsService } from 'app/savings/savings.service'; + +/** Custom Dialogs */ +import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; +import { WaiveChargeDialogComponent } from '../custom-dialogs/waive-charge-dialog/waive-charge-dialog.component'; +import { InactivateChargeDialogComponent } from '../custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component'; + +/** Custom Models */ +import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base'; +import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base'; +import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base'; /** * Charges Tab Component @@ -40,10 +54,18 @@ export class ChargesTabComponent implements OnInit { @ViewChild('chargesTable') chargesTableRef: MatTable; /** - * Retrieves Savings Account Data from `resolve`. + * Retrieves the Savings account data from `resolve`. + * @param {SavingsService} savingsService Savings Service * @param {ActivatedRoute} route Activated Route. + * @param {Router} router Router for navigation. + * @param {MatDialog} dialog Dialog reference. + * @param {DatePipe} datePipe DatePipe. */ - constructor(private route: ActivatedRoute) { + constructor(private savingsService: SavingsService, + private route: ActivatedRoute, + private datePipe: DatePipe, + private router: Router, + public dialog: MatDialog) { this.route.parent.data.subscribe((data: { savingsAccountData: any }) => { this.savingsAccountData = data.savingsAccountData; this.chargesData = this.savingsAccountData.charges; @@ -70,6 +92,84 @@ export class ChargesTabComponent implements OnInit { this.chargesTableRef.renderRows(); } + + /** + * Pays the charge. + * @param {any} chargeId Charge Id + */ + payCharge(chargeId: any) { + const formfields: FormfieldBase[] = [ + new InputBase({ + controlName: 'amount', + label: 'Amount', + value: '', + type: 'number', + required: true + }), + new DatepickerBase({ + controlName: 'dueDate', + label: 'Payment Date', + value: '', + type: 'date', + required: true + }) + ]; + const data = { + title: `Pay Charge ${chargeId}`, + layout: { addButtonText: 'Confirm' }, + formfields: formfields + }; + const payChargeDialogRef = this.dialog.open(FormDialogComponent, { data }); + payChargeDialogRef.afterClosed().subscribe((response: any) => { + if (response.data) { + const locale = 'en'; + const dateFormat = 'dd MMMM yyyy'; + const dataObject = { + ...response.data.value, + dueDate: this.datePipe.transform(response.data.value.dueDate, dateFormat), + dateFormat, + locale + }; + this.savingsService.executeSavingsAccountChargesCommand(this.savingsAccountData.id, 'paycharge', dataObject, chargeId) + .subscribe(() => { + this.router.navigate(['../'], { relativeTo: this.route }); + }); + } + }); + } + + /** + * Waive's the charge + * @param {any} chargeId Charge Id + */ + waiveCharge(chargeId: any) { + const waiveChargeDialogRef = this.dialog.open(WaiveChargeDialogComponent, { data: { id: chargeId } }); + waiveChargeDialogRef.afterClosed().subscribe((response: any) => { + if (response.confirm) { + this.savingsService.executeSavingsAccountChargesCommand(this.savingsAccountData.id, 'waive', {}, chargeId) + .subscribe(() => { + this.router.navigate(['../'], { relativeTo: this.route }); + }); + } + }); + } + + /** + * Inactivate's the charge + * @param {any} chargeId Charge Id + */ + inactivateCharge(chargeId: any) { + const inactivateChargeDialogRef = this.dialog.open(InactivateChargeDialogComponent, { data: { id: chargeId } }); + inactivateChargeDialogRef.afterClosed().subscribe((response: any) => { + if (response.confirm) { + this.savingsService.executeSavingsAccountChargesCommand(this.savingsAccountData.id, 'inactivate', {}, chargeId) + .subscribe(() => { + this.router.navigate(['../'], { relativeTo: this.route }); + }); + } + }); + } + /** * Checks if charge is recurring. * @param {any} charge Charge diff --git a/src/app/savings/savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component.html b/src/app/savings/savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component.html new file mode 100644 index 000000000..ce159445f --- /dev/null +++ b/src/app/savings/savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component.html @@ -0,0 +1,8 @@ +

Inactivate Charge

+
+

Are you sure you want to inactivate charge with id: {{ data.id }} ?

+
+ + + + diff --git a/src/app/savings/savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component.scss b/src/app/savings/savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/savings/savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component.spec.ts b/src/app/savings/savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component.spec.ts new file mode 100644 index 000000000..6bf5313f2 --- /dev/null +++ b/src/app/savings/savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { InactivateChargeDialogComponent } from './inactivate-charge-dialog.component'; + +describe('InactivateChargeDialogComponent', () => { + let component: InactivateChargeDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ InactivateChargeDialogComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(InactivateChargeDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/savings/savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component.ts b/src/app/savings/savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component.ts new file mode 100644 index 000000000..6a3515dfc --- /dev/null +++ b/src/app/savings/savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component.ts @@ -0,0 +1,22 @@ +/** Angular Imports */ +import { Component, Inject } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; + +/** + * Inactivate charge dialog component. + */ +@Component({ + selector: 'mifosx-inactivate-charge-dialog', + templateUrl: './inactivate-charge-dialog.component.html', + styleUrls: ['./inactivate-charge-dialog.component.scss'] +}) +export class InactivateChargeDialogComponent { + + /** + * @param {MatDialogRef} dialogRef Component reference to dialog. + * @param {any} data. + */ + constructor(public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: any) { } + +} diff --git a/src/app/savings/savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component.html b/src/app/savings/savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component.html new file mode 100644 index 000000000..1508d786e --- /dev/null +++ b/src/app/savings/savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component.html @@ -0,0 +1,8 @@ +

Waive Charge

+
+

Are you sure you want to waive charge with id: {{ data.id }} ?

+
+ + + + diff --git a/src/app/savings/savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component.scss b/src/app/savings/savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component.scss new file mode 100644 index 000000000..e69de29bb diff --git a/src/app/savings/savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component.spec.ts b/src/app/savings/savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component.spec.ts new file mode 100644 index 000000000..7d9bbd5ae --- /dev/null +++ b/src/app/savings/savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { WaiveChargeDialogComponent } from './waive-charge-dialog.component'; + +describe('WaiveChargeDialogComponent', () => { + let component: WaiveChargeDialogComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ WaiveChargeDialogComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(WaiveChargeDialogComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/savings/savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component.ts b/src/app/savings/savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component.ts new file mode 100644 index 000000000..12d7865c9 --- /dev/null +++ b/src/app/savings/savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component.ts @@ -0,0 +1,22 @@ +/** Angular Imports */ +import { Component, Inject } from '@angular/core'; +import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material'; + +/** + * Waive charge dialog component. + */ +@Component({ + selector: 'mifosx-waive-charge-dialog', + templateUrl: './waive-charge-dialog.component.html', + styleUrls: ['./waive-charge-dialog.component.scss'] +}) +export class WaiveChargeDialogComponent { + + /** + * @param {MatDialogRef} dialogRef Component reference to dialog. + * @param {any} data. + */ + constructor(public dialogRef: MatDialogRef, + @Inject(MAT_DIALOG_DATA) public data: any) { } + +} diff --git a/src/app/savings/savings-account-view/view-charge/view-charge.component.html b/src/app/savings/savings-account-view/view-charge/view-charge.component.html new file mode 100644 index 000000000..bcb03508a --- /dev/null +++ b/src/app/savings/savings-account-view/view-charge/view-charge.component.html @@ -0,0 +1,116 @@ + + +
+ + + + + + + +
+ +
+ + + + + +
+ +
+ Name +
+ +
+ {{ chargeData.name }} +
+ +
+ Charge Type +
+ +
+ {{ chargeData.penalty ? 'Penalty' : 'Fees' }} +
+ +
+ Currency +
+ +
+ {{ chargeData.currency.displayLabel }} +
+ +
+ Payment due at +
+ +
+ {{ chargeData.chargeTimeType.value }} +
+ +
+ Payment due as of +
+ +
+ {{ chargeData.dueDate | date }} +
+ +
+ Calculation Type +
+ +
+ {{ chargeData.chargeCalculationType.value }} +
+ +
+ Due +
+ +
+ {{ chargeData.amount }} +
+ +
+ Paid +
+ +
+ {{ chargeData.amountPaid }} +
+ +
+ Waived +
+ +
+ {{ chargeData.amountWaived }} +
+ +
+ Outstanding +
+ +
+ {{ chargeData.amountOutstanding }} +
+ +
+ +
+ +
+ +
diff --git a/src/app/savings/savings-account-view/view-charge/view-charge.component.scss b/src/app/savings/savings-account-view/view-charge/view-charge.component.scss new file mode 100644 index 000000000..56668f14f --- /dev/null +++ b/src/app/savings/savings-account-view/view-charge/view-charge.component.scss @@ -0,0 +1,10 @@ +.container { + max-width: 37rem; + + .content { + div { + margin: 1rem 0; + word-wrap: break-word; + } + } +} diff --git a/src/app/savings/savings-account-view/view-charge/view-charge.component.spec.ts b/src/app/savings/savings-account-view/view-charge/view-charge.component.spec.ts new file mode 100644 index 000000000..6c6e3739c --- /dev/null +++ b/src/app/savings/savings-account-view/view-charge/view-charge.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ViewChargeComponent } from './view-charge.component'; + +describe('ViewChargeComponent', () => { + let component: ViewChargeComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ViewChargeComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ViewChargeComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/savings/savings-account-view/view-charge/view-charge.component.ts b/src/app/savings/savings-account-view/view-charge/view-charge.component.ts new file mode 100644 index 000000000..bb8edda36 --- /dev/null +++ b/src/app/savings/savings-account-view/view-charge/view-charge.component.ts @@ -0,0 +1,136 @@ +/** Angular Imports */ +import { Component } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { MatDialog } from '@angular/material'; +import { DatePipe } from '@angular/common'; + +/** Custom Services */ +import { SavingsService } from 'app/savings/savings.service'; + +/** Custom Dialogs */ +import { FormDialogComponent } from 'app/shared/form-dialog/form-dialog.component'; +import { WaiveChargeDialogComponent } from '../custom-dialogs/waive-charge-dialog/waive-charge-dialog.component'; +import { InactivateChargeDialogComponent } from '../custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component'; + +/** Custom Models */ +import { FormfieldBase } from 'app/shared/form-dialog/formfield/model/formfield-base'; +import { InputBase } from 'app/shared/form-dialog/formfield/model/input-base'; +import { DatepickerBase } from 'app/shared/form-dialog/formfield/model/datepicker-base'; + +/** + * View Charge Component. + */ +@Component({ + selector: 'mifosx-view-charge', + templateUrl: './view-charge.component.html', + styleUrls: ['./view-charge.component.scss'] +}) +export class ViewChargeComponent { + + /** Charge data. */ + chargeData: any; + /** Savings Account Data */ + savingsAccountData: any; + + /** + * Retrieves the Charge data from `resolve`. + * @param {SavingsService} savingsService Savings Service + * @param {ActivatedRoute} route Activated Route. + * @param {Router} router Router for navigation. + * @param {MatDialog} dialog Dialog reference. + * @param {DatePipe} datePipe DatePipe. + */ + constructor(private savingsService: SavingsService, + private route: ActivatedRoute, + private datePipe: DatePipe, + private router: Router, + public dialog: MatDialog) { + this.route.data.subscribe((data: { savingsAccountCharge: any, savingsAccountData: any }) => { + this.chargeData = data.savingsAccountCharge; + this.savingsAccountData = data.savingsAccountData; + }); + } + + /** + * Pays the charge. + */ + payCharge() { + const formfields: FormfieldBase[] = [ + new InputBase({ + controlName: 'amount', + label: 'Amount', + value: '', + type: 'number', + required: true + }), + new DatepickerBase({ + controlName: 'dueDate', + label: 'Payment Date', + value: '', + type: 'date', + required: true + }) + ]; + const data = { + title: 'Pay Charge', + layout: { addButtonText: 'Confirm' }, + formfields: formfields + }; + const payChargeDialogRef = this.dialog.open(FormDialogComponent, { data }); + payChargeDialogRef.afterClosed().subscribe((response: any) => { + if (response.data) { + const locale = 'en'; + const dateFormat = 'dd MMMM yyyy'; + const dataObject = { + ...response.data.value, + dueDate: this.datePipe.transform(response.data.value.dueDate, dateFormat), + dateFormat, + locale + }; + this.savingsService.executeSavingsAccountChargesCommand(this.chargeData.accountId, 'paycharge', dataObject, this.chargeData.id) + .subscribe(() => { + this.router.navigate(['../'], { relativeTo: this.route }); + }); + } + }); + } + + /** + * Waive's the charge + */ + waiveCharge() { + const waiveChargeDialogRef = this.dialog.open(WaiveChargeDialogComponent, { data: { id: this.chargeData.id } }); + waiveChargeDialogRef.afterClosed().subscribe((response: any) => { + if (response.confirm) { + this.savingsService.executeSavingsAccountChargesCommand(this.chargeData.accountId, 'waive', {}, this.chargeData.id) + .subscribe(() => { + this.router.navigate(['../'], { relativeTo: this.route }); + }); + } + }); + } + + /** + * Inactivate's the charge + */ + inactivateCharge() { + const inactivateChargeDialogRef = this.dialog.open(InactivateChargeDialogComponent, { data: { id: this.chargeData.id } }); + inactivateChargeDialogRef.afterClosed().subscribe((response: any) => { + if (response.confirm) { + this.savingsService.executeSavingsAccountChargesCommand(this.chargeData.accountId, 'inactivate', {}, this.chargeData.id) + .subscribe(() => { + this.router.navigate(['../'], { relativeTo: this.route }); + }); + } + }); + } + + /** + * Checks if charge is recurring + */ + isRecurringCharge() { + const chargeTimeType = this.chargeData.chargeTimeType.value; + return chargeTimeType === 'Monthly Fee' || chargeTimeType === 'Annual Fee' || chargeTimeType === 'Weekly Fee'; + } + +} diff --git a/src/app/savings/savings-routing.module.ts b/src/app/savings/savings-routing.module.ts index 549b386c6..268a43c3e 100644 --- a/src/app/savings/savings-routing.module.ts +++ b/src/app/savings/savings-routing.module.ts @@ -16,6 +16,7 @@ import { DatatableTabsComponent } from './savings-account-view/datatable-tabs/da import { CreateSavingsAccountComponent } from './create-savings-account/create-savings-account.component'; import { EditSavingsAccountComponent } from './edit-savings-account/edit-savings-account.component'; import { ViewTransactionComponent } from './savings-account-view/view-transaction/view-transaction.component'; +import { ViewChargeComponent } from './savings-account-view/view-charge/view-charge.component'; /** Custom Resolvers */ import { SavingAccountTransactionTemplateResolver } from './common-resolvers/saving-transaction-template.resolver'; @@ -26,6 +27,7 @@ import { SavingsDatatablesResolver } from './common-resolvers/savings-datatables import { SavingsAccountTemplateResolver } from './common-resolvers/savings-account-template.resolver'; import { SavingsAccountAndTemplateResolver } from './common-resolvers/savings-account-and-template.resolver'; import { SavingsAccountTransactionResolver } from './common-resolvers/savings-account-transaction.resolver'; +import { SavingsAccountChargeResolver} from './common-resolvers/savings-account-charge.resolver'; const routes: Routes = [ { @@ -108,6 +110,25 @@ const routes: Routes = [ } ] }, + { + path: 'charges', + data: { title: extract('Savings Account Charges'), breadcrumb: 'Charges', routeParamBreadcrumb: false }, + children: [ + { + path: '', + redirectTo: '../charges', pathMatch: 'prefix' + }, + { + path: ':id', + data: { routeParamBreadcrumb: 'id' }, + component: ViewChargeComponent, + resolve: { + savingsAccountData: SavingsAccountViewResolver, + savingsAccountCharge: SavingsAccountChargeResolver + } + } + ] + }, { path: 'actions/:name', data: { title: extract('Savings Account Actions'), routeParamBreadcrumb: 'name' }, @@ -129,6 +150,7 @@ const routes: Routes = [ SavingsDatatableResolver, SavingsAccountTemplateResolver, SavingsAccountAndTemplateResolver, - SavingsAccountTransactionResolver] + SavingsAccountTransactionResolver, + SavingsAccountChargeResolver] }) export class SavingsRoutingModule {} diff --git a/src/app/savings/savings.module.ts b/src/app/savings/savings.module.ts index e334fab47..b646eb8bb 100644 --- a/src/app/savings/savings.module.ts +++ b/src/app/savings/savings.module.ts @@ -37,6 +37,10 @@ import { CalculateInterestDialogComponent } from './savings-account-view/custom- import { PostInterestDialogComponent } from './savings-account-view/custom-dialogs/post-interest-dialog/post-interest-dialog.component'; import { ViewTransactionComponent } from './savings-account-view/view-transaction/view-transaction.component'; import { UndoTransactionDialogComponent } from './savings-account-view/custom-dialogs/undo-transaction-dialog/undo-transaction-dialog.component'; +import { ViewChargeComponent } from './savings-account-view/view-charge/view-charge.component'; +import { WaiveChargeDialogComponent } from './savings-account-view/custom-dialogs/waive-charge-dialog/waive-charge-dialog.component'; +import { InactivateChargeDialogComponent } from './savings-account-view/custom-dialogs/inactivate-charge-dialog/inactivate-charge-dialog.component'; + /** * Savings Module @@ -78,12 +82,18 @@ import { UndoTransactionDialogComponent } from './savings-account-view/custom-di CalculateInterestDialogComponent, PostInterestDialogComponent, ViewTransactionComponent, - UndoTransactionDialogComponent + UndoTransactionDialogComponent, + ViewChargeComponent, + WaiveChargeDialogComponent, + InactivateChargeDialogComponent ], entryComponents: [ CalculateInterestDialogComponent, PostInterestDialogComponent, - UndoTransactionDialogComponent + UndoTransactionDialogComponent, + WaiveChargeDialogComponent, + InactivateChargeDialogComponent + ], providers: [DatePipe] }) diff --git a/src/app/savings/savings.service.ts b/src/app/savings/savings.service.ts index 519ce3708..af57120c4 100644 --- a/src/app/savings/savings.service.ts +++ b/src/app/savings/savings.service.ts @@ -206,6 +206,7 @@ export class SavingsService { * @param {string} accountId Savings Account Id * @param {string} command Command * @param {any} data Data + * @param {string} transactionId Transaction Id * @returns {Observable} Savings data. */ executeSavingsAccountTransactionsCommand(accountId: string, command: string, data: any, transactionId?: any): Observable { @@ -216,4 +217,24 @@ export class SavingsService { return this.http.post(`/savingsaccounts/${accountId}/transactions`, data, { params: httpParams }); } + /** + * @param {string} accountId savings account Id + * @param {string} chargeId savings charge Id + */ + getSavingsAccountCharge(accountId: string, chargeId: string) { + return this.http.get(`/savingsaccounts/${accountId}/charges/${chargeId}`); + } + + /** + * @param {string} accountId Savings Account Id + * @param {string} command Command + * @param {any} data Data + * @param {string} chargeId Charge Id + * @returns {Observable} Savings data. + */ + executeSavingsAccountChargesCommand(accountId: string, command: string, data: any, chargeId: any): Observable { + const httpParams = new HttpParams().set('command', command); + return this.http.post(`/savingsaccounts/${accountId}/charges/${chargeId}`, data, { params: httpParams }); + } + } diff --git a/src/app/shared/icons.module.ts b/src/app/shared/icons.module.ts index 508607644..df49cd91d 100644 --- a/src/app/shared/icons.module.ts +++ b/src/app/shared/icons.module.ts @@ -89,7 +89,8 @@ import { faDonate, faMoneyBill, faChartLine, - faPen + faPen, + faFlag } from '@fortawesome/free-solid-svg-icons'; /** Add icons to the library for convenient access in other components. */ @@ -178,7 +179,8 @@ library.add( faDonate, faMoneyBill, faChartLine, - faPen + faPen, + faFlag ); /**