-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more filters to React Admin #538
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/components/Admin/custom/list-filtering/CompetitionSeminarFilterSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {FC} from 'react' | ||
import {AutocompleteInput, FilterListSection, FilterLiveForm, ReferenceInput} from 'react-admin' | ||
|
||
export const CompetitionSeminarFilterSection: FC = () => { | ||
return ( | ||
<FilterListSection label="Seminar" icon={null}> | ||
<FilterLiveForm> | ||
<ReferenceInput source="competition" reference="competition/competition" filter={{competition_type: 0}}> | ||
<AutocompleteInput helperText={false} /> | ||
</ReferenceInput> | ||
</FilterLiveForm> | ||
</FilterListSection> | ||
) | ||
} |
14 changes: 14 additions & 0 deletions
14
src/components/Admin/custom/list-filtering/EventFilterSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {FC} from 'react' | ||
import {AutocompleteInput, FilterListSection, FilterLiveForm, ReferenceInput} from 'react-admin' | ||
|
||
export const EventFilterSection: FC = () => { | ||
return ( | ||
<FilterListSection label="Event" icon={null}> | ||
<FilterLiveForm> | ||
<ReferenceInput source="event" reference="competition/event"> | ||
<AutocompleteInput helperText={false} /> | ||
</ReferenceInput> | ||
</FilterLiveForm> | ||
</FilterListSection> | ||
) | ||
} |
14 changes: 14 additions & 0 deletions
14
src/components/Admin/custom/list-filtering/GradeFilterSection.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {FC} from 'react' | ||
import {AutocompleteInput, FilterListSection, FilterLiveForm, ReferenceInput} from 'react-admin' | ||
|
||
export const GradeFilterSection: FC = () => { | ||
return ( | ||
<FilterListSection label="Grade" icon={null}> | ||
<FilterLiveForm> | ||
<ReferenceInput source="grade" reference="competition/grade"> | ||
<AutocompleteInput helperText={false} /> | ||
</ReferenceInput> | ||
</FilterLiveForm> | ||
</FilterListSection> | ||
) | ||
} |
14 changes: 14 additions & 0 deletions
14
src/components/Admin/custom/list-filtering/SeasonCodeFilterList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import {FC} from 'react' | ||
import {FilterList, FilterListItem} from 'react-admin' | ||
|
||
import {seasonCodeStrings} from '../../seasonCodeStrings' | ||
|
||
export const SeasonCodeFilterList: FC = () => { | ||
return ( | ||
<FilterList label="season_code" icon={null}> | ||
{seasonCodeStrings.map((season) => ( | ||
<FilterListItem key={season.id} label={season.name} value={{season_code: season.id}} /> | ||
))} | ||
</FilterList> | ||
) | ||
} |
25 changes: 21 additions & 4 deletions
25
src/components/Admin/resources/competition/event-registration/EventRegistrationList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,38 @@ | ||
import {FC} from 'react' | ||
import {Datagrid, FunctionField, List, ReferenceField, TextField} from 'react-admin' | ||
|
||
import {EventFilterSection} from '@/components/Admin/custom/list-filtering/EventFilterSection' | ||
import {FilterSidebar} from '@/components/Admin/custom/list-filtering/FilterSidebar' | ||
import {GradeFilterSection} from '@/components/Admin/custom/list-filtering/GradeFilterSection' | ||
import {EventRegistration} from '@/types/api/competition' | ||
|
||
export const EventRegistrationList: FC = () => ( | ||
<List> | ||
<List aside={<EventRegistrationListFilters />}> | ||
<Datagrid> | ||
<FunctionField | ||
source="profile.last_name" | ||
label="content.labels.name" | ||
render={(record: EventRegistration) => `${record.profile.first_name} ${record.profile.last_name}`} | ||
sortable={false} | ||
/> | ||
<TextField source="school.abbreviation" /> | ||
<TextField source="grade.tag" /> | ||
<ReferenceField source="event" reference="competition/event" link={false} /> | ||
<TextField source="school.abbreviation" sortable={false} /> | ||
<TextField source="grade.tag" sortable={false} /> | ||
{/* TODO: malo by to byt raditelne podla sortBy="event__start", | ||
ale akosi sa mi to nezda ze by fungovalo a navyse to zo zobrazenia nie je intuitivne */} | ||
<ReferenceField source="event" reference="competition/event" link={false} sortable={false} /> | ||
</Datagrid> | ||
</List> | ||
) | ||
|
||
// TODO: filtre a ordering podla https://github.com/ZdruzenieSTROM/webstrom-backend/pull/460/files#diff-148e08b739e60a78edfc1e546340f501840b75f1646afa58ee524ff82cfc061eR905-R908 | ||
const EventRegistrationListFilters: FC = () => ( | ||
<FilterSidebar> | ||
<EventFilterSection /> | ||
|
||
<GradeFilterSection /> | ||
|
||
{/* TODO: | ||
- school | ||
- profile */} | ||
</FilterSidebar> | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
akoze mozno nejaky text inputovy filter by siel, len by to kus evokovalo search, pricom by to riesilo len full match 🤷♂️ asi netreba. a search na year aspon tam na BE je
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
peta tiez napadlo ten school_year moze byt search input, ale s plnou zhodou to za mna vyzera neintuitivne, za mna to nechajme pouzivat ludi a nech si povedia co by chceli