index.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. import React, { Component } from "react";
  2. import ContentWrapper from "@/components/Layout/ContentWrapper";
  3. import { Row, Col } from "reactstrap";
  4. import CaseProgress from "@/components/Main/CaseProgress";
  5. import TableSanksi from "@/components/Main/TableSanksi";
  6. import { getSanksi } from "@/actions/sanksi";
  7. import { connect } from "react-redux";
  8. class PemantauanPerbaikan extends Component {
  9. constructor(props) {
  10. super(props);
  11. this.state = {
  12. sanksi: {},
  13. };
  14. }
  15. componentDidMount = async () => {
  16. const { organisasi, peran } = this.props.user.peran[0];
  17. const query = { role: peran.id === 2021 ? "lldikti" : "dikti", docPerbaikan: true };
  18. if (peran.id === 2021) query.orgId = organisasi.id;
  19. const sanksi = await getSanksi(query);
  20. this.setState({ sanksi });
  21. };
  22. render() {
  23. const { sanksi } = this.state;
  24. return (
  25. <ContentWrapper>
  26. <div className="content-heading">Pemantauan Perbaikan</div>
  27. <Row>
  28. <Col lg="4">
  29. <CaseProgress />
  30. </Col>
  31. <Col lg="8">
  32. <TableSanksi listData={sanksi.data} to="/app/pemantauan-perbaikan/detail" linkName="Detail" />
  33. </Col>
  34. </Row>
  35. </ContentWrapper>
  36. );
  37. }
  38. }
  39. const mapStateToProps = (state) => ({ user: state.user });
  40. export default connect(mapStateToProps)(PemantauanPerbaikan);