diff --git a/src/app/app-routing.ts b/src/app/app-routing.ts index bfd9cc5d6..5a5a1c04b 100644 --- a/src/app/app-routing.ts +++ b/src/app/app-routing.ts @@ -77,6 +77,7 @@ const LoggedInPersonResolver: ResolveFn = async () => { const mandateResolver: ResolveFn = async (route: ActivatedRouteSnapshot) => { const mandateService = inject(MandateService); const mandateId = route.paramMap.get('mandateId'); + console.log({mandateId}); if (!mandateId) { throw new Error('mandateId param missing in route'); } @@ -287,7 +288,7 @@ if (flags.regularGivingEnabled) { ) routes.unshift({ - path: `${myRegularGivingPath}/:mandateId`, + path: 'my-account/regular-giving/:mandateId', pathMatch: 'full', component: MandateComponent, canActivate: [ diff --git a/src/app/mandate/mandate.component.ts b/src/app/mandate/mandate.component.ts index fa22730c9..b66bc1333 100644 --- a/src/app/mandate/mandate.component.ts +++ b/src/app/mandate/mandate.component.ts @@ -1,9 +1,10 @@ -import { Component } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import {ComponentsModule} from "@biggive/components-angular"; import {DatePipe} from "@angular/common"; import {Mandate} from "../mandate.model"; import {Donation} from "../donation.model"; import {ExactCurrencyPipe} from "../exact-currency.pipe"; +import {ActivatedRoute} from "@angular/router"; @Component({ selector: 'app-mandate', @@ -16,36 +17,46 @@ import {ExactCurrencyPipe} from "../exact-currency.pipe"; templateUrl: './mandate.component.html', styleUrl: './mandate.component.scss' }) -export class MandateComponent { +export class MandateComponent implements OnInit { complete: boolean = true; encodedShareUrl: string = ''; encodedPrefilledText: string = ''; donation: Donation; + mandate: Mandate; + + constructor( + private route: ActivatedRoute + ) {} + + ngOnInit() { + this.mandate = this.route.snapshot.data.mandate; + } // @todo-regular-giving: calculate the total in matchbot and show on template // totalPaid: number = 0; // @todo-regular-giving : replace this with a mandate fetched from matchbot - mandate: Mandate = { - id: 'f7037101-b555-4482-afff-43145fac78bb', - campaignId: 'a056900002TPVz5AAH', - charityName: '0011r00002Hoe8lAAB', - donationAmount: { - amountInPence: 10_00, - currency: "GBP" - }, - matchedAmount: { - amountInPence: 10_00, - currency: "GBP" - }, - giftAid: false, - numberOfMatchedDonations: 3, - status: 'active', - schedule: { - type: "monthly", - dayOfMonth: 1, - activeFrom: '2024-12-06 11:00:17', - expectedNextPaymentDate: '2025-01-01 11:00:17' - } - }; + // mandate: Mandate = { + // id: 'f7037101-b555-4482-afff-43145fac78bb', + // campaignId: 'a056900002TPVz5AAH', + // charityName: '0011r00002Hoe8lAAB', + // donationAmount: { + // amountInPence: 10_00, + // currency: "GBP" + // }, + // matchedAmount: { + // amountInPence: 10_00, + // currency: "GBP" + // }, + // giftAid: false, + // numberOfMatchedDonations: 3, + // status: 'active', + // schedule: { + // type: "monthly", + // dayOfMonth: 1, + // activeFrom: '2024-12-06 11:00:17', + // expectedNextPaymentDate: '2025-01-01 11:00:17' + // } + // }; + }