-
-
- {/* Personal */}
-
-
-
{t('personalInfoHeading')}
-
-
-
-
{tCommon('firstName')}
-
-
-
-
{tCommon('lastName')}
-
-
-
-
-
{t('birthDate')}
-
-
-
-
-
-
{t('educationGrade')}
-
-
-
-
{t('employmentStatus')}
-
-
-
-
{t('maritalStatus')}
-
-
-
-
-
-
-
- {/* Contact Info */}
-
-
-
{t('contactInfoHeading')}
-
-
-
-
-
-
{tCommon('address')}
-
-
-
-
-
-
-
-
-
- {/* Personal */}
-
-
-
{t('personalDetailsHeading')}
-
-
-
- {formState.image ? (
-
- ) : (
- <>
-
- >
- )}
-
-
-
{formState?.firstName}
-
-
- {userData?.appUserProfile?.isSuperAdmin
- ? 'Super Admin'
- : userData?.appUserProfile?.adminFor.length > 0
- ? 'Admin'
- : 'User'}
-
-
-
{formState.email}
-
-
- Joined on {prettyDate(userData?.user?.createdAt)}
-
-
-
-
+
+
+ {topNavButtons.map(renderButton)}
+
- {/* Actions */}
-
-
-
{t('actionsHeading')}
-
-
-
-
-
-
- {`${t('pluginCreationAllowed')} (API not supported yet)`}
-
-
-
-
-
-
-
-
-
-
-
-
-
+ {(() => {
+ switch (activeTab) {
+ case 'overview':
+ return (
+
+
+
+ );
+ case 'organizations':
+ return (
+
+
-
-
-
-
-
-
-
+ );
+ case 'events':
+ return (
+
+ );
+ case 'tags':
+ return (
+
+ );
+ }
+ })()}
);
diff --git a/src/screens/OrgList/OrgListMocks.ts b/src/screens/OrgList/OrgListMocks.ts
index 380313ffd5..7a2d8b9757 100644
--- a/src/screens/OrgList/OrgListMocks.ts
+++ b/src/screens/OrgList/OrgListMocks.ts
@@ -54,6 +54,8 @@ const organizations: InterfaceOrgConnectionInfoType[] = [
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
+ blockedUsers: [],
+ description: '',
},
];
@@ -88,6 +90,8 @@ for (let x = 0; x < 1; x++) {
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
+ blockedUsers: [],
+ description: '',
});
}
diff --git a/src/screens/OrganizationPeople/AddMember.tsx b/src/screens/OrganizationPeople/AddMember.tsx
index 4c1f15106e..ff5811b519 100644
--- a/src/screens/OrganizationPeople/AddMember.tsx
+++ b/src/screens/OrganizationPeople/AddMember.tsx
@@ -26,6 +26,7 @@ import { useTranslation } from 'react-i18next';
import { Link, useParams } from 'react-router-dom';
import { toast } from 'react-toastify';
import { errorHandler } from 'utils/errorHandler';
+import { getItem } from 'utils/useLocalstorage';
import type {
InterfaceQueryOrganizationsListObject,
InterfaceQueryUserListItem,
@@ -67,10 +68,15 @@ function AddMember(): JSX.Element {
keyPrefix: 'addMember',
});
+ const isSuperAdmin = getItem('SuperAdmin', '');
const { t: tCommon } = useTranslation('common');
-
document.title = translateOrgPeople('title');
+ const updateDocumentTitle = () => {
+ const titleKey = isSuperAdmin ? 'title_superadmin' : 'title';
+ document.title = translateOrgPeople(titleKey);
+ };
+ updateDocumentTitle();
const [addUserModalisOpen, setAddUserModalIsOpen] = useState(false);
function openAddUserModal(): void {
diff --git a/src/screens/OrganizationPeople/OrganizationPeople.test.tsx b/src/screens/OrganizationPeople/OrganizationPeople.test.tsx
index a840f1e1f0..d7f715a7e8 100644
--- a/src/screens/OrganizationPeople/OrganizationPeople.test.tsx
+++ b/src/screens/OrganizationPeople/OrganizationPeople.test.tsx
@@ -517,77 +517,7 @@ const MOCKS: TestMock[] = [
},
];
-const EMPTYMOCKS: TestMock[] = [
- {
- request: {
- query: ORGANIZATIONS_LIST,
- variables: {
- id: 'orgid',
- },
- },
- result: {
- data: {
- organizations: [],
- },
- },
- },
-
- {
- //These are mocks for 1st query (member list)
- request: {
- query: ORGANIZATIONS_MEMBER_CONNECTION_LIST,
- variables: {
- orgId: 'orgid',
- firstName_contains: '',
- lastName_contains: '',
- },
- },
- result: {
- data: {
- organizationsMemberConnection: {
- edges: [],
- },
- },
- },
- },
-
- {
- request: {
- query: ORGANIZATIONS_MEMBER_CONNECTION_LIST,
- variables: {
- orgId: 'orgid',
- firstName_contains: '',
- lastName_contains: '',
- },
- },
- result: {
- data: {
- organizationsMemberConnection: {
- edges: [],
- },
- },
- },
- },
-
- {
- //This is mock for user list
- request: {
- query: USER_LIST_FOR_TABLE,
- variables: {
- firstName_contains: '',
- lastName_contains: '',
- },
- },
- result: {
- data: {
- users: [],
- },
- },
- },
-];
-
const link = new StaticMockLink(MOCKS, true);
-const link2 = new StaticMockLink(EMPTYMOCKS, true);
async function wait(ms = 2): Promise
{
await act(() => {
return new Promise((resolve) => {
@@ -605,6 +535,13 @@ jest.mock('react-router-dom', () => ({
// FOR THE FIRST TEST WHICH CAME OUT OF NOWHERE
console.error = jest.fn();
+jest.mock('react-toastify', () => ({
+ toast: {
+ success: jest.fn(),
+ error: jest.fn(),
+ },
+}));
+
describe('Organization People Page', () => {
const searchData = {
fullNameMember: 'Aditya Memberguy',
@@ -1334,12 +1271,9 @@ describe('Organization People Page', () => {
await wait();
const dataGrid = screen.getByRole('grid');
expect(dataGrid).toBeInTheDocument();
- const removeButtons = screen.getAllByTestId('removeMemberModalBtn');
- userEvent.click(removeButtons[0]);
});
- test('Datagrid renders with admin data', async () => {
- window.location.assign('/orgpeople/orgid');
+ test('Datagrid row should direct to user profile', async () => {
render(
@@ -1351,35 +1285,35 @@ describe('Organization People Page', () => {
);
await wait();
- const dropdownToggles = screen.getAllByTestId('role');
- dropdownToggles.forEach((dropdownToggle) => {
- userEvent.click(dropdownToggle);
+ const dataGrid = screen.getByRole('grid');
+ expect(dataGrid).toBeInTheDocument();
+
+ const rows = screen.getAllByRole('row');
+ rows.forEach((row) => {
+ userEvent.click(row);
});
- const adminDropdownItem = screen.getByTestId('admins');
- userEvent.click(adminDropdownItem);
- await wait();
- const removeButtons = screen.getAllByTestId('removeAdminModalBtn');
- userEvent.click(removeButtons[0]);
});
- test('No Mock Data test', async () => {
+ test('Datagrid renders with admin data', async () => {
window.location.assign('/orgpeople/orgid');
-
render(
-
+
-
-
-
-
-
+
+
+
,
);
await wait();
- expect(window.location).toBeAt('/orgpeople/orgid');
- expect(screen.queryByText(/Nothing Found !!/i)).toBeInTheDocument();
+ const dropdownToggles = screen.getAllByTestId('role');
+ dropdownToggles.forEach((dropdownToggle) => {
+ userEvent.click(dropdownToggle);
+ });
+ const adminDropdownItem = screen.getByTestId('admins');
+ userEvent.click(adminDropdownItem);
+ await wait();
});
});
diff --git a/src/screens/OrganizationPeople/OrganizationPeople.tsx b/src/screens/OrganizationPeople/OrganizationPeople.tsx
index 1d230ed058..9b66f87289 100644
--- a/src/screens/OrganizationPeople/OrganizationPeople.tsx
+++ b/src/screens/OrganizationPeople/OrganizationPeople.tsx
@@ -6,14 +6,12 @@ import {
USER_LIST_FOR_TABLE,
} from 'GraphQl/Queries/Queries';
import Loader from 'components/Loader/Loader';
-import OrgAdminListCard from 'components/OrgAdminListCard/OrgAdminListCard';
-import OrgPeopleListCard from 'components/OrgPeopleListCard/OrgPeopleListCard';
import dayjs from 'dayjs';
import React, { useEffect, useState } from 'react';
import { Button, Dropdown, Form } from 'react-bootstrap';
import Row from 'react-bootstrap/Row';
import { useTranslation } from 'react-i18next';
-import { Link, useLocation, useParams } from 'react-router-dom';
+import { useLocation, useParams, useNavigate } from 'react-router-dom';
import { toast } from 'react-toastify';
import AddMember from './AddMember';
import styles from './OrganizationPeople.module.css';
@@ -34,7 +32,7 @@ function organizationPeople(): JSX.Element {
});
const { t: tCommon } = useTranslation('common');
- document.title = t('title');
+ const navigate = useNavigate();
const location = useLocation();
const role = location?.state;
@@ -50,26 +48,6 @@ function organizationPeople(): JSX.Element {
const [adminFilteredData, setAdminFilteredData] = useState();
const [userName, setUserName] = useState('');
- const [showRemoveModal, setShowRemoveModal] = React.useState(false);
- const [selectedAdminId, setSelectedAdminId] = React.useState<
- string | undefined
- >();
- const [selectedMemId, setSelectedMemId] = React.useState<
- string | undefined
- >();
- const toggleRemoveModal = (): void => {
- setShowRemoveModal((prev) => !prev);
- };
- const toggleRemoveMemberModal = (id: string): void => {
- setSelectedMemId(id);
- setSelectedAdminId(undefined);
- toggleRemoveModal();
- };
- const toggleRemoveAdminModal = (id: string): void => {
- setSelectedAdminId(id);
- setSelectedMemId(undefined);
- toggleRemoveModal();
- };
const {
data: memberData,
@@ -210,15 +188,7 @@ function organizationPeople(): JSX.Element {
headerClassName: `${styles.tableHeader}`,
sortable: false,
renderCell: (params: GridCellParams) => {
- return (
-
- {params.row?.firstName + ' ' + params.row?.lastName}
-
- );
+ return {params.row?.firstName + ' ' + params.row?.lastName}
;
},
},
{
@@ -244,33 +214,6 @@ function organizationPeople(): JSX.Element {
return dayjs(params.row.createdAt).format('DD/MM/YYYY');
},
},
- {
- field: 'action',
- headerName: tCommon('action'),
- flex: 1,
- minWidth: 100,
- align: 'center',
- headerAlign: 'center',
- headerClassName: `${styles.tableHeader}`,
- sortable: false,
- renderCell: (params: GridCellParams) => {
- return state === 1 ? (
-
- ) : (
-
- );
- },
- },
];
return (
<>
@@ -409,21 +352,13 @@ function organizationPeople(): JSX.Element {
}
columns={columns}
isRowSelectable={() => false}
+ onRowClick={(row: unknown) => {
+ const id = (row as { id: string }).id;
+ navigate(`/member/${currentUrl}`, { state: { id } });
+ }}
/>
)}
- {showRemoveModal && selectedMemId && (
-
- )}
- {showRemoveModal && selectedAdminId && (
-
- )}
>
);
}
diff --git a/src/screens/Requests/RequestsMocks.ts b/src/screens/Requests/RequestsMocks.ts
index 6dc22dd58e..08ee2352fd 100644
--- a/src/screens/Requests/RequestsMocks.ts
+++ b/src/screens/Requests/RequestsMocks.ts
@@ -40,6 +40,8 @@ export const EMPTY_REQUEST_MOCKS = [
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
+ blockedUsers: [],
+ description: '',
},
],
},
@@ -105,6 +107,8 @@ export const MOCKS = [
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
+ blockedUsers: [],
+ description: '',
},
],
},
@@ -189,6 +193,8 @@ export const MOCKS4 = [
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
+ blockedUsers: [],
+ description: '',
},
],
},
@@ -421,6 +427,8 @@ export const MOCKS2 = [
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
+ blockedUsers: [],
+ description: '',
},
],
},
@@ -496,6 +504,8 @@ export const MOCKS3 = [
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
+ blockedUsers: [],
+ description: '',
},
],
},
diff --git a/src/screens/Users/UsersMocks.ts b/src/screens/Users/UsersMocks.ts
index ff346a1c97..1a7625cf12 100644
--- a/src/screens/Users/UsersMocks.ts
+++ b/src/screens/Users/UsersMocks.ts
@@ -232,6 +232,8 @@ export const MOCKS = [
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
+ blockedUsers: [],
+ description: '',
},
],
},
@@ -467,6 +469,8 @@ export const MOCKS2 = [
sortingCode: 'ABC-123',
state: 'Kingston Parish',
},
+ blockedUsers: [],
+ description: '',
},
],
},
diff --git a/src/utils/interfaces.ts b/src/utils/interfaces.ts
index 495234a5a1..5d668c0038 100644
--- a/src/utils/interfaces.ts
+++ b/src/utils/interfaces.ts
@@ -79,6 +79,13 @@ export interface InterfaceMemberInfo {
}
export interface InterfaceOrgConnectionInfoType {
+ blockedUsers: {
+ _id: string;
+ firstName: string;
+ lastName: string;
+ email: string;
+ }[];
+ description: string;
_id: string;
image: string | null;
creator: {
@@ -505,6 +512,10 @@ export interface InterfaceQueryMembershipRequestsListItem {
}[];
}
+export interface InterfaceMemberOrganization {
+ userId: string;
+}
+
export interface InterfacePledger {
_id: string;
firstName: string;