浏览代码

commit issue januari 2024

andi 1 年之前
父节点
当前提交
6cb4009db1

+ 1 - 1
components/PT/CabutSanksi/Riwayat.js

@@ -26,7 +26,7 @@ function Riwayat({ data, role }) {
 							<tr>
 								<th>Tanggal</th>
 								<th>Dokumen</th>
-								<th>index</th>
+								<th>Tahap</th>
 							</tr>
 						</thead>
 						

+ 2 - 2
components/PT/DocPerbaikan/Riwayat.js

@@ -10,13 +10,13 @@ function Riwayat({ data }) {
 			</CardHeader>
 			<CardBody>
 				<Datatable options={{ responsive: true }}>
-					<table className="table table-striped my-4 w-100" data-order='[[0, "desc"]]'>
+					<table className="table table-striped my-4 w-100" data-order='[[3, "desc"]]'>
 						<thead>
 							<tr>
 								<th>Tanggal</th>
 								<th>Ketarangan</th>
 								<th>Dokumen</th>
-								<th>Index</th>
+								<th>Tahap</th>
 							</tr>
 						</thead>
 						<tbody>

+ 1 - 1
components/PencabutanSanksi/Riwayat.js

@@ -29,7 +29,7 @@ function Riwayat({ data, role }) {
 								<th>Status</th>
 								<th>Keterangan</th>
 								<th>Dokumen</th>
-								<th>index</th>
+								<th>Tahap</th>
 
 							</tr>
 						</thead>

+ 1 - 1
components/PencabutanSanksi/RiwayatPerbaikan.js

@@ -28,7 +28,7 @@ function RiwayatPerbaikan({ data, role }) {
 								<th>Tanggal</th>
 								<th>Keterangan</th>
 								<th>Dokumen</th>
-								<th>index</th>
+								<th>Tahap</th>
 							</tr>
 						</thead>
 						<tbody>

+ 1 - 1
pages/app/pencabutan-sanksi/detail.js

@@ -383,7 +383,7 @@ class JawabanPencabutanSanksi extends Component {
 															)}
 															<FormGroup>
 																<div className="row-xl-10">
-																	<Button color className="color-3e3a8e" type="submit" disabled={isSubmitting||lastPengajuan?.index + 1 === sanksi?.data?.index_perbaikan}>
+																	<Button color className="color-3e3a8e" type="submit" disabled={isSubmitting||lastPengajuan?.index + 1 !== sanksi?.data?.index_perbaikan}>
 																		<span className="font-color-white">
 																			Simpan
 																		</span>

+ 14 - 2
pages/laporan/new/index.js

@@ -63,6 +63,17 @@ const checkIfFilesAreCorrectType = (files) => {
   }
   return valid;
 };
+const checkIfFilesAreCorrectTypePDF = (files) => {
+  let valid = true;
+  if (files) {
+    files.map((file) => {
+      if (!["application/pdf", "application/pdf"].includes(file.type)) {
+        valid = false;
+      }
+    });
+  }
+  return valid;
+};
 
 const laporanSchema = Yup.object().shape({
   no_laporan: Yup.string().required(),
@@ -93,7 +104,8 @@ const laporanSchema = Yup.object().shape({
       "filesize",
       "Maksimal ukuran setiap dokumen 15mb",
       checkIfFilesAreTooBig
-    ),
+    )
+    .test("type", "File harus berformat PDF", checkIfFilesAreCorrectTypePDF),
   is_private: Yup.boolean().notRequired(),
 });
 
@@ -606,7 +618,7 @@ class App extends Component {
                             className="form-text text-danger"
                           />
                           <p className="mrgn-top-5">
-                            Ukuran setiap dokumen maksimal 15mb
+                          Ukuran setiap dokumen PDF maksimal 15 Mb
                           </p>
                         </div>
                       </FormGroup>

+ 1 - 1
pages/pageDone.js

@@ -32,7 +32,7 @@ class PlenoSanksi extends React.Component {
                         <Link href="/app">
                             <div className="btn-radius d-block text-center">
                                 <Button color className="btn-labeled-3">
-                                    <h4 className="p-0 mt-2">Kunjung Aplikasi SIDALI</h4>
+                                    <h4 className="p-0 mt-2">Kunjungi Aplikasi SIDALI</h4>
                                 </Button>
                             </div>
                         </Link>

+ 88 - 16
pages/pt/pencabutan-sanksi/detail.js

@@ -42,7 +42,8 @@ const checkIfFilesAreCorrectType = (files) => {
 };
 
 const docSchema = Yup.object().shape({
-	dokumen: Yup.array().max(2, "Maximal 2 dokumen").required("Required").test("filesize", "Maksimal ukuran dokumen 15mb", checkIfFilesAreTooBig),
+	dokumen: Yup.array().max(1, "Maximal 1 dokumen").required("Required").test("filesize", "Maksimal ukuran dokumen 15mb", checkIfFilesAreTooBig),
+	dokumenRekom: Yup.array().max(1, "Maximal 1 dokumen").required("Required").test("filesize", "Maksimal ukuran dokumen 15mb", checkIfFilesAreTooBig),
 });
 let Dropzone = null;
 class DropzoneWrapper extends Component {
@@ -63,6 +64,7 @@ class DetailPencabutanSanksi extends Component {
 		super(props);
 		this.state = {
 			files: [],
+			filesRekom: [],
 			sanksi: {},
 			pt: null,
 			error: null,
@@ -90,19 +92,29 @@ class DetailPencabutanSanksi extends Component {
 			stat: "Added " + selectedFile.length + " file(s)",
 		});
 		const selectFile = this.state.selectedFile
-		this.setState(prevState => ({
-			files: [...prevState.files, ...selectFile]
-		}))
+		// this.setState(prevState => ({
+		// 	files: [...prevState.files, ...selectFile]
+		// }))
+		this.setState({ files: selectFile })
 	};
-
-	uploadFiles = (e) => {
-		e.preventDefault();
-		e.stopPropagation();
+	onDropRekom = (selectedFile) => {
 		this.setState({
-			stat: this.state.files.length ? "Dropzone ready to upload " + this.state.files.length + " file(s)" : "No files added.",
+			selectedFile: selectedFile.map((file) =>
+				Object.assign(file, {
+					preview: URL.createObjectURL(file),
+				})
+			),
+			stat: "Added " + selectedFile.length + " file(s)",
 		});
+		const selectFile = this.state.selectedFile
+		// this.setState(prevState => ({
+		// 	filesRekom: [...prevState.filesRekom, ...selectFile]
+		// }))
+		this.setState({ filesRekom: selectFile })
 	};
 
+
+
 	clearFiles = (e) => {
 		e.preventDefault();
 		e.stopPropagation();
@@ -113,7 +125,16 @@ class DetailPencabutanSanksi extends Component {
 			files: [],
 		});
 	};
-
+	clearFilesRekom = (e) => {
+		e.preventDefault();
+		e.stopPropagation();
+		this.setState({
+			stat: this.state.filesRekom.length ? this.state.filesRekom.length + " file(s) cleared." : "No files to clear.",
+		});
+		this.setState({
+			filesRekom: [],
+		});
+	};
 	handleKirim = async (data) => {
 		const getToken = await getCsrf();
 		const _csrf = getToken.token;
@@ -122,6 +143,9 @@ class DetailPencabutanSanksi extends Component {
 		data.dokumen.forEach((e) => {
 			formdata.append("dokumen", e);
 		});
+		data.dokumenRekom.forEach((e) => {
+			formdata.append("dokumen_rekomendasi", e);
+		});
 		const id = toast.loading("Please wait...");
 		// await FinalisasiPerbaikan(token, query.id, { is_finalisasi: "true" }, _csrf)
 		const added = await addCabutSanksi(token, query.id, formdata, _csrf);
@@ -134,11 +158,16 @@ class DetailPencabutanSanksi extends Component {
 			});
 		}
 	};
-	
 
-	render() {
-		const { files, sanksi, pt } = this.state;
 
+	render() {
+		const { files, sanksi, pt, filesRekom } = this.state;
+		const thumbsRekom = filesRekom.map((file, index) => (
+			<div md={3} key={index}>
+				{/* <img className="img-fluid mb-2" src={file.preview} alt="Item" /> */}
+				<span className="text-left">{index + 1}.{file.name}</span>
+			</div>
+		));
 		const thumbs = files.map((file, index) => (
 			<div md={3} key={index}>
 				{/* <img className="img-fluid mb-2" src={file.preview} alt="Item" /> */}
@@ -177,6 +206,7 @@ class DetailPencabutanSanksi extends Component {
 												<Formik
 													initialValues={{
 														dokumen: [],
+														dokumenRekom: []
 													}}
 													validationSchema={docSchema}
 													onSubmit={this.handleKirim}
@@ -184,7 +214,7 @@ class DetailPencabutanSanksi extends Component {
 													{() => (
 														<Form className="form-horizontal">
 															<FormGroup>
-																<label className="row-form-label">Upload Dokumen:</label>
+																<label className="row-form-label"><span className=" font-12 font-weight-bold">Surat permohonan pencabutan sanksi :</span></label>
 																<div className=" font-color-black block">Note : Dokumen perbaikan akan diperiksa setelah surat permohonan pencabutan sanksi diunggah</div>
 																<div className="row-md-10">
 																	<Field name="dokumen">
@@ -225,9 +255,51 @@ class DetailPencabutanSanksi extends Component {
 																	<ErrorMessage name="dokumen" component="div" className="form-text text-danger" />
 																</div>
 															</FormGroup>
+															<FormGroup>
+																<label className="row-form-label"><span className=" font-12 font-weight-bold">Rekomendasi pencabutan sanksi dari LLDIKTI :</span></label>
+																<div className="row-md-10">
+																	<Field name="dokumenRekom">
+																		{({ field, form }) => (
+																			<DropzoneWrapper
+																				className=""
+																				onDrop={(e) => {
+																					this.onDropRekom(e);
+																					form.setFieldValue(field.name, e);
+																				}}
+																			>
+																				{({ getRootProps, getInputProps, isDragActive }) => {
+																					return (
+																						<div {...getRootProps()} className={"dropzone card" + (isDragActive ? "dropzone-drag-active" : "")}>
+																							<input {...getInputProps()} />
+																							<div className="dropzone-previews flex">
+																								<div className="dropzone-style-1">
+																									<div className="center-ver-hor dropzone-previews flex">{this.state.filesRekom.length > 0 ? <Row><span className="text-left">{thumbsRekom
+																									}</span></Row> :
+																										<div className="text-center fa-2x icon-cloud-upload mr-2 ">
+																											<h5 className="text-center dz-default dz-message">Klik untuk upload dokumen</h5>
+																										</div>
+																									}
+																									</div>
+																								</div>																							</div>
+																							<div className="d-flex align-items-center">
+																								<small className="ml-auto">
+																									<button type="button" className="btn btn-link" onClick={this.clearFilesRekom}>
+																										Clear files
+																									</button>
+																								</small>
+																							</div>
+																						</div>
+																					);
+																				}}
+																			</DropzoneWrapper>
+																		)}
+																	</Field>
+																	<ErrorMessage name="dokumenRekom" component="div" className="form-text text-danger" />
+																</div>
+															</FormGroup>
 															<FormGroup>
 																<div className="row-xl-10">
-																	<Button color className="color-3e3a8e" disabled={ sanksi.data.is_finalisasi === false || false||lastPengajuan?.index + 1 === sanksi?.data?.index_perbaikan} type="submit">
+																	<Button color className="color-3e3a8e" disabled={sanksi.data.is_finalisasi === false || false || lastPengajuan?.index + 1 === sanksi?.data?.index_perbaikan} type="submit">
 																		<span className="font-color-white">
 																			Kirim
 																		</span>
@@ -250,7 +322,7 @@ class DetailPencabutanSanksi extends Component {
 					{sanksi.data && (
 						<Row>
 							<Col>
-								<Riwayat data={sanksi.data?.riwayat_pengajuan_cabut_sanksi } />
+								<Riwayat data={sanksi.data?.riwayat_pengajuan_cabut_sanksi} />
 							</Col>
 						</Row>
 					)}

+ 16 - 6
pages/pt/sanksi/dokumen-perbaikan/detail.js

@@ -17,6 +17,8 @@ import { Formik, Form, Field, ErrorMessage } from "formik";
 import * as Yup from "yup";
 import { getCsrf } from "../../../../actions/security";
 import { FinalisasiPerbaikan } from "../../../../actions/docPerbaikan";
+import swal from "sweetalert2";
+
 const checkIfFilesAreTooBig = (files) => {
 	let valid = true;
 	if (files) {
@@ -68,7 +70,6 @@ class DetailPerbaikanDoc extends Component {
 			keterangan: "",
 			pt: null,
 			selectedFile: {},
-			modalTidak: false,
 		};
 	}
 
@@ -143,9 +144,16 @@ class DetailPerbaikanDoc extends Component {
 		}
 	};
 	setModal = () => {
-		this.setState({
-			modal: !this.state.modal
-		})
+		if (this.state.files.length || this.state.keterangan.length) {
+			toast("Dokumen belum diupload",{  type: "error", isLoading: false, autoClose: true, closeButton: true} );
+
+		}
+		else {
+			this.setState({
+				modal: !this.state.modal
+			})
+		}
+
 	}
 
 	render() {
@@ -163,7 +171,7 @@ class DetailPerbaikanDoc extends Component {
 		return (
 			<ContentWrapper unwrap>
 				<Modal isOpen={this.state.modal} >
-					<ModalBody>jika klik Ya maka tidak bisa upload dokumen perbaikan lagi dan segera dilakukan permohonan pencabutan sanksi</ModalBody>
+					<ModalBody>jika klik Ya maka tidak bisa upload dokumen perbaikan lagi dan segera dilakukan permohonan <span className=" font-weight-bold">pencabutan sanksi</span> </ModalBody>
 					<ModalFooter>
 
 						<Button color className="btn-login" onClick={async () => {
@@ -281,12 +289,14 @@ class DetailPerbaikanDoc extends Component {
 																	</Button>
 																</div>
 																<div className=" inline float-right ml-auto mr-3">
-																	<Button color="success" className=" float-right" onClick={this.setModal} disabled={!sanksi.data?.perbaikan.length || sanksi.data.is_finalisasi === true||lastDatePerbaikan?.index + 1 === sanksi?.data?.index_perbaikan}>
+																	<Button color="success" className=" float-right" onClick={this.setModal} disabled={!sanksi.data?.perbaikan.length || sanksi.data.is_finalisasi === true || lastDatePerbaikan?.index + 1 === sanksi?.data?.index_perbaikan}>
 																		<span className="font-color-white">Finalisasi upload dokumen perbaikan</span>
 																	</Button>
 																</div>
 
 															</FormGroup>
+															<div className=" font-color-black block">Note : Jika sudah melakukan upload dokumen perbaikan secara keseluruhan, silahkan klik tombol finalisasi upload dokumen</div>
+
 														</Form>
 													)}
 												</Formik>

+ 3 - 0
styles/app/app/mycss.scss

@@ -208,6 +208,9 @@ border-radius: 4px;
     .font-20{
       font-size: 20px;
     }
+    .font-12{
+      font-size: 12pt;
+    }
 
 
     .icon-triangle-onModalPT {