Skip to content

Commit

Permalink
Merge pull request #697 from NIUANULP/main
Browse files Browse the repository at this point in the history
learnathon dev deployment
  • Loading branch information
paritshivani authored Oct 14, 2024
2 parents 63a27cc + b054b23 commit ec76e16
Show file tree
Hide file tree
Showing 18 changed files with 57 additions and 136 deletions.
3 changes: 2 additions & 1 deletion packages/nulp_elite/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,8 +326,9 @@ function App() {
/>
))}
</Routes>
<LernModal />
</Router>
<LernModal />

</React.Suspense>
{/* </ChakraProvider> */}
{/* </ChakraProvider> */}
Expand Down
12 changes: 11 additions & 1 deletion packages/nulp_elite/src/components/Footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,17 @@ export default function Footer() {
</Box>
</Box>
<Box
className="xs-hide footer"
className="xs-hide"
style={{
background: "#065872",
color: "#fff",
padding: "15px 15px 13px",
marginTop: "auto",
position: 'absolute',
bottom: '0px',
width:'100%',
boxSizing: 'border-box'
}}
>
<Grid container spacing={2}>
<Grid
Expand Down
2 changes: 1 addition & 1 deletion packages/nulp_elite/src/components/VotingDrawerFilter.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ const VotingDrawerFilter = ({ onFilterChange }) => {
</Box>
<FormControl>
<InputLabel htmlFor="outlined-adornment-search">
{t("SEARCH_FOR_A_POLL")}
{t("SEARCH_FOR_A_POLL")}
</InputLabel>
<OutlinedInput
id="outlined-adornment-search"
Expand Down
2 changes: 2 additions & 0 deletions packages/nulp_elite/src/configs/urlConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,10 @@
"ADD_CERTIFICATE": "v1/add/template",
"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",
Expand Down
2 changes: 1 addition & 1 deletion packages/nulp_elite/src/pages/FAQPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const FAQPage = () => {
return (
<div>
<Header />
<Box sx={{ height: 'calc(100vh - 210px)', overflowY:'auto' }}>
<Box>
{setLanguage && url && <Container maxWidth="xl" role="main" className="min-472 pb-30">
{error && (
<Alert severity="error" className="my-10">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1289,7 +1289,7 @@ const AddConnections = () => {
<Box>
<Header />
{toasterMessage && <ToasterCommon response={toasterMessage} />}
<Box sx={{ height: 'calc(100vh - 210px)', overflowY:'auto' }}>
<Box>
<Container maxWidth="xl" role="main" className="pt-0 xs-pb-62 pt-108">
{error && (
<Alert severity="error" className="my-10">
Expand Down
2 changes: 1 addition & 1 deletion packages/nulp_elite/src/pages/content/AllContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ const AllContent = () => {
<Header />
{toasterMessage && <ToasterCommon response={toasterMessage} />}

<Box sx={{ height: 'calc(100vh - 210px)', overflowY:'auto' }}
<Box
>
{domain ? (
<DomainCarousel onSelectDomain={handleDomainFilter} domains={domain} />
Expand Down
2 changes: 1 addition & 1 deletion packages/nulp_elite/src/pages/content/CategoryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ const CategoryPage = () => {
return (
<>
<Header />
<Box sx={{ height: 'calc(100vh - 210px)', overflowY:'auto' }}>
<Box>
{toasterMessage && <ToasterCommon response={toasterMessage} />}
{domain.length > 0 ? (
<DomainCarousel onSelectDomain={handleDomainFilter} domains={domain} selectedDomainCode={preselectedDomain}/>
Expand Down
11 changes: 6 additions & 5 deletions packages/nulp_elite/src/pages/content/joinCourse.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ const JoinCourse = () => {
setCourseData(data);
setUserData(data);
if (_userId == data?.result?.content?.createdBy) {
console.log("here");
setIsOwner(true);
}
let identifiers;
Expand Down Expand Up @@ -628,11 +629,11 @@ const JoinCourse = () => {
<Button
onClick={handleLeaveCourseClick} // Open confirmation dialog
className="custom-btn-danger xs-mt-10"
>
{" "}
{t("LEAVE_COURSE")}

> {t("LEAVE_COURSE")}

</Button>
)}
}
</Box>
</div>

Expand Down Expand Up @@ -995,7 +996,7 @@ const JoinCourse = () => {
<div>
<Header />
{toasterMessage && <ToasterCommon response={toasterMessage} />}
<Box sx={{ height: "calc(100vh - 210px)", overflowY: "auto" }}>
<Box>
<Snackbar
open={showEnrollmentSnackbar}
autoHideDuration={6000}
Expand Down
2 changes: 1 addition & 1 deletion packages/nulp_elite/src/pages/content/pdf.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const PDFContent = () => {
return (
<div>
<Header />
<Box sx={{ height: 'calc(100vh - 210px)', overflowY:'auto' }}>
<Box>
<Container maxWidth="md" role="main" className="container-pb">
<Grid container spacing={2}>
<Grid item xs={8}>
Expand Down
2 changes: 1 addition & 1 deletion packages/nulp_elite/src/pages/events/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ const Dashboard = () => {
return (
<div>
<Header />
<Box sx={{ height: 'calc(100vh - 210px)', overflowY:'auto' }}>
<Box>
<Container
maxWidth="xl"
role="main"
Expand Down
86 changes: 0 additions & 86 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 @@ -947,10 +865,6 @@ const formatTimeWithTimezone = (date) => {
type="button"
onClick={() => {
managePublicPrivateEvent("join");
// generateCertificate();
if(detailData.issueCerificate === "Yes"){
generateCertificate();
}
}}
// onClick={attendWebinar}
style={{
Expand Down
2 changes: 1 addition & 1 deletion packages/nulp_elite/src/pages/events/eventList.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ const EventList = (props) => {
<div>
<Header globalSearchQuery={globalSearchQuery} />
{toasterMessage && <ToasterCommon response={toasterMessage} />}
<Box sx={{ height: 'calc(100vh - 210px)', overflowY:'auto' }}>
<Box>
<Box>
{domainList && domainList.length > 0 ? (
<DomainCarousel
Expand Down
Loading

0 comments on commit ec76e16

Please sign in to comment.