+8
@@ -0,0 +1,8 @@
|
|||||||
|
<h1 mat-dialog-title>Calculate Interest</h1>
|
||||||
|
<div mat-dialog-content>
|
||||||
|
<p>Are you sure you want to calculate interest ?</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 { CalculateInterestDialogComponent } from './calculate-interest-dialog.component';
|
||||||
|
|
||||||
|
describe('CalculateInterestDialogComponent', () => {
|
||||||
|
let component: CalculateInterestDialogComponent;
|
||||||
|
let fixture: ComponentFixture<CalculateInterestDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ CalculateInterestDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(CalculateInterestDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+21
@@ -0,0 +1,21 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { MatDialogRef } from '@angular/material';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculate interest dialog component.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-calculate-interest-dialog',
|
||||||
|
templateUrl: './calculate-interest-dialog.component.html',
|
||||||
|
styleUrls: ['./calculate-interest-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class CalculateInterestDialogComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||||
|
* @param {any} data savings account id.
|
||||||
|
*/
|
||||||
|
constructor(public dialogRef: MatDialogRef<CalculateInterestDialogComponent>) { }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import { MatDialog } from '@angular/material';
|
|||||||
|
|
||||||
/** Custom Dialogs */
|
/** Custom Dialogs */
|
||||||
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
|
||||||
|
import { CalculateInterestDialogComponent } from './custom-dialogs/calculate-interest-dialog/calculate-interest-dialog.component';
|
||||||
|
|
||||||
/** Custom Buttons Configuration */
|
/** Custom Buttons Configuration */
|
||||||
import { SavingsButtonsConfiguration } from './savings-buttons.config';
|
import { SavingsButtonsConfiguration } from './savings-buttons.config';
|
||||||
@@ -114,6 +115,9 @@ export class SavingsAccountViewComponent implements OnInit {
|
|||||||
case 'Delete':
|
case 'Delete':
|
||||||
this.deleteSavingsAccount();
|
this.deleteSavingsAccount();
|
||||||
break;
|
break;
|
||||||
|
case 'Calculate Interest':
|
||||||
|
this.calculateInterest();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -133,4 +137,29 @@ export class SavingsAccountViewComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Calculates savings account's interest
|
||||||
|
*/
|
||||||
|
private calculateInterest() {
|
||||||
|
const calculateInterestAccountDialogRef = this.dialog.open(CalculateInterestDialogComponent);
|
||||||
|
calculateInterestAccountDialogRef.afterClosed().subscribe((response: any) => {
|
||||||
|
if (response.confirm) {
|
||||||
|
this.savingsService.executeSavingsAccountCommand(this.savingsAccountData.id, 'calculateInterest', {}).subscribe(() => {
|
||||||
|
this.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Refetches data fot the component
|
||||||
|
* TODO: Replace by a custom reload component instead of hard-coded back-routing.
|
||||||
|
*/
|
||||||
|
private reload() {
|
||||||
|
const clientId = this.savingsAccountData.clientId;
|
||||||
|
const url: string = this.router.url;
|
||||||
|
this.router.navigateByUrl(`/clients/${clientId}/savingsaccounts`, {skipLocationChange: true})
|
||||||
|
.then(() => this.router.navigate([url]));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import { UndoApprovalSavingsAccountComponent } from './saving-account-actions/un
|
|||||||
import { PostInterestAsOnSavingsAccountComponent } from './saving-account-actions/post-interest-as-on-savings-account/post-interest-as-on-savings-account.component';
|
import { PostInterestAsOnSavingsAccountComponent } from './saving-account-actions/post-interest-as-on-savings-account/post-interest-as-on-savings-account.component';
|
||||||
import { SavingsAccountAssignStaffComponent } from './saving-account-actions/savings-account-assign-staff/savings-account-assign-staff.component';
|
import { SavingsAccountAssignStaffComponent } from './saving-account-actions/savings-account-assign-staff/savings-account-assign-staff.component';
|
||||||
import { SavingsAccountUnassignStaffComponent } from './saving-account-actions/savings-account-unassign-staff/savings-account-unassign-staff.component';
|
import { SavingsAccountUnassignStaffComponent } from './saving-account-actions/savings-account-unassign-staff/savings-account-unassign-staff.component';
|
||||||
|
import { CalculateInterestDialogComponent } from './savings-account-view/custom-dialogs/calculate-interest-dialog/calculate-interest-dialog.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Savings Module
|
* Savings Module
|
||||||
@@ -70,7 +71,11 @@ import { SavingsAccountUnassignStaffComponent } from './saving-account-actions/s
|
|||||||
UndoApprovalSavingsAccountComponent,
|
UndoApprovalSavingsAccountComponent,
|
||||||
PostInterestAsOnSavingsAccountComponent,
|
PostInterestAsOnSavingsAccountComponent,
|
||||||
SavingsAccountAssignStaffComponent,
|
SavingsAccountAssignStaffComponent,
|
||||||
SavingsAccountUnassignStaffComponent
|
SavingsAccountUnassignStaffComponent,
|
||||||
|
CalculateInterestDialogComponent
|
||||||
|
],
|
||||||
|
entryComponents: [
|
||||||
|
CalculateInterestDialogComponent
|
||||||
],
|
],
|
||||||
providers: [DatePipe]
|
providers: [DatePipe]
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user