Skip to content
Snippets Groups Projects
Commit 76474e36 authored by Tore.Brede's avatar Tore.Brede
Browse files

GREG-60: Showing proper names in summary table

parent 611fdcd5
No related branches found
No related tags found
1 merge request!94GREG-60: Making the registration and summary page look more like the design
Pipeline #96056 failed
...@@ -7,4 +7,4 @@ export type RegisterFormData = { ...@@ -7,4 +7,4 @@ export type RegisterFormData = {
comment?: string comment?: string
ou_id?: number ou_id?: number
email?: string email?: string
} }
\ No newline at end of file
...@@ -19,6 +19,7 @@ import { PersonFormMethods } from './personFormMethods' ...@@ -19,6 +19,7 @@ import { PersonFormMethods } from './personFormMethods'
import useOus from '../../hooks/useOus' import useOus from '../../hooks/useOus'
import useRoleTypes from '../../hooks/useRoleTypes' import useRoleTypes from '../../hooks/useRoleTypes'
import SubmitState from './submitState' import SubmitState from './submitState'
import i18n from 'i18next'
interface StepSummaryProperties { interface StepSummaryProperties {
...@@ -78,6 +79,13 @@ const StepSummary = forwardRef((props: StepSummaryProperties, ref: Ref<PersonFor ...@@ -78,6 +79,13 @@ const StepSummary = forwardRef((props: StepSummaryProperties, ref: Ref<PersonFor
useImperativeHandle(ref, () => ({ doSubmit })) useImperativeHandle(ref, () => ({ doSubmit }))
const selectedOus = ous.find((value) => value.id === formData.ou_id)
const ousName = selectedOus === undefined ? '' : (`${i18n.language === 'en' ? selectedOus.en : selectedOus.nb} (${selectedOus.id})`)
// TODO Fix this confusing mix between use of id and identifier
const selectedRoleType = roleTypes.find((value) => value.id === (formData.role_type === undefined ? -1 : parseInt(formData.role_type, 10)))
const roleTypeName = selectedRoleType === undefined ? '' : `${i18n.language === 'en' ? selectedRoleType.name_en : selectedRoleType.name_nb}`
return ( return (
<> <>
<Typography variant='h5' sx={{ <Typography variant='h5' sx={{
...@@ -88,7 +96,6 @@ const StepSummary = forwardRef((props: StepSummaryProperties, ref: Ref<PersonFor ...@@ -88,7 +96,6 @@ const StepSummary = forwardRef((props: StepSummaryProperties, ref: Ref<PersonFor
{t('registerWizardText.summaryPage')} {t('registerWizardText.summaryPage')}
</Box> </Box>
<Box sx={{ maxWidth: '30rem' }}> <Box sx={{ maxWidth: '30rem' }}>
<Box sx={{ padding: '1rem', bgcolor: 'primary.dark' }}>{t('registerWizardText.contactInformation')}</Box> <Box sx={{ padding: '1rem', bgcolor: 'primary.dark' }}>{t('registerWizardText.contactInformation')}</Box>
<Grid container> <Grid container>
...@@ -126,9 +133,9 @@ const StepSummary = forwardRef((props: StepSummaryProperties, ref: Ref<PersonFor ...@@ -126,9 +133,9 @@ const StepSummary = forwardRef((props: StepSummaryProperties, ref: Ref<PersonFor
</TableHead> </TableHead>
<TableBody> <TableBody>
<TableRow> <TableRow>
<TableCell>{formData.role_type}</TableCell> <TableCell>{roleTypeName}</TableCell>
<TableCell>{formData.role_start === null ? null : format(formData.role_start as Date, 'yyyy-MM-dd')}-{formData.role_end === null ? null : format(formData.role_end as Date, 'yyyy-MM-dd')}</TableCell> <TableCell>{formData.role_start === null ? null : format(formData.role_start as Date, 'yyyy-MM-dd')}-{formData.role_end === null ? null : format(formData.role_end as Date, 'yyyy-MM-dd')}</TableCell>
<TableCell>{formData.ou_id}</TableCell> <TableCell>{ousName}</TableCell>
<TableCell>{formData.comment}</TableCell> <TableCell>{formData.comment}</TableCell>
</TableRow> </TableRow>
</TableBody> </TableBody>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment