import React, { Component } from "react";
import ContentWrapper from "@/components/Layout/ContentWrapper";
import { Row, Col } from "reactstrap";
import { getPelaporan } from "@/actions/pelaporan";
import { getSanksi } from "@/actions/sanksi";
import TableLaporan from "@/components/RekomendasiDelegasi/TableLaporan";
import { connect } from "react-redux";
import Loader from "@/components/Common/Loader";

class RekomendasiDelegasi extends Component {
	constructor(props) {
		super(props);
		this.state = {
			pelaporan: {},
			graph: {},
			tahun: new Date().getFullYear(),
		};
	}

	componentDidMount = async () => {
		const { token } = this.props;
		const pelaporan = await getSanksi(token, { delegasi: true, sanksi: true, cabutSanksi: true });
		this.setState({ pelaporan });
	};

	render() {
		const { pelaporan } = this.state;
		return (
			<ContentWrapper>
				<div className="content-heading">
					<span className="font-color-white">
						Rekomendasi Delegasi</span>
				</div>
				<Row>
					{/* <Col lg="12">{graph?.data ? <CaseProgress data={graph.data} nextButton={this.nextButton} prevButton={this.prevButton} tahun={this.state.tahun} excel={this.excel} /> : <Loader />}</Col> */}
					<Col lg="12">{pelaporan?.data ? <TableLaporan status noBy listData={pelaporan.data} to="/app/rekomendasi-delegasi/detail" linkName="Detail" /> : <Loader />}</Col>
				</Row>
			</ContentWrapper>
		);
	}
}

const mapStateToProps = (state) => ({ user: state.user, token: state.token });
export default connect(mapStateToProps)(RekomendasiDelegasi);
