From a9e50597b4de6226c2b611c764adcdd59286f76b Mon Sep 17 00:00:00 2001 From: Arif Date: Fri, 19 Jul 2024 15:33:47 +0530 Subject: [PATCH] Issue #PS-1389 feat: UI for displaying center wise attendance report as per Figma within a Block with API integration --- src/components/CohortLearnerList.tsx | 3 +- src/components/LearnersListItem.tsx | 159 ++++++++++++++------------- src/utils/Interfaces.ts | 1 + 3 files changed, 83 insertions(+), 80 deletions(-) diff --git a/src/components/CohortLearnerList.tsx b/src/components/CohortLearnerList.tsx index 047b6b76..93cc682b 100644 --- a/src/components/CohortLearnerList.tsx +++ b/src/components/CohortLearnerList.tsx @@ -6,7 +6,7 @@ import { toPascalCase, } from '@/utils/Helper'; import LearnersListItem from '@/components/LearnersListItem'; -import { Status, limit } from '@/utils/app.constant'; +import { Role, Status, limit } from '@/utils/app.constant'; import { showToastMessage } from './Toastify'; import { useTranslation } from 'next-i18next'; import { Box, Typography } from '@mui/material'; @@ -85,6 +85,7 @@ const CohortLearnerList: React.FC = ({ {userData?.map((data: any) => { return ( = ({ + type, userId, learnerName, isDropout, @@ -496,85 +497,85 @@ const LearnersListItem: React.FC = ({ - ), - name: 'reassign-block-request', - }, - { - label: t('COMMON.REASSIGN_CENTERS'), - icon: ( - - ), - name: 'reassign-centers', - }, - { - label: isDropout - ? t('COMMON.UNMARK_DROP_OUT') - : t('COMMON.MARK_DROP_OUT'), - icon: ( - - ), - name: isDropout ? 'unmark-drop-out' : 'mark-drop-out', - }, - { - label: t('COMMON.DELETE_USER'), - icon: ( - - ), - name: 'delete-User', - }, - ] - : [ - { - label: t('COMMON.REASSIGN_CENTERS'), - icon: ( - - ), - name: 'reassign-centers', - }, - { - label: isDropout - ? t('COMMON.UNMARK_DROP_OUT') - : t('COMMON.MARK_DROP_OUT'), - icon: ( - - ), - name: isDropout ? 'unmark-drop-out' : 'mark-drop-out', - }, - { - label: t('COMMON.DELETE_USER'), - icon: ( - - ), - name: 'delete-User', - }, - ] - } - renderCustomContent={renderCustomContent} - /> + toggleDrawer={toggleDrawer} + state={state} + listItemClick={listItemClick} + optionList={ + block + ? [ + { + label: t('COMMON.REASSIGN_BLOCKS_REQUEST'), + icon: ( + + ), + name: 'reassign-block-request', + }, + { + label: t('COMMON.REASSIGN_CENTERS'), + icon: ( + + ), + name: 'reassign-centers', + }, + { + label: isDropout + ? t('COMMON.UNMARK_DROP_OUT') + : t('COMMON.MARK_DROP_OUT'), + icon: ( + + ), + name: isDropout ? 'unmark-drop-out' : 'mark-drop-out', + }, + { + label: t('COMMON.DELETE_USER'), + icon: ( + + ), + name: 'delete-User', + }, + ].filter(option => type == Role.STUDENT || option.name !== 'mark-drop-out' && option.name !== 'unmark-drop-out') + : [ + { + label: t('COMMON.REASSIGN_CENTERS'), + icon: ( + + ), + name: 'reassign-centers', + }, + { + label: isDropout + ? t('COMMON.UNMARK_DROP_OUT') + : t('COMMON.MARK_DROP_OUT'), + icon: ( + + ), + name: isDropout ? 'unmark-drop-out' : 'mark-drop-out', + }, + { + label: t('COMMON.DELETE_USER'), + icon: ( + + ), + name: 'delete-User', + }, + ].filter(option => type == Role.STUDENT || option.name !== 'mark-drop-out' && option.name !== 'unmark-drop-out') + } + renderCustomContent={renderCustomContent} + /> {isDropout ? (