diff --git a/src/app/account-transfers/account-transfers.service.ts b/src/app/account-transfers/account-transfers.service.ts index 934d0d7c8..4ca713a37 100644 --- a/src/app/account-transfers/account-transfers.service.ts +++ b/src/app/account-transfers/account-transfers.service.ts @@ -106,7 +106,7 @@ export class AccountTransfersService { deleteStandingInstrucions(id: any) { const httpParams = new HttpParams().set('command', 'delete'); - return this.http.delete(`/standinginstructions/${id}`, { params: httpParams }); + return this.http.put(`/standinginstructions/${id}`, {}, { params: httpParams }); } getStandingInstructionsTransactions(standingInstructionsId: any, dateFormat: any, locale: any) { diff --git a/src/app/current-accounts/current-account-view/standing-instructions-tab/standing-instructions-tab.component.html b/src/app/current-accounts/current-account-view/standing-instructions-tab/standing-instructions-tab.component.html index b7fce4f5c..8f5fe91d3 100644 --- a/src/app/current-accounts/current-account-view/standing-instructions-tab/standing-instructions-tab.component.html +++ b/src/app/current-accounts/current-account-view/standing-instructions-tab/standing-instructions-tab.component.html @@ -74,6 +74,7 @@ color="primary" matTooltip="{{ 'tooltips.Edit Standing Instruction' | translate }}" *mifosxHasPermission="'UPDATE_STANDINGINSTRUCTION'" + (click)="editInstruction(instruction.id)" > @@ -99,6 +100,7 @@ color="primary" matTooltip="{{ 'tooltips.View Standing Instruction' | translate }}" *mifosxHasPermission="'READ_STANDINGINSTRUCTION'" + (click)="viewInstruction(instruction.id)" > diff --git a/src/app/current-accounts/current-account-view/standing-instructions-tab/standing-instructions-tab.component.ts b/src/app/current-accounts/current-account-view/standing-instructions-tab/standing-instructions-tab.component.ts index f67be7eaf..385e80ae1 100644 --- a/src/app/current-accounts/current-account-view/standing-instructions-tab/standing-instructions-tab.component.ts +++ b/src/app/current-accounts/current-account-view/standing-instructions-tab/standing-instructions-tab.component.ts @@ -22,7 +22,7 @@ import { MatRowDef, MatRow } from '@angular/material/table'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; /** Custom Services */ import { CurrentAccountsService } from 'app/current-accounts/current-accounts.service'; @@ -60,6 +60,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; }) export class StandingInstructionsTabComponent implements OnInit { private route = inject(ActivatedRoute); + private router = inject(Router); private currentAccountsService = inject(CurrentAccountsService); private dialog = inject(MatDialog); private accountTransfersService = inject(AccountTransfersService); @@ -118,13 +119,25 @@ export class StandingInstructionsTabComponent implements OnInit { }); } + viewInstruction(instructionId: any) { + const base = this.router.url.split('?')[0].replace(/\/standing-instructions(-tab)?$/, ''); + this.router.navigateByUrl(`${base}/transfer-funds/${instructionId}/view`); + } + + editInstruction(instructionId: any) { + const base = this.router.url.split('?')[0].replace(/\/standing-instructions(-tab)?$/, ''); + this.router.navigateByUrl(`${base}/transfer-funds/${instructionId}/edit`); + } + 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(() => {}); + this.accountTransfersService.deleteStandingInstrucions(instructionId).subscribe(() => { + this.getStandingInstructions(); + }); } }); } diff --git a/src/app/deposits/fixed-deposits/fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component.html b/src/app/deposits/fixed-deposits/fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component.html index 10a69166d..cdb35759b 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component.html +++ b/src/app/deposits/fixed-deposits/fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component.html @@ -62,6 +62,7 @@ color="primary" matTooltip="{{ 'tooltips.Edit Standing Instruction' | translate }}" *mifosxHasPermission="'UPDATE_STANDINGINSTRUCTION'" + (click)="editInstruction(instruction.id)" > @@ -87,6 +88,7 @@ color="primary" matTooltip="{{ 'tooltips.View Standing Instruction' | translate }}" *mifosxHasPermission="'READ_STANDINGINSTRUCTION'" + (click)="viewInstruction(instruction.id)" > diff --git a/src/app/deposits/fixed-deposits/fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component.ts b/src/app/deposits/fixed-deposits/fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component.ts index bc5c87a22..170536f8c 100644 --- a/src/app/deposits/fixed-deposits/fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component.ts +++ b/src/app/deposits/fixed-deposits/fixed-deposit-account-view/standing-instructions-tab/standing-instructions-tab.component.ts @@ -22,7 +22,7 @@ import { MatRowDef, MatRow } from '@angular/material/table'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; /** Custom Services */ import { FixedDepositsService } from 'app/deposits/fixed-deposits/fixed-deposits.service'; @@ -60,6 +60,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; }) export class StandingInstructionsTabComponent implements OnInit { private route = inject(ActivatedRoute); + private router = inject(Router); private fixedDepositsService = inject(FixedDepositsService); private dialog = inject(MatDialog); private accountTransfersService = inject(AccountTransfersService); @@ -125,13 +126,26 @@ export class StandingInstructionsTabComponent implements OnInit { * Deletes a standing instruction * @param {any} instructionId Instruction Id */ + viewInstruction(instructionId: any) { + // FD: transfer-funds live under transactions/account-transfers + const base = this.router.url.split('?')[0].replace(/\/standing-instructions(-tab)?$/, ''); + this.router.navigateByUrl(`${base}/transactions/account-transfers/${instructionId}/view`); + } + + editInstruction(instructionId: any) { + const base = this.router.url.split('?')[0].replace(/\/standing-instructions(-tab)?$/, ''); + this.router.navigateByUrl(`${base}/transactions/account-transfers/${instructionId}/edit`); + } + 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(() => {}); + this.accountTransfersService.deleteStandingInstrucions(instructionId).subscribe(() => { + this.getStandingInstructions(); + }); } }); } diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/standing-instructions-tab/standing-instructions-tab.component.html b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/standing-instructions-tab/standing-instructions-tab.component.html index e1cb462d7..cdb35759b 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/standing-instructions-tab/standing-instructions-tab.component.html +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/standing-instructions-tab/standing-instructions-tab.component.html @@ -62,7 +62,7 @@ color="primary" matTooltip="{{ 'tooltips.Edit Standing Instruction' | translate }}" *mifosxHasPermission="'UPDATE_STANDINGINSTRUCTION'" - [routerLink]="['../', 'standing-instructions', instruction.id, 'edit']" + (click)="editInstruction(instruction.id)" > @@ -88,7 +88,7 @@ color="primary" matTooltip="{{ 'tooltips.View Standing Instruction' | translate }}" *mifosxHasPermission="'READ_STANDINGINSTRUCTION'" - [routerLink]="['../', 'standing-instructions', instruction.id, 'view']" + (click)="viewInstruction(instruction.id)" > diff --git a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/standing-instructions-tab/standing-instructions-tab.component.ts b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/standing-instructions-tab/standing-instructions-tab.component.ts index b26d02479..b43f2dd9a 100644 --- a/src/app/deposits/recurring-deposits/recurring-deposits-account-view/standing-instructions-tab/standing-instructions-tab.component.ts +++ b/src/app/deposits/recurring-deposits/recurring-deposits-account-view/standing-instructions-tab/standing-instructions-tab.component.ts @@ -22,7 +22,7 @@ import { MatRowDef, MatRow } from '@angular/material/table'; -import { ActivatedRoute, RouterLink } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; /** Custom Services */ import { RecurringDepositsService } from 'app/deposits/recurring-deposits/recurring-deposits.service'; @@ -60,6 +60,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; }) export class StandingInstructionsTabComponent implements OnInit { private route = inject(ActivatedRoute); + private router = inject(Router); private recurringDepositsService = inject(RecurringDepositsService); private dialog = inject(MatDialog); private accountTransfersService = inject(AccountTransfersService); @@ -117,13 +118,25 @@ export class StandingInstructionsTabComponent implements OnInit { }); } + viewInstruction(instructionId: any) { + const base = this.router.url.split('?')[0].replace(/\/standing-instructions(-tab)?$/, ''); + this.router.navigateByUrl(`${base}/transfer-funds/${instructionId}/view`); + } + + editInstruction(instructionId: any) { + const base = this.router.url.split('?')[0].replace(/\/standing-instructions(-tab)?$/, ''); + this.router.navigateByUrl(`${base}/transfer-funds/${instructionId}/edit`); + } + 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(() => {}); + this.accountTransfersService.deleteStandingInstrucions(instructionId).subscribe(() => { + this.getStandingInstructions(); + }); } }); } diff --git a/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.html b/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.html index b517656ff..a8813d7e2 100644 --- a/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.html +++ b/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.html @@ -63,6 +63,7 @@ color="primary" matTooltip="{{ 'tooltips.Edit Standing Instruction' | translate }}" *mifosxHasPermission="'UPDATE_STANDINGINSTRUCTION'" + (click)="editInstruction(instruction.id)" > @@ -88,6 +89,7 @@ color="primary" matTooltip="{{ 'tooltips.View Standing Instruction' | translate }}" *mifosxHasPermission="'READ_STANDINGINSTRUCTION'" + (click)="viewInstruction(instruction.id)" > diff --git a/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.ts b/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.ts index beeacd06d..df5776478 100644 --- a/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.ts +++ b/src/app/savings/savings-account-view/standing-instructions-tab/standing-instructions-tab.component.ts @@ -22,7 +22,7 @@ import { MatRowDef, MatRow } from '@angular/material/table'; -import { ActivatedRoute } from '@angular/router'; +import { ActivatedRoute, Router } from '@angular/router'; /** Custom Services */ import { SavingsService } from 'app/savings/savings.service'; @@ -60,6 +60,7 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module'; }) export class StandingInstructionsTabComponent implements OnInit { private route = inject(ActivatedRoute); + private router = inject(Router); private savingsService = inject(SavingsService); private dialog = inject(MatDialog); private accountTransfersService = inject(AccountTransfersService); @@ -118,13 +119,25 @@ export class StandingInstructionsTabComponent implements OnInit { }); } + viewInstruction(instructionId: any) { + const base = this.router.url.split('?')[0].replace(/\/standing-instructions(-tab)?$/, ''); + this.router.navigateByUrl(`${base}/transfer-funds/${instructionId}/view`); + } + + editInstruction(instructionId: any) { + const base = this.router.url.split('?')[0].replace(/\/standing-instructions(-tab)?$/, ''); + this.router.navigateByUrl(`${base}/transfer-funds/${instructionId}/edit`); + } + 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(() => {}); + this.accountTransfersService.deleteStandingInstrucions(instructionId).subscribe(() => { + this.getStandingInstructions(); + }); } }); }