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
@@ -56,7 +56,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 { LoansService } from 'app/loans/loans.service';
import { AccountTransfersService } from 'app/account-transfers/account-transfers.service';
/** Dialog Components */
import { DeleteDialogComponent } from 'app/shared/delete-dialog/delete-dialog.component';
/**
* Loans Standing Instructions Tab
@@ -33,7 +37,9 @@ export class StandingInstructionsTabComponent implements OnInit {
* @param {ActivatedRoute} route Activated Route.
*/
constructor(private route: ActivatedRoute,
private loansService: LoansService) {
private loansService: LoansService,
private dialog: MatDialog,
private accountTransfersService: AccountTransfersService) {
this.route.parent.data.subscribe((data: { loanDetailsData: any }) => {
this.loanDetailsData = data.loanDetailsData;
});
@@ -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(() => { });
}
});
}
}