Skip to content

Commit

Permalink
Merge pull request #686 from NIUANULP/main
Browse files Browse the repository at this point in the history
prod deployment - Oct 10
  • Loading branch information
paritshivani authored Oct 10, 2024
2 parents 55eb39a + 13d24b6 commit db607bf
Show file tree
Hide file tree
Showing 12 changed files with 342 additions and 326 deletions.
19 changes: 12 additions & 7 deletions packages/nulp_elite/src/components/header.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,9 +216,9 @@ function Header({ globalSearchQuery }) {
boxShadow: searchQuery ? '0 2px 4px rgba(0, 0, 0, 0.2)' : 'none',
color: searchQuery ? '#fff' : "#000"
};
const handleLogout =() => {
sessionStorage.setItem('isModalShown', 'false');
}
const handleLogout = () => {
sessionStorage.setItem('isModalShown', 'false');
}
return (
<>
<Box
Expand Down Expand Up @@ -615,9 +615,9 @@ const handleLogout =() => {
</MenuItem>
</Link>
<Link href="/logoff" underline="none" textAlign="center"
onClick={handleLogout}>
onClick={handleLogout}>
<MenuItem>


{t("LOGOUT")}

Expand Down Expand Up @@ -738,6 +738,11 @@ const handleLogout =() => {
>
<MenuItem value="en">{t("ENGLISH")}</MenuItem>
<MenuItem value="hi">{t("HINDI")}</MenuItem>
<MenuItem value="ma">{t("MARATHI")}</MenuItem>
<MenuItem value="gg">{t("GUJARATI")}</MenuItem>
<MenuItem value="ta">{t("TAMIL")}</MenuItem>
<MenuItem value="be">{t("BENGALI")}</MenuItem>
<MenuItem value="mal">{t("MALAYALAM")}</MenuItem>
</Select>
</FormControl>
</Box>
Expand Down Expand Up @@ -873,9 +878,9 @@ const handleLogout =() => {
className="ml-10"
onClick={() => {
sessionStorage.setItem("urlPath", "learningreport");
window.open(routeConfig.ROUTES.LEARNING_REPORT, "_blank");
window.open(routeConfig.ROUTES.LEARNING_REPORT, "_blank");
}}
style={{color:'#1976d2'}}
style={{ color: '#1976d2' }}
>
{t("LEARNING_REPORT")}
</MenuItem>
Expand Down
5 changes: 2 additions & 3 deletions packages/nulp_elite/src/components/learnathon/LernModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ const LernModal = () => {

const [lernUser, setLernUser] = useState([]);
const _userId = util.userId();

const handleClose = () => {
setIsModalOpen(false);
sessionStorage.setItem('isModalShown', 'true'); // Set flag to not show modal again
Expand Down Expand Up @@ -53,7 +52,7 @@ const LernModal = () => {
p: 4,
overflow: "auto",
};

console.log(lernUser,'lernUser form modal');
return (
<div>
<Modal
Expand Down Expand Up @@ -84,7 +83,7 @@ const LernModal = () => {
</Typography>
</Box>
<Box className='lg-mt-30'>
{lernUser === 'nulp-lern' ? (
{lernUser === 'nulp-learn' ? (
<a class="viewAll">{t("CREATE_CONTENT")}</a>
) : (
<a class="viewAll">{t("REQUEST_TO_CREATE")}</a>
Expand Down
3 changes: 1 addition & 2 deletions packages/nulp_elite/src/configs/urlConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,7 @@
"ADD_CERTIFICATE": "v1/add/template",
"ATTACH_CERTIFICATE": "v1/template/add",
"CREATE_CERT_TEMPLATE": "asset/v1/create",
"UPLOAD_CERT_TEMPLATE": "asset/v1/upload",
"CUSTOM_CERTIFICATE_CREATE": "/custom_event/certificate/create"
"UPLOAD_CERT_TEMPLATE": "asset/v1/upload"
},
"COMPOSITE": {
"SEARCH": "composite/v1/search",
Expand Down
9 changes: 6 additions & 3 deletions packages/nulp_elite/src/pages/content/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,17 +261,20 @@ const updateContentStateForAssessment = async () => {
return (
<div>
<Header />
<Box sx={{ height: 'calc(100vh - 210px)', overflowY:'auto' }}>
<Box>
<Container maxWidth="xl" role="main" className="player mt-15">
<Grid container spacing={2} className="mt-10 mb-30">
<Grid item xs={12} md={12} lg={12}>
<Box
className="d-flex mr-20 my-20 px-10"
style={{ alignItems: "center",justifyContent:'space-between' }}
>
<Link onClick={handleBackNavigation} className="viewAll mr-17 mt-10">
<Button
onClick={handleBackNavigation}
className="custom-btn-primary mr-17 mt-15"
>
{t("BACK")}
</Link>
</Button>
</Box>
</Grid>
<Grid item xs={12} md={9} lg={9}>
Expand Down
37 changes: 19 additions & 18 deletions packages/nulp_elite/src/pages/content/joinCourse.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,12 @@ const JoinCourse = () => {
console.log("here");
setIsOwner(true);
}
const identifiers =
data?.result?.content?.children[0]?.children[0]?.identifier;
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
}
console.log(identifiers, "setChildNode");
setChildNode(identifiers);

Expand Down Expand Up @@ -612,21 +616,20 @@ const JoinCourse = () => {
{t("BACK")}
</Button>
</Box>
<Box>
{" "}

<Box>
<Button
onClick={() => handleLinkClick(childnode)}
className="custom-btn-primary mr-5"
>
{t("START_LEARNING")}
</Button>
{!isCompleted && (
onClick={() => handleLinkClick(childnode)}
className="custom-btn-primary mr-5"
>
{t("START_LEARNING")}
</Button>
{!isCompleted &&
<Button
onClick={handleLeaveCourseClick} // Open confirmation dialog
className="custom-btn-danger"
>
{" "}
{t("LEAVE_COURSE")}
className="custom-btn-danger xs-mt-10"
> {t("LEAVE_COURSE")}

</Button>
)}
</Box>
Expand Down Expand Up @@ -690,10 +693,8 @@ const JoinCourse = () => {
{!isCompleted && (
<Button
onClick={handleLeaveCourseClick} // Open confirmation dialog
className="custom-btn-danger"
>
{" "}
{t("LEAVE_COURSE")}
className="custom-btn-danger xs-mt-10"
> {t("LEAVE_COURSE")}
</Button>
)}{" "}
</Box>
Expand Down
107 changes: 10 additions & 97 deletions packages/nulp_elite/src/pages/events/eventDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,6 @@ const EventDetails = () => {
const [isChecked, setIsChecked] = useState(false);
const [open, setOpen] = React.useState(false);
const [recording, setRecording] = useState();
const [batchCertData,setBatchCertData] = useState();
const [isCertificateIssued , setIsCertificateIssued] = useState(true)
const [isAllreadyFilledRegistation,setIsAlreadyFilledRegistration] = useState(true)
const [isExpired , setIsExpired] = useState(false)
const handleClickOpen = () => {
Expand Down Expand Up @@ -288,8 +286,6 @@ const formatTimeWithTimezone = (date) => {
getUserData(_userId, "loggedIn");
fetchMyEvents();
getEventRecording();
fetchData();
checkCertificateAlreadyIssued();
// checkEnrolledCourse();
}, [_userId, eventId]);

Expand All @@ -312,7 +308,6 @@ const formatTimeWithTimezone = (date) => {

const { result } = response.data;
const { response: batchResponse } = result;
setBatchCertData(response.data.result)

if (batchResponse && batchResponse.count === 0) {
showErrorMessage(t("This course has no active Batches"));
Expand Down Expand Up @@ -460,83 +455,6 @@ const formatTimeWithTimezone = (date) => {
});
};

const fetchData = async () => {
try {
const url = `${urlConfig.URLS.LEARNER_PREFIX}${urlConfig.URLS.USER.GET_PROFILE}${_userId}?fields=${urlConfig.params.userReadParam.fields}`;

const header = "application/json";
const response = await fetch(url, {
// headers: {
// "Content-Type": "application/json",
// },
});
const data = await response.json();
setUserData(data);
} catch (error) {
console.error("Error fetching user data:", error);
showErrorMessage(t("FAILED_TO_FETCH_DATA"));
}
};

const checkCertificateAlreadyIssued = async () => {
try{
const url = `${urlConfig.URLS.LEARNER_PREFIX}${urlConfig.URLS.CERTIFICATE.CERTIF_SEARCH}`;
const requestBody = {
filters: {
recipient: {
id: {
eq: _userId
}
}
}
}
const resopnse = await axios.post(url, requestBody);
setIsCertificateIssued(resopnse.data.some((item) => item.training?.id === eventId));

}catch(error){
console.log("error While calling API ");
}

}

const generateCertificate = async () => {
const templateId = Object.keys(batchCertData?.response?.content[0]["certTemplates"])[0];
const certificateDetails = batchCertData?.response?.content[0]["certTemplates"][templateId];
try {
const url = `${urlConfig.URLS.CERTIFICATE.CUSTOM_CERTIFICATE_CREATE}`;
const requestBody = {
recipient: {
id: _userId,
name: userData?.result?.response?.firstName + " " + userData?.result?.response?.lastName,
type: "user",
},
issuer: certificateDetails?.issuer,
training: {
id: detailData?.identifier,
name: detailData?.name,
type: "Event",
batchId: batchData?.batchId,
},
templateUrl:
certificateDetails?.url,
status: "ACTIVE",
signatoryList:
certificateDetails?.signatoryList,
certificateLabel: "test",
issuedOn: new Date().toISOString(),
};
if(!isCertificateIssued){
const response = await axios.post(url, requestBody);
if(response.data.responseCode === "OK"){
setIsCertificateIssued(true)
}
}
} catch (error) {
console.error("Error creating certificate:", error);
}
};


const managePublicPrivateEvent = (button) => {
if (eventVisibility && eventVisibility === "Public" && button === "reg") {
handleOpenConsentModal();
Expand Down Expand Up @@ -770,7 +688,7 @@ const formatTimeWithTimezone = (date) => {
<div>
<Header />
{toasterMessage && <ToasterCommon response={toasterMessage} />}
<Box sx={{ height: 'calc(100vh - 210px)', overflowY:'auto' }}>
<Box>
<Snackbar
open={showEnrollmentSnackbar}
autoHideDuration={6000}
Expand Down Expand Up @@ -838,7 +756,7 @@ const formatTimeWithTimezone = (date) => {
spacing={2}
className="bg-whitee custom-event-container mb-20 custom-container mb-38"
>
<Grid item xs={3} md={6} lg={2}>
<Grid item xs={12} md={6} lg={2}>
<img
src={
detailData.appIcon
Expand All @@ -849,10 +767,10 @@ const formatTimeWithTimezone = (date) => {
alt="App Icon"
/>
</Grid>
<Grid item xs={9} md={6} lg={6} className="lg-pl-60 xs-pl-30">
<Grid item xs={12} md={6} lg={6} className="lg-pl-60">
<Typography
gutterBottom
className="mt-10 h1-title mb-20 xs-pl-15"
className="mt-10 h1-title mb-20"
>
{detailData.name}
</Typography>
Expand All @@ -878,20 +796,20 @@ const formatTimeWithTimezone = (date) => {
</Box>

<Box className="d-flex mb-20 h3-custom-title xs-hide">
<Box className="d-flex jc-bw alignItems-center pr-5">
<Box className="d-flex alignItems-center pr-5">
<TodayOutlinedIcon className="h3-custom-title pr-5" />
{formatDate(detailData.startDate)}
</Box>
<Box className="d-flex jc-bw alignItems-center pl-10 pr-5">
<Box className="d-flex alignItems-center pl-10 pr-5">
<AccessAlarmsOutlinedIcon className="h3-custom-title pr-5" />
{formatTimeToIST(detailData.startTime)}
</Box>
<Box className="mx-10">To</Box>
<Box className="d-flex jc-bw alignItems-center pl-5 pr-5">
<Box className="d-flex alignItems-center pl-5 pr-5">
<TodayOutlinedIcon className="h3-custom-title pr-5" />
{formatDate(detailData.endDate)}
</Box>
<Box className="d-flex jc-bw alignItems-center pl-10 pr-5">
<Box className="d-flex alignItems-center pl-10 pr-5">
<AccessAlarmsOutlinedIcon className="h3-custom-title pr-5" />
{formatTimeToIST(detailData.endTime)}
</Box>
Expand Down Expand Up @@ -947,10 +865,6 @@ const formatTimeWithTimezone = (date) => {
type="button"
onClick={() => {
managePublicPrivateEvent("join");
// generateCertificate();
if(detailData.issueCerificate === "Yes"){
generateCertificate();
}
}}
// onClick={attendWebinar}
style={{
Expand Down Expand Up @@ -1341,7 +1255,6 @@ const formatTimeWithTimezone = (date) => {
top: "50%",
left: "50%",
transform: "translate(-50%, -50%)",
width: 1000,
bgcolor: "background.paper",
border: "2px solid #000",
boxShadow: 24,
Expand Down Expand Up @@ -1431,14 +1344,14 @@ const formatTimeWithTimezone = (date) => {
/>
<Box sx={{ mt: 2 }} style={{ textAlign: "right" }}>
<Button
className="custom-btn-primary"
className="custom-btn-primary xs-mb-10"
onClick={handleSubmit}
disabled={!isChecked}
>
{t("SUBMIT")}
</Button>
<Button
className="custom-btn-default"
className="custom-btn-default "
onClick={handleCloseConsentModal}
sx={{ ml: 2 }}
>
Expand Down
Loading

0 comments on commit db607bf

Please sign in to comment.