refactor: fixed deposits module (#1201)

See: #1196
This commit is contained in:
Karan Takalkar
2020-08-13 17:44:23 +05:30
committed by GitHub
parent a1cd561453
commit 572a07bf45
11 changed files with 34 additions and 10 deletions
@@ -66,7 +66,7 @@
<button mat-menu-item [routerLink]="['savingsaccounts', 'create-savings-account']">New Savings Account</button>
<button mat-menu-item *mifosxHasPermission="'CREATE_SHAREACCOUNT'" [routerLink]="['shares-accounts', 'create']">New Share Account</button>
<button mat-menu-item [routerLink]="['recurringdeposits', 'create-recurring-deposits-account']">New Recurring Deposit Account</button>
<button mat-menu-item [routerLink]="['fixed-deposits-accounts', 'create-fixed-deposit-account']">New Fixed Deposits Account</button>
<button mat-menu-item [routerLink]="['fixed-deposits-accounts', 'create']">New Fixed Deposits Account</button>
</mat-menu>
<button mat-raised-button [matMenuTriggerFor]="Actions">
@@ -22,6 +22,9 @@ export class FixedDepositAccountCurrencyStepComponent implements OnChanges {
/** Currency Data */
currencyData: any;
/**
* @param {FormBuilder} formBuilder Form Builder
*/
constructor(private formBuilder: FormBuilder) {
this.createFixedDepositAccountCurrencyForm();
}
@@ -36,6 +39,9 @@ export class FixedDepositAccountCurrencyStepComponent implements OnChanges {
}
}
/**
* Creates fd currency form.
*/
createFixedDepositAccountCurrencyForm() {
this.fixedDepositAccountCurrencyForm = this.formBuilder.group({
'currencyCode': [{ value: '', disabled: true}],
@@ -36,6 +36,7 @@ export class FixedDepositAccountInterestRateChartStepComponent implements OnChan
/** Expand Chart Slab Index used in the view */
expandChartSlabIndex: number;
/** Interest Rate charts table reference */
@ViewChild('chartsTable') chartsTableRef: MatTable<Element>;
constructor() { }
@@ -14,7 +14,6 @@ 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) { }
@@ -103,7 +103,7 @@ export class FixedDepositAccountViewComponent implements OnInit {
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
break;
case 'Modify Application':
this.router.navigate(['edit-fixed-deposit-account'], { relativeTo: this.route });
this.router.navigate(['edit'], { relativeTo: this.route });
break;
case 'Delete':
this.deleteFixedDepositsAccount();
@@ -140,7 +140,7 @@ export class FixedDepositAccountViewComponent implements OnInit {
}
/**
* Calculates savings account's interest
* Calculates fixed deposit account's interest
*/
private calculateInterest() {
const calculateInterestAccountDialogRef = this.dialog.open(CalculateInterestDialogComponent);
@@ -154,7 +154,7 @@ export class FixedDepositAccountViewComponent implements OnInit {
}
/**
* Posts savings account's interest
* Posts fixed deposit account's interest
*/
private postInterest() {
const postInterestAccountDialogRef = this.dialog.open(PostInterestDialogComponent);
@@ -43,6 +43,9 @@ export class StandingInstructionsTabComponent implements OnInit {
/**
* Retrieves Fixed Deposits Account Data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
* @param {FixedDepositsService} fixedDepositsService FixedDepositsService
* @param {MatDialog} dialog Mat Dialog
* @param {AccountTransfersService} accountTransfersService Accounts Transfer Service
*/
constructor(private route: ActivatedRoute,
private fixedDepositsService: FixedDepositsService,
@@ -73,6 +76,10 @@ export class StandingInstructionsTabComponent implements OnInit {
});
}
/**
* Deletes a standing instruction
* @param {any} instructionId Instruction Id
*/
deleteStandingInstruction(instructionId: any) {
const deleteStandingInstructionDialogRef = this.dialog.open(DeleteDialogComponent, {
data: { deleteContext: `standing instruction id: ${instructionId}` }
@@ -25,6 +25,7 @@ export class TransactionsTabComponent implements OnInit {
/**
* Retrieves fixed deposits account data from `resolve`.
* @param {ActivatedRoute} route Activated Route.
* @param {Router} router Router
*/
constructor(private route: ActivatedRoute,
private router: Router) {
@@ -49,7 +50,7 @@ export class TransactionsTabComponent implements OnInit {
/**
* Show Transactions Details
* @param transactionsData Transactions Data
* @param {any} transactionsData Transactions Data
*/
showTransactions(transactionsData: any) {
if (transactionsData.transfer) {
@@ -5,7 +5,6 @@ import { MatDialog } from '@angular/material';
/**
* View Transaction Component.
* TODO: Add support for account transfers.
*/
@Component({
selector: 'mifosx-view-transaction',
@@ -32,7 +32,7 @@ const routes: Routes = [
data: { title: extract('All Fixed Deposits'), breadcrumb: 'Fixed Deposits', routeParamBreadcrumb: false },
children: [
{
path: 'create-fixed-deposit-account',
path: 'create',
data: { title: extract('Create Fixed Deposit Account'), breadcrumb: 'Create Fixed Deposit Account' },
component: CreateFixedDepositAccountComponent,
resolve: {
@@ -87,7 +87,7 @@ const routes: Routes = [
]
},
{
path: 'edit-fixed-deposit-account',
path: 'edit',
data: { title: extract('Edit Fixed Deposit Account'), breadcrumb: 'Edit', routeParamBreadcrumb: false },
component: EditFixedDepositAccountComponent,
resolve: {
@@ -42,6 +42,11 @@ import { FixedDepositAccountPreviewStepComponent } from './fixed-deposit-account
import { FixedDepositAccountCurrencyStepComponent } from './fixed-deposit-account-stepper/fixed-deposit-account-currency-step/fixed-deposit-account-currency-step.component';
import { EditFixedDepositAccountComponent } from './edit-fixed-deposit-account/edit-fixed-deposit-account.component';
/**
* Fixed Deposits Module
*
* All components related to fixed deposits functions should be declared here.
*/
@NgModule({
declarations: [
FixedDepositAccountViewComponent,
@@ -13,6 +13,9 @@ import { Observable } from 'rxjs';
})
export class FixedDepositsService {
/**
* @param {HttpClient} http HttpClient
*/
constructor(private http: HttpClient) {}
/**
@@ -83,7 +86,10 @@ export class FixedDepositsService {
return this.http.get('/fixeddepositaccounts/template', { params: httpParams });
}
/**
* @param {string} accountId Fixed Deposits Account Id
* @returns {Observable<any>}
*/
getFixedDepositsAccountAndTemplate(accountId: any) {
const httpParams = new HttpParams().set('associations', 'charges,+linkedAccount')
.set('template', 'true');