EditMasterDataCAT.js 31.9 KB
Newer Older
Riri Novita's avatar
Riri Novita committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
import React, { Component } from 'react';
import { TextField, Typography, withStyles, Snackbar } from '@material-ui/core';
import { DatePicker } from '@material-ui/pickers';
import format from "date-fns/format";
import Autocomplete from '@material-ui/lab/Autocomplete';
import MuiAlert from '@material-ui/lab/Alert';
import api from '../../../api';
import * as R from 'ramda'
import { titleCase } from '../../../library/Utils';
import Images from '../../../assets/Images';
import Constant from '../../../library/Constant';
const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);

export default class EditMasterDataCAT extends Component {
    constructor(props) {
        super(props)
        this.state = {
faisalhamdi's avatar
faisalhamdi committed
19
            loading: true,
Riri Novita's avatar
Riri Novita committed
20 21 22
            company: null,
            parent: null,
            reportType: null,
faisalhamdi's avatar
faisalhamdi committed
23
            weight: '',
Riri Novita's avatar
Riri Novita committed
24 25 26
            alert: false,
            tipeAlert: '',
            messageAlert: '',
faisalhamdi's avatar
faisalhamdi committed
27 28 29
            listPeriode: null,
            errorWeight: false,
            msgErrorWeight: '',
faisalhamdi's avatar
faisalhamdi committed
30 31 32 33
            getParent: [],
            periode: null,
            created_by: '',
            updated_by: ''
Riri Novita's avatar
Riri Novita committed
34 35 36 37
        }
    }

    componentDidMount() {
faisalhamdi's avatar
faisalhamdi committed
38 39 40 41 42 43 44 45 46 47
        this.getInputType()
        this.getReportType()
        let date = format(new Date, 'yyyy-MM-dd')
        this.setState({
            startDate: date,
            endDate: date
        })
        this.getPeriode()
        this.getDetailUser()
        this.getDetailMasterDataCat()
Riri Novita's avatar
Riri Novita committed
48 49
    }

faisalhamdi's avatar
faisalhamdi committed
50 51 52 53 54 55 56 57 58 59 60 61 62
    getDetailUser() {
        let userId = localStorage.getItem(Constant.USER)
        api.create().getDetailUser(userId).then((response) => {
            if (response.data) {
                if (response.ok) {
                    if (response.data.status === 'success') {
                        this.setState({ userCompany: response.data.data.company }, () => {
                            this.getCompanyActive()
                        })
                    }
                }
            }
        })
Riri Novita's avatar
Riri Novita committed
63 64
    }

faisalhamdi's avatar
faisalhamdi committed
65 66 67 68 69 70
    getCompanyActive() {
        api.create().getPerusahaanActive().then((response) => {
            // console.log(response);
            if (response.data) {
                if (response.data.status === 'success') {
                    let data = response.data.data
faisalhamdi's avatar
faisalhamdi committed
71
                    let comID = this.props.data[8]
faisalhamdi's avatar
faisalhamdi committed
72 73 74 75 76 77
                    let companyData = data.map((item) => {
                        return {
                            company_id: item.company_id,
                            company_name: item.company_name,
                        }
                    })
Riri Novita's avatar
Riri Novita committed
78

faisalhamdi's avatar
faisalhamdi committed
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
                    let arrayBaru = []
                    this.state.userCompany.map((item, index) => {
                        let indexID = companyData.findIndex((val) => val.company_id == item)
                        if (indexID !== -1) {
                            arrayBaru.push(companyData[indexID])
                        }
                    })

                    if (arrayBaru.length > 0) {
                        arrayBaru = arrayBaru.sort((a,b) => a.company_name.localeCompare(b.company_name))
                    }

                    let defaultProps = {
                        options: arrayBaru,
                        getOptionLabel: (option) => titleCase(option.company_name),
                    };
                    let index = arrayBaru.findIndex((val) => val.company_id == comID)
                    this.setState({ listCompany: defaultProps, company: arrayBaru.length < 1 ? companyData[0] : (index == -1 ? arrayBaru[0] : arrayBaru[index]) })
                } 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 {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', listCompany: null, company: null })
            }
        })
Riri Novita's avatar
Riri Novita committed
111 112
    }

faisalhamdi's avatar
faisalhamdi committed
113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142
    getPeriode() {
        api.create().getPeriodeTransaction().then(response => {
            let currentYear = new Date().getFullYear()
            console.log(currentYear)
            console.log(response)
            if (response.data) {
                if (response.data.status === "success") {
                    let data = []
                    response.data.data.map((item) => {
                        // if (this.state.isApprover) {
                        if (item >= 2000 && item <= (Number(currentYear) + 1)) {
                            data.push(item)
                        }
                        // } else {
                        //     if ((item >= 2000) && (item == this.state.lastPeriod || item < this.state.lastPeriod)) {
                        //         data.push(item)
                        //     }
                        // }
                    })
                    let periodeData = data.map((item) => {
                        return {
                            periode: item,
                        }
                    })
                    let defaultProps = {
                        options: periodeData,
                        getOptionLabel: (option) => option.periode,
                    };
                    // let periode = (this.state.lastPeriod == "" ? String(Number(currentYear) + 1) : this.state.lastPeriod)
                    let periode = String(Number(currentYear))
faisalhamdi's avatar
faisalhamdi committed
143 144
                    let index = data.sort((a, b) => a - b).findIndex((val) => val == this.props.data[6])
                    // console.log(this.props.data)
faisalhamdi's avatar
faisalhamdi committed
145 146 147 148 149 150 151
                    // console.log(this.state.latestPeriode)
                    // console.log(periodeData)
                    console.log(index)
                    this.setState({ listPeriode: defaultProps, periode: index === -1 ? periodeData[0] : periodeData[index], loading: false })
                }
            }
        })
Riri Novita's avatar
Riri Novita committed
152 153
    }

faisalhamdi's avatar
faisalhamdi committed
154 155 156 157 158 159 160 161
    getParentIR() {
        let payload = {
            "report_id": 3,
            "years": this.state.periode.periode
        }
        api.create().getParentItemReport(payload).then(response => {
            console.log(payload)
            console.log(response)
Riri Novita's avatar
Riri Novita committed
162
            if (response.data) {
faisalhamdi's avatar
faisalhamdi committed
163 164
                if (response.data.status === "success") {
                    this.setState({ getParent: response.data.data.filter((val) => String(val.type_item_report_name).toLocaleLowerCase() != 'break')})
Riri Novita's avatar
Riri Novita committed
165 166
                }
            } else {
faisalhamdi's avatar
faisalhamdi committed
167
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
Riri Novita's avatar
Riri Novita committed
168 169 170 171
            }
        })
    }

faisalhamdi's avatar
faisalhamdi committed
172 173 174 175 176 177 178 179
    handleChange(e, item) {
        let dataSource = this.state.getParent
        let indexID = dataSource.findIndex((val) => val.item_report_id == item.item_report_id)
        // console.log(indexID)
        if (indexID != -1) {
            dataSource[indexID].weight = e.target.value
            this.setState({getParent: dataSource}, () => {
                console.log(this.state.getParent);
rifkaki's avatar
rifkaki committed
180
                this.clearMessage()
faisalhamdi's avatar
faisalhamdi committed
181 182 183 184 185 186
            })
        }
    }

    handleReportName(item) {
        let indexString = String(item).indexOf('-')
faisalhamdi's avatar
faisalhamdi committed
187
        let gantiNama = indexString === -1 ? item : String(item).substr(0, indexString)
faisalhamdi's avatar
faisalhamdi committed
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224
        return gantiNama
    }

    validasi(getData) {
        console.log(getData)
        let jumlah = 0
        getData.map((item) => {
            jumlah += Number(item.weight)
        })
        console.log(jumlah)
        if ( jumlah > 100/100 ) {
            this.setState({ errorWeight: true, msgErrorWeight: 'Weight more than 100 %' })
        } else if (jumlah < 100/100) {
            this.setState({ errorWeight: true, msgErrorWeight: 'Weight less than 100 %' })
        }
        else {
            this.addReportItems(getData)
        }
    }

    addReportItems(getData) {
        // alert("test")
        let simpan = []
        getData.map((item) => {
            simpan.push({
                "report_id": item.report_id,
                "item_report_id": item.item_report_id,
                "weight": item.weight
            })
        })
        console.log(simpan)
        let payload = {
            "company_id": this.state.company.company_id,
            "years": this.state.periode.periode,
            "detail": simpan
        }
        console.log(payload)
faisalhamdi's avatar
faisalhamdi committed
225
        this.props.updateReportItems(payload)
faisalhamdi's avatar
faisalhamdi committed
226 227 228
    }

    
Riri Novita's avatar
Riri Novita committed
229 230
    getInputType() {
        api.create().getInputType().then((response) => {
faisalhamdi's avatar
faisalhamdi committed
231
            // console.log(response.data)
Riri Novita's avatar
Riri Novita committed
232 233 234 235 236 237 238 239 240 241 242 243 244 245
            if (response.data) {
                if (response.ok) {
                    if (response.data.status === 'success') {
                        let data = response.data.data
                        let inputData = data.map((item) => {
                            return {
                                type_item_report_id: item.type_item_report_id,
                                type_item_report_name: item.type_item_report_name
                            }
                        })
                        let defaultProps = {
                            options: inputData,
                            getOptionLabel: (option) => titleCase(option.type_item_report_name),
                        };
faisalhamdi's avatar
faisalhamdi committed
246
                        this.setState({ listInputType: defaultProps, inputData: response.data.data })
Riri Novita's avatar
Riri Novita committed
247 248 249 250 251 252 253 254 255
                    } 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);
                            }
                        })
faisalhamdi's avatar
faisalhamdi committed
256
                        // alert(response.data.message)
Riri Novita's avatar
Riri Novita committed
257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
            }
        })
    }

    getReportType() {
        api.create().getReportType().then((response) => {
            // console.log(response)
            if (response.data) {
                if (response.ok) {
                    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),
                        };
faisalhamdi's avatar
faisalhamdi committed
284
                        this.setState({ listReportType: defaultProps, reportTypeData: response.data.data })
Riri Novita's avatar
Riri Novita committed
285
                    } else {
faisalhamdi's avatar
faisalhamdi committed
286
                        // alert(response.data.message)
Riri Novita's avatar
Riri Novita committed
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304
                        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 {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
            }
        })
    }

faisalhamdi's avatar
faisalhamdi committed
305 306 307 308 309 310
    handleDate(item) {
        let value = format(item, 'dd MMMM yyyy')
        return value
    }

    getDetailMasterDataCat() {
faisalhamdi's avatar
faisalhamdi committed
311 312 313
        this.setState({ loading: true })
        api.create().getDetailMasterDataCat(this.props.data[8], this.props.data[6]).then((response) => {
            // console.log(response);
faisalhamdi's avatar
faisalhamdi committed
314
            if (response.data) {
faisalhamdi's avatar
faisalhamdi committed
315 316 317 318 319
                if (response.data.status === "success") {
                    this.setState({ getParent: response.data.data.filter((val) => String(val.type_item_report_name).toLocaleLowerCase() != 'break'), created_by: response.data.data[0].created, updated_by: response.data.data[0].created_at }, () => {
                        // console.log(this.state.getParent[0].created);
                        this.setState({ loading: false })
                    })
faisalhamdi's avatar
faisalhamdi committed
320
                } else {
faisalhamdi's avatar
faisalhamdi committed
321 322 323 324 325 326 327 328 329
                    // alert(response.data.message)
                    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);
                        }
                    })
faisalhamdi's avatar
faisalhamdi committed
330 331 332 333
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
            }
Riri Novita's avatar
Riri Novita committed
334 335 336
        })
    }

rifkaki's avatar
rifkaki committed
337 338 339 340 341 342 343
    clearMessage() {
        this.setState({
            errorFormula: false, msgErrorFormula: '',
            errorWeight: false, msgErrorWeight: ''
        })
    }

Riri Novita's avatar
Riri Novita committed
344 345 346 347 348 349 350 351
    closeAlert() {
        this.setState({ alert: false })
    }

    render() {

        return (
            <div className="test app-popup-show">
faisalhamdi's avatar
faisalhamdi committed
352 353 354 355 356
                <div className="popup-content background-white border-radius" style={{ borderRadius: 8, maxHeight: 600 }}>
                    <div>
                        <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">
faisalhamdi's avatar
faisalhamdi committed
357
                                    <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Edit Data</span>
faisalhamdi's avatar
faisalhamdi committed
358
                                </div>
Riri Novita's avatar
Riri Novita committed
359
                            </div>
faisalhamdi's avatar
faisalhamdi committed
360 361 362 363 364
                            <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
                                <button
                                    type="button"
                                    className="btn btn-circle btn-white"
                                    onClick={() => this.props.onClickClose()}
Riri Novita's avatar
Riri Novita committed
365
                                >
faisalhamdi's avatar
faisalhamdi committed
366 367
                                    <img src={Images.close} />
                                </button>
Riri Novita's avatar
Riri Novita committed
368 369 370
                            </div>
                        </div>
                    </div>
faisalhamdi's avatar
faisalhamdi committed
371 372 373 374 375 376 377 378 379 380 381 382 383
                    <div style={{ maxHeight: 500, overflow: 'scroll' }}>
                        <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                            <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                                {this.state.messageAlert}
                            </Alert>
                        </Snackbar>

                        <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 }} >                                    
                                    <Autocomplete
                                        {...this.state.listCompany}
                                        id="company"
faisalhamdi's avatar
faisalhamdi committed
384 385
                                        onChange={(event, newInputValue) => this.setState({ company_name: newInputValue }, () => this.getParent(), this.clearMessage())}
                                        debug
faisalhamdi's avatar
faisalhamdi committed
386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403
                                        style={{ width: 250 }}
                                        renderInput={(params) =>
                                            <TextField {...params}
                                                label="Company Name"
                                                InputLabelProps={{
                                                    style: {
                                                        fontSize: 11,
                                                        fontFamily: 'Nunito Sans, sans-serif',
                                                        color: '#7e8085'
                                                    }
                                                }}
                                                error={this.state.errorPerusahaan}
                                                helperText={this.state.msgErrorPerusahaan}
                                                InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
                                            />}
                                        value={this.state.company}
                                    />
                                </div>
Riri Novita's avatar
Riri Novita committed
404
                            </div>
faisalhamdi's avatar
faisalhamdi committed
405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430
                            <div className="column-2">
                                <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                    <Autocomplete
                                        {...this.state.listPeriode}
                                        id="year"
                                        onChange={(event, newInputValue) => this.setState({ periode: newInputValue, loading: true, previewTable: false }, () => {
                                            this.getParentIR()
                                        })}
                                        debug
                                        renderInput={(params) =>
                                            <TextField {...params}
                                                label="Year"
                                                InputLabelProps={{
                                                    style: {
                                                        fontSize: 11,
                                                        fontFamily: 'Nunito Sans, sans-serif',
                                                        color: '#7e8085'
                                                    }
                                                }}
                                                error={this.state.errorJenisLaporan}
                                                helperText={this.state.msgErrorJenisLaporan}
                                                InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
                                            />}
                                        value={this.state.periode}
                                    />
                                </div>
Riri Novita's avatar
Riri Novita committed
431 432 433
                            </div>
                        </div>

faisalhamdi's avatar
faisalhamdi committed
434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455
                        {this.state.getParent.map((item, index) => {
                            return (
                                <div>
                                    <div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} >
                                        <Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10, fontWeight: 'bold' }}>{`Item Report - ${index + 1}`}</Typography>
                                    </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={item.item_report_id}
                                                    id="ID"
                                                    label="ID"
                                                    disabled
                                                    inputProps={{
                                                        style: {
                                                            fontSize: 11,
                                                            fontFamily: 'Nunito Sans, sans-serif',
                                                        }
                                                    }}
Riri Novita's avatar
Riri Novita committed
456 457 458 459
                                                    InputLabelProps={{
                                                        style: {
                                                            fontSize: 11,
                                                            fontFamily: 'Nunito Sans, sans-serif',
faisalhamdi's avatar
faisalhamdi committed
460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479
                                                            color: '#7e8085',
                                                        }
                                                    }}
                                                />
                                            </div>
                                        </div>
                                        <div className="column-2">
                                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                                <TextField
                                                    style={{ width: '100%' }}
                                                    id="reportName1"
                                                    name="reportName1"
                                                    label="Report Name"
                                                    disabled
                                                    value={item.report_name}
                                                    inputProps={{
                                                        min: 0,
                                                        style: {
                                                            fontSize: 11,
                                                            fontFamily: 'Nunito Sans, sans-serif',
Riri Novita's avatar
Riri Novita committed
480 481 482 483 484 485
                                                        }
                                                    }}
                                                    InputLabelProps={{
                                                        style: {
                                                            fontSize: 11,
                                                            fontFamily: 'Nunito Sans, sans-serif',
faisalhamdi's avatar
faisalhamdi committed
486
                                                            color: '#7e8085',
Riri Novita's avatar
Riri Novita committed
487 488
                                                        }
                                                    }}
faisalhamdi's avatar
faisalhamdi committed
489 490 491 492
                                                >
                                                </TextField>
                                            </div>
                                        </div>
Riri Novita's avatar
Riri Novita committed
493 494
                                    </div>

faisalhamdi's avatar
faisalhamdi committed
495 496 497 498 499 500 501 502 503 504 505
                                    <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="itemReportName1"
                                                    name="itemReportName1"
                                                    label="Item Report Name"
                                                    disabled
                                                    // onChange={(e) => this.handleChange(e, null)}
                                                    // value={this.state.order}
faisalhamdi's avatar
faisalhamdi committed
506
                                                    value={this.handleReportName(item.item_report_name)}
faisalhamdi's avatar
faisalhamdi committed
507 508 509 510 511 512 513 514 515
                                                    // error={this.state.errorOrder}
                                                    // helperText={this.state.msgErrorOrder}
                                                    inputProps={{
                                                        min: 0,
                                                        style: {
                                                            fontSize: 11,
                                                            fontFamily: 'Nunito Sans, sans-serif',
                                                        }
                                                    }}
Riri Novita's avatar
Riri Novita committed
516 517 518 519
                                                    InputLabelProps={{
                                                        style: {
                                                            fontSize: 11,
                                                            fontFamily: 'Nunito Sans, sans-serif',
faisalhamdi's avatar
faisalhamdi committed
520
                                                            color: '#7e8085',
Riri Novita's avatar
Riri Novita committed
521 522
                                                        }
                                                    }}
faisalhamdi's avatar
faisalhamdi committed
523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554
                                                >
                                                </TextField>
                                            </div>
                                        </div>
                                        <div className="column-2">
                                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                                <TextField
                                                    style={{ width: '100%' }}
                                                    id="weight1"
                                                    name="weight1"
                                                    label="Weight"
                                                    value={item.weight}
                                                    error={this.state.errorWeight}
                                                    helperText={this.state.msgErrorWeight}
                                                    onChange={(e) => this.handleChange(e, item)}
                                                    inputProps={{
                                                        style: {
                                                            fontSize: 11,
                                                            fontFamily: 'Nunito Sans, sans-serif',
                                                        }
                                                    }}
                                                    InputLabelProps={{
                                                        style: {
                                                            fontSize: 11,
                                                            fontFamily: 'Nunito Sans, sans-serif',
                                                            color: '#7e8085',
                                                        }
                                                    }}
                                                >
                                                </TextField>
                                            </div>
                                        </div>
Riri Novita's avatar
Riri Novita committed
555 556
                                    </div>
                                </div>
faisalhamdi's avatar
faisalhamdi committed
557 558
                            )
                        })}
Riri Novita's avatar
Riri Novita committed
559

faisalhamdi's avatar
faisalhamdi committed
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583
                        <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%' }}
                                        defaultValue={"active"}
                                        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>
Riri Novita's avatar
Riri Novita committed
584 585 586
                            </div>
                        </div>

faisalhamdi's avatar
faisalhamdi committed
587 588 589
                        <div className="margin-top-10px" style={{ paddingTop: 10, paddingBottom: 30, paddingRight: 30, paddingLeft: 30 }}>
                            <div style={{ display: 'flex' }}>
                                <Typography style={{ fontSize: 11, width: '13%' }}>Created By :</Typography>
faisalhamdi's avatar
faisalhamdi committed
590
                                {!this.state.loading && <Typography style={{ fontSize: 11 }}>:  {this.state.created_by}</Typography>}
Riri Novita's avatar
Riri Novita committed
591
                            </div>
faisalhamdi's avatar
faisalhamdi committed
592 593
                            <div style={{ display: 'flex' }}>
                                <Typography style={{ fontSize: 11, width: '13%' }}>Updated By :</Typography>
faisalhamdi's avatar
faisalhamdi committed
594
                                {!this.state.loading && <Typography style={{ fontSize: 11 }}>:  {this.state.updated_by}</Typography>}
Riri Novita's avatar
Riri Novita committed
595 596 597
                            </div>
                        </div>
                    </div>
faisalhamdi's avatar
faisalhamdi committed
598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619
                    <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 }}>Cancel</span>
                                    </div>
                                </button>
                            </div>
                            <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
                                <button
                                    type="button"
                                    onClick={() => this.validasi(this.state.getParent)}
                                >
                                    <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>
Riri Novita's avatar
Riri Novita committed
620 621 622 623 624 625 626
                        </div>
                    </div>
                </div>
            </div>
        )
    }
}