index.js 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. import React, { Component } from "react";
  2. import Router from "next/router";
  3. import ContentWrapper from "@/components/Layout/ContentWrapper";
  4. import { Row, Col, Progress, Modal, ModalHeader, ModalBody, ModalFooter, Button, Table } from "reactstrap";
  5. import { getPelaporan } from "../../../../actions/pelaporan";
  6. import Sparkline from "@/components/Common/Sparklines";
  7. import Datatable from "@/components/Tables/Datatable";
  8. import moment from "moment";
  9. class Keberatan extends Component {
  10. constructor(props) {
  11. super(props);
  12. this.state = {
  13. modal: false,
  14. };
  15. }
  16. static getInitialProps = async () => {
  17. const pelaporan = await getPelaporan();
  18. return { pelaporan };
  19. };
  20. handleYaClick = (e) => {
  21. e.preventDefault();
  22. this.toggleModal();
  23. Router.push({
  24. pathname: "/app/pt/keberatan/upload",
  25. });
  26. };
  27. handleTidakClick = (e) => {
  28. e.preventDefault();
  29. this.toggleModal();
  30. Router.push({
  31. pathname: "/app/pt/dokumen-perbaikan",
  32. });
  33. };
  34. toggleModal = () => {
  35. this.setState({
  36. modal: !this.state.modal,
  37. });
  38. };
  39. render() {
  40. console.log(this.state);
  41. const { pelaporan } = this.props;
  42. return (
  43. <ContentWrapper>
  44. <div className="content-heading">Permohonan Keberatan</div>
  45. <Row>
  46. <Col lg="4">
  47. <div className="card b">
  48. <div className="card-body bb">
  49. <p>Overvall progress</p>
  50. <div className="d-flex align-items-center mb-2">
  51. <div className="w-100">
  52. <Progress className="progress-xs m0" color="info" value={20} />
  53. </div>
  54. <div className="ml-auto">
  55. <div className="col wd-xxs text-right">
  56. <div className="text-bold text-muted">20%</div>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <div className="card-body">
  62. <p>Metrics</p>
  63. <div className="row text-center">
  64. <div className="col-6 col-lg-6 col-xl-6">
  65. <Sparkline
  66. values={[20, 80]}
  67. options={{
  68. type: "pie",
  69. height: "50",
  70. sliceColors: ["#edf1f2", "#23b7e5"],
  71. }}
  72. className="sparkline"
  73. />
  74. <p className="mt-3">Open Case</p>
  75. </div>
  76. <div className="col-6 col-lg-6 col-xl-6">
  77. <Sparkline
  78. values={[80, 20]}
  79. options={{
  80. type: "pie",
  81. height: "50",
  82. sliceColors: ["#edf1f2", "#27c24c"],
  83. }}
  84. className="sparkline"
  85. />
  86. <p className="mt-3">Close Case</p>
  87. </div>
  88. </div>
  89. </div>
  90. <table className="table bb">
  91. <tbody>
  92. <tr>
  93. <td>
  94. <strong>Open Case</strong>
  95. </td>
  96. <td>80</td>
  97. </tr>
  98. <tr>
  99. <td>
  100. <strong>Close Case</strong>
  101. </td>
  102. <td>20</td>
  103. </tr>
  104. <tr>
  105. <td>
  106. <strong>Performance</strong>
  107. </td>
  108. <td>
  109. <em className="far fa-smile fa-lg text-warning"></em>
  110. </td>
  111. </tr>
  112. <tr>
  113. <td>
  114. <strong>Last Case Closed</strong>
  115. </td>
  116. <td>BI:1107 - 12/01/2016</td>
  117. </tr>
  118. </tbody>
  119. </table>
  120. </div>
  121. </Col>
  122. <Col lg="8">
  123. <div className="card b">
  124. <div className="card-body">
  125. <Table options={{ responsive: true }}>
  126. {/* <table className="table w-100"> */}
  127. <thead>
  128. <tr>
  129. <th>#ID</th>
  130. <th>Description</th>
  131. <th>Created</th>
  132. <th>Status</th>
  133. <th></th>
  134. </tr>
  135. </thead>
  136. <tbody>
  137. {pelaporan.data.map((value) => {
  138. return (
  139. <tr key={value._id}>
  140. <td>BI:{value._number}</td>
  141. <td className="text-nowrap">
  142. <div className="media align-items-center">
  143. <img className="img-fluid rounded thumb64" src="/static/img/dummy-search.png" alt="Dummy" />
  144. <div className="media-body d-flex">
  145. <div>
  146. <h4 className="m-0">Universitas Satyagama</h4>
  147. <small className="text-muted">0742/O/1990 - www.satyagama.ac.id - info@satyagama.ac.id</small>
  148. <p>{value.description}</p>
  149. </div>
  150. </div>
  151. </div>
  152. </td>
  153. <td>{moment(value.createdAt).fromNow()}</td>
  154. <td>
  155. <div className="inline wd-xxs badge badge-success">open</div>
  156. </td>
  157. <td>
  158. <Button color="primary" onClick={this.toggleModal}>
  159. Ajukan
  160. </Button>
  161. <Modal isOpen={this.state.modal} toggle={this.toggleModal}>
  162. <ModalHeader toggle={this.toggleModal}>Permohonan Keberatan</ModalHeader>
  163. <ModalBody>apakah anda akan mengajukan permohonan keberatan atas pengenaan sanksi?</ModalBody>
  164. <ModalFooter>
  165. <Button color="primary" onClick={(e) => this.handleYaClick(e)}>
  166. Ya
  167. </Button>{" "}
  168. <Button color="secondary" onClick={(e) => this.handleTidakClick(e)}>
  169. Tidak
  170. </Button>
  171. </ModalFooter>
  172. </Modal>
  173. {/* <Swal options={this.state.swalOption} callback={this.swalCallback} className="btn btn-primary">
  174. Ajukan
  175. </Swal> */}
  176. {/* START card */}
  177. {/* Button trigger modal */}
  178. {/* <Button color="primary" onClick={(e) => this.permohonanClick(e, value.pt_id, value.number)}>
  179. Ajukan
  180. </Button> */}
  181. {/* END card */}
  182. {/* <Button onClick={(e) => this.permohonanClick(e, value.pt_id, value.number)} className="btn-primary">
  183. Ajukan
  184. </Button> */}
  185. </td>
  186. </tr>
  187. );
  188. })}
  189. </tbody>
  190. {/* </table> */}
  191. </Table>
  192. </div>
  193. </div>
  194. </Col>
  195. </Row>
  196. </ContentWrapper>
  197. );
  198. }
  199. }
  200. export default Keberatan;