feat: fixed deposit account actions (approve) (#963)

Fixes: #962
This commit is contained in:
Karan Takalkar
2020-07-03 13:19:20 +05:30
committed by GitHub
parent 51616ff9fd
commit 48616be5dd
13 changed files with 315 additions and 6 deletions
@@ -35,15 +35,15 @@
<mat-card-actions class="account-actions">
<ng-container *ngFor="let button of buttonConfig.singleButtons">
<button mat-raised-button>
<button mat-raised-button (click)="doAction(button.name)">
<i class="{{button.icon}}"></i> {{button.name}}</button>
</ng-container>
<ng-container *ngIf="buttonConfig.options">
<ng-container *ngIf="buttonConfig.options.length">
<button mat-raised-button [matMenuTriggerFor]="More">More</button>
<mat-menu #More="matMenu">
<span *ngFor="let option of buttonConfig.options">
<button mat-menu-item >{{option.name}}</button>
<button mat-menu-item (click)="doAction(option.name)">{{option.name}}</button>
</span>
</mat-menu>
</ng-container>
@@ -1,8 +1,14 @@
/** Angular Imports */
import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';
import { MatDialog } from '@angular/material';
/** Custom Button Config. */
import { FixedDepositsButtonsConfiguration } from './fixed-deposits-buttons.config';
/** Custom Services */
import { FixedDepositsService } from '../fixed-deposits.service';
/**
* Fixed Deposits Account View Component
*/
@@ -24,7 +30,10 @@ export class FixedDepositAccountViewComponent implements OnInit {
* Fetches fixed deposits account data from `resolve`
* @param {ActivatedRoute} route Activated Route
*/
constructor(private route: ActivatedRoute) {
constructor(private route: ActivatedRoute,
private router: Router,
private fixedDepositsService: FixedDepositsService,
public dialog: MatDialog) {
this.route.data.subscribe((data: { fixedDepositsAccountData: any, savingsDatatables: any }) => {
this.fixedDepositsAccountData = data.fixedDepositsAccountData;
this.savingsDatatables = data.savingsDatatables;
@@ -54,4 +63,48 @@ export class FixedDepositAccountViewComponent implements OnInit {
}
}
/**
* Performs action button/option action.
* @param {string} name action name.
*/
doAction(name: string) {
switch (name) {
case 'Approve':
case 'Reject':
case 'Deposit':
case 'Activate':
case 'Close':
case 'Undo Approval':
case 'Post Interest As On':
case 'Assign Staff':
case 'Add Charge':
case 'Unassign Staff':
case 'Withdraw By Client':
this.router.navigate([`actions/${name}`], { relativeTo: this.route });
break;
case 'Withdraw':
this.router.navigate([`actions/Withdrawal`], { relativeTo: this.route });
break;
case 'Modify Application':
this.router.navigate(['edit-savings-account'], { relativeTo: this.route });
break;
case 'Delete':
break;
case 'Calculate Interest':
break;
case 'Post Interest':
break;
case 'Enable Withhold Tax':
break;
case 'Disable Withhold Tax':
break;
}
}
}