import React, { Component } from "react";
import { Row, Col, Input, FormGroup, Label, Progress, Button } from "reactstrap";
import Select from "react-select";
import Swal from "sweetalert2";
import * as Yup from "yup";
import { connect } from "react-redux";
import { Formik, Form, Field, ErrorMessage } from "formik";
import { updateLaporan } from "../../actions/pelaporan"
import { getCsrf } from "../../actions/security";
import { ToastContainer, toast } from "react-toastify";
import Router from "next/router";
import { createLog } from "../../actions/log";
const checkIfFilesAreTooBig = (files) => {
    let valid = true;
    if (files) {
        files.map((file) => {
            if (file.size > 15 * 1024 * 1024) {
                valid = false;
            }
        });
    }
    return valid;
};
let Dropzone = null;
class DropzoneWrapper extends Component {
    state = {
        isClient: false,
    };
    componentDidMount = () => {
        Dropzone = require("react-dropzone").default;
        this.setState({ isClient: true });
    };
    render() {
        return Dropzone ? 
proses ini.
', confirmButtonColor: "#3e3a8e", confirmButtonText: 'Oke' }) } else { const getToken = await getCsrf(); const _csrf = getToken.token; const { token } = this.props; const formdata = new FormData(); formdata.append("keterangan", data.keterangan); this.state.files.forEach((e) => { formdata.append("dokumen", e); }); formdata.append("aktif", "false"); await toast.promise(updateLaporan(token, this.props.id, formdata, _csrf + `&redudansi=true`), { pending: "Loading", success: { render: "success", autoClose: 1000 }, error: "Error", }); await this.logDitutup() await Router.push({ pathname: "/app/sanksi", }); } }; setDataStatusLaporan = () => { this.props.setDataStatusLaporan(this.state) } render() { const { files, selectedOption } = this.state; const removeFile = file => () => { const newFiles = [...files] newFiles.splice(newFiles.indexOf(file), 1) this.setState({ files: newFiles, }); } const thumbs = files.map((file, index) => ({file.name}
)); return ( <>