CreateManagementDoc.js 27.5 KB
Newer Older
Deni Rinaldi's avatar
Deni Rinaldi committed
1 2 3
import React, { Component } from 'react'
import Images from '../../assets/Images'
import { TextField, withStyles, Snackbar } from '@material-ui/core'
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
4
import MuiAlert from '@material-ui/lab/Alert';
Deni Rinaldi's avatar
Deni Rinaldi committed
5 6 7 8 9 10 11
import api from '../../api'
import Autocomplete from '@material-ui/lab/Autocomplete'
import Constant from '../../library/Constant'
import { format } from 'date-fns';
import UploadFile from "../../library/Upload";
import { ExcelRenderer } from 'react-excel-renderer';
import * as R from 'ramda'
12
import PropagateLoader from "react-spinners/PropagateLoader"
Deni Rinaldi's avatar
Deni Rinaldi committed
13

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
14 15 16
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);

Deni Rinaldi's avatar
Deni Rinaldi committed
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
export default class CreateManagementDoc extends Component {
    constructor(props) {
        super(props)
        this.state = {
            perusahaan: null,
            perusahaanData: null,
            getPerusahaan: null,
            errorPerusahaan: false,
            msgErrorPerusahaan: '',
            document: null,
            documentData: null,
            getDocument: null,
            errorDocument: false,
            msgErrorDocument: '',
            listPeriode: null,
            periode: null,
33 34
            errorPeriode: false,
            msgErrorPeriode: '',
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
35 36
            listMonth: null,
            monthId: null,
37 38
            errorMonth: false,
            msgErrorMonth: '',
Deni Rinaldi's avatar
Deni Rinaldi committed
39 40 41 42 43 44 45
            description: '',
            errorDesc: false,
            msgErrorDesc: '',
            file: null,
            alert: false,
            tipeAlert: '',
            messageAlert: '',
46 47
            fileType: '',
            konfirmasi: false,
Deni Rinaldi's avatar
Deni Rinaldi committed
48
            docId: '',
49 50
            sizeUpload: "1",
            disabledPeriode: false
Deni Rinaldi's avatar
Deni Rinaldi committed
51 52 53 54 55 56 57
        }
    }

    componentDidMount() {
        this.getDataCompany()
        this.getDataDocument()
        this.getPeriode()
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
58
        this.getMonth()
Deni Rinaldi's avatar
Deni Rinaldi committed
59 60 61
        this.getFileSize()
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
62
    getFileSize() {
Deni Rinaldi's avatar
Deni Rinaldi committed
63 64 65 66 67 68
        let body = {
            group: 'MAX_FILE_SIZE',
            company_id: 0,
            type: 'MAX_FILE_SIZE'
        }
        api.create().getAllSettingByType(body).then(response => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
69
            // console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
70 71
            if (response.data) {
                if (response.data.status === "success") {
Deni Rinaldi's avatar
Deni Rinaldi committed
72
                    if (response.data.data.length == 0) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
73 74 75
                        this.setState({
                            sizeUpload: "1"
                        })
76 77 78 79 80 81
                    } else {
                        this.setState({
                            sizeUpload: response.data.data[0].value
                        })
                    }
                    // sizeUpload: response.data.data[0] ? response.data.data[0].value === undefined ? "1" : response.data.data[0].value : "1"
Deni Rinaldi's avatar
Deni Rinaldi committed
82 83 84
                }
            }
        })
Deni Rinaldi's avatar
Deni Rinaldi committed
85 86 87
    }

    getDataCompany() {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
88
        api.create().getPerusahaanUserActive().then((response) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
89 90 91 92 93 94 95 96 97
            if (response.data) {
                if (response.data.status == 'success') {
                    let data = response.data.data
                    let typeData = data.map((item) => {
                        return {
                            company_id: item.company_id,
                            company_name: item.company_name
                        }
                    })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
98 99 100 101
                    // typeData.push({
                    //     company_id: 0,
                    //     company_name: 'Default'
                    // })
Deni Rinaldi's avatar
Deni Rinaldi committed
102
                    let typeProps = {
103
                        options: typeData.sort((a, b) => a.company_name - b.company_name),
Deni Rinaldi's avatar
Deni Rinaldi committed
104 105 106 107 108 109 110 111 112 113 114 115 116 117
                        getOptionLabel: (option) => option.company_name,
                    };
                    this.setState({ perusahaan: typeProps, perusahaanData: response.data.data })
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                        if (response.data.message.includes("Someone Logged In")) {
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
118
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
Deni Rinaldi's avatar
Deni Rinaldi committed
119 120 121 122 123
            }
        })
    }

    getDataDocument() {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
124 125 126 127
        // let payload = {
        //     "setting_group_id": 7,
        //     "setting_type_id": 167,
        //     "company_id": 0
Deni Rinaldi's avatar
Deni Rinaldi committed
128

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
129 130
        // }
        api.create().getDocumentCategory().then(response => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
131
            // console.log(response);
Deni Rinaldi's avatar
Deni Rinaldi committed
132 133 134
            if (response.data) {
                if (response.data.status == 'success') {
                    let data = response.data.data
135 136 137 138 139 140 141 142 143 144 145 146 147 148
                    let typeData = []
                    data.map((item) => {
                        if (String(item.value).includes('Manual')){
                            if( this.props.allsubcoCreate ){
                                typeData.push( {
                                    document_category_id: item.setting_id,
                                    document_category_name: item.value
                                })
                            }
                        } else {
                            typeData.push( {
                                document_category_id: item.setting_id,
                                document_category_name: item.value
                            })
Deni Rinaldi's avatar
Deni Rinaldi committed
149 150
                        }
                    })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
151
                    // console.log(typeData)
Deni Rinaldi's avatar
Deni Rinaldi committed
152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167
                    let typeProps = {
                        options: typeData.sort((a, b) => a.document_category_id - b.document_category_id),
                        getOptionLabel: (option) => option.document_category_name,
                    };
                    this.setState({ document: typeProps, documentData: response.data.data })
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                        if (response.data.message.includes("Someone Logged In")) {
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
                }
            } else {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
168
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
Deni Rinaldi's avatar
Deni Rinaldi committed
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195
            }
        })
    }

    getPeriode() {
        api.create().getPeriodeTransaction().then(response => {
            let dateNow = new Date
            let year = format(dateNow, 'yyyy')
            if (response.data) {
                if (response.data.status === "success") {
                    let data = response.data.data
                    let periodeData = data.map((item) => {
                        return {
                            periode: item,
                        }
                    })
                    let defaultProps = {
                        options: periodeData,
                        getOptionLabel: (option) => option.periode,
                    };
                    let index = data.sort((a, b) => a - b).findIndex((val) => val == year)
                    this.setState({ listPeriode: defaultProps, periode: index == -1 ? periodeData[0] : periodeData[index] })
                }
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
196
    getMonth() {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
        api.create().getMonthTransaction().then(response => {
            let dateNow = new Date
            // let bulan = format(dateNow, 'MMMM')
            if (response.data) {
                if (response.data.status === "success") {
                    let data = response.data.data
                    let monthData = data.map((item) => {
                        return {
                            month_id: item.month_id,
                            month_name: item.month_name
                        }
                    })
                    let defaultProps = {
                        options: monthData,
                        getOptionLabel: (option) => option.month_name,
                    };
                    // let index = data.sort((a, b) => a - b).findIndex((val) => val == bulan)
                    // this.setState({ listMonth: defaultProps, month: index == -1 ? monthData[0] : monthData[index] })
                    this.setState({ listMonth: defaultProps })
                }
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
221 222 223 224 225 226
    clearMessage() {
        this.setState({
            errorPerusahaan: false,
            msgErrorPerusahaan: '',
            errorDocument: false,
            msgErrorDocument: '',
227 228 229 230
            errorMonth: false,
            msgErrorMonth: '',
            errorPeriode: false,
            msgErrorPeriode: '',
Deni Rinaldi's avatar
Deni Rinaldi committed
231 232 233 234 235 236 237
        })
    }

    fileHandler = (event) => {
        let fileObj = event
        let length = event.name.split(".").length
        let fileType = event.name.split(".")[length - 1]
238
        if (fileType === 'zip' || 'rar') {
Deni Rinaldi's avatar
Deni Rinaldi committed
239 240 241
            this.setState({ file: event, fileType: String(fileType) })
        } else {
            ExcelRenderer(fileObj, (err, resp) => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
242
                // console.log(fileType)
Deni Rinaldi's avatar
Deni Rinaldi committed
243
                if (err) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
244
                    // console.log(err);
Deni Rinaldi's avatar
Deni Rinaldi committed
245 246 247 248 249 250
                }
                else {
                    this.setState({ file: event, fileType: String(fileType) })
                }
            })
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
251 252 253
    }

    validasi() {
Deni Rinaldi's avatar
Deni Rinaldi committed
254
        if (this.state.disabledPeriode === true) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
255
            if (R.isNil(this.state.getDocument)) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
256 257 258 259 260 261
                this.setState({ errorDocument: true, msgErrorDocument: 'Category Cannot be Empty' })
            } else if (R.isNil(this.state.file)) {
                this.setState({ alert: true, messageAlert: 'File Cannot be Empty', tipeAlert: 'warning' })
            } else {
                const formData = new FormData();
                formData.append("file", this.state.file);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
262
                formData.append("companyId", 1);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
263 264 265 266 267
                formData.append("settingId", this.state.getDocument.document_category_id);
                formData.append("description", this.state.description);
                formData.append("extension", this.state.fileType);
                formData.append("documentPeriode", null);
                formData.append("documentMonth", null);
Deni Rinaldi's avatar
Deni Rinaldi committed
268
                this.setState({ formData }, () => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
269
                    this.props.createDocument(this.state.formData, this.props.setting_id, this.props.name)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
270
                })
271
                var object = {};
Deni Rinaldi's avatar
Deni Rinaldi committed
272
                formData.forEach(function (value, key) {
273 274 275
                    object[key] = value;
                });
                var json = JSON.stringify(object);
276
                // console.log(object)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
277
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
278

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
279
        } else {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
280 281 282 283 284
            if (R.isNil(this.state.getPerusahaan)) {
                this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
            } else if (R.isNil(this.state.getDocument)) {
                this.setState({ errorDocument: true, msgErrorDocument: 'Category Cannot be Empty' })
            } else if (R.isNil(this.state.periode)) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
285
                this.setState({ errorPeriode: true, msgErrorPeriode: 'Period Cannot be Empty' })
Deni Rinaldi's avatar
Deni Rinaldi committed
286
            } else if (R.isNil(this.state.monthId)) {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
287
                this.setState({ errorMonth: true, msgErrorMonth: 'Month Cannot be Empty' })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
288 289 290
            }
            else if (R.isNil(this.state.file)) {
                this.setState({ alert: true, messageAlert: 'File Cannot be Empty', tipeAlert: 'warning' })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
291
            } else {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
292 293 294 295 296 297
                const formData = new FormData();
                formData.append("file", this.state.file);
                formData.append("companyId", this.state.getPerusahaan.company_id);
                formData.append("settingId", this.state.getDocument.document_category_id);
                formData.append("description", this.state.description);
                formData.append("extension", this.state.fileType);
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
298 299
                formData.append("documentPeriode", this.state.periode.periode);
                formData.append("documentMonth", this.state.monthId.month_id);
Deni Rinaldi's avatar
Deni Rinaldi committed
300
                this.setState({ formData }, () => {
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
301
                    this.props.createDocument(this.state.formData, this.props.setting_id, this.props.name)
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
302
                })
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
303
            }
Deni Rinaldi's avatar
Deni Rinaldi committed
304
        }
Deni Rinaldi's avatar
Deni Rinaldi committed
305 306
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
307 308
    deleteFile(e) {
        this.setState({ file: null })
Deni Rinaldi's avatar
Deni Rinaldi committed
309 310
    }

Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
311 312 313 314
    closeAlert() {
        this.setState({ alert: false })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
315
    render() {
316 317 318 319 320 321 322 323 324 325
        const loadingComponent = (
            <div style={{ position: 'absolute', zIndex: 110, top: 0, left: 0, width: '100%', height: '100%', display: 'flex', justifyContent: 'center', alignItems: 'center', background: 'rgba(255,255,255,0.8)' }}>
                <PropagateLoader
                    // css={override}
                    size={20}
                    color={"#274B80"}
                    loading={this.state.loading}
                />
            </div>
        );
Deni Rinaldi's avatar
Deni Rinaldi committed
326
        return (
327
            <div>
328
                <div className="test app-popup-show">
Deni Rinaldi's avatar
Deni Rinaldi committed
329 330 331 332 333 334
                    <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
                        <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
                            <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                                <div className="popup-title">
                                    <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Create</span>
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
335
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
336 337 338 339 340 341 342 343
                            <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
                                <button
                                    type="button"
                                    className="btn btn-circle btn-white"
                                    onClick={() => this.props.onClickClose()}
                                >
                                    <img src={Images.close} />
                                </button>
Deni Rinaldi's avatar
Deni Rinaldi committed
344 345
                            </div>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
346 347

                        <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20, paddingTop: 20 }}>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370
                            {this.state.disabledPeriode === false ?
                                <div className="column-1">
                                    <div style={{ padding: 10, borderRadius: 5 }}>
                                        <Autocomplete
                                            {...this.state.perusahaan}
                                            // debug
                                            clearOnEscape
                                            id="tipe"
                                            onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, () => this.clearMessage())}
                                            renderInput={(params) =>
                                                <TextField {...params}
                                                    error={this.state.errorPerusahaan}
                                                    helperText={this.state.msgErrorPerusahaan}
                                                    InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                    InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                                    label="Company Name" />}
                                            value={this.state.getPerusahaan}
                                        />
                                    </div>
                                </div>
                            : true}
                            {this.state.disabledPeriode === false ?
                            <div className="column-2">
Deni Rinaldi's avatar
Deni Rinaldi committed
371 372
                                <div style={{ padding: 10, borderRadius: 5 }}>
                                    <Autocomplete
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
373
                                        {...this.state.document}
Deni Rinaldi's avatar
Deni Rinaldi committed
374 375 376
                                        // debug
                                        clearOnEscape
                                        id="tipe"
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
377 378 379 380 381 382
                                        onChange={(event, newInputValue) => this.setState({ getDocument: newInputValue },
                                            () => newInputValue === null ? this.setState({ disabledPeriode: false })
                                                : newInputValue.document_category_name === 'Manual Book TIA 4.0' ?
                                                    this.setState({ disabledPeriode: true }, () => this.clearMessage())
                                                    : this.setState({ disabledPeriode: false }, () => this.clearMessage())
                                        )}
Deni Rinaldi's avatar
Deni Rinaldi committed
383 384
                                        renderInput={(params) =>
                                            <TextField {...params}
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
385 386
                                                error={this.state.errorDocument}
                                                helperText={this.state.msgErrorDocument}
Deni Rinaldi's avatar
Deni Rinaldi committed
387 388
                                                InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
389 390
                                                label="Category" />}
                                        value={this.state.getDocument}
Deni Rinaldi's avatar
Deni Rinaldi committed
391 392
                                    />
                                </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
393
                            </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
394 395
                            :
                            <div className="column-1">
Deni Rinaldi's avatar
Deni Rinaldi committed
396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417
                                <div style={{ padding: 10, borderRadius: 5 }}>
                                    <Autocomplete
                                        {...this.state.document}
                                        // debug
                                        clearOnEscape
                                        id="tipe"
                                        onChange={(event, newInputValue) => this.setState({ getDocument: newInputValue },
                                            () => newInputValue === null ? this.setState({ disabledPeriode: false })
                                                : newInputValue.document_category_name === 'Manual Book TIA 4.0' ?
                                                    this.setState({ disabledPeriode: true }, () => this.clearMessage())
                                                    : this.setState({ disabledPeriode: false }, () => this.clearMessage())
                                        )}
                                        renderInput={(params) =>
                                            <TextField {...params}
                                                error={this.state.errorDocument}
                                                helperText={this.state.msgErrorDocument}
                                                InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                                label="Category" />}
                                        value={this.state.getDocument}
                                    />
                                </div>
418
                            </div>
Rifka Kurnia Irfiana's avatar
Rifka Kurnia Irfiana committed
419
                            }
Deni Rinaldi's avatar
Deni Rinaldi committed
420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463
                            {this.state.disabledPeriode === false ?
                                <div className="column-1">
                                    <div style={{ padding: 10, borderRadius: 5 }}>
                                        <Autocomplete
                                            {...this.state.listMonth}
                                            // debug
                                            clearOnEscape
                                            id="month"
                                            onChange={(event, newInputValue) => this.setState({ monthId: newInputValue }, () => this.clearMessage())}
                                            style={{ width: 250 }}
                                            renderInput={(params) =>
                                                <TextField {...params} label="Period Month" margin="normal" style={{ marginTop: 7 }}
                                                    InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                    InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                                    error={this.state.errorMonth}
                                                    helperText={this.state.msgErrorMonth}
                                                />}
                                            value={this.state.monthId}
                                        />
                                    </div>
                                </div>
                                : true}
                            {this.state.disabledPeriode === false ?
                                <div className="column-2">
                                    <div style={{ padding: 10, borderRadius: 5 }}>
                                        <Autocomplete
                                            {...this.state.listPeriode}
                                            // debug
                                            clearOnEscape
                                            id="periode"
                                            onChange={(event, newInputValue) => this.setState({ periode: newInputValue }, () => this.clearMessage())}
                                            style={{ width: 250 }}
                                            renderInput={(params) =>
                                                <TextField {...params} label="Period Year" margin="normal" style={{ marginTop: 7 }}
                                                    InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                    InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                                    error={this.state.errorPeriode}
                                                    helperText={this.state.msgErrorPeriode}
                                                />}
                                            value={this.state.periode}
                                        />
                                    </div>
                                </div>
                                : true}
464
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
465 466 467 468 469
                        <div style={{ paddingLeft: 30, paddingRight: 30, paddingTop: 10 }}>
                            <UploadFile
                                type={this.state.uploadStatus}
                                percentage={this.state.percentage}
                                result={this.state.result}
470
                                acceptedFiles={["xls", "xlsx", "pdf", "PDF", "docx", "doc", "pptx", "ppt", "ods", "odf", "txt", "csv", "zip", "rar"]}
Deni Rinaldi's avatar
Deni Rinaldi committed
471 472 473 474 475 476 477 478 479 480 481
                                intent={"management"}
                                onHandle={(dt) => {
                                    this.fileHandler(dt)
                                    this.setState({ uploadStatus: 'idle', percentage: '0' })
                                }}
                                onDelete={(e) => {
                                    this.deleteFile(e)
                                }}
                                onUpload={() => alert('sukses')}
                                sizeUpload={Number(this.state.sizeUpload)}
                            />
Deni Rinaldi's avatar
Deni Rinaldi committed
482
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
483 484 485 486 487 488 489 490 491 492 493 494
                        <div className="margin-top-10px" style={{ paddingLeft: 30, paddingRight: 30, borderRadius: 5, paddingBottom: 20 }}>
                            <TextField
                                style={{ width: '100%' }}
                                id="description"
                                label="Description"
                                value={this.state.decription}
                                inputProps={{
                                    min: 0,
                                    style: {
                                        fontSize: 11
                                    }
                                }}
Deni Rinaldi's avatar
Deni Rinaldi committed
495

Deni Rinaldi's avatar
Deni Rinaldi committed
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510
                                InputLabelProps={{
                                    style: {
                                        fontSize: 11,
                                        color: '#7e8085'
                                    }
                                }}
                                name="Description"
                                onChange={(e) => {
                                    this.setState({
                                        description: e.target.value
                                    })
                                    this.clearMessage()
                                }}
                                error={this.state.errorDesc}
                                helperText={this.state.msgErrorDesc}
Deni Rinaldi's avatar
Deni Rinaldi committed
511
                            >
Deni Rinaldi's avatar
Deni Rinaldi committed
512
                            </TextField>
Deni Rinaldi's avatar
Deni Rinaldi committed
513
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
514 515 516 517 518 519 520 521 522 523 524 525 526 527
                        <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
                            <div className="column-1" style={{ alignSelf: 'center' }}>
                                <button
                                    type="button"
                                    onClick={() => this.props.onClickClose()}
                                >
                                    <div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                        <span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
                                    </div>
                                </button>
                            </div>
                            <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
                                <button
                                    type="button"
528
                                    onClick={() => 
529 530 531 532 533
                                        {this.props.handleLoading(1) 
                                            setTimeout(() => {
                                                this.validasi()
                                            }, 100)
                                        }
534
                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
535 536 537 538 539 540
                                >
                                    <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                        <span style={{ color: '#fff', fontSize: 11 }}>Save</span>
                                    </div>
                                </button>
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
541 542
                        </div>
                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
543 544 545 546 547
                    <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                        <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                            {this.state.messageAlert}
                        </Alert>
                    </Snackbar>
Deni Rinaldi's avatar
Deni Rinaldi committed
548
                </div>
549
            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
550 551 552
        )
    }
}