From 47e543020e5332218670da4ede57f0c943ec3e86 Mon Sep 17 00:00:00 2001 From: upendraTekdi Date: Tue, 27 Aug 2024 15:30:50 +0530 Subject: [PATCH] Task #224820: for modification attendance previous status should be there,Remove My timetable section by config,update option from remove user reason Taken Tc make it Taken TC --- app.config.ts | 4 +- public/locales/en/common.json | 2 +- src/pages/dashboard.tsx | 136 ++++++++++++++++++---------------- 3 files changed, 78 insertions(+), 64 deletions(-) diff --git a/app.config.ts b/app.config.ts index 2d312d42..9459b885 100644 --- a/app.config.ts +++ b/app.config.ts @@ -93,4 +93,6 @@ export const markdDropOut = false; // show lables as per product export const showLablesForOther = true; -export const tourGuideNavigtion = false \ No newline at end of file +export const tourGuideNavigtion = false + +export const showMyTimeTable = false \ No newline at end of file diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 1a6f7114..2c1c5389 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -354,7 +354,7 @@ "ERROR_EMPTY": "Center name cannot be empty", "ERROR_NUMBER": "Center name cannot be number", "LONG_ABSENTEE": "Long Absentee", - "TAKEN_TC": "Taken Tc", + "TAKEN_TC": "Taken TC", "ALLOCATION_CHANGE": "Allocation Change", "INCORRECT_ENTRY": "Incorrect Entry", "DUPLICATION_ENTRY": "Duplicate Entry" diff --git a/src/pages/dashboard.tsx b/src/pages/dashboard.tsx index 340dde26..c867d356 100644 --- a/src/pages/dashboard.tsx +++ b/src/pages/dashboard.tsx @@ -52,6 +52,7 @@ import { lowLearnerAttendanceLimit, showLablesForOther, tourGuideNavigtion, + showMyTimeTable, } from './../../app.config'; import AttendanceComparison from '@/components/AttendanceComparison'; @@ -258,8 +259,9 @@ const Dashboard: React.FC = () => { React.useState(false); const [confirmButtonDisable, setConfirmButtonDisable] = React.useState(true); - const [selectedAttendance, setSelectedAttendance] = - React.useState(''); + const [selectedAttendance, setSelectedAttendance] = React.useState< + string | null + >(''); const [isLocationModalOpen, setLocationModalOpen] = React.useState(false); const [attendanceLocation, setAttendanceLocation] = React.useState(null); @@ -294,7 +296,7 @@ const Dashboard: React.FC = () => { const onCloseEditMOdel = () => { setIsAttendanceModalOpen(false); - setSelectedAttendance(''); + // setSelectedAttendance(''); setConfirmButtonDisable(true); }; const handleRadioChange = (value: string) => { @@ -391,9 +393,10 @@ const Dashboard: React.FC = () => { const dateForAttendance = formatSelectedDate(currentDate); console.log('attendanceLocation?', attendanceLocation); + // if (selectedAttendance) { const data = { userId: userId, - attendance: selectedAttendance, + attendance: selectedAttendance ? selectedAttendance : '', attendanceDate: selectedDate, contextId: classId, scope: 'self', @@ -422,11 +425,12 @@ const Dashboard: React.FC = () => { } finally { setLoading(false); onCloseEditMOdel(); - setSelectedAttendance(''); + // setSelectedAttendance(''); fetchData(selectedDate); setConfirmButtonDisable(true); - setSelectedAttendance(''); + // setSelectedAttendance(''); setReasonOfAbsent(''); + // } } }; const fetchData = async (selectedDate: any) => { @@ -452,7 +456,12 @@ const Dashboard: React.FC = () => { // Update state with attendance data if (response?.data?.attendanceList?.length > 0) { setAttendanceData(response?.data?.attendanceList); + const attendanceData = response?.data?.attendanceList; + if (attendanceData) { + setSelectedAttendance(attendanceData?.[0]?.attendance); + } } else { + setSelectedAttendance(''); setAttendanceData([]); } } else { @@ -762,7 +771,6 @@ const Dashboard: React.FC = () => { }, }; telemetryFactory.interact(telemetryInteract); - }; const getMonthName = (dateString: string) => { @@ -1828,70 +1836,74 @@ const Dashboard: React.FC = () => { )} - - - - {t('DASHBOARD.MY_TIMETABLE')} - + {showMyTimeTable && ( + - {getMonthName(selectedDate)} + {t('DASHBOARD.MY_TIMETABLE')} - - - - - - - - {sessions?.map((item) => ( - - - - - - ))} - {sessions && sessions?.length === 0 && ( - {t('COMMON.NO_SESSIONS_SCHEDULED')} + + {getMonthName(selectedDate)} + + - )} - - + + + + )} + {showMyTimeTable && ( + + + {sessions?.map((item) => ( + + + + + + ))} + {sessions && sessions?.length === 0 && ( + + {t('COMMON.NO_SESSIONS_SCHEDULED')} + + )} + + + )}