BeritaAcara_A.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import React, { useRef, Component } from 'react';
  2. import { useReactToPrint } from "react-to-print";
  3. import { Row, Col, Button } from "reactstrap";
  4. import Head from 'next/head'
  5. import SignatureCanvas from 'react-signature-canvas'
  6. import ComponentToPrint from "./SuratBA";
  7. import ReactToPrint, { PrintContextConsumer } from 'react-to-print';
  8. import { getOneLaporan, updateLaporan } from "@/actions/pelaporan";
  9. class BeritaAcara extends Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = {
  13. };
  14. }
  15. static getInitialProps = async ({ query }) => {
  16. return { query };
  17. };
  18. render() {
  19. return (
  20. <div>
  21. <ReactToPrint pageStyle='print' content={() => this.componentRef}>
  22. <PrintContextConsumer>
  23. {({ handlePrint }) => (
  24. <div className=' content-heading border-radius-login'>
  25. <span className="btn-radius">
  26. <Button onClick={handlePrint} color className="btn-labeled-4">
  27. <h4 className="p-0 mt-2">Print dan Download</h4>
  28. </Button>
  29. </span>
  30. </div>
  31. )}
  32. </PrintContextConsumer>
  33. </ReactToPrint>
  34. {/* <div style={{ display: "none" }}> */}
  35. <ComponentToPrint ref={el => (this.componentRef = el)} query={this.props.query} dataPelanggaran={this.props.dataPelanggaran} />
  36. {/* </div> */}
  37. </div >
  38. );
  39. }
  40. }
  41. export default BeritaAcara