-
-
+
+
- {t('sort')}
+ {sortingState.selectedOption}
- Action 1
- Action 2
- Action 3
-
-
-
-
-
- {t('filter')}
-
-
- Action 1
- Action 2
- Action 3
+ handleSorting('Latest')}
+ data-testid="latest"
+ >
+ {t('Latest')}
+
+ handleSorting('Earliest')}
+ data-testid="oldest"
+ >
+ {t('Earliest')}
+
@@ -465,10 +493,13 @@ function orgList(): JSX.Element {
required
value={formState.name}
onChange={(e): void => {
- setFormState({
- ...formState,
- name: e.target.value,
- });
+ const inputText = e.target.value;
+ if (inputText.length < 50) {
+ setFormState({
+ ...formState,
+ name: e.target.value,
+ });
+ }
}}
/>
{t('description')}
@@ -481,10 +512,13 @@ function orgList(): JSX.Element {
required
value={formState.descrip}
onChange={(e): void => {
- setFormState({
- ...formState,
- descrip: e.target.value,
- });
+ const descriptionText = e.target.value;
+ if (descriptionText.length < 200) {
+ setFormState({
+ ...formState,
+ descrip: e.target.value,
+ });
+ }
}}
/>
{t('location')}
@@ -497,10 +531,13 @@ function orgList(): JSX.Element {
required
value={formState.location}
onChange={(e): void => {
- setFormState({
- ...formState,
- location: e.target.value,
- });
+ const locationText = e.target.value;
+ if (locationText.length < 100) {
+ setFormState({
+ ...formState,
+ location: e.target.value,
+ });
+ }
}}
/>
@@ -611,8 +648,8 @@ function orgList(): JSX.Element {
@@ -624,7 +661,7 @@ function orgList(): JSX.Element {
{t('goToStore')}
@@ -635,7 +672,7 @@ function orgList(): JSX.Element {
className={styles.greenregbtn}
onClick={closeDialogModal}
value="invite"
- data-testid="submitOrganizationForm"
+ data-testid="enableEverythingForm"
>
{t('enableEverything')}
diff --git a/src/screens/OrgList/OrgListMocks.ts b/src/screens/OrgList/OrgListMocks.ts
index 1a1ab30ab7..833535f4aa 100644
--- a/src/screens/OrgList/OrgListMocks.ts
+++ b/src/screens/OrgList/OrgListMocks.ts
@@ -1,3 +1,7 @@
+import {
+ CREATE_ORGANIZATION_MUTATION,
+ CREATE_SAMPLE_ORGANIZATION_MUTATION,
+} from 'GraphQl/Mutations/mutations';
import {
ORGANIZATION_CONNECTION_LIST,
USER_ORGANIZATION_LIST,
@@ -84,6 +88,7 @@ const MOCKS = [
first: 8,
skip: 0,
filter: '',
+ orderBy: 'createdAt_ASC',
},
notifyOnNetworkStatusChange: true,
},
@@ -102,6 +107,39 @@ const MOCKS = [
data: superAdminUser,
},
},
+ {
+ request: {
+ query: CREATE_SAMPLE_ORGANIZATION_MUTATION,
+ },
+ result: {
+ data: {
+ createSampleOrganization: {
+ id: '1',
+ name: 'Sample Organization',
+ },
+ },
+ },
+ },
+ {
+ request: {
+ query: CREATE_ORGANIZATION_MUTATION,
+ variables: {
+ description: 'This is a dummy organization',
+ location: 'Delhi, India',
+ name: 'Dummy Organization',
+ visibleInSearch: true,
+ isPublic: false,
+ image: '',
+ },
+ },
+ result: {
+ data: {
+ createOrganization: {
+ _id: '1',
+ },
+ },
+ },
+ },
];
const MOCKS_EMPTY = [
{
@@ -111,6 +149,7 @@ const MOCKS_EMPTY = [
first: 8,
skip: 0,
filter: '',
+ orderBy: 'createdAt_ASC',
},
notifyOnNetworkStatusChange: true,
},
@@ -130,6 +169,40 @@ const MOCKS_EMPTY = [
},
},
];
+const MOCKS_WITH_ERROR = [
+ {
+ request: {
+ query: ORGANIZATION_CONNECTION_LIST,
+ variables: {
+ first: 8,
+ skip: 0,
+ filter: '',
+ orderBy: 'createdAt_ASC',
+ },
+ notifyOnNetworkStatusChange: true,
+ },
+ result: {
+ data: {
+ organizationsConnection: organizations,
+ },
+ },
+ },
+ {
+ request: {
+ query: USER_ORGANIZATION_LIST,
+ variables: { id: '123' },
+ },
+ result: {
+ data: superAdminUser,
+ },
+ },
+ {
+ request: {
+ query: CREATE_SAMPLE_ORGANIZATION_MUTATION,
+ },
+ error: new Error('Failed to create sample organization'),
+ },
+];
// MOCKS FOR ADMIN
const MOCKS_ADMIN = [
@@ -140,6 +213,7 @@ const MOCKS_ADMIN = [
first: 8,
skip: 0,
filter: '',
+ orderBy: 'createdAt_ASC',
},
notifyOnNetworkStatusChange: true,
},
@@ -160,4 +234,4 @@ const MOCKS_ADMIN = [
},
];
-export { MOCKS, MOCKS_ADMIN, MOCKS_EMPTY };
+export { MOCKS, MOCKS_ADMIN, MOCKS_EMPTY, MOCKS_WITH_ERROR };
diff --git a/src/screens/OrgPost/OrgPost.tsx b/src/screens/OrgPost/OrgPost.tsx
index 3408f3f96c..f1f2e477fa 100644
--- a/src/screens/OrgPost/OrgPost.tsx
+++ b/src/screens/OrgPost/OrgPost.tsx
@@ -253,12 +253,9 @@ function orgPost(): JSX.Element {
title="Sort Post"
data-testid="sort"
>
-
+
- {t('sortPost')}
+ {sortingOption === 'latest' ? t('Latest') : t('Oldest')}
{
const calenderView = 'Calendar View';
expect(screen.queryAllByText(calenderView)).not.toBeNull();
+ expect(screen.getByText('Sun')).toBeInTheDocument();
});
});
diff --git a/src/screens/UserPortal/Events/Events.tsx b/src/screens/UserPortal/Events/Events.tsx
index caf1d72fd2..47332c10b4 100644
--- a/src/screens/UserPortal/Events/Events.tsx
+++ b/src/screens/UserPortal/Events/Events.tsx
@@ -5,7 +5,10 @@ import EventCard from 'components/UserPortal/EventCard/EventCard';
import UserSidebar from 'components/UserPortal/UserSidebar/UserSidebar';
import { Button, Dropdown, Form, InputGroup } from 'react-bootstrap';
import PaginationList from 'components/PaginationList/PaginationList';
-import { ORGANIZATION_EVENTS_CONNECTION } from 'GraphQl/Queries/Queries';
+import {
+ ORGANIZATION_EVENTS_CONNECTION,
+ ORGANIZATIONS_LIST,
+} from 'GraphQl/Queries/Queries';
import { useMutation, useQuery } from '@apollo/client';
import { SearchOutlined } from '@mui/icons-material';
import styles from './Events.module.css';
@@ -18,6 +21,7 @@ import { CREATE_EVENT_MUTATION } from 'GraphQl/Mutations/mutations';
import dayjs from 'dayjs';
import { toast } from 'react-toastify';
import { errorHandler } from 'utils/errorHandler';
+import EventCalendar from 'components/EventCalendar/EventCalendar';
interface InterfaceEventCardProps {
id: string;
@@ -76,8 +80,15 @@ export default function events(): JSX.Element {
},
});
+ const { data: orgData } = useQuery(ORGANIZATIONS_LIST, {
+ variables: { id: organizationId },
+ });
+
const [create] = useMutation(CREATE_EVENT_MUTATION);
+ const userId = localStorage.getItem('id') as string;
+ const userRole = localStorage.getItem('UserType') as string;
+
const createEvent = async (): Promise => {
try {
const { data: createEventData } = await create({
@@ -109,6 +120,7 @@ export default function events(): JSX.Element {
setStartTime('08:00:00');
setEndTime('10:00:00');
}
+ setShowCreateEventModal(false);
} catch (error: any) {
/* istanbul ignore next */
errorHandler(t, error);
@@ -243,83 +255,95 @@ export default function events(): JSX.Element {
-