import React, { Component } from "react";
import ContentWrapper from "@/components/Layout/ContentWrapper";
import { getSanksi } from "@/actions/sanksi";
import Header from "@/components/Main/Header";
import DetailPT from "@/components/Main/DetailPT";
import DetailSanksi from "@/components/Main/DetailSanksi";
import DetailJawaban from "@/components/PT/JawabanBanding/DetailJawaban";
import Link from "next/link";
import { Row, Col, Card, CardBody, Button } from "reactstrap";

class JawabanBanding extends Component {
	constructor(props) {
		super(props);
		this.state = {
			modal: false,
		};
	}

	static async getInitialProps({ query }) {
		const { noSanksi } = query;
		const sanksi = await getSanksi({ noSanksi, ptId: "0BCE4DB7-B207-445D-8D03-0C54B7688252" });
		return { query, sanksi };
	}

	toggleModal = (value = true) => {
		if (!value) {
			this.setState({ modal: false });
		} else {
			this.setState({ modal: !this.state.modal });
		}
	};

	render() {
		const { sanksi } = this.props;

		return (
			<ContentWrapper unwrap>
				<Header />
				<div className="p-3">
					<div className="content-heading">
						<div>Jawaban Atas Permohonan Keberatan</div>
						<div className="ml-auto">
							<Link href="/app/pt/jawaban-banding">
								<button className="btn btn-sm btn-secondary text-sm">&lt; back</button>
							</Link>
						</div>
					</div>
					<Row>
						<Col xl="9">
							<Card className="card-default">
								<CardBody>
									<Row>
										<Col lg={12}>
											<DetailSanksi data={sanksi.data[0]} />
											<DetailJawaban data={sanksi.data[0]} />
										</Col>
									</Row>
								</CardBody>
							</Card>
						</Col>
						<Col xl="3">
							<DetailPT />
						</Col>
					</Row>
				</div>
			</ContentWrapper>
		);
	}
}

export default JawabanBanding;
