CreateParameter.js 127 KB
Newer Older
faisalhamdi's avatar
faisalhamdi committed
1 2
import React, { Component } from 'react';
import { TextField, Typography } from '@material-ui/core';
3 4 5 6 7
import Autocomplete from '@material-ui/lab/Autocomplete';
import api from '../../../api';
import { DatePicker } from '@material-ui/pickers';
import { format } from 'date-fns';
import * as R from 'ramda'
d.arizona's avatar
d.arizona committed
8
import Images from '../../../assets/Images';
a.bairuha's avatar
a.bairuha committed
9
import Constant from '../../../library/Constant';
10
import PopUpInformation from '../../../library/PopUpInformation';
faisalhamdi's avatar
faisalhamdi committed
11 12

export default class CreateParameter extends Component {
13 14 15 16
    constructor(props) {
        super(props)
        this.state = {
            enableParameter: false,
Riri Novita's avatar
Riri Novita committed
17
            enableReportName: false,
Riri Novita's avatar
Riri Novita committed
18
            enableFormat: false,
19
            enableThreshold: false,
20 21
            id: '',
            description: '',
22
            value: '',
23
            order: null,
24 25
            minValue: '',
            maxValue: '',
26
            startDate: '',
Deni Rinaldi's avatar
Deni Rinaldi committed
27
            endDate: null,
28 29 30 31 32 33
            date: new Date(),
            approvedBy: null,
            getApprovedBy: null,
            types: null,
            getTypes: null,
            perusahaan: null,
Riri Novita's avatar
Riri Novita committed
34
            reportName: null,
Riri Novita's avatar
Riri Novita committed
35
            formatCurrency: null,
36
            thresholdCurrency: null,
Riri Novita's avatar
Riri Novita committed
37
            getReportName: null,
Riri Novita's avatar
Riri Novita committed
38
            getFormatData: null,
39
            getThresholdCurrency: null,
40 41 42 43 44 45
            getPerusahaan: null,
            parameter: null,
            getParameter: null,
            operators: null,
            getOperators: null,
            tempData: null,
Riri Novita's avatar
Riri Novita committed
46
            tesValue: null,
47 48
            errorParameter: false,
            errorDeskripsi: false,
49
            errorReportName: false,
Riri Novita's avatar
Riri Novita committed
50
            errorFormatValue: false,
51
            errorThresholdCurrency: false,
52 53 54 55 56 57
            errorValue: false,
            errorMinValue: false,
            errorOrder: false,
            errorMaxValue: false,
            errorStartDate: false,
            errorEndDate: false,
Deni Rinaldi's avatar
Deni Rinaldi committed
58 59 60 61
            errorGroup: false,
            errorPerusahaan: false,
            msgErrorPerusahaan: '',
            msgErrorGroup: '',
62 63
            msgErrorParameter: '',
            msgErrorDeskripsi: '',
64
            msgErrorReportName: '',
Riri Novita's avatar
Riri Novita committed
65
            msgErrorFormatValue: '',
66
            msgErrorThresholdCurrency: '',
67 68 69 70 71
            msgErrorValue: '',
            msgErrorMinValue: '',
            msgErrorOrder: '',
            msgErrorMaxValue: '',
            msgErrorStartDate: '',
fahrur huzain's avatar
fahrur huzain committed
72
            msgErrorEndDate: '',
Riri Novita's avatar
Riri Novita committed
73 74 75 76 77
            regexValue: "",
            valueLength: "",
            minMaxRegex: "",
            minLength: "",
            maxLength: "",
78
            visiblePopupInformation: false,
79 80 81 82 83 84 85
        }
    }

    componentDidMount() {
        if (this.props.type === 'edit') {
            this.getDetailParameter()
        } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
86 87 88 89 90
            let date = format(new Date, 'yyyy-MM-dd')
            this.setState({
                startDate: date,
                endDate: date
            })
91 92
            this.getDataGroup()
            this.getDataPerusahaan()
Riri Novita's avatar
Riri Novita committed
93
            this.getDataReportName()
Riri Novita's avatar
Riri Novita committed
94
            this.getDataFormat()
95
            this.getDataCurrencyThreshold()
96 97 98 99
        }
    }

    getDetailParameter() {
Deni Rinaldi's avatar
Deni Rinaldi committed
100
        api.create().getDetailParameter(this.props.data[0]).then((response) => {
101
            console.log(response);
a.bairuha's avatar
a.bairuha committed
102
            if (response.data) {
a.bairuha's avatar
a.bairuha committed
103 104 105 106 107
                if (response.ok) {
                    if (response.data.status === 'success') {
                        let data = response.data.data
                        this.setState({
                            tempData: response.data.data,
108
                            getSettingGroupID: response.data.data.setting_group_id,
a.bairuha's avatar
a.bairuha committed
109 110
                            getCompanyID: data.company_id,
                            settingType: data.setting_type,
111
                            getSettingTypeID: data.setting_type_id,
112 113
                            typeReport: data.setting_type_name,
                            getTypeReportID: data.setting_type_id,
Riri Novita's avatar
Riri Novita committed
114
                            enableReportName: data.setting_group === "CURRENCY" ? true : false,
Riri Novita's avatar
Riri Novita committed
115
                            enableFormat: data.setting_group === "CURRENCY_MONEY_FORMAT" ? true : false,
116
                            enableThreshold: data.setting_group === "THRESHOLD_CONTROL" ? true : false,
Riri Novita's avatar
Riri Novita committed
117
                            tesValue: response.data.data.setting_group === "CURRENCY" ? Number(response.data.data.value) * 1000 : response.data.data.value
118

a.bairuha's avatar
a.bairuha committed
119 120 121
                        }, () => {
                            this.getAllGroup()
                            this.getPerusahaan()
122
                            this.getReport()
Riri Novita's avatar
Riri Novita committed
123
                            this.getFormat()
124
                            this.getCurrencyByThreshold()
a.bairuha's avatar
a.bairuha committed
125 126 127
                        })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
128
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
a.bairuha's avatar
a.bairuha committed
129 130 131 132 133 134 135
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
                    }
a.bairuha's avatar
a.bairuha committed
136
                } else {
a.bairuha's avatar
a.bairuha committed
137
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
a.bairuha's avatar
a.bairuha committed
138
                }
139
            } else {
a.bairuha's avatar
a.bairuha committed
140
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
141 142 143 144 145 146
            }
        })
    }

    getAllGroup() {
        api.create().getAllGroup().then(response => {
a.bairuha's avatar
a.bairuha committed
147
            if (response.data) {
a.bairuha's avatar
a.bairuha committed
148 149 150 151 152 153 154 155 156 157 158 159 160 161
                if (response.ok) {
                    if (response.data.status == 'success') {
                        let data = response.data.data
                        let typeData = data.map((item) => {
                            return {
                                setting_group_id: item.setting_group_id,
                                setting_group_name: item.setting_group_name
                            }
                        })
                        let index = typeData.findIndex((val) => val.setting_group_id == this.state.getSettingGroupID)
                        let typeProps = {
                            options: typeData,
                            getOptionLabel: (option) => option.setting_group_name,
                        };
Deni Rinaldi's avatar
Deni Rinaldi committed
162
                        this.setState({ types: typeProps, typeData: response.data.data, getTypes: index == -1 ? typeData[0] : typeData[index] }, () => {
163
                            this.getParameterByGroup(this.state.getTypes.setting_group_id, this.state.getTypes.setting_group_name)
Deni Rinaldi's avatar
Deni Rinaldi committed
164
                        })
a.bairuha's avatar
a.bairuha committed
165 166
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
167
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
a.bairuha's avatar
a.bairuha committed
168 169 170 171 172 173
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
174
                    }
a.bairuha's avatar
a.bairuha committed
175
                } else {
a.bairuha's avatar
a.bairuha committed
176
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
a.bairuha's avatar
a.bairuha committed
177
                }
178
            } else {
a.bairuha's avatar
a.bairuha committed
179
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
180 181 182 183 184 185
            }
        })
    }

    getPerusahaan() {
        api.create().getPerusahaanActive().then(response => {
a.bairuha's avatar
a.bairuha committed
186
            if (response.data) {
a.bairuha's avatar
a.bairuha committed
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204
                if (response.ok) {
                    if (response.data.status == 'success') {
                        let data = response.data.data
                        let perusahaanData = data.map((item) => {
                            return {
                                company_id: item.company_id,
                                company_name: item.company_name
                            }
                        })
                        perusahaanData.push({
                            company_id: 0,
                            company_name: 'Default'
                        })
                        let index = perusahaanData.sort((a, b) => a.company_id - b.company_id).findIndex((val) => val.company_id == this.state.getCompanyID)
                        let typeProps = {
                            options: perusahaanData,
                            getOptionLabel: (option) => option.company_name,
                        };
a.bairuha's avatar
a.bairuha committed
205
                        this.setState({ perusahaan: typeProps, perusahaanData: response.data.data, getPerusahaan: index == -1 ? null : perusahaanData[index], msgErrorPerusahaan: index === -1 ? 'Company has been Inactive' : "", errorPerusahaan: index === -1 ? true : false })
a.bairuha's avatar
a.bairuha committed
206 207
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
208
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
a.bairuha's avatar
a.bairuha committed
209 210 211 212 213 214
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
215
                    }
a.bairuha's avatar
a.bairuha committed
216
                } else {
a.bairuha's avatar
a.bairuha committed
217
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
a.bairuha's avatar
a.bairuha committed
218
                }
219
            } else {
a.bairuha's avatar
a.bairuha committed
220
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
221 222 223 224
            }
        })
    }

225 226 227 228 229 230 231 232
    getReport() {
        api.create().getDataReport().then(response => {
            if (response.data) {
                if (response.ok) {
                    if (response.data.status == 'success') {
                        let data = response.data.data
                        let reportData = data.map((item) => {
                            return {
233 234
                                setting_type_id: item.setting_type_id,
                                setting_type_name: item.setting_type_name
235 236
                            }
                        })
Riri Novita's avatar
Riri Novita committed
237
                        let index = reportData.findIndex((val) => val.setting_type_id == this.state.tempData.reference_id)
238 239
                        let reportProps = {
                            options: reportData,
240
                            getOptionLabel: (option) => option.setting_type_name,
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261
                        };
                        this.setState({ reportName: reportProps, reportData: response.data.data, getReportName: index == -1 ? reportData[0] : reportData[index] })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                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' })
            }
        })
    }

Riri Novita's avatar
Riri Novita committed
262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299
    getFormat() {
        api.create().getFormatValue().then(response => {
            console.log(response);
            if (response.data) {
                if (response.ok) {
                    if (response.data.status == 'success') {
                        let data = response.data.data
                        let formatData = data.map((item) => {
                            return {
                                setting_type_id: item.setting_type_id,
                                setting_type_name: item.setting_type_name
                            }
                        })
                        let index = formatData.findIndex((val) => val.setting_type_id == this.state.tempData.reference_id)
                        let formatProps = {
                            options: formatData,
                            getOptionLabel: (option) => option.setting_type_name,
                        };
                        this.setState({ formatCurrency: formatProps, formatData: response.data.data, getFormatData: index == -1 ? formatData[0] : formatData[index] })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                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' })
            }
        })
    }

300
    getCurrencyByThreshold() {
Riri Novita's avatar
Riri Novita committed
301
        api.create().getThreshold().then(response => {
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337
            console.log(response);
            if (response.data) {
                if (response.ok) {
                    if (response.data.status == 'success') {
                        let data = response.data.data
                        let currencyData = data.map((item) => {
                            return {
                                setting_type_id: item.setting_type_id,
                                setting_type_name: item.setting_type_name
                            }
                        })
                        let index = currencyData.findIndex((val) => val.setting_type_id == this.state.tempData.reference_id)
                        let currencyProps = {
                            options: currencyData,
                            getOptionLabel: (option) => option.setting_type_name,
                        };
                        this.setState({ thresholdCurrency: currencyProps, currencyData: response.data.data, getThresholdCurrency: index == -1 ? currencyData[0] : currencyData[index] })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                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' })
            }
        })
    }

338 339
    getDataGroup() {
        api.create().getAllGroup().then((response) => {
a.bairuha's avatar
a.bairuha committed
340
            if (response.data) {
a.bairuha's avatar
a.bairuha committed
341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356
                if (response.ok) {
                    if (response.data.status == 'success') {
                        let data = response.data.data
                        let typeData = data.map((item) => {
                            return {
                                setting_group_id: item.setting_group_id,
                                setting_group_name: item.setting_group_name
                            }
                        })
                        let typeProps = {
                            options: typeData,
                            getOptionLabel: (option) => option.setting_group_name,
                        };
                        this.setState({ types: typeProps, typeData: response.data.data })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
357
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
a.bairuha's avatar
a.bairuha committed
358 359 360 361 362 363
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
364
                    }
a.bairuha's avatar
a.bairuha committed
365
                } else {
a.bairuha's avatar
a.bairuha committed
366
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
a.bairuha's avatar
a.bairuha committed
367
                }
368
            } else {
a.bairuha's avatar
a.bairuha committed
369
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
370 371 372 373 374 375
            }
        })
    }

    getDataPerusahaan() {
        api.create().getPerusahaanActive().then((response) => {
a.bairuha's avatar
a.bairuha committed
376
            if (response.data) {
a.bairuha's avatar
a.bairuha committed
377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396
                if (response.ok) {
                    if (response.data.status == 'success') {
                        let data = response.data.data
                        let typeData = data.map((item) => {
                            return {
                                company_id: item.company_id,
                                company_name: item.company_name
                            }
                        })
                        typeData.push({
                            company_id: 0,
                            company_name: 'Default'
                        })
                        let typeProps = {
                            options: typeData.sort((a, b) => a.company_id - b.company_id),
                            getOptionLabel: (option) => option.company_name,
                        };
                        this.setState({ perusahaan: typeProps, perusahaanData: response.data.data })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
397
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
a.bairuha's avatar
a.bairuha committed
398 399 400 401 402 403
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
404
                    }
a.bairuha's avatar
a.bairuha committed
405
                } else {
a.bairuha's avatar
a.bairuha committed
406
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
a.bairuha's avatar
a.bairuha committed
407
                }
408
            } else {
a.bairuha's avatar
a.bairuha committed
409
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
410 411 412 413
            }
        })
    }

414 415
    getParameterByGroup(id, name) {
        if (name === "CURRENCY") {
416
            this.setState({ enableReportName: true, enableFormat: false, enableThreshold: false })
Riri Novita's avatar
Riri Novita committed
417
        } else if (name === "CURRENCY_MONEY_FORMAT") {
418 419 420
            this.setState({ enableFormat: true, enableReportName: false, enableThreshold: false })
        } else if (name === "THRESHOLD_CONTROL") {
            this.setState({ enableThreshold: true, enableFormat: false, enableReportName: false })
Riri Novita's avatar
Riri Novita committed
421
        } else {
422
            this.setState({ enableReportName: false, enableFormat: false, enableThreshold: false })
Riri Novita's avatar
Riri Novita committed
423
        }
424
        api.create().getParameterByGroup(id).then(response => {
Deni Rinaldi's avatar
Deni Rinaldi committed
425
            // console.log(id, response);
a.bairuha's avatar
a.bairuha committed
426
            if (response.data) {
a.bairuha's avatar
a.bairuha committed
427 428 429 430 431 432 433 434 435 436 437 438 439 440
                if (response.ok) {
                    if (response.data.status == 'success') {
                        let data = response.data.data
                        let typeData = data.map((item) => {
                            return {
                                setting_type_id: item.setting_type_id,
                                setting_type_name: item.setting_type_name
                            }
                        })
                        let index = typeData.findIndex((val) => val.setting_type_id == this.state.getSettingTypeID)
                        let typeProps = {
                            options: typeData,
                            getOptionLabel: (option) => option.setting_type_name,
                        };
Deni Rinaldi's avatar
Deni Rinaldi committed
441
                        this.setState({ enableParameter: true, parameter: typeProps, parameterData: response.data.data, getParameter: index == -1 ? null : typeData[index] })
a.bairuha's avatar
a.bairuha committed
442 443
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
d.arizona's avatar
d.arizona committed
444
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
a.bairuha's avatar
a.bairuha committed
445 446 447 448 449 450
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
451
                    }
a.bairuha's avatar
a.bairuha committed
452
                } else {
a.bairuha's avatar
a.bairuha committed
453
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
a.bairuha's avatar
a.bairuha committed
454
                }
455
            } else {
a.bairuha's avatar
a.bairuha committed
456
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
457 458 459 460
            }
        })
    }

Riri Novita's avatar
Riri Novita committed
461
    getDataReportName() {
462 463 464 465 466 467 468 469
        api.create().getDataReport().then((response) => {
            console.log(response);
            if (response.data) {
                if (response.ok) {
                    if (response.data.status == 'success') {
                        let data = response.data.data
                        let reportData = data.map((item) => {
                            return {
470 471
                                setting_type_id: item.setting_type_id,
                                setting_type_name: item.setting_type_name
472 473 474 475
                            }
                        })
                        let reportProps = {
                            options: reportData,
476
                            getOptionLabel: (option) => option.setting_type_name,
477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493
                        };
                        this.setState({ reportName: reportProps, reportData: response.data.data })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                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' })
Riri Novita's avatar
Riri Novita committed
494
            }
495 496 497 498 499 500 501 502 503 504 505 506 507 508
        })
        // let reportData = [
        //     {
        //         "type_report_id": 1,
        //         "report_name": "Master Budget"
        //     },
        //     {
        //         "type_report_id": 2,
        //         "report_name": "Monthly Report"
        //     },
        //     {
        //         "type_report_id": 3,
        //         "report_name": "Rolling Outlook"
        //     },
Riri Novita's avatar
Riri Novita committed
509
        //     {checkUpload
510 511 512 513 514 515 516 517
        //         "type_report_id": 4,
        //         "report_name": "Outlook PA"
        //     },
        //     {
        //         "type_report_id": 5,
        //         "report_name": "Operating Indicator"
        //     }
        // ]
Riri Novita's avatar
Riri Novita committed
518

519 520 521 522 523
        // let reportProps = {
        //     options: reportData.sort((a, b) => a.report_id - b.report_id),
        //     getOptionLabel: (option) => option.report_name,
        // };
        // this.setState({ reportName: reportProps })
Riri Novita's avatar
Riri Novita committed
524 525
    }

Riri Novita's avatar
Riri Novita committed
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 556 557 558 559 560 561 562
    getDataFormat() {
        api.create().getFormatValue().then((response) => {
            console.log(response);
            if (response.data) {
                if (response.ok) {
                    if (response.data.status == 'success') {
                        let data = response.data.data
                        let formatData = data.map((item) => {
                            return {
                                setting_type_id: item.setting_type_id,
                                setting_type_name: item.setting_type_name
                            }
                        })
                        let formatProps = {
                            options: formatData,
                            getOptionLabel: (option) => option.setting_type_name,
                        };
                        this.setState({ formatCurrency: formatProps, formatData: response.data.data })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                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' })
            }
        })
    }

563
    getDataCurrencyThreshold() {
Riri Novita's avatar
Riri Novita committed
564
        api.create().getThreshold().then((response) => {
565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599
            console.log(response);
            if (response.data) {
                if (response.ok) {
                    if (response.data.status == 'success') {
                        let data = response.data.data
                        let currencyData = data.map((item) => {
                            return {
                                setting_type_id: item.setting_type_id,
                                setting_type_name: item.setting_type_name
                            }
                        })
                        let currencyProps = {
                            options: currencyData,
                            getOptionLabel: (option) => option.setting_type_name,
                        };
                        this.setState({ thresholdCurrency: currencyProps, currencyData: response.data.data })
                    } else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
                            if (response.data.message.includes("Someone Logged In") || response.data.message.includes("Token Expired")) {
                                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' })
            }
        })
    }

fahrur huzain's avatar
fahrur huzain committed
600 601 602 603 604 605 606 607 608
    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 },
                errorParameter: false,
                errorDeskripsi: false,
                errorReportName: false,
Riri Novita's avatar
Riri Novita committed
609
                errorFormatValue: false,
fahrur huzain's avatar
fahrur huzain committed
610 611 612 613 614 615 616 617
                errorValue: false,
                errorMinValue: false,
                errorOrder: false,
                errorMaxValue: false,
                errorStartDate: false,
                errorEndDate: false,
                errorGroup: false,
                errorPerusahaan: false,
618 619
                errorThresholdCurrency: false,
                msgErrorThresholdCurrency: '',
fahrur huzain's avatar
fahrur huzain committed
620 621 622 623 624
                msgErrorPerusahaan: '',
                msgErrorGroup: '',
                msgErrorParameter: '',
                msgErrorDeskripsi: '',
                msgErrorReportName: '',
Riri Novita's avatar
Riri Novita committed
625
                msgErrorFormatValue: '',
fahrur huzain's avatar
fahrur huzain committed
626 627 628 629 630 631 632 633 634 635 636 637 638
                msgErrorValue: '',
                msgErrorMinValue: '',
                msgErrorOrder: '',
                msgErrorMaxValue: '',
                msgErrorStartDate: '',
                msgErrorEndDate: ''
            })
        } else if (isDate && type == 'end_date') {
            this.setState({
                ...data, tempData: { ...this.state.tempData, end_date: format(e, 'yyyy-MM-dd') },
                errorParameter: false,
                errorDeskripsi: false,
                errorReportName: false,
Riri Novita's avatar
Riri Novita committed
639
                errorFormatValue: false,
fahrur huzain's avatar
fahrur huzain committed
640 641 642 643 644 645 646 647
                errorValue: false,
                errorMinValue: false,
                errorOrder: false,
                errorMaxValue: false,
                errorStartDate: false,
                errorEndDate: false,
                errorGroup: false,
                errorPerusahaan: false,
648 649
                errorThresholdCurrency: false,
                msgErrorThresholdCurrency: '',
fahrur huzain's avatar
fahrur huzain committed
650 651 652 653 654
                msgErrorPerusahaan: '',
                msgErrorGroup: '',
                msgErrorParameter: '',
                msgErrorDeskripsi: '',
                msgErrorReportName: '',
Riri Novita's avatar
Riri Novita committed
655
                msgErrorFormatValue: '',
fahrur huzain's avatar
fahrur huzain committed
656 657 658 659 660 661 662 663 664 665 666 667 668 669
                msgErrorValue: '',
                msgErrorMinValue: '',
                msgErrorOrder: '',
                msgErrorMaxValue: '',
                msgErrorStartDate: '',
                msgErrorEndDate: ''
            })
        } else {
            this.setState({
                ...data,
                tempData: { ...this.state.tempData, [e.target.name]: e.target.value },
                errorParameter: false,
                errorDeskripsi: false,
                errorReportName: false,
Riri Novita's avatar
Riri Novita committed
670
                errorFormatValue: false,
fahrur huzain's avatar
fahrur huzain committed
671 672 673 674 675 676 677 678
                errorValue: false,
                errorMinValue: false,
                errorOrder: false,
                errorMaxValue: false,
                errorStartDate: false,
                errorEndDate: false,
                errorGroup: false,
                errorPerusahaan: false,
679 680
                errorThresholdCurrency: false,
                msgErrorThresholdCurrency: '',
fahrur huzain's avatar
fahrur huzain committed
681 682 683 684 685
                msgErrorPerusahaan: '',
                msgErrorGroup: '',
                msgErrorParameter: '',
                msgErrorDeskripsi: '',
                msgErrorReportName: '',
Riri Novita's avatar
Riri Novita committed
686
                msgErrorFormatValue: '',
fahrur huzain's avatar
fahrur huzain committed
687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704
                msgErrorValue: '',
                msgErrorMinValue: '',
                msgErrorOrder: '',
                msgErrorMaxValue: '',
                msgErrorStartDate: '',
                msgErrorEndDate: ''
            })
        }
    }

    clearMessage() {
        this.setState({
            errorParameter: false,
            errorDeskripsi: false,
            errorValue: false,
            errorMinValue: false,
            errorOrder: false,
            errorReportName: false,
Riri Novita's avatar
Riri Novita committed
705
            errorFormatValue: false,
fahrur huzain's avatar
fahrur huzain committed
706 707 708 709 710
            errorMaxValue: false,
            errorStartDate: false,
            errorEndDate: false,
            errorGroup: false,
            errorPerusahaan: false,
711 712
            errorThresholdCurrency: false,
            msgErrorThresholdCurrency: '',
fahrur huzain's avatar
fahrur huzain committed
713 714 715 716 717 718 719 720 721 722 723
            msgErrorPerusahaan: '',
            msgErrorGroup: '',
            msgErrorParameter: '',
            msgErrorDeskripsi: '',
            msgErrorValue: '',
            msgErrorMinValue: '',
            msgErrorOrder: '',
            msgErrorMaxValue: '',
            msgErrorStartDate: '',
            msgErrorEndDate: '',
            msgErrorReportName: '',
Riri Novita's avatar
Riri Novita committed
724 725 726 727 728 729
            msgErrorFormatValue: '',
            regexValue: "",
            valueLength: "",
            minMaxRegex: "",
            minLength: "",
            maxLength: "",
fahrur huzain's avatar
fahrur huzain committed
730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748
        })
    }

    handleChangeCreate(e, type) {
        let data = this.state
        let isDate = type !== '' ? true : false
        if (isDate && type == 'start_date') {
            this.setState({ startDate: format(e, 'yyyy-MM-dd'), endDate: null }, () => {
                // console.log(this.state.startDate)
            })
        } else if (isDate && type == 'end_date') {
            this.setState({ endDate: format(e, 'yyyy-MM-dd') }, () => {
                // console.log(this.state.endDate)
            })
        } else {
            this.setState({ ...data, [e.target.name]: e.target.value }, () => this.clearMessage())
        }
    }

749 750
    // validasi() {
    //     if (R.isNil(this.state.getTypes)) {
751
    //
752
    //     } else if (R.isNil(this.state.getParameter)) {
753
    //
754
    //     } else if (R.isNil(this.state.getPerusahaan)) {
755
    //        this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
756 757 758 759 760
    //         // } else if (R.isEmpty(this.state.tempData.description)) {
    //         //     this.setState({ errorDeskripsi: true, msgErrorDeskripsi: 'Deskripsi tidak boleh kosong' })
    //     } else if (this.state.getTypes.setting_group_name === "CURRENCY" && R.isNil(this.state.getReportName)) {
    //         this.setState({ errorReportName: true, msgErrorReportName: 'Type Report Cannot be Empty' })
    //     } else if (this.state.getTypes.setting_group_name === "CURRENCY_MONEY_FORMAT" && R.isNil(this.state.getFormatData)) {
761
    //
762
    //     } else if (R.isEmpty(this.state.tempData.value) && R.isEmpty(this.state.tempData.min_value) && R.isEmpty(this.state.tempData.max_value)) {
763
    //
764
    //     } else if ((!R.isEmpty(this.state.tempData.max_value) && R.isEmpty(this.state.tempData.min_value))) {
765
    //        this.validasiMinResponse()
766
    //     } else if (R.isNil(this.state.tempData.start_date)) {
767
    //
768 769 770
    //         // } else if (R.isNil(this.state.tempData.order)) {
    //         //     this.setState({ errorOrder: true, msgErrorOrder: 'Order tidak boleh kosong' })
    //     } else if ((!R.isEmpty(this.state.tempData.min_value) && R.isEmpty(this.state.tempData.max_value))) {
771
    //        this.validasiMaxResponse()
772 773 774 775 776 777
    //     } else if (R.isNil(this.state.tempData.end_date)) {
    //         this.setState({ errorEndDate: true, msgErrorEndDate: 'Valid To Cannot be Empty' })
    //     } else {
    //         this.updateParameter()
    //     }
    // }
fahrur huzain's avatar
fahrur huzain committed
778

779 780
    async validasiValueResponse() {
        let data = await this.validasiValueData()
Riri Novita's avatar
Riri Novita committed
781
        if (R.isNil(this.state.getTypes)) {
782
        } else {
fahrur huzain's avatar
fahrur huzain committed
783 784
            if (this.state.getTypes.setting_group_name == "REPORT_SUBMIT_PERIOD") {
                if (R.isEmpty(data.value)) {
785 786 787 788 789
                    if (R.isNil(this.state.getPerusahaan)) {
                    } else {
                        if (this.state.getPerusahaan.company_name == "Default") {
                        } else {
                            this.setState({ errorValue: true, msgErrorValue: 'Value Cannot be Empty' })
790 791
                        }
                    }
fahrur huzain's avatar
fahrur huzain committed
792
                } else {
793 794 795 796
                    if (R.isNil(this.state.getParameter)) {
                    } else {
                        switch (this.state.getParameter.setting_type_name) {
                            case "MASTER_BUDGET":
797
                                this.setState({ errorValue: true, msgErrorValue: 'Incorrect value format, example : 2023' })
798 799 800 801
                                break
                            case "MONTHLY_REPORT":
                                this.setState({
                                    errorValue: true,
802
                                    msgErrorValue: 'Incorrect value format, example : Jan 2023'
803 804 805
                                })
                                break
                            case "OUTLOOK_Q1":
806
                                this.setState({ errorValue: true, msgErrorValue: 'Incorrect value format, example : Q1 2023' })
807 808
                                break
                            case "OUTLOOK_Q2":
809
                                this.setState({ errorValue: true, msgErrorValue: 'Incorrect value format, example : Q2 2023' })
810 811
                                break
                            case "OUTLOOK_Q3":
812
                                this.setState({ errorValue: true, msgErrorValue: 'Incorrect value format, example : Q3 2023' })
813 814
                                break
                            case "OUTLOOK_PA":
815
                                this.setState({ errorValue: true, msgErrorValue: 'Incorrect value format, example : 2023' })
816 817
                                break
                            default:
818
                                this.setState({ errorValue: true, msgErrorValue: 'Incorrect value format, example : 2023' })
819
                        }
fahrur huzain's avatar
fahrur huzain committed
820 821
                    }
                }
fahrur huzain's avatar
fahrur huzain committed
822
            } else if (this.state.getTypes.setting_group_name == "CURRENCY") {
823
                this.setState({ errorValue: true, msgErrorValue: 'Incorrect value format, example : 15000' })
fahrur huzain's avatar
fahrur huzain committed
824 825 826 827
            }
        }
    }

828
    async validasiCreateEdit() {
829
        let data = await this.validasiValueData()
fahrur huzain's avatar
fahrur huzain committed
830 831
        let response = await this.validasiRegexValue()
        let minMaxValidasi = await this.validasiMinMaxValue()
832
        console.log("Masuk ke menu creat : " + R.isNil(this.state.getFormatData))
833
        if (this.props.type === "edit") {
fahrur huzain's avatar
fahrur huzain committed
834 835 836
            if (R.isNil(this.state.getTypes)) {
            } else {
                if (this.state.getTypes.setting_group_name == "CURRENCY_MONEY_FORMAT") {
837 838 839 840 841 842
                    if (R.isNil(this.state.getParameter)) {
                    } else {
                        if (R.isNil(this.state.getPerusahaan)) {
                        } else {
                            if (R.isNil(this.state.getFormatData)) {
                            } else {
843 844 845 846 847
                                this.updateParameterCurrebcyMoneyFormat()
                            }
                        }
                    }
                } else if (this.state.getTypes.setticonng_group_name == "CURRENCY") {
848
                    if (R.isNil(this.state.getReportName)) {
fahrur huzain's avatar
fahrur huzain committed
849 850
                    } else {
                        if (R.isEmpty(data.value)) {
851
                        } else {
fahrur huzain's avatar
fahrur huzain committed
852 853 854
                            if (data.value.match(response.regexValue) && data.value.length <= response.valueLength) {
                                if (R.isEmpty(data.minValue)) {
                                } else {
855
                                    if (data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0, 1) != "0" && data.minValue.length <= minMaxValidasi.minLength) {
fahrur huzain's avatar
fahrur huzain committed
856 857 858 859 860 861 862 863 864
                                        if (R.isEmpty(data.maxValue)) {
                                        } else {
                                            if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0, 1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
                                                this.updateParameter()
                                            }
                                        }
                                    }
                                }
                            }
865
                        }
866
                    }
867
                } else if (this.state.getTypes.setting_group_name == "THRESHOLD_VARIANCE" || this.state.getTypes.setting_group_name == "THRESHOLD_CONTROL") {
868 869
                    if (R.isEmpty(data.minValue)) {
                    } else {
870
                        if (data.minValue.match(minMaxValidasi.minMaxRegex) && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.minValue.substring(0,1) != "0" : true )  && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.minValue.length <= minMaxValidasi.minLength : true )) {
871 872
                            if (R.isEmpty(data.maxValue)) {
                            } else {
873
                                if (data.maxValue.match(minMaxValidasi.minMaxRegex) && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.maxValue.substring(0,1) != "0" : true ) && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.maxValue.length <= minMaxValidasi.maxLength : true )) {
874
                                    this.updateParameterThreshold()
875 876 877 878
                                }
                            }
                        }
                    }
879
                } else if (this.state.getTypes.setting_group_name == "REPORT_SUBMIT_PERIOD") {
fahrur huzain's avatar
fahrur huzain committed
880
                    if (R.isEmpty(data.value)) {
881
                        if (this.state.getPerusahaan.company_name == "Default") {
882 883
                            if (R.isEmpty(data.minValue)) {
                            } else {
884
                                if (data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0, 1) != "0" && data.minValue.length <= minMaxValidasi.minLength) {
885 886 887 888 889 890 891 892 893
                                    if (R.isEmpty(data.maxValue)) {
                                    } else {
                                        if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0, 1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
                                            this.updateParameter()
                                        }
                                    }
                                }
                            }
                        }
894
                    } else {
fahrur huzain's avatar
fahrur huzain committed
895 896 897
                        if (data.value.match(response.regexValue) && data.value.length <= response.valueLength) {
                            if (R.isEmpty(data.minValue)) {
                            } else {
898
                                if (data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0, 1) != "0" && data.minValue.length <= minMaxValidasi.minLength) {
fahrur huzain's avatar
fahrur huzain committed
899 900 901 902 903 904 905 906 907
                                    if (R.isEmpty(data.maxValue)) {
                                    } else {
                                        if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0, 1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
                                            this.updateParameter()
                                        }
                                    }
                                }
                            }
                        }
908
                    }
909 910 911 912 913
                } else {
                    if (R.isNil(this.state.getParameter)) {
                    } else {
                        if (R.isNil(this.state.getPerusahaan)) {
                        } else {
914
                            this.updateParameter()
915 916
                        }
                    }
917 918
                }
            }
919
        } else {
fahrur huzain's avatar
fahrur huzain committed
920 921 922
            if (R.isNil(this.state.getTypes)) {
            } else {
                if (this.state.getTypes.setting_group_name == "CURRENCY_MONEY_FORMAT") {
923 924 925 926
                    if (R.isNil(this.state.getParameter)) {
                    } else {
                        if (R.isNil(this.state.getPerusahaan)) {
                        } else {
927
                            console.log()
928 929
                            if (R.isNil(this.state.getFormatData)) {
                            } else {
930 931 932 933
                                this.createParameterCurrebcyMoneyFormat()
                            }
                        }
                    }
fahrur huzain's avatar
fahrur huzain committed
934
                } else if (this.state.getTypes.setting_group_name == "CURRENCY") {
935
                    if (R.isNil(this.state.getReportName)) {
fahrur huzain's avatar
fahrur huzain committed
936 937
                    } else {
                        if (R.isEmpty(data.value)) {
938
                        } else {
fahrur huzain's avatar
fahrur huzain committed
939 940 941 942 943 944 945 946 947 948 949 950 951
                            if (data.value.match(response.regexValue) && data.value.length <= response.valueLength) {
                                if (R.isEmpty(data.minValue)) {
                                } else {
                                    if (data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0, 1) != "0" && data.minValue.length <= minMaxValidasi.minLength) {
                                        if (R.isEmpty(data.maxValue)) {
                                        } else {
                                            if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0, 1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
                                                this.createParameter()
                                            }
                                        }
                                    }
                                }
                            }
952
                        }
953
                    }
954
                } else if (this.state.getTypes.setting_group_name == "THRESHOLD_VARIANCE" || this.state.getTypes.setting_group_name == "THRESHOLD_CONTROL") {
955 956
                    if (R.isEmpty(data.minValue)) {
                    } else {
957
                        if (data.minValue.match(minMaxValidasi.minMaxRegex) && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.minValue.substring(0,1) != "0" : true )  && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.minValue.length <= minMaxValidasi.minLength : true )) {
958 959
                            if (R.isEmpty(data.maxValue)) {
                            } else {
960 961
                                if (data.maxValue.match(minMaxValidasi.minMaxRegex) && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.maxValue.substring(0,1) != "0" : true ) && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.maxValue.length <= minMaxValidasi.maxLength : true )) {
                                    this.createParameterThreshold()
962 963 964 965
                                }
                            }
                        }
                    }
966
                } else if (this.state.getTypes.setting_group_name == "REPORT_SUBMIT_PERIOD") {
fahrur huzain's avatar
fahrur huzain committed
967
                    if (R.isEmpty(data.value)) {
968
                        if (this.state.getPerusahaan.company_name == "Default") {
969 970
                            if (R.isEmpty(data.minValue)) {
                            } else {
971
                                if (data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0, 1) != "0" && data.minValue.length <= minMaxValidasi.minLength) {
972 973
                                    if (R.isEmpty(data.maxValue)) {
                                    } else {
974
                                        if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0, 1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
975 976 977 978 979 980
                                            this.createParameter()
                                        }
                                    }
                                }
                            }
                        }
981
                    } else {
fahrur huzain's avatar
fahrur huzain committed
982 983 984
                        if (data.value.match(response.regexValue) && data.value.length <= response.valueLength) {
                            if (R.isEmpty(data.minValue)) {
                            } else {
985
                                if (data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0, 1) != "0" && data.minValue.length <= minMaxValidasi.minLength) {
fahrur huzain's avatar
fahrur huzain committed
986 987
                                    if (R.isEmpty(data.maxValue)) {
                                    } else {
988
                                        if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0, 1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
fahrur huzain's avatar
fahrur huzain committed
989 990 991 992 993 994
                                            this.createParameter()
                                        }
                                    }
                                }
                            }
                        }
995
                    }
996 997 998 999 1000
                } else {
                    if (R.isNil(this.state.getParameter)) {
                    } else {
                        if (R.isNil(this.state.getPerusahaan)) {
                        } else {
1001
                            this.createParameter()
1002 1003
                        }
                    }
1004 1005 1006 1007 1008
                }
            }
        }
    }

1009 1010 1011 1012 1013
    validasiFormatResponse() {
        if (R.isNil(this.state.getTypes)) {
        } else {
            if (this.state.getTypes.setting_group_name == "CURRENCY_MONEY_FORMAT") {
                if (R.isNil(this.state.getFormatData)) {
1014 1015 1016
                    this.setState({ errorFormatValue: true, msgErrorFormatValue: 'Format Cannot be Empty' })
                }
            }
1017 1018 1019
        }
    }

fahrur huzain's avatar
fahrur huzain committed
1020 1021
    validasiRegexValue() {
        let obj = null
1022
        if (R.isNil(this.state.getTypes)) {
fahrur huzain's avatar
fahrur huzain committed
1023
            obj = { regexValue: (/null.*$/), valueLength: 0 }
1024 1025
        } else {
            if (this.state.getTypes.setting_group_name === "CURRENCY") {
1026
                obj = { regexValue: (/\d+(\.\d+)?/), valueLength: 20 }
1027
            } else if (this.state.getTypes.setting_group_name === "REPORT_SUBMIT_PERIOD") {
1028
                if (R.isNil(this.state.getParameter)) {
Riri Novita's avatar
Riri Novita committed
1029
                    obj = { regexValue: (/\b\d{4}\b/), valueLength: 4 }
1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050
                } else {
                    switch (this.state.getParameter.setting_type_name) {
                        case "MASTER_BUDGET":
                            obj = { regexValue: (/\b\d{4}\b/), valueLength: 4 }
                            break
                        case "MONTHLY_REPORT":
                            obj = {
                                regexValue: (/^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}$/),
                                valueLength: 8
                            }
                            break
                        case "OUTLOOK_Q1":
                            obj = { regexValue: (/Q1\s\d{4}/), valueLength: 7 }
                            break
                        case "OUTLOOK_Q2":
                            obj = { regexValue: (/Q2\s\d{4}/), valueLength: 7 }
                            break
                        case "OUTLOOK_Q3":
                            obj = { regexValue: (/Q3\s\d{4}/), valueLength: 7 }
                            break
                        case "OUTLOOK_PA":
1051
                            obj = { regexValue: (/\b\d{4}\b/), valueLength: 4 }
1052 1053 1054
                            break
                        default:
                            obj = { regexValue: (/Q1\s\d{4}/), valueLength: 7 }
fahrur huzain's avatar
fahrur huzain committed
1055
                    }
1056
                }
fahrur huzain's avatar
fahrur huzain committed
1057 1058
            }else{
                obj = { regexValue: (/null.*$/), valueLength: 20 }
fahrur huzain's avatar
fahrur huzain committed
1059 1060 1061 1062 1063
            }
        }
        return obj;
    }

1064
    validasiMaxResponse() {
Riri Novita's avatar
Riri Novita committed
1065 1066
        if (R.isNil(this.state.getTypes)) {
        } else {
1067 1068 1069 1070
            switch (this.state.getTypes.setting_group_name) {
                case "REPORT_SUBMIT_PERIOD":
                    this.setState({
                        errorMaxValue: true,
1071
                        msgErrorMaxValue: 'Incorrect max value format, example : 31 Jan 2023'
1072 1073 1074 1075 1076
                    })
                    break
                case "CURRENCY":
                    this.setState({
                        errorMaxValue: true,
1077
                        msgErrorMaxValue: 'Incorrect max value format, example : 31 Jan 2023'
1078 1079 1080
                    })
                    break
                case "THRESHOLD_CONTROL":
1081
                    this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Incorrect max value format, example : 99999999' })
1082 1083
                    break
                case "THRESHOLD_VARIANCE":
1084
                    this.setState({ errorMaxValue: true, msgErrorMaxValue: 'Incorrect max value format, example : 99999999' })
1085
                    break
Riri Novita's avatar
Riri Novita committed
1086
                default:
1087
                    this.setState({ errorMaxValue: false, msgErrorMaxValue: '' })
1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098
            }
        }
    }

    validasiMinResponse() {
        if (R.isNil(this.state.getTypes)) {
        } else {
            switch (this.state.getTypes.setting_group_name) {
                case "REPORT_SUBMIT_PERIOD":
                    this.setState({
                        errorMinValue: true,
1099
                        msgErrorMinValue: 'Incorrect min value format, example : 1 Jan 2023'
1100 1101 1102 1103 1104
                    })
                    break
                case "CURRENCY":
                    this.setState({
                        errorMinValue: true,
1105
                        msgErrorMinValue: 'Incorrect min value format, example : 1 Jan 2023'
1106 1107 1108
                    })
                    break
                case "THRESHOLD_CONTROL":
1109
                    this.setState({ errorMinValue: true, msgErrorMinValue: 'Incorrect min value format, example : -99999999' })
1110 1111
                    break
                case "THRESHOLD_VARIANCE":
1112
                    this.setState({ errorMinValue: true, msgErrorMinValue: 'Incorrect min value format, example : -99999999' })
1113
                    break
Riri Novita's avatar
Riri Novita committed
1114
                default:
1115
                    this.setState({ errorMinValue: false, msgErrorMinValue: '' })
1116 1117 1118 1119 1120 1121
            }
        }
    }

    validasiMinMaxValue() {
        let obj = null
Riri Novita's avatar
Riri Novita committed
1122 1123 1124
        if (R.isNil(this.state.getTypes)) {
            obj = { minMaxRegex: (/^-?\d+\.?\d+$/), minLength: this.state.minValue.length, maxLength: this.state.maxValue.length }
        } else {
1125 1126
            switch (this.state.getTypes.setting_group_name) {
                case "CURRENCY":
1127
                    obj = { minMaxRegex: (/\b\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\b/), minLength: 11, maxLength: 11, regexValue: (/^\d+$/) }
1128 1129
                    break
                case "REPORT_SUBMIT_PERIOD":
1130
                    if (R.isNil(this.state.getPerusahaan)) {
1131 1132 1133 1134
                        obj = {
                            minMaxRegex: (/\b\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\b/),
                            minLength: 11, maxLength: 11
                        }
1135 1136
                    } else {
                        if (this.state.getPerusahaan.company_name == "Default") {
1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186
                            if (R.isNil(this.state.getParameter)) {
                                obj = {
                                    minMaxRegex: (/\b\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\b/),
                                    minLength: 11, maxLength: 11
                                }
                            } else {
                                switch (this.state.getParameter.setting_type_name) {
                                    case "MASTER_BUDGET":
                                        obj = {
                                            minMaxRegex: (/^(\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))(?:\s\d{4})?$/),
                                            minLength: 11, maxLength: 11
                                        }
                                        break
                                    case "MONTHLY_REPORT":
                                        obj = {
                                            minMaxRegex: (/^(?:\d{1,2}|(\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}))$/),
                                            minLength: 11, maxLength: 11
                                        }
                                        break
                                    case "OUTLOOK_Q1":
                                        obj = {
                                            minMaxRegex: (/^(\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))(?:\s\d{4})?$/),
                                            minLength: 11, maxLength: 11
                                        }
                                        break
                                    case "OUTLOOK_Q2":
                                        obj = {
                                            minMaxRegex: (/^(\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))(?:\s\d{4})?$/),
                                            minLength: 11, maxLength: 11
                                        }
                                        break
                                    case "OUTLOOK_Q3":
                                        obj = {
                                            minMaxRegex: (/^(\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))(?:\s\d{4})?$/),
                                            minLength: 11, maxLength: 11
                                        }
                                        break
                                    case "OUTLOOK_PA":
                                        obj = {
                                            minMaxRegex: (/^(\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))(?:\s\d{4})?$/),
                                            minLength: 11, maxLength: 11
                                        }
                                        break
                                    default:
                                        obj = {
                                            minMaxRegex: (/^(\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec))(?:\s\d{4})?$/),
                                            minLength: 11, maxLength: 11
                                        }
                                }
                            }
1187
                        } else {
1188 1189 1190 1191 1192
                            obj = {
                                minMaxRegex: (/\b\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\b/),
                                minLength: 11, maxLength: 11
                            }
                        }
1193 1194 1195
                    }
                    break
                case "THRESHOLD_CONTROL":
1196
                    obj = { minMaxRegex: (/^-?\d+(\.\d+)?$/), minLength: this.state.minValue.length, maxLength: this.state.maxValue.length }
1197
                    break
Riri Novita's avatar
Riri Novita committed
1198 1199
                default:
                    obj = { regexValue: null, minLength: 11, maxLength: 11 }
1200 1201 1202 1203 1204
            }
        }
        return obj;
    }

1205
    validasiValueData() {
1206
        let obj = null
1207 1208 1209 1210
        if (this.props.type === "edit") {
            obj = { value: this.state.tempData.value.toString(), minValue: this.state.tempData.min_value, maxValue: this.state.tempData.max_value, endDate: this.state.tempData.end_date, startDate: this.state.tempData.start_date }
        } else {
            obj = { value: this.state.value, minValue: this.state.minValue, maxValue: this.state.maxValue, endDate: this.state.endDate, startDate: this.state.startDate }
1211 1212 1213
        }
        return obj;
    }
1214

1215 1216 1217 1218 1219 1220
    validasiCurrencyTC(){
        if (R.isNil(this.state.getThresholdCurrency)){
            this.setState({ errorThresholdCurrency: true, msgErrorThresholdCurrency: 'Currency Cannot be Empty' })
        }
    }

fahrur huzain's avatar
fahrur huzain committed
1221 1222 1223 1224 1225
    async validasiMaxValue() {
        let data = await this.validasiValueData()
        let minMaxValidasi = await this.validasiMinMaxValue()
        if (R.isEmpty(data.maxValue)) {
            this.validasiMaxResponse()
1226
            this.validasiCurrencyTC()
fahrur huzain's avatar
fahrur huzain committed
1227
        } else {
1228 1229 1230 1231 1232 1233 1234 1235
            if (R.isNil(this.state.getTypes)){
                if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0,1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
                    this.validasiCurrencyTC()
                } else {
                    this.validasiMaxResponse()
                    this.validasiCurrencyTC()
                }
            }else {
1236
                if (data.maxValue.match(minMaxValidasi.minMaxRegex) && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.maxValue.substring(0,1) != "0" : true ) && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.maxValue.length <= minMaxValidasi.maxLength : true ) ) {
1237 1238 1239 1240 1241
                    this.validasiCurrencyTC()
                } else {
                    this.validasiMaxResponse()
                    this.validasiCurrencyTC()
                }
fahrur huzain's avatar
fahrur huzain committed
1242 1243 1244 1245 1246
            }
        }
    }

    validasiFormatData() {
1247
        if (R.isNil(this.state.getFormatData)) {
fahrur huzain's avatar
fahrur huzain committed
1248 1249 1250 1251 1252 1253 1254 1255 1256
            this.validasiFormatResponse()
            this.validasiMaxValue()
        } else {
            this.validasiMaxValue()
        }
    }

    async validsiMinValue() {
        let data = await this.validasiValueData()
1257
        let minMaxValidasi = await this.validasiMinMaxValue()
fahrur huzain's avatar
fahrur huzain committed
1258 1259 1260 1261
        if (R.isEmpty(data.minValue)) {
            this.validasiMinResponse()
            this.validasiFormatData()
        } else {
1262 1263 1264 1265 1266 1267 1268 1269
            if (R.isNil(this.state.getTypes)){
                if(data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0,1) != "0" && data.minValue.length <= minMaxValidasi.minLength){
                    this.validasiFormatData()
                } else {
                    this.validasiMinResponse()
                    this.validasiFormatData()
                }
            }else {
1270
                if(data.minValue.match(minMaxValidasi.minMaxRegex) && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.minValue.substring(0,1) != "0" : true )  && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.minValue.length <= minMaxValidasi.minLength : true )){
1271 1272 1273 1274 1275
                    this.validasiFormatData()
                } else {
                    this.validasiMinResponse()
                    this.validasiFormatData()
                }
fahrur huzain's avatar
fahrur huzain committed
1276 1277 1278 1279
            }
        }
    }

1280
    async validasiValue() {
1281
        let data = await this.validasiValueData()
fahrur huzain's avatar
fahrur huzain committed
1282
        let response = await this.validasiRegexValue()
1283
        if (R.isEmpty(data.value)) {
fahrur huzain's avatar
fahrur huzain committed
1284 1285
            this.validasiValueResponse()
            this.validsiMinValue()
1286 1287
        } else {
            if (data.value.match(response.regexValue) && data.value.length <= response.valueLength) {
fahrur huzain's avatar
fahrur huzain committed
1288
                this.validsiMinValue()
1289
            } else {
fahrur huzain's avatar
fahrur huzain committed
1290 1291 1292 1293 1294 1295
                this.validasiValueResponse()
                this.validsiMinValue()
            }
        }
    }

1296 1297
    validasiReportName() {
        if (R.isNil(this.state.getReportName)) {
fahrur huzain's avatar
fahrur huzain committed
1298 1299
            this.setState({ errorReportName: true, msgErrorReportName: 'Report Cannot be Empty' })
            this.validasiValue()
1300
        } else {
fahrur huzain's avatar
fahrur huzain committed
1301 1302 1303 1304
            this.validasiValue()
        }
    }

1305 1306
    validasiPerusahaan() {
        if (R.isNil(this.state.getPerusahaan)) {
fahrur huzain's avatar
fahrur huzain committed
1307 1308
            this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company Cannot be Empty' })
            this.validasiReportName()
1309
        } else {
fahrur huzain's avatar
fahrur huzain committed
1310 1311 1312 1313 1314
            this.validasiReportName()
            this.validasiCreateEdit()
        }
    }

1315 1316
    validasiParameter() {
        if (R.isNil(this.state.getParameter)) {
fahrur huzain's avatar
fahrur huzain committed
1317 1318
            this.setState({ errorParameter: true, msgErrorParameter: 'Parameter Cannot be Empty' })
            this.validasiPerusahaan()
1319
        } else {
fahrur huzain's avatar
fahrur huzain committed
1320 1321 1322 1323
            this.validasiPerusahaan()
        }
    }

1324
    validasiGroup() {
fahrur huzain's avatar
fahrur huzain committed
1325
        if (R.isNil(this.state.getTypes)) {
1326
            this.setState({ errorGroup: true, msgErrorGroup: 'Group Cannot be Empty' })
fahrur huzain's avatar
fahrur huzain committed
1327
            this.validasiParameter()
1328
        } else {
fahrur huzain's avatar
fahrur huzain committed
1329
            this.validasiParameter()
1330 1331 1332
        }
    }

fahrur huzain's avatar
fahrur huzain committed
1333 1334 1335 1336
    validasiCreate() {
        this.validasiGroup()
    }

Riri Novita's avatar
Riri Novita committed
1337 1338 1339
    validasiFormat() {
        this.state.getTypes.setting_group_name === "CURRENCY_MONEY_FORMAT" && R.isNil(this.state.getFormatData)
    }
1340 1341

    updateParameter() {
Riri Novita's avatar
Riri Novita committed
1342 1343 1344
        // let char = this.state.value
        // let arrayChar = char.split('');
        // console.log(char);
1345 1346 1347 1348 1349
        let body = {
            "setting_id": this.state.tempData.setting_id,
            "setting_group_id": this.state.getTypes.setting_group_id,
            "setting_type_id": this.state.getParameter.setting_type_id,
            "company_id": this.state.getPerusahaan.company_id,
Riri Novita's avatar
Riri Novita committed
1350
            "reference_id": this.state.getReportName == null ? null : this.state.getReportName.setting_type_id,
1351 1352
            "description": this.state.tempData.description,
            "orders": this.state.tempData.order,
Riri Novita's avatar
Riri Novita committed
1353
            "value": this.state.tempData.value,
1354 1355 1356 1357 1358
            "max_value": this.state.tempData.max_value,
            "min_value": this.state.tempData.min_value,
            "start_date": this.state.tempData.start_date,
            "end_date": this.state.tempData.end_date
        }
Riri Novita's avatar
Riri Novita committed
1359
        console.log(body);
Riri Novita's avatar
Riri Novita committed
1360
        this.props.updateParameter(body)
1361 1362
    }

1363 1364 1365 1366 1367 1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384
    updateParameterThreshold() {
        // let char = this.state.value
        // let arrayChar = char.split('');
        // console.log(char);
        let body = {
            "setting_id": this.state.tempData.setting_id,
            "setting_group_id": this.state.getTypes.setting_group_id,
            "setting_type_id": this.state.getParameter.setting_type_id,
            "company_id": this.state.getPerusahaan.company_id,
            "reference_id": this.state.getThresholdCurrency == null ? null : this.state.getThresholdCurrency.setting_type_id,
            "description": this.state.tempData.description,
            "orders": this.state.tempData.order,
            "value": this.state.tempData.value,
            "max_value": this.state.tempData.max_value,
            "min_value": this.state.tempData.min_value,
            "start_date": this.state.tempData.start_date,
            "end_date": this.state.tempData.end_date
        }
        console.log(body);
        this.props.updateParameter(body)
    }

1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406
    updateParameterCurrebcyMoneyFormat() {
        // let char = this.state.value
        // let arrayChar = char.split('');
        // console.log(char);
        let body = {
            "setting_id": this.state.tempData.setting_id,
            "setting_group_id": this.state.getTypes.setting_group_id,
            "setting_type_id": this.state.getParameter.setting_type_id,
            "company_id": this.state.getPerusahaan.company_id,
            "reference_id": this.state.getFormatData == null ? null : this.state.getFormatData.setting_type_id,
            "description": this.state.tempData.description,
            "orders": this.state.tempData.order,
            "value": this.state.tempData.value,
            "max_value": this.state.tempData.max_value,
            "min_value": this.state.tempData.min_value,
            "start_date": this.state.tempData.start_date,
            "end_date": this.state.tempData.end_date
        }
        console.log(body);
        this.props.updateParameter(body)
    }

1407
    createParameter() {
Riri Novita's avatar
Riri Novita committed
1408 1409
        let char = this.state.value
        let arrayChar = char.split('');
Riri Novita's avatar
Riri Novita committed
1410
        console.log(char);
1411 1412 1413 1414
        let body = {
            "setting_group_id": this.state.getTypes.setting_group_id,
            "setting_type_id": this.state.getParameter.setting_type_id,
            "company_id": this.state.getPerusahaan.company_id,
Riri Novita's avatar
Riri Novita committed
1415
            "reference_id": this.state.getReportName == null ? null : this.state.getReportName.setting_type_id,
1416 1417
            "description": this.state.description,
            "orders": this.state.order,
1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429
            "value": this.state.value,
            // convert IDR to IDR mn
            "value": this.state.enableReportName ? this.state.value.includes(".") || arrayChar.length == 2 ? this.state.value : this.state.value / 1000 : this.state.value,
            "max_value": this.state.maxValue,
            "min_value": this.state.minValue,
            "start_date": this.state.startDate,
            "end_date": this.state.endDate
        }
        console.log(body);
        this.props.createParameter(body)
    }

1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 1444 1445 1446 1447 1448 1449 1450 1451 1452
    createParameterThreshold() {
        let char = this.state.value
        let arrayChar = char.split('');
        console.log(char);
        let body = {
            "setting_group_id": this.state.getTypes.setting_group_id,
            "setting_type_id": this.state.getParameter.setting_type_id,
            "company_id": this.state.getPerusahaan.company_id,
            "reference_id": this.state.getThresholdCurrency == null ? null : this.state.getThresholdCurrency.setting_type_id,
            "description": this.state.description,
            "orders": this.state.order,
            "value": this.state.value,
            // convert IDR to IDR mn
            "value": this.state.enableReportName ? this.state.value.includes(".") || arrayChar.length == 2 ? this.state.value : this.state.value / 1000 : this.state.value,
            "max_value": this.state.maxValue,
            "min_value": this.state.minValue,
            "start_date": this.state.startDate,
            "end_date": this.state.endDate
        }
        console.log(body);
        this.props.createParameter(body)
    }

1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463
    createParameterCurrebcyMoneyFormat() {
        let char = this.state.value
        let arrayChar = char.split('');
        console.log(char);
        let body = {
            "setting_group_id": this.state.getTypes.setting_group_id,
            "setting_type_id": this.state.getParameter.setting_type_id,
            "company_id": this.state.getPerusahaan.company_id,
            "reference_id": this.state.getFormatData == null ? null : this.state.getFormatData.setting_type_id,
            "description": this.state.description,
            "orders": this.state.order,
Riri Novita's avatar
Riri Novita committed
1464
            "value": this.state.value,
Riri Novita's avatar
Riri Novita committed
1465
            // convert IDR to IDR mn
Riri Novita's avatar
Riri Novita committed
1466
            "value": this.state.enableReportName ? this.state.value.includes(".") || arrayChar.length == 2 ? this.state.value : this.state.value / 1000 : this.state.value,
1467 1468 1469 1470 1471
            "max_value": this.state.maxValue,
            "min_value": this.state.minValue,
            "start_date": this.state.startDate,
            "end_date": this.state.endDate
        }
Riri Novita's avatar
Riri Novita committed
1472
        console.log(body);
Riri Novita's avatar
Riri Novita committed
1473
        this.props.createParameter(body)
1474 1475
    }

1476
    openPopUp() {
1477 1478 1479
        if (!R.isNil(this.state.getTypes)) {
            if (this.state.getTypes.setting_group_name == "CURRENCY") {
                if (!R.isNil(this.state.getReportName)) {
1480 1481 1482 1483 1484 1485 1486 1487
                    this.setState({
                        visiblePopupInformation: true
                    })
                }
            }
        }
    }

faisalhamdi's avatar
faisalhamdi committed
1488 1489 1490 1491 1492 1493 1494
    render() {
        let { type } = this.props
        return type === 'edit' ? this.renderEdit() : this.renderCreate()
    }

    renderEdit() {
        return (
1495
            <div className="test app-popup-show">
faisalhamdi's avatar
faisalhamdi committed
1496
                <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
1497
                    <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
faisalhamdi's avatar
faisalhamdi committed
1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508
                        <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                            <div className="popup-title">
                                <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Ubah 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()}
                            >
Deni Rinaldi's avatar
Deni Rinaldi committed
1509
                                <img src={Images.close} />
faisalhamdi's avatar
faisalhamdi committed
1510 1511 1512 1513 1514
                            </button>
                        </div>
                    </div>


Riri Novita's avatar
Riri Novita committed
1515
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '20px 20px 0px' }}>
faisalhamdi's avatar
faisalhamdi committed
1516 1517 1518 1519
                        <div className="column-1">
                            <div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
1520
                                    value={this.state.tempData === null ? '' : this.state.tempData.setting_id}
faisalhamdi's avatar
faisalhamdi committed
1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536
                                    id="id"
                                    label="ID"
                                    disabled
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
                                />
                            </div>
Riri Novita's avatar
Riri Novita committed
1537 1538 1539 1540 1541 1542 1543
                        </div>
                        <div className="column-2">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                <Autocomplete
                                    {...this.state.types}
                                    debug
                                    id="tipe"
1544
                                    onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => newInputValue === null ? this.setState({ enableParameter: false, enableReportName: false, enableFormat: false, enableThreshold: false, getParameter: null, getReportName: null }, () => this.clearMessage()) : this.getParameterByGroup(newInputValue.setting_group_id, newInputValue.setting_group_name), this.clearMessage())}
Riri Novita's avatar
Riri Novita committed
1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560
                                    renderInput={(params) =>
                                        <TextField
                                            {...params}
                                            error={this.state.errorGroup}
                                            helperText={this.state.msgErrorGroup}
                                            InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                            InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                            label="Group" />}
                                    value={this.state.getTypes}
                                />
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
1561 1562 1563 1564
                                <Autocomplete
                                    {...this.state.parameter}
                                    debug
                                    id="tipe"
Deni Rinaldi's avatar
Deni Rinaldi committed
1565
                                    onChange={(event, newInputValue) => this.setState({ getParameter: newInputValue }, () => this.clearMessage())}
Deni Rinaldi's avatar
Deni Rinaldi committed
1566 1567 1568 1569 1570 1571 1572 1573 1574
                                    renderInput={(params) =>
                                        <TextField
                                            {...params}
                                            InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                            InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                            label="Parameter"
                                            error={this.state.errorParameter}
                                            helperText={this.state.msgErrorParameter}
                                        />}
1575 1576
                                    value={this.state.getParameter}
                                />
faisalhamdi's avatar
faisalhamdi committed
1577
                            </div>
Riri Novita's avatar
Riri Novita committed
1578 1579 1580 1581 1582 1583 1584 1585 1586 1587
                        </div>
                        <div className="column-2">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                <Autocomplete
                                    {...this.state.perusahaan}
                                    debug
                                    id="tipe"
                                    onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, () => this.clearMessage())}
                                    renderInput={(params) =>
                                        <TextField {...params}
1588 1589 1590 1591 1592
                                                   error={this.state.errorPerusahaan}
                                                   helperText={this.state.msgErrorPerusahaan}
                                                   InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                   InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                                   label="Company Name" />}
Riri Novita's avatar
Riri Novita committed
1593 1594 1595 1596 1597 1598 1599 1600
                                    value={this.state.getPerusahaan}
                                />
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
1601 1602
                                <TextField
                                    style={{ width: '100%' }}
1603 1604 1605
                                    id="description"
                                    label="Description"
                                    value={this.state.tempData === null ? '' : this.state.tempData.description}
faisalhamdi's avatar
faisalhamdi committed
1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
1617 1618
                                    name="description"
                                    onChange={(e) => this.handleChange(e, '')}
1619 1620
                                    // error={this.state.errorDeskripsi}
                                    // helperText={this.state.msgErrorDeskripsi}
faisalhamdi's avatar
faisalhamdi committed
1621 1622 1623
                                >
                                </TextField>
                            </div>
Riri Novita's avatar
Riri Novita committed
1624 1625 1626
                        </div>
                        <div className="column-2">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
1627 1628
                                <TextField
                                    style={{ width: '100%' }}
Riri Novita's avatar
Riri Novita committed
1629 1630 1631
                                    id="order"
                                    label="Order"
                                    value={this.state.tempData === null ? '' : this.state.tempData.order}
faisalhamdi's avatar
faisalhamdi committed
1632
                                    inputProps={{
1633
                                        min: 0,
faisalhamdi's avatar
faisalhamdi committed
1634 1635 1636 1637 1638 1639 1640 1641 1642 1643
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
Riri Novita's avatar
Riri Novita committed
1644
                                    name="order"
Deni Rinaldi's avatar
Deni Rinaldi committed
1645
                                    onChange={(e) => {
Riri Novita's avatar
Riri Novita committed
1646
                                        let coba = String(e.target.value).replace(/[^\d]/g, '');
Deni Rinaldi's avatar
Deni Rinaldi committed
1647 1648 1649
                                        this.setState({
                                            tempData: {
                                                ...this.state.tempData,
Riri Novita's avatar
Riri Novita committed
1650
                                                order: coba
Deni Rinaldi's avatar
Deni Rinaldi committed
1651 1652 1653 1654 1655 1656
                                            }
                                        })
                                        this.clearMessage()
                                    }
                                        // this.handleChange(coba, 'value')}
                                    }
1657 1658
                                    // error={this.state.errorOrder}
                                    // helperText={this.state.msgErrorOrder}
faisalhamdi's avatar
faisalhamdi committed
1659 1660 1661
                                >
                                </TextField>
                            </div>
Riri Novita's avatar
Riri Novita committed
1662 1663 1664 1665 1666
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
1667 1668
                                <TextField
                                    style={{ width: '100%' }}
Riri Novita's avatar
Riri Novita committed
1669
                                    id="value"
Riri Novita's avatar
Riri Novita committed
1670
                                    label={"Value"}
Riri Novita's avatar
Riri Novita committed
1671
                                    // get data IDR by IDR mn
Riri Novita's avatar
Riri Novita committed
1672
                                    value={this.state.tempData === null ? '' : this.state.tempData.setting_group === "CURRENCY" ? Number(this.state.tempData.value) * 1000 : this.state.tempData.value}
faisalhamdi's avatar
faisalhamdi committed
1673
                                    inputProps={{
1674
                                        min: 0,
faisalhamdi's avatar
faisalhamdi committed
1675 1676 1677 1678 1679 1680 1681 1682 1683 1684
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
Riri Novita's avatar
Riri Novita committed
1685
                                    name="value"
Deni Rinaldi's avatar
Deni Rinaldi committed
1686 1687 1688 1689
                                    onChange={(e) => {
                                        this.setState({
                                            tempData: {
                                                ...this.state.tempData,
Riri Novita's avatar
Riri Novita committed
1690
                                                value: this.state.tempData.setting_group === "CURRENCY" ? e.target.value / 1000 : e.target.value
Deni Rinaldi's avatar
Deni Rinaldi committed
1691 1692 1693 1694 1695 1696
                                            }
                                        })
                                        this.clearMessage()
                                    }
                                        // this.handleChange(coba, 'value')}
                                    }
Riri Novita's avatar
Riri Novita committed
1697 1698
                                    error={this.state.errorValue}
                                    helperText={this.state.msgErrorValue}
faisalhamdi's avatar
faisalhamdi committed
1699 1700 1701 1702 1703
                                >
                                </TextField>
                            </div>
                        </div>
                        <div className="column-2">
Riri Novita's avatar
Riri Novita committed
1704 1705 1706 1707 1708 1709
                            {this.state.enableReportName == true ?
                                <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                    <Autocomplete
                                        {...this.state.reportName}
                                        debug
                                        id="report"
1710 1711 1712 1713
                                        onChange={(event, newInputValue) => this.setState({ getReportName: newInputValue }, () => {
                                            this.clearMessage()
                                            this.openPopUp()
                                        })}
Riri Novita's avatar
Riri Novita committed
1714 1715 1716 1717 1718
                                        renderInput={(params) =>
                                            <TextField
                                                {...params}
                                                InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
Riri Novita's avatar
Riri Novita committed
1719
                                                label="Type Report"
1720 1721
                                                // error={this.state.errorPerusahaan}
                                                // helperText={this.state.msgErrorPerusahaan}
Riri Novita's avatar
Riri Novita committed
1722 1723 1724
                                            />}
                                        value={this.state.getReportName}
                                    />
Riri Novita's avatar
Riri Novita committed
1725 1726 1727 1728 1729 1730 1731 1732
                                </div>
                                :
                                this.state.enableFormat == true ?
                                    <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                        <Autocomplete
                                            {...this.state.formatCurrency}
                                            debug
                                            id="report"
1733 1734
                                            onChange={(event, newInputValue) => this.setState({ getFormatData: newInputValue }, () =>
                                                this.clearMessage())}
Riri Novita's avatar
Riri Novita committed
1735 1736 1737 1738 1739 1740 1741 1742 1743 1744 1745 1746 1747
                                            renderInput={(params) =>
                                                <TextField
                                                    {...params}
                                                    InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                    InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                                    label="Format"
                                                    error={this.state.errorFormatValue}
                                                    helperText={this.state.msgErrorFormatValue}
                                                />}
                                            value={this.state.getFormatData}
                                        />
                                    </div>
                                    :
1748 1749 1750 1751 1752 1753 1754 1755 1756 1757 1758 1759 1760 1761 1762 1763 1764 1765 1766 1767 1768 1769
                                    this.state.enableThreshold == true ?
                                        <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                            <Autocomplete
                                                {...this.state.thresholdCurrency}
                                                debug
                                                id="report"
                                                onChange={(event, newInputValue) => this.setState({ getThresholdCurrency: newInputValue }, () =>
                                                    this.clearMessage())}
                                                renderInput={(params) =>
                                                    <TextField
                                                        {...params}
                                                        InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                        InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                                        label="Currency"
                                                        error={this.state.errorThresholdCurrency}
                                                        helperText={this.state.msgErrorThresholdCurrency}
                                                    />}
                                                value={this.state.getThresholdCurrency}
                                            />
                                        </div>
                                        :
                                        null
fahrur huzain's avatar
fahrur huzain committed
1770
                            }
Riri Novita's avatar
Riri Novita committed
1771 1772 1773 1774 1775 1776 1777 1778 1779 1780 1781 1782 1783 1784 1785 1786 1787 1788 1789 1790
                            {/* {this.state.enableFormat == true ?
                                <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                    <Autocomplete
                                        {...this.state.formatCurrency}
                                        debug
                                        id="report"
                                        onChange={(event, newInputValue) => this.setState({ getFormatData: newInputValue }, () => this.clearMessage())}
                                        renderInput={(params) =>
                                            <TextField
                                                {...params}
                                                InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                                label="Format"
                                                error={this.state.errorFormatValue}
                                                helperText={this.state.msgErrorFormatValue}
                                            />}
                                        value={this.state.getFormatData}
                                    />
                                </div> : null
                            } */}
Riri Novita's avatar
Riri Novita committed
1791 1792 1793 1794
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
1795
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
1796 1797
                                <TextField
                                    style={{ width: '100%' }}
Riri Novita's avatar
Riri Novita committed
1798 1799 1800
                                    id="min_value"
                                    label="Min Value"
                                    value={this.state.tempData === null ? '' : this.state.tempData.min_value}
faisalhamdi's avatar
faisalhamdi committed
1801
                                    inputProps={{
1802
                                        min: 0,
faisalhamdi's avatar
faisalhamdi committed
1803 1804 1805 1806 1807 1808 1809 1810 1811 1812
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
Riri Novita's avatar
Riri Novita committed
1813
                                    name="min_value"
Deni Rinaldi's avatar
Deni Rinaldi committed
1814
                                    onChange={(e) => {
Riri Novita's avatar
Riri Novita committed
1815
                                        // let coba = String(e.target.value).replace(/[^\d]/g, '');
Deni Rinaldi's avatar
Deni Rinaldi committed
1816 1817 1818
                                        this.setState({
                                            tempData: {
                                                ...this.state.tempData,
Riri Novita's avatar
Riri Novita committed
1819
                                                min_value: e.target.value
Deni Rinaldi's avatar
Deni Rinaldi committed
1820 1821
                                            }
                                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
1822 1823
                                        this.clearMessage()
                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
1824 1825
                                        // this.handleChange(coba, 'value')}
                                    }
Riri Novita's avatar
Riri Novita committed
1826 1827
                                    error={this.state.errorMinValue}
                                    helperText={this.state.msgErrorMinValue}
faisalhamdi's avatar
faisalhamdi committed
1828 1829 1830
                                >
                                </TextField>
                            </div>
Riri Novita's avatar
Riri Novita committed
1831 1832 1833
                        </div>
                        <div className="column-2">
                            <div style={{ padding: 10, borderRadius: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
1834 1835
                                <TextField
                                    style={{ width: '100%' }}
1836
                                    id="max_value"
faisalhamdi's avatar
faisalhamdi committed
1837
                                    label="Max Value"
1838
                                    value={this.state.tempData === null ? '' : this.state.tempData.max_value}
faisalhamdi's avatar
faisalhamdi committed
1839
                                    inputProps={{
1840
                                        min: 0,
faisalhamdi's avatar
faisalhamdi committed
1841 1842 1843 1844 1845 1846 1847 1848 1849 1850
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
1851
                                    name="max_value"
Deni Rinaldi's avatar
Deni Rinaldi committed
1852
                                    onChange={(e) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
1853
                                        // let coba = String(e.target.value).replace(/[^\d]/g, '');
Deni Rinaldi's avatar
Deni Rinaldi committed
1854 1855 1856
                                        this.setState({
                                            tempData: {
                                                ...this.state.tempData,
Deni Rinaldi's avatar
Deni Rinaldi committed
1857
                                                max_value: e.target.value
Deni Rinaldi's avatar
Deni Rinaldi committed
1858 1859 1860 1861 1862 1863
                                            }
                                        })
                                        this.clearMessage()
                                    }
                                        // this.handleChange(coba, 'value')}
                                    }
1864 1865
                                    error={this.state.errorMaxValue}
                                    helperText={this.state.msgErrorMaxValue}
faisalhamdi's avatar
faisalhamdi committed
1866 1867 1868
                                >
                                </TextField>
                            </div>
Riri Novita's avatar
Riri Novita committed
1869 1870 1871 1872 1873
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
1874 1875
                                <DatePicker
                                    margin="normal"
Riri Novita's avatar
Riri Novita committed
1876 1877
                                    id="start_date"
                                    label="Valid From"
Deni Rinaldi's avatar
Deni Rinaldi committed
1878
                                    format="dd-MM-yyyy"
Riri Novita's avatar
Riri Novita committed
1879 1880 1881 1882
                                    value={this.state.tempData === null ? '' : this.state.tempData.start_date}
                                    error={this.state.errorStartDate}
                                    helperText={this.state.msgErrorStartDate}
                                    onChange={(e) => this.handleChange(e, 'start_date')}
1883 1884 1885
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}
faisalhamdi's avatar
faisalhamdi committed
1886 1887 1888 1889 1890 1891 1892 1893 1894 1895 1896
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
1897 1898
                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
faisalhamdi's avatar
faisalhamdi committed
1899 1900
                            </div>
                        </div>
Riri Novita's avatar
Riri Novita committed
1901 1902 1903 1904 1905 1906 1907 1908 1909 1910 1911 1912 1913 1914 1915 1916 1917 1918 1919 1920 1921 1922 1923 1924 1925 1926 1927 1928 1929 1930 1931 1932 1933 1934 1935 1936 1937 1938 1939 1940 1941 1942 1943 1944 1945 1946 1947 1948 1949 1950 1951 1952 1953 1954 1955 1956 1957 1958 1959 1960 1961 1962 1963 1964 1965 1966 1967 1968
                        <div className="column-2">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                <DatePicker
                                    margin="normal"
                                    id="end_date"
                                    label="Valid To"
                                    format="dd-MM-yyyy"
                                    error={this.state.errorEndDate}
                                    helperText={this.state.msgErrorEndDate}
                                    minDate={this.state.tempData === null ? null : this.state.tempData.start_date}
                                    value={this.state.tempData === null ? '' : this.state.tempData.end_date}
                                    onChange={(e) => this.handleChange(e, 'end_date')}
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
                            <div className="" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    id="status"
                                    label="Status"
                                    value={this.state.tempData === null ? '' : this.state.tempData.status}
                                    disabled
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
                                />
                            </div>
                        </div>
                        <div className="column-2">

                        </div>
                    </div>

                    <div className="border-bottom margin-top-10px" style={{ padding: '0px 20px 20px 20px', borderRadius: 5 }}>
                        <div style={{ display: 'flex' }}>
                            <Typography style={{ fontSize: 11, width: '12%' }}>Created By</Typography>
                            <Typography style={{ fontSize: 11 }}>: {this.state.tempData === null ? "" : this.state.tempData.created}</Typography>
                        </div>
                        <div style={{ display: 'flex' }}>
                            <Typography style={{ fontSize: 11, width: '12%' }}>Updated By</Typography>
                            <Typography style={{ fontSize: 11 }}>: {this.state.tempData === null ? "" : this.state.tempData.updated === null ? "" : this.state.tempData.updated}</Typography>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
1969 1970
                    </div>

faisalhamdi's avatar
faisalhamdi committed
1971 1972
                    <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1" style={{ alignSelf: 'center' }}>
1973 1974 1975 1976 1977
                            <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' }}>
a.bairuha's avatar
a.bairuha committed
1978
                                    <span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
1979 1980
                                </div>
                            </button>
faisalhamdi's avatar
faisalhamdi committed
1981 1982
                        </div>
                        <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
1983 1984
                            <button
                                type="button"
1985
                                onClick={() => this.validasiCreate()}
1986 1987
                            >
                                <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
a.bairuha's avatar
a.bairuha committed
1988
                                    <span style={{ color: '#fff', fontSize: 11 }}>Save</span>
1989 1990
                                </div>
                            </button>
faisalhamdi's avatar
faisalhamdi committed
1991 1992 1993
                        </div>
                    </div>
                </div>
1994 1995 1996 1997 1998 1999
                {this.state.visiblePopupInformation && (
                    <PopUpInformation
                        onClickClose={() => this.setState({ visiblePopupInformation: false })}
                        reportName={this.state.getReportName.setting_type_name}
                    />
                )}
faisalhamdi's avatar
faisalhamdi committed
2000 2001 2002 2003 2004 2005
            </div>
        )
    }

    renderCreate() {
        return (
2006
            <div className="test app-popup-show">
faisalhamdi's avatar
faisalhamdi committed
2007
                <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
2008
                    <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
faisalhamdi's avatar
faisalhamdi committed
2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2019
                        <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                            <div className="popup-title">
                                <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Create 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()}
                            >
Deni Rinaldi's avatar
Deni Rinaldi committed
2020
                                <img src={Images.close} />
faisalhamdi's avatar
faisalhamdi committed
2021 2022 2023 2024
                            </button>
                        </div>
                    </div>

Riri Novita's avatar
Riri Novita committed
2025
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '20px 20px 0px' }}>
faisalhamdi's avatar
faisalhamdi committed
2026
                        <div className="column-1">
2027
                            <div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
2028 2029
                                <TextField
                                    style={{ width: '100%' }}
2030 2031 2032 2033
                                    value={this.state.tempData === null ? '' : this.state.tempData.setting_id}
                                    id="id"
                                    label="ID"
                                    disabled
faisalhamdi's avatar
faisalhamdi committed
2034 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
2045
                                />
faisalhamdi's avatar
faisalhamdi committed
2046
                            </div>
Riri Novita's avatar
Riri Novita committed
2047 2048 2049 2050 2051 2052 2053
                        </div>
                        <div className="column-2">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                <Autocomplete
                                    {...this.state.types}
                                    debug
                                    id="tipe"
2054
                                    onChange={(event, newInputValue) => this.setState({ getTypes: newInputValue }, () => newInputValue === null ? this.setState({ enableParameter: false, enableReportName: false, enableFormat: false, enableThreshold: false, getParameter: null, getReportName: null }, () => this.clearMessage()) : this.getParameterByGroup(newInputValue.setting_group_id, newInputValue.setting_group_name), this.clearMessage())}
Riri Novita's avatar
Riri Novita committed
2055 2056 2057 2058 2059 2060 2061 2062 2063 2064 2065 2066 2067 2068 2069 2070
                                    renderInput={(params) =>
                                        <TextField
                                            {...params}
                                            InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                            InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                            label="Group"
                                            error={this.state.errorGroup}
                                            helperText={this.state.msgErrorGroup}
                                        />}
                                    value={this.state.getTypes}
                                />
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
Riri Novita's avatar
Riri Novita committed
2071
                            <div style={{ padding: 10, borderRadius: 5 }}>
2072 2073 2074 2075 2076
                                <Autocomplete
                                    {...this.state.parameter}
                                    debug
                                    disabled={!this.state.enableParameter}
                                    id="tipe"
Deni Rinaldi's avatar
Deni Rinaldi committed
2077
                                    onChange={(event, newInputValue) => this.setState({ getParameter: newInputValue }, () => this.clearMessage())}
Deni Rinaldi's avatar
Deni Rinaldi committed
2078 2079 2080 2081 2082 2083 2084 2085 2086
                                    renderInput={(params) =>
                                        <TextField
                                            {...params}
                                            InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                            InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                            label="Parameter"
                                            error={this.state.errorParameter}
                                            helperText={this.state.msgErrorParameter}
                                        />}
2087 2088 2089
                                    value={this.state.getParameter}
                                />
                            </div>
Riri Novita's avatar
Riri Novita committed
2090 2091 2092 2093 2094 2095 2096 2097 2098 2099 2100 2101 2102 2103 2104 2105 2106 2107 2108 2109 2110 2111 2112 2113 2114
                        </div>
                        <div className="column-2">
                            <div style={{ padding: 10, borderRadius: 5 }}>
                                <Autocomplete
                                    {...this.state.perusahaan}
                                    debug
                                    id="tipe"
                                    onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, () => this.clearMessage())}
                                    renderInput={(params) =>
                                        <TextField
                                            {...params}
                                            InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                            InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                            label="Company Name"
                                            error={this.state.errorPerusahaan}
                                            helperText={this.state.msgErrorPerusahaan}
                                        />}
                                    value={this.state.getPerusahaan}
                                />
                            </div>
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
2115 2116
                                <TextField
                                    style={{ width: '100%' }}
2117 2118 2119
                                    id="description"
                                    label="Description"
                                    value={this.state.description === '' ? '' : this.state.description}
faisalhamdi's avatar
faisalhamdi committed
2120 2121 2122 2123 2124 2125 2126 2127 2128 2129 2130
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
2131 2132
                                    name="description"
                                    onChange={(e) => this.handleChangeCreate(e, '')}
faisalhamdi's avatar
faisalhamdi committed
2133 2134 2135
                                >
                                </TextField>
                            </div>
Riri Novita's avatar
Riri Novita committed
2136 2137 2138
                        </div>
                        <div className="column-2">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
2139 2140
                                <TextField
                                    style={{ width: '100%' }}
Riri Novita's avatar
Riri Novita committed
2141 2142 2143
                                    id="order"
                                    label="Order"
                                    value={this.state.order === null ? '' : this.state.order}
faisalhamdi's avatar
faisalhamdi committed
2144
                                    inputProps={{
2145
                                        min: 0,
faisalhamdi's avatar
faisalhamdi committed
2146 2147 2148 2149 2150 2151 2152 2153 2154 2155
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
Riri Novita's avatar
Riri Novita committed
2156
                                    name="order"
Deni Rinaldi's avatar
Deni Rinaldi committed
2157
                                    onChange={(e) => {
Riri Novita's avatar
Riri Novita committed
2158
                                        let coba = String(e.target.value).replace(/[^\d]/g, '');
Deni Rinaldi's avatar
Deni Rinaldi committed
2159
                                        this.setState({
Riri Novita's avatar
Riri Novita committed
2160
                                            order: coba
Deni Rinaldi's avatar
Deni Rinaldi committed
2161
                                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
2162 2163
                                        this.clearMessage()
                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
2164 2165
                                        // this.handleChange(coba, 'value')}
                                    }
2166 2167
                                    // error={this.state.errorOrder}
                                    // helperText={this.state.msgErrorOrder}
faisalhamdi's avatar
faisalhamdi committed
2168 2169 2170
                                >
                                </TextField>
                            </div>
Riri Novita's avatar
Riri Novita committed
2171 2172 2173 2174 2175
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
2176 2177
                                <TextField
                                    style={{ width: '100%' }}
Riri Novita's avatar
Riri Novita committed
2178
                                    id="value"
Riri Novita's avatar
Riri Novita committed
2179
                                    label={"Value"}
Riri Novita's avatar
Riri Novita committed
2180
                                    value={this.state.value}
faisalhamdi's avatar
faisalhamdi committed
2181
                                    inputProps={{
2182
                                        min: 0,
faisalhamdi's avatar
faisalhamdi committed
2183 2184 2185 2186 2187 2188 2189 2190 2191 2192
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
Riri Novita's avatar
Riri Novita committed
2193
                                    name="value"
Deni Rinaldi's avatar
Deni Rinaldi committed
2194 2195
                                    onChange={(e) => {
                                        this.setState({
Riri Novita's avatar
Riri Novita committed
2196
                                            value: e.target.value
Deni Rinaldi's avatar
Deni Rinaldi committed
2197
                                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
2198 2199
                                        this.clearMessage()
                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
2200 2201
                                        // this.handleChange(coba, 'value')}
                                    }
Riri Novita's avatar
Riri Novita committed
2202 2203
                                    error={this.state.errorValue}
                                    helperText={this.state.msgErrorValue}
faisalhamdi's avatar
faisalhamdi committed
2204 2205 2206 2207 2208
                                >
                                </TextField>
                            </div>
                        </div>
                        <div className="column-2">
Riri Novita's avatar
Riri Novita committed
2209 2210 2211 2212 2213 2214
                            {this.state.enableReportName == true ?
                                <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                    <Autocomplete
                                        {...this.state.reportName}
                                        debug
                                        id="report"
2215 2216
                                        onChange={(event, newInputValue) => this.setState({ getReportName: newInputValue }, () => {
                                            this.clearMessage()
2217 2218
                                            this.openPopUp()
                                        })}
Riri Novita's avatar
Riri Novita committed
2219 2220 2221 2222 2223 2224 2225 2226 2227 2228 2229 2230 2231 2232 2233 2234 2235 2236 2237 2238 2239 2240 2241 2242 2243 2244 2245 2246 2247 2248 2249 2250 2251
                                        renderInput={(params) =>
                                            <TextField
                                                {...params}
                                                InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                                label="Type Report"
                                                error={this.state.errorReportName}
                                                helperText={this.state.msgErrorReportName}
                                            />}
                                        value={this.state.getReportName}
                                    />
                                </div>
                                :
                                this.state.enableFormat == true ?
                                    <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                        <Autocomplete
                                            {...this.state.formatCurrency}
                                            debug
                                            id="report"
                                            onChange={(event, newInputValue) => this.setState({ getFormatData: newInputValue }, () => this.clearMessage())}
                                            renderInput={(params) =>
                                                <TextField
                                                    {...params}
                                                    InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                    InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                                    label="Format"
                                                    error={this.state.errorFormatValue}
                                                    helperText={this.state.msgErrorFormatValue}
                                                />}
                                            value={this.state.getFormatData}
                                        />
                                    </div>
                                    :
2252 2253 2254 2255 2256 2257 2258 2259 2260 2261 2262 2263 2264 2265 2266 2267 2268 2269 2270 2271 2272
                                    this.state.enableThreshold == true ?
                                        <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                            <Autocomplete
                                                {...this.state.thresholdCurrency}
                                                debug
                                                id="report"
                                                onChange={(event, newInputValue) => this.setState({ getThresholdCurrency: newInputValue }, () => this.clearMessage())}
                                                renderInput={(params) =>
                                                    <TextField
                                                        {...params}
                                                        InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
                                                        InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
                                                        label="Currency"
                                                        error={this.state.errorThresholdCurrency}
                                                        helperText={this.state.msgErrorThresholdCurrency}
                                                    />}
                                                value={this.state.getThresholdCurrency}
                                            />
                                        </div>
                                        :
                                        null
Riri Novita's avatar
Riri Novita committed
2273
                            }
Riri Novita's avatar
Riri Novita committed
2274

Riri Novita's avatar
Riri Novita committed
2275 2276 2277 2278
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
2279
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
2280 2281
                                <TextField
                                    style={{ width: '100%' }}
Riri Novita's avatar
Riri Novita committed
2282 2283 2284
                                    id="min_value"
                                    label="Min Value"
                                    value={this.state.minValue}
faisalhamdi's avatar
faisalhamdi committed
2285
                                    inputProps={{
2286
                                        min: 0,
faisalhamdi's avatar
faisalhamdi committed
2287 2288 2289 2290 2291 2292 2293 2294 2295 2296
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
Riri Novita's avatar
Riri Novita committed
2297
                                    name="minValue"
Deni Rinaldi's avatar
Deni Rinaldi committed
2298
                                    onChange={(e) => {
Riri Novita's avatar
Riri Novita committed
2299
                                        // let coba = String(e.target.value).replace(/[^\d]/g, '');
Deni Rinaldi's avatar
Deni Rinaldi committed
2300
                                        this.setState({
Riri Novita's avatar
Riri Novita committed
2301
                                            minValue: e.target.value
Deni Rinaldi's avatar
Deni Rinaldi committed
2302
                                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
2303 2304
                                        this.clearMessage()
                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
2305 2306
                                        // this.handleChange(coba, 'value')}
                                    }
Riri Novita's avatar
Riri Novita committed
2307 2308
                                    error={this.state.errorMinValue}
                                    helperText={this.state.msgErrorMinValue}
2309

faisalhamdi's avatar
faisalhamdi committed
2310 2311 2312
                                >
                                </TextField>
                            </div>
Riri Novita's avatar
Riri Novita committed
2313 2314 2315
                        </div>
                        <div className="column-2">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
faisalhamdi's avatar
faisalhamdi committed
2316 2317
                                <TextField
                                    style={{ width: '100%' }}
2318
                                    id="max_value"
faisalhamdi's avatar
faisalhamdi committed
2319
                                    label="Max Value"
2320
                                    value={this.state.maxValue}
faisalhamdi's avatar
faisalhamdi committed
2321
                                    inputProps={{
2322
                                        min: 0,
faisalhamdi's avatar
faisalhamdi committed
2323 2324 2325 2326 2327 2328 2329 2330 2331 2332
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
2333
                                    name="maxValue"
Deni Rinaldi's avatar
Deni Rinaldi committed
2334
                                    onChange={(e) => {
Deni Rinaldi's avatar
Deni Rinaldi committed
2335
                                        // let coba = String(e.target.value).replace(/[^\d]/g, '');
Deni Rinaldi's avatar
Deni Rinaldi committed
2336
                                        this.setState({
Deni Rinaldi's avatar
Deni Rinaldi committed
2337
                                            maxValue: e.target.value
Deni Rinaldi's avatar
Deni Rinaldi committed
2338
                                        })
Deni Rinaldi's avatar
Deni Rinaldi committed
2339 2340
                                        this.clearMessage()
                                    }
Deni Rinaldi's avatar
Deni Rinaldi committed
2341 2342
                                        // this.handleChange(coba, 'value')}
                                    }
2343
                                    error={this.state.errorMaxValue}
Riri Novita's avatar
Riri Novita committed
2344
                                    helperText={this.state.msgErrorMaxValue}
faisalhamdi's avatar
faisalhamdi committed
2345 2346 2347
                                >
                                </TextField>
                            </div>
Riri Novita's avatar
Riri Novita committed
2348 2349 2350 2351 2352 2353 2354 2355 2356 2357 2358 2359 2360 2361 2362 2363 2364 2365 2366 2367 2368 2369 2370 2371 2372 2373 2374 2375 2376 2377 2378 2379 2380 2381
                        </div>
                    </div>
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
                                <DatePicker
                                    margin="normal"
                                    id="startDate"
                                    label="Valid From"
                                    format="dd-MM-yyyy"
                                    error={this.state.errorStartDate}
                                    helperText={this.state.msgErrorStartDate}
                                    value={this.state.startDate == "" ? null : this.state.startDate}
                                    onChange={(e) => this.handleChangeCreate(e, 'start_date')}
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
                            </div>
                        </div>
                        <div className="column-2">
                            <div className="" style={{ padding: 10, borderRadius: 5 }}>
2382 2383 2384
                                <DatePicker
                                    margin="normal"
                                    id="endDate"
Deni Rinaldi's avatar
Deni Rinaldi committed
2385
                                    label="Valid To"
Deni Rinaldi's avatar
Deni Rinaldi committed
2386
                                    format="dd-MM-yyyy"
2387 2388 2389 2390 2391 2392 2393 2394
                                    error={this.state.errorEndDate}
                                    helperText={this.state.msgErrorEndDate}
                                    minDate={this.state.startDate}
                                    value={this.state.endDate == "" ? null : this.state.endDate}
                                    onChange={(e) => this.handleChangeCreate(e, 'end_date')}
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}
faisalhamdi's avatar
faisalhamdi committed
2395 2396 2397 2398 2399 2400 2401 2402 2403 2404 2405
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
2406 2407
                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
faisalhamdi's avatar
faisalhamdi committed
2408 2409 2410
                            </div>
                        </div>
                    </div>
Riri Novita's avatar
Riri Novita committed
2411 2412 2413 2414 2415 2416 2417 2418 2419 2420 2421 2422 2423 2424 2425 2426 2427 2428 2429 2430 2431 2432 2433 2434 2435 2436 2437 2438 2439 2440 2441 2442
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: '5px 20px' }}>
                        <div className="column-1">
                            <div className="" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    defaultValue={"Active"}
                                    id="status"
                                    label="Status"
                                    disabled
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
                                />
                            </div>

                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                <Typography style={{ fontSize: 11, width: '25%' }}>Created By	: </Typography>
                                <Typography style={{ fontSize: 11, width: '25%' }}>Updated By	: </Typography>
                            </div>
                        </div>
                        <div className="column-2">

                        </div>
                    </div>
faisalhamdi's avatar
faisalhamdi committed
2443 2444 2445

                    <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1" style={{ alignSelf: 'center' }}>
2446 2447 2448 2449 2450
                            <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' }}>
a.bairuha's avatar
a.bairuha committed
2451
                                    <span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
2452 2453
                                </div>
                            </button>
faisalhamdi's avatar
faisalhamdi committed
2454 2455
                        </div>
                        <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
2456 2457
                            <button
                                type="button"
2458
                                onClick={() => this.validasiCreate()}
2459 2460
                            >
                                <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
2461
                                    <span style={{ color: '#fff', fontSize: 11 }}>Save</span>
2462 2463
                                </div>
                            </button>
faisalhamdi's avatar
faisalhamdi committed
2464 2465 2466
                        </div>
                    </div>
                </div>
2467 2468 2469 2470 2471 2472
                {this.state.visiblePopupInformation && (
                    <PopUpInformation
                        onClickClose={() => this.setState({ visiblePopupInformation: false })}
                        reportName={this.state.getReportName.setting_type_name}
                    />
                )}
faisalhamdi's avatar
faisalhamdi committed
2473 2474 2475 2476
            </div>
        )
    }
}