浏览代码

fix dashboard

andi 2 年之前
父节点
当前提交
4680538aea

+ 1 - 1
components/Maps/jquery-jvectormap.id.js

@@ -1,6 +1,6 @@
 /**
  * Indonesia Map for jVectorMap
- *
+ *https://github.com/davchezt/indonesia-map-for-jvectormap
  * Copyright 2017, Leonardo DaVchezt
  * Licensed under the MIT license.
  *

+ 2 - 3
components/Riwayat/ChartDataBar.js

@@ -2,7 +2,6 @@ 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 { getjumlahStatusLaporan } from "@/actions/graph";
 import dynamic from "next/dynamic";
 const ReactApexChart = dynamic(() => import("react-apexcharts"), { ssr: false });
@@ -72,14 +71,14 @@ class ChartDataBar extends React.Component {
 
 	async componentDidMount() {
 		const { token } = this.props;
-		const data = await jumlahLaporan(token);
+		const data = await getjumlahStatusLaporan(token);
 		this.setState((prevState) => ({
 			...prevState,
 			series: [{ data: data.data.map((e) => e.jumlah_laporan), name: "jumlah laporan" }],
 			options: {
 				...prevState.options,
 				xaxis: {
-					categories: data.data.map((e) => e._id),
+					categories: data.data.map((e) => e.pembina.name),
 				},
 			},
 		}));

+ 0 - 1
components/Riwayat/ChartRadarA.js

@@ -2,7 +2,6 @@ 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";
 import { getjumlahStatusLaporan } from "../../actions/graph";
 const ReactApexChart = dynamic(() => import("react-apexcharts"), { ssr: false });

+ 127 - 16
components/Riwayat/Maps.js

@@ -10,6 +10,43 @@ const defaultColors = {
     scaleColors: ["#146804", "#ff0000"],
     regionFill: '#bbbec6'
 };
+
+const init = {
+    'LLDIKTI I': 'ID_su',
+    'LLDIKTI II': 'ID_ss',
+    'LLDIKTI II': 'ID_la',
+    'LLDIKTI II': 'ID_be',
+    'LLDIKTI II': 'ID_bb',
+    'LLDIKTI III': 'ID_jk',
+    'LLDIKTI IV': 'ID_jb',
+    'LLDIKTI IV': 'ID_bt',
+    'LLDIKTI V': 'ID_yo',
+    'LLDIKTI VI': 'ID_jt',
+    'LLDIKTI VII': 'ID_jl',
+    'LLDIKTI VIII': 'ID_ba',
+    'LLDIKTI VIII': 'ID_nb',
+    'LLDIKTI IX': 'ID_sg',
+    'LLDIKTI IX': 'ID_sn',
+    'LLDIKTI IX': 'ID_sr',
+    'LLDIKTI X': 'ID_sb',
+    'LLDIKTI X': 'ID_ri',
+    'LLDIKTI X': 'ID_kr',
+    'LLDIKTI X': 'ID_ja',
+    'LLDIKTI XI': 'ID_ks',
+    'LLDIKTI XI': 'ID_kb',
+    'LLDIKTI XI': 'ID_ki',
+    'LLDIKTI XI': 'ID_kt',
+    'LLDIKTI XI': 'ID_ku',
+    'LLDIKTI XII': 'ID_ma',
+    'LLDIKTI XII': 'ID_mu',
+    'LLDIKTI XIII': 'ID_ac',
+    'LLDIKTI XIV': 'ID_pa',
+    'LLDIKTI XIV': 'ID_pb',
+    'LLDIKTI XV': 'ID_nt',
+    'LLDIKTI XVI': 'ID_go',
+    'LLDIKTI XVI': 'ID_st',
+    'LLDIKTI XVI': 'ID_sa',
+}
 const RegionValues = {
     'ID_su': 0,
     'ID_su': 0,
@@ -124,6 +161,42 @@ const LLDIKTI = {
 class Maps extends Component {
 
     state = {
+        LLDIKTI: {
+            'ID_su': '<h5>LLDIKTI Wilayah I</h5>',
+            'ID_ss': '<h5>LLDIKTI Wilayah II</h5>',
+            'ID_la': '<h5>LLDIKTI Wilayah II</h5>',
+            'ID_be': '<h5>LLDIKTI Wilayah II</h5>',
+            'ID_bb': '<h5>LLDIKTI Wilayah II</h5>',
+            'ID_jk': '<h5>LLDIKTI Wilayah III</h5>',
+            'ID_jb': '<h5>LLDIKTI Wilayah IV</h5>',
+            'ID_bt': '<h5>LLDIKTI Wilayah IV</h5>',
+            'ID_yo': '<h5>LLDIKTI Wilayah V</h5>',
+            'ID_jt': '<h5>LLDIKTI Wilayah VI</h5>',
+            'ID_jl': '<h5>LLDIKTI Wilayah VII</h5>',
+            'ID_ba': '<h5>LLDIKTI Wilayah VIII</h5>',
+            'ID_nb': '<h5>LLDIKTI Wilayah VIII</h5>',
+            'ID_sg': '<h5>LLDIKTI Wilayah IX</h5>',
+            'ID_sn': '<h5>LLDIKTI Wilayah IX</h5>',
+            'ID_sr': '<h5>LLDIKTI Wilayah IX</h5>',
+            'ID_sb': '<h5>LLDIKTI Wilayah X</h5>',
+            'ID_ri': '<h5>LLDIKTI Wilayah X</h5>',
+            'ID_kr': '<h5>LLDIKTI Wilayah X</h5>',
+            'ID_ja': '<h5>LLDIKTI Wilayah X</h5>',
+            'ID_ks': '<h5>LLDIKTI Wilayah XI</h5>',
+            'ID_kb': '<h5>LLDIKTI Wilayah XI</h5>',
+            'ID_ki': '<h5>LLDIKTI Wilayah XI</h5>',
+            'ID_kt': '<h5>LLDIKTI Wilayah XI</h5>',
+            'ID_ku': '<h5>LLDIKTI Wilayah XI</h5>',
+            'ID_ma': '<h5>LLDIKTI Wilayah XII</h5>',
+            'ID_mu': '<h5>LLDIKTI Wilayah XII</h5>',
+            'ID_ac': '<h5>LLDIKTI Wilayah XIII</h5>',
+            'ID_pa': '<h5>LLDIKTI Wilayah XIV</h5>',
+            'ID_pb': '<h5>LLDIKTI Wilayah XIV</h5>',
+            'ID_nt': '<h5>LLDIKTI Wilayah XV</h5>',
+            'ID_go': '<h5>LLDIKTI Wilayah XVI</h5>',
+            'ID_st': '<h5>LLDIKTI Wilayah XVI</h5>',
+            'ID_sa': '<h5>LLDIKTI Wilayah XVI</h5>',
+        },
         series: {
             regions: [{
                 values: RegionValues,
@@ -133,21 +206,8 @@ class Maps extends Component {
         },
         markers: [
 
-            // { latLng: [0.293347, 101.706825], name: 'aceh' },
+
             // { latLng: [4.695135, 96.749397], name: 'ID_ac' },
-            // { latLng: [-0.52, 166.93], name: 'Nauru' },
-            // { latLng: [-8.51, 179.21], name: 'Tuvalu' },
-            // { latLng: [7.11, 171.06], name: 'Marshall Islands' },
-            // { latLng: [17.3, -62.73], name: 'Saint Kitts and Nevis' },
-            // { latLng: [3.2, 73.22], name: 'Maldives' },
-            // { latLng: [35.88, 14.5], name: 'Malta' },
-            // { latLng: [41.0, -71.06], name: 'New England' },
-            // { latLng: [12.05, -61.75], name: 'Grenada' },
-            // { latLng: [13.16, -59.55], name: 'Barbados' },
-            // { latLng: [17.11, -61.85], name: 'Antigua and Barbuda' },
-            // { latLng: [-4.61, 55.45], name: 'Seychelles' },
-            // { latLng: [7.35, 134.46], name: 'Palau' },
-            // { latLng: [42.5, 1.51], name: 'Andorra' }
         ],
         options: {
             map: 'id_ID',
@@ -183,10 +243,61 @@ class Maps extends Component {
                     stroke: defaultColors.markerColor
                 }
             },
-            onRegionLabelShow: (e, el, code) => {
-                el.html(LLDIKTI[code] + el.html() + ' : ' + RegionValues[code] + ' pelaporan');
+            onRegionLabelShow: (event, code, region) => {
+                console.log(this.state.RegionValues, RegionValues[region])
+                code.html(this.state.LLDIKTI[region] + code.html() + ' : ' + this.state.RegionValues[region] + ' pelaporan');
+
+
             }
         }
+    }
+    async componentDidMount() {
+        const { token } = this.props;
+        const data = await jumlahLaporan(token);
+        const empat = "16"
+        // console.log(data.data.filter(e => e._id.includes('LLDIKTI')))
+        this.setState({
+            RegionValues: {
+                'ID_su': 0,
+                'ID_su': 0,
+                'ID_ss': 0,
+                'ID_la': 0,
+                'ID_be': 0,
+                'ID_bb': 0,
+                'ID_jk': 0,
+                'ID_jb': 0,
+                'ID_bt': 0,
+                'ID_yo': 0,
+                'ID_jt': 0,
+                'ID_jl': 0,
+                'ID_ba': 0,
+                'ID_nb': 0,
+                'ID_sg': 0,
+                'ID_sn': 0,
+                'ID_sr': 0,
+                'ID_sb': 0,
+                'ID_ri': 0,
+                'ID_kr': 0,
+                'ID_ja': 0,
+                'ID_ks': 0,
+                'ID_kb': 0,
+                'ID_ki': 0,
+                'ID_kt': 0,
+                'ID_ku': 0,
+                'ID_ma': 0,
+                'ID_mu': 0,
+                'ID_ac': 0,
+                'ID_pa': 0,
+                'ID_pb': 0,
+                'ID_nt': 0,
+                'ID_go': 0,
+                'ID_st': 0,
+                'ID_sa': 0,
+            }
+        })
+        // this.setState({ RegionValues: data.data.filter(e => e._id.includes('LLDIKTI')) })
+
+
     }
     render() {
         return (

+ 1 - 0
components/Riwayat/TableRadar.js

@@ -24,6 +24,7 @@ function TableRadar({ listData, to, linkName, jadwal, pemeriksaan, sanksi, keber
                                 style={{
                                     color: "black",
                                     verticalAlign: "middle",
+                                    textAlign: "center",
                                 }}>Jumlah Laporan</th>
                             <th
                                 colSpan="2"