Skip to content

Commit

Permalink
#PS-1769 Course Planner bottom drawer desktop view UI
Browse files Browse the repository at this point in the history
  • Loading branch information
shreyas1434shinde committed Aug 29, 2024
2 parents 2e5c9c2 + ab4a0a3 commit 86f81ac
Show file tree
Hide file tree
Showing 35 changed files with 1,432 additions and 1,396 deletions.
9 changes: 5 additions & 4 deletions .env
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
NEXT_PUBLIC_BASE_URL=https://qa.prathamteacherapp.tekdinext.com/user/v1

NEXT_PUBLIC_EVENT_BASE_URL=https://event-pratham.tekdinext.com/event-service/event/v1
NEXT_PUBLIC_NOTIFICATION_BASE_URL=https://notification-pratham.tekdinext.com
NEXT_PUBLIC_TELEMETRY_URL=https://qa.prathamteacherapp.tekdinext.com/telemetry
NEXT_PUBLIC_MEASUREMENT_ID= G-GNMQZ8Z65Z
NEXT_PUBLIC_TRACKING_API_URL=https://tracking-pratham.tekdinext.com
NEXT_PUBLIC_SHIKSHALOKAM_API_URL=https://dev.elevate-apis.shikshalokam.org/project/v1
NEXT_PUBLIC_SHIKSHALOKAM_TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7ImlkIjoxNjIsIm5hbWUiOiJQcml5YW5rYSIsInNlc3Npb25faWQiOjYxNTAsIm9yZ2FuaXphdGlvbl9pZCI6MjQsInJvbGVzIjpbeyJpZCI6MywidGl0bGUiOiJtZW50ZWUiLCJsYWJlbCI6Ik1lbnRlZSIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiQUNUSVZFIiwib3JnYW5pemF0aW9uX2lkIjoxLCJ2aXNpYmlsaXR5IjoiUFVCTElDIn0seyJpZCI6NCwidGl0bGUiOiJhZG1pbiIsImxhYmVsIjoiQWRtaW4iLCJ1c2VyX3R5cGUiOjEsInN0YXR1cyI6IkFDVElWRSIsIm9yZ2FuaXphdGlvbl9pZCI6MSwidmlzaWJpbGl0eSI6IlBVQkxJQyJ9LHsiaWQiOjgsInRpdGxlIjoicHVibGljIiwibGFiZWwiOiJQdWJsaWMiLCJ1c2VyX3R5cGUiOjAsInN0YXR1cyI6IkFDVElWRSIsIm9yZ2FuaXphdGlvbl9pZCI6MSwidmlzaWJpbGl0eSI6IlBVQkxJQyJ9LHsiaWQiOjUsInRpdGxlIjoib3JnX2FkbWluIiwibGFiZWwiOiJPcmcgQWRtaW4iLCJ1c2VyX3R5cGUiOjEsInN0YXR1cyI6IkFDVElWRSIsIm9yZ2FuaXphdGlvbl9pZCI6MSwidmlzaWJpbGl0eSI6IlBVQkxJQyJ9LHsiaWQiOjEwLCJ0aXRsZSI6InJldmlld2VyIiwibGFiZWwiOiJSZXZpZXdlciIsInVzZXJfdHlwZSI6MCwic3RhdHVzIjoiQUNUSVZFIiwib3JnYW5pemF0aW9uX2lkIjoxLCJ2aXNpYmlsaXR5IjoiUFVCTElDIn0seyJpZCI6MjAsInRpdGxlIjoiZGlzdHJpY3RfZWR1Y2F0aW9uX29mZmljZXIiLCJsYWJlbCI6IkRpc3RyaWN0IEVkdWNhdGlvbiBPZmZpY2VyIiwidXNlcl90eXBlIjowLCJzdGF0dXMiOiJBQ1RJVkUiLCJvcmdhbml6YXRpb25faWQiOjI0LCJ2aXNpYmlsaXR5IjoiUFVCTElDIn1dfSwiaWF0IjoxNzI0ODM3NzEyLCJleHAiOjE3MjQ5MjQxMTJ9.5rBJlIC0wN-6zpISQfa-cNCLRvSSe6uI87W2JKBt4Yk
# NEXT_PUBLIC_BASE_URL=https://backend.prathamdigital.org/user/v1
# NEXT_PUBLIC_NOTIFICATION_BASE_URL=https://notification.prathamdigital.org
# NEXT_PUBLIC_TRACKING_API_URL=https://tracking.prathamdigital.org
# NEXT_PUBLIC_TRACKING_API_URL=https://tracking.prathamdigital.org

8 changes: 8 additions & 0 deletions app.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,11 @@ export const DaysOfWeek = {
Fri: 5,
Sat: 6,
};

export const Program = "Second chance";

export enum AssessmentType {
PRE_TEST = 'Pre Test',
POST_TEST = 'Post Test',
}

39 changes: 22 additions & 17 deletions public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
"SURE_LOGOUT": "Are you sure you want to Logout?",
"SURE_UPDATE": "Are you sure you want to update this attendance?",
"SURE_REMOVE": "Are you sure you want to remove this learner?",
"SURE_REASSIGN_CENTER": "Are you sure you want to re-assign Center to this user?",
"SURE_REASSIGN_CENTER": "Are you sure you want to re-assign center to this user?",
"SURE_CLOSE": "Are you sure you want to close without saving?",
"LEARNER_LIST": "Learners List",
"FACILITATOR_LIST": "Facilitators List",
Expand All @@ -94,7 +94,7 @@
"DROPPED_OUT": "Dropped Out",
"DELETE_USER": "Delete User Permanently",
"DELETE_USER_WITH_REASON": "Delete User",
"USER_DELETED_PERMANENTLY": "User Successfully Deleted!",
"USER_DELETED_PERMANENTLY": "User successfully deleted!",
"OBSERVATIONS_FORMS": "Observations and Forms",
"OTHER_REASON": "Other Reason",
"OTHER_REASON_PLACEHOLDER": "Enter Other Reason",
Expand All @@ -103,7 +103,8 @@
"CREDENTIALS_EMAILED": "The login credentials will be emailed to the Facilitator at ",
"CREDENTIALS_EMAILED_OF_LEARNER": "The login credentials have been send to your email ",
"NEW": "New {{role}}",
"USER_CREDENTIAL_SEND_SUCCESSFULLY": "User Credentials Sent Successfully!",
"USER_CREDENTIAL_SEND_SUCCESSFULLY": "User credentials sent successfully!",
"USER_CREDENTIAL_SEND_FAILED": "User credentials failed to send!",
"CENTER_SESSIONS": "Center Sessions",
"SCHEDULE_NEW": "Schedule New",
"UPCOMING_EXTRA_SESSION": "Upcoming Extra Sessions (Next {{days}} days)",
Expand All @@ -118,7 +119,7 @@
"NEW_FACILITATOR": "New Facilitator",
"EDIT_FACILITATOR": "Edit Facilitator",
"SUBMIT": "Submit",
"LEARNER_CREATED_SUCCESSFULLY": "Leaner has been Successfully Created!",
"LEARNER_CREATED_SUCCESSFULLY": "Leaner has been successfully created!",
"FACILITATOR_ADDED_SUCCESSFULLY": "Facilitator added successfully!",
"LEARNER_UPDATED_SUCCESSFULLY": "Learner profile updated successfully!",
"FACILITATOR_UPDATED_SUCCESSFULLY": "Facilitator profile updated successfully!",
Expand Down Expand Up @@ -319,14 +320,14 @@
"CENTER_TYPE": "Center Type",
"UNIT_NAME": "Unit Name",
"NOTE": "Note: This will be the center name",
"CENTER_CREATED": "Center Created Successfully!",
"CENTER_CREATED": "Center created successfully!",
"RENAME_CENTER": "Rename Center",
"REQUEST_TO_DELETE": "Request to Delete",
"RENAME": "Rename",
"CENTER_RENAMED": "Center Renamed Successfully!",
"CENTER_RENAMED": "Center renamed successfully!",
"SEND_REQUEST": "Send Request",
"REQUEST_TO_DELETE_HAS_BEEN_SENT": "Request to Delete has been sent",
"YOU_ARE_SENDING_REQUEST_TO_THE_STATE_ADMIN": "You are sending a request to the State Admin to delete this Center",
"YOU_ARE_SENDING_REQUEST_TO_THE_STATE_ADMIN": "You are sending a request to the State Admin to delete this center",
"THE_USER_BELONGS_TO_THE_FOLLOWING_COHORT": "The user belongs to the following cohort: ",
"PLEASE_REMOVE_THE_USER_FROM_COHORT": "Please remove the user from these cohorts before proceeding with deletion.",
"ERROR_EMPTY": "Center name cannot be empty",
Expand All @@ -353,6 +354,7 @@
"TOPIC": "Topic",
"SUBTOPIC": "Sub Topic",
"FACILITATORS": " Facilitators Pre-requisites",
"LEARNERS": " Learners Pre-requisites",
"TITLE": "Title",
"DELETE_SESSION": "Delete Session",
"SCHEDULE": "Schedule",
Expand All @@ -371,19 +373,21 @@
"EXTRA_OFFLINE": "Extra offline",
"ENTER_VALID_MEETING_LINK": "Please enter a valid Zoom or Google Meet link.",
"ZOOM": "Zoom",
"GOOGLEMEET": "GoogleMeet",
"GOOGLE_MEET": "GOOGLE_MEET",
"SET_UP": "Set-Up",
"EDIT_THIS_SESSION": "Edit this session",
"EDIT_FOLLOWING_SESSIONS": "Edit this and following sessions",
"DELETE_SESSION_MSG": "Are you sure you want to delete this session?",
"DELETE_ALL_SESSION_MSG": "Are you sure you want to delete all sessions in this series?",
"DELETE_THIS_SESSION": "Delete this session",
"DELETE_FOLLOWING_SESSION": "Delete this and following sessions",
"UPDATE_CHANGES": "Are you sure you want to update the changes?"
"UPDATE_CHANGES": "Are you sure you want to update the changes?",
"SESSION_DELETED_SUCCESSFULLY": "Session deleted successfully",
"SESSION_EDITED_SUCCESSFULLY": "Session updated successfully"
},
"MANAGE_USERS": {
"CENTERS_REQUESTED_SUCCESSFULLY": "Center Requested Successfully",
"CENTERS_REQUEST_FAILED": "Center Requested Failed"
"CENTERS_REQUESTED_SUCCESSFULLY": "Center requested successfully",
"CENTERS_REQUEST_FAILED": "Center Request Failed"
},
"FORM": {
"FULL_NAME": "Full Name",
Expand All @@ -408,7 +412,7 @@
"ENTER_YOUR_FATHER_NAME": "Enter Your Father Name",
"CLASS_OR_LAST_PASSED_GRADE": "Class (Last passed grade)",
"NO_SCHOOLING": "No Schooling",
"REASON_FOR_DROPOUT_FROM_SCHOOL": "Reason for Drop Out From School",
"REASON_FOR_DROPOUT_FROM_SCHOOL": "Reason for dropout from school",
"SCHOOL_INACCESSIBLE": "School inaccessible",
"FINANCIAL_CONSTRAINTS": "Financial Constraints",
"LACK_OF_INTEREST": "Lack of Interest",
Expand Down Expand Up @@ -483,7 +487,8 @@
"ENTER_VALID_EMAIL": "Enter valid Email",
"ENTER_VALID_YEAR": "Enter valid Year",
"MUST_BE_LESS_THAN": "{{fieldname}} must be less than {{maxLength}}",
"MUST_BE_GREATER_THAN": "{{fieldname}} must be greater than {{minLength}}"
"MUST_BE_GREATER_THAN": "{{fieldname}} must be greater than {{minLength}}",
"ENTER_VALID_CENTER_NAME": "Enter valid center name"
},
"COURSE_PLANNER": {
"COURSE_PLANNER": "Course Plan",
Expand Down Expand Up @@ -512,11 +517,11 @@
"ASSESSMENT_NOT_STARTED_YET": "Assessment not started yet",
"NUMBER_OUT_OF_COMPLETED": "{{completedCount}} out of {{totalCount}} completed"
},
"BOARD_ENROOLMENT": {
"BOARD_ENROLMENT": {
"BOARD_ENROLLMENT": "Board Enrollment",
"BOARD_SELECTION":"Board Selection",
"BOARD_SELECTION": "Board Selection",
"SUBJECTS_SELECTION": "Subjects Selection",
"REGISTRATION_COMPLETED":"Registration Completed",
"DROPPED_OUT":" Dropped Out"
"REGISTRATION_COMPLETED": "Registration Completed",
"DROPPED_OUT": " Dropped Out"
}
}
87 changes: 51 additions & 36 deletions src/components/AddFacilitator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,29 @@ import {
GenerateSchemaAndUiSchema,
customFields,
} from '@/components/GeneratedSchemas';
import { FormContext, FormContextType, RoleId, Telemetry } from '@/utils/app.constant';
import {
FormContext,
FormContextType,
QueryKeys,
RoleId,
Telemetry,
} from '@/utils/app.constant';
import React, { useEffect } from 'react';
import ReactGA from 'react-ga4';

import DynamicForm from '@/components/DynamicForm';
import SendCredentialModal from '@/components/SendCredentialModal';
import SimpleModal from '@/components/SimpleModal';
import { createUser, getFormRead } from '@/services/CreateUserService';
import {
sendEmailOnFacilitatorCreation
} from '@/services/NotificationService';
import { editEditUser } from '@/services/ProfileService';
import useSubmittedButtonStore from '@/store/useSubmittedButtonStore';
import { modalStyles } from '@/styles/modalStyles';
import { generateUsernameAndPassword } from '@/utils/Helper';
import { Field, FormData } from '@/utils/Interfaces';
import { IChangeEvent } from '@rjsf/core';
import { RJSFSchema } from '@rjsf/utils';
import { useTranslation } from 'next-i18next';
import { showToastMessage } from './Toastify';
import { editEditUser } from '@/services/ProfileService';
import { tenantId } from '../../app.config';
import FormButtons from './FormButtons';
import { sendCredentialService } from '@/services/NotificationService';
import { telemetryFactory } from '@/utils/telemetry';
import CloseIcon from '@mui/icons-material/Close';
import {
Box,
Button,
Expand All @@ -28,10 +33,13 @@ import {
Typography,
useTheme,
} from '@mui/material';
import CloseIcon from '@mui/icons-material/Close';
import { modalStyles } from '@/styles/modalStyles';
import useSubmittedButtonStore from '@/store/useSubmittedButtonStore';
import { telemetryFactory } from '@/utils/telemetry';
import { IChangeEvent } from '@rjsf/core';
import { RJSFSchema } from '@rjsf/utils';
import { useTranslation } from 'next-i18next';
import { tenantId } from '../../app.config';
import FormButtons from './FormButtons';
import { showToastMessage } from './Toastify';
import { useQueryClient } from '@tanstack/react-query';
interface AddFacilitatorModalprops {
open: boolean;
onClose: () => void;
Expand All @@ -55,6 +63,7 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
const [createFacilitator, setCreateFacilitator] = React.useState(false);
const [isVisible, setIsVisible] = React.useState(true);
const [uiSchema, setUiSchema] = React.useState<any>();
const queryClient = useQueryClient();
const [reloadProfile, setReloadProfile] = React.useState(false);
const [email, setEmail] = React.useState('');
const [formData, setFormData] = React.useState<any>();
Expand Down Expand Up @@ -148,6 +157,25 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
}
}, [formData, createFacilitator]);

const sendEmail = async (
name: string,
username: string,
password: string,
email: string
) => {
try {
const response = await sendEmailOnFacilitatorCreation(name, username, password, email);
if (response?.email?.data?.[0]?.[0]?.status !== 'success') {
showToastMessage(
t('COMMON.USER_CREDENTIAL_SEND_FAILED'),
'error'
);
}
} catch (error) {
console.error('error in sending email', error);
}
};

const handleButtonClick = async () => {
console.log('Form data:', formData);
setSubmittedButtonStatus(true);
Expand Down Expand Up @@ -262,6 +290,7 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
);
setReloadProfile(true);
onReload?.();
queryClient.invalidateQueries({ queryKey: [QueryKeys.GET_ACTIVE_FACILITATOR] });
}
onClose();
} else {
Expand All @@ -274,6 +303,8 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
if (response) {
onFacilitatorAdded?.();
onClose();
queryClient.invalidateQueries({ queryKey: [QueryKeys.GET_ACTIVE_FACILITATOR] });
queryClient.invalidateQueries({ queryKey: [QueryKeys.MY_COHORTS, userId] });
showToastMessage(
t('COMMON.FACILITATOR_ADDED_SUCCESSFULLY'),
'success'
Expand All @@ -296,28 +327,12 @@ const AddFacilitatorModal: React.FC<AddFacilitatorModalprops> = ({
};
telemetryFactory.interact(telemetryInteract);

const isQueue = false;
const context = 'USER';
const key = 'onFacilitatorCreated';
const replacements = [apiBody['name'], username, password];
const sendTo = {
receipients: [formData?.email],
};

let createrName;
if (typeof window !== 'undefined' && window.localStorage) {
createrName = localStorage.getItem('userName');
}

if (replacements && sendTo) {
const credentialResponse = await sendCredentialService({
isQueue,
context,
key,
replacements,
email: sendTo,
});
}
await sendEmail(
apiBody['name'],
username,
password,
formData?.email
);
} else {
showToastMessage(t('COMMON.SOMETHING_WENT_WRONG'), 'error');
}
Expand Down
Loading

0 comments on commit 86f81ac

Please sign in to comment.