From 9e4cdb237e3f0e7e6ec7e8b08e9b227a42328467 Mon Sep 17 00:00:00 2001 From: Akshata Katwal Date: Wed, 4 Dec 2024 12:24:32 +0530 Subject: [PATCH] Issue feat:In schedule new modal addtext 'plz select session.'..until next button disable --- public/locales/en/common.json | 4 +++- src/components/CenterSessionModal.tsx | 8 +++++--- src/pages/centers/[cohortId]/index.tsx | 11 +++++++++++ src/utils/Interfaces.ts | 1 + 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 4f7cf071..9876f9fe 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -442,7 +442,8 @@ "END_TIME_ERROR": "End time cannot be earlier than start time.", "START_DATE_ERROR": "Start date cannot be later than end date.", "END_DATE_ERROR": "End date cannot be earlier than start date.", - "IDENTIFIER_NOT_FOUND": "Identifier not found! Cannot Open Content!" + "IDENTIFIER_NOT_FOUND": "Identifier not found! Cannot Open Content!", + "SELECT_SESSION":"Please click on any session to schedule a session" }, "MANAGE_USERS": { "CENTERS_REQUESTED_SUCCESSFULLY": "Center requested successfully", @@ -558,6 +559,7 @@ "EXPAND_ALL": "Expand All", "RESOURCES": "Resources", "MARK_AS_COMPLETED": "Mark As Complete" + }, "ASSESSMENTS": { "ASSESSMENTS": "Assessments", diff --git a/src/components/CenterSessionModal.tsx b/src/components/CenterSessionModal.tsx index 9f31a9e8..acbb9200 100644 --- a/src/components/CenterSessionModal.tsx +++ b/src/components/CenterSessionModal.tsx @@ -21,6 +21,7 @@ const CenterSessionModal: React.FC = ({ secondary, handlePrimaryModel, handleEditModal, + disable=false }) => { const theme = useTheme(); const { t } = useTranslation(); @@ -166,9 +167,9 @@ const CenterSessionModal: React.FC = ({ color="primary" className="one-line-text" sx={{ - '&.Mui-disabled': { - backgroundColor: theme?.palette?.primary?.main, - }, + // '&.Mui-disabled': { + // backgroundColor: theme?.palette?.primary?.main, + // }, minWidth: '84px', padding: theme.spacing(1), fontWeight: '500', @@ -179,6 +180,7 @@ const CenterSessionModal: React.FC = ({ }, }} onClick={handlePrimaryModel || handleEditModal} + disabled={disable} > {primary} diff --git a/src/pages/centers/[cohortId]/index.tsx b/src/pages/centers/[cohortId]/index.tsx index 67cb07e6..b51fb7a6 100644 --- a/src/pages/centers/[cohortId]/index.tsx +++ b/src/pages/centers/[cohortId]/index.tsx @@ -159,6 +159,8 @@ const CohortPage = () => { React.useState(false); const [openAddLearnerModal, setOpenAddLearnerModal] = React.useState(false); const [openSchedule, setOpenSchedule] = React.useState(false); + const [disableNextButton, setDisableNextButton] = React.useState(true); + const [eventDeleted, setEventDeleted] = React.useState(false); const [eventUpdated, setEventUpdated] = React.useState(false); const [deleteModal, setDeleteModal] = React.useState(false); @@ -177,6 +179,7 @@ const CohortPage = () => { const [initialSlideIndex, setInitialSlideIndex] = useState(); const handleClick = (selection: string) => { + setDisableNextButton(false); setClickedBox(selection); }; @@ -185,6 +188,7 @@ const CohortPage = () => { }; const handleCentermodel = () => { + setOpenSchedule(true); }; @@ -733,6 +737,7 @@ const CohortPage = () => { : handleCentermodel } handleEditModal={handleEditEvent} + disable={onEditEvent?false: disableNextButton} > {deleteModal ? DeleteSession && @@ -753,10 +758,16 @@ const CohortPage = () => { /> ) : Schedule && ( + <> + {!clickedBox &&( + {t('CENTER_SESSION.SELECT_SESSION')} + )} + + )} diff --git a/src/utils/Interfaces.ts b/src/utils/Interfaces.ts index 92e08a48..3b298506 100644 --- a/src/utils/Interfaces.ts +++ b/src/utils/Interfaces.ts @@ -157,6 +157,7 @@ export interface SessionsModalProps { handlePrimaryModel?: () => void; secondary?: string; handleEditModal?: () => void; + disable?:boolean } export interface PlannedModalProps {