-1
@@ -14,7 +14,6 @@ export class CalculateInterestDialogComponent {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||||
* @param {any} data savings account id.
|
|
||||||
*/
|
*/
|
||||||
constructor(public dialogRef: MatDialogRef<CalculateInterestDialogComponent>) { }
|
constructor(public dialogRef: MatDialogRef<CalculateInterestDialogComponent>) { }
|
||||||
|
|
||||||
|
|||||||
+8
@@ -0,0 +1,8 @@
|
|||||||
|
<h1 mat-dialog-title>Post Interest</h1>
|
||||||
|
<div mat-dialog-content>
|
||||||
|
<p>Are you sure you want to post 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 { PostInterestDialogComponent } from './post-interest-dialog.component';
|
||||||
|
|
||||||
|
describe('PostInterestDialogComponent', () => {
|
||||||
|
let component: PostInterestDialogComponent;
|
||||||
|
let fixture: ComponentFixture<PostInterestDialogComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ PostInterestDialogComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(PostInterestDialogComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
/** Angular Imports */
|
||||||
|
import { Component } from '@angular/core';
|
||||||
|
import { MatDialogRef } from '@angular/material';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Post interest dialog component.
|
||||||
|
*/
|
||||||
|
@Component({
|
||||||
|
selector: 'mifosx-post-interest-dialog',
|
||||||
|
templateUrl: './post-interest-dialog.component.html',
|
||||||
|
styleUrls: ['./post-interest-dialog.component.scss']
|
||||||
|
})
|
||||||
|
export class PostInterestDialogComponent {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param {MatDialogRef} dialogRef Component reference to dialog.
|
||||||
|
*/
|
||||||
|
constructor(public dialogRef: MatDialogRef<PostInterestDialogComponent>) { }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -6,6 +6,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';
|
import { CalculateInterestDialogComponent } from './custom-dialogs/calculate-interest-dialog/calculate-interest-dialog.component';
|
||||||
|
import { PostInterestDialogComponent } from './custom-dialogs/post-interest-dialog/post-interest-dialog.component';
|
||||||
|
|
||||||
/** Custom Buttons Configuration */
|
/** Custom Buttons Configuration */
|
||||||
import { SavingsButtonsConfiguration } from './savings-buttons.config';
|
import { SavingsButtonsConfiguration } from './savings-buttons.config';
|
||||||
@@ -97,6 +98,10 @@ export class SavingsAccountViewComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Performs action button/option action.
|
||||||
|
* @param {string} name action name.
|
||||||
|
*/
|
||||||
doAction(name: string) {
|
doAction(name: string) {
|
||||||
switch (name) {
|
switch (name) {
|
||||||
case 'Approve':
|
case 'Approve':
|
||||||
@@ -118,6 +123,9 @@ export class SavingsAccountViewComponent implements OnInit {
|
|||||||
case 'Calculate Interest':
|
case 'Calculate Interest':
|
||||||
this.calculateInterest();
|
this.calculateInterest();
|
||||||
break;
|
break;
|
||||||
|
case 'Post Interest':
|
||||||
|
this.postInterest();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,6 +159,20 @@ export class SavingsAccountViewComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Posts savings account's interest
|
||||||
|
*/
|
||||||
|
private postInterest() {
|
||||||
|
const postInterestAccountDialogRef = this.dialog.open(PostInterestDialogComponent);
|
||||||
|
postInterestAccountDialogRef.afterClosed().subscribe((response: any) => {
|
||||||
|
if (response.confirm) {
|
||||||
|
this.savingsService.executeSavingsAccountCommand(this.savingsAccountData.id, 'postInterest', {}).subscribe(() => {
|
||||||
|
this.reload();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Refetches data fot the component
|
* Refetches data fot the component
|
||||||
* TODO: Replace by a custom reload component instead of hard-coded back-routing.
|
* TODO: Replace by a custom reload component instead of hard-coded back-routing.
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import { PostInterestAsOnSavingsAccountComponent } from './saving-account-action
|
|||||||
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';
|
import { CalculateInterestDialogComponent } from './savings-account-view/custom-dialogs/calculate-interest-dialog/calculate-interest-dialog.component';
|
||||||
|
import { PostInterestDialogComponent } from './savings-account-view/custom-dialogs/post-interest-dialog/post-interest-dialog.component';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Savings Module
|
* Savings Module
|
||||||
@@ -72,10 +73,12 @@ import { CalculateInterestDialogComponent } from './savings-account-view/custom-
|
|||||||
PostInterestAsOnSavingsAccountComponent,
|
PostInterestAsOnSavingsAccountComponent,
|
||||||
SavingsAccountAssignStaffComponent,
|
SavingsAccountAssignStaffComponent,
|
||||||
SavingsAccountUnassignStaffComponent,
|
SavingsAccountUnassignStaffComponent,
|
||||||
CalculateInterestDialogComponent
|
CalculateInterestDialogComponent,
|
||||||
|
PostInterestDialogComponent
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
CalculateInterestDialogComponent
|
CalculateInterestDialogComponent,
|
||||||
|
PostInterestDialogComponent
|
||||||
],
|
],
|
||||||
providers: [DatePipe]
|
providers: [DatePipe]
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user