import React, { Component } from "react";
import ContentWrapper from "@/components/Layout/ContentWrapper";
import Header from "@/components/Main/Header";
import DetailPT from "@/components/Main/DetailPT";
import { getLog } from "@/actions/log";
import { Row, Col } from "reactstrap";
import Timeline from "@/components/Main/Timeline";
import { getPT } from "@/actions/PT";

class Pemantauan extends Component {
	constructor(props) {
		super(props);
		this.state = {
			pt: {},
		};
	}

	static async getInitialProps({ query }) {
		const log = await getLog({ ptId: query.ptId });
		return { log, query };
	}

	componentDidMount = async () => {
		const { query } = this.props;
		const pt = await getPT({ id: query.ptId });
		this.setState({ pt });
	};

	render() {
		const { log } = this.props;
		const { pt } = this.state;
		console.log(pt);

		return (
			<ContentWrapper unwrap>
				<Header />
				<div className="p-3">
					<Row>
						<Col xl="9">
							<Timeline data={log} />
						</Col>
						<Col xl="3">{/* <DetailPT data={pt.data[0]} /> */}</Col>
					</Row>
				</div>
			</ContentWrapper>
		);
	}
}

export default Pemantauan;
