index.js 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. import React, { Component } from "react";
  2. import BasePage from "@/components/Layout/BasePage";
  3. import { getPT } from "@/actions/PT";
  4. import { getPelanggaran } from "@/actions/pelanggaran";
  5. import Select from "react-select";
  6. import AsyncSelect from "react-select/async";
  7. import { Row, Col, FormGroup, Input, Card, CardBody, Button, CustomInput, Navbar, NavItem, NavLink, NavbarBrand, NavbarToggler, Nav, Collapse } from "reactstrap";
  8. import ContentWrapper from "@/components/Layout/ContentWrapper";
  9. import Link from "next/link";
  10. const loadOptions = (inputValue, callback) => {
  11. setTimeout(async () => {
  12. const pt = await getPT({ search: inputValue });
  13. const data = pt.data.map((e) => ({ value: e.id, label: e.nama, className: "State-ACT" }));
  14. callback(data);
  15. }, 1000);
  16. };
  17. const menu = [
  18. {
  19. title: "Home",
  20. path: "/app",
  21. },
  22. {
  23. title: "Membuat Laporan",
  24. path: "/laporan/new",
  25. },
  26. {
  27. title: "Pemantauan",
  28. path: "/pemantauan",
  29. },
  30. {
  31. title: "Login",
  32. path: "/login",
  33. },
  34. ];
  35. const selectInstanceId = 1;
  36. class App extends Component {
  37. constructor(props) {
  38. super(props);
  39. this.state = {
  40. isOpen: false,
  41. };
  42. }
  43. static getInitialProps = ({ pathname }) => ({ pathname });
  44. toggleCollapse = () => {
  45. this.setState({
  46. isOpen: !this.state.isOpen,
  47. });
  48. };
  49. render() {
  50. return (
  51. <div>
  52. <Navbar color="info" expand="md" dark>
  53. <NavbarBrand href="/">
  54. <img className="img-fluid" src="/static/img/logo-single.png" alt="App Logo" /> Aldila Dikti
  55. </NavbarBrand>
  56. <NavbarToggler onClick={this.toggleCollapse} />
  57. <Collapse isOpen={this.state.isOpen} navbar>
  58. <Nav className="ml-auto" navbar>
  59. {menu.map((e) => (
  60. <NavItem active={e.path === this.props.pathname ? true : false}>
  61. <Link href={e.path}>
  62. <NavLink style={{ cursor: "pointer" }}>{e.title}</NavLink>
  63. </Link>
  64. </NavItem>
  65. ))}
  66. </Nav>
  67. </Collapse>
  68. </Navbar>
  69. <ContentWrapper>
  70. <Row>
  71. <Col lg={8} className="block-center d-block "></Col>
  72. </Row>
  73. </ContentWrapper>
  74. </div>
  75. );
  76. }
  77. }
  78. App.Layout = BasePage;
  79. export default App;