pemantauan.js 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. import React, { Component } from "react";
  2. import BasePage from "@/components/Layout/BasePage";
  3. import { Row, Col, FormGroup, Input, Card, CardBody, Button, CustomInput, Navbar, NavItem, NavLink, NavbarBrand, NavbarToggler, Nav, Collapse } from "reactstrap";
  4. import Link from "next/link";
  5. import ContentWrapper from "@/components/Layout/ContentWrapper";
  6. const menu = [
  7. {
  8. title: "Home",
  9. path: "/app",
  10. },
  11. {
  12. title: "Membuat Laporan",
  13. path: "/laporan/new",
  14. },
  15. {
  16. title: "Pemantauan",
  17. path: "/pemantauan",
  18. },
  19. {
  20. title: "Login",
  21. path: "/login",
  22. },
  23. ];
  24. class App extends Component {
  25. constructor(props) {
  26. super(props);
  27. this.state = {
  28. isOpen: false,
  29. no_laporan: "",
  30. pelaporanNumber: Math.floor(Date.now() * Math.random()),
  31. no_hp: "",
  32. msgError: [],
  33. };
  34. }
  35. static getInitialProps = ({ pathname }) => ({ pathname });
  36. toggleCollapse = () => {
  37. this.setState({
  38. isOpen: !this.state.isOpen,
  39. });
  40. };
  41. handleLihatPemantaun = async (e) => {
  42. e.preventDefault();
  43. // validasi
  44. // if (nama === '') msgError.push({nama: 'Wajib diisi'})
  45. };
  46. render() {
  47. return (
  48. <div>
  49. <Navbar color="info" expand="md" dark>
  50. <NavbarBrand href="/">
  51. <img className="img-fluid" src="/static/img/logo-single.png" alt="App Logo" /> Aldila Dikti
  52. </NavbarBrand>
  53. <NavbarToggler onClick={this.toggleCollapse} />
  54. <Collapse isOpen={this.state.isOpen} navbar>
  55. <Nav className="ml-auto" navbar>
  56. {menu.map((e) => (
  57. <NavItem active={e.path === this.props.pathname ? true : false}>
  58. <Link href={e.path}>
  59. <NavLink style={{ cursor: "pointer" }}>{e.title}</NavLink>
  60. </Link>
  61. </NavItem>
  62. ))}
  63. </Nav>
  64. </Collapse>
  65. </Navbar>
  66. <ContentWrapper>
  67. <Row>
  68. <Col lg={8} className="block-center d-block ">
  69. <Card className="card-default">
  70. <CardBody>
  71. <form className="form-horizontal" method="post" onSubmit={this.onSubmit}>
  72. <p className="lead bb">Pemantauan</p>
  73. <FormGroup row>
  74. <label className="col-md-2 col-form-label">Nomor Laporan</label>
  75. <div className="col-md-10">
  76. <Input type="text" value={this.state.no_laporan} onChange={(e) => this.setState({ no_laporan: e.target.value })} required />
  77. </div>
  78. </FormGroup>
  79. <FormGroup row>
  80. <label className="col-md-2 col-form-label">Nomor yang dapat dihubungi</label>
  81. <div className="col-md-10">
  82. <Input type="text" value={this.state.no_hp} onChange={(e) => this.setState({ no_hp: e.target.value })} required />
  83. </div>
  84. </FormGroup>
  85. <FormGroup row>
  86. <div className="col-12 col-lg-2">
  87. <Button color="info" block type="submit" onClick={this.handleLihatPemantaun}>
  88. Lihat Pemantauan
  89. </Button>
  90. </div>
  91. </FormGroup>
  92. </form>
  93. </CardBody>
  94. </Card>
  95. </Col>
  96. </Row>
  97. </ContentWrapper>
  98. </div>
  99. );
  100. }
  101. }
  102. App.Layout = BasePage;
  103. export default App;