Skip to content

Commit

Permalink
create even registration in RA
Browse files Browse the repository at this point in the history
  • Loading branch information
vikibrezinova committed May 19, 2024
1 parent 2dd2a32 commit 88b0604
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/components/Admin/Admin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ import {EventCreate} from './resources/competition/event/EventCreate'
import {EventEdit} from './resources/competition/event/EventEdit'
import {EventList} from './resources/competition/event/EventList'
import {EventShow} from './resources/competition/event/EventShow'
import {EventRegistrationCreate} from './resources/competition/event-registration/EventRegistrationCreate'
import {EventRegistrationEdit} from './resources/competition/event-registration/EventRegistrationEdit'
import {EventRegistrationList} from './resources/competition/event-registration/EventRegistrationList'
import {EventRegistrationShow} from './resources/competition/event-registration/EventRegistrationShow'
import {ProblemCreate} from './resources/competition/problems/ProblemCreate'
import {ProblemEdit} from './resources/competition/problems/ProblemEdit'
import {ProblemList} from './resources/competition/problems/ProblemList'
Expand Down Expand Up @@ -97,7 +101,16 @@ export const Admin: FC = () => {
show={SolutionShow}
create={SolutionCreate}
/>
<Resource name="competition/event-registration" recordRepresentation="verbose_name" />
<Resource
name="competition/event-registration"
recordRepresentation="verbose_name"
list={EventRegistrationList}
edit={EventRegistrationEdit}
show={EventRegistrationShow}
create={EventRegistrationCreate}
/>
<Resource name="personal/schools" recordRepresentation="verbose_name" />
<Resource name="personal/profiles" recordRepresentation="verbose_name" />
</ReactAdmin>
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {FC} from 'react'
import {AutocompleteInput, ReferenceInput, required, SimpleForm} from 'react-admin'

import {MyCreate} from '@/components/Admin/custom/MyCreate'

export const EventRegistrationCreate: FC = () => (
<MyCreate>
<SimpleForm>
<ReferenceInput source="school" reference="personal/schools">
<AutocompleteInput optionText="verbose_name" optionValue="code" fullWidth validate={required()} />
</ReferenceInput>
<ReferenceInput source="profile" reference="personal/profiles">
<AutocompleteInput optionText="verbose_name" fullWidth validate={required()} />
</ReferenceInput>
</SimpleForm>
</MyCreate>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import {FC} from 'react'
import {AutocompleteInput, ReferenceInput, required, SimpleForm} from 'react-admin'

import {MyEdit} from '@/components/Admin/custom/MyEdit'

export const EventRegistrationEdit: FC = () => (
<MyEdit>
<SimpleForm>
<ReferenceInput source="school" reference="personal/schools">
<AutocompleteInput optionText="verbose_name" optionValue="code" fullWidth validate={required()} />
</ReferenceInput>
<ReferenceInput source="profile" reference="personal/profiles">
<AutocompleteInput optionText="verbose_name" fullWidth validate={required()} />
</ReferenceInput>
</SimpleForm>
</MyEdit>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {FC} from 'react'
import {Datagrid, List, ReferenceField} from 'react-admin'

export const EventRegistrationList: FC = () => (
<List>
<Datagrid rowClick="show">
<ReferenceField source="school" reference="personal/schools" link={false} />
<ReferenceField source="profile" reference="personal/profiles" link={false} />
</Datagrid>
</List>
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import {FC} from 'react'
import {ReferenceField, SimpleShowLayout} from 'react-admin'

import {MyShow} from '@/components/Admin/custom/MyShow'

export const EventRegistrationShow: FC = () => (
<MyShow>
<SimpleShowLayout>
<ReferenceField source="school" reference="personal/schools" link="show" />
<ReferenceField source="profile" reference="personal/profiles" link="show" />
</SimpleShowLayout>
</MyShow>
)

0 comments on commit 88b0604

Please sign in to comment.