|
|
@@ -0,0 +1,57 @@
|
|
|
+import React, { Component } from "react";
|
|
|
+import ContentWrapper from "@/components/Layout/ContentWrapper";
|
|
|
+import Link from "next/link";
|
|
|
+import { Row, Col, Button } from "reactstrap";
|
|
|
+import { getPelaporan } from "@/actions/pelaporan";
|
|
|
+import CaseProgress from "@/components/Main/CaseProgress";
|
|
|
+import TableLaporan from "@/components/Main/TableLaporan";
|
|
|
+import { connect } from "react-redux";
|
|
|
+import Loader from "@/components/Common/Loader";
|
|
|
+
|
|
|
+class Pelaporan extends Component {
|
|
|
+ constructor(props) {
|
|
|
+ super(props);
|
|
|
+ this.state = {
|
|
|
+ pelaporan: {},
|
|
|
+ };
|
|
|
+ }
|
|
|
+
|
|
|
+ componentDidMount = async () => {
|
|
|
+ const pelaporan = await getPelaporan(this.props.token);
|
|
|
+ this.setState({ pelaporan });
|
|
|
+ };
|
|
|
+
|
|
|
+ render() {
|
|
|
+ const { pelaporan } = this.state;
|
|
|
+ return (
|
|
|
+ <ContentWrapper>
|
|
|
+ <div className="content-heading">
|
|
|
+ <div>Pelaporan</div>
|
|
|
+ <div className="ml-auto">
|
|
|
+ <Link href="/app/penjadwalan">
|
|
|
+ <button className="btn btn-sm btn-secondary text-sm">next ></button>
|
|
|
+ </Link>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ <Row>
|
|
|
+ <Col lg="4">
|
|
|
+ <CaseProgress />
|
|
|
+ </Col>
|
|
|
+ <Col lg="8">
|
|
|
+ <div className="mb-3 d-flex">
|
|
|
+ <div>
|
|
|
+ <Link href="/app/pelaporan/search">
|
|
|
+ <Button color="primary">Laporan Baru</Button>
|
|
|
+ </Link>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ {pelaporan?.data ? <TableLaporan listData={pelaporan.data} to="/app/pelaporan/detail" linkName="Detail" /> : <Loader />}
|
|
|
+ </Col>
|
|
|
+ </Row>
|
|
|
+ </ContentWrapper>
|
|
|
+ );
|
|
|
+ }
|
|
|
+}
|
|
|
+
|
|
|
+const mapStateToProps = (state) => ({ user: state.user, token: state.token });
|
|
|
+export default connect(mapStateToProps)(Pelaporan);
|