Skip to content
Snippets Groups Projects
Commit dcba7779 authored by lass's avatar lass
Browse files

Make role-end null by default

parent 4f127a63
No related branches found
No related tags found
1 merge request!396Greg 334 fix
Pipeline #185447 passed
...@@ -305,9 +305,6 @@ function NewGuestRole({ guest, reloadGuestInfo }: NewGuestRoleProps) { ...@@ -305,9 +305,6 @@ function NewGuestRole({ guest, reloadGuestInfo }: NewGuestRoleProps) {
control={control} control={control}
rules={{ rules={{
required: true, required: true,
validate: () =>
Number(getValues('start_date')) <=
Number(getValues('end_date')),
}} }}
render={({ field }) => ( render={({ field }) => (
<DatePicker <DatePicker
......
...@@ -3,7 +3,7 @@ export type RegisterFormData = { ...@@ -3,7 +3,7 @@ export type RegisterFormData = {
last_name?: string last_name?: string
role_type?: number role_type?: number
role_start: Date role_start: Date
role_end: Date role_end: Date | null
contact_person_unit?: string contact_person_unit?: string
comment?: string comment?: string
ou_id?: number ou_id?: number
......
...@@ -337,7 +337,7 @@ const StepPersonForm = forwardRef( ...@@ -337,7 +337,7 @@ const StepPersonForm = forwardRef(
/> />
)} )}
/> />
{!!errors.role_end && errors.role_end.type === 'required' && ( {!!errors.role_end && (
<Box sx={{ typography: 'caption', color: 'red' }}> <Box sx={{ typography: 'caption', color: 'red' }}>
{t('validation.roleEndRequired')} {t('validation.roleEndRequired')}
</Box> </Box>
......
...@@ -38,9 +38,9 @@ export default function StepRegistration() { ...@@ -38,9 +38,9 @@ export default function StepRegistration() {
first_name: undefined, first_name: undefined,
last_name: undefined, last_name: undefined,
role_type: undefined, role_type: undefined,
// Having role_start and role_end to be nullable caused problems when specifying a default value, so instead having them as non-null and use today as the default date here // Having role_start to be nullable caused problems when specifying a default value, so instead having them as non-null and use today as the default date here
role_start: new Date(), role_start: new Date(),
role_end: new Date(), role_end: null,
comment: undefined, comment: undefined,
ou_id: undefined, ou_id: undefined,
email: undefined, email: undefined,
......
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