import { Component, computed, input, output } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { FormFieldComponent } from '@shared/ui/molecules/form-field/form-field.component'; import { TextInputComponent } from '@shared/ui/atoms/text-input/text-input.component'; import { RadioGroupComponent, JA_NEE } from '@shared/ui/atoms/radio-group/radio-group.component'; import { Answers, Errors, lageUren } from '@herregistratie/domain/intake.machine'; /** Step: the intake wizard's second screen (work experience in the Netherlands, with the inline scholing follow-up). Pure & presentational — values in via `answers`/`errors`/`scholingThreshold`, every keystroke out via `answerChange`. No store, no services, no internal state; the parent owns the Model and decides what a change means. */ @Component({ selector: 'app-intake-werk-step', imports: [FormsModule, FormFieldComponent, TextInputComponent, RadioGroupComponent], template: `
@if (scholingZichtbaar()) {
} @if (answers().scholingGevolgd === 'ja') {
} `, }) export class WerkStep { answers = input.required(); errors = input.required(); scholingThreshold = input.required(); answerChange = output<{ key: keyof Answers; value: string }>(); readonly jaNee = JA_NEE; protected err = (k: keyof Answers) => this.errors()[k] ?? ''; protected scholingZichtbaar = computed(() => lageUren(this.answers(), this.scholingThreshold())); }