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 <noreply@anthropic.com>
This commit is contained in:
Jaanu423
2026-05-26 11:42:18 +05:30
co-authored by Claude Sonnet 4.6
parent ae414c620e
commit 33b01d667d
9 changed files with 70 additions and 11 deletions
@@ -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) {
@@ -74,6 +74,7 @@
color="primary"
matTooltip="{{ 'tooltips.Edit Standing Instruction' | translate }}"
*mifosxHasPermission="'UPDATE_STANDINGINSTRUCTION'"
(click)="editInstruction(instruction.id)"
>
<i class="fa fa-edit"></i>
</button>
@@ -99,6 +100,7 @@
color="primary"
matTooltip="{{ 'tooltips.View Standing Instruction' | translate }}"
*mifosxHasPermission="'READ_STANDINGINSTRUCTION'"
(click)="viewInstruction(instruction.id)"
>
<i class="fa fa-eye"></i>
</button>
@@ -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();
});
}
});
}
@@ -62,6 +62,7 @@
color="primary"
matTooltip="{{ 'tooltips.Edit Standing Instruction' | translate }}"
*mifosxHasPermission="'UPDATE_STANDINGINSTRUCTION'"
(click)="editInstruction(instruction.id)"
>
<i class="fa fa-edit"></i>
</button>
@@ -87,6 +88,7 @@
color="primary"
matTooltip="{{ 'tooltips.View Standing Instruction' | translate }}"
*mifosxHasPermission="'READ_STANDINGINSTRUCTION'"
(click)="viewInstruction(instruction.id)"
>
<i class="fa fa-eye"></i>
</button>
@@ -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();
});
}
});
}
@@ -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)"
>
<i class="fa fa-edit"></i>
</button>
@@ -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)"
>
<i class="fa fa-eye"></i>
</button>
@@ -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();
});
}
});
}
@@ -63,6 +63,7 @@
color="primary"
matTooltip="{{ 'tooltips.Edit Standing Instruction' | translate }}"
*mifosxHasPermission="'UPDATE_STANDINGINSTRUCTION'"
(click)="editInstruction(instruction.id)"
>
<i class="fa fa-edit"></i>
</button>
@@ -88,6 +89,7 @@
color="primary"
matTooltip="{{ 'tooltips.View Standing Instruction' | translate }}"
*mifosxHasPermission="'READ_STANDINGINSTRUCTION'"
(click)="viewInstruction(instruction.id)"
>
<i class="fa fa-eye"></i>
</button>
@@ -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();
});
}
});
}