| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697 |
- import React, { Component } from "react";
- import Header from "@/components/Main/Header";
- import DetailPT from "@/components/Main/DetailPT";
- import { getOneLaporan } from "@/actions/pelaporan";
- import { getLog } from "@/actions/log";
- import DetailLaporan from "@/components/Main/DetailLaporan";
- import Link from "next/link";
- import ContentWrapper from "@/components/Layout/ContentWrapper";
- import { Row, Col, Card, CardBody, Button, FormGroup } from "reactstrap";
- import Loader from "@/components/Common/Loader";
- import { connect } from "react-redux";
- import Scrollable from "@/components/Common/Scrollable";
- import Timeline from "@/components/Main/Timeline";
- import { createLog } from "@/actions/log";
- class DetailPelaporan extends Component {
- constructor(props) {
- super(props);
- this.state = {
- pelaporan: {},
- pemantauan: {},
- };
- }
- static getInitialProps = async ({ query }) => {
- return { query };
- };
- componentDidMount = async () => {
- const { token, query } = this.props;
- const pelaporan = await getOneLaporan(this.props.token, query.id + "?delegasi=true");
- await createLog(token, { aktivitas: `Mengakses halaman detail Laporan Delegasi dengan No. Laporan ${pelaporan.data.no_laporan}`, menu: "Laporan Delegasi" });
- const pemantauan = await getLog(this.props.token, query.id + "?delegasi=true&asc=true");
- pemantauan.data = pemantauan.data.filter((e) => e.action != "CREATE LAPORAN");
- this.setState({ pelaporan, pemantauan });
- };
- render() {
- const { pelaporan, pemantauan } = this.state;
- return (
- <ContentWrapper unwrap>
- {/* <Header /> */}
- <div className="p-3">
- <div className="content-heading">
- <span className="font-color-white">Detail Laporan Delegasi</span>
- <div className="ml-auto">
- <Link href="/app/laporan-delegasi">
- <Button className="color-3e3a8e btn-login" color>
- <span className="font-color-white">< Kembali</span>
- </Button>
- </Link>
- </div>
- </div>
- <Row>
- <Col xl="9">
- {pelaporan.data ? (
- <Card className="card-default">
- <CardBody>
- <Row>
- <Col lg={12}>
- {<DetailLaporan data={pelaporan.data} />}
- <p className="lead bb">Keterangan Delegasi</p>
- <form className="form-horizontal">
- <FormGroup row>
- <Col md="4">Alasan Delegasi:</Col>
- <Col md="8">
- <Scrollable height="100px" className="list-group">
- <p>{pelaporan.data.alasan_delegasi}</p>
- </Scrollable>
- </Col>
- </FormGroup>
- </form>
- </Col>
- </Row>
- </CardBody>
- </Card>
- ) : (
- <Loader />
- )}
- </Col>
- <Col xl="3">{pelaporan.data ? <DetailPT data={pelaporan.data.pt} /> : <Loader />}</Col>
- </Row>
- <Row>
- {pemantauan.data && (
- <Col xl={12}>
- <Timeline data={pemantauan.data} />
- </Col>
- )}
- </Row>
- </div>
- </ContentWrapper>
- );
- }
- }
- const mapStateToProps = (state) => ({ user: state.user, token: state.token });
- export default connect(mapStateToProps)(DetailPelaporan);
|