detail.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345
  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 Scrollable from "@/components/Common/Scrollable";
  6. import ContentWrapper from "@/components/Layout/ContentWrapper";
  7. import {
  8. Row,
  9. Col,
  10. Card,
  11. CardHeader,
  12. CardBody,
  13. FormGroup,
  14. FormFeedback,
  15. FormText,
  16. Label,
  17. InputGroup,
  18. InputGroupAddon,
  19. InputGroupButtonDropdown,
  20. InputGroupText,
  21. Input,
  22. Button,
  23. DropdownToggle,
  24. DropdownMenu,
  25. CustomInput,
  26. DropdownItem,
  27. } from "reactstrap";
  28. let Dropzone = null;
  29. class DropzoneWrapper extends Component {
  30. state = {
  31. isClient: false,
  32. };
  33. componentDidMount = () => {
  34. Dropzone = require("react-dropzone").default;
  35. this.setState({ isClient: true });
  36. };
  37. render() {
  38. return Dropzone ? <Dropzone {...this.props}>{this.props.children}</Dropzone> : null;
  39. }
  40. }
  41. const styleHeaderText = {
  42. color: "brown",
  43. };
  44. const selectInstanceId = 1;
  45. class JawabanPencabutanSanksi extends Component {
  46. constructor(props) {
  47. super(props);
  48. this.state = {
  49. selectedOption: null,
  50. files: [],
  51. };
  52. }
  53. handleChangeSelect = (selectedOption) => {
  54. this.setState({ selectedOption });
  55. };
  56. onDrop = (files) => {
  57. this.setState({
  58. files: files.map((file) =>
  59. Object.assign(file, {
  60. preview: URL.createObjectURL(file),
  61. })
  62. ),
  63. stat: "Added " + files.length + " file(s)",
  64. });
  65. };
  66. uploadFiles = (e) => {
  67. e.preventDefault();
  68. e.stopPropagation();
  69. this.setState({
  70. stat: this.state.files.length ? "Dropzone ready to upload " + this.state.files.length + " file(s)" : "No files added.",
  71. });
  72. };
  73. clearFiles = (e) => {
  74. e.preventDefault();
  75. e.stopPropagation();
  76. this.setState({
  77. stat: this.state.files.length ? this.state.files.length + " file(s) cleared." : "No files to clear.",
  78. });
  79. this.setState({
  80. files: [],
  81. });
  82. };
  83. render() {
  84. const { files, selectedOption } = this.state;
  85. console.log(this.state);
  86. const thumbs = files.map((file, index) => (
  87. <Col md={3} key={index}>
  88. <img className="img-fluid mb-2" src={file.preview} alt="Item" />
  89. </Col>
  90. ));
  91. return (
  92. <ContentWrapper unwrap>
  93. <div className="bg-cover" style={{ backgroundImage: "url(/static/img/profile-bg.png)" }}>
  94. <div className="p-4 text-center" style={styleHeaderText}>
  95. <img className="img-thumbnail rounded-circle thumb128" src="/static/img/univ-avatar.png" alt="Avatar" />
  96. <h3 className="m-0">Universitas Satyagama</h3>
  97. <p>0742/O/1990</p>
  98. <p>Jalan Kamal Raya No 2-A Cengkareng</p>
  99. </div>
  100. </div>
  101. <div className="p-3">
  102. <div className="content-heading">
  103. <div>
  104. Permohonan Pencabutan Sanksi
  105. {/* <small>Form pembuatan laporan baru v.0.1</small> */}
  106. </div>
  107. <div className="ml-auto">
  108. <Link href="/app/pt/keberatan">
  109. <button className="btn btn-sm btn-secondary text-sm">&lt; back</button>
  110. </Link>
  111. </div>
  112. </div>
  113. <Row>
  114. <Col xl="9">
  115. <Card className="card-default">
  116. {/* <CardHeader>
  117. <label>Informasi Dokumen</label>
  118. </CardHeader> */}
  119. <CardBody>
  120. <Row>
  121. <Col lg="6">
  122. <p className="lead bb">Detail</p>
  123. <form className="form-horizontal">
  124. <FormGroup row>
  125. <Col md="4">Order ID:</Col>
  126. <Col md="8">
  127. <strong>987654</strong>
  128. </Col>
  129. </FormGroup>
  130. <FormGroup row>
  131. <Col md="4">Purchased On:</Col>
  132. <Col md="8">
  133. <strong>03/11/2015 10:10</strong>
  134. </Col>
  135. </FormGroup>
  136. <FormGroup row>
  137. <Col md="4">Client Name:</Col>
  138. <Col md="8">
  139. <strong>Addison Nichols</strong>
  140. </Col>
  141. </FormGroup>
  142. <FormGroup row>
  143. <Col md="4">Items:</Col>
  144. <Col md="8">
  145. <strong>547</strong>
  146. </Col>
  147. </FormGroup>
  148. <FormGroup row>
  149. <Col md="4">Amount:</Col>
  150. <Col md="8">
  151. <strong>$515.20</strong>
  152. </Col>
  153. </FormGroup>
  154. <FormGroup row>
  155. <Col md="4">Shipment:</Col>
  156. <Col md="8">
  157. <strong>04/10/2015</strong>
  158. </Col>
  159. </FormGroup>
  160. <FormGroup row>
  161. <Col md="4">Status</Col>
  162. <Col md="8">
  163. <div className="badge badge-info">Shipped</div>
  164. </Col>
  165. </FormGroup>
  166. <FormGroup row>
  167. <Col md="4">File Pendukung</Col>
  168. <Col md="8">
  169. <Scrollable height="120px" className="list-group">
  170. <table className="table table-bordered bg-transparent">
  171. <tbody>
  172. <tr>
  173. <td>
  174. <em className="fa-lg far fa-file-code"></em>
  175. </td>
  176. <td>
  177. <a className="text-muted" href="">
  178. database.controller.js
  179. </a>
  180. </td>
  181. </tr>
  182. <tr>
  183. <td>
  184. <em className="fa-lg far fa-file-image"></em>
  185. </td>
  186. <td>
  187. <a className="text-muted" href="">
  188. baground-lg.png
  189. </a>
  190. </td>
  191. </tr>
  192. <tr>
  193. <td>
  194. <em className="fa-lg far fa-file-code"></em>
  195. </td>
  196. <td>
  197. <a className="text-muted" href="">
  198. picture.controller.js
  199. </a>
  200. </td>
  201. </tr>
  202. <tr>
  203. <td>
  204. <em className="fa-lg far fa-file-word"></em>
  205. </td>
  206. <td>
  207. <a className="text-muted" href="">
  208. applicat-diagrams.docx
  209. </a>
  210. </td>
  211. </tr>
  212. <tr>
  213. <td>
  214. <em className="fa-lg far fa-file-code"></em>
  215. </td>
  216. <td>
  217. <a className="text-muted" href="">
  218. database.controller.js
  219. </a>
  220. </td>
  221. </tr>
  222. <tr>
  223. <td>
  224. <em className="fa-lg far fa-file-code"></em>
  225. </td>
  226. <td>
  227. <a className="text-muted" href="">
  228. database.controller.js
  229. </a>
  230. </td>
  231. </tr>
  232. </tbody>
  233. </table>
  234. </Scrollable>
  235. </Col>
  236. </FormGroup>
  237. </form>
  238. </Col>
  239. <Col lg={6}>
  240. <p className="lead bb">Jawaban</p>
  241. <form className="form-horizontal" method="get" action="/" onSubmit={this.onSubmit}>
  242. <FormGroup>
  243. <label className="row-form-label">Status</label>
  244. <div className="row-md-10">
  245. <Select
  246. instanceId={selectInstanceId + 1}
  247. value={this.state.selectedOption}
  248. onChange={this.handleChangeSelect}
  249. options={[
  250. { value: "diterima", label: "Diterima", className: "State-ACT" },
  251. { value: "rekomendasi perbaikan", label: "Rekomendasi Perbaikan", className: "State-ACT" },
  252. ]}
  253. required
  254. />
  255. {/* <span className="form-text">Pilih Jenis Pelanggaran</span> */}
  256. </div>
  257. </FormGroup>
  258. {selectedOption && selectedOption.value === "rekomendasi perbaikan" ? (
  259. <FormGroup>
  260. <label className="row-form-label">Keterangan</label>
  261. <div className="row-md-10">
  262. <Input type="textarea" value={this.state.keteranganLaporan} onChange={this.setKeteranganPelaporan} required />
  263. {/* <span className="form-text">Deskripsi pelaporan minimum karakter 50 maksimum 200 karakter</span> */}
  264. </div>
  265. </FormGroup>
  266. ) : (
  267. ""
  268. )}
  269. <FormGroup>
  270. <label className="row-form-label">{selectedOption && selectedOption.value === "diterima" ? "Upload Dokumen" : "Usulan Perbaikan"}</label>
  271. <div className="row-md-10">
  272. <DropzoneWrapper className="" onDrop={this.onDrop}>
  273. {({ getRootProps, getInputProps, isDragActive }) => {
  274. return (
  275. <div {...getRootProps()} className={"dropzone card p-3 " + (isDragActive ? "dropzone-drag-active" : "")}>
  276. <input {...getInputProps()} />
  277. <div className="dropzone-previews flex">
  278. {this.state.files.length > 0 ? <Row>{thumbs}</Row> : <div className="text-center dz-default dz-message">Drop files here to upload</div>}
  279. </div>
  280. <div className="d-flex align-items-center">
  281. <small className="ml-auto">
  282. <button type="button" className="btn btn-link" onClick={this.clearFiles}>
  283. Clear files
  284. </button>
  285. </small>
  286. </div>
  287. </div>
  288. );
  289. }}
  290. </DropzoneWrapper>
  291. </div>
  292. </FormGroup>
  293. <FormGroup>
  294. <div className="row-xl-10">
  295. <button className="btn btn-sm btn-primary" type="submit">
  296. Simpan
  297. </button>
  298. </div>
  299. </FormGroup>
  300. </form>
  301. </Col>
  302. </Row>
  303. </CardBody>
  304. </Card>
  305. {/* END card */}
  306. </Col>
  307. <Col xl="3">
  308. <div className="card card-default">
  309. <div className="card-body">
  310. <div className="text-center">
  311. <h3 className="mt-0">Universitas Satyagama</h3>
  312. <p>0742/O/1990</p>
  313. </div>
  314. <hr />
  315. <ul className="list-unstyled px-4">
  316. <li>
  317. <em className="fa fa-globe fa-fw mr-3"></em>www.satyagama.ac.id
  318. </li>
  319. <li>
  320. <em className="fa fa-graduation-cap fa-fw mr-3"></em>Status Pelanggaran : Tidak Ada
  321. </li>
  322. </ul>
  323. </div>
  324. </div>
  325. </Col>
  326. </Row>
  327. </div>
  328. </ContentWrapper>
  329. );
  330. }
  331. }
  332. export default JawabanPencabutanSanksi;