andi %!s(int64=2) %!d(string=hai) anos
pai
achega
bae414b3a6
Modificáronse 33 ficheiros con 925 adicións e 634 borrados
  1. 22 4
      components/Banding/Riwayat.js
  2. 21 4
      components/DocPerbaikan/Riwayat.js
  3. 5 7
      components/Extras/calendar.view.js
  4. 20 4
      components/Keberatan/Riwayat.js
  5. 20 4
      components/Main/DetailLaporan.js
  6. 31 12
      components/Main/DetailSanksi.js
  7. 22 5
      components/Main/PermohonanPT.js
  8. 12 21
      components/NaikSanksi/TableLaporan.js
  9. 2 2
      components/Pelaporan/InputData.js
  10. 10 1
      components/Pemeriksaan/DetailLaporan.js
  11. 2 2
      components/Pemeriksaan/InputEvaluasi.js
  12. 19 1
      components/Pemeriksaan/TableRiwayat.js
  13. 21 4
      components/PencabutanSanksi/Riwayat.js
  14. 20 2
      components/Penjadwalan/DetailLaporan.js
  15. 22 5
      components/RekomendasiDelegasi/DetailSanksi.js
  16. 46 34
      components/RekomendasiDelegasi/InputRekomendasi.js
  17. 30 7
      components/RekomendasiDelegasi/TableRiwayat.js
  18. 24 6
      components/Sanksi/BeritaAcara.js
  19. 139 242
      components/Sanksi/DetailSanksi.js
  20. 9 0
      components/Sanksi/Ringkasan.js
  21. 10 19
      components/TurunSanksi/TableLaporan.js
  22. 42 30
      pages/app/banding/detail.js
  23. 43 31
      pages/app/keberatan/detail.js
  24. 1 1
      pages/app/pelaporan/detail.js
  25. 47 24
      pages/app/pelaporan/index.js
  26. 44 22
      pages/app/pemeriksaan/index.js
  27. 2 2
      pages/app/pemeriksaan/new.js
  28. 32 20
      pages/app/pencabutan-sanksi/detail.js
  29. 47 25
      pages/app/penjadwalan/index.js
  30. 2 2
      pages/app/perbaikan/detail.js
  31. 2 2
      pages/app/rekomendasi-delegasi/detail.js
  32. 47 25
      pages/app/sanksi/index.js
  33. 109 64
      pages/app/sanksi/proses.js

+ 22 - 4
components/Banding/Riwayat.js

@@ -1,8 +1,18 @@
 import Datatable from "@/components/Tables/Datatable";
 import moment from "moment";
 import { Card, CardHeader, CardBody, CardTitle } from "reactstrap";
+import Swal from "sweetalert2";
 
-function Riwayat({ data }) {
+function Riwayat({ data, role }) {
+	const handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	return (
 		<Card className="card-default">
 			<CardHeader>
@@ -27,9 +37,17 @@ function Riwayat({ data }) {
 										{data.dokumen.map((e) => (
 											<>
 												<em className="fa-lg far fa-file-code"></em>
-												<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-													{e.judul}
-												</a>
+												{role === 2024 ?
+													<a className="text-muted" onClick={handleOpenAlert}>
+														{e.judul}
+													</a>
+													:
+													<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+														{e.judul}
+													</a>
+
+												}
+
 											</>
 										))}
 									</td>

+ 21 - 4
components/DocPerbaikan/Riwayat.js

@@ -1,8 +1,18 @@
 import Datatable from "@/components/Tables/Datatable";
 import moment from "moment";
 import { Card, CardHeader, CardBody, CardTitle } from "reactstrap";
+import Swal from "sweetalert2";
 
-function Riwayat({ data }) {
+function Riwayat({ data, role }) {
+	const handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	return (
 		<Card className="card-default">
 			<CardHeader>
@@ -28,9 +38,16 @@ function Riwayat({ data }) {
 											{value.dokumen.map((e) => (
 												<>
 													<em className="fa-lg far fa-file-code"></em>
-													<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-														{e.judul}
-													</a>
+													{role === 2024 ?
+														<a className="text-muted" onClick={handleOpenAlert}>
+															{e.judul}
+														</a>
+														:
+														<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+															{e.judul}
+														</a>
+
+													}
 												</>
 											))}
 										</td>

+ 5 - 7
components/Extras/calendar.view.js

@@ -140,10 +140,9 @@ class Calendar extends Component {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',
-				text: 'Maaf anda tidak memiliki akses untuk menyelesaikan proses ini.',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
-				confirmButtonText: 'Kembali'
-				// footer: '<a href="">Why do I have this issue?</a>'
+				confirmButtonText: 'Oke'
 			})
 		} else {
 			const { query, token } = this.props;
@@ -202,10 +201,9 @@ class Calendar extends Component {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',
-				text: 'Maaf anda tidak memiliki akses untuk menyelesaikan proses ini.',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
-				confirmButtonText: 'Kembali'
-				// footer: '<a href="">Why do I have this issue?</a>'
+				confirmButtonText: 'Oke'
 			})
 		} else {
 			const getToken = await getCsrf();
@@ -265,7 +263,7 @@ class Calendar extends Component {
 							<Col>
 								<Card className="card-default">
 									<CardBody>
-										<DetailLaporan noStatus data={laporan.data} />
+										<DetailLaporan noStatus data={laporan.data} role={this.props.user.role.id}/>
 									</CardBody>
 								</Card>
 							</Col>

+ 20 - 4
components/Keberatan/Riwayat.js

@@ -2,8 +2,18 @@ import Datatable from "@/components/Tables/Datatable";
 import moment from "moment";
 import { Card, CardHeader, CardBody, CardTitle } from "reactstrap";
 import { API_URL } from "@/env";
+import Swal from "sweetalert2";
 
-function Riwayat({ data }) {
+function Riwayat({ data, role }) {
+	const handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	return (
 		<Card className="card-default">
 			<CardHeader>
@@ -30,9 +40,15 @@ function Riwayat({ data }) {
 										{data.dokumen.map((e) => (
 											<>
 												<em className="fa-lg far fa-file-code"></em>
-												<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-													{e.judul}
-												</a>
+												{role === 2024 ?
+													<a className="text-muted" onClick={handleOpenAlert}>
+														{e.judul}
+													</a>
+													:
+													<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+														{e.judul}
+													</a>
+												}
 											</>
 										))}
 									</td>

+ 20 - 4
components/Main/DetailLaporan.js

@@ -2,9 +2,19 @@ import Scrollable from "@/components/Common/Scrollable";
 import moment from "moment";
 import { Col, FormGroup } from "reactstrap";
 import { useSelector } from "react-redux";
+import Swal from "sweetalert2";
 
-function DetailLaporan({ data, noTitle = false, noStatus = false }) {
+function DetailLaporan({ data, noTitle = false, noStatus = false, role }) {
 	const user = useSelector((state) => state.user);
+	const handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	return (
 		<>
 			{(!data.user.isPrivate || user?.role.id === 2020) && (
@@ -149,9 +159,15 @@ function DetailLaporan({ data, noTitle = false, noStatus = false }) {
 												<em className="fa-lg far fa-file-code"></em>
 											</td>
 											<td>
-												<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-													{e.judul}
-												</a>
+												{role === 2024 ?
+													<a className="text-muted" onClick={handleOpenAlert}>
+														{e.judul}
+													</a> :
+													<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+														{e.judul}
+													</a>
+												}
+
 											</td>
 										</tr>
 									))}

+ 31 - 12
components/Main/DetailSanksi.js

@@ -2,8 +2,19 @@ import Scrollable from "@/components/Common/Scrollable";
 import moment from "moment";
 import { Col, FormGroup, Table } from "reactstrap";
 import { API_URL } from "@/env";
+import Swal from "sweetalert2";
+import { connect } from "react-redux";
 
-function DetailSanksi({ data, noTitle = false }) {
+function DetailSanksi({ data, noTitle = false, role }) {
+	const handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	return (
 		<>
 			{noTitle ? "" : <p className="lead bb">Detail Sanksi</p>}
@@ -29,12 +40,14 @@ function DetailSanksi({ data, noTitle = false }) {
 						</Scrollable>
 					</Col>
 				</FormGroup>
-				<FormGroup row>
-					<Col md="4">Tanggal Penetapan Sanksi:</Col>
-					<Col md="8">
-						<strong>{moment(data.masa_berlaku?.from_date).locale("id").format("D MMMM YYYY")}</strong>
-					</Col>
-				</FormGroup>
+				{data.masa_berlaku?.from_date && data.masa_berlaku?.from_date === null &&
+					<FormGroup row>
+						<Col md="4">Tanggal Penetapan Sanksi:</Col>
+						<Col md="8">
+							<strong>{moment(data.masa_berlaku?.from_date).locale("id").format("D MMMM YYYY")}</strong>
+						</Col>
+					</FormGroup>
+				}
 				{
 					data.tanggal_akhir_keberatan &&
 					<FormGroup row>
@@ -65,9 +78,15 @@ function DetailSanksi({ data, noTitle = false }) {
 												<em className="fa-lg far fa-file-code"></em>
 											</td>
 											<td>
-												<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-													{e.judul}
-												</a>
+												{role === 2024 ?
+													<a className="text-muted" onClick={handleOpenAlert}>
+														{e.judul}
+													</a>
+													:
+													<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+														{e.judul}
+													</a>
+												}
 											</td>
 										</tr>
 									))}
@@ -123,5 +142,5 @@ function DetailSanksi({ data, noTitle = false }) {
 		</>
 	);
 }
-
-export default DetailSanksi;
+const mapStateToProps = (state) => ({ user: state.user, token: state.token });
+export default connect(mapStateToProps)(DetailSanksi);

+ 22 - 5
components/Main/PermohonanPT.js

@@ -1,7 +1,17 @@
 import Scrollable from "@/components/Common/Scrollable";
 import { Col, FormGroup } from "reactstrap";
+import Swal from "sweetalert2";
 
-function PermohonanPT({ data, title = null }) {
+function PermohonanPT({ data, title = null, role }) {
+	const handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	return (
 		<>
 			<p className="lead bb">{title || "Permohonan dari PT"}</p>
@@ -14,13 +24,20 @@ function PermohonanPT({ data, title = null }) {
 								<tbody>
 									{data.dokumen.map((e) => (
 										<tr>
-											<td  style={{ width: "30px" }}>
+											<td style={{ width: "30px" }}>
 												<em className="fa-lg far fa-file-code"></em>
 											</td>
 											<td>
-												<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-													{e.judul}
-												</a>
+												{role === 2024 ?
+													<a className="text-muted" onClick={handleOpenAlert}>
+														{e.judul}
+													</a>
+													:
+													<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+														{e.judul}
+													</a>
+												}
+
 											</td>
 										</tr>
 									))}

+ 12 - 21
components/NaikSanksi/TableLaporan.js

@@ -57,31 +57,22 @@ function TableLaporan({ listData, to, linkName, status = false, noBy = false })
 												</div>
 											</td>
 											<td>
-											
-															<h4>{data.no_sanksi}</h4>
-												
+												<h4>{data.no_sanksi}</h4>
 											</td>
-
-											<td className=" col-md-4">
-												<div className="table-desc">
-													<div className="media align-items-center">
-														<div className="media-body d-flex">
-															<div>
-																<h4 className="m-0">{data.laporan.pt.nama.length > 64 ? data.laporan.pt.nama.substring(0, 64) + "..." : data.laporan.pt.nama}</h4>
-																<p className="w-105">{data.laporan.keterangan}</p>
-															</div>
-														</div>
-													</div>
+											<td className=" col-md-6">
+												<div>
+													<h4 className="m-0">{data.laporan.pt.nama.length > 64 ? data.laporan.pt.nama.substring(0, 64) + "..." : data.laporan.pt.nama}</h4>
+													<p className="w-105">{data.laporan.keterangan.length > 100 ? data.laporan.keterangan.substring(0, 100) + "..." : data.laporan.keterangan}</p>
 												</div>
 											</td>
-											{/* <td>
-												{data.sanksi.length ? data.sanksi.map((e) => (<h4 className="w-105">Sanksi Administratif {e.label}</h4>)) : data.pelanggaran.map((e) => (<h4 className="w-105">Sanksi Administratif:  {e.label_sanksi}</h4>))}
-												<p className="w-105">{data.keterangan}</p>
-											</td> */}
+
 											<td className=" col-md-5">
-												<h4>
-													Sanksi Administratif : {getLabelSanksi(data.sanksi, "level") === 3 ? "Berat" : getLabelSanksi(data.sanksi, "level") === 2 ? "Sedang" : "Ringan"}
-												</h4>
+												<div>
+													<h4>
+														Sanksi Administratif : {getLabelSanksi(data.sanksi, "level") === 3 ? "Berat" : getLabelSanksi(data.sanksi, "level") === 2 ? "Sedang" : "Ringan"}
+													</h4>
+													<p className="w-105">{data.keterangan}</p>
+												</div>
 											</td>
 											{!noBy && <td>{data.user.isPrivate ? "" : data.user.nama}</td>}
 											<td>

+ 2 - 2
components/Pelaporan/InputData.js

@@ -150,9 +150,9 @@ export class InputData extends Component {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',
-				text: 'Maaf anda tidak memiliki akses untuk menyelesaikan proses ini.',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
-				confirmButtonText: 'Kembali'
+				confirmButtonText: 'Oke'
 				// footer: '<a href="">Why do I have this issue?</a>'
 			})
 		} else {

+ 10 - 1
components/Pemeriksaan/DetailLaporan.js

@@ -3,7 +3,7 @@ import moment from "moment";
 import { Col, FormGroup } from "reactstrap";
 import { useSelector } from "react-redux";
 
-function DetailLaporan({ data, noTitle = false, noStatus = false }) {
+function DetailLaporan({ data, noTitle = false, noStatus = false, role }) {
 	const user = useSelector((state) => state.user);
 	return (
 		<>
@@ -148,6 +148,15 @@ function DetailLaporan({ data, noTitle = false, noStatus = false }) {
 												<em className="fa-lg far fa-file-code"></em>
 											</td>
 											<td>
+												{role ===2024?
+												<a className="text-muted">
+													{e.judul}
+												</a>
+												:	<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+													{e.judul}
+												</a>
+											
+											}
 												<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
 													{e.judul}
 												</a>

+ 2 - 2
components/Pemeriksaan/InputEvaluasi.js

@@ -143,9 +143,9 @@ class InputEvaluasi extends Component {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',
-				text: 'Maaf anda tidak memiliki akses untuk menyelesaikan proses ini.',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
-				confirmButtonText: 'Kembali'
+				confirmButtonText: 'Oke'
 				// footer: '<a href="">Why do I have this issue?</a>'
 			})
 		} else {

+ 19 - 1
components/Pemeriksaan/TableRiwayat.js

@@ -1,6 +1,16 @@
 import Datatable from "@/components/Tables/Datatable";
+import Swal from "sweetalert2";
 
-function TableRiwayat({ data }) {
+function TableRiwayat({ data, role }) {
+	const handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	return (
 		// <Datatable options={{ responsive: true }}>
 		<div className="card-over">
@@ -23,6 +33,14 @@ function TableRiwayat({ data }) {
 								{e.dokumen.map((e, index) => (
 									<>
 										<em key="index" className="fa-lg far fa-file-code"></em>
+										{role === 2024 ?
+											<a className="text-muted" onClick={handleOpenAlert} >
+												{e.judul}
+											</a>
+											: <a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+												{e.judul}
+											</a>
+										}
 										<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
 											{e.judul}
 										</a>

+ 21 - 4
components/PencabutanSanksi/Riwayat.js

@@ -2,8 +2,18 @@ import Datatable from "@/components/Tables/Datatable";
 import moment from "moment";
 import { Card, CardHeader, CardBody, CardTitle } from "reactstrap";
 import { API_URL } from "@/env";
+import Swal from "sweetalert2";
 
-function Riwayat({ data }) {
+function Riwayat({ data, role }) {
+	const handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	return (
 		<Card className="card-default">
 			<CardHeader>
@@ -30,9 +40,16 @@ function Riwayat({ data }) {
 										{data.dokumen?.map((e) => (
 											<>
 												<em className="fa-lg far fa-file-code"></em>
-												<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-													{e.judul}
-												</a>
+												{role === 2024 ?
+													<a className="text-muted" onClick={handleOpenAlert}>
+														{e.judul}
+													</a>
+													:
+													<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+														{e.judul}
+													</a>
+
+												}
 											</>
 										))}
 									</td>

+ 20 - 2
components/Penjadwalan/DetailLaporan.js

@@ -2,9 +2,19 @@ import Scrollable from "@/components/Common/Scrollable";
 import moment from "moment";
 import { Col, FormGroup } from "reactstrap";
 import { useSelector } from "react-redux";
+import Swal from "sweetalert2";
 
-function DetailLaporan({ data, noTitle = false, noStatus = false }) {
+function DetailLaporan({ data, noTitle = false, noStatus = false, role }) {
 	const user = useSelector((state) => state.user);
+	const handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	return (
 		<>
 			{(!data.user.isPrivate || user?.role.id === 2020) && (
@@ -147,10 +157,18 @@ function DetailLaporan({ data, noTitle = false, noStatus = false }) {
 											<td style={{ width: "30px" }}>
 												<em className="fa-lg far fa-file-code"></em>
 											</td>
-											<td>
+
+											<td>{role === 2024 ?
+												<a className="text-muted" onClick={handleOpenAlert}>
+													{e.judul}
+												</a>
+												:
 												<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
 													{e.judul}
 												</a>
+
+											}
+
 											</td>
 										</tr>
 									))}

+ 22 - 5
components/RekomendasiDelegasi/DetailSanksi.js

@@ -4,8 +4,19 @@ import 'moment/min/locales';
 moment.locale('id');
 import { CardBody, Col, FormGroup, Table, Card } from "reactstrap";
 import { API_URL } from "@/env";
+import Swal from "sweetalert2";
 
-function DetailSanksi({ data, noTitle = false }) {
+
+function DetailSanksi({ data, noTitle = false, role }) {
+	const handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	return (
 		<Card className="card-default">
 			<CardBody>
@@ -64,13 +75,19 @@ function DetailSanksi({ data, noTitle = false }) {
 									<tbody>
 										{data.dokumen.map((e) => (
 											<tr>
-												<td  style={{ width: "30px" }}>
+												<td style={{ width: "30px" }}>
 													<em className="fa-lg far fa-file-code"></em>
 												</td>
 												<td>
-													<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-														{e.judul}
-													</a>
+													{role === 2024 ?
+														<a className="text-muted" onClick={handleOpenAlert}>
+															{e.judul}
+														</a>
+														:
+														<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+															{e.judul}
+														</a>
+													}
 												</td>
 											</tr>
 										))}

+ 46 - 34
components/RekomendasiDelegasi/InputRekomendasi.js

@@ -9,6 +9,7 @@ import { getOneSanksi, addRekomendasiDelegasi } from "@/actions/sanksi";
 import moment from "moment";
 import 'moment/min/locales';
 import { getCsrf } from "../../actions/security";
+import Swal from "sweetalert2";
 moment.locale('id');
 
 
@@ -66,7 +67,7 @@ class InputRekomendasi extends Component {
 			files: [],
 			sanksi: {},
 			data: {},
-			selectedFile:{}
+			selectedFile: {}
 		};
 	}
 
@@ -82,20 +83,20 @@ class InputRekomendasi extends Component {
 		});
 	};
 
-    onDrop = (selectedFile) => {
-        this.setState({
-            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 => ({
-            files: [...prevState.files, ...selectFile]
-        }))
-    };
+	onDrop = (selectedFile) => {
+		this.setState({
+			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 => ({
+			files: [...prevState.files, ...selectFile]
+		}))
+	};
 
 	uploadFiles = (e) => {
 		e.preventDefault();
@@ -122,27 +123,38 @@ class InputRekomendasi extends Component {
 
 
 	handelSimpan = async () => {
-		const getToken = await getCsrf();
-		const _csrf = getToken.token;
-		const { token, query } = this.props;
-		const { id } = query;
-		const formdata = new FormData();
-		this.state.files.forEach((e) => {
-			formdata.append("dokumen", e);
-		});
-		const toastid = toast.loading("Please wait...");
-		const added = await addRekomendasiDelegasi(token, id, formdata, _csrf);
-		if (!added) {
-			toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
+		if (this.props.user.role.id === 2024) {
+			Swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
 		} else {
-			toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
-			const sanksi = await getOneSanksi(token, id);
-			this.setState({ sanksi, files: [] });
-			resetForm();
-			// Router.push({
-			// 	pathname: "/app/rekomendasi-delegasi",
-			// });
+			const getToken = await getCsrf();
+			const _csrf = getToken.token;
+			const { token, query } = this.props;
+			const { id } = query;
+			const formdata = new FormData();
+			this.state.files.forEach((e) => {
+				formdata.append("dokumen", e);
+			});
+			const toastid = toast.loading("Please wait...");
+			const added = await addRekomendasiDelegasi(token, id, formdata, _csrf);
+			if (!added) {
+				toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
+			} else {
+				toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
+				const sanksi = await getOneSanksi(token, id);
+				this.setState({ sanksi, files: [] });
+				resetForm();
+				// Router.push({
+				// 	pathname: "/app/rekomendasi-delegasi",
+				// });
 
+			}
 		}
 
 	};

+ 30 - 7
components/RekomendasiDelegasi/TableRiwayat.js

@@ -1,9 +1,19 @@
 import Datatable from "@/components/Tables/Datatable";
 import moment from "moment";
 import 'moment/min/locales';
+import Swal from "sweetalert2";
 moment.locale('id');
 
-function TableRiwayat({ data, perbaikan }) {
+function TableRiwayat({ data, perbaikan, role }) {
+	const handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	return (
 		// <Datatable options={{ responsive: true }}>
 		<div className="card-over">
@@ -26,9 +36,16 @@ function TableRiwayat({ data, perbaikan }) {
 							{data.dokumen.map((e, index) => (
 								<>
 									<em key="index" className="fa-lg far fa-file-code"></em>
-									<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-										{e.judul}
-									</a>
+									<em className="fa-lg far fa-file-code"></em>
+									{role === 2024 ?
+										<a className="text-muted" onClick={handleOpenAlert}>
+											{e.judul}
+										</a>
+										:
+										<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+											{e.judul}
+										</a>
+									}
 									<br />
 								</>
 							))}
@@ -40,9 +57,15 @@ function TableRiwayat({ data, perbaikan }) {
 										{value.dokumen.map((e) => (
 											<>
 												<em className="fa-lg far fa-file-code"></em>
-												<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-													{e.judul}
-												</a>
+												{role === 2024 ?
+													<a className="text-muted" onClick={handleOpenAlert}>
+														{e.judul}
+													</a>
+													:
+													<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+														{e.judul}
+													</a>
+												}
 											</>
 										))}
 									</td>

+ 24 - 6
components/Sanksi/BeritaAcara.js

@@ -13,6 +13,10 @@ import { ToastContainer, toast } from "react-toastify";
 import Router from "next/router";
 import { getCsrf } from '../../actions/security';
 import { ENV } from '../../env';
+import { connect } from "react-redux";
+import Swal from 'sweetalert2';
+
+
 
 
 
@@ -41,7 +45,7 @@ class BeritaAcara extends Component {
             setmeState: true,
             descPelanggaran: [],
             modalRemovePeserta: false,
-            selectedPeserta: ""
+            selectedPeserta: "",
         };
     }
 
@@ -238,13 +242,21 @@ class BeritaAcara extends Component {
         const meringankan = this.state.meringankan
         const data = [...meringankan]
         data.splice(index, 1);
-
         this.setState({
             meringankan: data,
         }, this.setDataSuratBA()
         );
-
     }
+
+    handleOpenAlert = () => {
+        Swal.fire({
+            icon: 'error',
+            title: 'Oops...',
+            html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+            confirmButtonColor: "#3e3a8e",
+            confirmButtonText: 'Oke'
+        })
+    };
     render() {
         const { dataLaporan, dataSuratBA, dataPelanggaran } = this.props
         const { descPelanggaran, tanggal, setTanggal, setTanggal_2, tanggal_2, temuanLain } = this.state
@@ -283,6 +295,10 @@ class BeritaAcara extends Component {
                 </Modal>
                 <div className=' content-heading border-radius-login'>
                     <span className="btn-radius">
+                        {this.props.user?.role?.id === 2024 ?
+                            <Button color className="btn-labeled-4" onClick={this.handleOpenAlert}>
+                                <h4 className="p-0 mt-2">Print dan Download</h4>
+                            </Button> :
                         <ReactToPrint
                             trigger={() => {
                                 return <span>
@@ -293,6 +309,8 @@ class BeritaAcara extends Component {
                             }}
                             content={() => this.componentRef}
                         />
+                        }
+
                     </span>
                 </div>
                 <div style={{ display: "none" }}>
@@ -634,6 +652,6 @@ class BeritaAcara extends Component {
     }
 }
 
-// const mapStateToProps = (state) => ({ user: state.user, token: state.token });
-// export default connect(mapStateToProps)(BeritaAcara)
-export default BeritaAcara
+const mapStateToProps = (state) => ({ user: state.user, token: state.token });
+export default connect(mapStateToProps)(BeritaAcara)
+// export default BeritaAcara

+ 139 - 242
components/Sanksi/DetailSanksi.js

@@ -7,6 +7,9 @@ import { getOneSanksi } from "../../actions/sanksi";
 import ReactToPrint, { PrintContextConsumer } from 'react-to-print';
 import ComponentBA from "../Sanksi/SuratBA _detail";
 import Link from "next/dist/client/link";
+import { connect } from "react-redux";
+import Swal from "sweetalert2";
+
 
 
 
@@ -28,6 +31,15 @@ class DetailSanksi extends Component {
 		const sanksi = await getOneSanksi(token, query.id);
 		this.setState({ sanksi });
 	};
+	handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 
 	render() {
 		const { sanksi } = this.state
@@ -49,81 +61,96 @@ class DetailSanksi extends Component {
 							</Col>
 						</FormGroup>
 						<FormGroup row>
-					<Col md="4">Keterangan:</Col>
-					<Col md="8">
-						<Scrollable height="100px" className="list-group">
-							<p>{sanksi.data.keterangan}</p>
-						</Scrollable>
-					</Col>
-				</FormGroup>
-				<FormGroup row>
-					<Col md="4">Tanggal Penetapan Sanksi:</Col>
-					<Col md="8">
-						<strong>{moment(sanksi.data.masa_berlaku?.from_date).locale("id").format("D MMMM YYYY")}</strong>
-					</Col>
-				</FormGroup>
-				{
-					sanksi.data.tanggal_akhir_keberatan &&
-					<FormGroup row>
-						<Col md="4">Tanggal Akhir Pengajuan Keberatan</Col>
-						<Col md="8">
-							<strong>{moment(sanksi.data.tanggal_akhir_keberatan).locale("id").format("D MMMM YYYY")}</strong>
-						</Col>
-					</FormGroup>
-				}
-				{
-					sanksi.data.jawaban?.keberatan?.tanggal_akhir_banding &&
-					<FormGroup row>
-						<Col md="4">Tanggal Akhir Pengajuan Banding:</Col>
-						<Col md="8">
-							<strong>{moment(sanksi.data.jawaban?.keberatan?.tanggal_akhir_banding).locale("id").format("D MMMM YYYY")}</strong>
-						</Col>
-					</FormGroup>
-				}
-				<FormGroup row>
-					<Col md="4">Dokumen Sanksi:</Col>
-					<Col md="8">
-						<Scrollable height="120px" className="list-group">
-							<table className="table table-bordered bg-transparent">
-								<tbody>
-									{sanksi.data.dokumen.map((e) => (
-										<tr>
-											<td style={{ width: "30px" }}>
-												<em className="fa-lg far fa-file-code"></em>
-											</td>
-											<td>
-												<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-													{e.judul}
-												</a>
-											</td>
-										</tr>
-									))}
-								</tbody>
-							</table>
-						</Scrollable>
-					</Col>
-				</FormGroup>
+							<Col md="4">Keterangan:</Col>
+							<Col md="8">
+								<Scrollable height="100px" className="list-group">
+									<p>{sanksi.data.keterangan}</p>
+								</Scrollable>
+							</Col>
+						</FormGroup>
+						<FormGroup row>
+							<Col md="4">Tanggal Penetapan Sanksi:</Col>
+							<Col md="8">
+								<strong>{moment(sanksi.data.masa_berlaku?.from_date).locale("id").format("D MMMM YYYY")}</strong>
+							</Col>
+						</FormGroup>
+						{
+							sanksi.data.tanggal_akhir_keberatan &&
+							<FormGroup row>
+								<Col md="4">Tanggal Akhir Pengajuan Keberatan</Col>
+								<Col md="8">
+									<strong>{moment(sanksi.data.tanggal_akhir_keberatan).locale("id").format("D MMMM YYYY")}</strong>
+								</Col>
+							</FormGroup>
+						}
+						{
+							sanksi.data.jawaban?.keberatan?.tanggal_akhir_banding &&
+							<FormGroup row>
+								<Col md="4">Tanggal Akhir Pengajuan Banding:</Col>
+								<Col md="8">
+									<strong>{moment(sanksi.data.jawaban?.keberatan?.tanggal_akhir_banding).locale("id").format("D MMMM YYYY")}</strong>
+								</Col>
+							</FormGroup>
+						}
+						<FormGroup row>
+							<Col md="4">Dokumen Sanksi:</Col>
+							<Col md="8">
+								<Scrollable height="120px" className="list-group">
+									<table className="table table-bordered bg-transparent">
+										<tbody>
+											{sanksi.data.dokumen.map((e) => (
+												<tr>
+													<td style={{ width: "30px" }}>
+														<em className="fa-lg far fa-file-code"></em>
+													</td>
+													<td>
+														{this.props.user.role.id === 2024?
+															<a className="text-muted" onClick={this.handleOpenAlert} >
+																{e.judul}
+															</a>
+															:
+															<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
+																{e.judul}
+															</a>
+
+														}
+
+													</td>
+												</tr>
+											))}
+										</tbody>
+									</table>
+								</Scrollable>
+							</Col>
+						</FormGroup>
 
 						<FormGroup row>
 							<Col md="4">Dokumen Acara Pleno:</Col>
 							<Col md="8">
 								<div>
-									<ReactToPrint
-										trigger={() => {
-											return <span>
-												<Link
-													href={{
-														pathname: "/app/sanksi/detail",
-														query: { id: this.props.query.id },
-													}}>
-													<Button color className="btn-labeled-4 mt-0">
-														<h5 className="p-0 mt-2"><em className="fas fa-download mr-2" />Print dan Download</h5>
-													</Button>
-												</Link>
-											</span>
-										}}
-										content={() => this.componentRef}
-									/>
+									{this.props.user.role.id === 2024 ?
+										<Button color className="btn-labeled-4 mt-0" onClick={this.handleOpenAlert}>
+											<h5 className="p-0 mt-2"><em className="fas fa-download mr-2" />Print dan Download</h5>
+										</Button>
+										:
+										<ReactToPrint
+											trigger={() => {
+												return <span>
+													<Link
+														href={{
+															pathname: "/app/sanksi/detail",
+															query: { id: this.props.query.id },
+														}}>
+														<Button color className="btn-labeled-4 mt-0">
+															<h5 className="p-0 mt-2"><em className="fas fa-download mr-2" />Print dan Download</h5>
+														</Button>
+													</Link>
+												</span>
+											}}
+											content={() => this.componentRef}
+										/>
+									}
+
 									<div style={{ display: "none" }}>
 										<ComponentBA ref={el => (this.componentRef = el)} query={this.props.query} />
 									</div>
@@ -133,48 +160,48 @@ class DetailSanksi extends Component {
 							</Col>
 						</FormGroup>
 						<FormGroup row>
-					<Col md={12}>
-						<div className="card b">
-							<div className="card-body bb">
-								<Table responsive>
-									<thead>
-										<tr>
-											<th>Jenis Pelanggaran</th>
-											<th>Sanksi</th>
-										</tr>
-									</thead>
-									<tbody>
-										{sanksi.data.pelanggaran.map((jp, index) => (
-											<tr key={jp._id}>
-												<td width={50}>
-													<div className="media align-items-center">
-														<div className="media-body d-flex">
-															<div>
-																<p>{jp.pelanggaran}</p>
-																<p>TMT : {jp.tmt_bulan} Bulan</p>
-																<p>Jenis Sanksi Administratif : {jp.label_sanksi}</p>
+							<Col md={12}>
+								<div className="card b">
+									<div className="card-body bb">
+										<Table responsive>
+											<thead>
+												<tr>
+													<th>Jenis Pelanggaran</th>
+													<th>Sanksi</th>
+												</tr>
+											</thead>
+											<tbody>
+												{sanksi.data.pelanggaran.map((jp, index) => (
+													<tr key={jp._id}>
+														<td width={50}>
+															<div className="media align-items-center">
+																<div className="media-body d-flex">
+																	<div>
+																		<p>{jp.pelanggaran}</p>
+																		<p>TMT : {jp.tmt_bulan} Bulan</p>
+																		<p>Jenis Sanksi Administratif : {jp.label_sanksi}</p>
+																	</div>
+																</div>
 															</div>
-														</div>
-													</div>
-												</td>
-												<td width={50}>
-													<div className="media align-items-center">
-														<div className="media-body d-flex">
-															<div>
-																<p>{jp.sanksi}</p>
-																<p>Keterangan : {jp.keterangan_sanksi}</p>
+														</td>
+														<td width={50}>
+															<div className="media align-items-center">
+																<div className="media-body d-flex">
+																	<div>
+																		<p>{jp.sanksi}</p>
+																		<p>Keterangan : {jp.keterangan_sanksi}</p>
+																	</div>
+																</div>
 															</div>
-														</div>
-													</div>
-												</td>
-											</tr>
-										))}
-									</tbody>
-								</Table>
-							</div>
-						</div>
-					</Col>
-				</FormGroup>
+														</td>
+													</tr>
+												))}
+											</tbody>
+										</Table>
+									</div>
+								</div>
+							</Col>
+						</FormGroup>
 
 					</form>
 				}
@@ -186,136 +213,6 @@ class DetailSanksi extends Component {
 
 
 }
+const mapStateToProps = (state) => ({ user: state.user, token: state.token });
+export default connect(mapStateToProps)(DetailSanksi)
 
-
-
-// function DetailSanksi({ data, noTitle = false, query }) {
-
-// 	return (
-// 		<>
-// 			{noTitle ? "" : <p className="lead bb">Detail Sanksi</p>}
-// <form className="form-horizontal">
-// 	<FormGroup row>
-// 		<Col md="4">Nomor Sanksi:</Col>
-// 		<Col md="8">
-// 			<strong>{data.no_sanksi}</strong>
-// 		</Col>
-// 	</FormGroup>
-// 	<FormGroup row>
-// 		<Col md="4">Nama Perguruan Tinggi:</Col>
-// 		<Col md="8">
-// 			<strong>{data.laporan.pt.nama}</strong>
-// 		</Col>
-// 	</FormGroup>
-// 	<FormGroup row>
-// 		<Col md="4">Keterangan:</Col>
-// 		<Col md="8">
-// 			<Scrollable height="100px" className="list-group">
-// 				<p>{data.keterangan}</p>
-// 			</Scrollable>
-// 		</Col>
-// 	</FormGroup>
-// 	<FormGroup row>
-// 		<Col md="4">Tanggal Penetapan Sanksi:</Col>
-// 		<Col md="8">
-// 			<strong>{moment(data.masa_berlaku?.from_date).locale("id").format("D MMMM YYYY")}</strong>
-// 		</Col>
-// 	</FormGroup>
-// 	{
-// 		data.tanggal_akhir_keberatan &&
-// 		<FormGroup row>
-// 			<Col md="4">Tanggal Akhir Pengajuan Keberatan</Col>
-// 			<Col md="8">
-// 				<strong>{moment(data.tanggal_akhir_keberatan).locale("id").format("D MMMM YYYY")}</strong>
-// 			</Col>
-// 		</FormGroup>
-// 	}
-// 	{
-// 		data.jawaban?.keberatan?.tanggal_akhir_banding &&
-// 		<FormGroup row>
-// 			<Col md="4">Tanggal Akhir Pengajuan Banding:</Col>
-// 			<Col md="8">
-// 				<strong>{moment(data.jawaban?.keberatan?.tanggal_akhir_banding).locale("id").format("D MMMM YYYY")}</strong>
-// 			</Col>
-// 		</FormGroup>
-// 	}
-// 	<FormGroup row>
-// 		<Col md="4">Dokumen Sanksi:</Col>
-// 		<Col md="8">
-// 			<Scrollable height="120px" className="list-group">
-// 				<table className="table table-bordered bg-transparent">
-// 					<tbody>
-// 						{data.dokumen.map((e) => (
-// 							<tr>
-// 								<td style={{ width: "30px" }}>
-// 									<em className="fa-lg far fa-file-code"></em>
-// 								</td>
-// 								<td>
-// 									<a className="text-muted" href={e.path} target="_blank" download={e.judul}>
-// 										{e.judul}
-// 									</a>
-// 								</td>
-// 							</tr>
-// 						))}
-// 					</tbody>
-// 				</table>
-// 			</Scrollable>
-// 		</Col>
-// 	</FormGroup>
-// 	<FormGroup row>
-// 		<Col md="4">Dokumen Acara Pleno:</Col>
-// 		<Col md="8">
-// 			<BeritaAcara
-// 				query={query}
-// 			/>
-// 		</Col>
-// 	</FormGroup>
-// 	<FormGroup row>
-// 		<Col md={12}>
-// 			<div className="card b">
-// 				<div className="card-body bb">
-// 					<Table responsive>
-// 						<thead>
-// 							<tr>
-// 								<th>Jenis Pelanggaran</th>
-// 								<th>Sanksi</th>
-// 							</tr>
-// 						</thead>
-// 						<tbody>
-// 							{data.pelanggaran.map((jp, index) => (
-// 								<tr key={jp._id}>
-// 									<td width={50}>
-// 										<div className="media align-items-center">
-// 											<div className="media-body d-flex">
-// 												<div>
-// 													<p>{jp.pelanggaran}</p>
-// 													<p>TMT : {jp.tmt_bulan} Bulan</p>
-// 													<p>Jenis Sanksi Administratif : {jp.label_sanksi}</p>
-// 												</div>
-// 											</div>
-// 										</div>
-// 									</td>
-// 									<td width={50}>
-// 										<div className="media align-items-center">
-// 											<div className="media-body d-flex">
-// 												<div>
-// 													<p>{jp.sanksi}</p>
-// 													<p>Keterangan : {jp.keterangan_sanksi}</p>
-// 												</div>
-// 											</div>
-// 										</div>
-// 									</td>
-// 								</tr>
-// 							))}
-// 						</tbody>
-// 					</Table>
-// 				</div>
-// 			</div>
-// 		</Col>
-// 	</FormGroup>
-// </form>
-// 		</>
-// 	);
-// }
-
-export default DetailSanksi;

+ 9 - 0
components/Sanksi/Ringkasan.js

@@ -27,6 +27,15 @@ export class Ringkasan extends Component {
 		const saveData = getDataSave.data?.penetapanSanksi;
 		this.setState(saveData)
 	}
+		handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 
 	render() {
 		const { dataLaporan, dataPelanggaran, dataUpload } = this.props

+ 10 - 19
components/TurunSanksi/TableLaporan.js

@@ -65,29 +65,20 @@ function TableLaporan({ listData, to, linkName, status = false, noBy = false })
 													</div>
 												</div>
 											</td>
-
-											<td className=" col-md-4">
-												<div className="table-desc">
-													<div className="media align-items-center">
-														<div className="media-body d-flex">
-															<div>
-																<h4 className="m-0">{data.laporan.pt.nama.length > 64 ? data.laporan.pt.nama.substring(0, 64) + "..." : data.laporan.pt.nama}</h4>
-																<p className="w-105">{data.laporan.keterangan}</p>
-															</div>
-														</div>
-													</div>
+											<td className=" col-md-6">
+												<div>
+													<h4 className="m-0">{data.laporan.pt.nama.length > 64 ? data.laporan.pt.nama.substring(0, 64) + "..." : data.laporan.pt.nama}</h4>
+													<p className="w-105">{data.laporan.keterangan.length > 100 ? data.laporan.keterangan.substring(0, 100) + "..." : data.laporan.keterangan}</p>
 												</div>
 											</td>
 
-
-											{/* <td>
-												{data.sanksi.length ? data.sanksi.map((e) => (<h4 className="w-105">Sanksi Administratif {e.label}</h4>)) : data.pelanggaran.map((e) => (<h4 className="w-105">Sanksi Administratif:  {e.label_sanksi}</h4>))}
-												<p className="w-105">{data.sanksi.keterangan}</p>
-											</td> */}
 											<td className=" col-md-5">
-												<h4 className="w-105">
-													Sanksi Administratif : {getLabelSanksi(data.sanksi, "level") === 3 ? "Berat" : getLabelSanksi(data.sanksi, "level") === 2 ? "Sedang" : "Ringan"}
-												</h4>
+												<div>
+													<h4>
+														Sanksi Administratif : {getLabelSanksi(data.sanksi, "level") === 3 ? "Berat" : getLabelSanksi(data.sanksi, "level") === 2 ? "Sedang" : "Ringan"}
+													</h4>
+													<p className="w-105">{data.keterangan}</p>
+												</div>
 											</td>
 											{!noBy && <td>{data.user.isPrivate ? "" : data.user.nama}</td>}
 											<td>

+ 42 - 30
pages/app/banding/detail.js

@@ -24,6 +24,7 @@ import id from 'date-fns/locale/id';
 import moment from "moment";
 import Datetime from "react-datetime";
 import { getCsrf } from "../../../actions/security";
+import swal from "sweetalert2";
 
 let Dropzone = null;
 class DropzoneWrapper extends Component {
@@ -172,35 +173,46 @@ class JawabanBanding extends Component {
 
 
 	handelSimpan = async () => {
-		const getTokenCsrf = await getCsrf();
-		const _csrf = getTokenCsrf.token;
-		if (this.state.modal === true) {
-			this.toggleModal();
-		}
-		const { data } = this.state;
-		const { query, token } = this.props;
-		const { id } = query;
-		const formdata = new FormData();
-		formdata.append("status", data.status);
-		formdata.append("keterangan", data.keterangan);
-		formdata.append("no_banding", data.no_banding);
-		formdata.append("tanggal_terima_banding", data.tanggal_terima_banding);
-		formdata.append("tanggal_surat_banding", data.tanggal_surat_banding);
-		data.dokumen.forEach((e) => {
-			formdata.append("dokumen", e);
-		});
-		data.dokumen_terima_banding.forEach((e) => {
-			formdata.append("dokumen_terima_banding", e);
-		});
-		const toastid = toast.loading("Please wait...");
-		const added = await addJawabanBanding(token, id, formdata, _csrf);
-		if (!added) {
-			toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
+		if (this.props.user.role.id === 2024) {
+			swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
 		} else {
-			toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
-			Router.push({
-				pathname: "/app/banding",
+			const getTokenCsrf = await getCsrf();
+			const _csrf = getTokenCsrf.token;
+			if (this.state.modal === true) {
+				this.toggleModal();
+			}
+			const { data } = this.state;
+			const { query, token } = this.props;
+			const { id } = query;
+			const formdata = new FormData();
+			formdata.append("status", data.status);
+			formdata.append("keterangan", data.keterangan);
+			formdata.append("no_banding", data.no_banding);
+			formdata.append("tanggal_terima_banding", data.tanggal_terima_banding);
+			formdata.append("tanggal_surat_banding", data.tanggal_surat_banding);
+			data.dokumen.forEach((e) => {
+				formdata.append("dokumen", e);
 			});
+			data.dokumen_terima_banding.forEach((e) => {
+				formdata.append("dokumen_terima_banding", e);
+			});
+			const toastid = toast.loading("Please wait...");
+			const added = await addJawabanBanding(token, id, formdata, _csrf);
+			if (!added) {
+				toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
+			} else {
+				toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
+				Router.push({
+					pathname: "/app/banding",
+				});
+			}
 		}
 	};
 
@@ -249,8 +261,8 @@ class JawabanBanding extends Component {
 									<CardBody>
 										<Row>
 											<Col lg={12}>
-												<DetailSanksi data={sanksi.data} />
-												<PermohonanPT data={sanksi.data.pengajuan.banding} title="Permohonan Banding" />
+												<DetailSanksi data={sanksi.data} role={this.props.user.role.id} />
+												<PermohonanPT data={sanksi.data.pengajuan.banding} title="Permohonan Banding" role={this.props.user.role.id} />
 												<p className="lead bb">Jawaban</p>
 												<Formik
 													initialValues={{
@@ -478,7 +490,7 @@ class JawabanBanding extends Component {
 					{sanksi.data && (
 						<Row>
 							<Col>
-								<Riwayat data={sanksi.data.jawaban.banding} />
+								<Riwayat data={sanksi.data.jawaban.banding} role={this.props.user.role.id} />
 							</Col>
 						</Row>
 					)}

+ 43 - 31
pages/app/keberatan/detail.js

@@ -24,6 +24,7 @@ import id from 'date-fns/locale/id';
 import moment from "moment";
 import Datetime from "react-datetime";
 import { getCsrf } from "../../../actions/security";
+import swal from "sweetalert2";
 
 
 let Dropzone = null;
@@ -181,36 +182,47 @@ class DetailKeberatan extends Component {
 	};
 
 	handelSimpan = async () => {
-		const getTokenCsrf = await getCsrf();
-		const _csrf = getTokenCsrf.token;
-		if (this.state.modal === true) {
-			this.toggleModal();
-		}
-		const { data } = this.state;
-		const { query, token } = this.props;
-		const { id } = query;
-		const formdata = new FormData();
-		formdata.append("keterangan", data.keterangan);
-		formdata.append("status", data.status);
-		formdata.append("no_keberatan", data.no_keberatan);
-		formdata.append("tanggal_terima_keberatan", data.tanggal_terima_keberatan);
-		formdata.append("tanggal_akhir_banding", data.tanggal_akhir_banding);
-		formdata.append("tanggal_surat_keberatan", data.tanggal_surat_keberatan);
-		data.dokumen.forEach((e) => {
-			formdata.append("dokumen", e);
-		});
-		data.dokumen_terima_keberatan.forEach((e) => {
-			formdata.append("dokumen_terima_keberatan", e);
-		});
-		const toastid = toast.loading("Please wait...");
-		const added = await addJawabanKeberatan(token, id, formdata, _csrf);
-		if (!added) {
-			toast.update(toastid, { render: "Gagal Menjawab Keberatan", type: "error", isLoading: false, autoClose: true, closeButton: true });
+		if (this.props.user.role.id === 2024) {
+			swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
 		} else {
-			toast.update(toastid, { render: "Berhasil Menjawab Keberatan", type: "success", isLoading: false, autoClose: true, closeButton: true });
-			Router.push({
-				pathname: "/app/keberatan",
+			const getTokenCsrf = await getCsrf();
+			const _csrf = getTokenCsrf.token;
+			if (this.state.modal === true) {
+				this.toggleModal();
+			}
+			const { data } = this.state;
+			const { query, token } = this.props;
+			const { id } = query;
+			const formdata = new FormData();
+			formdata.append("keterangan", data.keterangan);
+			formdata.append("status", data.status);
+			formdata.append("no_keberatan", data.no_keberatan);
+			formdata.append("tanggal_terima_keberatan", data.tanggal_terima_keberatan);
+			formdata.append("tanggal_akhir_banding", data.tanggal_akhir_banding);
+			formdata.append("tanggal_surat_keberatan", data.tanggal_surat_keberatan);
+			data.dokumen.forEach((e) => {
+				formdata.append("dokumen", e);
 			});
+			data.dokumen_terima_keberatan.forEach((e) => {
+				formdata.append("dokumen_terima_keberatan", e);
+			});
+			const toastid = toast.loading("Please wait...");
+			const added = await addJawabanKeberatan(token, id, formdata, _csrf);
+			if (!added) {
+				toast.update(toastid, { render: "Gagal Menjawab Keberatan", type: "error", isLoading: false, autoClose: true, closeButton: true });
+			} else {
+				toast.update(toastid, { render: "Berhasil Menjawab Keberatan", type: "success", isLoading: false, autoClose: true, closeButton: true });
+				Router.push({
+					pathname: "/app/keberatan",
+				});
+			}
 		}
 	};
 	setTglTerimaKeberatan = (tglTerimaKeberatan) => {
@@ -255,12 +267,12 @@ class DetailKeberatan extends Component {
 									<CardBody>
 										<Row>
 											<Col lg={12}>
-												<DetailSanksi data={sanksi.data} />
+												<DetailSanksi data={sanksi.data} role={this.props.user.role.id} />
 											</Col>
 										</Row>
 										<Row>
 											<Col lg={12}>
-												<PermohonanPT data={sanksi.data.pengajuan.keberatan} title="Permohonan Keberatan" />
+												<PermohonanPT data={sanksi.data.pengajuan.keberatan} title="Permohonan Keberatan" role={this.props.user.role.id} />
 											</Col>
 										</Row>
 										<Row>
@@ -518,7 +530,7 @@ class DetailKeberatan extends Component {
 					{sanksi.data && (
 						<Row>
 							<Col>
-								<Riwayat data={sanksi.data.jawaban?.keberatan ? sanksi.data.jawaban.keberatan : null} />
+								<Riwayat data={sanksi.data.jawaban?.keberatan ? sanksi.data.jawaban.keberatan : null} role={this.props.user.role.id} />
 							</Col>
 						</Row>
 					)}

+ 1 - 1
pages/app/pelaporan/detail.js

@@ -54,7 +54,7 @@ class DetailPelaporan extends Component {
 								<Card className="card-default">
 									<CardBody>
 										<Row>
-											<Col lg={12}>{<DetailLaporan data={pelaporan.data} />}</Col>
+											<Col lg={12}>{<DetailLaporan data={pelaporan.data} role={this.props.user.role.id} />}</Col>
 										</Row>
 									</CardBody>
 								</Card>

+ 47 - 24
pages/app/pelaporan/index.js

@@ -12,6 +12,7 @@ import Router from "next/router";
 import { createLog } from "@/actions/log";
 import swal from "sweetalert2";
 import { getCsrf } from "../../../actions/security";
+import Swal from "sweetalert2";
 
 class Pelaporan extends Component {
 	constructor(props) {
@@ -63,37 +64,59 @@ class Pelaporan extends Component {
 		if (prevState.graph !== this.state.graph) return true;
 	};
 	excelMenu = () => {
-		const url = getExcel(this.props.token, "Laporan", {
-			tahun: this.state.tahun,
-			pelaporan: true,
-		});
-		if (this.state.graph.data.jumlah_laporan.dikti && this.state.graph.data.jumlah_laporan.ditutup && this.state.graph.data.jumlah_laporan.lldikti) {
-			Router.push(url);
-		} else {
-			swal.fire({
-				title: "Data Kosong",
-				icon: "error",
+		if (this.props.user.role.id === 2024) {
+			Swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
+		} else {
+			const url = getExcel(this.props.token, "Laporan", {
+				tahun: this.state.tahun,
+				pelaporan: true,
 			});
+			if (this.state.graph.data.jumlah_laporan.dikti && this.state.graph.data.jumlah_laporan.ditutup && this.state.graph.data.jumlah_laporan.lldikti) {
+				Router.push(url);
+			} else {
+				swal.fire({
+					title: "Data Kosong",
+					icon: "error",
+					confirmButtonColor: "#3e3a8e",
+				});
+			}
 		}
 	};
 	excelSemua = () => {
-		const url = getExcel(this.props.token, "Laporan", {
-			tahun: this.state.tahun,
-			pelaporan: true,
-			penjadwalan: true,
-			pemeriksaan: true,
-			sanksi: true,
-
-		});
-		if (this.state.graph.data.jumlah_laporan.dikti && this.state.graph.data.jumlah_laporan.ditutup && this.state.graph.data.jumlah_laporan.lldikti) {
-			Router.push(url);
-		} else {
-			swal.fire({
-				title: "Data Kosong",
-				icon: "error",
+		if (this.props.user.role.id === 2024) {
+			Swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
+		} else {
+			const url = getExcel(this.props.token, "Laporan", {
+				tahun: this.state.tahun,
+				pelaporan: true,
+				penjadwalan: true,
+				pemeriksaan: true,
+				sanksi: true,
+
 			});
+			if (this.state.graph.data.jumlah_laporan.dikti && this.state.graph.data.jumlah_laporan.ditutup && this.state.graph.data.jumlah_laporan.lldikti) {
+				Router.push(url);
+			} else {
+				swal.fire({
+					title: "Data Kosong",
+					icon: "error",
+					confirmButtonColor: "#3e3a8e",
+				});
+			}
 		}
 	};
 	render() {

+ 44 - 22
pages/app/pemeriksaan/index.js

@@ -48,38 +48,60 @@ class Pemeriksaan extends Component {
 
 
 	excelMenu = () => {
-		const url = getExcel(this.props.token, "Laporan", {
-			tahun: this.state.tahun,
-			pemeriksaan: true,
-		});
-		if (this.state.graph.data.evaluasi.hasEvaluasi) {
-			Router.push(url);
-		} else {
+		if (this.props.user.role.id === 2024) {
 			swal.fire({
-				title: "Data Kosong",
-				icon: "error",
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
+		} else {
+			const url = getExcel(this.props.token, "Laporan", {
+				tahun: this.state.tahun,
+				pemeriksaan: true,
 			});
+			if (this.state.graph.data.evaluasi.hasEvaluasi) {
+				Router.push(url);
+			} else {
+				swal.fire({
+					title: "Data Kosong",
+					icon: "error",
+					confirmButtonColor: "#3e3a8e",
+				});
+			}
 		}
 	};
 
 	excelSemua = () => {
-		const url = getExcel(this.props.token, "Laporan", {
-			tahun: this.state.tahun,
-			pelaporan: true,
-			penjadwalan: true,
-			pemeriksaan: true,
-			sanksi: true,
-
-		});
-		if (this.state.graph.data.evaluasi.hasEvaluasi) {
-			Router.push(url);
-		} else {
+		if (this.props.user.role.id === 2024) {
 			swal.fire({
-				title: "Data Kosong",
-				icon: "error",
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
+		} else {
+			const url = getExcel(this.props.token, "Laporan", {
+				tahun: this.state.tahun,
+				pelaporan: true,
+				penjadwalan: true,
+				pemeriksaan: true,
+				sanksi: true,
+
 			});
+			if (this.state.graph.data.evaluasi.hasEvaluasi) {
+				Router.push(url);
+			} else {
+				swal.fire({
+					title: "Data Kosong",
+					icon: "error",
+					confirmButtonColor: "#3e3a8e",
+				});
+			}
 		}
 	};
 	excel = () => {

+ 2 - 2
pages/app/pemeriksaan/new.js

@@ -62,7 +62,7 @@ class PemeriksaanNew extends Component {
 									<CardBody>
 										<Row>
 											<Col lg={12}>
-												<DetailLaporan data={pelaporan.data} />
+												<DetailLaporan data={pelaporan.data} role={this.props.user.role.id} />
 												<InputEvaluasi query={query} token={token} changePelaporan={this.changePelaporan} data={pelaporan.data} />
 											</Col>
 										</Row>
@@ -82,7 +82,7 @@ class PemeriksaanNew extends Component {
 										<CardTitle>Riwayat Evaluasi</CardTitle>
 									</CardHeader>
 									<CardBody>
-										<TableRiwayat data={pelaporan.data} />
+										<TableRiwayat data={pelaporan.data} role={this.props.user.role.id} />
 									</CardBody>
 								</Card>
 							</Col>

+ 32 - 20
pages/app/pencabutan-sanksi/detail.js

@@ -18,6 +18,7 @@ import { connect } from "react-redux";
 import { Formik, Form, Field, ErrorMessage } from "formik";
 import * as Yup from "yup";
 import { getCsrf } from "../../../actions/security";
+import Swal from "sweetalert2";
 
 const checkIfFilesAreTooBig = (files) => {
 	let valid = true;
@@ -136,25 +137,36 @@ class JawabanPencabutanSanksi extends Component {
 	};
 
 	handleSimpan = async () => {
-		const getToken = await getCsrf();
-		const _csrf = getToken.token;
-		const { data } = this.state;
-		const { token, query } = this.props;
-		const formdata = new FormData();
-		formdata.append("status", data.status);
-		formdata.append("keterangan", data.keterangan);
-		this.state.files.forEach((e) => {
-			formdata.append("dokumen", e);
-		});
-		const toastid = toast.loading("Please wait...");
-		const added = await addJawabanCabutSanksi(token, query.id, formdata, _csrf);
-		if (!added) {
-			toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
+		if (this.props.user.role.id === 2024) {
+			Swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
 		} else {
-			toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
-			Router.push({
-				pathname: "/app/pencabutan-sanksi",
+			const getToken = await getCsrf();
+			const _csrf = getToken.token;
+			const { data } = this.state;
+			const { token, query } = this.props;
+			const formdata = new FormData();
+			formdata.append("status", data.status);
+			formdata.append("keterangan", data.keterangan);
+			this.state.files.forEach((e) => {
+				formdata.append("dokumen", e);
 			});
+			const toastid = toast.loading("Please wait...");
+			const added = await addJawabanCabutSanksi(token, query.id, formdata, _csrf);
+			if (!added) {
+				toast.update(toastid, { render: "Error", type: "error", isLoading: false, autoClose: true, closeButton: true });
+			} else {
+				toast.update(toastid, { render: "Success", type: "success", isLoading: false, autoClose: true, closeButton: true });
+				Router.push({
+					pathname: "/app/pencabutan-sanksi",
+				});
+			}
 		}
 	};
 
@@ -193,9 +205,9 @@ class JawabanPencabutanSanksi extends Component {
 									<CardBody>
 										<Row>
 											<Col lg={12}>
-												<DetailSanksi data={sanksi.data} />
+												<DetailSanksi data={sanksi.data} role={this.props.user.role.id} />
 												{sanksi.data?.pengajuan?.cabut_sanksi &&
-													< PermohonanPT data={sanksi.data?.pengajuan?.cabut_sanksi} />
+													< PermohonanPT data={sanksi.data?.pengajuan?.cabut_sanksi} role={this.props.user.role.id} />
 												}
 
 												<p className="lead bb">Jawaban</p>
@@ -379,7 +391,7 @@ class JawabanPencabutanSanksi extends Component {
 					{sanksi.data && (
 						<Row>
 							<Col>
-								<Riwayat data={sanksi.data.jawaban?.cabut_sanksi} />
+								<Riwayat data={sanksi.data.jawaban?.cabut_sanksi} role={this.props.user.role.id} />
 							</Col>
 						</Row>
 					)}

+ 47 - 25
pages/app/penjadwalan/index.js

@@ -10,7 +10,7 @@ import Loader from "@/components/Common/Loader";
 import Link from "next/link";
 import Button from "reactstrap/lib/Button";
 import Router from "next/router";
-import swal from "sweetalert2";
+import Swal from "sweetalert2";
 
 
 class Penjadwalan extends Component {
@@ -46,37 +46,59 @@ class Penjadwalan extends Component {
 		if (prevState.graph !== this.state.graph) return true;
 	};
 	excelMenu = () => {
-		const url = getExcel(this.props.token, "Laporan", {
-			tahun: this.state.tahun,
-			penjadwalan: true,
-		});
-		if (this.state.graph.data.jadwal.hasJadwal && this.state.graph.data.jadwal.notHasJadwal) {
-			Router.push(url);
-		} else {
-			swal.fire({
-				title: "Data Kosong",
-				icon: "error",
+		if (this.props.user.role.id === 2024) {
+			Swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
+		} else {
+			const url = getExcel(this.props.token, "Laporan", {
+				tahun: this.state.tahun,
+				penjadwalan: true,
 			});
+			if (this.state.graph.data.jadwal.hasJadwal && this.state.graph.data.jadwal.notHasJadwal) {
+				Router.push(url);
+			} else {
+				Swal.fire({
+					title: "Data Kosong",
+					icon: "error",
+					confirmButtonColor: "#3e3a8e",
+				});
+			}
 		}
 	};
 	excelSemua = () => {
-		const url = getExcel(this.props.token, "Laporan", {
-			tahun: this.state.tahun,
-			pelaporan: true,
-			penjadwalan: true,
-			pemeriksaan: true,
-			sanksi: true,
-
-		});
-		if (this.state.graph.data.jadwal.hasJadwal && this.state.graph.data.jadwal.notHasJadwal) {
-			Router.push(url);
-		} else {
-			swal.fire({
-				title: "Data Kosong",
-				icon: "error",
+		if (this.props.user.role.id === 2024) {
+			Swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
+		} else {
+			const url = getExcel(this.props.token, "Laporan", {
+				tahun: this.state.tahun,
+				pelaporan: true,
+				penjadwalan: true,
+				pemeriksaan: true,
+				sanksi: true,
+
 			});
+			if (this.state.graph.data.jadwal.hasJadwal && this.state.graph.data.jadwal.notHasJadwal) {
+				Router.push(url);
+			} else {
+				Swal.fire({
+					title: "Data Kosong",
+					icon: "error",
+					confirmButtonColor: "#3e3a8e",
+				});
+			}
 		}
 	};
 

+ 2 - 2
pages/app/perbaikan/detail.js

@@ -56,7 +56,7 @@ class PemantauanDokumen extends Component {
 									<CardBody>
 										<Row>
 											<Col lg={12}>
-												<DetailSanksi data={sanksi.data} />
+												<DetailSanksi data={sanksi.data} role={this.props.user.role.id} />
 											</Col>
 										</Row>
 									</CardBody>
@@ -68,7 +68,7 @@ class PemantauanDokumen extends Component {
 						<Col xl="3">{pt ? <DetailPT data={pt} /> : <Loader />}</Col>
 					</Row>
 					<Row>
-						<Col>{sanksi.data && <Riwayat data={sanksi.data.perbaikan} />}</Col>
+						<Col>{sanksi.data && <Riwayat data={sanksi.data.perbaikan} role={this.props.user.role.id} />}</Col>
 					</Row>
 				</div>
 			</ContentWrapper>

+ 2 - 2
pages/app/rekomendasi-delegasi/detail.js

@@ -62,13 +62,13 @@ class Detail extends Component {
 						<Row>
 
 							<Col xl="9">
-								<DetailSanksi data={sanksi.data} />
+								<DetailSanksi data={sanksi.data} role={this.props.user.role.id} />
 								<Card className="card-default">
 									<CardHeader>
 										<CardTitle>Riwayat</CardTitle>
 									</CardHeader>
 									<CardBody>
-										<TableRiwayat data={sanksi.data} perbaikan={sanksi.data.perbaikan} />
+										<TableRiwayat data={sanksi.data} perbaikan={sanksi.data.perbaikan} role={this.props.user.role.id} />
 									</CardBody>
 								</Card>
 								<InputRekomendasi query={query} token={token} data={sanksi.data} />

+ 47 - 25
pages/app/sanksi/index.js

@@ -10,7 +10,7 @@ import Loader from "@/components/Common/Loader";
 import Link from "next/link";
 import Button from "reactstrap/lib/Button";
 import Router from "next/router";
-import swal from "sweetalert2";
+import Swal from "sweetalert2";
 
 
 class Sanksi extends Component {
@@ -46,37 +46,59 @@ class Sanksi extends Component {
 		if (prevState.graph !== this.state.graph) return true;
 	};
 	excelMenu = () => {
-		const url = getExcel(this.props.token, "Laporan", {
-			tahun: this.state.tahun,
-			sanksi: true,
-		});
-		if (this.state.graph.data.sanksi.hasSanksi && this.state.graph.data.sanksi.notHasSanksi) {
-			Router.push(url);
-		} else {
-			swal.fire({
-				title: "Data Kosong",
-				icon: "error",
+		if (this.props.user.role.id === 2024) {
+			Swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
+		} else {
+			const url = getExcel(this.props.token, "Laporan", {
+				tahun: this.state.tahun,
+				sanksi: true,
 			});
+			if (this.state.graph.data.sanksi.hasSanksi && this.state.graph.data.sanksi.notHasSanksi) {
+				Router.push(url);
+			} else {
+				Swal.fire({
+					title: "Data Kosong",
+					icon: "error",
+					confirmButtonColor: "#3e3a8e",
+				});
+			}
 		}
 	};
 	excelSemua = () => {
-		const url = getExcel(this.props.token, "Laporan", {
-			tahun: this.state.tahun,
-			pelaporan: true,
-			penjadwalan: true,
-			pemeriksaan: true,
-			sanksi: true,
-
-		});
-		if (this.state.graph.data.sanksi.hasSanksi && this.state.graph.data.sanksi.notHasSanksi) {
-			Router.push(url);
-		} else {
-			swal.fire({
-				title: "Data Kosong",
-				icon: "error",
+		if (this.props.user.role.id === 2024) {
+			Swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
 				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
+		} else {
+			const url = getExcel(this.props.token, "Laporan", {
+				tahun: this.state.tahun,
+				pelaporan: true,
+				penjadwalan: true,
+				pemeriksaan: true,
+				sanksi: true,
+
 			});
+			if (this.state.graph.data.sanksi.hasSanksi && this.state.graph.data.sanksi.notHasSanksi) {
+				Router.push(url);
+			} else {
+				Swal.fire({
+					title: "Data Kosong",
+					icon: "error",
+					confirmButtonColor: "#3e3a8e",
+				});
+			}
 		}
 	};
 

+ 109 - 64
pages/app/sanksi/proses.js

@@ -24,6 +24,7 @@ import ComponentToPrint from "../../../components/Sanksi/SuratBA_A";
 import ReactToPrint, { PrintContextConsumer } from 'react-to-print';
 import { updatePddikti } from "../../../actions/sanksi";
 import { ENV } from "../../../env";
+import Swal from "sweetalert2";
 
 
 
@@ -65,25 +66,40 @@ class ProsesSanksi extends Component {
 
 
 	handleAutoSave = async (data, activeStep) => {
+		if (this.props.user.role.id === 2024) {
+			""
+		} else {
+			const { query, token } = this.props;
+			const { id } = query;
+			const { dataSuratBA, dataUpload } = this.state
+			await inputAutoSave({ data: { PenetapanSanksi: { dataSuratBA, dataUpload, dataPelanggaran: data, activeStep } }, token, id, laporan: true })
+		}
 
-		const { query, token } = this.props;
-		const { id } = query;
-		const { dataSuratBA, dataUpload } = this.state
-		await inputAutoSave({ data: { PenetapanSanksi: { dataSuratBA, dataUpload, dataPelanggaran: data, activeStep } }, token, id, laporan: true })
 	}
 
 	done = async () => {
-		this.setState({
-			loading: true
-		})
-		const sanksi = await this.tambahSanksi()
-		if (sanksi && ENV === "production") {
-			await this.updatePddikti(sanksi.data._id)  //kirim sanksiID ke function updatePDDIKTI
-		}
+		if (this.props.user.role.id === 2024) {
+			Swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
+		} else {
+			this.setState({
+				loading: true
+			})
+			const sanksi = await this.tambahSanksi()
+			if (sanksi && ENV === "production") {
+				await this.updatePddikti(sanksi.data._id)  //kirim sanksiID ke function updatePDDIKTI
+			}
 
-		await Router.push({
-			pathname: "/app/sanksi",
-		});
+			await Router.push({
+				pathname: "/app/sanksi",
+			});
+		}
 	};
 
 	updatePddikti = async (sanksiId) => {
@@ -129,13 +145,13 @@ class ProsesSanksi extends Component {
 						formdata.append("dokumen_terima_sanksi", e);
 					});
 				}
-	
+
 				const sanksi = await createSanksi(token, id, formdata, _csrf)
-	
+
 				toast.update(toastid, { render: "Berhasil membuat sanksi", type: "success", isLoading: false, autoClose: true, closeButton: true });
 				return sanksi
 			}
-	
+
 			catch (error) {
 				toast.update(toastid, { render: error.response.data.message || error.message, type: "error", isLoading: false, autoClose: true, closeButton: true });
 				return null
@@ -147,7 +163,7 @@ class ProsesSanksi extends Component {
 				const formdata = new FormData();
 				formdata.append("no_sanksi", this.state.dataUpload.nomorSanksi);
 				formdata.append("keterangan", this.state.dataUpload.keterangan);
-	
+
 				formdata.append("from_date", this.state.dataUpload.awalTMT);
 				formdata.append("to_date", this.state.dataUpload.akhirTMT);
 				formdata.append("tanggal_terima_sanksi", this.state.dataUpload.terimaSuratSanksi);
@@ -163,41 +179,50 @@ class ProsesSanksi extends Component {
 						formdata.append("dokumen_terima_sanksi", e);
 					});
 				}
-	
+
 				const sanksi = await createSanksi(token, id, formdata, _csrf)
-	
+
 				toast.update(toastid, { render: "Berhasil membuat sanksi", type: "success", isLoading: false, autoClose: true, closeButton: true });
 				return sanksi
 			}
-	
+
 			catch (error) {
 				toast.update(toastid, { render: error.response.data.message || error.message, type: "error", isLoading: false, autoClose: true, closeButton: true });
 				return null
 			}
 		}
-		
-
-	}
 
 
+	}
 
 	handleDelegasi = async (data) => {
-
-		const getToken = await getCsrf();
-		const _csrf = getToken.token;
-		const { token, query } = this.props;
-		const { id } = query;
-		let update = null;
-		const toastid = toast.loading("Please wait...");
-		data.change_role = "true";
-		data.keterangan = "delegasi ke DIKTI"
-		update = await updateLaporan(token, id, data, _csrf);
-
-		if (!update) {
-			toast.update(toastid, { render: "Laporan gagal didelegasi", type: "error", isLoading: false, autoClose: true, closeButton: true });
+		if (this.props.user.role.id === 2024) {
+			Swal.fire({
+				icon: 'error',
+				title: 'Oops...',
+				html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+				confirmButtonColor: "#3e3a8e",
+				confirmButtonText: 'Oke'
+				// footer: '<a href="">Why do I have this issue?</a>'
+			})
 		} else {
-			toast.update(toastid, { render: "Laporan berhasil didelegasi", type: "success", isLoading: false, autoClose: true, closeButton: true });
-			Router.push("/app/sanksi");
+
+			const getToken = await getCsrf();
+			const _csrf = getToken.token;
+			const { token, query } = this.props;
+			const { id } = query;
+			let update = null;
+			const toastid = toast.loading("Please wait...");
+			data.change_role = "true";
+			data.keterangan = "delegasi ke DIKTI"
+			update = await updateLaporan(token, id, data, _csrf);
+
+			if (!update) {
+				toast.update(toastid, { render: "Laporan gagal didelegasi", type: "error", isLoading: false, autoClose: true, closeButton: true });
+			} else {
+				toast.update(toastid, { render: "Laporan berhasil didelegasi", type: "success", isLoading: false, autoClose: true, closeButton: true });
+				Router.push("/app/sanksi");
+			}
 		}
 	};
 
@@ -283,11 +308,18 @@ class ProsesSanksi extends Component {
 				});
 			}
 		}
-
-
-
 	}
 
+	handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
+
 	render() {
 		const { dataUpload, dataPelanggaran, pelaporan, dataSuratBA } = this.state
 		return (
@@ -457,17 +489,25 @@ class ProsesSanksi extends Component {
 													<div style={{ display: "none" }}>
 														<ComponentToPrint ref={el => (this.componentRef = el)} query={this.props.query} handleAutoSave={this.handleAutoSave} dataPelanggaran={this.state.dataPelanggaran} setDataSuratBA={this.setDataSuratBA} dataLaporan={pelaporan} dataSuratBA={dataSuratBA} />
 													</div>
-													<ReactToPrint
-														trigger={() => {
-															return <span>
-
-																<Button color className="btn-labeled-4 mt-0">
-																	<h5 className="p-0 mt-2"><em className="fas fa-download mr-2" />Print dan Download</h5>
-																</Button>
-															</span>
-														}}
-														content={() => this.componentRef}
-													/>
+													{this.props.user.role.id === 2024 ?
+														<Button color className="btn-labeled-4 mt-0" onClick={this.handleOpenAlert}>
+															<h5 className="p-0 mt-2"><em className="fas fa-download mr-2" />Print dan Download</h5>
+														</Button>
+														:
+														<ReactToPrint
+															trigger={() => {
+																return <span>
+																	<Button color className="btn-labeled-4 mt-0">
+																		<h5 className="p-0 mt-2"><em className="fas fa-download mr-2" />Print dan Download</h5>
+																	</Button>
+
+																</span>
+															}}
+															content={() => this.componentRef}
+														/>
+
+													}
+
 												</div>
 											</FormGroup>
 											<hr />
@@ -487,17 +527,22 @@ class ProsesSanksi extends Component {
 												<FormGroup row>
 													<Col md="4">Surat Berita Acara:</Col>
 													<Col md="8">
-
-														<ReactToPrint
-															trigger={() => {
-																return <span>
-																	<Button color className="btn-labeled-4 mt-0">
-																		<h5 className="p-0 mt-2"><em className="fas fa-download mr-2" />Print dan Download</h5>
-																	</Button>
-																</span>
-															}}
-															content={() => this.componentRef}
-														/>
+														{this.props.user.role.id === 2024 ?
+															<Button color className="btn-labeled-4 mt-0" onClick={this.handleOpenAlert}>
+																<h5 className="p-0 mt-2"><em className="fas fa-download mr-2" />Print dan Download</h5>
+															</Button>
+															:
+															<ReactToPrint
+																trigger={() => {
+																	return <span>
+																		<Button color className="btn-labeled-4 mt-0">
+																			<h5 className="p-0 mt-2"><em className="fas fa-download mr-2" />Print dan Download</h5>
+																		</Button>
+																	</span>
+																}}
+																content={() => this.componentRef}
+															/>
+														}
 														<div style={{ display: "none" }}>
 															<ComponentToPrint ref={el => (this.componentRef = el)} query={this.props.query} handleAutoSave={this.handleAutoSave} dataPelanggaran={this.state.dataPelanggaran} setDataSuratBA={this.setDataSuratBA} dataLaporan={pelaporan} dataSuratBA={dataSuratBA} />
 														</div>