diff --git a/module-template/public/image24.png b/module-template/public/image24.png
new file mode 100644
index 00000000..144c688d
Binary files /dev/null and b/module-template/public/image24.png differ
diff --git a/packages/nulp_elite/public/locales/be/translation.json b/packages/nulp_elite/public/locales/be/translation.json
index 53e88aa2..e222c345 100644
--- a/packages/nulp_elite/public/locales/be/translation.json
+++ b/packages/nulp_elite/public/locales/be/translation.json
@@ -322,8 +322,10 @@
"NO_CHAT_REQUEST": "কোনো চ্যাট অনুরোধ নেই",
"PHONE":"ফোন",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
- "LERN_title":"Learnathon 2.0",
- "LERN_MESSAGE":"Learnathon 2.0 20/09/2024 থেকে 20/10/2024 পর্যন্ত শুরু হয়েছে। আপনি এখন আপনার জমাগুলি তৈরি এবং ভাগ করতে পারেন!",
"CREATE_CONTENT":"সামগ্রী তৈরি করুন",
- "REQUEST_TO_CREATE":"তৈরি করার অনুরোধ"
+ "REQUEST_TO_CREATE":"তৈরি করার অনুরোধ",
+ "PARTICIPATE_NOW":"এখনই অংশগ্রহণ করুন",
+ "LERN_title": "The Learnathon 2.0 শুরু হয়েছে!",
+ "LERN_MESSAGE": "যেখানে শহুরে অনুশীলনকারীরা সহযোগিতামূলক শিক্ষাকে উৎসাহিত করার জন্য সমাধানগুলি ভাগ করে নেয়।",
+ "LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 18ই নভেম্বর 2024 এ চালু হয়েছে এবং 20শে ডিসেম্বর 2024 পর্যন্ত চলবে। এখনই আপনার শহুরে সমাধান জমা দিন!"
}
diff --git a/packages/nulp_elite/public/locales/en/translation.json b/packages/nulp_elite/public/locales/en/translation.json
index f3c5d794..ea0703cd 100644
--- a/packages/nulp_elite/public/locales/en/translation.json
+++ b/packages/nulp_elite/public/locales/en/translation.json
@@ -319,8 +319,10 @@
"PHONE": "Phone",
"PHONE_NUMBER": "(+91 11) 24617517, 24617543, 24617595",
"SESSION_TIMEOUT_MESSAGE": "Failed to fetch data.please try again.",
- "LERN_title": "Learnathon 2.0",
- "LERN_MESSAGE": "Learnathon 2.0 has started from 20/09/2024 to 20/10/2024. You can now create and share your submissions!",
"CREATE_CONTENT": "Create Content",
- "REQUEST_TO_CREATE": "Request to Create"
+ "REQUEST_TO_CREATE": "Request to Create",
+ "PARTICIPATE_NOW":"Participate Now",
+ "LERN_title": "The Learnathon 2.0 Has Begun!",
+ "LERN_MESSAGE": "Where urban practitioners share solutions to foster collaborative learning.",
+ "LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 launched on 18th November 2024 and will continue until 20th December 2024. Submit your urban solutions now!"
}
diff --git a/packages/nulp_elite/public/locales/gg/translation.json b/packages/nulp_elite/public/locales/gg/translation.json
index af24cd87..b099cc22 100644
--- a/packages/nulp_elite/public/locales/gg/translation.json
+++ b/packages/nulp_elite/public/locales/gg/translation.json
@@ -325,8 +325,10 @@
"NO_CHAT_REQUEST": "કોઈ ચેટ વિનંતી નથી",
"PHONE":"ફોન",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
- "LERN_title":"લર્નથોન 2.0",
- "LERN_MESSAGE":"લર્નથોન 2.0 20/09/2024 થી 20/10/2024 સુધી શરૂ થઈ છે. તમે હવે તમારા સબમિશન બનાવી અને શેર કરી શકો છો!",
"CREATE_CONTENT":"સામગ્રી બનાવો",
- "REQUEST_TO_CREATE":"બનાવવાની વિનંતી"
+ "REQUEST_TO_CREATE":"બનાવવાની વિનંતી",
+ "PARTICIPATE_NOW":"હવે ભાગ લો",
+ "LERN_title": "ધ લર્નથોન 2.0 શરૂ થઈ ગયું છે!",
+ "LERN_MESSAGE": "જ્યાં શહેરી પ્રેક્ટિશનરો સહયોગી શિક્ષણને પ્રોત્સાહન આપવા માટે ઉકેલો શેર કરે છે.",
+ "LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 18મી નવેમ્બર 2024 ના રોજ લોન્ચ થયું અને 20મી ડિસેમ્બર 2024 સુધી ચાલુ રહેશે. તમારા શહેરી ઉકેલો હમણાં જ સબમિટ કરો!"
}
diff --git a/packages/nulp_elite/public/locales/hi/translation.json b/packages/nulp_elite/public/locales/hi/translation.json
index 9429b27a..716a1f4c 100644
--- a/packages/nulp_elite/public/locales/hi/translation.json
+++ b/packages/nulp_elite/public/locales/hi/translation.json
@@ -316,8 +316,10 @@
"NO_CHAT_REQUEST": "कोई चैट अनुरोध नहीं",
"PHONE":"फोन",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
- "LERN_title":"लर्नथॉन 2.0",
- "LERN_MESSAGE":"लर्नथॉन 2.0 20/09/2024 से 20/10/2024 तक शुरू हो चुका है। अब आप अपने सबमिशन बना और साझा कर सकते हैं!",
"CREATE_CONTENT":"सामग्री बनाएँ",
- "REQUEST_TO_CREATE":"बनाने का अनुरोध"
+ "REQUEST_TO_CREATE":"बनाने का अनुरोध",
+ "PARTICIPATE_NOW":"अभी भाग लें",
+ "LERN_title": "लर्नथॉन 2.0 शुरू हो गया है!",
+ "LERN_MESSAGE": "जहां शहरी व्यवसायी सहयोगात्मक शिक्षा को बढ़ावा देने के लिए समाधान साझा करते हैं।",
+ "LERN_MESSAGE_LINE_TWO":"लर्नथॉन 2.0 18 नवंबर 2024 को लॉन्च हुआ और 20 दिसंबर 2024 तक जारी रहेगा। अब अपना शहरी समाधान सबमिट करें!"
}
diff --git a/packages/nulp_elite/public/locales/ma/translation.json b/packages/nulp_elite/public/locales/ma/translation.json
index 6aad9d48..35510d44 100644
--- a/packages/nulp_elite/public/locales/ma/translation.json
+++ b/packages/nulp_elite/public/locales/ma/translation.json
@@ -317,9 +317,11 @@
"NO_CHAT_REQUEST": "चॅट विनंती नाही",
"PHONE":"फोन",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
- "LERN_title":"लर्नथॉन 2.0",
- "LERN_MESSAGE":"लर्नथॉन 2.0 20/09/2024 ते 20/10/2024 पर्यंत सुरू झाली आहे. तुम्ही आता तुमचे सबमिशन तयार आणि शेअर करू शकता!",
"CREATE_CONTENT":"सामग्री तयार करा",
- "REQUEST_TO_CREATE":"तयार करण्याची विनंती"
+ "REQUEST_TO_CREATE":"तयार करण्याची विनंती",
+ "PARTICIPATE_NOW":"आता सहभागी व्हा",
+ "LERN_title": "लर्नथॉन २.० सुरु झाली आहे!",
+ "LERN_MESSAGE": "जेथे शहरी अभ्यासक सहयोगी शिक्षणाला चालना देण्यासाठी उपाय सामायिक करतात.",
+ "LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 18 नोव्हेंबर 2024 ला लॉन्च झाला आणि 20 डिसेंबर 2024 पर्यंत सुरू राहील. तुमचे शहरी उपाय आता सबमिट करा!"
}
diff --git a/packages/nulp_elite/public/locales/mal/translation.json b/packages/nulp_elite/public/locales/mal/translation.json
index 2d5115aa..fcb4a8df 100644
--- a/packages/nulp_elite/public/locales/mal/translation.json
+++ b/packages/nulp_elite/public/locales/mal/translation.json
@@ -317,8 +317,10 @@
"NO_CHAT_REQUEST": "ചാറ്റ് അഭ്യര്ത്ഥനയില്ല",
"PHONE":"ഫോൺ",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
- "LERN_title":"ലേണത്തോൺ 2.0",
- "LERN_MESSAGE":"ലേണത്തോൺ 2.0 20/09/2024 മുതൽ 20/10/2024 വരെ ആരംഭിച്ചു. നിങ്ങൾക്ക് ഇപ്പോൾ നിങ്ങളുടെ സമർപ്പിക്കലുകൾ സൃഷ്ടിക്കാനും പങ്കിടാനും കഴിയും!",
"CREATE_CONTENT":"ഉള്ളടക്കം സൃഷ്ടിക്കുക",
- "REQUEST_TO_CREATE":"സൃഷ്ടിക്കാനുള്ള അഭ്യർത്ഥന"
+ "REQUEST_TO_CREATE":"സൃഷ്ടിക്കാനുള്ള അഭ്യർത്ഥന",
+ "PARTICIPATE_NOW":"ഇപ്പോൾ പങ്കെടുക്കുക",
+ "LERN_title": "ലേണത്തോൺ 2.0 ആരംഭിച്ചു!",
+ "LERN_MESSAGE": "സഹകരണ പഠനം പ്രോത്സാഹിപ്പിക്കുന്നതിന് നഗരപരിശീലകർ പരിഹാരങ്ങൾ പങ്കിടുന്നിടത്ത്.",
+ "LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 2024 നവംബർ 18-ന് സമാരംഭിച്ചു, 2024 ഡിസംബർ 20 വരെ തുടരും. നിങ്ങളുടെ നഗര പരിഹാരങ്ങൾ ഇപ്പോൾ സമർപ്പിക്കുക!"
}
diff --git a/packages/nulp_elite/public/locales/ta/translation.json b/packages/nulp_elite/public/locales/ta/translation.json
index 89537f35..bc93f858 100644
--- a/packages/nulp_elite/public/locales/ta/translation.json
+++ b/packages/nulp_elite/public/locales/ta/translation.json
@@ -342,8 +342,10 @@
"NO_CHAT_REQUEST": "சாட் கோரிக்கை இல்லை",
"PHONE":"தொலைபேசி",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
- "LERN_title":"கற்றல் 2.0",
- "LERN_MESSAGE":"கற்றல் 2.0 20/09/2024 முதல் 20/10/2024 வரை தொடங்கியது. நீங்கள் இப்போது உங்கள் சமர்ப்பிப்புகளை உருவாக்கி பகிரலாம்!",
"CREATE_CONTENT":"உள்ளடக்கத்தை உருவாக்கவும்",
- "REQUEST_TO_CREATE":"உருவாக்க கோரிக்கை"
+ "REQUEST_TO_CREATE":"உருவாக்க கோரிக்கை",
+ "PARTICIPATE_NOW":"இப்போது பங்கேற்கவும்",
+ "LERN_title": "The Learnathon 2.0 Has Begun!",
+ "LERN_MESSAGE": "நகர்ப்புற பயிற்சியாளர்கள் கூட்டுக் கற்றலை வளர்ப்பதற்கான தீர்வுகளை எங்கே பகிர்ந்து கொள்கிறார்கள்.",
+ "LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 18 நவம்பர் 2024 அன்று தொடங்கப்பட்டது மற்றும் 20 டிசம்பர் 2024 வரை தொடரும். உங்கள் நகர்ப்புற தீர்வுகளை இப்போதே சமர்ப்பிக்கவும்!"
}
diff --git a/packages/nulp_elite/public/locales/te/translation.json b/packages/nulp_elite/public/locales/te/translation.json
index 442d41db..fde633d3 100644
--- a/packages/nulp_elite/public/locales/te/translation.json
+++ b/packages/nulp_elite/public/locales/te/translation.json
@@ -281,8 +281,10 @@
"PHONE":"ఫోన్",
"PHONE_NUMBER":"(+91 11) 24617517, 24617543, 24617595",
"WHAT_DO_YOU_WANT_TO_LEARN_TODAY":"ఈరోజు మీరు ఏమి నేర్చుకోవాలనుకుంటున్నారు",
- "LERN_title":"లెర్నాథాన్ 2.0",
- "LERN_MESSAGE":"లెర్నాథాన్ 2.0 20/09/2024 నుండి 20/10/2024 వరకు ప్రారంభమైంది. మీరు ఇప్పుడు మీ సమర్పణలను సృష్టించవచ్చు మరియు భాగస్వామ్యం చేయవచ్చు!",
"CREATE_CONTENT":"కంటెంట్ని సృష్టించండి",
- "REQUEST_TO_CREATE":"సృష్టించడానికి అభ్యర్థన"
+ "REQUEST_TO_CREATE":"సృష్టించడానికి అభ్యర్థన",
+ "PARTICIPATE_NOW":"ఇప్పుడే పాల్గొనండి",
+ "LERN_title": "లెర్నాథాన్ 2.0 ప్రారంభమైంది!",
+ "LERN_MESSAGE": "పట్టణ అభ్యాసకులు సహకార అభ్యాసాన్ని ప్రోత్సహించడానికి పరిష్కారాలను పంచుకునే చోట.",
+ "LERN_MESSAGE_LINE_TWO":"Learnathon 2.0 18 నవంబర్ 2024న ప్రారంభించబడింది మరియు 20 డిసెంబర్ 2024 వరకు కొనసాగుతుంది. మీ పట్టణ పరిష్కారాలను ఇప్పుడే సమర్పించండి!"
}
diff --git a/packages/nulp_elite/src/App.js b/packages/nulp_elite/src/App.js
index 388de7dd..caccc0b4 100644
--- a/packages/nulp_elite/src/App.js
+++ b/packages/nulp_elite/src/App.js
@@ -41,6 +41,7 @@ import PopupForm from "pages/profileData";
import axios from "axios";
import ReactGA from "react-ga4";
import LernModal from "components/learnathon/LernModal";
+import LernSubmissionTable from "pages/learnathon/LernSubmissionTable";
function App() {
// const [t] = useTranslation();
@@ -111,12 +112,6 @@ function App() {
path: routeConfig.ROUTES.JOIN_COURSE_PAGE.JOIN_COURSE,
component: JoinCourse,
},
- // {
- // moduleName: "nulp_elite",
- // path: "/joinCourse/:contentId",
- // component: JoinCourse,
- // },
-
{
moduleName: "nulp_elite",
path: routeConfig.ROUTES.PLAYER_PAGE.PLAYER,
@@ -217,8 +212,14 @@ function App() {
path: routeConfig.ROUTES.LEARNATHON.CREATELEARNCONTENT,
component: LernCreatorForm,
},
+ {
+ moduleName: "nulp_elite",
+ path: routeConfig.ROUTES.LEARNATHON.MYLERNSUBMISSION,
+ component: LernSubmissionTable,
+
+ },
];
- createForm;
+
initializeI18n(
["translation"],
`${process.env.PUBLIC_URL}/locales/{{lng}}/{{ns}}.json`
@@ -327,6 +328,7 @@ function App() {
+
{/* */}
{/* */}
diff --git a/packages/nulp_elite/src/assets/image24.png b/packages/nulp_elite/src/assets/image24.png
new file mode 100644
index 00000000..144c688d
Binary files /dev/null and b/packages/nulp_elite/src/assets/image24.png differ
diff --git a/packages/nulp_elite/src/components/Card.js b/packages/nulp_elite/src/components/Card.js
index 81bbee96..8a12ec0d 100644
--- a/packages/nulp_elite/src/components/Card.js
+++ b/packages/nulp_elite/src/components/Card.js
@@ -18,7 +18,6 @@ export default function BoxCard({ items, index, onClick, continueLearning }) {
const { t } = useTranslation();
useEffect(() => {
- console.log("items-------", items);
if (items.se_gradeLevels) {
setSubdomain(processString(items.se_gradeLevels[0]));
} else if (items.gradeLevel) {
diff --git a/packages/nulp_elite/src/components/learnathon/LernModal.js b/packages/nulp_elite/src/components/learnathon/LernModal.js
index 19b3248a..56c3f72a 100644
--- a/packages/nulp_elite/src/components/learnathon/LernModal.js
+++ b/packages/nulp_elite/src/components/learnathon/LernModal.js
@@ -1,13 +1,20 @@
import React, { useState, useEffect } from 'react';
-import { Modal, Box, Typography, IconButton } from '@mui/material';
+import { Modal, Box, IconButton, Button, Grid } from '@mui/material';
import * as util from "services/utilService";
const urlConfig = require("../../configs/urlConfig.json");
import CloseIcon from "@mui/icons-material/Close";
import Divider from '@mui/material/Divider';
import { useTranslation } from "react-i18next";
+import { useNavigate } from 'react-router-dom';
+import axios from "axios";
+import ToasterCommon from 'pages/ToasterCommon';
const LernModal = () => {
const { t } = useTranslation();
+ const navigate = useNavigate();
+ const [toasterMessage, setToasterMessage] = useState("");
+ const [toasterOpen, setToasterOpen] = useState(false);
+ const [roleList, setRoleList] = useState([]);
const [isModalOpen, setIsModalOpen] = useState(() => {
// Check if the modal has been shown in the current session
const isModalShown = sessionStorage.getItem('isModalShown');
@@ -15,24 +22,97 @@ const LernModal = () => {
});
const [lernUser, setLernUser] = useState([]);
+ const [responseCode,setResponseCode] = useState([]);
+ const [orgId,setOrgId] = useState([]);
const _userId = util.userId();
const handleClose = () => {
setIsModalOpen(false);
sessionStorage.setItem('isModalShown', 'true'); // Set flag to not show modal again
};
+
const fetchData = async () => {
try {
const url = `${urlConfig.URLS.LEARNER_PREFIX}${urlConfig.URLS.USER.GET_PROFILE}${_userId}`;
const response = await fetch(url);
const data = await response.json();
const rolesData = data.result.response.channel;
+ const roles =data.result.response.roles;
+ console.log(roles,'roles array');
+ const organizationId=roles[0]?.scope[0]?.organisationId;
+ const extractedRoles = roles.map(roleObj => roleObj.role);
+ setRoleList(extractedRoles);
+ console.log(organizationId,'organizationId');
+ setOrgId(organizationId);
setLernUser(rolesData);
} catch (error) {
console.error("Error fetching user data:", error);
}
};
+ const checkAccess = async () => {
+ try {
+ const url = `${urlConfig.URLS.CHECK_USER_ACCESS}`;
+ const response = await fetch(url);
+ const data = await response.json();
+
+ const userID = data.result.data;
+ const user = userID.find((user) => user.user_id === _userId);
+
+ if (!user) {
+ console.log("User ID not found. Calling fetchUserAccess...");
+ fetchUserAccess();
+ } else if (user.creator_access === true) {
+ navigate('/webapp/mylernsubmissions');
+ setIsModalOpen(false);
+ console.log("User ID found with creator access. No need to call fetchUserAccess.");
+ } else if (user.creator_access === false) {
+ console.log("User ID found but no creator access. Calling fetchUserAccess...");
+ fetchUserAccess();
+ }
+ } catch (error) {
+ console.error("Error fetching user data:", error);
+ }
+ };
+
+
+ let responsecode;
+ const isCreator = roleList.includes("CONTENT_CREATOR");
+ const fetchUserAccess = async () => {
+ try {
+ const url = `${urlConfig.URLS.PROVIDE_ACCESS}`;
+ const role = isCreator ? roleList : ["CONTENT_CREATOR", ...roleList];
+ const requestPayload = {
+ request: {
+ organisationId: orgId,
+ roles: role,
+ userId: _userId,
+ },
+ };
+
+ if (isCreator) {
+ requestPayload.isCreator = true;
+ }
+
+ const response = await axios.post(url, requestPayload);
+ const data = await response.data;
+ const result = data.result.data.responseCode;
+
+ responsecode = result;
+ setResponseCode(result);
+
+ if (result === "OK") {
+ navigate('webapp/mylernsubmissions');
+ setIsModalOpen(false);
+ } else {
+ setToasterMessage("Something went wrong! Please try again later");
+ }
+ } catch (error) {
+ console.log('error', error);
+ }
+ };
+
+
// Fetch data when the component mounts or _userId changes
useEffect(() => {
if (_userId) {
@@ -51,21 +131,44 @@ const LernModal = () => {
boxShadow: 24,
p: 4,
overflow: "auto",
+ borderRadius:'10px',
+ width: {
+ xs: '100%',
+ sm: '100%',
+ md: '600px',
+ },
};
- console.log(lernUser,'lernUser form modal');
+
+ const handleCardClick = async () => {
+ if (lernUser === 'nulp-learn') {
+ navigate('/webapp/mylernsubmissions');
+ setIsModalOpen(false); // Close the modal
+ } else{
+ await checkAccess();
+ }
+ };
+
+
return (
+ {toasterMessage && (
+
+
+
+ )}
+
- {t("LERN_title")}
+ {t("LERN_title")}
@@ -75,20 +178,41 @@ const LernModal = () => {
-
-
-
-
- {t("LERN_MESSAGE")}
-
-
-
- {lernUser === 'nulp-learn' ? (
- {t("CREATE_CONTENT")}
- ) : (
- {t("REQUEST_TO_CREATE")}
- )}
+
+
+
+
+
+
+
+
+
+
+
+ {t("LERN_MESSAGE")}
+
+
+ {t("LERN_MESSAGE_LINE_TWO")}
+
+
+
+ {lernUser === 'nulp-learn' ? (
+
+ ) : (
+
+ )}
+
+
+
+
diff --git a/packages/nulp_elite/src/configs/routeConfig.json b/packages/nulp_elite/src/configs/routeConfig.json
index d923004c..4d884b00 100644
--- a/packages/nulp_elite/src/configs/routeConfig.json
+++ b/packages/nulp_elite/src/configs/routeConfig.json
@@ -85,7 +85,9 @@
"POLLS_VIEW_ALL": "/webapp/pollsDetails"
},
"LEARNATHON": {
- "CREATELEARNCONTENT": "/webapp/learnthon"
+ "CREATELEARNCONTENT": "/webapp/learnthon",
+ "SUBMISSIONLIST": "webapp/SubmissionList",
+ "MYLERNSUBMISSION": "/webapp/mylernsubmissions"
}
}
}
diff --git a/packages/nulp_elite/src/configs/urlConfig.json b/packages/nulp_elite/src/configs/urlConfig.json
index 4650f216..2c2c0e31 100644
--- a/packages/nulp_elite/src/configs/urlConfig.json
+++ b/packages/nulp_elite/src/configs/urlConfig.json
@@ -49,8 +49,10 @@
"framework": "board,gradeLevel,medium,class,subject"
},
"URLS": {
- "CUSTOM_EVENT_FETCH_RECORDINGS":"/custom_event/fetch_recordings?event_id=",
+ "CUSTOM_EVENT_FETCH_RECORDINGS": "/custom_event/fetch_recordings?event_id=",
"LEARNER_PREFIX": "/learner/",
+ "PROVIDE_ACCESS": "/learnathon/access/provide",
+ "CHECK_USER_ACCESS": "/learnathon/get/creators",
"DISCUSSIONS_FORUM_PREFIX": "/discussion/",
"DEVICE_PREFIX": "/device/",
"CERT_REG_PREFIX": "/certreg/",
@@ -144,6 +146,9 @@
"ATTACH_CERTIFICATE": "v1/template/add",
"CREATE_CERT_TEMPLATE": "asset/v1/create",
"UPLOAD_CERT_TEMPLATE": "asset/v1/upload"
+ "UPLOAD_CERT_TEMPLATE": "asset/v1/upload",
+ "CUSTOM_CERTIFICATE_CREATE": "/custom_event/certificate/create"
+
},
"COMPOSITE": {
"SEARCH": "composite/v1/search",
@@ -441,13 +446,19 @@
"USER_UPDATE": "/polls/user/update"
},
"FEEDBACK": {
- "CREATE" : "/custom_feedback/create",
- "LIST" : "/custom_feedback/list"
+ "CREATE": "/custom_feedback/create",
+ "LIST": "/custom_feedback/list"
},
- "NOTIFICATION" : {
+ "NOTIFICATION": {
"READ": "notification/v1/feed/read/",
- "UPDATE" : "notification/v1/feed/update",
- "DELETE" : "notification/v1/feed/delete"
+ "UPDATE": "notification/v1/feed/update",
+ "DELETE": "notification/v1/feed/delete"
+ },
+ "LEARNATHON": {
+ "LIST": "/learnathon/content/list",
+ "CREATE": "/learnathon/content/create",
+ "UPDATE": "/learnathon/content/update",
+ "DELETE": "/learnathon/content/delete"
}
}
}
diff --git a/packages/nulp_elite/src/pages/content/joinCourse.js b/packages/nulp_elite/src/pages/content/joinCourse.js
index 09823174..f1515584 100644
--- a/packages/nulp_elite/src/pages/content/joinCourse.js
+++ b/packages/nulp_elite/src/pages/content/joinCourse.js
@@ -162,10 +162,11 @@ const JoinCourse = () => {
setIsOwner(true);
}
let identifiers;
- if(data?.result?.content?.children[0]?.children){
- identifiers = data?.result?.content?.children[0]?.children[0]?.identifier;
- }else{
- identifiers = data?.result?.content?.children[0]?.identifier
+ if (data?.result?.content?.children[0]?.children) {
+ identifiers =
+ data?.result?.content?.children[0]?.children[0]?.identifier;
+ } else {
+ identifiers = data?.result?.content?.children[0]?.identifier;
}
console.log(identifiers, "setChildNode");
setChildNode(identifiers);
@@ -617,18 +618,20 @@ const JoinCourse = () => {
-
+
- {!isCompleted &&
+ onClick={() => handleLinkClick(childnode)}
+ className="custom-btn-primary mr-5"
+ >
+ {t("START_LEARNING")}
+
+ {!isCompleted && (
}
@@ -693,7 +696,9 @@ const JoinCourse = () => {
)}{" "}
diff --git a/packages/nulp_elite/src/pages/learnathon/LernSubmissionTable.js b/packages/nulp_elite/src/pages/learnathon/LernSubmissionTable.js
new file mode 100644
index 00000000..d9e92381
--- /dev/null
+++ b/packages/nulp_elite/src/pages/learnathon/LernSubmissionTable.js
@@ -0,0 +1,290 @@
+import React, { useState, useEffect } from "react";
+import {
+ Table,
+ TableBody,
+ TableCell,
+ TableContainer,
+ TableHead,
+ TableRow,
+ TablePagination,
+ Paper,
+ TextField,
+ Button,
+ IconButton,
+ Typography,
+ Box,
+ DialogActions,
+} from "@mui/material";
+import { useTranslation } from "react-i18next";
+
+import * as util from "../../services/utilService";
+import Dialog from "@mui/material/Dialog";
+import DialogContent from "@mui/material/DialogContent";
+import { Edit, Visibility, Delete } from "@mui/icons-material";
+import SearchIcon from "@mui/icons-material/Search";
+import submissions from "./lernSubmission.json";
+import { useNavigate, useLocation } from "react-router-dom";
+
+import Footer from "components/Footer";
+import Header from "components/header";
+
+const LernSubmissionTable = () => {
+ const { t } = useTranslation();
+ const navigate = useNavigate();
+ const [data, setData] = useState([]);
+ const [page, setPage] = useState(0);
+ const [rowsPerPage, setRowsPerPage] = useState(5);
+ const [totalRows, setTotalRows] = useState(0);
+ const [search, setSearch] = useState("");
+ const _userId = util.userId(); // Assuming util.userId() is defined
+ const urlConfig = require("../../configs/urlConfig.json");
+ const [dialogOpen, setDialogOpen] = useState(false);
+
+ const handleDialogOpen = () => {
+ setDialogOpen(true);
+ };
+
+ const routeConfig = require("../../configs/routeConfig.json");
+
+ useEffect(() => {
+ fetchData();
+ }, [page, rowsPerPage, search]);
+
+ const fetchData = async () => {
+ const assetBody = {
+ request: {
+ filters: {
+ created_by: _userId,
+ },
+ sort_by: {
+ created_on: "desc",
+ },
+ limit: rowsPerPage,
+ offset: page * rowsPerPage,
+ search: search,
+ },
+ };
+ try {
+ const response = await fetch(`${urlConfig.URLS.LEARNATHON.LIST}`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(assetBody),
+ });
+
+ if (!response.ok) {
+ throw new Error("Failed to fetch polls");
+ }
+
+ const result = await response.json();
+ console.log("suceesss----", result);
+ console.log(result.result);
+ setData(result.result.data);
+ setTotalRows(result.result.totalCount);
+ } catch (error) {
+ console.log("error---", error);
+ // setError(error.message);
+ } finally {
+ // setIsLoading(false);
+ }
+
+ // Example API endpoint with limit, offset, and search params
+ // const apiUrl = `https://api.example.com/submissions?limit=${rowsPerPage}&offset=${
+ // page * rowsPerPage
+ // }&search=${search}`;
+ // const response = await fetch(apiUrl);
+
+ // const result = await response.json();
+ // console.log(submissions);
+ // setData(submissions.result.data);
+ // setTotalRows(result.totalCount);
+ };
+
+ const handleSearchChange = (e) => {
+ setSearch(e.target.value);
+ setPage(0); // Reset to first page on search
+ };
+
+ const handleDialogClose = () => {
+ setDialogOpen(false);
+ };
+
+ const handleDeletePollConfirmed = async (id) => {
+ event.stopPropagation();
+ try {
+ const response = await fetch(
+ `${urlConfig.URLS.LEARNATHON.DELETE}?id=${id}`,
+ {
+ method: "DELETE",
+ }
+ );
+
+ if (!response.ok) {
+ throw new Error("Failed to fetch polls");
+ }
+
+ const result = await response.json();
+ console.log("suceesss----", result);
+ setDialogOpen(false);
+ } catch (error) {
+ console.log("error---", error);
+ // setError(error.message);
+ } finally {
+ // setIsLoading(false);
+ }
+ };
+
+ const deleteContent = async (id) => {
+ // show confirmation popup
+ };
+
+ const handlePageChange = (event, newPage) => {
+ setPage(newPage);
+ };
+
+ const handleRowsPerPageChange = (event) => {
+ setRowsPerPage(parseInt(event.target.value, 10));
+ setPage(0);
+ };
+
+ return (
+ <>
+
+
+
+ Learnathon Submissions List
+
+
+
+
+ ,
+ }}
+ size="small"
+ />
+
+
+
+
+
+
+ Name
+ Last Updated
+ Status
+ Actions
+
+
+
+ {data.map((row) => (
+
+ {row.title_of_submission}
+
+ {new Date(row.updated_on).toLocaleDateString()}
+
+
+ {row.status}
+
+
+ {row.status == "draft" && (
+
+ (window.location.href =
+ routeConfig.ROUTES.LEARNATHON.CREATELEARNCONTENT +
+ "?" +
+ row.learnathon_content_id)
+ }
+ >
+
+
+ )}
+ {
+
+ (window.location.href =
+ routeConfig.ROUTES.LEARNATHON.CREATELEARNCONTENT +
+ "?" +
+ row.learnathon_content_id)
+ }
+ >
+
+
+ }
+ {(row.status == "draft" || row.status == "review") && (
+ handleDialogOpen()}
+ >
+
+
+ )}
+
+
+ ))}
+
+
+
+
+
+
+
+
+ >
+ );
+};
+
+export default LernSubmissionTable;
diff --git a/packages/nulp_elite/src/pages/learnathon/lernCreatorForm.js b/packages/nulp_elite/src/pages/learnathon/lernCreatorForm.js
index ebc17224..40f5e01d 100644
--- a/packages/nulp_elite/src/pages/learnathon/lernCreatorForm.js
+++ b/packages/nulp_elite/src/pages/learnathon/lernCreatorForm.js
@@ -16,6 +16,15 @@ import {
import HelpOutlineIcon from "@mui/icons-material/HelpOutline";
import Footer from "components/Footer";
import Header from "components/header";
+const urlConfig = require("../../configs/urlConfig.json");
+import * as util from "../../services/utilService";
+import { v4 as uuidv4 } from "uuid";
+import { useNavigate, useLocation } from "react-router-dom";
+import Container from "@mui/material/Container";
+import InputLabel from '@mui/material/InputLabel';
+import FormControl from '@mui/material/FormControl';
+import Alert from '@mui/material/Alert';
+
// const [globalSearchQuery, setGlobalSearchQuery] = useState();
// // location.state?.globalSearchQuery || undefined
// const [searchQuery, setSearchQuery] = useState(globalSearchQuery || "");
@@ -27,36 +36,160 @@ const categories = [
];
const themes = [
- "NULP Domain 1",
- "NULP Domain 2",
- "NULP Domain 3",
- "NULP Domain 4",
- "NULP Domain 5",
- "NULP Domain 6",
- "NULP Domain 7",
- "NULP Domain 8",
- "NULP Domain 9",
- "NULP Domain 10",
- "Others",
+ "Solid Waste Management",
+ "Environment and Climate",
+ "WASH - Water, Sanitation and Hygiene",
+ "Urban Planning and Housing",
+ "Transport and Mobility",
+ "Social Aspects",
+ "Municipal Finance",
+ "General Administration",
+ "Governance and Urban Management",
+ "Miscellaneous/ Others",
];
const LernCreatorForm = () => {
+ const _userId = util.userId(); // Assuming util.userId() is defined
+ const [isEdit, setIsEdit] = useState(false);
+ const [isNotDraft, setIsNotDraft] = useState(false);
+ const [userInfo, setUserInfo] = useState();
+ const navigate = useNavigate();
+ const [errors, setErrors] = useState({});
+
const [formData, setFormData] = useState({
- userName: "",
+ user_name: "",
email: "",
- mobileNumber: "",
- submissionIcon: "",
- category: "",
- organisation: "",
- department: "",
- theme: "",
- title: "",
+ mobile_number: "",
+ icon: "",
+ category_of_participation: "",
+ name_of_organisation: "",
+ name_of_department_group: "",
+ indicative_theme: "",
+ other_indicative_themes: "",
+ title_of_submission: "",
description: "",
- file: null,
- consent: false,
- });
+ content_id: null,
+ consent_checkbox: false,
+ status: "",
+ created_by: _userId,
+ // "link_to_guidelines": "https://demo.com/guideline",
+ });
const [guidelineLink, setGuidelineLink] = useState("");
+ const location = useLocation();
+ const queryString = location.search;
+ let contentId = queryString.startsWith("?do_")
+ ? queryString.slice(1)
+ : undefined;
+ useEffect(() => {
+ fetchData();
+ getUserData();
+ }, [contentId]);
+
+ const fetchData = async () => {
+ const requestBody = {
+ request: {
+ filters: {
+ created_by: _userId,
+ learnathon_content_id: contentId,
+ },
+ },
+ };
+ if (contentId) {
+ try {
+ const response = await fetch(`${urlConfig.URLS.LEARNATHON.LIST}`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(requestBody),
+ });
+
+ if (!response.ok) {
+ throw new Error("Failed to fetch polls");
+ }
+
+ const result = await response.json();
+ setIsEdit(true);
+ const readResponse = result.result.data[0];
+ if (result.result.data[0].status != "draft") {
+ setIsNotDraft(true);
+ }
+ // Update formData with the response data
+ setFormData((prevFormData) => ({
+ ...prevFormData,
+ user_name: readResponse.user_name || "",
+ email: readResponse.email || "",
+ mobile_number: readResponse.mobile_number || "",
+ icon: readResponse.icon || "",
+ category_of_participation:
+ readResponse.category_of_participation || "",
+ name_of_organisation: readResponse.name_of_organisation || "",
+ name_of_department_group: readResponse.name_of_department_group || "",
+ indicative_theme: readResponse.indicative_theme || "",
+ other_indicative_themes: readResponse.other_indicative_themes || "",
+ title_of_submission: readResponse.title_of_submission || "",
+ description: readResponse.description || "",
+ content_id: readResponse.content_id || null,
+ consent_checkbox: readResponse.consent_checkbox || false,
+ status: readResponse.status || "",
+ created_by: readResponse.created_by || _userId, // assuming _userId is defined elsewhere
+ // If you want to include the link to guidelines:
+ // link_to_guidelines: readResponse.link_to_guidelines || "",
+ }));
+ } catch (error) {
+ console.log("error---", error);
+ // setError(error.message);
+ } finally {
+ // setIsLoading(false);
+ }
+ }
+ };
+
+ const validate = () => {
+ let tempErrors = {};
+
+ if (!formData.user_name) tempErrors.user_name = "User Name is required";
+ if (!formData.email) tempErrors.email = "Email is required";
+ else if (!/\S+@\S+\.\S+/.test(formData.email))
+ tempErrors.email = "Email is not valid";
+
+ if (!formData.mobile_number)
+ tempErrors.mobile_number = "Mobile Number is required";
+ else if (!/^\d{10}$/.test(formData.mobile_number))
+ tempErrors.mobile_number = "Mobile Number must be 10 digits";
+
+ if (!formData.category_of_participation)
+ tempErrors.category_of_participation =
+ "Category of Participation is required";
+ if (!formData.name_of_organisation)
+ tempErrors.name_of_organisation = "Name of Organisation is required";
+ if (!formData.indicative_theme)
+ tempErrors.indicative_theme = "Indicative Theme is required";
+ // if (!formData.other_indicative_theme) tempErrors.other_indicative_theme = "Indicative Theme is required";
+ if (!formData.title_of_submission)
+ tempErrors.title_of_submission = "Title of Submission is required";
+ if (!formData.description)
+ tempErrors.description = "Description is required";
+ if (!formData.content_id) tempErrors.content_id = "File upload is required";
+ if (!formData.consent_checkbox)
+ tempErrors.consent_checkbox = "You must accept the terms and conditions";
+
+ setErrors(tempErrors);
+ return Object.keys(tempErrors).length === 0;
+ };
+
+ const getUserData = async () => {
+ try {
+ const url = `${urlConfig.URLS.LEARNER_PREFIX}${urlConfig.URLS.USER.GET_PROFILE}${_userId}?fields=${urlConfig.params.userReadParam.fields}`;
+
+ const response = await fetch(url);
+ const data = await response.json();
+ setUserInfo(data.result.response);
+ } catch (error) {
+ console.error("Error while getting user data:", error);
+ }
+ };
const handleChange = (e) => {
const { name, value } = e.target;
@@ -64,302 +197,694 @@ const LernCreatorForm = () => {
...formData,
[name]: value,
});
+ setErrors({ ...errors, [name]: "" });
};
- const handleFileChange = (e) => {
- setFormData({
- ...formData,
- file: e.target.files[0],
- });
+ const handleIconChange = async (e) => {
+ const _uuid = uuidv4();
+ const assetBody = {
+ request: {
+ asset: {
+ primaryCategory: "asset",
+ language: ["English"],
+ code: _uuid,
+ name: e.target.files[0].name,
+ mediaType: "image",
+ mimeType: "image/png",
+ createdBy: _userId,
+ channel: userInfo.rootOrg.channel,
+ },
+ },
+ };
+ try {
+ const response = await fetch(`${urlConfig.URLS.ICON.CREATE}`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(assetBody),
+ });
+
+ if (!response.ok) {
+ throw new Error("Failed to fetch polls");
+ }
+
+ const result = await response.json();
+ console.log("suceesss----", result);
+
+ const uploadBody = {
+ request: {
+ content: {
+ fileName: e.target.files[0].name,
+ },
+ },
+ };
+ try {
+ const response = await fetch(
+ `${urlConfig.URLS.ICON.UPLOAD}${result.result.identifier}`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(uploadBody),
+ }
+ );
+
+ if (!response.ok) {
+ throw new Error("Failed to fetch polls");
+ }
+
+ const uploadResult = await response.json();
+ console.log("upload suceesss------", uploadResult);
+ setFormData({
+ ...formData,
+ icon: uploadResult.result.identifier,
+ });
+ setErrors({ ...errors, icon: "" });
+
+ // setData(result.result.data);
+ // setTotalPages(Math.ceil(result.result.totalCount / 10));
+ } catch (error) {
+ console.log("error---", error);
+ // setError(error.message);
+ } finally {
+ // setIsLoading(false);
+ }
+ } catch (error) {
+ console.log("error---", error);
+ // setError(error.message);
+ } finally {
+ // setIsLoading(false);
+ }
};
- const handleIconChange = (e) => {
- setFormData({
- ...formData,
- submissionIcon: e.target.files[0],
- });
+ const handleFileChange = async (e) => {
+ console.log("e.target.files[0]----", e.target.files[0]);
+ const _uuid = uuidv4();
+ const assetBody = {
+ request: {
+ content: {
+ primaryCategory: "Good Practices",
+ contentType: "Resource",
+ language: ["English"],
+ code: _uuid,
+ name: e.target.files[0].name,
+ mediaType: "image",
+ mimeType: e.target.files[0].type,
+ createdBy: _userId,
+ organisation: [userInfo.rootOrg.channel],
+ createdFor: [userInfo.rootOrg.id],
+ },
+ },
+ };
+ try {
+ const response = await fetch(`${urlConfig.URLS.ASSET.CREATE}`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(assetBody),
+ });
+
+ if (!response.ok) {
+ throw new Error("Failed to fetch polls");
+ }
+
+ const result = await response.json();
+ console.log("suceesss----", result);
+
+ const uploadBody = {
+ request: {
+ content: {
+ fileName: formData.title_of_submission,
+ },
+ },
+ };
+ try {
+ const response = await fetch(
+ `${urlConfig.URLS.ASSET.UPDATE}${result.result.identifier}`,
+ {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(uploadBody),
+ }
+ );
+
+ if (!response.ok) {
+ throw new Error("Failed to fetch polls");
+ }
+
+ const uploadResult = await response.json();
+ console.log("upload suceesss------", uploadResult);
+ setFormData({
+ ...formData,
+ content_id: uploadResult.result.identifier,
+ });
+ setErrors({ ...errors, content_id: "" });
+
+ // setData(result.result.data);
+ // setTotalPages(Math.ceil(result.result.totalCount / 10));
+ } catch (error) {
+ console.log("error---", error);
+ // setError(error.message);
+ } finally {
+ // setIsLoading(false);
+ }
+ } catch (error) {
+ console.log("error---", error);
+ // setError(error.message);
+ } finally {
+ // setIsLoading(false);
+ }
};
const handleCheckboxChange = (e) => {
setFormData({
...formData,
- consent: e.target.checked,
+ consent_checkbox: e.target.checked,
});
};
const handleCategoryChange = (e) => {
- const category = e.target.value;
- setFormData({ ...formData, category });
-
- // Set appropriate guideline link based on category
- if (category === "State / UT / SPVs / ULBs / Any Other") {
+ const category_of_participation = e.target.value;
+ setFormData({ ...formData, category_of_participation });
+ setErrors({ ...errors, category_of_participation: "" });
+ // Set appropriate guideline link based on category_of_participation
+ if (category_of_participation === "State / UT / SPVs / ULBs / Any Other") {
setGuidelineLink("link-to-state-guidelines.pdf");
- } else if (category === "Industry") {
+ } else if (category_of_participation === "Industry") {
setGuidelineLink("link-to-industry-guidelines.pdf");
- } else if (category === "Academia") {
+ } else if (category_of_participation === "Academia") {
setGuidelineLink("link-to-academia-guidelines.pdf");
} else {
setGuidelineLink("");
}
};
- const handleSubmit = (action) => {
- if (!formData.consent) {
+ const checkDraftValidations = () => {
+ let tempErrors = {};
+ if (!formData.user_name) tempErrors.user_name = "User Name is required";
+ if (!formData.title_of_submission)
+ tempErrors.title_of_submission = "Title of Submission is required";
+ setErrors(tempErrors);
+ return Object.keys(tempErrors).length === 0;
+ };
+ const handleSubmit = async (action) => {
+ if (!formData.consent_checkbox) {
alert("You must accept the terms and conditions.");
return;
}
+ formData.created_by = _userId;
// Handle form submission (draft or review)
console.log("Form submitted:", formData);
if (action === "draft") {
- alert("Saved as draft");
+ formData.status = "draft";
+ // Add validations
+
+ if (!checkDraftValidations()) return;
+
+ if (isEdit == false) {
+ try {
+ const response = await fetch(`${urlConfig.URLS.LEARNATHON.CREATE}`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(formData),
+ });
+
+ if (!response.ok) {
+ throw new Error("Failed to fetch polls");
+ }
+
+ const result = await response.json();
+ console.log("suceesss");
+ navigate("/webapp/mylernsubmissions");
+ // setData(result.result.data);
+ // setTotalPages(Math.ceil(result.result.totalCount / 10));
+ } catch (error) {
+ console.log("error---", error.message);
+ alert(error.message);
+ // setError(error.message);
+ } finally {
+ // setIsLoading(false);
+ }
+ } else if (isEdit == true) {
+ console.log("formData----", formData);
+ try {
+ const response = await fetch(
+ `${urlConfig.URLS.LEARNATHON.UPDATE}?id=${contentId}`,
+ {
+ method: "PUT",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(formData),
+ }
+ );
+
+ if (!response.ok) {
+ throw new Error("Failed to fetch polls");
+ }
+
+ const result = await response.json();
+ console.log("suceesss");
+ navigate("/webapp/mylernsubmissions");
+ // setData(result.result.data);
+ // setTotalPages(Math.ceil(result.result.totalCount / 10));
+ } catch (error) {
+ console.log("error---", error.message);
+ alert(error.message);
+ // setError(error.message);
+ } finally {
+ // setIsLoading(false);
+ }
+ }
+
+ console.log("Saved as draft");
} else if (action === "review") {
- alert("Sent for review");
+ formData.status = "review";
+ if (!validate()) return;
+
+ if (isEdit == false) {
+ try {
+ const response = await fetch(`${urlConfig.URLS.LEARNATHON.CREATE}`, {
+ method: "POST",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(formData),
+ });
+
+ if (!response.ok) {
+ throw new Error("Failed to fetch polls");
+ }
+
+ const result = await response.json();
+ console.log("suceesss");
+ // setData(result.result.data);
+ // setTotalPages(Math.ceil(result.result.totalCount / 10));
+ } catch (error) {
+ console.log("error---", error);
+ // setError(error.message);
+ } finally {
+ // setIsLoading(false);
+ }
+ } else {
+ try {
+ const response = await fetch(
+ `${urlConfig.URLS.LEARNATHON.UPDATE}?id=${contentId}`,
+ {
+ method: "PUT",
+ headers: {
+ "Content-Type": "application/json",
+ },
+ body: JSON.stringify(formData),
+ }
+ );
+
+ if (!response.ok) {
+ throw new Error("Failed to fetch polls");
+ }
+
+ const result = await response.json();
+ console.log("suceesss");
+ // setData(result.result.data);
+ // setTotalPages(Math.ceil(result.result.totalCount / 10));
+ } catch (error) {
+ console.log("error---", error);
+ // setError(error.message);
+ } finally {
+ // setIsLoading(false);
+ }
+ }
+
+ console.log("Sent for review");
}
};
return (
<>
-
-
-
- Upload Learnathon Submission
-
-
-
-
-
-
-
- Participant Details
-
-
-
+
+
+
+
+ Upload Learnathon Submission
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
+
+
+ Participant Details
+
-
- Submission Details
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {categories.map((option) => (
-
- ))}
-
- {guidelineLink && (
-
- View and Download Guidelines
-
- )}
+
+
+ User Name *
+
+
+
+
+
-
-
+
+
+ Email *
+
+
+
+
+
-
-
-
-
-
-
- {themes.map((theme) => (
-
- ))}
-
-
-
-
-
-
-
-
-
+
+
+
+ Mobile
Number *
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+ Submission Details
+
+
+
+
+
+ Submission Icon
+
+
-
+
+
+
+ Supported formats: MP4, PDF, HTML5, YouTube links
+
+
-
- }
- label="I accept the terms and conditions"
- />
-
-
+
+
+ Category of Participation *
+
+
+
+ {categories.map((option) => (
+
+ ))}
+
+
+
+
+ {guidelineLink && (
+
+ View and Download Guidelines
+
+ )}
+
+
+
+
+
+
+
+ Name of Organisation *
+
+
+
+
+
+
+
+
+
+ Name of Department/Group
+
+
+
+
+
+
+
+
+
+ Indicative Theme *
+
+
+
+ {themes.map((theme) => (
+
+ ))}
+
+
+
+
+
+
+
+ Title of Submission *
+
+
+
+
+
+
+
+
+
+ Description *
+
+
+
+
+
+
+
+
+
+ File Upload *
+
+
+
+
+
+ Supported formats: MP4, PDF, HTML5, YouTube links
+
+
+
+
+ }
+ label="Terms and conditions"
+ />
+
+
+
+
+
+
+
+ Your submission will be used for NULP purposes only and your personal details will not be disclosed to any entity.
+
+
+
+
+
+ handleSubmit("review")}
+ sx={{ ml: 2, padding: '9px 35px' }} // Adds spacing between the buttons
+ >
+ Submit
+
-
+
+
>
);
diff --git a/packages/nulp_elite/src/pages/learnathon/lernCreatorList.js b/packages/nulp_elite/src/pages/learnathon/lernCreatorList.js
deleted file mode 100644
index e69de29b..00000000
diff --git a/packages/nulp_elite/src/pages/learnathon/lernSubmission.json b/packages/nulp_elite/src/pages/learnathon/lernSubmission.json
new file mode 100644
index 00000000..5fe3451e
--- /dev/null
+++ b/packages/nulp_elite/src/pages/learnathon/lernSubmission.json
@@ -0,0 +1,142 @@
+{
+ "ts": "2024-10-07T12:29:26.592Z",
+ "params": {
+ "resmsgid": "caa3ec00-84a7-11ef-b085-3f76106a933c",
+ "msgid": "caa3ec01-84a7-11ef-b085-3f76106a933c",
+ "status": "Learnathon contents fetched successfully",
+ "err": null,
+ "errmsg": null
+ },
+ "responseCode": "OK",
+ "result": {
+ "totalCount": 6,
+ "data": [
+ {
+ "id": 11,
+ "learnathon_content_id": "do_1728275652639455299",
+ "user_name": "Mahesh",
+ "email": "1bf9e9fd16d5f6b9910bab15b4ed0cc0:f06503b30672a19b11bf2a75b95d37d3",
+ "mobile_number": "8c9e8e44841e196a79433e13e0e84bb4:d524b4f8dd7951719b8302e42b82f00f",
+ "category_of_participation": "Learnathon",
+ "link_to_guidelines": "https://demo.com/guideline",
+ "name_of_organisation": "NULP-Learn",
+ "name_of_department_group": "DEvelopment",
+ "indicative_theme": "Demo",
+ "title_of_submission": "Demo content",
+ "content_id": "do_233439874322324567",
+ "consent_checkbox": true,
+ "created_on": "2024-10-06T23:04:12.649Z",
+ "updated_on": "2024-10-06T23:04:12.649Z",
+ "created_by": "929a2476-f232-47af-8e65-87229d1d4952",
+ "poll_id": null,
+ "is_published": false,
+ "icon": "https://exampleicon.com"
+ },
+ {
+ "id": 10,
+ "learnathon_content_id": "do_1728275524591748024",
+ "user_name": "Mahesh",
+ "email": "e09fde0fc5003abedbc7a8a2fe30fba3:3de05332e8011d12537d828e52a0a853",
+ "mobile_number": "6c7b3c8f08f67b506e467a798ef6e6db:7eeafda740f20adec6295bfb02ba4723",
+ "category_of_participation": "Learnathon",
+ "link_to_guidelines": "https://demo.com/guideline",
+ "name_of_organisation": "NULP-Learn",
+ "name_of_department_group": "DEvelopment",
+ "indicative_theme": "Demo",
+ "title_of_submission": "Demo content",
+ "content_id": "do_233439874322324567",
+ "consent_checkbox": true,
+ "created_on": "2024-10-06T23:02:04.591Z",
+ "updated_on": "2024-10-06T23:02:04.591Z",
+ "created_by": "929a2476-f232-47af-8e65-87229d1d4952",
+ "poll_id": null,
+ "is_published": false,
+ "icon": null
+ },
+ {
+ "id": 9,
+ "learnathon_content_id": "do_1728275480480866116",
+ "user_name": "Mahesh",
+ "email": "3d30809d4d14278197a3464bf91a371a:47682f54e86a07afc9482e710cdd54d9",
+ "mobile_number": "c8b93b49d64ba0b289205dec686f880a:6f8a33dde0d1cc4083ef11d0602469b4",
+ "category_of_participation": "Learnathon",
+ "link_to_guidelines": "https://demo.com/guideline",
+ "name_of_organisation": "NULP-Learn",
+ "name_of_department_group": "DEvelopment",
+ "indicative_theme": "Demo",
+ "title_of_submission": "Demo content",
+ "content_id": "do_233439874322324566",
+ "consent_checkbox": true,
+ "created_on": "2024-10-06T23:01:20.490Z",
+ "updated_on": "2024-10-06T23:01:20.490Z",
+ "created_by": "929a2476-f232-47af-8e65-87229d1d4952",
+ "poll_id": null,
+ "is_published": false,
+ "icon": null
+ },
+ {
+ "id": 8,
+ "learnathon_content_id": "do_172804425702580603",
+ "user_name": "John Doe",
+ "email": "d6de43bfa5b30cf985a659125ab26066:432455393ac7f7a9ead978d63d8568210acf23b63f993dcbf7f20c6f92c276c2",
+ "mobile_number": "f51b957b78e674da3f7014c20edbac93:7cbbb3ddc4ae317e5a3446e4e48bc7c3",
+ "category_of_participation": "Technical",
+ "link_to_guidelines": "https://example.com/guidelines",
+ "name_of_organisation": "Tech Corp",
+ "name_of_department_group": "Engineering",
+ "indicative_theme": "Innovation",
+ "title_of_submission": "Next-gen AI solutions",
+ "content_id": "do_233439874322324566",
+ "consent_checkbox": true,
+ "created_on": "2024-10-04T06:47:37.032Z",
+ "updated_on": "2024-10-04T06:47:37.032Z",
+ "created_by": "929a2476-f232-47af-8e65-87229d1d4952",
+ "poll_id": null,
+ "is_published": false,
+ "icon": null
+ },
+ {
+ "id": 7,
+ "learnathon_content_id": "do_1728044116243117507",
+ "user_name": "John Doe",
+ "email": "d6de43bfa5b30cf985a659125ab26066:432455393ac7f7a9ead978d63d8568210acf23b63f993dcbf7f20c6f92c276c2",
+ "mobile_number": "f51b957b78e674da3f7014c20edbac93:7cbbb3ddc4ae317e5a3446e4e48bc7c3",
+ "category_of_participation": "Technical",
+ "link_to_guidelines": "https://example.com/guidelines",
+ "name_of_organisation": "Tech Corp",
+ "name_of_department_group": "Engineering",
+ "indicative_theme": "Innovation",
+ "title_of_submission": "Next-gen AI solutions",
+ "content_id": "do_233439874322324566",
+ "consent_checkbox": true,
+ "created_on": "2024-10-04T06:45:16.250Z",
+ "updated_on": "2024-10-04T06:45:16.250Z",
+ "created_by": "929a2476-f232-47af-8e65-87229d1d4952",
+ "poll_id": null,
+ "is_published": false,
+ "icon": null
+ },
+ {
+ "id": 6,
+ "learnathon_content_id": "do_172804161396294572",
+ "user_name": "John Doe",
+ "email": "d6de43bfa5b30cf985a659125ab26066:432455393ac7f7a9ead978d63d8568210acf23b63f993dcbf7f20c6f92c276c2",
+ "mobile_number": "f51b957b78e674da3f7014c20edbac93:7cbbb3ddc4ae317e5a3446e4e48bc7c3",
+ "category_of_participation": "Technical",
+ "link_to_guidelines": "https://example.com/guidelines",
+ "name_of_organisation": "Tech Corp",
+ "name_of_department_group": "Engineering",
+ "indicative_theme": "Innovation",
+ "title_of_submission": "Next-gen AI solutions",
+ "content_id": "do_233439874322324566",
+ "consent_checkbox": true,
+ "created_on": "2024-10-04T06:03:33.968Z",
+ "updated_on": "2024-10-04T06:03:33.968Z",
+ "created_by": "self",
+ "poll_id": null,
+ "is_published": false,
+ "icon": null
+ }
+ ]
+ }
+}
diff --git a/packages/nulp_elite/src/pages/search/DomainList.js b/packages/nulp_elite/src/pages/search/DomainList.js
index c59a1bd2..eb265f50 100644
--- a/packages/nulp_elite/src/pages/search/DomainList.js
+++ b/packages/nulp_elite/src/pages/search/DomainList.js
@@ -29,6 +29,8 @@ import SkeletonLoader from "components/skeletonLoader";
import FloatingChatIcon from "components/FloatingChatIcon";
import * as util from "../../services/utilService";
import { Loading } from "@shiksha/common-lib";
+import { Button } from '@mui/material';
+import axios from "axios";
const Item = styled(Paper)(({ theme }) => ({
@@ -68,17 +70,12 @@ const DomainList = ({ globalSearchQuery }) => {
const [domain, setDomain] = useState();
const [popularCourses, setPopularCourses] = useState([]);
const [recentlyAddedCourses, setRecentlyAddedCourses] = useState([]);
- const [orgId, setOrgId] = useState();
const [framework, setFramework] = useState();
+ const [roleList, setRoleList] = useState([]);
+ const [orgId,setOrgId] = useState([]);
const [searchQuery, setSearchQuery] = useState(globalSearchQuery || "");
- const [isModalOpen, setIsModalOpen] = useState(() => {
- // Check if the modal has been shown in the current session
- const isModalShown = sessionStorage.getItem('isModalShown');
- return isModalShown !== 'true'; // Show modal if not already shown
- });
-
const [lernUser, setLernUser] = useState([]);
const _userId = util.userId();
const fetchData = async () => {
@@ -87,6 +84,11 @@ const DomainList = ({ globalSearchQuery }) => {
const response = await fetch(url);
const data = await response.json();
const rolesData = data.result.response.channel;
+ const roles =data.result.response.roles;
+ const organizationId=roles[0]?.scope[0]?.organisationId;
+ const extractedRoles = roles.map(roleObj => roleObj.role);
+ setRoleList(extractedRoles);
+ setOrgId(organizationId);
setLernUser(rolesData);
} catch (error) {
console.error("Error fetching user data:", error);
@@ -100,6 +102,77 @@ const DomainList = ({ globalSearchQuery }) => {
}
}, [_userId]);
+ const checkAccess = async () => {
+ try {
+ const url = `${urlConfig.URLS.CHECK_USER_ACCESS}`;
+ const response = await fetch(url);
+ const data = await response.json();
+
+ const userID = data.result.data;
+ const user = userID.find((user) => user.user_id === _userId);
+
+ if (!user) {
+ console.log("User ID not found. Calling fetchUserAccess...");
+ fetchUserAccess();
+ } else if (user.creator_access === true) {
+ navigate('/webapp/mylernsubmissions');
+ console.log("User ID found with creator access. No need to call fetchUserAccess.");
+ } else if (user.creator_access === false) {
+ console.log("User ID found but no creator access. Calling fetchUserAccess...");
+ fetchUserAccess();
+ }
+ } catch (error) {
+ console.error("Error fetching user data:", error);
+ }
+ };
+
+
+ let responsecode;
+ const isCreator = roleList.includes("CONTENT_CREATOR");
+ const fetchUserAccess = async () => {
+ try {
+ const url = `${urlConfig.URLS.PROVIDE_ACCESS}`;
+ const role = isCreator ? roleList : ["CONTENT_CREATOR", ...roleList];
+ const requestPayload = {
+ request: {
+ organisationId: orgId,
+ roles: role,
+ userId: _userId,
+ },
+ };
+
+ if (isCreator) {
+ requestPayload.isCreator = true;
+ }
+
+ const response = await axios.post(url, requestPayload);
+ const data = await response.data;
+ const result = data.result.data.responseCode;
+
+ responsecode = result;
+ setResponseCode(result);
+
+ if (result === "OK") {
+ navigate('webapp/mylernsubmissions');
+ setIsModalOpen(false);
+ } else {
+ setToasterMessage("Something went wrong! Please try again later");
+ }
+ } catch (error) {
+ console.log('error', error);
+ }
+ };
+
+
+ const handleCheckUser = async () => {
+ if (lernUser === 'nulp-learn') {
+ navigate('/webapp/mylernsubmissions');
+ } else{
+ await checkAccess();
+ }
+ };
+
+
const showErrorMessage = (msg) => {
setToasterMessage(msg);
setTimeout(() => {
@@ -504,6 +577,46 @@ const DomainList = ({ globalSearchQuery }) => {
>
{error && {error}}
+
+
+
+
+
+
+ {t("LERN_title")}
+
+
+
+
+ {t("LERN_MESSAGE_LINE_TWO")}
+
+
+
+
+ {lernUser === 'nulp-learn' ? (
+
+ {t("PARTICIPATE_NOW")}
+
+ ) : (
+
+ {t("PARTICIPATE_NOW")}
+
+ )}
+
+
+
+ {toasterMessage && (
+
+
+
+ )}
+
+
+
+
+