import React, { Component } from "react"; import Router from "next/router"; import { connect } from "react-redux"; import ContentWrapper from "@/components/Layout/ContentWrapper"; import { Row, Col, Card, CardHeader, CardBody, Button, FormGroup, Popover, PopoverHeader, Modal, ModalBody, ModalFooter, ModalHeader } from "reactstrap"; import 'react-draft-wysiwyg/dist/react-draft-wysiwyg.css'; import dynamic from 'next/dynamic'; const Editor = dynamic( () => import('react-draft-wysiwyg').then(mod => mod.Editor), { ssr: false }) import pdfMake from "pdfmake/build/pdfmake"; import pdfFonts from "pdfmake/build/vfs_fonts"; import { toast } from "react-toastify"; import { addCatatan, deletePeserta, getOneCatatan, updateCatatan } from "../../../actions/catatan"; import { getCsrf } from "../../../actions/security"; pdfMake.vfs = pdfFonts.pdfMake.vfs; import { ENV } from '../../../env.js'; import CopyToClipboard from "react-copy-to-clipboard"; import ReactToPrint from "react-to-print"; import ComponentToPrint from "../../../components/Main/presensi_print.js"; import Datetime from "react-datetime"; import ContentEditable from 'react-contenteditable' class EditFile extends Component { constructor(props) { super(props); this.state = { tanggal: "", modalRemovePeserta: false, setTanggal: false, isEditTanggal: false, isEditTempat: false, simpulan: "  ", rekomendasi: "  ", selectedPeserta: "", isi: [ { Aspek_Perbaikan: "", Laporan_Perbaikan: "", Hasil_Verifikasi: "", }, ], }; } static getInitialProps = async ({ query }) => { return { query }; }; componentDidMount = async () => { const { token, query } = this.props; const { id } = query; const getCatatan = await getOneCatatan(token, id) // const sanksi = await getOneSanksi(token, idSanksi, { all: true }); const pt = getCatatan.data?.isi.pt; const catatan = getCatatan.data const judul = getCatatan.data.judul const tempat = catatan.isi.tempat const setTanggal = catatan.isi.setTanggal const isi = catatan.isi.isi const tanggal = catatan.isi.tanggal const isEditTanggal = catatan.isi.isEditTanggal const isEditTempat = catatan.isi.isEditTempat const simpulan = catatan.isi.simpulan const rekomendasi = catatan.isi.rekomendasi this.setState({ isi, catatan, judul, pt, tanggal, tempat, isEditTanggal, isEditTempat, simpulan, rekomendasi, setTanggal }); } handelSimpan = async (data) => { if (this.props?.user?.role.id === 2024) { Swal.fire({ icon: 'error', title: 'Oops...', html: 'Maaf anda tidak memiliki akses untuk menyelesaikan

proses ini.

', confirmButtonColor: "#3e3a8e", confirmButtonText: 'Oke' }) } else { const getToken = await getCsrf(); const _csrf = getToken.token; const { token, query } = this.props; const { id } = query; const toastid = toast.loading("Please wait..."); const added = await updateCatatan(token, this.state.catatan.sanksi_id, { "judul": this.state.judul, "isi": this.state, "catatan_id": id, "menu": "Naik Sanksi" }, _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(`/app/naik-sanksi/detail?id=${this.state.catatan.sanksi_id}`); } } }; setHandleJudul = (e) => { this.setState({ judul: e.target.value }); }; CloseCopiedd = () => { setTimeout(() => { this.setState({ copiedd: !this.state.copiedd }); }, 1000); } Copiedd = () => this.setState({ copiedd: !this.state.copiedd }) isEditTanggal = () => { this.setState({ isEditTanggal: !this.state.isEditTanggal, }) } isEditTempat = () => { this.setState({ isEditTempat: !this.state.isEditTempat, }) } handleAspek = (evt, id, field) => { const newValue = evt.target.value || evt.target.innerHTML; this.setState(prevState => ({ isi: prevState.isi.map((item, index) => index === id ? { ...item, [field]: newValue } : item ) })); }; addRow = () => { this.setState(prevState => ({ isi: [ ...prevState.isi, { Aspek_Perbaikan: "", Laporan_Perbaikan: "", Hasil_Verifikasi: "" } ] })); }; setDataCatatan = (data) => { this.setState({ dataCatatan: data }); } removeRow = (index) => { this.setState(prevState => ({ isi: prevState.isi.filter((_, i) => i !== index) })); }; setModalRemovePeserta = (modalRemovePeserta) => { this.setState({ modalRemovePeserta: !this.state.modalRemovePeserta }) } render() { const { catatan, pt, isEditTanggal, tanggal } = this.state; return ( Apakah anda ingin menghapus peserta?
{ return }} content={() => this.componentRef} />
(this.componentRef = el)} query={this.props.query} />
logo

LAPORAN HASIL VERIFIKASI DAN VALIDASI DOKUMEN USUL PENCABUTAN SANKSI ADMINISTRATIF

{pt && (

{pt.nama}

)}

Pada hari ini {isEditTanggal && { this.setState({ tanggal, setTanggal: true }) }} closeOnSelect={true} />

{this.state.isi?.map((isi, index) => ( ))}
NO ASPEK PERBAIKAN LAPORAN PERBAIKAN HASIL VERIFIKASI DAN VALIDASI
{index + 1} { this.handleAspek(evt, index, "Aspek_Perbaikan") }} /> { this.handleAspek(evt, index, "Laporan_Perbaikan") }} /> { this.handleAspek(evt, index, "Hasil_Verifikasi") }} />
Simpulan : { this.setState({ simpulan: e.target.value }); }} tagName="text" />
Rekomendasi : { this.setState({ rekomendasi: e.target.value }); }} tagName="text" />
PESERTA RAPAT
{catatan ? catatan.daftar_kehadiran_peserta?.map((value) => (
{value.nama}
)) : ""}
{ENV === "local" &&
Link Berhasil Disalin
} {ENV === "production" &&
Link Berhasil Disalin
} {ENV === "development" &&
Link Berhasil Disalin
}
); } } const mapStateToProps = (state) => ({ user: state.user, token: state.token }); export default connect(mapStateToProps)(EditFile);