import React, { Component } from 'react';
import { TextField, Typography } from '@material-ui/core';
import { DatePicker } from '@material-ui/pickers';
import format from "date-fns/format";
import Autocomplete from '@material-ui/lab/Autocomplete';
import api from '../../../api';
import * as R from 'ramda'
import { titleCase } from '../../../library/Utils';
import Images from '../../../assets/Images';

export default class EditReportItems extends Component {
    constructor(props) {
        super(props)
        this.state = {
            
            tempData: null,
            InputType: null,
            company: null,
            parent: null,
            reportType: null,
            startDate: null,
            endDate: null,
            order: null,
            description: '',
            uom: '',
            weight: null,
            formula: '',
            realVal: '',
            condition: null,
            date: new Date(),
            listInputType: null,
            listCompany: null,
            listReportType: null,
            listParent: null,
            errorOrder: false,
            errorDesc: false,
            errorFormula: false,
            errorRV: false,
            errorStartDate: false,
            errorEndDate: false,
            msgErrorOrder: '',
            msgErrorDesc: '',
            msgErrorFormula: '',
            msgErrorRV: '',
            msgErrorSD: '',
            msgErrorED: '',
            disabledFormula: true,
            disabledCondt: true,
            disabledValue: true,
            options: ['WARNING', 'STOPPER']

        }
    }

    componentDidMount() {
        this.getDetailReportItems();
        
    }

    handleChange(e, type) {
        let data = this.state
        let isDate = type !== '' ? true : false
        if (isDate && type === 'start_date') {
            this.setState({
                ...data, tempData: { ...this.state.tempData, start_date: format(e, 'yyyy-MM-dd'), end_date: null },
                errorOrder: false,
                errorDesc: false,
                errorFormula: false,
                errorRV: false,
                errorStartDate: false,
                errorEndDate: false,
                msgErrorOrder: '',
                msgErrorDesc: '',
                msgErrorFormula: '',
                msgErrorRV: '',
                msgErrorSD: '',
                msgErrorED: '',
            })
        } else if (isDate && type === 'end_date') {
            this.setState({
                ...data, tempData: { ...this.state.tempData, end_date: format(e, 'yyyy-MM-dd') },
                errorOrder: false,
                errorDesc: false,
                errorFormula: false,
                errorRV: false,
                errorStartDate: false,
                errorEndDate: false,
                msgErrorOrder: '',
                msgErrorDesc: '',
                msgErrorFormula: '',
                msgErrorRV: '',
                msgErrorSD: '',
                msgErrorED: '',
            })
        } else {
            this.setState({
                ...data, tempData: { ...this.state.tempData, [e.target.name]: e.target.value },
                errorOrder: false,
                errorDesc: false,
                errorFormula: false,
                errorRV: false,
                errorStartDate: false,
                errorEndDate: false,
                msgErrorOrder: '',
                msgErrorDesc: '',
                msgErrorFormula: '',
                msgErrorRV: '',
                msgErrorSD: '',
                msgErrorED: '',
            })
        }
    }

    validasi() {
        // alert('coba ya')
        if (R.isNil(this.state.reportType)) return alert("Jenis Laporan is Required.");
        if (R.isNil(this.state.company)) return alert("Perusahaan is Required.");
        else if (R.isEmpty(this.state.tempData.order)) {
            this.setState({errorOrder: true, msgErrorOrder: 'Order Harus Diisi'})
        } else if (R.isEmpty(this.state.tempData.description)) {
            this.setState({errorDesc: true, msgErrorDesc: 'Deskripsi Harus Diisi'})
        } else  if (R.isNil(this.state.InputType)) return alert("Tipe Data harus dipilih.")
        else if (this.state.InputType.type_report_name === 'Formula' || this.state.InputType.type_report_name === 'Validation' && R.isEmpty(this.state.tempData.formula)) {
            this.setState({errorFormula: true, msgErrorFormula: 'Formula Harus Diisi'})
        }
        else if (this.state.InputType.type_report_name === 'Validation' && R.isEmpty(this.state.tempData.condition_it_should_be)) {
            this.setState({errorRV: true, msgErrorRV: 'Nilai Seharusnya Harus Diisi'})
        }
        else if (this.state.InputType.type_report_name === 'Validation' && R.isNil(this.state.condition)) return alert("Kondisi Jika Salah is Required.");
        else if (R.isNil(this.state.tempData.start_date)) {
            this.setState({ errorStartDate: true, msgErrorSD: 'Start Date Harus Diisi' })
        } else if (R.isNil(this.state.tempData.end_date)) {
            this.setState({ errorEndDate: true, msgErrorED: 'End Date Harus Diisi' })
        } else {
            this.updateReportItems()
        }

    }

    updateReportItems() {
        // alert('test')
        let payload = {
            "item_report_id": this.state.tempData.item_report_id,
            "report_id": this.state.reportType == null? this.state.tempData.report_id : this.state.reportType.report_id,
            "company_id": this.state.company == null? this.state.tempData.company_id : this.state.company.company_id,
            "description": this.state.tempData.description,
            "orders": this.state.tempData.order,
            "parent": this.state.parent == null? this.state.tempData.parent : this.state.parent.item_report_id,
            "type_report_id": this.state.InputType == null? this.state.tempData.type_report_id : this.state.InputType.type_report_id,
            "formula": this.state.tempData.formula,
            "uom": this.state.tempData.uom,
            "weight": this.state.tempData.weight,
            "condition_if_wrong": this.state.tempData.condition_if_wrong,
            "condition_it_should_be": this.state.tempData.condition_it_should_be,
            "start_date": this.state.tempData.start_date,
            "end_date": this.state.tempData.end_date
        }
        console.log(payload)
        // api.create().updateReportItems(payload).then((response) => {
        //     if (response.data) {
        //         if (response.data.status === 'success') {
        //             this.props.onClickClose()
        //             this.props.refresh()
        //         } else {
        //             alert(response.data.message)
        //         }
        //     }
        // })
    }

    getDetailReportItems() {
        api.create().getDetailReportItems(this.props.data[1]).then((response) => {
            if (response.data.status === 'success') {
                this.setState({ tempData: response.data.data}, () => this.getInputType(), this.getPerusahaan(), this.getReportType(),)
                console.log(response.data.data)
            } else {
                alert(response.data.message)
            }
        })
    }

    getInputType() {
        api.create().getInputType().then((response) => {
            // console.log(response)
            if(response.data.status === 'success') {
                let data = response.data.data
                let inputData = data.map((item) => {
                    return {
                        type_report_id: item.type_report_id,
                        type_report_name: item.type_report_name
                    }
                })
                let defaultProps = {
                    options: inputData,
                    getOptionLabel: (option) => titleCase(option.type_report_name),
                  };
                
                  let index = inputData.findIndex((val) => val.type_report_id === this.state.tempData.type_report_id)
                this.setState({listInputType: defaultProps, InputType: index === -1 ? null : inputData[index]})
            } else {
                alert(response.data.message)
            }
        })
    }

    getPerusahaan() {
        api.create().getPerusahaanActive().then((response) => {
            console.log(response)
            if(response.data.status === 'success') {
                let data = response.data.data
                let companyData = data.map((item) => {
                    return {
                        company_id: item.company_id,
                        company_name: item.company_name
                    }
                })
                let defaultProps = {
                    options: companyData,
                    getOptionLabel: (option) => titleCase(option.company_name),
                  };
                
                let index = companyData.findIndex((val) => val.company_id === this.state.tempData.company_id)
                this.setState({listCompany: defaultProps, company: index === -1 ? null : companyData[index]}, () => this.getParent())
            } else {
                alert(response.data.message)
            }
        })
    }

    getReportType() {
        api.create().getReportType().then((response) => {
            console.log(response)
            if(response.data.status === 'success') {
                let data = response.data.data
                let reportTypeData = data.map((item) => {
                    return {
                        report_id: item.report_id,
                        report_name: item.report_name,
                    }
                })
                let defaultProps = {
                    options: reportTypeData,
                    getOptionLabel: (option) => titleCase(option.report_name),
                  };

                let index = reportTypeData.findIndex((val) => val.report_id === this.state.tempData.report_id)
                this.setState({listReportType: defaultProps, reportType: index === -1 ? null: reportTypeData[index]}, () => this.getParent())
            } else {
                alert(response.data.message)
            }
        })
    }

    getParent() {
        if (this.state.reportType !== null && this.state.company !== null) {
            let payload = {
                "report_id": this.state.reportType.report_id,
                "company_id": this.state.company.company_id
            }
            api.create().getReportParent(payload).then((response) => {
                console.log(response)
                if(response.data.status === 'success') {
                    let data = response.data.data
                    let parentData = data.map((item) => {
                        return {
                            item_report_id: item.item_report_id,
                            description: item.description
                        }
                    })
                    let defaultProps = {
                        options: parentData,
                        getOptionLabel: (option) => titleCase(option.description),
                      };
                    let index = parentData.findIndex((val) => val.item_report_id === this.state.tempData.parent)
                    this.setState({listParent: defaultProps, parent: index == -1? null : parentData[index]})
                } else {
                    alert(response.data.message)
                }
            })
        }
    }
    
    render() {

        return (
            <div className="test app-popup-show">
                <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' }}>Edit Data</span>
                            </div>
                        </div>
                        <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>
                        </div>
                    </div>

                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1">
                            <div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    value={this.state.tempData === null ? '' : this.state.tempData.item_report_id}
                                    id="ID"
                                    label="ID"
                                    disabled
                                    variant="filled"
                                    onChange={(e) => null}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif'
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085'
                                        }
                                    }}
                                />
                            </div>
                        </div>
                        <div className="column-2">
                            <div className="margin-top-10px" style={{padding: 10}}>
                                <Autocomplete
                                    {...this.state.listReportType}
                                    id="reportType"
                                    onChange={(event, newInputValue) => this.setState({reportType: newInputValue}, () => this.getParent())}
                                    debug
                                    renderInput={(params) => 
                                        <TextField {...params} 
                                            label="Jenis Laporan" 
                                            InputLabelProps={{
                                                style: {
                                                    fontSize: 11,
                                                    fontFamily: 'Nunito Sans, sans-serif',
                                                    color: '#7e8085'
                                                }
                                            }}
                                            InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
                                        />}
                                    value={this.state.reportType}
                                />
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1">
                            <div className="margin-top-10px" style={{padding: 10}} >
                                <Autocomplete
                                    {...this.state.listCompany}
                                    id="company"
                                    onChange={(event, newInputValue) => this.setState({company: newInputValue}, () => this.getParent())}
                                    debug
                                    renderInput={(params) => 
                                        <TextField {...params} 
                                            label="Perusahaan" 
                                            InputLabelProps={{
                                                style: {
                                                    fontSize: 11,
                                                    fontFamily: 'Nunito Sans, sans-serif',
                                                    color: '#7e8085'
                                                }
                                            }}
                                            InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
                                        />}
                                    value={this.state.company}
                                />
                            </div>
                        </div>
                        <div className="column-2">
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    id="order"
                                    label="Order"
                                    name="order"
                                    value={this.state.tempData === null ? '' : this.state.tempData.order}
                                    error={this.state.errorOrder}
                                    helperText={this.state.msgErrorOrder}
                                    onChange={(e) => this.handleChange(e, '')}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif'
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085'
                                        }
                                    }}
                                >
                                </TextField>
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1">
                            <div className="margin-top-10px"  style={{ padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    id="description"
                                    label="Deskripsi"
                                    name="description"
                                    error={this.state.errorDesc}
                                    helperText={this.state.msgErrorDesc}
                                    onChange={(e) => this.handleChange(e, '')}
                                    value={this.state.tempData === null ? '' : this.state.tempData.description}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif'
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085'
                                        }
                                    }}
                                >
                                </TextField>
                            </div>
                        </div>
                        <div className="column-2">
                            <div className="margin-top-10px"  style={{padding: 10}} >
                                <Autocomplete
                                    {...this.state.listParent}
                                    id="parentId"
                                    onChange={(event, newInputValue) => this.setState({parent: newInputValue})}
                                    disabled={this.state.reportType == null || this.state.company == null}
                                    debug
                                    renderInput={(params) => 
                                        <TextField {...params} 
                                            label="Parent ID" 
                                            InputLabelProps={{
                                                style: {
                                                    fontSize: 11,
                                                    fontFamily: 'Nunito Sans, sans-serif',
                                                    color: '#7e8085'
                                                }
                                            }}
                                            InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
                                        />}
                                    value={this.state.parent}
                                />
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1">
                            <div className="margin-top-10px"  style={{ padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    id="uom"
                                    label="UOM"
                                    name="uom"
                                    onChange={(e) => this.handleChange(e, '')}
                                    value={this.state.tempData === null ? '' : this.state.tempData.uom}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif'
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085'
                                        }
                                    }}
                                >
                                </TextField>
                            </div>
                        </div>
                        <div className="column-2">
                            <div className="margin-top-10px"  style={{ padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    id="weight"
                                    label="Weight"
                                    name="weight"
                                    onChange={(e) => this.handleChange(e, '')}
                                    value={this.state.tempData === null ? '' : this.state.tempData.weight}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif'
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085'
                                        }
                                    }}
                                >
                                </TextField>
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1">
                            <div className="margin-top-10px" style={{padding: 10}}>
                                <Autocomplete
                                    {...this.state.listInputType}
                                    id="inputType"
                                    onChange={(event, newInputValue) => 
                                        this.setState({InputType: newInputValue, 
                                            tempData: {...this.state.tempData, formula: '', condition_it_should_be: '', condition_if_wrong: ''}, 
                                            errorFormula: false, msgErrorFormula: '',
                                            errorRV: false, msgErrorRV: ''},
                                            () => console.log(this.state.InputType))}
                                    debug
                                    renderInput={(params) => 
                                        <TextField {...params} 
                                            label="Tipe Data" 
                                            InputLabelProps={{
                                                style: {
                                                    fontSize: 11,
                                                    fontFamily: 'Nunito Sans, sans-serif',
                                                    color: '#7e8085'
                                                }
                                            }}
                                            InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
                                        />}
                                    value={this.state.InputType}
                                />
                            </div>
                        </div>
                        <div className="column-2">
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    id="formula"
                                    label="Formula"
                                    disabled={this.state.InputType == null? true : (this.state.InputType.type_report_name === 'Formula' || this.state.InputType.type_report_name === 'Validation'? false : true)}
                                    name="formula"
                                    error={this.state.errorFormula}
                                    helperText={this.state.msgErrorFormula}
                                    onChange={(e) => this.handleChange(e, '')}
                                    value={this.state.tempData === null ? '' : this.state.tempData.formula}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif'
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085'
                                        }
                                    }}
                                >
                                </TextField>
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1">
                            <div className="margin-top-10px" style={{ padding: 10 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    id="condition_it_should_be"
                                    label="Nilai Seharusnya"
                                    error={this.state.errorRV}
                                    helperText={this.state.msgErrorRV}
                                    disabled={this.state.InputType == null? true : (this.state.InputType.type_report_name === 'Validation'? false : true)}
                                        name="condition_it_should_be"
                                        onChange={(e) => this.handleChange(e, '')}
                                    value={this.state.tempData === null ? '' : this.state.tempData.condition_it_should_be}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif'
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085'
                                        }
                                    }}
                                />
                            </div>
                        </div>
                        <div className="column-2">
                            <div className="margin-top-10px" style={{padding: 10}}>
                                <Autocomplete
                                    value={this.state.tempData === null ? '' : this.state.tempData.condition}
                                    id="isWrongCondition"
                                    disabled={this.state.InputType == null? true : (this.state.InputType.type_report_name === 'Validation'? false : true)}
                                    onChange={(event, newValue) => {
                                        this.setState({condition: newValue});
                                    }}
                                    options={this.state.options}
                                    renderInput={(params) => 
                                        <TextField {...params} 
                                            label="Kondisi Jika Salah" 
                                            InputLabelProps={{
                                                style: {
                                                    fontSize: 11,
                                                    fontFamily: 'Nunito Sans, sans-serif',
                                                    color: '#7e8085'
                                                }
                                            }}
                                            InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
                                        />}
                                />
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1">
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                <DatePicker
                                    margin="normal"
                                    id="startDate"
                                    label="Berlaku Mulai"
                                    format="dd MMMM yyyy"
                                    value={this.state.tempData === null ? null : this.state.tempData.start_date}
                                    error={this.state.errorStartDate}
                                    helperText={this.state.msgErrorSD}
                                    onChange={(e) => this.handleChange(e, 'start_date')}
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}
                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
                            </div>
                        </div>
                        <div className="column-2">
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                <DatePicker
                                    margin="normal"
                                    id="endDate"
                                    label="Berlaku Hingga"
                                    format="dd MMMM yyyy"
                                    value={this.state.tempData === null ? null : this.state.tempData.end_date}
                                    error={this.state.errorEndDate}
                                    helperText={this.state.msgErrorED}
                                    minDate={this.state.tempData === null ? null : this.state.tempData.start_date}
                                    onChange={(e) => this.handleChange(e, 'end_date')}
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}

                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1">
                            <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    value={this.state.tempData === null ? '' : this.state.tempData.status}
                                    id="status"
                                    label="Status"
                                    disabled
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif'
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085'
                                        }
                                    }}
                                />
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1">
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                <div style={{display: 'flex'}}>
                                    <Typography style={{ fontSize: 11, width: '20%' }}>Dibuat</Typography>
                                    <Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
                                </div>
                                <div style={{display: 'flex'}}>
                                    <Typography style={{ fontSize: 11, width: '20%' }}>Diubah</Typography>
                                    <Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
                                </div>
                            </div>
                        </div>
                    </div>

                    <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 }}>Batal</span>
                                </div>
                            </button>
                        </div>
                        <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
                            <button onClick={() => this.validasi()}>
                                <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                    <span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
                                </div>
                            </button>
                        </div>
                    </div>
                </div>
            </div>
        )
    }
}
