diff --git a/src/components/Pages/Gangguan/Daftar/DGangguan_RecoveryTime.vue b/src/components/Pages/Gangguan/Daftar/DGangguan_RecoveryTime.vue
index 47e8182..03a0e66 100755
--- a/src/components/Pages/Gangguan/Daftar/DGangguan_RecoveryTime.vue
+++ b/src/components/Pages/Gangguan/Daftar/DGangguan_RecoveryTime.vue
@@ -1,5 +1,5 @@
- filterData(filters)" class="mb-4">
+ filterData()" class="mb-4">
(filters = value)"
:sla-options="[
@@ -22,10 +22,11 @@
+
-
@@ -312,8 +305,6 @@
-
-
diff --git a/src/components/Pages/Gangguan/Daftar/DGangguan_ResponseTime.vue b/src/components/Pages/Gangguan/Daftar/DGangguan_ResponseTime.vue
index 9f69b0f..5b5cd92 100755
--- a/src/components/Pages/Gangguan/Daftar/DGangguan_ResponseTime.vue
+++ b/src/components/Pages/Gangguan/Daftar/DGangguan_ResponseTime.vue
@@ -1,5 +1,5 @@
- filterData(filters)" class="mb-4">
+ filterData()" class="mb-4">
(filters = value)" />
diff --git a/src/report/Gangguan/Daftar/DGangguan_RecoveryTime.ts b/src/report/Gangguan/Daftar/DGangguan_RecoveryTime.ts
index 26f6a89..07c7a04 100644
--- a/src/report/Gangguan/Daftar/DGangguan_RecoveryTime.ts
+++ b/src/report/Gangguan/Daftar/DGangguan_RecoveryTime.ts
@@ -64,12 +64,13 @@ const formatMetaData = (reportMeta: any) => {
}
}
-const exportToPDF = (reportMeta: any, data: any) => {
+const exportToPDF = async (reportMeta: any, data: any) => {
const meta = formatMetaData(reportMeta)
const day = new Date().toLocaleString('id-ID', { weekday: 'long' })
const date = new Date().getDate()
const month = new Date().toLocaleString('id-ID', { month: 'long' })
const year = new Date().getFullYear()
+ const resultData = data.value.data
const doc = new jsPDF({
orientation: 'landscape'
})
@@ -150,7 +151,7 @@ const exportToPDF = (reportMeta: any, data: any) => {
'Posko'
]
],
- body: data.value.map((item: any, i: any) => [
+ body: resultData.map((item: any, i: any) => [
{ content: ++i, styles: { halign: 'right' } },
item.no_laporan,
item.waktu_lapor,
@@ -217,12 +218,19 @@ const exportToPDF = (reportMeta: any, data: any) => {
margin: { left: 230 }
})
- doc.save(`Laporan ${reportName}.pdf`, { returnPromise: true }).then(() => {
- console.log('pdf berhasil disimpan')
- })
+ await doc
+ .save(`Laporan ${reportName}.pdf`, { returnPromise: true })
+ .then(() => {
+ console.log('PDF Exported')
+ })
+ .catch((error) => {
+ console.error('Error while exporting PDF', error)
+ })
+
+ return true
}
-const exportToXLSX = (reportMeta: any, data: any, e: any) => {
+const exportToXLSX = async (reportMeta: any, e: any) => {
const meta = formatMetaData(reportMeta)
const workbook = new Workbook()
@@ -282,14 +290,11 @@ const exportToXLSX = (reportMeta: any, data: any, e: any) => {
worksheet.mergeCells('H7:J7')
worksheet.mergeCells('H8:J8')
- exportToExcel({
+ await exportToExcel({
component: e.component,
worksheet,
autoFilterEnabled: true,
- topLeftCell: { row: 11, column: 1 },
- loadPanel: {
- enabled: false
- }
+ topLeftCell: { row: 10, column: 1 }
}).then(() => {
workbook.xlsx.writeBuffer().then((buffer: any) => {
saveAs(new Blob([buffer], { type: 'application/octet-stream' }), `Laporan ${reportName}.xlsx`)
@@ -299,15 +304,16 @@ const exportToXLSX = (reportMeta: any, data: any, e: any) => {
e.cancel = true
}
-const exportToDOCX = (reportMeta: any, data: any) => {
+const exportToDOCX = async (reportMeta: any, data: any) => {
const day = new Date().toLocaleString('id-ID', { weekday: 'long' })
const date = new Date().getDate()
const month = new Date().toLocaleString('id-ID', { month: 'long' })
const year = new Date().getFullYear()
const meta = formatMetaData(reportMeta)
+ const resultData = data.value.data
const generateRows = () => {
- return data.value.map((item: any, i: any) => {
+ return resultData.map((item: any, i: any) => {
return new TableRow({
children: [
{ text: `${++i}`, field: 'no' },
@@ -553,10 +559,17 @@ const exportToDOCX = (reportMeta: any, data: any) => {
]
})
- Packer.toBlob(doc).then((blob) => {
- saveAs(blob, `Laporan ${reportName}.docx`)
- console.log('Document created successfully')
- })
+ await Packer.toBlob(doc)
+ .then((blob) => {
+ saveAs(blob, `Laporan ${reportName}.docx`)
+
+ console.log('DOCX Exported')
+ })
+ .catch((error) => {
+ console.error('Error while exporting DOCX', error)
+ })
+
+ return true
}
export { exportToPDF, exportToXLSX, exportToDOCX }
diff --git a/src/utils/api/api.graphql.ts b/src/utils/api/api.graphql.ts
index fc0367a..151c5a0 100755
--- a/src/utils/api/api.graphql.ts
+++ b/src/utils/api/api.graphql.ts
@@ -2507,6 +2507,58 @@ export const queries = {
}
}
`,
+ ssdaftarGangguanRecoveryTime: gql`
+ query ssdaftarGangguanRecoveryTime(
+ $dateFrom: Date!
+ $dateTo: Date!
+ $posko: Int!
+ $idUid: Int!
+ $idUp3: Int!
+ $minDurasiRecoveryTime: Int!
+ $maxDurasiRecoveryTime: Int!
+ $skip: Int
+ $take: Int
+ $requireTotalCount: Boolean
+ $sort: [SortInput]
+ $filter: [FilterInput]
+ ) {
+ ssdaftarGangguanRecoveryTime(
+ dateFrom: $dateFrom
+ dateTo: $dateTo
+ minDurasiRecoveryTime: $minDurasiRecoveryTime
+ maxDurasiRecoveryTime: $maxDurasiRecoveryTime
+ posko: $posko
+ idUid: $idUid
+ idUp3: $idUp3
+ skip: $skip
+ take: $take
+ requireTotalCount: $requireTotalCount
+ sort: $sort
+ filter: $filter
+ ) {
+ totalCount
+ data {
+ no_laporan
+ pembuat_laporan
+ waktu_lapor
+ waktu_response
+ waktu_recovery
+ durasi_response_time
+ durasi_recovery_time
+ status_akhir
+ is_marking
+ referensi_marking
+ idpel_nometer
+ nama_pelapor
+ alamat_pelapor
+ no_telp_pelapor
+ keterangan_pelapor
+ media
+ nama_posko
+ }
+ }
+ }
+ `,
melaporLebihDariSatuKaliDetail: gql`
query detailGangguanLaporLebihDariSatuKali($noLaporan: String!) {
detailGangguanLaporLebihDariSatuKali(noLaporan: $noLaporan) {