Fix for account id parameter in account tabs (#1711)

Co-authored-by: Jose Alberto Hernandez <alberto@MacBook-Pro.local>
This commit is contained in:
José Alberto Hernández
2023-03-17 22:18:43 -06:00
committed by GitHub
co-authored by Jose Alberto Hernandez
parent 7b9e036f01
commit 0f450262b9
11 changed files with 42 additions and 12 deletions
@@ -56,7 +56,9 @@ export class SavingAccountActionsComponent {
*/
constructor(private route: ActivatedRoute) {
this.route.data.subscribe((data: { savingsAccountActionData: any }) => {
this.currencyCode = data.savingsAccountActionData.currency.code;
if (data.savingsAccountActionData) {
this.currencyCode = data.savingsAccountActionData.currency.code;
}
});
const name = this.route.snapshot.params['name'];
this.actions[name] = true;
@@ -19,7 +19,7 @@ export class NotesTabComponent implements OnInit {
private authenticationService: AuthenticationService) {
const savedCredentials = this.authenticationService.getCredentials();
this.username = savedCredentials.username;
this.entityId = this.route.snapshot.params['savingAccountId'];
this.entityId = this.route.parent.snapshot.params['savingAccountId'];
this.route.data.subscribe((data: { savingAccountNotes: any }) => {
this.entityNotes = data.savingAccountNotes;
});
@@ -30,7 +30,7 @@ export class SavingsDocumentsTabComponent implements OnInit {
this.route.data.subscribe((data: { savingsDocuments: any }) => {
this.setSavingsDocumentsData(data.savingsDocuments);
});
this.entityId = this.route.snapshot.params['savingAccountId'];
this.entityId = this.route.parent.snapshot.paramMap.get('savingAccountId');
}
ngOnInit() {
@@ -53,8 +53,8 @@ export class SavingsDocumentsTabComponent implements OnInit {
this.entityDocuments = data;
}
downloadDocument(parentEntityId: string, documentId: string) {
this.savingsService.downloadSavingsDocument(parentEntityId, documentId).subscribe(res => {
downloadDocument(documentId: string) {
this.savingsService.downloadSavingsDocument(this.entityId, documentId).subscribe(res => {
const url = window.URL.createObjectURL(res);
window.open(url);
});
@@ -42,7 +42,7 @@ export class TransactionsTabComponent implements OnInit {
ngOnInit() {
this.dataSource = new MatTableDataSource(this.transactionsData);
this.accountWithTransactions = (this.transactionsData.length > 0);
this.accountWithTransactions = (this.transactionsData && this.transactionsData.length > 0);
this.dataSource.paginator = this.paginator;
this.dataSource.sort = this.sort;
}