andi il y a 2 ans
Parent
commit
713efc9d13

+ 4 - 3
components/Bypass/TableBypass.js

@@ -18,10 +18,11 @@ function TableBypass({ listData, to, linkName, role }) {
     const [modalIsOpen, setModalIsOpen] = useState(false)
     const [seledtedID, setSelectedID] = useState("")
     const setmodal = (id) => {
-        setModalIsOpen(true)
+        setModalIsOpen(!modalIsOpen)
         setSelectedID(id)
     }
-
+    const setmodals = () => {
+    }
 
     return (
         <div className="card b">
@@ -52,7 +53,7 @@ function TableBypass({ listData, to, linkName, role }) {
                     }}>
                         <span className="font-color-white">Ya</span>
                     </Button>
-                    <Button color className="btn-v2" onClick={setModalIsOpen}>
+                    <Button color className="btn-v2" onClick={ setmodal }>
                         Tidak
                     </Button>
                 </ModalFooter>

+ 20 - 8
components/PelaporanTuntas/DetailLaporan.js

@@ -2,8 +2,18 @@ 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 handleOpenAlert = () => {
+		Swal.fire({
+			icon: 'error',
+			title: 'Oops...',
+			html: 'Maaf anda tidak memiliki akses untuk menyelesaikan<p> proses ini.</p>',
+			confirmButtonColor: "#3e3a8e",
+			confirmButtonText: 'Oke'
+		})
+	};
 	const user = useSelector((state) => state.user);
 	return (
 		<>
@@ -127,10 +137,6 @@ function DetailLaporan({ data, noTitle = false, noStatus = false }) {
 				) : (
 					""
 				)}
-				{/* <FormGroup row>
-					<Col md="4">Prioritas:</Col>
-					<Col md="8">{data.level == 3 ? <div className="badge badge-success">Tinggi</div> : data.level == 2 ? <div className="badge badge-info">Sedang</div> : <div className="badge badge-warning">Rendah</div>}</Col>
-				</FormGroup> */}
 				<FormGroup row>
 					<Col md="4">Dokumen Pendukung:</Col>
 					<Col md="8">
@@ -143,9 +149,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>
 									))}

+ 20 - 4
components/PelaporanTuntas/DetailSanksi.js

@@ -2,8 +2,18 @@ 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";
 
-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>}
@@ -65,9 +75,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>
 									))}

+ 18 - 12
components/Pemeriksaan/DetailLaporan.js

@@ -2,8 +2,18 @@ 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, 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'
+		})
+	};
 	const user = useSelector((state) => state.user);
 	return (
 		<>
@@ -148,18 +158,14 @@ function DetailLaporan({ data, noTitle = false, noStatus = false, role }) {
 												<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>
+												{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>
 									))}

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

@@ -67,7 +67,7 @@ class DetailPelaporan extends Component {
 									<CardBody>
 										<Row>
 											<Col lg={12}>
-												{sanksi?.data && query?.data === "sanksi" ? <DetailSanksi data={sanksi.data} /> : <Loader />}
+												{sanksi?.data && query?.data === "sanksi" ? <DetailSanksi data={sanksi.data} role={this.props.user.role.id} /> : <Loader />}
 											</Col>
 										</Row>
 									</CardBody>
@@ -78,7 +78,7 @@ class DetailPelaporan extends Component {
 									<CardBody>
 										<Row>
 											<Col lg={12}>
-												{pelaporan?.data && query.data === "laporan" ? <DetailLaporan data={pelaporan.data} /> : <Loader />}</Col>
+												{pelaporan?.data && query.data === "laporan" ? <DetailLaporan data={pelaporan.data} role={this.props.user.role.id} /> : <Loader />}</Col>
 										</Row>
 									</CardBody>
 								</Card>

+ 20 - 2
pages/app/tuntas/index.js

@@ -70,6 +70,15 @@ class PelaporanTuntas extends Component {
         Router.push(url);
     };
     excelMenu = () => {
+        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'
+            })
+        } else {
         const url = getExcel(this.props.token, "Laporan", {
             tahun: this.state.tahun,
             pelaporan: true,
@@ -82,9 +91,18 @@ class PelaporanTuntas extends Component {
                 icon: "error",
                 confirmButtonColor: "#3e3a8e",
             });
-        }
+        }}
     };
     excelSemua = () => {
+        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'
+            })
+        } else {
         const url = getExcel(this.props.token, "Laporan", {
             tahun: this.state.tahun,
             pelaporan: true,
@@ -101,7 +119,7 @@ class PelaporanTuntas extends Component {
                 icon: "error",
                 confirmButtonColor: "#3e3a8e",
             });
-        }
+        }}
     };
 
     render() {

+ 31 - 21
pages/app/verifikasi/index.js

@@ -8,6 +8,7 @@ import { loginToPt } from "../../../actions/auth";
 import { connect } from "react-redux";
 import { ToastContainer, toast } from "react-toastify";
 import { getCsrf } from "../../../actions/security";
+import Swal from "sweetalert2";
 
 
 
@@ -70,28 +71,37 @@ class Verifikasi extends React.Component {
         this.setState({ pt_id: selected_PT.value });
     };
     onSubmit = async () => {
-        const getToken = await getCsrf();
-        const _csrf = getToken.token;
-        this.setState({ loading: true });
-        const { password } = this.state.formLogin;
-        const { pt_id } = this.state
-        const auth = await toast.promise(loginToPt(pt_id, password, _csrf), {
-            pending: "Loading",
-            success: "Success",
-            error: "Akun tidak ada",
-        });
-        // const auth = await loginToPt(pt_id, password);
-        this.props.setToken(auth.data.token);
-        this.props.setUser(auth.data.user);
-        if (auth.data.user.role.id === 2022) {
-            location.href = "/pt/pemantauan"
-            return;
-        } else if ([2020, 2021, 2023].includes(auth.data.user.role.id)) {
-            location.href = "/pt/pemantauan"
-            return;
+        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'
+            })
+        } else {
+            const getToken = await getCsrf();
+            const _csrf = getToken.token;
+            this.setState({ loading: true });
+            const { password } = this.state.formLogin;
+            const { pt_id } = this.state
+            const auth = await toast.promise(loginToPt(pt_id, password, _csrf), {
+                pending: "Loading",
+                success: "Success",
+                error: "Akun tidak ada",
+            });
+            // const auth = await loginToPt(pt_id, password);
+            this.props.setToken(auth.data.token);
+            this.props.setUser(auth.data.user);
+            if (auth.data.user.role.id === 2022) {
+                location.href = "/pt/pemantauan"
+                return;
+            } else if ([2020, 2021, 2023].includes(auth.data.user.role.id)) {
+                location.href = "/pt/pemantauan"
+                return;
+            }
+            this.setState({ loading: false });
         }
-        this.setState({ loading: false });
-
     }