| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 | 
							- 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/Delegasi/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";
 
- import { getCsrf } from "../../../actions/security";
 
- 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 getTokenCsrf = await getCsrf();
 
- 		const _csrf = getTokenCsrf.token;
 
- 		const pelaporan = await getOneLaporan(this.props.token, query.id + "?delegasi=true&?aktif=false");
 
- 		await createLog(token, { aktivitas: `Mengakses halaman detail Laporan Delegasi dengan No. Laporan ${pelaporan.data.no_laporan}`, menu: "Laporan Delegasi", _csrf: _csrf });
 
- 		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);
 
 
  |