feat: add list view standing instructions (#1152)

Fixes: #267
This commit is contained in:
Muskan Khedia
2020-07-23 17:22:28 +05:30
committed by GitHub
parent 63a9e46fc2
commit cb62fefbfa
18 changed files with 410 additions and 18 deletions
@@ -49,7 +49,7 @@
</span>
<span *ngIf="instruction.status.value!=='Deleted'">
<button class="account-action-button" mat-raised-button color="warn" matTooltip="Delete Standing Instruction"
*mifosxHasPermission="'DELETE_STANDINGINSTRUCTION'">
*mifosxHasPermission="'DELETE_STANDINGINSTRUCTION'" (click)="deleteStandingInstruction(instruction.id)">
<i class="fa fa-times"></i>
</button>
</span>
@@ -1,10 +1,14 @@
/** Angular Imports */
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatTableDataSource, MatTable } from '@angular/material';
import { MatTableDataSource, MatTable, MatDialog } from '@angular/material';
import { ActivatedRoute } from '@angular/router';
/** Custom Services */
import { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service';
import { AccountTransfersService } from 'app/account-transfers/account-transfers.service';
/** Dialog Components */
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
/**
* Fixed Deposits Standing Instructions Tab
@@ -41,7 +45,9 @@ export class StandingInstructionsTabComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute,
private fixedDepositsService: FixedDepositsService) {
private fixedDepositsService: FixedDepositsService,
private dialog: MatDialog,
private accountTransfersService: AccountTransfersService) {
this.route.parent.data.subscribe((data: { fixedDepositsAccountData: any }) => {
this.fixedDepositsData = data.fixedDepositsAccountData;
});
@@ -67,4 +73,16 @@ export class StandingInstructionsTabComponent implements OnInit {
});
}
deleteStandingInstruction(instructionId: any) {
const deleteStandingInstructionDialogRef = this.dialog.open(DeleteDialogComponent, {
data: { deleteContext: `standing instruction id: ${instructionId}` }
});
deleteStandingInstructionDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.accountTransfersService.deleteStandingInstrucions(instructionId)
.subscribe(() => { });
}
});
}
}
@@ -54,7 +54,7 @@
</span>
<span *ngIf="instruction.status.value!=='Deleted'">
<button class="account-action-button" mat-raised-button color="warn"
matTooltip="Delete Standing Instruction" *mifosxHasPermission="'DELETE_STANDINGINSTRUCTION'">
matTooltip="Delete Standing Instruction" *mifosxHasPermission="'DELETE_STANDINGINSTRUCTION'" (click)="deleteStandingInstruction(instruction.id)">
<i class="fa fa-times"></i>
</button>
</span>
@@ -1,10 +1,14 @@
/** Angular Imports */
import { Component, OnInit, ViewChild } from '@angular/core';
import { MatTableDataSource, MatTable } from '@angular/material';
import { MatTableDataSource, MatTable, MatDialog } from '@angular/material';
import { ActivatedRoute } from '@angular/router';
/** Custom Services */
import { RecurringDepositsService } from 'app/deposits/recurring-deposits/recurring-deposits.service';
import { AccountTransfersService } from 'app/account-transfers/account-transfers.service';
/** Dialog Components */
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
/**
* Recurring Deposits Standing Instructions Tab
@@ -33,7 +37,9 @@ export class StandingInstructionsTabComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute,
private recurringDepositsService: RecurringDepositsService) {
private recurringDepositsService: RecurringDepositsService,
private dialog: MatDialog,
private accountTransfersService: AccountTransfersService) {
this.route.parent.data.subscribe((data: { recurringDepositsAccountData: any }) => {
this.recurringDepositsData = data.recurringDepositsAccountData;
});
@@ -59,4 +65,16 @@ export class StandingInstructionsTabComponent implements OnInit {
});
}
deleteStandingInstruction(instructionId: any) {
const deleteStandingInstructionDialogRef = this.dialog.open(DeleteDialogComponent, {
data: { deleteContext: `standing instruction id: ${instructionId}` }
});
deleteStandingInstructionDialogRef.afterClosed().subscribe((response: any) => {
if (response.delete) {
this.accountTransfersService.deleteStandingInstrucions(instructionId)
.subscribe(() => { });
}
});
}
}