diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 51f2dd05..6133f721 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -87,8 +87,9 @@ "ALL_BLOCKS": "Blocks", "NEW_FACILITATOR": "New Facilitator", "SEARCHBAR_PLACEHOLDER": "Search Facilitators..", - "FACILITATOR_CREATED_SUCCESSFULLY": "Teacher has been Successfully Created", - "FACILITATOR_UPDATED_SUCCESSFULLY": "Teacher has been Successfully Updated!" + "FACILITATOR_CREATED_SUCCESSFULLY": "Teacher has been successfully created", + "FACILITATOR_UPDATED_SUCCESSFULLY": "Teacher has been successfully updated!", + "EDIT_FACILITATOR":"Edit Facilitator" }, "NAVBAR": { "SEARCHBAR_PLACEHOLDER": "Search course, topic, student, pdf etc.." @@ -97,15 +98,18 @@ "SEARCHBAR_PLACEHOLDER": "Search Learners..", "NEW_LEARNER": "New Learner", "FIRST_SELECT_REQUIRED_FIELDS": "First select required fields", - "LEARNER_CREATED_SUCCESSFULLY": "Learner has been Successfully Created!", - "LEARNER_UPDATED_SUCCESSFULLY": "Learner has been Successfully Updated!" + "LEARNER_CREATED_SUCCESSFULLY": "Learner has been successfully created!", + "LEARNER_UPDATED_SUCCESSFULLY": "Learner has been successfully updated!", + "EDIT_LEARNER":"Edit Learner" + }, "TEAM_LEADERS": { "SEARCHBAR_PLACEHOLDER": "Search Team leaders..", "NEW_TEAM_LEADER": "New Team Leader", "FIRST_SELECT_REQUIRED_FIELDS": "First select required fields", - "TEAM_LEADER_CREATED_SUCCESSFULLY": "Team Leader has been Successfully Created!", - "TEAM_LEADER_UPDATED_SUCCESSFULLY": "Team Leader has been Successfully Updated!" + "TEAM_LEADER_CREATED_SUCCESSFULLY": "Team Leader has been successfully created!", + "TEAM_LEADER_UPDATED_SUCCESSFULLY": "Team Leader has been successfully updated!", + "EDIT_TEAM_LEADER":"Edit Team Leader" }, "COHORTS": { "SEARCHBAR_PLACEHOLDER": "Search Center.." diff --git a/src/components/AddFacilitator.tsx b/src/components/AddFacilitator.tsx index bbc7b45f..486b0900 100644 --- a/src/components/AddFacilitator.tsx +++ b/src/components/AddFacilitator.tsx @@ -258,7 +258,7 @@ const AddFacilitatorModal: React.FC = ({ open={open} onClose={onClose} showFooter={false} - modalTitle={t("FACILITATORS.NEW_FACILITATOR")} + modalTitle={ !isEditModal?t("FACILITATORS.NEW_FACILITATOR"): t("FACILITATORS.EDIT_FACILITATOR")} > {/* {!dynamicForm && ( {t("LEARNERS.FIRST_SELECT_REQUIRED_FIELDS")} diff --git a/src/components/AddLeanerModal.tsx b/src/components/AddLeanerModal.tsx index 511e4a4e..cc95f379 100644 --- a/src/components/AddLeanerModal.tsx +++ b/src/components/AddLeanerModal.tsx @@ -34,6 +34,7 @@ interface AddLearnerModalProps { formData?: object; isEditModal?: boolean; userId?: string; + onSubmit: (submitValue: boolean) => void; } interface FieldProp { value: string; @@ -45,10 +46,12 @@ const AddLearnerModal: React.FC = ({ formData, isEditModal = false, userId, + onSubmit }) => { const [schema, setSchema] = React.useState(); const [uiSchema, setUiSchema] = React.useState(); + const [credentials, setCredentials] = React.useState({ username: "", password: "", @@ -212,6 +215,7 @@ const AddLearnerModal: React.FC = ({ const response = await createUser(apiBody); showToastMessage(t("LEARNERS.LEARNER_CREATED_SUCCESSFULLY"), "success"); } + onSubmit(true); onClose(); } catch (error) { onClose(); @@ -303,7 +307,7 @@ const AddLearnerModal: React.FC = ({ open={open} onClose={onClose} showFooter={false} - modalTitle={t("LEARNERS.NEW_LEARNER")} + modalTitle={!isEditModal?t("LEARNERS.NEW_LEARNER"): t("LEARNERS.EDIT_LEARNER")} > <> = ({ ); }; - +AddLearnerModal.defaultProps = { + onSubmit: () => {}, // Default to a no-op function +}; export default AddLearnerModal; diff --git a/src/components/AddTeamLeaderModal.tsx b/src/components/AddTeamLeaderModal.tsx index 53457e90..99bd624f 100644 --- a/src/components/AddTeamLeaderModal.tsx +++ b/src/components/AddTeamLeaderModal.tsx @@ -310,7 +310,7 @@ const AddTeamLeaderModal: React.FC = ({ open={open} onClose={onClose} showFooter={false} - modalTitle={t("TEAM_LEADERS.NEW_TEAM_LEADER")} + modalTitle={!isEditModal? t("TEAM_LEADERS.NEW_TEAM_LEADER"): t("TEAM_LEADERS.EDIT_TEAM_LEADER")} > <> = ({ : [...prevSelected, rowId] ); }; - const tableProps: ITableProps = { columns, data, diff --git a/src/components/UserTable.tsx b/src/components/UserTable.tsx index 484ab447..d06f9e7d 100644 --- a/src/components/UserTable.tsx +++ b/src/components/UserTable.tsx @@ -107,12 +107,15 @@ const UserTable: React.FC = ({ const [loading, setLoading] = useState(undefined); const [openAddLearnerModal, setOpenAddLearnerModal] = React.useState(false); const [userId, setUserId] = useState(); + const [submitValue, setSubmitValue] = useState(false); const handleOpenAddLearnerModal = () => { - console.log("hello"); setOpenAddLearnerModal(true); }; + const handleModalSubmit = (value: boolean) => { + setSubmitValue(true); + }; const handleCloseAddLearnerModal = () => { setOpenAddLearnerModal(false); }; @@ -514,7 +517,7 @@ const handleCloseAddTeamLeaderModal = () => { } }; fetchUserList(); - }, [pageOffset, pageLimit, sortBy, filters, openAddFacilitatorModal, openAddLearnerModal, openAddTeamLeaderModal, parentState]); + }, [pageOffset,submitValue, pageLimit, sortBy, filters, openAddFacilitatorModal, openAddTeamLeaderModal]); useEffect(() => { const fetchData = async () => { @@ -662,6 +665,7 @@ const handleCloseAddTeamLeaderModal = () => { formData={formdata} isEditModal={true} userId={userId} + onSubmit={handleModalSubmit} /> { const { t } = useTranslation(); const [openAddLearnerModal, setOpenAddLearnerModal] = React.useState(false); + const [submitValue, setSubmitValue] = React.useState(false); + const handleOpenAddLearnerModal = () => { setOpenAddLearnerModal(true); }; +const handleModalSubmit = (value: boolean) => { + setSubmitValue(true); +}; const handleCloseAddLearnerModal = () => { setOpenAddLearnerModal(false); }; @@ -24,6 +29,8 @@ const handleCloseAddLearnerModal = () => { diff --git a/src/pages/login.tsx b/src/pages/login.tsx index 72f1fe85..6e96e1a3 100644 --- a/src/pages/login.tsx +++ b/src/pages/login.tsx @@ -218,14 +218,14 @@ const LoginPage = () => { )} App Logo - {t("LOGIN_PAGE.LOGIN")} - + */}