DetailLaporan.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  1. import Scrollable from "@/components/Common/Scrollable";
  2. import moment from "moment";
  3. import 'moment/locale/id';
  4. moment.locale('id');
  5. import { Col, FormGroup } from "reactstrap";
  6. import { useSelector } from "react-redux";
  7. function DetailLaporan({ data, noTitle = false, noStatus = false }) {
  8. const user = useSelector((state) => state.user);
  9. return (
  10. <>
  11. {(!data.user.isPrivate || user?.role.id === 2020) && (
  12. <>
  13. {noTitle ? (
  14. ""
  15. ) : (
  16. <div className="header-1">
  17. <h2 className="card-title-1">Identitas Pelapor - {data.user.isPublic ? "Umum" : "Internal"}</h2>
  18. </div>
  19. )}
  20. {data.user.nama && (
  21. <FormGroup row>
  22. <Col md="4">Nama Pelapor:</Col>
  23. <Col md="8">
  24. <strong>{data.user.nama}</strong>
  25. </Col>
  26. </FormGroup>
  27. )}
  28. <FormGroup row>
  29. <Col md="4">Nomor yang dapat dihubungi:</Col>
  30. <Col md="8">
  31. <strong>
  32. {data.user.no_hp} {data.user.verified && "(Terverifikasi)"}
  33. </strong>
  34. </Col>
  35. </FormGroup>
  36. {data.user.email && (
  37. <FormGroup row>
  38. <Col md="4">Email:</Col>
  39. <Col md="8">
  40. <strong>{data.user.email}</strong>
  41. </Col>
  42. </FormGroup>
  43. )}
  44. {data.user.isPublic && (
  45. <>
  46. {data.user.alamat && (
  47. <FormGroup row>
  48. <Col md="4">Alamat:</Col>
  49. <Col md="8">
  50. <strong>{data.user.alamat}</strong>
  51. </Col>
  52. </FormGroup>
  53. )}
  54. {data.user.foto && (
  55. <FormGroup row>
  56. <Col md="4">Foto Kartu Identitas:</Col>
  57. <Col md="8">
  58. <img src={data.user.foto.path} height={200} alt="Foto Identitas" />
  59. </Col>
  60. </FormGroup>
  61. )}
  62. </>
  63. )}
  64. {data.user.isPrivate && (
  65. <FormGroup row>
  66. <Col md="4">Dirahasiakan</Col>
  67. <Col md="8">
  68. <strong>Ya</strong>
  69. </Col>
  70. </FormGroup>
  71. )}
  72. </>
  73. )}
  74. {noTitle ? (
  75. ""
  76. ) : (
  77. <div className="header-1">
  78. <h2 className="card-title-1">Detail Laporan</h2>
  79. </div>
  80. )}
  81. <form className="form-horizontal">
  82. <FormGroup row>
  83. <Col md="4">Nomor Laporan:</Col>
  84. <Col md="8">
  85. <strong>{data.no_laporan}</strong>
  86. </Col>
  87. </FormGroup>
  88. <FormGroup row>
  89. <Col md="4">Nama Perguruan Tinggi yang Dilaporkan:</Col>
  90. <Col md="8">
  91. <strong>{data.pt.nama}</strong>
  92. </Col>
  93. </FormGroup>
  94. <FormGroup row>
  95. <Col md="4">Jenis Pelanggaran:</Col>
  96. <Col md="8">
  97. <Scrollable height="125px" className="list-group">
  98. <ul>
  99. {data.pelanggaran.map((e) => (
  100. <li>{e.pelanggaran}</li>
  101. ))}
  102. </ul>
  103. </Scrollable>
  104. </Col>
  105. </FormGroup>
  106. <FormGroup row>
  107. <Col md="4">Keterangan Laporan:</Col>
  108. <Col md="8">
  109. <Scrollable height="100px" className="list-group">
  110. <p>{data.keterangan}</p>
  111. </Scrollable>
  112. </Col>
  113. </FormGroup>
  114. <FormGroup row>
  115. <Col md="4">Dibuat Pada:</Col>
  116. <Col md="8">
  117. <strong>{moment(data.createdAt).format("D MMMM YYYY")}</strong>
  118. </Col>
  119. </FormGroup>
  120. {!noStatus && data.aktif ? (
  121. <FormGroup row>
  122. <Col md="4">Status:</Col>
  123. <Col md="8">
  124. <div className="badge badge-info">{data.role_data === "dikti" ? "Ditindaklanjuti DIKTI" : "Ditindaklanjuti LLDIKTI"}</div>
  125. </Col>
  126. </FormGroup>
  127. ) : (
  128. <FormGroup row>
  129. <Col md="4">Status:</Col>
  130. <Col md="8">
  131. <div className="badge badge-danger">Ditutup</div>
  132. </Col>
  133. </FormGroup>
  134. )}
  135. {/* <FormGroup row>
  136. <Col md="4">Prioritas:</Col>
  137. <Col md="8">{data.level == 3 ? <div className="badge badge-success">Tinggi</div> : data.level == 2 ? <div className="badge badge-info">Sedang</div> : <div className="badge badge-warning">Rendah</div>}</Col>
  138. </FormGroup> */}
  139. <FormGroup row>
  140. <Col md="4">Dokumen Pendukung:</Col>
  141. <Col md="8">
  142. <Scrollable height="120px" className="list-group">
  143. <table className="table table-bordered bg-transparent">
  144. <tbody>
  145. {data.dokumen.map((e, index) => (
  146. <tr key={`files-${index}`}>
  147. <td style={{ width: "30px" }}>
  148. <em className="fa-lg far fa-file-code"></em>
  149. </td>
  150. <td>
  151. <a className="text-muted" href={e.path} target="_blank" download={e.judul}>
  152. {e.judul}
  153. </a>
  154. </td>
  155. </tr>
  156. ))}
  157. </tbody>
  158. </table>
  159. </Scrollable>
  160. </Col>
  161. </FormGroup>
  162. </form>
  163. </>
  164. );
  165. }
  166. export default DetailLaporan;