detail.js 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411
  1. import React, { Component } from "react";
  2. import Router from "next/router";
  3. import Link from "next/link";
  4. import Select from "react-select";
  5. import Datatable from "@/components/Tables/Datatable";
  6. import Scrollable from "@/components/Common/Scrollable";
  7. import ContentWrapper from "@/components/Layout/ContentWrapper";
  8. import {
  9. Row,
  10. Col,
  11. Card,
  12. CardHeader,
  13. CardBody,
  14. CardTitle,
  15. FormGroup,
  16. FormFeedback,
  17. FormText,
  18. Label,
  19. InputGroup,
  20. InputGroupAddon,
  21. InputGroupButtonDropdown,
  22. InputGroupText,
  23. Input,
  24. Button,
  25. DropdownToggle,
  26. DropdownMenu,
  27. CustomInput,
  28. DropdownItem,
  29. } from "reactstrap";
  30. let Dropzone = null;
  31. class DropzoneWrapper extends Component {
  32. state = {
  33. isClient: false,
  34. };
  35. componentDidMount = () => {
  36. Dropzone = require("react-dropzone").default;
  37. this.setState({ isClient: true });
  38. };
  39. render() {
  40. return Dropzone ? <Dropzone {...this.props}>{this.props.children}</Dropzone> : null;
  41. }
  42. }
  43. const styleHeaderText = {
  44. color: "brown",
  45. };
  46. const selectInstanceId = 1;
  47. class JawabanPencabutanSanksi extends Component {
  48. constructor(props) {
  49. super(props);
  50. this.state = {
  51. selectedOption: null,
  52. files: [],
  53. };
  54. }
  55. handleChangeSelect = (selectedOption) => {
  56. this.setState({ selectedOption });
  57. };
  58. onDrop = (files) => {
  59. this.setState({
  60. files: files.map((file) =>
  61. Object.assign(file, {
  62. preview: URL.createObjectURL(file),
  63. })
  64. ),
  65. stat: "Added " + files.length + " file(s)",
  66. });
  67. };
  68. uploadFiles = (e) => {
  69. e.preventDefault();
  70. e.stopPropagation();
  71. this.setState({
  72. stat: this.state.files.length ? "Dropzone ready to upload " + this.state.files.length + " file(s)" : "No files added.",
  73. });
  74. };
  75. clearFiles = (e) => {
  76. e.preventDefault();
  77. e.stopPropagation();
  78. this.setState({
  79. stat: this.state.files.length ? this.state.files.length + " file(s) cleared." : "No files to clear.",
  80. });
  81. this.setState({
  82. files: [],
  83. });
  84. };
  85. render() {
  86. const { files, selectedOption } = this.state;
  87. console.log(this.state);
  88. const thumbs = files.map((file, index) => (
  89. <Col md={3} key={index}>
  90. <img className="img-fluid mb-2" src={file.preview} alt="Item" />
  91. </Col>
  92. ));
  93. return (
  94. <ContentWrapper unwrap>
  95. <div className="bg-cover" style={{ backgroundImage: "url(/static/img/profile-bg.png)" }}>
  96. <div className="p-4 text-center" style={styleHeaderText}>
  97. <img className="img-thumbnail rounded-circle thumb128" src="/static/img/univ-avatar.png" alt="Avatar" />
  98. <h3 className="m-0">Universitas Satyagama</h3>
  99. <p>0742/O/1990</p>
  100. <p>Jalan Kamal Raya No 2-A Cengkareng</p>
  101. </div>
  102. </div>
  103. <div className="p-3">
  104. <div className="content-heading">
  105. <div>
  106. Permohonan Pencabutan Sanksi
  107. {/* <small>Form pembuatan laporan baru v.0.1</small> */}
  108. </div>
  109. <div className="ml-auto">
  110. <Link href="/app/pt/keberatan">
  111. <button className="btn btn-sm btn-secondary text-sm">&lt; back</button>
  112. </Link>
  113. </div>
  114. </div>
  115. <Row>
  116. <Col xl="9">
  117. <Card className="card-default">
  118. {/* <CardHeader>
  119. <label>Informasi Dokumen</label>
  120. </CardHeader> */}
  121. <CardBody>
  122. <Row>
  123. <Col lg="6">
  124. <p className="lead bb">Detail Laporan</p>
  125. <form className="form-horizontal">
  126. <FormGroup row>
  127. <Col md="4">Nomor Laporan:</Col>
  128. <Col md="8">
  129. <strong>987654</strong>
  130. </Col>
  131. </FormGroup>
  132. <FormGroup row>
  133. <Col md="4">Nama Perguruan Tinggi:</Col>
  134. <Col md="8">
  135. <strong>Universitas Satyagama</strong>
  136. </Col>
  137. </FormGroup>
  138. <FormGroup row>
  139. <Col md="4">Jenis Pelanggaran:</Col>
  140. <Col md="8">
  141. <Scrollable height="75px" className="list-group">
  142. <ul>
  143. <li>Lorem ipsum dolor sit amet.</li>
  144. <li>Lorem, ipsum dolor.</li>
  145. <li>Lorem ipsum dolor sit.</li>
  146. </ul>
  147. </Scrollable>
  148. </Col>
  149. </FormGroup>
  150. <FormGroup row>
  151. <Col md="4">Keterangan Laporan:</Col>
  152. <Col md="8">
  153. <Scrollable height="100px" className="list-group">
  154. <p>
  155. Lorem ipsum dolor sit, amet consectetur adipisicing elit. Amet dicta placeat enim illo aspernatur adipisci neque repellendus itaque blanditiis fugit. Quam obcaecati sed
  156. perferendis facere.
  157. </p>
  158. </Scrollable>
  159. </Col>
  160. </FormGroup>
  161. <FormGroup row>
  162. <Col md="4">Dibuat Pada:</Col>
  163. <Col md="8">
  164. <strong>23 Januari 2022</strong>
  165. </Col>
  166. </FormGroup>
  167. <FormGroup row>
  168. <Col md="4">Status</Col>
  169. <Col md="8">
  170. <div className="badge badge-info">Ditindaklanjuti</div>
  171. </Col>
  172. </FormGroup>
  173. <FormGroup row>
  174. <Col md="4">File Pendukung</Col>
  175. <Col md="8">
  176. <Scrollable height="120px" className="list-group">
  177. <table className="table table-bordered bg-transparent">
  178. <tbody>
  179. <tr>
  180. <td>
  181. <em className="fa-lg far fa-file-code"></em>
  182. </td>
  183. <td>
  184. <a className="text-muted" href="">
  185. database.controller.js
  186. </a>
  187. </td>
  188. </tr>
  189. <tr>
  190. <td>
  191. <em className="fa-lg far fa-file-image"></em>
  192. </td>
  193. <td>
  194. <a className="text-muted" href="">
  195. baground-lg.png
  196. </a>
  197. </td>
  198. </tr>
  199. <tr>
  200. <td>
  201. <em className="fa-lg far fa-file-code"></em>
  202. </td>
  203. <td>
  204. <a className="text-muted" href="">
  205. picture.controller.js
  206. </a>
  207. </td>
  208. </tr>
  209. <tr>
  210. <td>
  211. <em className="fa-lg far fa-file-word"></em>
  212. </td>
  213. <td>
  214. <a className="text-muted" href="">
  215. applicat-diagrams.docx
  216. </a>
  217. </td>
  218. </tr>
  219. <tr>
  220. <td>
  221. <em className="fa-lg far fa-file-code"></em>
  222. </td>
  223. <td>
  224. <a className="text-muted" href="">
  225. database.controller.js
  226. </a>
  227. </td>
  228. </tr>
  229. <tr>
  230. <td>
  231. <em className="fa-lg far fa-file-code"></em>
  232. </td>
  233. <td>
  234. <a className="text-muted" href="">
  235. database.controller.js
  236. </a>
  237. </td>
  238. </tr>
  239. </tbody>
  240. </table>
  241. </Scrollable>
  242. </Col>
  243. </FormGroup>
  244. </form>
  245. </Col>
  246. <Col lg={6}>
  247. <p className="lead bb">Jawaban</p>
  248. <form className="form-horizontal" method="get" action="/" onSubmit={this.onSubmit}>
  249. <FormGroup>
  250. <label className="row-form-label">Status</label>
  251. <div className="row-md-10">
  252. <Select
  253. instanceId={selectInstanceId + 1}
  254. value={this.state.selectedOption}
  255. onChange={this.handleChangeSelect}
  256. options={[
  257. { value: "diterima", label: "Diterima", className: "State-ACT" },
  258. { value: "rekomendasi perbaikan", label: "Rekomendasi Perbaikan", className: "State-ACT" },
  259. ]}
  260. required
  261. />
  262. {/* <span className="form-text">Pilih Jenis Pelanggaran</span> */}
  263. </div>
  264. </FormGroup>
  265. {selectedOption && selectedOption.value === "rekomendasi perbaikan" ? (
  266. <FormGroup>
  267. <label className="row-form-label">Keterangan</label>
  268. <div className="row-md-10">
  269. <Input type="textarea" value={this.state.keteranganLaporan} onChange={this.setKeteranganPelaporan} required />
  270. {/* <span className="form-text">Deskripsi pelaporan minimum karakter 50 maksimum 200 karakter</span> */}
  271. </div>
  272. </FormGroup>
  273. ) : (
  274. ""
  275. )}
  276. <FormGroup>
  277. <label className="row-form-label">{selectedOption && selectedOption.value === "diterima" ? "Upload Dokumen" : "Usulan Perbaikan"}</label>
  278. <div className="row-md-10">
  279. <DropzoneWrapper className="" onDrop={this.onDrop}>
  280. {({ getRootProps, getInputProps, isDragActive }) => {
  281. return (
  282. <div {...getRootProps()} className={"dropzone card p-3 " + (isDragActive ? "dropzone-drag-active" : "")}>
  283. <input {...getInputProps()} />
  284. <div className="dropzone-previews flex">
  285. {this.state.files.length > 0 ? <Row>{thumbs}</Row> : <div className="text-center dz-default dz-message">Drop files here to upload</div>}
  286. </div>
  287. <div className="d-flex align-items-center">
  288. <small className="ml-auto">
  289. <button type="button" className="btn btn-link" onClick={this.clearFiles}>
  290. Clear files
  291. </button>
  292. </small>
  293. </div>
  294. </div>
  295. );
  296. }}
  297. </DropzoneWrapper>
  298. </div>
  299. </FormGroup>
  300. <FormGroup>
  301. <div className="row-xl-10">
  302. <button className="btn btn-sm btn-primary" type="submit">
  303. Simpan
  304. </button>
  305. </div>
  306. </FormGroup>
  307. </form>
  308. </Col>
  309. </Row>
  310. </CardBody>
  311. </Card>
  312. {/* END card */}
  313. </Col>
  314. <Col xl="3">
  315. <div className="card card-default">
  316. <div className="card-body">
  317. <div className="text-center">
  318. <h3 className="mt-0">Universitas Satyagama</h3>
  319. <p>0742/O/1990</p>
  320. </div>
  321. <hr />
  322. <ul className="list-unstyled px-4">
  323. <li>
  324. <em className="fa fa-globe fa-fw mr-3"></em>www.satyagama.ac.id
  325. </li>
  326. <li>
  327. <em className="fa fa-graduation-cap fa-fw mr-3"></em>Status Pelanggaran : Tidak Ada
  328. </li>
  329. </ul>
  330. </div>
  331. </div>
  332. </Col>
  333. </Row>
  334. <Row>
  335. <Col>
  336. <Card className="card-default">
  337. <CardHeader>
  338. <CardTitle>Riwayat</CardTitle>
  339. {/* <div className="text-sm">DataTables has most features enabled by default, so all you need to do to use it with your own tables is to call the construction function: $().DataTable();.</div> */}
  340. </CardHeader>
  341. <CardBody>
  342. <Datatable options={{ responsive: true }}>
  343. <table className="table table-striped my-4 w-100">
  344. <thead>
  345. <tr>
  346. <th>Tanggal</th>
  347. <th>Status</th>
  348. <th>Keterangan</th>
  349. <th>Dokumen</th>
  350. </tr>
  351. </thead>
  352. <tbody>
  353. <tr>
  354. <td>23/01/2022</td>
  355. <td>Rekomendasi Perbaikan</td>
  356. <td>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos, maxime.</td>
  357. <td>
  358. <em className="fa-lg far fa-file-code"></em>
  359. <a className="text-muted" href="">
  360. database.controller.js
  361. </a>
  362. </td>
  363. </tr>
  364. <tr>
  365. <td>23/01/2022</td>
  366. <td>Rekomendasi Perbaikan</td>
  367. <td>Lorem ipsum dolor sit amet consectetur adipisicing.</td>
  368. <td>
  369. <em className="fa-lg far fa-file-code"></em>
  370. <a className="text-muted" href="">
  371. database.controller.js
  372. </a>
  373. </td>
  374. </tr>
  375. <tr>
  376. <td>23/01/2022</td>
  377. <td>Rekomendasi Perbaikan</td>
  378. <td>Lorem ipsum dolor sit.</td>
  379. <td>
  380. <em className="fa-lg far fa-file-code"></em>
  381. <a className="text-muted" href="">
  382. database.controller.js
  383. </a>
  384. </td>
  385. </tr>
  386. </tbody>
  387. </table>
  388. </Datatable>
  389. </CardBody>
  390. </Card>
  391. </Col>
  392. </Row>
  393. </div>
  394. </ContentWrapper>
  395. );
  396. }
  397. }
  398. export default JawabanPencabutanSanksi;