BeritaAcara_A.js 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. const { pelaporan } = this.state
  20. return (
  21. <div>
  22. <ReactToPrint pageStyle='print' content={() => this.componentRef}>
  23. <PrintContextConsumer>
  24. {({ handlePrint }) => (
  25. <div className=' content-heading border-radius-login'>
  26. <span className="btn-radius">
  27. <Button onClick={handlePrint} color className="btn-labeled-4">
  28. <h4 className="p-0 mt-2">Print dan Download</h4>
  29. </Button>
  30. </span>
  31. </div>
  32. )}
  33. </PrintContextConsumer>
  34. </ReactToPrint>
  35. {/* <div style={{ display: "none" }}> */}
  36. <ComponentToPrint ref={el => (this.componentRef = el)} query={this.props.query} />
  37. {/* </div> */}
  38. </div >
  39. );
  40. }
  41. }
  42. export default BeritaAcara