Skip to content

Comments

feat(ks,employer): single form wizard form flow#3874

Open
nikomakela wants to merge 6 commits intomainfrom
YJDH-801-employer-1-form-view
Open

feat(ks,employer): single form wizard form flow#3874
nikomakela wants to merge 6 commits intomainfrom
YJDH-801-employer-1-form-view

Conversation

@nikomakela
Copy link
Contributor

@nikomakela nikomakela commented Feb 6, 2026

YJDH-801.

Remove accordion forms from wizard form flow. Merge organisation and employment steps (step 1 and step 2). Summary page then represents only 1 employment form and organisation details. 3rd step removed -- thank you page offers adding another form (or to logout).

Made the employment form fully visible, but disabled until employee details are requested to be filled. Added disabled and read only props to some shared components.

@nikomakela nikomakela force-pushed the YJDH-801-employer-1-form-view branch from 5e0c39e to b11ee70 Compare February 6, 2026 14:23
@azure-pipelines
Copy link

YJDH-KESASETELI-API branch is deployed to platta: https://yjdh-kesaseteli-pr3874.api.dev.hel.ninja 🚀🚀🚀

@nikomakela nikomakela force-pushed the YJDH-801-employer-1-form-view branch from b11ee70 to 4709b31 Compare February 6, 2026 14:36
@azure-pipelines
Copy link

YJDH-KESASETELI-API branch is deployed to platta: https://yjdh-kesaseteli-pr3874.api.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

EMPLOYER branch is deployed to platta: https://kesaseteli-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

HANDLER branch is deployed to platta: https://kesaseteli-handler-ui-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

YJDH-HELSINKILISA-API branch is deployed to platta: https://helsinkilisa-pr3874.api.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

YOUTH branch is deployed to platta: https://nuortenkesaseteli-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe employer result is failed for https://kesaseteli-pr3874.dev.hel.ninja 😿💢💥💥

@azure-pipelines
Copy link

HANDLER branch is deployed to platta: https://helsinkilisa-ui-handler-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://kesaseteli-handler-ui-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

APPLICANT is deployed to platta: https://helsinkilisa-ui-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://nuortenkesaseteli-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

TestCafe result is success for https://helsinkilisa-ui-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

TestCafe result is success for https://helsinkilisa-ui-handler-pr3874.dev.hel.ninja 😆🎉🎉🎉

@nikomakela nikomakela force-pushed the YJDH-801-employer-1-form-view branch 3 times, most recently from 143ab47 to 2e02828 Compare February 17, 2026 13:30
@azure-pipelines
Copy link

YJDH-KESASETELI-API branch is deployed to platta: https://yjdh-kesaseteli-pr3874.api.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

HANDLER branch is deployed to platta: https://kesaseteli-handler-ui-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

YJDH-HELSINKILISA-API branch is deployed to platta: https://helsinkilisa-pr3874.api.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

EMPLOYER branch is deployed to platta: https://kesaseteli-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://kesaseteli-handler-ui-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

YOUTH branch is deployed to platta: https://nuortenkesaseteli-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

APPLICANT is deployed to platta: https://helsinkilisa-ui-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://nuortenkesaseteli-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

HANDLER branch is deployed to platta: https://helsinkilisa-ui-handler-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe employer result is failed for https://kesaseteli-pr3874.dev.hel.ninja 😿💢💥💥

@azure-pipelines
Copy link

TestCafe result is success for https://helsinkilisa-ui-pr3874.dev.hel.ninja 😆🎉🎉🎉

@nikomakela nikomakela force-pushed the YJDH-801-employer-1-form-view branch from 2e02828 to bbb438f Compare February 17, 2026 14:00
@azure-pipelines
Copy link

EMPLOYER branch is deployed to platta: https://kesaseteli-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

APPLICANT is deployed to platta: https://helsinkilisa-ui-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://nuortenkesaseteli-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

TestCafe result is success for https://kesaseteli-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

HANDLER branch is deployed to platta: https://helsinkilisa-ui-handler-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://helsinkilisa-ui-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

TestCafe result is success for https://helsinkilisa-ui-handler-pr3874.dev.hel.ninja 😆🎉🎉🎉

Copy link
Collaborator

@karisal-anders karisal-anders left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally with NEXT_PUBLIC_MOCK_FLAG on. Mostly functional testing, skimmed through the code. Seems to be working ok for the most part. Can be fixed more in another PRs.

Having the EMPLOYER_FIELDS in sessionStorage ("Closing the tab/window ends the session and clears the data in sessionStorage.") using a trivially reversible obfuscation (=base64 encoding) is good enough IMO (Could it be made better? Sure. Is it worth the time and effort? That's the question).

YJDH-801.

IBAN input id must not be a static hard coded input. It should be
consistent with other inputs and the id-property should be settable.
YJDH-801.

Remove accordion forms from wizard form flow. Merge organisation and
employment steps (step 1 and step 2). Summary page then represents only
1 employment form and organisation details. 3rd step removed -- thank
you page offers adding another form (or to logout).

Made the employment form fully visible, but disabled until employee
details are requested to be filled. Added disabled and read only props
to some shared components.
YJDH-801.

Add tools to persist data in session storage:

1. Employer details should be remembered in form wizard when adding new
employment details after another.

2. Fix for fields' values not remembered on page reload or stepping
backwards in form wizard.
@nikomakela nikomakela force-pushed the YJDH-801-employer-1-form-view branch from 337bd48 to b0c8db8 Compare February 24, 2026 15:01
Comment on lines +14 to +20
const vouchers = applicationQuery.data?.summer_vouchers || [];
const currentVoucherIndex = vouchers.length > 0 ? vouchers.length - 1 : 0;

return (
<ApplicationForm title={t('common:application.step1.header')} step={1}>
<EmployerForm />
<EmploymentForm index={currentVoucherIndex} />
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The form attempts to register fields for summer_vouchers[0] on new applications, but this index doesn't exist in the initially empty summer_vouchers array, causing form fields to fail.
Severity: HIGH

Suggested Fix

Either initialize the summer_vouchers array with at least one empty object [{}] for new applications, or refactor the form to use the useFieldArray hook from React Hook Form to dynamically manage employment entries with its append and remove methods.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location:
frontend/kesaseteli/employer/src/components/application/steps/step1/Step1EmployerAndEmployment.tsx#L14-L20

Potential issue: When a user creates a new application, the `summer_vouchers` array is
initially empty. The `EmploymentForm` component then attempts to register form fields
for the first voucher at index 0 (e.g., `summer_vouchers.0.employee_name`). However,
because the component does not use the `useFieldArray` hook and no initial empty voucher
object is added to the array, React Hook Form fails to register fields for this
non-existent index. This results in form fields not binding correctly, `useWatch` hooks
returning `undefined`, and user input not being tracked, rendering the form unusable for
new applications.

Did we get this right? 👍 / 👎 to inform future reviews.

@azure-pipelines
Copy link

YJDH-KESASETELI-API branch is deployed to platta: https://yjdh-kesaseteli-pr3874.api.dev.hel.ninja 🚀🚀🚀

@sonarqubecloud
Copy link

@sonarqubecloud
Copy link

@azure-pipelines
Copy link

YOUTH branch is deployed to platta: https://nuortenkesaseteli-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

HANDLER branch is deployed to platta: https://kesaseteli-handler-ui-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

YJDH-HELSINKILISA-API branch is deployed to platta: https://helsinkilisa-pr3874.api.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://nuortenkesaseteli-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

EMPLOYER branch is deployed to platta: https://kesaseteli-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://kesaseteli-handler-ui-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

APPLICANT is deployed to platta: https://helsinkilisa-ui-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://kesaseteli-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

HANDLER branch is deployed to platta: https://helsinkilisa-ui-handler-pr3874.dev.hel.ninja 🚀🚀🚀

@azure-pipelines
Copy link

TestCafe result is success for https://helsinkilisa-ui-pr3874.dev.hel.ninja 😆🎉🎉🎉

@azure-pipelines
Copy link

TestCafe result is success for https://helsinkilisa-ui-handler-pr3874.dev.hel.ninja 😆🎉🎉🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants