|
|
|
@ -763,25 +763,25 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
Sortname: n.kode_sortname ? n.kode_sortname : "", |
|
|
|
|
"Nama Project": n.nama ? n.nama : "", |
|
|
|
|
"Tanggal Mulai": n.mulai_proyek |
|
|
|
|
? moment(n.mulai_proyek).format(format) |
|
|
|
|
: "-", |
|
|
|
|
? moment(n.mulai_proyek).format(format) |
|
|
|
|
: "-", |
|
|
|
|
"Tanggal Selesai": n.akhir_proyek |
|
|
|
|
? moment(n.akhir_proyek).format(format) |
|
|
|
|
: "-", |
|
|
|
|
? moment(n.akhir_proyek).format(format) |
|
|
|
|
: "-", |
|
|
|
|
"Area Kerja": n.area_kerja ? n.area_kerja : "", |
|
|
|
|
Perusahaan: n.company ? n.company : "", |
|
|
|
|
Keterangan: n.keterangan ? n.keterangan : "", |
|
|
|
|
"Dianggap sukses ketika": n.considered_success_when |
|
|
|
|
? n.considered_success_when |
|
|
|
|
: "", |
|
|
|
|
? n.considered_success_when |
|
|
|
|
: "", |
|
|
|
|
"Tujuan Proyek": n.project_objectives ? n.project_objectives : "", |
|
|
|
|
"Resiko potensial": n.potential_risk ? n.potential_risk : "", |
|
|
|
|
"Rencana Biaya": n.rencana_biaya |
|
|
|
|
? formatThousand(n.rencana_biaya) |
|
|
|
|
: "-", |
|
|
|
|
? formatThousand(n.rencana_biaya) |
|
|
|
|
: "-", |
|
|
|
|
"Testing Environment": n.testing_environment |
|
|
|
|
? n.testing_environment |
|
|
|
|
: "-", |
|
|
|
|
? n.testing_environment |
|
|
|
|
: "-", |
|
|
|
|
}; |
|
|
|
|
excelData.push(dataRow); |
|
|
|
|
}); |
|
|
|
@ -791,33 +791,45 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
} |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
const handleExportPdf = () => { |
|
|
|
|
const handleExportPdf = async () => { |
|
|
|
|
const doc = new jsPDF(); |
|
|
|
|
|
|
|
|
|
const headers = [ |
|
|
|
|
["Project Name", "Budget", "Project Type", "PM", "Time Project"], |
|
|
|
|
]; |
|
|
|
|
const data = dataTable.map((elt) => [ |
|
|
|
|
elt.nama, |
|
|
|
|
`Rp. ${formatThousand(elt.rencana_biaya)}`, |
|
|
|
|
elt.join_second_name, |
|
|
|
|
elt.join_first_name, |
|
|
|
|
`${moment(elt.mulai_proyek).format(format)} - ${moment( |
|
|
|
|
elt.akhir_proyek |
|
|
|
|
).format(format)}`,
|
|
|
|
|
]); |
|
|
|
|
// Or use javascript directly:
|
|
|
|
|
doc.text(4, 15, "Project Charter"); |
|
|
|
|
autoTable(doc, { |
|
|
|
|
startY: 20, |
|
|
|
|
margin: { horizontal: 4 }, |
|
|
|
|
styles: { overflow: "linebreak", columnWidth: "auto", fontSize: 8 }, |
|
|
|
|
columnStyles: { text: { columnWidth: "auto" } }, |
|
|
|
|
head: headers, |
|
|
|
|
body: data, |
|
|
|
|
}); |
|
|
|
|
const payload = { |
|
|
|
|
paging: { start: 0, length: -1 }, |
|
|
|
|
joins: [], |
|
|
|
|
orders: { columns: ["id"], ascending: false }, |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
doc.save("table.pdf"); |
|
|
|
|
const result = await axios |
|
|
|
|
.post(PROYEK_SEARCH, payload, HEADER) |
|
|
|
|
.then((res) => res) |
|
|
|
|
.catch((error) => error.response); |
|
|
|
|
if (result && result.data && result.data.code == 200) { |
|
|
|
|
let resData = result.data.data; |
|
|
|
|
const data = resData.map((elt) => [ |
|
|
|
|
elt.nama, |
|
|
|
|
`Rp. ${formatThousand(elt.rencana_biaya)}`, |
|
|
|
|
elt.join_second_name, |
|
|
|
|
elt.join_first_name, |
|
|
|
|
`${moment(elt.mulai_proyek).format(format)} - ${moment( |
|
|
|
|
elt.akhir_proyek |
|
|
|
|
).format(format)}`,
|
|
|
|
|
]); |
|
|
|
|
// Or use javascript directly:
|
|
|
|
|
doc.text(4, 15, "Project Charter"); |
|
|
|
|
autoTable(doc, { |
|
|
|
|
startY: 20, |
|
|
|
|
margin: { horizontal: 4 }, |
|
|
|
|
styles: { overflow: "linebreak", columnWidth: "auto", fontSize: 8 }, |
|
|
|
|
columnStyles: { text: { columnWidth: "auto" } }, |
|
|
|
|
head: headers, |
|
|
|
|
body: data, |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
doc.save("Project.pdf"); |
|
|
|
|
// const unit = "pt";
|
|
|
|
|
// const size = "A4"; // Use A1, A2, A3 or A4
|
|
|
|
|
// const orientation = "portrait"; // portrait or landscape
|
|
|
|
@ -1321,12 +1333,12 @@ const CreatedProyek = ({ params, ...props }) => {
|
|
|
|
|
</Button> |
|
|
|
|
</> |
|
|
|
|
} |
|
|
|
|
// visible={visible}
|
|
|
|
|
// onVisibleChange={handleVisibleChange}
|
|
|
|
|
// visible={visible}
|
|
|
|
|
// onVisibleChange={handleVisibleChange}
|
|
|
|
|
> |
|
|
|
|
<Button |
|
|
|
|
style={{ marginLeft: "5px" }} |
|
|
|
|
// onClick={() => handleExportExcel()}
|
|
|
|
|
// onClick={() => handleExportExcel()}
|
|
|
|
|
> |
|
|
|
|
<i className="fa fa-print"></i> |
|
|
|
|
</Button> |
|
|
|
|