andi пре 2 година
родитељ
комит
f0fb53b262

+ 2 - 2
components/Extras/calendar.view.js

@@ -136,7 +136,7 @@ class Calendar extends Component {
 	}
 
 	handleEventCalendar = async (data) => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',
@@ -197,7 +197,7 @@ class Calendar extends Component {
 	}
 
 	handleSimpan = async (value) => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',

+ 1 - 1
components/NaikSanksi/InputTanggal.js

@@ -156,7 +156,7 @@ class InputTanggal extends Component {
 
 
     handelSimpan = async (data) => {
-        if (this.props.user.role.id === 2024) {
+        if (this.props?.user?.role.id === 2024) {
             Swal.fire({
                 icon: 'error',
                 title: 'Oops...',

+ 1 - 1
components/Pelaporan/InputData.js

@@ -146,7 +146,7 @@ export class InputData extends Component {
 		await createLog(token, { aktivitas: "Mengakses halaman Pelaporan", menu: "Pelaporan", _csrf: _csrf });
 	}
 	onSubmit = async (data) => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',

+ 1 - 1
components/Pemeriksaan/InputEvaluasi.js

@@ -139,7 +139,7 @@ class InputEvaluasi extends Component {
 	};
 
 	onSubmit = async (data, { resetForm }) => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',

+ 1 - 1
components/PerpanjanganSanksi/InputTanggal.js

@@ -141,7 +141,7 @@ class InputTanggal extends Component {
 
 
     handelSimpan = async (data) => {
-        if (this.props.user.role.id === 2024) {
+        if (this.props?.user?.role.id === 2024) {
             Swal.fire({
                 icon: 'error',
                 title: 'Oops...',

+ 1 - 1
components/RekomendasiDelegasi/InputRekomendasi.js

@@ -123,7 +123,7 @@ class InputRekomendasi extends Component {
 
 
 	handelSimpan = async () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',

+ 3 - 3
components/Sanksi/DetailSanksi.js

@@ -104,7 +104,7 @@ class DetailSanksi extends Component {
 														<em className="fa-lg far fa-file-code"></em>
 													</td>
 													<td>
-														{this.props.user.role.id === 2024?
+														{this.props?.user?.role.id === 2024 ?
 															<a className="text-muted" onClick={this.handleOpenAlert} >
 																{e.judul}
 															</a>
@@ -128,7 +128,7 @@ class DetailSanksi extends Component {
 							<Col md="4">Dokumen Acara Pleno:</Col>
 							<Col md="8">
 								<div>
-									{this.props.user.role.id === 2024 ?
+									{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>
@@ -155,7 +155,7 @@ class DetailSanksi extends Component {
 										<ComponentBA ref={el => (this.componentRef = el)} query={this.props.query} />
 									</div>
 								</div>
-					
+
 							</Col>
 						</FormGroup>
 						<FormGroup row>

+ 26 - 9
components/Sanksi/SuratBA _detail.js

@@ -87,8 +87,8 @@ class ComponentBA extends React.Component {
                                 {this.state?.setTanggal_2 === true ? (
 
                                     this.state?.setTanggal_2 === true ?
-                                    <span > {moment(this.state?.tanggal_2).locale("id").format("dddd")}, tanggal&nbsp;{moment(this.state?.tanggal_2).format("D")}&nbsp; bulan &nbsp;{moment(this.state?.tanggal_2).format("MMMM")} tahun &nbsp;{moment(this.state?.tanggal_2).format("YYYY")},</span> :
-                                    <span> &nbsp;- &nbsp;</span>
+                                        <span > {moment(this.state?.tanggal_2).locale("id").format("dddd")}, tanggal&nbsp;{moment(this.state?.tanggal_2).format("D")}&nbsp; bulan &nbsp;{moment(this.state?.tanggal_2).format("MMMM")} tahun &nbsp;{moment(this.state?.tanggal_2).format("YYYY")},</span> :
+                                        <span> &nbsp;- &nbsp;</span>
                                 )
                                     : (
                                         this.state?.setTanggal === true ?
@@ -119,7 +119,26 @@ class ComponentBA extends React.Component {
                                 </tr>
                             </thead>
                             <tbody>
-                                {this.state.dataPelanggaran?.data?.map((e, i) => (
+                                {dataLaporan?.data?.sanksi.pelanggaran.map((e, i) => (
+                                    <tr key={e._id}>
+                                        <td>{++i}</td>
+                                        {dataLaporan.data && (<td >{dataLaporan.data.pt.nama}</td>)}
+                                        <td>{e.pasal}</td>
+                                        <td>{e.butir_pelanggaran}</td>
+                                        <td>{e.pelanggaran}</td>
+                                        {this.state?.descPelanggaran ?
+                                            (
+                                                <td style={{ minWidth: "215px" }} >{"-" || this.state.descPelanggaran[e?._id]?.simpulan
+                                                }</td>
+                                            ) :
+                                            (<td style={{ minWidth: "215px" }}>
+                                                -
+                                            </td>)
+                                        }
+                                        <td style={{ minWidth: "215px" }}>{`Sanksi Administratif berupa ${this.state?.sanksi ? this.state?.sanksi : ""}` || ""}</td>
+                                    </tr>
+                                ))}
+                                {/* {this.state.dataPelanggaran?.data?.map((e, i) => (
                                     <tr key={e._id}>
                                         <td>{++i}</td>
                                         {this.state.dataSanksi.data && (<td className='BA-header'>{this.state.dataSanksi.data.laporan.pt.nama}</td>)}
@@ -130,18 +149,16 @@ class ComponentBA extends React.Component {
                                             (
                                                 <td style={{ minWidth: "215px" }} >{"-" || this.state.descPelanggaran[e?._id]?.simpulan
                                                 }</td>
-                                            ):
+                                            ) :
                                             (<td style={{ minWidth: "215px" }}>
                                                 -
                                             </td>)
                                         }
-                                        {/* <td style={{ minWidth: "215px" }} >{"" || dataSuratBA?.descPelanggaran[e?._id]?.simpulan
-                                            || this.state.descPelanggaran[e?._id]?.simpulan
-                                        }</td> */}
-                                        <td style={{ minWidth: "215px" }}>{`Sanksi Administratif berupa ${this.state?.sanksi? this.state?.sanksi:"" }` || ""}</td>
+
+                                        <td style={{ minWidth: "215px" }}>{`Sanksi Administratif berupa ${this.state?.sanksi ? this.state?.sanksi : ""}` || ""}</td>
                                     </tr>
 
-                                ))}
+                                ))} */}
                             </tbody>
                         </table>
                     </div>

+ 1 - 1
components/TurunSanksi/InputTanggal.js

@@ -159,7 +159,7 @@ class InputTanggal extends Component {
 
 
     handelSimpan = async (data) => {
-        if (this.props.user.role.id === 2024) {
+        if (this.props?.user?.role.id === 2024) {
             Swal.fire({
                 icon: 'error',
                 title: 'Oops...',

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

@@ -173,7 +173,7 @@ class JawabanBanding extends Component {
 
 
 	handelSimpan = async () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			swal.fire({
 				icon: 'error',
 				title: 'Oops...',

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

@@ -182,7 +182,7 @@ class DetailKeberatan extends Component {
 	};
 
 	handelSimpan = async () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			swal.fire({
 				icon: 'error',
 				title: 'Oops...',

+ 2 - 2
pages/app/pelaporan/index.js

@@ -64,7 +64,7 @@ class Pelaporan extends Component {
 		if (prevState.graph !== this.state.graph) return true;
 	};
 	excelMenu = () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',
@@ -90,7 +90,7 @@ class Pelaporan extends Component {
 		}
 	};
 	excelSemua = () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',

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

@@ -48,7 +48,7 @@ class Pemeriksaan extends Component {
 
 
 	excelMenu = () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			swal.fire({
 				icon: 'error',
 				title: 'Oops...',
@@ -75,7 +75,7 @@ class Pemeriksaan extends Component {
 	};
 
 	excelSemua = () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			swal.fire({
 				icon: 'error',
 				title: 'Oops...',

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

@@ -137,7 +137,7 @@ class JawabanPencabutanSanksi extends Component {
 	};
 
 	handleSimpan = async () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',

+ 2 - 2
pages/app/penjadwalan/index.js

@@ -46,7 +46,7 @@ class Penjadwalan extends Component {
 		if (prevState.graph !== this.state.graph) return true;
 	};
 	excelMenu = () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',
@@ -72,7 +72,7 @@ class Penjadwalan extends Component {
 		}
 	};
 	excelSemua = () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',

+ 2 - 2
pages/app/sanksi/index.js

@@ -46,7 +46,7 @@ class Sanksi extends Component {
 		if (prevState.graph !== this.state.graph) return true;
 	};
 	excelMenu = () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',
@@ -72,7 +72,7 @@ class Sanksi extends Component {
 		}
 	};
 	excelSemua = () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',

+ 3 - 3
pages/app/sanksi/proses.js

@@ -66,7 +66,7 @@ class ProsesSanksi extends Component {
 
 
 	handleAutoSave = async (data, activeStep) => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			""
 		} else {
 			const { query, token } = this.props;
@@ -78,7 +78,7 @@ class ProsesSanksi extends Component {
 	}
 
 	done = async () => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',
@@ -196,7 +196,7 @@ class ProsesSanksi extends Component {
 	}
 
 	handleDelegasi = async (data) => {
-		if (this.props.user.role.id === 2024) {
+		if (this.props?.user?.role.id === 2024) {
 			Swal.fire({
 				icon: 'error',
 				title: 'Oops...',

+ 31 - 29
pages/app/tuntas/index.js

@@ -70,7 +70,7 @@ class PelaporanTuntas extends Component {
         Router.push(url);
     };
     excelMenu = () => {
-        if (this.props.user.role.id === 2024) {
+        if (this.props?.user?.role.id === 2024) {
             swal.fire({
                 icon: 'error',
                 title: 'Oops...',
@@ -79,22 +79,23 @@ class PelaporanTuntas extends Component {
                 confirmButtonText: 'Oke'
             })
         } else {
-        const url = getExcel(this.props.token, "Laporan", {
-            tahun: this.state.tahun,
-            pelaporan: true,
-        });
-        if (this.state.graph.data.jumlah_ditutup && this.state.graph.data.jumlah_selesai) {
-            Router.push(url);
-        } else {
-            swal.fire({
-                title: "Data Kosong",
-                icon: "error",
-                confirmButtonColor: "#3e3a8e",
+            const url = getExcel(this.props.token, "Laporan", {
+                tahun: this.state.tahun,
+                pelaporan: true,
             });
-        }}
+            if (this.state.graph.data.jumlah_ditutup && this.state.graph.data.jumlah_selesai) {
+                Router.push(url);
+            } else {
+                swal.fire({
+                    title: "Data Kosong",
+                    icon: "error",
+                    confirmButtonColor: "#3e3a8e",
+                });
+            }
+        }
     };
     excelSemua = () => {
-        if (this.props.user.role.id === 2024) {
+        if (this.props?.user?.role.id === 2024) {
             swal.fire({
                 icon: 'error',
                 title: 'Oops...',
@@ -103,23 +104,24 @@ class PelaporanTuntas extends Component {
                 confirmButtonText: 'Oke'
             })
         } else {
-        const url = getExcel(this.props.token, "Laporan", {
-            tahun: this.state.tahun,
-            pelaporan: true,
-            penjadwalan: true,
-            pemeriksaan: true,
-            sanksi: true,
+            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_ditutup && this.state.graph.data.jumlah_selesai) {
-            Router.push(url);
-        } else {
-            swal.fire({
-                title: "Data Kosong",
-                icon: "error",
-                confirmButtonColor: "#3e3a8e",
             });
-        }}
+            if (this.state.graph.data.jumlah_ditutup && this.state.graph.data.jumlah_selesai) {
+                Router.push(url);
+            } else {
+                swal.fire({
+                    title: "Data Kosong",
+                    icon: "error",
+                    confirmButtonColor: "#3e3a8e",
+                });
+            }
+        }
     };
 
     render() {

+ 1 - 1
pages/app/verifikasi/index.js

@@ -71,7 +71,7 @@ class Verifikasi extends React.Component {
         this.setState({ pt_id: selected_PT.value });
     };
     onSubmit = async () => {
-        if (this.props.user.role.id === 2024) {
+        if (this.props?.user?.role.id === 2024) {
             Swal.fire({
                 icon: 'error',
                 title: 'Oops...',

+ 33 - 27
pages/signature/pleno-sanksi/[id].js

@@ -217,33 +217,39 @@ class PlenoSanksi extends Component {
                                     </tr>
                                 </thead>
                                 <tbody>
-                                    
-                                    {/* {dataPelanggaran?.map((e, i) => (
-                                        <tr key={e._id}>
-                                            <td>{++i}</td>
-                                            {dataLaporan.data && (<td >{dataLaporan.data.pt.nama}</td>)}
-                                            <td>{e.pasal}</td>
-                                            <td>{e.butir_pelanggaran}</td>
-                                            <td>{e.pelanggaran}</td>
-                                            <td >{dataSuratBA?.descPelanggaran[e._id]?.simpulan || ""}</td>
-                                            <td style={{ maxWidth: "80px" }}>
-                                                {`Sanksi Administratif berupa ${dataSuratBA?.sanksi || this.state.sanksi}` || ""}
-                                            </td>
-                                        </tr>
-                                    ))} */}
-                                    {dataLaporan.data?.sanksi.pelanggaran.map((e, i) => (
-                                        <tr key={e._id}>
-                                            <td>{++i}</td>
-                                            {dataLaporan.data && (<td >{dataLaporan.data.pt.nama}</td>)}
-                                            <td>{e.pasal}</td>
-                                            <td>{e.butir_pelanggaran}</td>
-                                            <td>{e.pelanggaran}</td>
-                                            <td >{dataSuratBA?.descPelanggaran[e._id]?.simpulan || ""}</td>
-                                            <td style={{ maxWidth: "80px" }}>
-                                                {`Sanksi Administratif berupa ${dataSuratBA?.sanksi || this.state.sanksi}` || ""}
-                                            </td>
-                                        </tr>
-                                    ))}
+                                    {dataLaporan.data?.sanksi?.pelanggaran ?
+                                        (
+                                            dataLaporan.data?.sanksi.pelanggaran.map((e, i) => (
+                                                <tr key={e._id}>
+                                                    <td>{++i}</td>
+                                                    {dataLaporan.data && (<td >{dataLaporan.data.pt.nama}</td>)}
+                                                    <td>{e.pasal}</td>
+                                                    <td>{e.butir_pelanggaran}</td>
+                                                    <td>{e.pelanggaran}</td>
+                                                    <td >{dataSuratBA?.descPelanggaran[e._id]?.simpulan || ""}</td>
+                                                    <td style={{ maxWidth: "80px" }}>
+                                                        {`Sanksi Administratif berupa ${dataSuratBA?.sanksi || this.state.sanksi}` || ""}
+                                                    </td>
+                                                </tr>
+                                            ))
+                                        ) :
+                                        (
+                                            dataPelanggaran?.map((e, i) => (
+                                                <tr key={e._id}>
+                                                    <td>{++i}</td>
+                                                    {dataLaporan.data && (<td >{dataLaporan.data.pt.nama}</td>)}
+                                                    <td>{e.pasal}</td>
+                                                    <td>{e.butir_pelanggaran}</td>
+                                                    <td>{e.pelanggaran}</td>
+                                                    <td >{dataSuratBA?.descPelanggaran[e._id]?.simpulan || ""}</td>
+                                                    <td style={{ maxWidth: "80px" }}>
+                                                        {`Sanksi Administratif berupa ${dataSuratBA?.sanksi || this.state.sanksi}` || ""}
+                                                    </td>
+                                                </tr>
+                                            ))
+                                        )}
+
+
                                 </tbody>
                             </table>
                         </div>