diff --git a/src/pages/course-planner/index.tsx b/src/pages/course-planner/index.tsx
index ccdf74ee..e0ee956e 100644
--- a/src/pages/course-planner/index.tsx
+++ b/src/pages/course-planner/index.tsx
@@ -202,27 +202,19 @@ const Foundation = () => {
{loading ? (
) : (
-
+
{t("MASTER.STATE")}
-
+
{role === "Central Admin CCTA"
? stateNames.map((stateName) => (
-
+ {
"&:hover": {
backgroundColor: "#D0C5B4",
},
+ marginTop: "8px"
}}
onClick={() => handleCardClick(stateName)}
>
@@ -257,20 +250,24 @@ const Foundation = () => {
{/* Add any icon or text for the copy link button */}
-
+
+
))
: store?.matchingstate && (
-
+
handleCardClick(store.matchingstate.name)
@@ -297,10 +294,11 @@ const Foundation = () => {
{/* Add any icon or text for the copy link button */}
-
+
+
)}
-
+
)}
>
diff --git a/src/pages/district.tsx b/src/pages/district.tsx
index 02ac6eed..d8142233 100644
--- a/src/pages/district.tsx
+++ b/src/pages/district.tsx
@@ -82,6 +82,8 @@ const District: React.FC = () => {
const [pageSizeArray, setPageSizeArray] = useState([5, 10, 20, 50]);
const [sortBy, setSortBy] = useState<[string, string]>(["name", "asc"]);
const [searchKeyword, setSearchKeyword] = useState("");
+ const [fetchDistrict, setFetchDistrict] = useState(true);
+
const [paginationCount, setPaginationCount] = useState(Numbers.ZERO);
const [stateCode, setStateCode] = useState();
const [stateValue, setStateValue] = useState("");
@@ -161,7 +163,7 @@ const District: React.FC = () => {
useEffect(() => {
fetchDistricts();
- }, []);
+ }, [fetchDistrict]);
// get cohort id of state
const getStatecohorts = async () => {
let userId: any;
@@ -559,6 +561,7 @@ const District: React.FC = () => {
});
showToastMessage(t("COMMON.DISTRICT_UPDATED_SUCCESS"), "success");
+ setFetchDistrict(!fetchDistrict);
const windowUrl = window.location.pathname;
const cleanedUrl = windowUrl.replace(/^\//, '');
const env = cleanedUrl.split("/")[0];
diff --git a/src/pages/importCsv.tsx b/src/pages/importCsv.tsx
index 415081aa..bf0a2da4 100644
--- a/src/pages/importCsv.tsx
+++ b/src/pages/importCsv.tsx
@@ -75,9 +75,9 @@ const ImportCsv = () => {
const response = await getTargetedSolutions({
subject: tstore?.taxonomySubject,
class: tstore?.taxonomyGrade,
- state: tstore?.state,
+ state: localStorage.getItem("selectedState") || tstore?.state,
board: tstore?.board,
- type: tstore?.taxonomyType,
+ courseType: tstore?.taxonomyType,
medium: tstore?.taxonomyMedium,
});
@@ -115,9 +115,9 @@ const ImportCsv = () => {
const updatedResponse = await getTargetedSolutions({
subject: tstore?.taxonomySubject,
class: tstore?.taxonomyGrade,
- state: tstore?.state,
+ state: localStorage.getItem("selectedState") || tstore?.state,
board: tstore?.board,
- type: tstore?.taxonomyType,
+ courseType: tstore?.taxonomyType,
medium: tstore?.taxonomyMedium,
});
setLoading(false);
@@ -185,7 +185,7 @@ const ImportCsv = () => {
const metaData: CoursePlannerMetaData = {
subject: tstore?.taxonomySubject,
class: tstore?.taxonomyGrade,
- state: tstore?.state,
+ state: localStorage.getItem("selectedState") || tstore?.state,
board: tstore?.board,
type: tstore?.taxonomyType,
medium: tstore?.taxonomyMedium,
diff --git a/src/pages/login.tsx b/src/pages/login.tsx
index 8d4aae04..634a9ee8 100644
--- a/src/pages/login.tsx
+++ b/src/pages/login.tsx
@@ -77,7 +77,15 @@ const LoginPage = () => {
const token = localStorage.getItem("token");
if (token) {
+ const { locale } = router;
+ if(locale)
+ {
+ router.push("/centers", undefined, { locale: locale });
+ }
+ else
router.push("/centers");
+
+
}
}
}, []);
@@ -152,9 +160,25 @@ const LoginPage = () => {
// router.push("/centers");
if (userInfo?.role === Role.SCTA || userInfo?.role === Role.CCTA) {
window.location.href = "/course-planner";
+ const { locale } = router;
+ if(locale)
+ {
+ router.push("/course-planner", undefined, { locale: locale });
+ }
+ else
+ router.push("/course-planner");
+
}
else {
- window.location.href = "/centers";
+ //window.location.href = "/centers";
+ const { locale } = router;
+ if(locale)
+ {
+ router.push("/centers", undefined, { locale: locale });
+ }
+ else
+ router.push("/centers");
+
}
}
diff --git a/src/pages/stateDetails.tsx b/src/pages/stateDetails.tsx
index 75a85f15..6759e1cd 100644
--- a/src/pages/stateDetails.tsx
+++ b/src/pages/stateDetails.tsx
@@ -75,7 +75,7 @@ const StateDetails = () => {
-
+
{state || "States"}
@@ -86,24 +86,21 @@ const StateDetails = () => {
>
Boards:
-
+
{boards.map((board: any, index: number) => (
{
handleBoardClick(board.code, board.name);
diff --git a/src/pages/subjectDetails.tsx b/src/pages/subjectDetails.tsx
index bcd7d913..9cf54751 100644
--- a/src/pages/subjectDetails.tsx
+++ b/src/pages/subjectDetails.tsx
@@ -821,14 +821,15 @@ const SubjectDetails = () => {
sx={{
display: "flex",
alignItems: "center",
- marginLeft: "10px",
marginTop: "16px",
marginBottom: "16px",
+ gap:'5px'
}}
+ onClick={handleBackClick}
>
-
+
-
+
{boardName}
{/*
Boardasahskj
@@ -858,7 +859,6 @@ const SubjectDetails = () => {
backgroundColor: "#EAF2FF",
transform: "scale(1.02)",
},
- marginTop: "12px",
}}
onClick={() => handleCardClick(subj)}
>
@@ -883,7 +883,7 @@ const SubjectDetails = () => {
Select Medium, Grade, and Type
diff --git a/src/services/coursePlanner.ts b/src/services/coursePlanner.ts
index 8087a453..45402da7 100644
--- a/src/services/coursePlanner.ts
+++ b/src/services/coursePlanner.ts
@@ -1,11 +1,14 @@
-import { CoursePlannerMetaData, GetSolutionDetailsParams, GetTargetedSolutionsParams, GetUserProjectTemplateParams } from "@/utils/Interfaces";
+import {
+ CoursePlannerMetaData,
+ GetSolutionDetailsParams,
+ GetTargetedSolutionsParams,
+ GetUserProjectTemplateParams,
+} from "@/utils/Interfaces";
import { get, post } from "./RestClient";
-import axios from 'axios';
+import axios from "axios";
import { FRAMEWORK_ID } from "../../app.config";
import { URL_CONFIG } from "@/utils/url.config";
-
-
export const getChannelDetails = async (): Promise => {
const apiUrl: string = `/api/framework/v1/read/${FRAMEWORK_ID}`;
@@ -13,159 +16,163 @@ export const getChannelDetails = async (): Promise => {
const response = await axios.get(apiUrl);
return response?.data;
} catch (error) {
- console.error('Error in getting Channel Details', error);
+ console.error("Error in getting Channel Details", error);
return error;
}
};
-export const getFrameworkDetails = async (frameworkId: string): Promise => {
+export const getFrameworkDetails = async (
+ frameworkId: string
+): Promise => {
const apiUrl: string = `/api/framework/v1/read/${frameworkId}?categories=gradeLevel,medium,class,subject`;
try {
const response = await axios.get(apiUrl);
return response?.data;
} catch (error) {
- console.error('Error in getting Framework Details', error);
+ console.error("Error in getting Framework Details", error);
return error;
}
};
-export const uploadCoursePlanner = async (file: File, metaData: CoursePlannerMetaData): Promise => {
- const apiUrl: string = `${process.env.NEXT_PUBLIC_MIDDLEWARE_URL}/prathamservice/v1/course-planner/upload`;
- const formData = new FormData();
- formData.append('file', file);
- formData.append('metaData', JSON.stringify(metaData));
- try {
- const response = await post(apiUrl, formData, {
- });
- return response?.data;
- } catch (error) {
- console.error('Error uploading course planner', error);
- throw error;
- }
- };
+export const uploadCoursePlanner = async (
+ file: File,
+ metaData: CoursePlannerMetaData
+): Promise => {
+ const apiUrl: string = `${process.env.NEXT_PUBLIC_MIDDLEWARE_URL}/prathamservice/v1/course-planner/upload`;
+ const formData = new FormData();
+ formData.append("file", file);
+ formData.append("metaData", JSON.stringify(metaData));
+ try {
+ const response = await post(apiUrl, formData, {});
+ return response?.data;
+ } catch (error) {
+ console.error("Error uploading course planner", error);
+ throw error;
+ }
+};
+
+export const getTargetedSolutions = async ({
+ subject,
+ state,
+ medium,
+ class: className,
+ board,
+ courseType,
+}: GetTargetedSolutionsParams): Promise => {
+ const apiUrl: string = `${process.env.NEXT_PUBLIC_COURSE_PLANNER_API_URL}/solutions/targetedSolutions?type=improvementProject¤tScopeOnly=true`;
+ const headers = {
+ "X-auth-token": localStorage.getItem("token"),
+ "Content-Type": "application/json",
+ };
- export const getTargetedSolutions = async ({
+ const data = {
subject,
state,
medium,
class: className,
board,
- type,
- }: GetTargetedSolutionsParams): Promise => {
- const apiUrl: string = `${process.env.NEXT_PUBLIC_COURSE_PLANNER_API_URL}/solutions/targetedSolutions?type=improvementProject¤tScopeOnly=true`;
-
- const headers = {
- 'X-auth-token': localStorage.getItem('token'),
- 'Content-Type': 'application/json',
- };
-
- const data = {
- subject,
- state,
-
- medium,
- class: className,
- board,
- type,
- };
-
- try {
- const response = await axios.post(apiUrl, data, { headers });
- return response?.data;
- } catch (error) {
- console.error('Error in getting Targeted Solutions', error);
- return error;
- }
+ courseType,
};
- interface GetUserProjectDetailsParams {
- id: string;
+
+ try {
+ const response = await axios.post(apiUrl, data, { headers });
+ return response?.data;
+ } catch (error) {
+ console.error("Error in getting Targeted Solutions", error);
+ return error;
}
-
- export const getUserProjectDetails = async ({ id }: GetUserProjectDetailsParams): Promise => {
- const apiUrl: string = `${process.env.NEXT_PUBLIC_COURSE_PLANNER_API_URL}/userProjects/details/${id}`;
-
- const headers = {
- 'Authorization': localStorage.getItem('token'),
- 'Content-Type': 'application/json',
- 'x-auth-token': localStorage.getItem('token'),
-
- };
-
- try {
- const response = await axios.post(apiUrl, {}, { headers });
- return response?.data;
- } catch (error) {
- console.error('Error in getting User Project Details', error);
- return error;
- }
+};
+interface GetUserProjectDetailsParams {
+ id: string;
+}
+
+export const getUserProjectDetails = async ({
+ id,
+}: GetUserProjectDetailsParams): Promise => {
+ const apiUrl: string = `${process.env.NEXT_PUBLIC_COURSE_PLANNER_API_URL}/userProjects/details/${id}`;
+
+ const headers = {
+ Authorization: localStorage.getItem("token"),
+ "Content-Type": "application/json",
+ "x-auth-token": localStorage.getItem("token"),
};
-
-
- export const getSolutionDetails = async ({ id, role }: GetSolutionDetailsParams): Promise => {
- const apiUrl: string = `${process.env.NEXT_PUBLIC_COURSE_PLANNER_API_URL}/solutions/details/${id}`;
-
- const headers = {
- 'X-auth-token': localStorage.getItem('token'),
- 'Content-Type': 'application/json',
- };
-
- const data = {
- role,
- };
-
- try {
- const response = await axios.post(apiUrl, data, { headers });
- return response?.data;
- } catch (error) {
- console.error('Error in getting Solution Details', error);
- return error;
- }
+
+ try {
+ const response = await axios.post(apiUrl, {}, { headers });
+ return response?.data;
+ } catch (error) {
+ console.error("Error in getting User Project Details", error);
+ return error;
+ }
+};
+
+export const getSolutionDetails = async ({
+ id,
+ role,
+}: GetSolutionDetailsParams): Promise => {
+ const apiUrl: string = `${process.env.NEXT_PUBLIC_COURSE_PLANNER_API_URL}/solutions/details/${id}`;
+
+ const headers = {
+ "X-auth-token": localStorage.getItem("token"),
+ "Content-Type": "application/json",
};
-
- export const getUserProjectTemplate = async ({
- templateId,
- solutionId,
+
+ const data = {
role,
- }: GetUserProjectTemplateParams): Promise => {
- const apiUrl: string = `${process.env.NEXT_PUBLIC_COURSE_PLANNER_API_URL}/userProjects/details?templateId=${templateId}&solutionId=${solutionId}`;
-
- const headers = {
- 'X-auth-token': localStorage.getItem('token'),
- 'Content-Type': 'application/json',
- };
-
- const data = {
- role,
- };
-
- try {
- const response = await axios.post(apiUrl, data, { headers });
- return response?.data;
- } catch (error) {
- console.error('Error in getting User Project Details', error);
- throw error;
- }
};
-
- export const getContentHierarchy = async ({
- doId,
- }: {
- doId: string;
- }): Promise => {
- const apiUrl: string = `${URL_CONFIG.API.CONTENT_HIERARCHY}/${doId}`;
-
- try {
- console.log('Request data', apiUrl);
- const response = await get(apiUrl);
- // console.log('response', response);
- return response;
- } catch (error) {
- console.error('Error in getContentHierarchy Service', error);
- throw error;
- }
+
+ try {
+ const response = await axios.post(apiUrl, data, { headers });
+ return response?.data;
+ } catch (error) {
+ console.error("Error in getting Solution Details", error);
+ return error;
+ }
+};
+
+export const getUserProjectTemplate = async ({
+ templateId,
+ solutionId,
+ role,
+}: GetUserProjectTemplateParams): Promise => {
+ const apiUrl: string = `${process.env.NEXT_PUBLIC_COURSE_PLANNER_API_URL}/userProjects/details?templateId=${templateId}&solutionId=${solutionId}`;
+
+ const headers = {
+ "X-auth-token": localStorage.getItem("token"),
+ "Content-Type": "application/json",
+ };
+
+ const data = {
+ role,
};
-
\ No newline at end of file
+
+ try {
+ const response = await axios.post(apiUrl, data, { headers });
+ return response?.data;
+ } catch (error) {
+ console.error("Error in getting User Project Details", error);
+ throw error;
+ }
+};
+
+export const getContentHierarchy = async ({
+ doId,
+}: {
+ doId: string;
+}): Promise => {
+ const apiUrl: string = `${URL_CONFIG.API.CONTENT_HIERARCHY}/${doId}`;
+
+ try {
+ console.log("Request data", apiUrl);
+ const response = await get(apiUrl);
+ // console.log('response', response);
+ return response;
+ } catch (error) {
+ console.error("Error in getContentHierarchy Service", error);
+ throw error;
+ }
+};
diff --git a/src/utils/Interfaces.ts b/src/utils/Interfaces.ts
index 7a0b3f04..d8dea478 100644
--- a/src/utils/Interfaces.ts
+++ b/src/utils/Interfaces.ts
@@ -97,7 +97,7 @@ export interface GetTargetedSolutionsParams {
medium: string;
class: string;
board: string;
- type: string;
+ courseType: string;
}
export interface GetSolutionDetailsParams {