Skip to content

Commit

Permalink
Merge pull request #674 from mahajanmahesh935/category
Browse files Browse the repository at this point in the history
Task #228396 : [FE] Add the Ribbon on certificate card of course and …
  • Loading branch information
paritshivani authored Oct 7, 2024
2 parents 85b10be + fcd8343 commit 845bdcc
Showing 1 changed file with 29 additions and 14 deletions.
43 changes: 29 additions & 14 deletions packages/nulp_elite/src/pages/profile/certificate.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ const Certificate = () => {
const url = `${urlConfig.URLS.LEARNER_PREFIX}${urlConfig.URLS.CERTIFICATE.CERTIF_SEARCH}`;
const response = await axios.post(url, request);
const data = response.data;

setOtherCertData(data);
} catch (error) {
console.error("Error fetching user data:", error);
Expand Down Expand Up @@ -279,7 +280,7 @@ const Certificate = () => {
fontWeight: "600",
}}
>
{certificate._source.data.badge.name}
{certificate?._source?.data?.badge?.name}
</Typography>
<Typography
variant="subtitle1"
Expand All @@ -288,7 +289,7 @@ const Certificate = () => {
style={{ fontSize: "12px" }}
>
{t("CERTIFICATE_GIVEN_BY")}:{" "}
{certificate._source.data.badge.issuer.name}
{certificate?._source?.data?.badge?.issuer?.name}
</Typography>
<Typography
variant="subtitle1"
Expand All @@ -297,7 +298,7 @@ const Certificate = () => {
style={{ fontSize: "12px" }}
>
{t("CERTIFICATE_ISSUE_DATE")}:{" "}
{formatDate(certificate._source.data.issuedOn)}
{formatDate(certificate?._source?.data?.issuedOn)}
</Typography>
<Box
style={{
Expand All @@ -310,7 +311,7 @@ const Certificate = () => {
>
<SimCardDownloadOutlinedIcon />
<Link
href={certificate._source.pdfUrl}
href={certificate?._source?.pdfUrl}
underline="none"
style={{
fontSize: "12px",
Expand All @@ -319,8 +320,8 @@ const Certificate = () => {
}}
onClick={() => {
getCertificateReport(
certificate._id,
certificate._source.data.badge.name
certificate?._id,
certificate?._source?.data?.badge?.name
);
}}
>
Expand All @@ -331,7 +332,7 @@ const Certificate = () => {
</Grid>
))}
{otherCertData.map((certificate) => (
<Grid item xs={12} md={4} key={certificate.osid}>
<Grid item xs={12} md={4} key={certificate?.osid}>
<Card
sx={{
marginTop: "10px",
Expand All @@ -340,8 +341,21 @@ const Certificate = () => {
border: "solid 1px #EFEFEF",
boxShadow: "none",
color: "#484848",
position: 'relative',
}}
>
{certificate?.training?.type && (
<Typography
gutterBottom
variant="h7"
component="div"
className="ribbonCard"
marginTop={"-23px"}
>
<Box className="cardCourses">{certificate?.training?.type}</Box>
</Typography>
)}

<Typography
className="twoLineEllipsis"
variant="subtitle1"
Expand All @@ -352,17 +366,18 @@ const Certificate = () => {
paddingBottom: "0",
height: "42px",
fontWeight: "600",
marginTop : "27px"
}}
>
{certificate.training.name}
{certificate?.training?.name}
</Typography>
<Typography
variant="subtitle1"
color="text.secondary"
component="div"
style={{ fontSize: "12px" }}
>
{t("CERTIFICATE_GIVEN_BY")}: {certificate.issuer.name}
{t("CERTIFICATE_GIVEN_BY")}: {certificate?.issuer?.name}
</Typography>
<Typography
variant="subtitle1"
Expand All @@ -371,7 +386,7 @@ const Certificate = () => {
style={{ fontSize: "12px" }}
>
{t("CERTIFICATE_ISSUE_DATE")}:{" "}
{formatDate(certificate.osCreatedAt)}
{formatDate(certificate?.osCreatedAt)}
</Typography>
<Box
style={{
Expand All @@ -383,15 +398,15 @@ const Certificate = () => {
className="text-green"
onClick={() => {
getCertificate(
certificate.templateUrl,
certificate.osid,
certificate.training.name
certificate?.templateUrl,
certificate?.osid,
certificate?.training?.name
);
}}
>
<SimCardDownloadOutlinedIcon />
<Link
href={certificate.pdfUrl}
href={certificate?.pdfUrl}
underline="none"
style={{
fontSize: "12px",
Expand Down

0 comments on commit 845bdcc

Please sign in to comment.