From 5b7ac30589ed181f336b2c2ee44f3fb5872cba4f Mon Sep 17 00:00:00 2001 From: "Kemas M. Aryadary Rasyad" <112590882+aryadary0706@users.noreply.github.com> Date: Fri, 3 Jul 2026 20:18:52 +0700 Subject: [PATCH] [TEST DONE] Checking Sertification generation for mentor/admin and view on intern --- index.html | 8 +- package.json | 2 + .../internify/intern/InternCertDetail.tsx | 28 +++---- .../intern/components/CertificateAvailabe.tsx | 2 +- .../intern/components/CertificateHistory.tsx | 13 +--- .../components/CertificateNotAvailable.tsx | 16 ++-- .../intern/components/SidebarIntern.tsx | 2 +- .../intern/components/TaskForm-file.tsx | 2 +- .../mentor/components/SidebarMentor.tsx | 2 +- .../components/StatusSubmissionTable.tsx | 22 ++++-- src/Pages/utils/Certificates.ts | 40 +++++++--- src/Pages/utils/SertificateGenerator.ts | 71 ++++++++++++++--- src/Pages/utils/testlayout.html | 78 ++++++++++++------- src/index.css | 2 +- 14 files changed, 189 insertions(+), 99 deletions(-) diff --git a/index.html b/index.html index ca99a96..f66e2df 100644 --- a/index.html +++ b/index.html @@ -1,10 +1,16 @@ - + Internify | Humic Engineering + + +
diff --git a/package.json b/package.json index 2d47eb2..8086d26 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "jspdf": "^4.2.1", "jszip": "^3.10.1", "lucide-react": "^0.553.0", + "qrcode": "^1.5.4", "react": "^18.2.0", "react-dom": "^18.2.0", "react-froala-wysiwyg": "^4.5.2", @@ -34,6 +35,7 @@ "devDependencies": { "@eslint/js": "^9.25.0", "@types/node": "^25.9.1", + "@types/qrcode": "^1.5.6", "@types/react": "^19.1.2", "@types/react-dom": "^19.1.2", "@typescript-eslint/eslint-plugin": "^8.54.0", diff --git a/src/Pages/internify/intern/InternCertDetail.tsx b/src/Pages/internify/intern/InternCertDetail.tsx index dbe43e9..e34c7ce 100644 --- a/src/Pages/internify/intern/InternCertDetail.tsx +++ b/src/Pages/internify/intern/InternCertDetail.tsx @@ -5,10 +5,10 @@ import CertificateAvailable from "./components/CertificateAvailabe"; import CertificateNotAvailable from "./components/CertificateNotAvailable"; import SertificateHistory from "./components/CertificateHistory"; -import { useClaimCertificate } from "../../../hooks/useCertificates"; +// import { useClaimCertificate } from "../../../hooks/useCertificates"; import { useProjectDetail } from "../../../hooks/useProjects"; -import { useProjectCertificates } from "../../../hooks/useCertificates"; +import { useMyCertificates } from "../../../hooks/useCertificates"; import type { Project } from "../../../types/project.types"; export default function InternCertificateDetail () { @@ -17,8 +17,8 @@ export default function InternCertificateDetail () { const projectFromList = location.state?.project as Project | undefined; const { project: projectDetail, loading: projectLoading } = useProjectDetail(slug ?? ""); - const { certificates, loading: certLoading, refetch: refetchCertificates } = useProjectCertificates(projectDetail?.id ?? 0); - const { claim, loading: claiming, error: claimError } = useClaimCertificate(); + const { certificates, loading: certLoading, refetch: refetchCertificates } = useMyCertificates(); + // const { claim, loading: claiming, error: claimError } = useClaimCertificate(); const myCertificateForProject = useMemo(() => { if (!projectDetail) return null; @@ -43,13 +43,13 @@ export default function InternCertificateDetail () { const remainingTasks = project ? project.total_tasks - project.task_done : 0; const isLoading = projectLoading || certLoading; - const handleClaim = async () => { - if (!project?.id) return; - const result = await claim(project.id); - if (result) { - refetchCertificates(); - } - }; + // const handleClaim = async () => { + // if (!project?.id) return; + // const result = await claim(project.id); + // if (result) { + // refetchCertificates(); + // } + // }; if (isLoading) { return ( @@ -78,9 +78,9 @@ export default function InternCertificateDetail () { progress={progress} remainingTasks={remainingTasks} allTasksDone={allTasksDone} - onClaim={handleClaim} - claiming={claiming} - claimError={claimError} + // onClaim={handleClaim} + // claiming={claiming} + // claimError={claimError} /> )} diff --git a/src/Pages/internify/intern/components/CertificateAvailabe.tsx b/src/Pages/internify/intern/components/CertificateAvailabe.tsx index c1df8f8..f058cc5 100644 --- a/src/Pages/internify/intern/components/CertificateAvailabe.tsx +++ b/src/Pages/internify/intern/components/CertificateAvailabe.tsx @@ -22,7 +22,7 @@ export default function CertificateAvailable({ project, certificate, templateUrl useEffect(() => { if (!templateUrl) return; - generateCertificate(resolveImageUrl(templateUrl), certificate.user.full_name) + generateCertificate(resolveImageUrl(templateUrl), certificate.user.full_name, certificate.project.project_name, certificate.certificate_no, certificate.uuid) .then((blob) => { const url = URL.createObjectURL(blob); setPreviewUrl(url); diff --git a/src/Pages/internify/intern/components/CertificateHistory.tsx b/src/Pages/internify/intern/components/CertificateHistory.tsx index 38048c9..7ee991b 100644 --- a/src/Pages/internify/intern/components/CertificateHistory.tsx +++ b/src/Pages/internify/intern/components/CertificateHistory.tsx @@ -1,12 +1,10 @@ -import { useNavigate } from "react-router-dom"; import { History, Loader2, AlertCircle } from "lucide-react"; import type { Certificate } from "../../../../types/certificate.types"; import { useMyCertificates } from "../../../../hooks/useCertificates"; export default function SertificateHistory() { - const navigate = useNavigate(); const { certificates, loading, error } = useMyCertificates(); - const displayed = certificates.slice(0, 2); + const displayed = certificates.slice(0, 3); return (
@@ -56,15 +54,6 @@ export default function SertificateHistory() { ))}
)} - -
- -
); } \ No newline at end of file diff --git a/src/Pages/internify/intern/components/CertificateNotAvailable.tsx b/src/Pages/internify/intern/components/CertificateNotAvailable.tsx index dfb346b..173e708 100644 --- a/src/Pages/internify/intern/components/CertificateNotAvailable.tsx +++ b/src/Pages/internify/intern/components/CertificateNotAvailable.tsx @@ -5,18 +5,18 @@ interface CertificateNotAvailableProps { progress: number; remainingTasks: number; allTasksDone?: boolean; - onClaim: () => void; - claiming: boolean; - claimError: string | null; + // onClaim: () => void; + // claiming: boolean; + // claimError: string | null; } export default function CertificateNotAvailable({ progress, remainingTasks, allTasksDone = false, - onClaim, - claiming, - claimError, + // onClaim, + // claiming, + // claimError, }: CertificateNotAvailableProps) { return (
@@ -54,14 +54,14 @@ export default function CertificateNotAvailable({
- - {claimError &&

{claimError}

} + {claimError &&

{claimError}

} */} ) : ( <> diff --git a/src/Pages/internify/intern/components/SidebarIntern.tsx b/src/Pages/internify/intern/components/SidebarIntern.tsx index 93e5abb..94959e2 100644 --- a/src/Pages/internify/intern/components/SidebarIntern.tsx +++ b/src/Pages/internify/intern/components/SidebarIntern.tsx @@ -65,7 +65,7 @@ export default function SidebarIntern({ isOpen, closeSidebar }: SidebarProps) { {/* Main nav */}