EditMasterDataCAT.js 32.2 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
                    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' }, () => {
d.arizona's avatar
d.arizona committed
99
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
faisalhamdi's avatar
faisalhamdi committed
100 101 102 103 104 105 106 107 108 109 110
                            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
                    // console.log(this.state.latestPeriode)
                    // console.log(periodeData)
faisalhamdi's avatar
faisalhamdi committed
147
                    // console.log(index)
faisalhamdi's avatar
faisalhamdi committed
148 149 150 151
                    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
        return gantiNama
    }

    validasi(getData) {
        console.log(getData)
        let jumlah = 0
        getData.map((item) => {
            jumlah += Number(item.weight)
        })
        console.log(jumlah)
        if ( jumlah > 100/100 ) {
syadziy's avatar
syadziy committed
199
            this.setState({ errorWeight: true, msgErrorWeight: 'Weight more than 100%' })
faisalhamdi's avatar
faisalhamdi committed
200
        } else if (jumlah < 100/100) {
syadziy's avatar
syadziy committed
201
            this.setState({ errorWeight: true, msgErrorWeight: 'Weight less than 100%' })
faisalhamdi's avatar
faisalhamdi committed
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
        }
        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,
faisalhamdi's avatar
faisalhamdi committed
221
            "company_old": this.props.data[8],
faisalhamdi's avatar
faisalhamdi committed
222 223 224 225
            "years": this.state.periode.periode,
            "detail": simpan
        }
        console.log(payload)
faisalhamdi's avatar
faisalhamdi committed
226
        this.props.updateReportItems(payload)
faisalhamdi's avatar
faisalhamdi committed
227 228 229
    }

    
Riri Novita's avatar
Riri Novita committed
230 231
    getInputType() {
        api.create().getInputType().then((response) => {
faisalhamdi's avatar
faisalhamdi committed
232
            // console.log(response.data)
Riri Novita's avatar
Riri Novita committed
233 234 235 236 237 238 239 240 241 242 243 244 245 246
            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
247
                        this.setState({ listInputType: defaultProps, inputData: response.data.data })
Riri Novita's avatar
Riri Novita committed
248 249
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
250
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
251 252 253 254 255 256
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
faisalhamdi's avatar
faisalhamdi committed
257
                        // alert(response.data.message)
Riri Novita's avatar
Riri Novita committed
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 284
                    }
                } 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
285
                        this.setState({ listReportType: defaultProps, reportTypeData: response.data.data })
Riri Novita's avatar
Riri Novita committed
286
                    } else {
faisalhamdi's avatar
faisalhamdi committed
287
                        // alert(response.data.message)
Riri Novita's avatar
Riri Novita committed
288
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
289
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
Riri Novita's avatar
Riri Novita committed
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305
                                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
306 307 308 309 310 311
    handleDate(item) {
        let value = format(item, 'dd MMMM yyyy')
        return value
    }

    getDetailMasterDataCat() {
faisalhamdi's avatar
faisalhamdi committed
312 313 314
        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
315
            if (response.data) {
faisalhamdi's avatar
faisalhamdi committed
316
                if (response.data.status === "success") {
syadziy's avatar
syadziy committed
317
                    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].updated }, () => {
faisalhamdi's avatar
faisalhamdi committed
318 319 320
                        // console.log(this.state.getParent[0].created);
                        this.setState({ loading: false })
                    })
faisalhamdi's avatar
faisalhamdi committed
321
                } else {
faisalhamdi's avatar
faisalhamdi committed
322 323
                    // alert(response.data.message)
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
324
                        if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
faisalhamdi's avatar
faisalhamdi committed
325 326 327 328 329 330
                            setTimeout(() => {
                                localStorage.removeItem(Constant.TOKEN)
                                window.location.reload();
                            }, 1000);
                        }
                    })
faisalhamdi's avatar
faisalhamdi committed
331 332 333 334
                }
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
            }
Riri Novita's avatar
Riri Novita committed
335 336 337
        })
    }

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

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

    render() {

        return (
            <div className="test app-popup-show">
faisalhamdi's avatar
faisalhamdi committed
353 354 355 356 357
                <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
358
                                    <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Edit Data</span>
faisalhamdi's avatar
faisalhamdi committed
359
                                </div>
Riri Novita's avatar
Riri Novita committed
360
                            </div>
faisalhamdi's avatar
faisalhamdi committed
361 362 363 364 365
                            <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
366
                                >
faisalhamdi's avatar
faisalhamdi committed
367 368
                                    <img src={Images.close} />
                                </button>
Riri Novita's avatar
Riri Novita committed
369 370 371
                            </div>
                        </div>
                    </div>
faisalhamdi's avatar
faisalhamdi committed
372 373 374 375 376 377 378 379 380 381 382 383 384
                    <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
385 386
                                        onChange={(event, newInputValue) => this.setState({ company: newInputValue }, () => this.getParentIR(), this.clearMessage())}
                                        disableClearable
faisalhamdi's avatar
faisalhamdi committed
387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
                                        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
405
                            </div>
faisalhamdi's avatar
faisalhamdi committed
406 407 408 409 410 411 412 413
                            <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()
                                        })}
faisalhamdi's avatar
faisalhamdi committed
414
                                        disableClearable
faisalhamdi's avatar
faisalhamdi committed
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431
                                        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
432 433 434
                            </div>
                        </div>

faisalhamdi's avatar
faisalhamdi committed
435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456
                        {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
457 458 459 460
                                                    InputLabelProps={{
                                                        style: {
                                                            fontSize: 11,
                                                            fontFamily: 'Nunito Sans, sans-serif',
faisalhamdi's avatar
faisalhamdi committed
461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480
                                                            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
481 482 483 484 485 486
                                                        }
                                                    }}
                                                    InputLabelProps={{
                                                        style: {
                                                            fontSize: 11,
                                                            fontFamily: 'Nunito Sans, sans-serif',
faisalhamdi's avatar
faisalhamdi committed
487
                                                            color: '#7e8085',
Riri Novita's avatar
Riri Novita committed
488 489
                                                        }
                                                    }}
faisalhamdi's avatar
faisalhamdi committed
490 491 492 493
                                                >
                                                </TextField>
                                            </div>
                                        </div>
Riri Novita's avatar
Riri Novita committed
494 495
                                    </div>

faisalhamdi's avatar
faisalhamdi committed
496 497 498 499 500 501 502 503 504 505 506
                                    <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
507
                                                    value={this.handleReportName(item.item_report_name)}
faisalhamdi's avatar
faisalhamdi committed
508 509 510 511 512 513 514 515 516
                                                    // 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
517 518 519 520
                                                    InputLabelProps={{
                                                        style: {
                                                            fontSize: 11,
                                                            fontFamily: 'Nunito Sans, sans-serif',
faisalhamdi's avatar
faisalhamdi committed
521
                                                            color: '#7e8085',
Riri Novita's avatar
Riri Novita committed
522 523
                                                        }
                                                    }}
faisalhamdi's avatar
faisalhamdi committed
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 555
                                                >
                                                </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
556 557
                                    </div>
                                </div>
faisalhamdi's avatar
faisalhamdi committed
558 559
                            )
                        })}
Riri Novita's avatar
Riri Novita committed
560

faisalhamdi's avatar
faisalhamdi committed
561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584
                        <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
585 586 587
                            </div>
                        </div>

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