diff --git a/src/views/SimproV2/CreatedProyek/ViewProject.js b/src/views/SimproV2/CreatedProyek/ViewProject.js index ef36f74..9ad4b67 100644 --- a/src/views/SimproV2/CreatedProyek/ViewProject.js +++ b/src/views/SimproV2/CreatedProyek/ViewProject.js @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react' +import React, { useEffect, useState, useRef } from 'react' import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; import { Button } from 'reactstrap'; import moment from 'moment'; @@ -6,13 +6,18 @@ import 'antd/dist/antd.css'; import _ from 'underscore' import './style.css' import { formatThousand, sortBy } from '../../../const/CustomFunc'; -import { BASE_OSPRO } from "../../../const/ApiConst"; +import { BASE_OSPRO, PROYEK_SEARCH} from "../../../const/ApiConst"; +import { Tooltip } from 'antd'; +import { useTranslation } from 'react-i18next'; +import axios from "../../../const/interceptorApi" +import autoTable from "jspdf-autotable"; +import jsPDF from "jspdf"; const createMarkup = (element) => { return {__html: element}; } - const ViewProject = ({ openDialog, closeDialog, toggleDialog, projectCharter, projectParticipant, projectChecklist, projectIssue, projectRisk, projectMilestone, projectApproval, projectManager, projectK3, assignHR, projectImage }) => { + const ViewProject = ({ idTask, openDialog, closeDialog, toggleDialog, projectCharter, projectParticipant, projectChecklist, projectIssue, projectRisk, projectMilestone, projectApproval, projectManager, projectK3, assignHR, projectImage }) => { const [proyekName, setProyekName] = useState("") const [description, setDescription] = useState("") const [shortname, setKodeShortname] = useState("") @@ -41,6 +46,17 @@ const createMarkup = (element) => { const [K3Search, setDataK3Search] = useState("") const [HR, setAssignHR] = useState("") const formatDate = "DD-MM-YYYY"; + const reportTemplateRef = useRef(null); + const { t } = useTranslation(); + const token = localStorage.getItem("token"); + + const HEADER = { + headers: { + "Content-Type": "application/json", + Authorization: `Bearer ${token}`, + }, + }; + useEffect(() => { if(!openDialog){ setProyekName("") @@ -73,7 +89,7 @@ const createMarkup = (element) => { }, [openDialog]); useEffect(() => { - if(projectCharter && projectCharter!={}){ + if (projectCharter && projectCharter != {}) { setProyekName(projectCharter.nama); setDescription(projectCharter.keterangan); setKodeShortname(projectCharter.kode_sortname); @@ -156,6 +172,20 @@ const createMarkup = (element) => { } }, [assignHR]); + const handleExportPdf = async () => { + const doc = new jsPDF({ + orientation: 'landscape', + unit: 'px', + format: [1130, 1000] + }); + + doc.html(reportTemplateRef.current, { + async callback(doc) { + await doc.save('Project Charter'); + }, + }); + }; + const RenderParticipant = () => { if(participants && participants.length > 0){ return ( @@ -353,26 +383,17 @@ const createMarkup = (element) => { marginLeft: '5pt', marginTop: '2pt', marginBottom: '2pt', - fontFamily: 'Arial', fontSize: '10pt', fontWeight: 'bold', }; - const italicStyle = { - fontStyle: 'italic' - }; - const boldStyle = { - fontWeight: 'bold', - fontVariant: 'small-caps', - }; - const emptyCellStyle = { padding: '0', }; const renderForm = () => { return ( -
- 2.0 OBJEKTIF PROYEK (TUJUAN) +2.0 OBJEKTIF PROYEK (TUJUAN) |
||
- {objectives ?? '-'} +{objectives ?? '-'} |
||
- 3.0 RUANG LINGKUP PROYEK +3.0 RUANG LINGKUP PROYEK |
||
---|---|---|
- 4.0 ANGGOTA PROYEK +4.0 ANGGOTA PROYEK |
||
- 5.0 STRUKTUR ORGANISASI +5.0 STRUKTUR ORGANISASI |
||
- 6.0 TARGET UTAMA & MILESTONE PENCAPAIAN +6.0 TARGET UTAMA & MILESTONE PENCAPAIAN |
||
- 7.0 ISU & HAMBATAN UTAMA +7.0 ISU & HAMBATAN UTAMA |
||
*Skala 1 ke 7 (1 = kecil, 7 = besar)
+*Skala 1 ke 7 (1 = kecil, 7 = besar)
- 8.0 RESIKO +8.0 RESIKO |
||
*Skala 1 ke 7 (1 = kecil, 7 = besar)
+*Skala 1 ke 7 (1 = kecil, 7 = besar)