From 33b01d667df3dc749760109dfee7710db99f6492 Mon Sep 17 00:00:00 2001 From: Jaanu423 Date: Tue, 26 May 2026 11:42:18 +0530 Subject: [PATCH] feat: fix standing instructions action buttons for all account types - Wire up Edit/View/Delete buttons with click handlers in all 4 HTML templates (Current Account, Savings, Fixed Deposit, Recurring Deposit) - Remove broken [routerLink] from Recurring Deposit HTML - Add viewInstruction() and editInstruction() methods to all 4 tab components - Use navigateByUrl with absolute path built from this.router.url to avoid Angular multi-level .. navigation bug (was producing literal .. in URL) CA/Savings/RD: basePath + /transfer-funds/:id/view|edit FD: basePath + /transactions/account-transfers/:id/view|edit - Fix deleteStandingInstruction() to refresh table after delete in all tabs - Fix AccountTransfersService.deleteStandingInstrucions to use PUT ?command=delete instead of HTTP DELETE (backend soft-delete only) Co-Authored-By: Claude Sonnet 4.6 --- .../account-transfers.service.ts | 2 +- .../standing-instructions-tab.component.html | 2 ++ .../standing-instructions-tab.component.ts | 17 +++++++++++++++-- .../standing-instructions-tab.component.html | 2 ++ .../standing-instructions-tab.component.ts | 18 ++++++++++++++++-- .../standing-instructions-tab.component.html | 4 ++-- .../standing-instructions-tab.component.ts | 17 +++++++++++++++-- .../standing-instructions-tab.component.html | 2 ++ .../standing-instructions-tab.component.ts | 17 +++++++++++++++-- 9 files changed, 70 insertions(+), 11 deletions(-) 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(); + }); } }); }