Skip to content

Commit

Permalink
#1304 - sorting of category in drop down
Browse files Browse the repository at this point in the history
  • Loading branch information
petmongrels committed Aug 9, 2024
1 parent 67bd920 commit 4a6b91d
Showing 1 changed file with 34 additions and 36 deletions.
70 changes: 34 additions & 36 deletions src/adminApp/Organisation.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,24 +103,8 @@ export const OrganisationEdit = props => {
<DisabledInput source="schemaName" validate={isRequired} />
<DisabledInput source="mediaDirectory" />
<TextInput source="usernameSuffix" validate={isRequired} />
<ReferenceInput
resource="organisationCategory"
source="categoryId"
reference="organisationCategory"
label="Organisation Category"
validate={required("Please select a category")}
>
<CustomSelectInput source="name" />
</ReferenceInput>
<ReferenceInput
resource="organisationStatus"
source="statusId"
reference="organisationStatus"
label="Organisation Status"
validate={required("Please select a status")}
>
<CustomSelectInput source="name" />
</ReferenceInput>
<OrganisationCategoryInput />
<OrganisationStatusInput />
<BooleanField source="analyticsDataSyncActive" />
<ToggleAnalyticsButton />
<br />
Expand All @@ -145,6 +129,36 @@ const CustomToolbar = props => (
</Toolbar>
);

function OrganisationCategoryInput() {
return (
<ReferenceInput
resource="organisationCategory"
source="categoryId"
reference="organisationCategory"
label="Organisation Category"
validate={required("Please select a category")}
sort={{ field: "name", order: "ASC" }}
>
<CustomSelectInput source="name" />
</ReferenceInput>
);
}

function OrganisationStatusInput() {
return (
<ReferenceInput
resource="organisationStatus"
source="statusId"
reference="organisationStatus"
label="Organisation Status"
validate={required("Please select a status")}
sort={{ field: "name", order: "ASC" }}
>
<CustomSelectInput source="name" />
</ReferenceInput>
);
}

export const OrganisationCreate = props => {
return (
<Create title="Create New Organisation" {...props}>
Expand All @@ -154,24 +168,8 @@ export const OrganisationCreate = props => {
<TextInput source="schemaName" validate={isRequired} />
<TextInput source="mediaDirectory" validate={isRequired} />
<TextInput source="usernameSuffix" validate={isRequired} />
<ReferenceInput
resource="organisationCategory"
source="categoryId"
reference="organisationCategory"
label="Organisation Category"
validate={required("Please select a category")}
>
<CustomSelectInput source="name" />
</ReferenceInput>
<ReferenceInput
resource="organisationStatus"
source="statusId"
reference="organisationStatus"
label="Organisation Status"
validate={required("Please select a status")}
>
<CustomSelectInput source="name" />
</ReferenceInput>
<OrganisationCategoryInput />
<OrganisationStatusInput />
<ReferenceInput
resource="account"
source="accountId"
Expand Down

0 comments on commit 4a6b91d

Please sign in to comment.