Skip to content
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

Fix/organisation #2057

Merged
merged 2 commits into from
Jan 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/backend/app/organisations/organisation_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ def parse_organisation_input(
slug: Optional[str] = Form(None),
created_by: Optional[int] = Form(None),
community_type: CommunityType = Form(None),
description: Optional[str] = Form(None),
url: Optional[str] = Form(None),
type: OrganisationType = Form(None, alias="type"),
odk_central_url: Optional[str] = Form(None),
odk_central_user: Optional[str] = Form(None),
Expand All @@ -83,6 +85,8 @@ def parse_organisation_input(
name=name,
slug=slug,
created_by=created_by,
description=description,
url=url,
community_type=community_type,
type=type,
odk_central_url=odk_central_url,
Expand All @@ -98,6 +102,7 @@ class OrganisationOut(BaseModel):
name: str
approved: bool
type: OrganisationType
community_type: CommunityType
logo: Optional[str]
description: Optional[str]
slug: Optional[str]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const OrganizationForm = () => {
};

const rejectOrganization = () => {
dispatch(RejectOrganizationService(`${import.meta.env.VITE_API_URL}/organisation/${organizationId}`));
dispatch(RejectOrganizationService(`${import.meta.env.VITE_API_URL}/organisation/unapproved/${organizationId}`));
};

// redirect to manage-organization page after approve/reject success
Expand Down Expand Up @@ -105,7 +105,7 @@ const OrganizationForm = () => {
id="url"
name="url"
label="Community or Organization are you applied for? "
value={organisationFormData?.organization_type}
value={organisationFormData?.community_type}
onChange={() => {}}
fieldType="text"
disabled
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ import { organizationTypeOptionsType } from '@/models/organisation/organisationM
import { useAppSelector } from '@/types/reduxTypes';

const organizationTypeOptions: organizationTypeOptionsType[] = [
{ name: 'osm_community', value: 'osm_community', label: 'OSM Community' },
{ name: 'company', value: 'company', label: 'Company' },
{ name: 'non_profit', value: 'non_profit', label: 'Non-profit' },
{ name: 'university', value: 'university', label: 'University' },
{ name: 'other', value: 'other', label: 'Other' },
{ name: 'osm_community', value: 'OSM_COMMUNITY', label: 'OSM Community' },
{ name: 'company', value: 'COMPANY', label: 'Company' },
{ name: 'non_profit', value: 'NON_PROFIT', label: 'Non-profit' },
{ name: 'university', value: 'UNIVERSITY', label: 'University' },
{ name: 'other', value: 'OTHER', label: 'Other' },
];

const CreateEditOrganizationForm = ({ organizationId }: { organizationId: string }) => {
Expand Down Expand Up @@ -211,12 +211,12 @@ const CreateEditOrganizationForm = ({ organizationId }: { organizationId: string
topic="What type of community or organization are you applying for? "
options={organizationTypeOptions}
direction="column"
value={values.organization_type}
value={values.community_type}
onChangeData={(value) => {
handleCustomChange('organization_type', value);
handleCustomChange('community_type', value);
}}
className="fmtm-text-base fmtm-text-[#7A7676] fmtm-mt-1"
errorMsg={errors.organization_type}
errorMsg={errors.community_type}
required
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface OrganisationValues {
odk_central_user: string;
odk_central_password: string;
osm_profile: string;
organization_type: string;
community_type: string;
fillODKCredentials: boolean;
}
interface ValidationErrors {
Expand All @@ -25,7 +25,7 @@ interface ValidationErrors {
odk_central_user?: string;
odk_central_password?: string;
osm_profile?: string;
organization_type?: string;
community_type?: string;
fillODKCredentials?: boolean;
}

Expand All @@ -46,8 +46,8 @@ function OrganizationDetailsValidation(values: OrganisationValues) {
} else if (!isValidUrl(values.url)) {
errors.url = 'Invalid URL.';
}
if (!values?.organization_type) {
errors.organization_type = 'Organization type is Required.';
if (!values?.community_type) {
errors.community_type = 'Community type is Required.';
}
}

Expand Down
Loading