CreateUnitBisnis.js 26 KB
Newer Older
Deni Rinaldi's avatar
Deni Rinaldi committed
1
import React, { Component } from 'react';
Deni Rinaldi's avatar
Deni Rinaldi committed
2
import { TextField, Typography, withStyles, Snackbar } from '@material-ui/core';
Deni Rinaldi's avatar
Deni Rinaldi committed
3 4 5
import * as R from 'ramda'
import { DateTimePicker, KeyboardDatePicker, DatePicker } from "@material-ui/pickers";
import format from "date-fns/format";
d.arizona's avatar
d.arizona committed
6
import Images from '../../../assets/Images';
7
import api from '../../../api';
Deni Rinaldi's avatar
Deni Rinaldi committed
8
import MuiAlert from '@material-ui/lab/Alert';
a.bairuha's avatar
a.bairuha committed
9
import Constant from '../../../library/Constant';
Deni Rinaldi's avatar
Deni Rinaldi committed
10 11 12

const Alert = withStyles({
})((props) => <MuiAlert elevation={6} variant="filled" {...props} />);
Deni Rinaldi's avatar
Deni Rinaldi committed
13 14

export default class CreateUnitBisnis extends Component {
Deni Rinaldi's avatar
Deni Rinaldi committed
15 16 17 18
    constructor(props) {
        super(props)
        this.state = {
            id: '',
Deni Rinaldi's avatar
Deni Rinaldi committed
19
            status: "",
Deni Rinaldi's avatar
Deni Rinaldi committed
20 21
            name: '',
            startDate: '',
22 23 24 25 26 27
            endDate: '',
            errorName: false,
            errorStartDate: false,
            errorEndDate: false,
            msgErrorName: "",
            msgErrorStartDate: "",
Deni Rinaldi's avatar
Deni Rinaldi committed
28 29 30 31
            msgErrorEndDate: "",
            alert: false,
            tipeAlert: '',
            messageAlert: '',
Deni Rinaldi's avatar
Deni Rinaldi committed
32 33
        }
    }
Deni Rinaldi's avatar
Deni Rinaldi committed
34
    render() {
Deni Rinaldi's avatar
Deni Rinaldi committed
35 36 37 38
        let { type } = this.props
        return type === 'edit' ? this.renderEdit() : this.renderCreate()
    }

39
    componentDidMount() {
Deni Rinaldi's avatar
Deni Rinaldi committed
40
        if (this.props.type === 'edit') {
41
            this.getDetailUnitBisnis()
Deni Rinaldi's avatar
Deni Rinaldi committed
42
            // console.log(this.props.data);
43 44 45 46 47 48 49 50
            // this.setState({
            //     id: data[0],
            //     name: data[1],
            //     startDate: data[2],
            //     endDate: data[3]
            // })
        } else {
            let date = format(new Date, 'yyyy-MM-dd')
Deni Rinaldi's avatar
Deni Rinaldi committed
51
            // console.log(date);
Deni Rinaldi's avatar
Deni Rinaldi committed
52
            this.setState({
53 54
                startDate: date,
                endDate: date
Deni Rinaldi's avatar
Deni Rinaldi committed
55 56 57 58
            })
        }
    }

59 60
    getDetailUnitBisnis() {
        api.create().getDetailUnitBisnis(this.props.data[1]).then(response => {
Deni Rinaldi's avatar
Deni Rinaldi committed
61
            // console.log(response)
62
            if (response.data) {
a.bairuha's avatar
a.bairuha committed
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77
                if (response.ok) {
                    if (response.data.status === "success") {
                        let data = response.data.data
                        this.setState({
                            id: data.business_unit_id,
                            name: data.business_unit_name,
                            startDate: data.start_date,
                            endDate: data.end_date,
                            status: data.status,
                            created: data.created,
                            updated: data.updated === null ? "" : data.updated
                        })
                    }
                    else {
                        this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'warning' }, () => {
a.bairuha's avatar
a.bairuha committed
78
                            if (response.data.message.includes("Someone Logged In")) {
a.bairuha's avatar
a.bairuha committed
79 80 81 82 83 84 85 86 87
                                setTimeout(() => {
                                    localStorage.removeItem(Constant.TOKEN)
                                    window.location.reload();
                                }, 1000);
                            }
                        })
                    }
                } else {
                    this.setState({ alert: true, messageAlert: response.data.message, tipeAlert: 'error' })
Deni Rinaldi's avatar
Deni Rinaldi committed
88
                }
Deni Rinaldi's avatar
Deni Rinaldi committed
89 90
            } else {
                this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error' })
91 92 93 94
            }
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
95 96 97 98
    handleChange(e, type) {
        let data = this.state
        let isDate = type !== '' ? true : false
        if (isDate && type == 'start_date') {
99 100
            this.setState({ startDate: format(e, 'yyyy-MM-dd'), endDate: null }, () => {
                this.clearError()
Deni Rinaldi's avatar
Deni Rinaldi committed
101
                // console.log(this.state.startDate)
Deni Rinaldi's avatar
Deni Rinaldi committed
102 103 104
            })
        } else if (isDate && type == 'end_date') {
            this.setState({ endDate: format(e, 'yyyy-MM-dd') }, () => {
105
                this.clearError()
Deni Rinaldi's avatar
Deni Rinaldi committed
106
                // console.log(this.state.endDate)
Deni Rinaldi's avatar
Deni Rinaldi committed
107 108 109 110 111 112 113
            })
        } else {
            // this.setState({...data, tempData: {...this.state.tempData, [e.target.name] :  e.target.value}})
        }

    }

114 115 116 117 118 119 120 121 122 123 124
    clearError() {
        this.setState({
            errorName: false,
            errorStartDate: false,
            errorEndDate: false,
            msgErrorName: "",
            msgErrorStartDate: "",
            msgErrorEndDate: ""
        })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
125
    validasi() {
126
        if (R.isEmpty(this.state.name)) {
EKSAD's avatar
EKSAD committed
127
            this.setState({ errorName: true, msgErrorName: 'Business Unit Cannot be Empty' })
128
        } else if (R.isEmpty(this.state.startDate)) {
EKSAD's avatar
EKSAD committed
129
            this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty' })
130
        } else if (R.isEmpty(this.state.endDate) || this.state.endDate === null) {
EKSAD's avatar
EKSAD committed
131
            this.setState({ errorEndDate: true, msgErrorEndDate: 'Valid To Cannot be Empty' })
132
        } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
133 134 135 136 137 138 139
            let payload = {
                "business_unit_id": this.state.id,
                "business_unit_name": this.state.name,
                "start_date": this.state.startDate,
                "end_date": this.state.endDate
            }
            this.props.updateUnitBisnis(payload)
140 141 142 143 144
        }
    }

    validasiCreate() {
        if (R.isEmpty(this.state.name)) {
EKSAD's avatar
EKSAD committed
145
            this.setState({ errorName: true, msgErrorName: 'Business Unit Cannot be Empty' })
146
        } else if (R.isNil(this.state.startDate)) {
EKSAD's avatar
EKSAD committed
147
            this.setState({ errorStartDate: true, msgErrorStartDate: 'Valid From Cannot be Empty' })
148
        } else if (R.isNil(this.state.endDate)) {
EKSAD's avatar
EKSAD committed
149
            this.setState({ errorEndDate: true, msgErrorEndDate: 'Valid To Cannot be Empty' })
150
        } else {
Deni Rinaldi's avatar
Deni Rinaldi committed
151 152 153 154 155 156 157
            let payload = {
                "business_unit_name": this.state.name,
                "start_date": this.state.startDate,
                "end_date": this.state.endDate
            }
            this.props.createUnitBisnis(payload)
        }
158 159
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
160 161 162 163
    closeAlert() {
        this.setState({ alert: false })
    }

Deni Rinaldi's avatar
Deni Rinaldi committed
164
    renderEdit() {
Deni Rinaldi's avatar
Deni Rinaldi committed
165
        return (
166
            <div className="test app-popup-show">
Deni Rinaldi's avatar
Deni Rinaldi committed
167 168 169 170 171
                <Snackbar open={this.state.alert} autoHideDuration={6000} onClose={() => this.closeAlert()}>
                    <Alert onClose={() => this.closeAlert()} severity={this.state.tipeAlert}>
                        {this.state.messageAlert}
                    </Alert>
                </Snackbar>
Deni Rinaldi's avatar
Deni Rinaldi committed
172
                <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
173
                    <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
174
                        <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
175
                            <div className="popup-title">
Deni Rinaldi's avatar
Deni Rinaldi committed
176
                                <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Edit Data</span>
Deni Rinaldi's avatar
Deni Rinaldi committed
177 178
                            </div>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
179
                        <div className="col-2 content-right" style={{ maxWidth: "inherit", alignSelf: 'center' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
180 181
                            <button
                                type="button"
Deni Rinaldi's avatar
Deni Rinaldi committed
182 183
                                className="btn btn-circle btn-white"
                                onClick={() => this.props.onClickClose()}
Deni Rinaldi's avatar
Deni Rinaldi committed
184
                            >
185
                                <img src={Images.close} />
Deni Rinaldi's avatar
Deni Rinaldi committed
186 187 188 189 190
                            </button>
                        </div>
                    </div>


Deni Rinaldi's avatar
Deni Rinaldi committed
191
                    <div className="grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
192
                        <div className="column-1">
193
                            <div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
194 195
                                <TextField
                                    style={{ width: '100%' }}
196 197
                                    value={this.state.id}
                                    id="id"
Deni Rinaldi's avatar
Deni Rinaldi committed
198 199
                                    label="ID"
                                    disabled
200 201 202 203 204 205 206 207 208 209 210
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
Deni Rinaldi's avatar
Deni Rinaldi committed
211 212
                                />
                            </div>
213
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
214 215 216
                                <DatePicker
                                    margin="normal"
                                    id="startDate"
Deni Rinaldi's avatar
Deni Rinaldi committed
217
                                    label="Valid From"
Deni Rinaldi's avatar
Deni Rinaldi committed
218
                                    format="dd-MM-yyyy"
Deni Rinaldi's avatar
Deni Rinaldi committed
219 220 221 222 223
                                    value={this.state.startDate}
                                    onChange={(e) => this.handleChange(e, 'start_date')}
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}
224 225 226 227 228 229 230 231 232 233 234
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
235 236
                                    error={this.state.errorStartDate}
                                    helperText={this.state.msgErrorStartDate}
Deni Rinaldi's avatar
Deni Rinaldi committed
237 238
                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
239
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
240

241
                            <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
242 243
                                <TextField
                                    style={{ width: '100%' }}
244
                                    value={this.state.status}
Deni Rinaldi's avatar
Deni Rinaldi committed
245 246 247
                                    id="status"
                                    label="Status"
                                    disabled
248 249 250 251 252 253 254 255 256 257 258
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
Deni Rinaldi's avatar
Deni Rinaldi committed
259 260
                                />
                            </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
261 262 263
                        </div>

                        <div className="column-2">
264
                            <div style={{ padding: 10, borderRadius: 5 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
265 266 267 268
                                <TextField
                                    style={{ width: '100%' }}
                                    id="unit"
                                    label="Unit Bisnis"
Deni Rinaldi's avatar
Deni Rinaldi committed
269
                                    value={this.state.name}
270 271 272 273 274 275 276 277 278 279 280
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
281 282 283
                                    error={this.state.errorName}
                                    helperText={this.state.msgErrorName}
                                    onChange={(e) => this.setState({ name: e.target.value }, () => this.clearError())}
Deni Rinaldi's avatar
Deni Rinaldi committed
284 285 286
                                >
                                </TextField>
                            </div>
287
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
288 289 290
                                <DatePicker
                                    margin="normal"
                                    id="startDate"
Deni Rinaldi's avatar
Deni Rinaldi committed
291
                                    label="Valid To"
Deni Rinaldi's avatar
Deni Rinaldi committed
292
                                    format="dd-MM-yyyy"
293 294 295
                                    error={this.state.errorEndDate}
                                    helperText={this.state.msgErrorEndDate}
                                    minDate={this.state.startDate}
Deni Rinaldi's avatar
Deni Rinaldi committed
296 297 298 299 300
                                    value={this.state.endDate}
                                    onChange={(e) => this.handleChange(e, 'end_date')}
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}
301 302 303 304 305 306 307 308 309 310 311
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
Deni Rinaldi's avatar
Deni Rinaldi committed
312 313
                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
314 315 316 317 318
                            </div>
                        </div>

                    </div>

Deni Rinaldi's avatar
Deni Rinaldi committed
319 320 321 322 323 324 325 326 327 328 329
                    <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.created}</Typography>
                        </div>
                        <div style={{ display: 'flex' }}>
                            <Typography style={{ fontSize: 11, width: '12%' }}>Updated By</Typography>
                            <Typography style={{ fontSize: 11 }}>: {this.state.updated}</Typography>
                        </div>
                    </div>

Deni Rinaldi's avatar
Deni Rinaldi committed
330 331
                    <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1" style={{ alignSelf: 'center' }}>
332 333 334 335 336
                            <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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
337
                                    <span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
338 339
                                </div>
                            </button>
Deni Rinaldi's avatar
Deni Rinaldi committed
340 341
                        </div>
                        <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
342 343 344 345 346
                            <button
                                type="button"
                                onClick={() => this.validasi()}
                            >
                                <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
347
                                    <span style={{ color: '#fff', fontSize: 11 }}>Save</span>
Deni Rinaldi's avatar
Deni Rinaldi committed
348 349
                                </div>
                            </button>
Deni Rinaldi's avatar
Deni Rinaldi committed
350 351 352 353 354 355 356 357 358 359 360
                        </div>
                    </div>
                </div>
            </div>
        )
    }

    renderCreate() {
        return (
            <div className="test app-popup-show" style={{ paddingTop: 100 }}>
                <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
361
                    <div className="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
362 363 364 365 366 367 368 369 370 371 372
                        <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()}
                            >
373
                                <img src={Images.close} />
Deni Rinaldi's avatar
Deni Rinaldi committed
374 375 376 377 378 379 380
                            </button>
                        </div>
                    </div>


                    <div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
                        <div className="column-1">
Deni Rinaldi's avatar
Deni Rinaldi committed
381
                            <div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
382 383
                                <TextField
                                    style={{ width: '100%' }}
Deni Rinaldi's avatar
Deni Rinaldi committed
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404
                                    // value={this.props.data.business_unit_id}
                                    id="status"
                                    label="ID"
                                    disabled
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
                                />
                            </div>
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                <DatePicker
                                    margin="normal"
                                    id="startDate"
Deni Rinaldi's avatar
Deni Rinaldi committed
405
                                    label="Valid From"
Deni Rinaldi's avatar
Deni Rinaldi committed
406
                                    format="dd-MM-yyyy"
Deni Rinaldi's avatar
Deni Rinaldi committed
407 408 409 410 411
                                    value={this.state.startDate == "" ? null : this.state.startDate}
                                    onChange={(e) => this.handleChange(e, 'start_date')}
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}
412 413 414 415 416 417 418 419 420 421 422
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
423 424
                                    error={this.state.errorStartDate}
                                    helperText={this.state.msgErrorStartDate}
Deni Rinaldi's avatar
Deni Rinaldi committed
425 426
                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
427 428
                            </div>

429
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5, backgroundColor: '#e8e8e8', }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
430 431
                                <TextField
                                    style={{ width: '100%' }}
Deni Rinaldi's avatar
Deni Rinaldi committed
432
                                    defaultValue={"Active"}
Deni Rinaldi's avatar
Deni Rinaldi committed
433 434 435
                                    id="status"
                                    label="Status"
                                    disabled
436 437 438 439 440 441 442 443 444 445 446
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
Deni Rinaldi's avatar
Deni Rinaldi committed
447 448 449
                                />
                            </div>

450
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
451 452
                                <Typography style={{ fontSize: 11, width: '25%' }}>Created By : </Typography>
                                <Typography style={{ fontSize: 11, width: '25%' }}>Updated By : </Typography>
Deni Rinaldi's avatar
Deni Rinaldi committed
453 454 455 456
                            </div>
                        </div>

                        <div className="column-2">
457
                            <div style={{ padding: 10, borderRadius: 5 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
458 459 460
                                <TextField
                                    style={{ width: '100%' }}
                                    id="unit"
Deni Rinaldi's avatar
Deni Rinaldi committed
461
                                    label="Business Unit"
Deni Rinaldi's avatar
Deni Rinaldi committed
462
                                    value={this.state.name}
463 464 465 466 467 468 469 470 471 472 473
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
474 475 476
                                    error={this.state.errorName}
                                    helperText={this.state.msgErrorName}
                                    onChange={(e) => this.setState({ name: e.target.value }, () => this.clearError())}
Deni Rinaldi's avatar
Deni Rinaldi committed
477 478 479
                                >
                                </TextField>
                            </div>
480
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
481 482 483
                                <DatePicker
                                    margin="normal"
                                    id="endDate"
Deni Rinaldi's avatar
Deni Rinaldi committed
484
                                    label="Valid To"
Deni Rinaldi's avatar
Deni Rinaldi committed
485
                                    format="dd-MM-yyyy"
486 487 488
                                    error={this.state.errorEndDate}
                                    helperText={this.state.msgErrorEndDate}
                                    minDate={this.state.startDate}
Deni Rinaldi's avatar
Deni Rinaldi committed
489 490 491 492 493
                                    value={this.state.endDate == "" ? null : this.state.endDate}
                                    onChange={(e) => this.handleChange(e, 'end_date')}
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}
494 495 496 497 498 499 500 501 502 503 504
                                    inputProps={{
                                        style: {
                                            fontSize: 11
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            color: '#7e8085'
                                        }
                                    }}
Deni Rinaldi's avatar
Deni Rinaldi committed
505 506 507

                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
Deni Rinaldi's avatar
Deni Rinaldi committed
508 509
                            </div>
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
510 511 512

                    </div>

Deni Rinaldi's avatar
Deni Rinaldi committed
513 514
                    <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1" style={{ alignSelf: 'center' }}>
515 516 517 518 519
                            <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' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
520
                                    <span style={{ color: '#354960', fontSize: 11 }}>Cancel</span>
521 522
                                </div>
                            </button>
Deni Rinaldi's avatar
Deni Rinaldi committed
523
                        </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
524
                        <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
525 526
                            <button
                                type="button"
527
                                onClick={() => this.validasiCreate()}
Deni Rinaldi's avatar
Deni Rinaldi committed
528 529
                            >
                                <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
Deni Rinaldi's avatar
Deni Rinaldi committed
530
                                    <span style={{ color: '#fff', fontSize: 11 }}>Save</span>
Deni Rinaldi's avatar
Deni Rinaldi committed
531 532
                                </div>
                            </button>
Deni Rinaldi's avatar
Deni Rinaldi committed
533 534
                        </div>
                    </div>
Deni Rinaldi's avatar
Deni Rinaldi committed
535
                </div>
536
            </div >
Deni Rinaldi's avatar
Deni Rinaldi committed
537 538 539
        );
    }
}