|
|
@@ -1,8 +1,12 @@
|
|
|
import React, { Component } from "react";
|
|
|
import BasePage from "@/components/Layout/BasePage";
|
|
|
-import { Row, Col, FormGroup, Input, Card, CardBody, Button, CustomInput, Navbar, NavItem, NavLink, NavbarBrand, NavbarToggler, Nav, Collapse } from "reactstrap";
|
|
|
+import { Row, Col, FormGroup, Input, Card, CardBody, Button, Navbar, NavItem, NavLink, NavbarBrand, NavbarToggler, Nav, Collapse } from "reactstrap";
|
|
|
import Link from "next/link";
|
|
|
import ContentWrapper from "@/components/Layout/ContentWrapper";
|
|
|
+import { getPelaporanPublic } from "@/actions/pelaporan";
|
|
|
+import DetailLaporan from "@/components/Public/DetailLaporan";
|
|
|
+import { getLogPublic } from "@/actions/log";
|
|
|
+import Timeline from "@/components/Main/Timeline";
|
|
|
|
|
|
const menu = [
|
|
|
{
|
|
|
@@ -28,9 +32,10 @@ class App extends Component {
|
|
|
this.state = {
|
|
|
isOpen: false,
|
|
|
no_laporan: "",
|
|
|
- pelaporanNumber: Math.floor(Date.now() * Math.random()),
|
|
|
no_hp: "",
|
|
|
msgError: [],
|
|
|
+ laporan: {},
|
|
|
+ log: {},
|
|
|
};
|
|
|
}
|
|
|
|
|
|
@@ -44,11 +49,15 @@ class App extends Component {
|
|
|
|
|
|
handleLihatPemantaun = async (e) => {
|
|
|
e.preventDefault();
|
|
|
- // validasi
|
|
|
- // if (nama === '') msgError.push({nama: 'Wajib diisi'})
|
|
|
+ const { no_hp, no_laporan } = this.state;
|
|
|
+ const laporan = await getPelaporanPublic({ number: no_laporan, noHp: no_hp });
|
|
|
+ const log = await getLogPublic({ ptId: laporan.data[0].pt_id, laporanId: laporan.data[0]._id });
|
|
|
+ this.setState({ laporan });
|
|
|
+ this.setState({ log });
|
|
|
};
|
|
|
|
|
|
render() {
|
|
|
+ const { laporan, log } = this.state;
|
|
|
return (
|
|
|
<div>
|
|
|
<Navbar color="info" expand="md" dark>
|
|
|
@@ -97,6 +106,22 @@ class App extends Component {
|
|
|
</form>
|
|
|
</CardBody>
|
|
|
</Card>
|
|
|
+ <Card className="card-default">
|
|
|
+ <CardBody>
|
|
|
+ {laporan.data && log.data ? (
|
|
|
+ <>
|
|
|
+ <DetailLaporan data={laporan.data[0]} />
|
|
|
+ <p className="lead bb">Pemantauan</p>
|
|
|
+ <Timeline data={log.data} noFile />{" "}
|
|
|
+ </>
|
|
|
+ ) : (
|
|
|
+ ""
|
|
|
+ )}
|
|
|
+ </CardBody>
|
|
|
+ </Card>
|
|
|
+ {/* <Card className="card-default">
|
|
|
+ <CardBody></CardBody>
|
|
|
+ </Card> */}
|
|
|
</Col>
|
|
|
</Row>
|
|
|
</ContentWrapper>
|