Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Inject } from '@angular/core';
import { Router } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';

import { LAYOUT_GAP_M } from '../../../../../tokens';
import { CreateDefaultPaymentReferenceService } from '../../services/create-default-payment-reference.service';
Expand All @@ -14,11 +14,14 @@ export class CreateDefaultPaymentReferenceComponent {

constructor(
private createDefaultPaymentReferenceService: CreateDefaultPaymentReferenceService,
private route: ActivatedRoute,
private router: Router,
@Inject(LAYOUT_GAP_M) public layoutGapM: string
) {
this.createDefaultPaymentReferenceService.created$.subscribe(() => {
this.router.navigate(['/templates/default-references']);
void this.router.navigateByUrl(
this.route.snapshot.queryParamMap.get('returnUrl') || '/templates/default-references'
);
});
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Component, Inject } from '@angular/core';
import { Router } from '@angular/router';
import { ActivatedRoute, Router } from '@angular/router';

import { OperationType } from '../../../../../shared/constants/operation-type';
import { CsvUtilsService } from '../../../../../shared/services/utils/csv-utils.service';
Expand All @@ -17,11 +17,14 @@ export class CreatePaymentReferenceComponent {

constructor(
private createPaymentReferenceService: CreatePaymentReferenceService,
private route: ActivatedRoute,
private router: Router,
@Inject(LAYOUT_GAP_M) public layoutGapM: string
) {
this.createPaymentReferenceService.created$.subscribe(() => {
this.router.navigate(['/templates/references']);
void this.router.navigateByUrl(
this.route.snapshot.queryParamMap.get('returnUrl') || '/templates/references'
);
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ export class EditTemplateComponent {
) {}

back() {
this.router.navigate([`../templates`]);
const returnUrl = this.route.snapshot.queryParamMap.get('returnUrl');
if (returnUrl) {
void this.router.navigateByUrl(returnUrl);
} else {
void this.router.navigate([`../templates`]);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ export class DefaultPaymentReferencesComponent {
@Inject(LAYOUT_GAP_M) public layoutGapM: string
) {
this.removeDefaultReferenceService.removed$.subscribe(() => {
this.fetchDefaultReferencesService.search({ isGlobal: false, isDefault: false });
this.fetchDefaultReferencesService.refresh();
});
}

createReference() {
this.router.navigate(['/default-references/new/payment']);
void this.router.navigate(['/default-references/new/payment'], {
queryParams: { returnUrl: this.router.url },
});
}

search(searchValue: string) {
Expand All @@ -49,7 +51,10 @@ export class DefaultPaymentReferencesComponent {
}

goToTemplate(id: string) {
this.router.navigate([`/template/${id}`], { fragment: OperationType.Payment });
void this.router.navigate([`/template/${id}`], {
fragment: OperationType.Payment,
queryParams: { returnUrl: this.router.url },
});
}

removeReference(reference: PaymentReference) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ export class PaymentReferencesComponent {
@Inject(LAYOUT_GAP_M) public layoutGapM: string
) {
this.removeReferenceService.removed$.subscribe(() => {
this.fetchReferencesService.search({ isGlobal: false, isDefault: false });
this.fetchReferencesService.refresh();
});
}

createReference() {
this.router.navigate(['/reference/new/payment']);
void this.router.navigate(['/reference/new/payment'], {
queryParams: { returnUrl: this.router.url },
});
}

search(searchValue: string) {
Expand All @@ -49,7 +51,9 @@ export class PaymentReferencesComponent {
}

goToTemplate(id: string) {
this.router.navigate([`/template/${id}`]);
void this.router.navigate([`/template/${id}`], {
queryParams: { returnUrl: this.router.url },
});
}

removeReference(reference: PaymentReference) {
Expand Down
Loading