import { Component, computed, inject } from '@angular/core'; import { PageShellComponent } from '@shared/layout/page-shell/page-shell.component'; import { AlertComponent } from '@shared/ui/alert/alert.component'; import { ASYNC } from '@shared/ui/async/async.component'; import { map } from '@shared/application/remote-data'; import { BigProfileStore } from '@registratie/application/big-profile.store'; import { isHerregistratieEligible } from '@registratie/domain/registration.policy'; import { HerregistratieWizardComponent } from '@herregistratie/ui/herregistratie-wizard/herregistratie-wizard.component'; /** A whole new page built from existing building blocks. Eligibility is a pure domain rule (registration.policy) read from the shared profile state. */ @Component({ selector: 'app-herregistratie-page', imports: [PageShellComponent, AlertComponent, ...ASYNC, HerregistratieWizardComponent], template: ` @if (eligible) { Uw huidige registratie verloopt binnenkort. Vraag tijdig herregistratie aan.
} @else { Voor uw huidige registratiestatus is herregistratie niet mogelijk. }
`, }) export class HerregistratiePage { private store = inject(BigProfileStore); // Derive a boolean RemoteData from the combined profile via map (pure). protected eligibility = computed(() => map(this.store.profile(), (p) => isHerregistratieEligible(p.registration, new Date())), ); }