@@ -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<Object> {
|
||||
|
||||
/**
|
||||
* @param {SavingsService} SavingsService Savings service.
|
||||
*/
|
||||
constructor(private savingsService: SavingsService) { }
|
||||
|
||||
/**
|
||||
* Returns the Savings Account Charge data.
|
||||
* @param {ActivatedRouteSnapshot} route Route Snapshot
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const savingAccountId = route.parent.paramMap.get('savingAccountId');
|
||||
const chargeId = route.paramMap.get('id');
|
||||
return this.savingsService.getSavingsAccountCharge(savingAccountId, chargeId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,7 +25,7 @@ export class SavingsAccountViewResolver implements Resolve<Object> {
|
||||
* @returns {Observable<any>}
|
||||
*/
|
||||
resolve(route: ActivatedRouteSnapshot): Observable<any> {
|
||||
const savingAccountId = route.paramMap.get('savingAccountId');
|
||||
const savingAccountId = route.paramMap.get('savingAccountId') || route.parent.parent.paramMap.get('savingAccountId');
|
||||
return this.savingsService.getSavingsAccountData(savingAccountId);
|
||||
}
|
||||
|
||||
|
||||
@@ -79,16 +79,16 @@
|
||||
</span>
|
||||
<span *ngIf="savingsAccountData.status.value === 'Active' && charge.amountOutstanding !== 0">
|
||||
<button class="account-action-button" mat-raised-button color="primary" matTooltip="Pay Charge"
|
||||
*mifosxHasPermission="'PAY_SAVINGSACCOUNTCHARGE'">
|
||||
*mifosxHasPermission="'PAY_SAVINGSACCOUNTCHARGE'" (click)="payCharge(charge.id)">
|
||||
<i class="fa fa-dollar"></i>
|
||||
</button>
|
||||
<button class="account-action-button" mat-raised-button color="primary" matTooltip="Waive Charge"
|
||||
*mifosxHasPermission="'WAIVE_SAVINGSACCOUNTCHARGE'">
|
||||
*mifosxHasPermission="'WAIVE_SAVINGSACCOUNTCHARGE'" (click)="waiveCharge(charge.id)">
|
||||
<i class="fa fa-flag"></i>
|
||||
</button>
|
||||
<ng-container *ngIf="isRecurringCharge(charge)">
|
||||
<button class="account-action-button" mat-raised-button color="primary" matTooltip="Inactivate Charge"
|
||||
*mifosxHasPermission="'INACTIVATE_SAVINGSACCOUNTCHARGE'">
|
||||
*mifosxHasPermission="'INACTIVATE_SAVINGSACCOUNTCHARGE'" (click)="inactivateCharge(charge.id)">
|
||||
<i class="fa fa-ban"></i>
|
||||
</button>
|
||||
</ng-container>
|
||||
@@ -97,7 +97,7 @@
|
||||
</ng-container>
|
||||
|
||||
<tr mat-header-row *matHeaderRowDef="displayedColumns"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;"></tr>
|
||||
<tr mat-row *matRowDef="let row; columns: displayedColumns;" class="select-row" [routerLink]="[row.id]"></tr>
|
||||
|
||||
</table>
|
||||
|
||||
|
||||
@@ -15,5 +15,8 @@
|
||||
margin: 4px;
|
||||
line-height: 25px;
|
||||
}
|
||||
.select-row:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<Element>;
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<h1 mat-dialog-title>Inactivate Charge</h1>
|
||||
<div mat-dialog-content>
|
||||
<p>Are you sure you want to inactivate charge with id: {{ data.id }} ?</p>
|
||||
</div>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-dialog-close>Cancel</button>
|
||||
<button mat-raised-button color="primary" [mat-dialog-close]="{ confirm: true }">Confirm</button>
|
||||
</mat-dialog-actions>
|
||||
+25
@@ -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<InactivateChargeDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ InactivateChargeDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(InactivateChargeDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+22
@@ -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<InactivateChargeDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
<h1 mat-dialog-title>Waive Charge</h1>
|
||||
<div mat-dialog-content>
|
||||
<p>Are you sure you want to waive charge with id: {{ data.id }} ?</p>
|
||||
</div>
|
||||
<mat-dialog-actions align="end">
|
||||
<button mat-raised-button mat-dialog-close>Cancel</button>
|
||||
<button mat-raised-button color="primary" [mat-dialog-close]="{ confirm: true }">Confirm</button>
|
||||
</mat-dialog-actions>
|
||||
+25
@@ -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<WaiveChargeDialogComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ WaiveChargeDialogComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(WaiveChargeDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
+22
@@ -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<WaiveChargeDialogComponent>,
|
||||
@Inject(MAT_DIALOG_DATA) public data: any) { }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
|
||||
|
||||
<div fxLayout="row" fxLayoutAlign="end" fxLayoutGap="2%" fxLayout.lt-md="column" class="container m-b-20">
|
||||
<span *ngIf="savingsAccountData.status.value === 'Active' && chargeData.amountOutstanding !== 0">
|
||||
<button mat-raised-button color="accent" *mifosxHasPermission="'PAY_SAVINGSACCOUNTCHARGE'" (click)="payCharge()">
|
||||
<fa-icon icon="dollar-sign"></fa-icon>
|
||||
Pay Charge
|
||||
</button>
|
||||
<button mat-raised-button color="primary" *mifosxHasPermission="'WAIVE_SAVINGSACCOUNTCHARGE'" (click)="waiveCharge()">
|
||||
<fa-icon icon="flag"></fa-icon>
|
||||
Waive Charge
|
||||
</button>
|
||||
<span *ngIf="isRecurringCharge()">
|
||||
<button mat-raised-button color="warn" *mifosxHasPermission="'INACTIVATE_SAVINGSACCOUNTCHARGE'" (click)="inactivateCharge()">
|
||||
<fa-icon icon="trash"></fa-icon>
|
||||
Inactivate Charge
|
||||
</button>
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div class="container">
|
||||
|
||||
<mat-card>
|
||||
|
||||
<mat-card-content>
|
||||
|
||||
<div fxLayout="row wrap" class="content">
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Name
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ chargeData.name }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Charge Type
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ chargeData.penalty ? 'Penalty' : 'Fees' }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Currency
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ chargeData.currency.displayLabel }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Payment due at
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ chargeData.chargeTimeType.value }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Payment due as of
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ chargeData.dueDate | date }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Calculation Type
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ chargeData.chargeCalculationType.value }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Due
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ chargeData.amount }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Paid
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ chargeData.amountPaid }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Waived
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ chargeData.amountWaived }}
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%" class="mat-body-strong">
|
||||
Outstanding
|
||||
</div>
|
||||
|
||||
<div fxFlex="50%">
|
||||
{{ chargeData.amountOutstanding }}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</mat-card-content>
|
||||
|
||||
</mat-card>
|
||||
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
.container {
|
||||
max-width: 37rem;
|
||||
|
||||
.content {
|
||||
div {
|
||||
margin: 1rem 0;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<ViewChargeComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ ViewChargeComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ViewChargeComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
@@ -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';
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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 {}
|
||||
|
||||
@@ -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]
|
||||
})
|
||||
|
||||
@@ -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<any>} Savings data.
|
||||
*/
|
||||
executeSavingsAccountTransactionsCommand(accountId: string, command: string, data: any, transactionId?: any): Observable<any> {
|
||||
@@ -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<any>} Savings data.
|
||||
*/
|
||||
executeSavingsAccountChargesCommand(accountId: string, command: string, data: any, chargeId: any): Observable<any> {
|
||||
const httpParams = new HttpParams().set('command', command);
|
||||
return this.http.post(`/savingsaccounts/${accountId}/charges/${chargeId}`, data, { params: httpParams });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user