Procházet zdrojové kódy

fiks CaseProgress pelaporan

andifebri před 3 roky
rodič
revize
e476fc2f24

+ 4 - 3
components/Pelaporan/CaseProgress.js

@@ -7,6 +7,7 @@ import Datatable from "@/components/Tables/Datatable";
 import { useState, useEffect } from "react";
 
 function CaseProgress({ data, nextButton, prevButton, tahun, newLaporan }) {
+	console.log(data);
 	const laporan_pertahun = data.laporan_perTahun;
 
 	const [chartData, setChartData] = useState([
@@ -19,7 +20,7 @@ function CaseProgress({ data, nextButton, prevButton, tahun, newLaporan }) {
 
 	useEffect(() => {
 		laporan_pertahun.forEach((e) => {
-			chartData[0].data.push([convertMonth(e._id.bulan), e.jumlah_laporan]);
+			chartData[0].data.push([convertMonth(e._id.bulan), data.jumlah_laporan.ditutup + data.jumlah_laporan.dikti + data.jumlah_laporan.lldikti]);
 		});
 	}, []);
 
@@ -71,12 +72,12 @@ function CaseProgress({ data, nextButton, prevButton, tahun, newLaporan }) {
 			{
 				label: "Pelaporan masuk",
 				color: "#287DAD",
-				data: 40,
+				data: [data.jumlah_laporan.ditutup + data.jumlah_laporan.dikti + data.jumlah_laporan.lldikti],
 			},
 			{
 				label: "Pelaporan selesai",
 				color: "#52D489",
-				data: 70,
+				data: [data.jumlah_laporan.ditutup],
 			},
 		],
 

+ 3 - 3
pages/app/pelaporan/index.js

@@ -22,20 +22,20 @@ class Pelaporan extends Component {
 
 	componentDidMount = async () => {
 		const pelaporan = await getPelaporan(this.props.token);
-		const graph = await getGraph(this.props.token, { laporanTahun: true, newLaporan: true });
+		const graph = await getGraph(this.props.token, { laporanTahun: true, newLaporan: true, jumlahLaporan: true });
 		const newLaporan = graph.data.newLaporan;
 		this.setState({ pelaporan, graph, newLaporan });
 	};
 
 	nextButton = async () => {
 		const tahun = this.state.tahun + 1;
-		const graph = await getGraph(this.props.token, { laporanTahun: true, tahun });
+		const graph = await getGraph(this.props.token, { laporanTahun: true, jumlahLaporan: true, tahun });
 		this.setState({ graph, tahun });
 	};
 
 	prevButton = async () => {
 		const tahun = this.state.tahun - 1;
-		const graph = await getGraph(this.props.token, { laporanTahun: true, tahun });
+		const graph = await getGraph(this.props.token, { laporanTahun: true, jumlahLaporan: true, tahun });
 		this.setState({ graph, tahun });
 	};