new.js 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import React, { Component } from "react";
  2. import Header from "@/components/Main/Header";
  3. import DetailPT from "@/components/Main/DetailPT";
  4. import InputData from "@/components/Pelaporan/InputData";
  5. import Link from "next/link";
  6. import { getPT } from "@/actions/PT";
  7. import ContentWrapper from "@/components/Layout/ContentWrapper";
  8. import { Row, Col, Card, CardHeader, CardBody } from "reactstrap";
  9. class PelaporanNew extends Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = {
  13. pt: {},
  14. };
  15. }
  16. static getInitialProps = async ({ query }) => {
  17. return { query };
  18. };
  19. componentDidMount = async () => {
  20. const { query } = this.props;
  21. const pt = await getPT({ id: query.ptId });
  22. this.setState({ pt });
  23. };
  24. render() {
  25. const { pt } = this.state;
  26. return (
  27. <ContentWrapper unwrap>
  28. {/* <Header /> */}
  29. <div className="p-3">
  30. <div className="content-heading">
  31. <div>
  32. Pelaporan Baru
  33. <small>Form pembuatan laporan baru v.0.1</small>
  34. </div>
  35. <div className="ml-auto">
  36. <Link href="/app/pelaporan/search">
  37. <button className="btn btn-sm btn-secondary text-sm">&lt; back</button>
  38. </Link>
  39. </div>
  40. </div>
  41. <Row>
  42. <Col xl="9">
  43. <Card className="card-default">
  44. <CardBody>
  45. <Row>
  46. <Col lg={12}>
  47. <p className="lead bb">Informasi Laporan</p>
  48. <InputData query={this.props.query} />
  49. </Col>
  50. </Row>
  51. </CardBody>
  52. </Card>
  53. </Col>
  54. <Col xl="3">{pt?.data && <DetailPT data={pt.data[0]} />}</Col>
  55. </Row>
  56. </div>
  57. </ContentWrapper>
  58. );
  59. }
  60. }
  61. export default PelaporanNew;