Procházet zdrojové kódy

consume getExcel Clear

yazid138 před 3 roky
rodič
revize
35019de89f

+ 2 - 2
components/Pelaporan/CaseProgress.js

@@ -6,7 +6,7 @@ import { ChartSpline, ChartArea, ChartBar, ChartBarStacked, ChartDonut, ChartLin
 import Datatable from "@/components/Tables/Datatable";
 import { useState, useEffect } from "react";
 
-function CaseProgress({ data, nextButton, prevButton, tahun, newLaporan }) {
+function CaseProgress({ data, nextButton, prevButton, tahun, newLaporan, excel }) {
 	console.log(data);
 	const laporan_pertahun = data.laporan_perTahun;
 
@@ -118,7 +118,7 @@ function CaseProgress({ data, nextButton, prevButton, tahun, newLaporan }) {
 						<img src="/static/img/next.png"></img>
 					</Button>
 					<b className="text-tahun">Tahun {tahun} </b>
-					<Button className="float-right button-hidden icon-eksport">
+					<Button className="float-right button-hidden icon-eksport" onClick={excel}>
 						<img src="/static/img/eksport.png"></img>
 					</Button>
 				</div>

+ 2 - 2
components/Pemeriksaan/CaseProgress.js

@@ -8,7 +8,7 @@ import Datatable from "@/components/Tables/Datatable";
 import MorrisChart from "@/components/Charts//Morris";
 import { Button } from "reactstrap";
 
-function CaseProgress({ data, nextButton, prevButton, tahun }) {
+function CaseProgress({ data, nextButton, prevButton, tahun, excel }) {
 	const ChartBar = {
 		data: [
 			{
@@ -106,7 +106,7 @@ function CaseProgress({ data, nextButton, prevButton, tahun }) {
 						<img src="/static/img/next.png"></img>
 					</Button>
 					<b className="text-tahun">Tahun {tahun} </b>
-					<Button className="float-right button-hidden icon-eksport">
+					<Button className="float-right button-hidden icon-eksport" onClick={excel}>
 						<img src="/static/img/eksport.png"></img>
 					</Button>
 				</div>

+ 2 - 2
components/Penjadwalan/CaseProgress.js

@@ -8,7 +8,7 @@ import Datatable from "@/components/Tables/Datatable";
 import MorrisChart from "@/components/Charts//Morris";
 import { Button } from "reactstrap";
 
-function CaseProgress({ data, nextButton, prevButton, tahun }) {
+function CaseProgress({ data, nextButton, prevButton, tahun, excel }) {
 	const ChartBar = {
 		data: [
 			{
@@ -106,7 +106,7 @@ function CaseProgress({ data, nextButton, prevButton, tahun }) {
 						<img src="/static/img/next.png"></img>
 					</Button>
 					<b className="text-tahun">Tahun {tahun} </b>
-					<Button className="float-right button-hidden icon-eksport">
+					<Button className="float-right button-hidden icon-eksport" onClick={excel}>
 						<img src="/static/img/eksport.png"></img>
 					</Button>
 				</div>

+ 2 - 2
components/Sanksi/CaseProgress.js

@@ -8,7 +8,7 @@ import Datatable from "@/components/Tables/Datatable";
 import MorrisChart from "@/components/Charts//Morris";
 import { Button } from "reactstrap";
 
-function CaseProgress({ data, nextButton, prevButton, tahun }) {
+function CaseProgress({ data, nextButton, prevButton, tahun, excel }) {
 	const ChartBar = {
 		data: [
 			{
@@ -105,7 +105,7 @@ function CaseProgress({ data, nextButton, prevButton, tahun }) {
 						<img src="/static/img/next.png"></img>
 					</Button>
 					<b className="text-tahun">Tahun {tahun} </b>
-					<Button className="float-right button-hidden icon-eksport">
+					<Button className="float-right button-hidden icon-eksport" onClick={excel}>
 						<img src="/static/img/eksport.png"></img>
 					</Button>
 				</div>

+ 8 - 2
pages/app/pelaporan/index.js

@@ -3,11 +3,12 @@ import ContentWrapper from "@/components/Layout/ContentWrapper";
 import Link from "next/link";
 import { Row, Col, Button } from "reactstrap";
 import { getPelaporan } from "@/actions/pelaporan";
-import { getGraph } from "@/actions/graph";
+import { getGraph, getExcel } from "@/actions/graph";
 import CaseProgress from "@/components/Pelaporan/CaseProgress";
 import TableLaporan from "@/components/Main/TableLaporan";
 import { connect } from "react-redux";
 import Loader from "@/components/Common/Loader";
+import Router from 'next/router'
 
 class Pelaporan extends Component {
 	constructor(props) {
@@ -43,6 +44,11 @@ class Pelaporan extends Component {
 		if (prevState.graph !== this.state.graph) return true;
 	};
 
+	excel = () => {
+		const url = getExcel(this.props.token, "Laporan", { tahun: this.state.tahun });
+		Router.push(url);
+	};
+
 	render() {
 		const { pelaporan, graph, newLaporan } = this.state;
 
@@ -58,7 +64,7 @@ class Pelaporan extends Component {
 					</Link>
 				</div>
 				<Row>
-					<Col lg="4">{graph?.data ? <CaseProgress data={graph.data} nextButton={this.nextButton} prevButton={this.prevButton} tahun={this.state.tahun} newLaporan={newLaporan} /> : <Loader />}</Col>
+					<Col lg="4">{graph?.data ? <CaseProgress data={graph.data} nextButton={this.nextButton} prevButton={this.prevButton} tahun={this.state.tahun} newLaporan={newLaporan} excel={this.excel} /> : <Loader />}</Col>
 					<Col lg="8">
 						<div className="mb-3 d-flex">
 							<div>

+ 8 - 2
pages/app/pemeriksaan/index.js

@@ -2,13 +2,14 @@ import React, { Component } from "react";
 import ContentWrapper from "@/components/Layout/ContentWrapper";
 import { Row, Col } from "reactstrap";
 import { getPelaporan } from "@/actions/pelaporan";
-import { getGraph } from "@/actions/graph";
+import { getGraph, getExcel } from "@/actions/graph";
 import CaseProgress from "@/components/Pemeriksaan/CaseProgress";
 import TableLaporan from "@/components/Pemeriksaan/TableLaporan";
 import { connect } from "react-redux";
 import Loader from "@/components/Common/Loader";
 import Link from "next/link";
 import Button from "reactstrap/lib/Button";
+import Router from "next/router";
 
 class Pemeriksaan extends Component {
 	constructor(props) {
@@ -43,6 +44,11 @@ class Pemeriksaan extends Component {
 		if (prevState.graph !== this.state.graph) return true;
 	};
 
+	excel = () => {
+		const url = getExcel(this.props.token, "Laporan", { tahun: this.state.tahun });
+		Router.push(url);
+	};
+
 	render() {
 		const { pelaporan, graph } = this.state;
 		return (
@@ -66,7 +72,7 @@ class Pemeriksaan extends Component {
 					</div>
 				</div>
 				<Row>
-					<Col lg="4">{graph?.data ? <CaseProgress data={graph.data} nextButton={this.nextButton} prevButton={this.prevButton} tahun={this.state.tahun} /> : <Loader />}</Col>
+					<Col lg="4">{graph?.data ? <CaseProgress data={graph.data} nextButton={this.nextButton} prevButton={this.prevButton} tahun={this.state.tahun} excel={this.excel} /> : <Loader />}</Col>
 					<Col lg="8">{pelaporan?.data ? <TableLaporan status noBy listData={pelaporan.data} to="/app/pemeriksaan/new" linkName="Evaluasi" /> : <Loader />}</Col>
 				</Row>
 			</ContentWrapper>

+ 8 - 2
pages/app/penjadwalan/index.js

@@ -2,13 +2,14 @@ import React, { Component } from "react";
 import ContentWrapper from "@/components/Layout/ContentWrapper";
 import { Row, Col } from "reactstrap";
 import { getPelaporan } from "@/actions/pelaporan";
-import { getGraph } from "@/actions/graph";
+import { getGraph, getExcel } from "@/actions/graph";
 import CaseProgress from "@/components/Penjadwalan/CaseProgress";
 import TableLaporan from "@/components/Penjadwalan/TableLaporan";
 import { connect } from "react-redux";
 import Loader from "@/components/Common/Loader";
 import Link from "next/link";
 import Button from "reactstrap/lib/Button";
+import Router from "next/router";
 
 class Penjadwalan extends Component {
 	constructor(props) {
@@ -43,6 +44,11 @@ class Penjadwalan extends Component {
 		if (prevState.graph !== this.state.graph) return true;
 	};
 
+	excel = () => {
+		const url = getExcel(this.props.token, "Laporan", { tahun: this.state.tahun });
+		Router.push(url);
+	};
+
 	render() {
 		const { pelaporan, graph } = this.state;
 		return (
@@ -66,7 +72,7 @@ class Penjadwalan extends Component {
 					</div>
 				</div>
 				<Row>
-					<Col lg="4">{graph?.data ? <CaseProgress data={graph.data} nextButton={this.nextButton} prevButton={this.prevButton} tahun={this.state.tahun} /> : <Loader />}</Col>
+					<Col lg="4">{graph?.data ? <CaseProgress data={graph.data} nextButton={this.nextButton} prevButton={this.prevButton} tahun={this.state.tahun} excel={this.excel} /> : <Loader />}</Col>
 					<Col lg="8">{pelaporan?.data ? <TableLaporan listData={pelaporan.data} to="/app/penjadwalan/todo" linkName="Atur Jadwal" /> : <Loader />}</Col>
 				</Row>
 			</ContentWrapper>

+ 8 - 2
pages/app/sanksi/index.js

@@ -2,13 +2,14 @@ import React, { Component } from "react";
 import ContentWrapper from "@/components/Layout/ContentWrapper";
 import { Row, Col } from "reactstrap";
 import { getPelaporan } from "@/actions/pelaporan";
-import { getGraph } from "@/actions/graph";
+import { getGraph, getExcel } from "@/actions/graph";
 import CaseProgress from "@/components/Sanksi/CaseProgress";
 import TableLaporan from "@/components/Sanksi/TableLaporan";
 import { connect } from "react-redux";
 import Loader from "@/components/Common/Loader";
 import Link from "next/link";
 import Button from "reactstrap/lib/Button";
+import Router from "next/router";
 
 class Sanksi extends Component {
 	constructor(props) {
@@ -43,6 +44,11 @@ class Sanksi extends Component {
 		if (prevState.graph !== this.state.graph) return true;
 	};
 
+	excel = () => {
+		const url = getExcel(this.props.token, "Laporan", { tahun: this.state.tahun });
+		Router.push(url);
+	};
+
 	render() {
 		const { pelaporan, graph } = this.state;
 		return (
@@ -58,7 +64,7 @@ class Sanksi extends Component {
 					</div>
 				</div>
 				<Row>
-					<Col lg="4">{graph?.data ? <CaseProgress data={graph.data} nextButton={this.nextButton} prevButton={this.prevButton} tahun={this.state.tahun} /> : <Loader />}</Col>
+					<Col lg="4">{graph?.data ? <CaseProgress data={graph.data} nextButton={this.nextButton} prevButton={this.prevButton} tahun={this.state.tahun} excel={this.excel} /> : <Loader />}</Col>
 					<Col lg="8">{pelaporan.data ? <TableLaporan listData={pelaporan.data} /> : <Loader />}</Col>
 				</Row>
 			</ContentWrapper>