diff --git a/.env b/.env index 855e635c0..2d9004de1 100644 --- a/.env +++ b/.env @@ -1,4 +1,5 @@ NEXT_PUBLIC_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/user/v1 +NEXT_PUBLIC_EVENT_BASE_URL=http://3.109.46.84:4000/event/v1 NEXT_PUBLIC_TELEMETRY_URL=https://qa.prathamteacherapp.tekdinext.com NEXT_PUBLIC_MEASUREMENT_ID= G-GNMQZ8Z65Z NEXT_PUBLIC_TRACKING_API_URL=https://tracking-pratham.tekdinext.com \ No newline at end of file diff --git a/src/components/AddLeanerModal.tsx b/src/components/AddLeanerModal.tsx index 4124e9cc4..f660d6494 100644 --- a/src/components/AddLeanerModal.tsx +++ b/src/components/AddLeanerModal.tsx @@ -181,13 +181,12 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({ onReload?.(); } } else { - const response = await createUser(apiBody); - showToastMessage(t('LEARNERS.LEARNER_CREATED_SUCCESSFULLY'), 'success'); + await createUser(apiBody); } onClose(); + showToastMessage(t('COMMON.LEARNER_CREATED_SUCCESSFULLY'), 'success'); onLearnerAdded?.(); } catch (error) { - onClose(); showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error'); setReloadProfile(true); } @@ -275,7 +274,9 @@ const AddLearnerModal: React.FC<AddLearnerModalProps> = ({ open={open} onClose={onClose} showFooter={false} - modalTitle={isEditModal ? t('COMMON.EDIT_LEARNER') : t('COMMON.NEW_LEARNER')} + modalTitle={ + isEditModal ? t('COMMON.EDIT_LEARNER') : t('COMMON.NEW_LEARNER') + } > {formData ? schema && diff --git a/src/services/EventService.ts b/src/services/EventService.ts new file mode 100644 index 000000000..06d50c83b --- /dev/null +++ b/src/services/EventService.ts @@ -0,0 +1,15 @@ +import { scheduleEventParam } from '@/utils/Interfaces'; +import { post } from './RestClient'; + +export const AssesmentListService = async ({ + filters, +}: scheduleEventParam): Promise<any> => { + const apiUrl: string = `${process.env.NEXT_PUBLIC_EVENT_BASE_URL}/list`; + try { + const response = await post(apiUrl, { filters }); + return response?.data; + } catch (error) { + console.error('error in getting event List Service list', error); + return error; + } +}; diff --git a/src/styles/globals.css b/src/styles/globals.css index 4e04ae0d4..bf911ea45 100644 --- a/src/styles/globals.css +++ b/src/styles/globals.css @@ -983,3 +983,7 @@ input[type='number']::-webkit-outer-spin-button { white-space: nowrap; text-overflow: ellipsis; } + +legend.Mui-focused { + color: inherit !important; +} diff --git a/src/utils/Helper.ts b/src/utils/Helper.ts index 24646f567..3ec5f6f6d 100644 --- a/src/utils/Helper.ts +++ b/src/utils/Helper.ts @@ -289,10 +289,38 @@ export const generateUsernameAndPassword = ( return { username, password }; }; -export const mapFieldIdToValue = (fields: CustomField[]): { [key: string]: string } => { +export const mapFieldIdToValue = ( + fields: CustomField[] +): { [key: string]: string } => { return fields.reduce((acc: { [key: string]: string }, field: CustomField) => { acc[field.fieldId] = field.value; return acc; }, {}); }; +export const convertUTCToIST = (utcDateTime: any) => { + const utcDate = new Date(utcDateTime); + + const utcYear = utcDate.getUTCFullYear(); + const utcMonth = (utcDate.getUTCMonth() + 1).toString().padStart(2, '0'); // Months are zero-based + const utcDateDay = utcDate.getUTCDate().toString().padStart(2, '0'); + + let utcHours = utcDate.getUTCHours(); + const utcMinutes = utcDate.getUTCMinutes().toString().padStart(2, '0'); + const utcSeconds = utcDate.getUTCSeconds().toString().padStart(2, '0'); + + const ampm = utcHours >= 12 ? 'PM' : 'AM'; + utcHours = utcHours % 12; + utcHours = utcHours ? utcHours : 12; + + const dateString = `${utcYear}-${utcMonth}-${utcDateDay}`; + const timeString = `${utcHours.toString().padStart(2, '0')}:${utcMinutes}:${utcSeconds} ${ampm}`; + + return { dateString, timeString }; +}; + +export const convertLocalToUTC = (localDateTime: any) => { + const localDate = new Date(localDateTime); + const utcDateTime = localDate.toISOString(); + return utcDateTime; +}; diff --git a/src/utils/Interfaces.ts b/src/utils/Interfaces.ts index af147bfa4..08d07cd57 100644 --- a/src/utils/Interfaces.ts +++ b/src/utils/Interfaces.ts @@ -422,3 +422,18 @@ export interface CoursePlannerCardsProps { title: string; subtitle: string; } + +export interface scheduleEventParam { + limit: number; + page: number; + filters: eventFilters; +} + +export interface eventFilters { + date?: string; + startDate?: string; + endDate?: string; + eventType?: []; + title?: string; + status?: []; +}