Skip to content

Commit

Permalink
fix #520 - EventRegistration - Create - prefilter Events based on pic…
Browse files Browse the repository at this point in the history
…ked grade and the future flag
  • Loading branch information
rtrembecky committed Dec 14, 2024
1 parent bfa065a commit 0445692
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,19 @@ export const EventRegistrationCreate: FC = () => {
<ReferenceInput source="grade" reference="competition/grade">
<AutocompleteInput optionText="name" fullWidth validate={required()} />
</ReferenceInput>
<ReferenceInput source="event" reference="competition/event">
<AutocompleteInput optionText="verbose_name" fullWidth validate={required()} />
</ReferenceInput>
<EventReferenceInput />
</SimpleForm>
</MyCreate>
)
}

const EventReferenceInput = () => {
const {watch} = useFormContext()
const grade = watch('grade')

return (
<ReferenceInput source="event" reference="competition/event" filter={{grade, future: true}}>
<AutocompleteInput optionText="verbose_name" fullWidth validate={required()} />
</ReferenceInput>
)
}

0 comments on commit 0445692

Please sign in to comment.