fix: file name when lihat laporan

This commit is contained in:
kur0nek-o
2024-03-30 13:17:01 +07:00
parent 021088afe1
commit 2f399e53c3
13 changed files with 95 additions and 14 deletions

View File

@@ -89,10 +89,14 @@ const formatData = (rawData: any) => {
data[id_fasilitas][i].sub_kelompok,
formatNumber(data[id_fasilitas][i].total),
formatNumber(data[id_fasilitas][i].total_selesai),
formatPercentage((data[id_fasilitas][i].total_selesai / data[id_fasilitas][i].total) * 100),
formatPercentage(
!data[id_fasilitas][i].total_selesai || !data[id_fasilitas][i].total
? '0%'
: (data[id_fasilitas][i].total_selesai / data[id_fasilitas][i].total) * 100
),
formatNumber(data[id_fasilitas][i].total_inproses),
formatPercentage(
data[id_fasilitas][i].total_inproses == null || data[id_fasilitas][i].total == null
!data[id_fasilitas][i].total_inproses || !data[id_fasilitas][i].total
? '0%'
: (data[id_fasilitas][i].total_inproses / data[id_fasilitas][i].total) * 100
),
@@ -147,9 +151,17 @@ const formatData = (rawData: any) => {
{ content: 'TOTAL', colSpan: 3, styles: { fontStyle: 'bold' } },
formatNumber(total.total_laporan),
formatNumber(total.total_laporan_sudah_selesai),
formatPercentage((total.total_laporan_sudah_selesai / total.total_laporan) * 100),
formatPercentage(
!total.total_laporan_sudah_selesai || !total.total_laporan
? '0%'
: (total.total_laporan_sudah_selesai / total.total_laporan) * 100
),
formatNumber(total.total_laporan_belum_selesai),
formatPercentage((total.total_laporan_belum_selesai / total.total_laporan) * 100),
formatPercentage(
!total.total_laporan_belum_selesai || !total.total_laporan
? '0%'
: (total.total_laporan_belum_selesai / total.total_laporan) * 100
),
formatNumber(total.total_response_time_total),
formatNumber(
total.total_response_time_rata_rata.length
@@ -179,9 +191,17 @@ const formatData = (rawData: any) => {
{ content: 'GRAND TOTAL', colSpan: 3, styles: { fontStyle: 'bold' } },
formatNumber(grandTotal.total_laporan),
formatNumber(grandTotal.total_laporan_sudah_selesai),
formatPercentage((grandTotal.total_laporan_sudah_selesai / grandTotal.total_laporan) * 100),
formatPercentage(
!grandTotal.total_laporan_sudah_selesai || !grandTotal.total_laporan
? '0%'
: (grandTotal.total_laporan_sudah_selesai / grandTotal.total_laporan) * 100
),
formatNumber(grandTotal.total_laporan_belum_selesai),
formatPercentage((grandTotal.total_laporan_belum_selesai / grandTotal.total_laporan) * 100),
formatPercentage(
!grandTotal.total_laporan_belum_selesai || !grandTotal.total_laporan
? '0%'
: (grandTotal.total_laporan_belum_selesai / grandTotal.total_laporan) * 100
),
formatNumber(grandTotal.total_response_time_total),
formatNumber(
grandTotal.total_response_time_rata_rata.length
@@ -435,6 +455,9 @@ const exportToPDF = (reportMeta: any, rawData: any, preview: boolean = false) =>
})
if (preview) {
doc.setProperties({
title: `${reportName}`
})
window.open(doc.output('bloburl'))
} else {
doc.save(`Laporan ${reportName}.pdf`, { returnPromise: true }).then(() => {