diff --git a/frontend/public/locales/en/common.json b/frontend/public/locales/en/common.json index f002b0643b3d6a387ecce79fc8d2fb399e364b54..c5e5e7350a3ef79c9fed8a541408f78e033c5799 100644 --- a/frontend/public/locales/en/common.json +++ b/frontend/public/locales/en/common.json @@ -20,7 +20,8 @@ "roleType": "Role", "roleStartDate": "From", "roleEndDate": "To", - "comment": "Comment" + "comment": "Comment", + "email": "E-mail" }, "loading": "Loading...", "termsHeader": "Terms", @@ -48,7 +49,8 @@ "invalidIdNumber": "Invalid national ID number", "nationalIdNumberRequired": "National ID number required", "roleTypeRequired": "Role type is required", - "roleEndRequired": "Role end date is required" + "roleEndRequired": "Role end date is required", + "emailRequired": "E-mail is required" }, "button": { "back": "Back", diff --git a/frontend/public/locales/nb/common.json b/frontend/public/locales/nb/common.json index 314af2fff20c2c6cc5a5e1128e88260eb7dde61a..67239ab90429c20ff6083251b7058dfd8eba4776 100644 --- a/frontend/public/locales/nb/common.json +++ b/frontend/public/locales/nb/common.json @@ -20,7 +20,8 @@ "roleType": "Gjesterolle", "roleStartDate": "Fra", "roleEndDate": "Til", - "comment": "Kommentar" + "comment": "Kommentar", + "email": "E-post" }, "loading": "Laster...", "termsHeader": "Vilkår", @@ -48,7 +49,8 @@ "invalidIdNumber": "Ugyldig fødselsnummer", "nationalIdNumberRequired": "Fødselsnummer er påkrevd", "roleTypeRequired": "Rolletype er påkrevd", - "roleEndRequired": "Sluttdato for rolle er påkrevd" + "roleEndRequired": "Sluttdato for rolle er påkrevd", + "emailRequired": "E-post er obligatorisk" }, "button": { "back": "Tilbake", diff --git a/frontend/public/locales/nn/common.json b/frontend/public/locales/nn/common.json index f3263eefaff0c7d4a55ecbd4e2a7855772a9bbce..0c80b604abffb7bb7a7861173ebeb058600f16b4 100644 --- a/frontend/public/locales/nn/common.json +++ b/frontend/public/locales/nn/common.json @@ -21,7 +21,8 @@ "roleType": "Gjesterolle", "roleStartDate": "Frå", "roleEndDate": "Til", - "comment": "Kommentar" + "comment": "Kommentar", + "email": "E-post" }, "loading": "Lastar...", "termsHeader": "Vilkår", @@ -49,7 +50,8 @@ "invalidIdNumber": "Ugyldig fødselsnummer", "nationalIdNumberRequired": "Fødselsnummer er påkrevd", "roleTypeRequired": "Rolletype er påkrevd", - "roleEndRequired": "Sluttdato for rolle er påkrevd" + "roleEndRequired": "Sluttdato for rolle er påkrevd", + "emailRequired": "E-post er obligatorisk" }, "button": { "back": "Tilbake", diff --git a/frontend/src/routes/frontpage/index.tsx b/frontend/src/routes/frontpage/index.tsx index 1ac44895fe1efebde616eaea854ffe3db381c78c..d48137473b76eaebcbd02ee9b2aaaa7432f71fab 100644 --- a/frontend/src/routes/frontpage/index.tsx +++ b/frontend/src/routes/frontpage/index.tsx @@ -19,9 +19,6 @@ export default function FrontPage() { <li> <Link to="/register/">Registration</Link> </li> - <li> - <Link to="/registerwizard/">Registration wizard</Link> - </li> </ul> </p> <Debug /> diff --git a/frontend/src/routes/register/formData.ts b/frontend/src/routes/register/formData.ts index a496d7bf03744771145a7e404ef43a3d575a4095..1653f65411292362a4a7ac5f7d8b3ea365b906a4 100644 --- a/frontend/src/routes/register/formData.ts +++ b/frontend/src/routes/register/formData.ts @@ -8,4 +8,5 @@ export type RegisterFormData = { role_end?: Date comment?: string ou?: { value: string; label: string } + email?: string } \ No newline at end of file diff --git a/frontend/src/routes/register/stepPersonForm.tsx b/frontend/src/routes/register/stepPersonForm.tsx index dec044bf5327a104bbb0c942c28b3a050a9de21d..990af6d0b54c94d1be159ce5e9338dea5083615b 100644 --- a/frontend/src/routes/register/stepPersonForm.tsx +++ b/frontend/src/routes/register/stepPersonForm.tsx @@ -3,7 +3,6 @@ import { Controller, SubmitHandler, useForm } from 'react-hook-form' import { DatePicker } from '@mui/lab' import React, { forwardRef, Ref, useEffect, useImperativeHandle, useContext, useState } from 'react' import { useTranslation } from 'react-i18next' -import { isValidFnr } from '../../utils' import { RegisterFormData } from './formData' import { PersonFormMethods } from './personFormMethods' import { RolesContext } from '../../context' @@ -94,41 +93,15 @@ const StepPersonForm = forwardRef((props: StepPersonFormProperties, ref: Ref<Per required: t('validation.lastNameRequired').toString(), })} /> - - <Controller name='date_of_birth' - control={control} - rules={{ - required: t( - 'validation.dateOfBirthRequired').toString(), - }} - render={({ field }) => ( - <DatePicker - mask='____-__-__' - label={t('input.dateOfBirth')} - value={field.value} - inputFormat='yyyy-MM-dd' - onChange={(value) => { - field.onChange(value) - }} - renderInput={(params) => <TextField {...params} />} - />)} - /> - <TextField - id='nationalIdNumber' - label={t('input.nationalIdNumber')} - error={!!errors.national_id_number} - helperText={ - errors.national_id_number && errors.national_id_number.message - } - {...register('national_id_number', { - required: t( - 'validation.nationalIdNumberRequired', - ).toString(), - validate: isValidFnr, + id='email' + label={t('input.email')} + error={!!errors.email} + helperText={errors.email && errors.email.message} + {...register(`email`, { + required: t('validation.emailRequired').toString(), })} /> - <FormControl fullWidth> <InputLabel id='ou-select-label'>{t('common:ou')}</InputLabel> <Select diff --git a/frontend/src/routes/register/stepSummary.tsx b/frontend/src/routes/register/stepSummary.tsx index 84bb2574bee7b3c439ae29eb3d313e6cfc8d0ae7..662213158aaecb9b7005a083a8df02ba19f4f06d 100644 --- a/frontend/src/routes/register/stepSummary.tsx +++ b/frontend/src/routes/register/stepSummary.tsx @@ -23,13 +23,12 @@ const StepSummary = forwardRef((props: StepSummaryProperties, ref: Ref<PersonFor const payload = { first_name: data.first_name, last_name: data.last_name, - date_of_birth: data.date_of_birth === null ? null : format(data.date_of_birth as Date, 'yyyy-MM-dd'), - national_id_number: data.national_id_number, role_type: data.role_type, role_start: data.role_start === null ? null : format(data.role_start as Date, 'yyyy-MM-dd'), role_end: data.role_end === null ? null : format(data.role_end as Date, 'yyyy-MM-dd'), comment: data.comment, ou: data.ou, + email: data.email } console.log('submitting', JSON.stringify(payload)) fetch('http://localhost:3000/api/ui/v1/register/', postJsonOpts(payload)) @@ -81,27 +80,20 @@ const StepSummary = forwardRef((props: StepSummaryProperties, ref: Ref<PersonFor {...register('last_name')} /> - <Controller name='date_of_birth' - control={control} - render={({ field }) => ( - <DatePicker - mask='____-__-__' - label={t('input.dateOfBirth')} - disabled - value={field.value} - inputFormat='yyyy-MM-dd' - onChange={(value) => { - field.onChange(value) - }} - renderInput={(params) => <TextField {...params} />} - />)} + <TextField + id='email' + label={t('input.email')} + disabled + {...register('email')} /> <TextField - id='nationalIdNumber' - label={t('input.nationalIdNumber')} + id='ou' + value={ + formData.ou ? formData.ou.label : '' + } + label={t('ou')} disabled - {...register('national_id_number')} /> <TextField