소스 검색

commit bae deh

yazid138 3 년 전
부모
커밋
5679e85e4b
4개의 변경된 파일95개의 추가작업 그리고 90개의 파일을 삭제
  1. 10 0
      actions/pelaporan.js
  2. 4 4
      components/Layout/Menu.js
  3. 10 0
      components/Layout/MenuLLDIKTI.js
  4. 71 86
      components/Riwayat/ChartDataBar.js

+ 10 - 0
actions/pelaporan.js

@@ -95,6 +95,16 @@ export const updateLaporan = async (token, id, data) => {
 	}
 };
 
+export const jumlahLaporan = async (token) => {
+	try {
+		const res = await axiosAPI.get(`/laporan/jumlah`, { headers: { Authorization: token } });
+		return res.data;
+	} catch (error) {
+		console.log("error", error.response.data);
+		return false;
+	}
+};
+
 // export const activeLaporan = async ({ number, ptId }) => {
 // 	try {
 // 		const res = await put(`/pelaporan/active?number=${number}&ptId=${ptId}`);

+ 4 - 4
components/Layout/Menu.js

@@ -82,16 +82,16 @@ const Menu = [
 		icon: "icon-graph",
 		translate: "sidebar.nav.PEMANTAUAN_PERBAIKAN",
 	},
+	{
+		heading: "Analytics Report",
+		translate: "sidebar.heading.ANALYTICS_REPORT",
+	},
 	{
 		name: "Riwayat",
 		path: "/app/riwayat",
 		icon: "icon-graph",
 		translate: "sidebar.nav.PEMANTAUAN_PERBAIKAN",
 	},
-	{
-		heading: "Analytics Report",
-		translate: "sidebar.heading.ANALYTICS_REPORT",
-	},
 ];
 
 export default Menu;

+ 10 - 0
components/Layout/MenuLLDIKTI.js

@@ -76,6 +76,16 @@ const Menu = [
 		icon: "icon-shield",
 		translate: "sidebar.nav.PENCABUTAN_SANKSI",
 	},
+	{
+		heading: "Analytics Report",
+		translate: "sidebar.heading.ANALYTICS_REPORT",
+	},
+	{
+		name: "Riwayat",
+		path: "/app/riwayat",
+		icon: "icon-graph",
+		translate: "sidebar.nav.PEMANTAUAN_PERBAIKAN",
+	},
 ];
 
 export default Menu;

+ 71 - 86
components/Riwayat/ChartDataBar.js

@@ -1,96 +1,81 @@
 import React, { Component } from "react";
 import ContentWrapper from "@/components/Layout/ContentWrapper";
 import { Container, Row, Col, Card, CardHeader, CardBody } from "reactstrap";
-
+import { connect } from "react-redux";
+import { jumlahLaporan } from "@/actions/pelaporan";
 import dynamic from "next/dynamic";
 const ReactApexChart = dynamic(() => import("react-apexcharts"), { ssr: false });
 
 class ChartDataBar extends React.Component {
-  constructor(props) {
-    super(props);
+	constructor(props) {
+		super(props);
+
+		this.state = {
+			series: [
+				{
+					data: [44, 55, 41, 64, 22, 43, 21, 44, 42, 67, 43, 86, 42, 99, 131, 313],
+				},
+			],
+			options: {
+				chart: {
+					type: "bar",
+					height: 430,
+				},
+				plotOptions: {
+					bar: {
+						horizontal: true,
+						dataLabels: {
+							position: "top",
+						},
+					},
+				},
+				chart: {
+					toolbar: {
+						show: true,
+						tools: {
+							download: false,
+						},
+					},
+				},
+				colors: ["#B2B0D2"],
+				dataLabels: {
+					enabled: true,
+					offsetX: -6,
+					style: {
+						fontSize: "12px",
+						colors: ["#333333"],
+					},
+				},
+				stroke: {
+					show: true,
+					width: 1,
+					colors: ["#fff"],
+				},
+				tooltip: {
+					shared: true,
+					intersect: false,
+				},
+				xaxis: {
+					categories: ["I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX", "X", "XI", "XII", "XIII", "XIV", "XV", "XVI"],
+				},
+			},
+		};
+	}
 
-    this.state = {
-      series: [
-        {
-          data: [
-            44, 55, 41, 64, 22, 43, 21, 44, 42, 67, 43, 86, 42, 99, 131, 313,
-          ],
-        },
-      ],
-      options: {
-        chart: {
-          type: "bar",
-          height: 430,
-        },
-        plotOptions: {
-          bar: {
-            horizontal: true,
-            dataLabels: {
-              position: "top",
-            },
-          },
-        },
-        chart: {
-          toolbar: {
-            show: true,
-            tools: {
-              download: false,
-            },
-          },
-        },
-        colors: ["#B2B0D2"],
-        dataLabels: {
-          enabled: true,
-          offsetX: -6,
-          style: {
-            fontSize: "12px",
-            colors: ["#333333"],
-          },
-        },
-        stroke: {
-          show: true,
-          width: 1,
-          colors: ["#fff"],
-        },
-        tooltip: {
-          shared: true,
-          intersect: false,
-        },
-        xaxis: {
-          categories: [
-            "I",
-            "II",
-            "III",
-            "IV",
-            "V",
-            "VI",
-            "VII",
-            "VIII",
-            "IX",
-            "X",
-            "XI",
-            "XII",
-            "XIII",
-            "XIV",
-            "XV",
-            "XVI",
-          ],
-        },
-      },
-    };
-  }
+	async componentDidMount() {
+		const { token } = this.props;
+		const data = await jumlahLaporan(token);
+		console.log(data.data);
+	}
 
-  render() {
-    return (
-      <div id="chart">
-        <ReactApexChart
-          options={this.state.options}
-          series={this.state.series}
-          type="bar"
-          height={430}
-        />
-      </div>
-    );
-  }
+	render() {
+		return (
+			<div id="chart">
+				<ReactApexChart options={this.state.options} series={this.state.series} type="bar" height={430} />
+			</div>
+		);
+	}
 }
-export default ChartDataBar;
+
+const MapStateToProps = (state) => ({ token: state.token });
+export default connect(MapStateToProps)(ChartDataBar);