CreateItemLaporan.js 28.8 KB
Newer Older
EKSAD's avatar
EKSAD committed
1 2
import React, { Component } from 'react';
import { TextField, Typography } from '@material-ui/core';
EKSAD's avatar
EKSAD committed
3
import { DatePicker } from '@material-ui/pickers';
EKSAD's avatar
EKSAD committed
4

EKSAD's avatar
EKSAD committed
5 6 7 8 9 10
const companies = [
    {
      value: '',
      label: '',
    },
    {
EKSAD's avatar
EKSAD committed
11
      value: '1',
EKSAD's avatar
EKSAD committed
12 13 14
      label: 'TIA',
    },
    {
EKSAD's avatar
EKSAD committed
15
      value: '2',
EKSAD's avatar
EKSAD committed
16 17
      label: 'TIA',
    },
EKSAD's avatar
EKSAD committed
18 19 20
  ];

  const dataTypes = [
EKSAD's avatar
EKSAD committed
21
    {
EKSAD's avatar
EKSAD committed
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61
      value: '',
      label: '',
    },
    {
      value: '1',
      label: 'Formula',
    },
    {
      value: '2',
      label: 'Formula',
    },
  ];

  const reportTypes = [
    {
      value: '',
      label: '',
    },
    {
      value: '1',
      label: 'KPI',
    },
    {
      value: '2',
      label: 'KPI',
    },
  ];

  const parents = [
    {
      value: '-',
      label: '-',
    },
    {
      value: '1',
      label: '1',
    },
    {
      value: '2',
      label: '2',
EKSAD's avatar
EKSAD committed
62 63 64
    },
  ];

EKSAD's avatar
EKSAD committed
65
export default class CreateItemLaporan extends Component {
EKSAD's avatar
EKSAD committed
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
    constructor(props) {
        super(props)
        this.state = {
            startDate: new Date(),
            endDate: new Date(),

        }
    }

    handleStartDate = (date) => {
        this.setState({
            startDate: date
        });
      };
    
      handleEndDate = (date) => {
        this.setState({
            endDate: date
        });
      };
EKSAD's avatar
EKSAD committed
86 87 88 89 90

    componentDidMount() {
        console.log(this.props.data);
    }

EKSAD's avatar
EKSAD committed
91
    render() {
EKSAD's avatar
EKSAD committed
92 93
        const { startDate, endDate } = this.state;

EKSAD's avatar
EKSAD committed
94 95 96 97 98 99
        return (
            <div className="test app-popup-show">
                <div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}>
                    <div className="popup-panel grid grid-2x" style={{ backgroundColor: '#51c6ea', height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
                        <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
                            <div className="popup-title">
EKSAD's avatar
EKSAD committed
100
                                <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Tambah Data</span>
EKSAD's avatar
EKSAD committed
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119
                            </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()}
                            >
                                <i className="fa fa-lg fa-times" style={{ color: 'white' }} />
                            </button>
                        </div>
                    </div>


                    <div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
                        <div className="column-1">
                            <div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
EKSAD's avatar
EKSAD committed
120
                                    value={1}
EKSAD's avatar
EKSAD committed
121
                                    id="ID"
EKSAD's avatar
EKSAD committed
122 123 124 125
                                    label="ID"
                                    disabled
                                    inputProps={{
                                        style: {
EKSAD's avatar
EKSAD committed
126 127 128 129
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
EKSAD's avatar
EKSAD committed
130 131 132 133 134
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
EKSAD's avatar
EKSAD committed
135 136 137 138
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
EKSAD's avatar
EKSAD committed
139 140 141 142 143 144
                                        }
                                    }}
                                />
                            </div>
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                <TextField
EKSAD's avatar
EKSAD committed
145 146
                                    id="company"
                                    style={{ width: '100%' }}
EKSAD's avatar
EKSAD committed
147
                                    select
EKSAD's avatar
EKSAD committed
148
                                    label="Perusahaan"
EKSAD's avatar
EKSAD committed
149
                                    // onChange={handleChange}
EKSAD's avatar
EKSAD committed
150
                                    helperText=""
EKSAD's avatar
EKSAD committed
151 152 153
                                    SelectProps={{
                                        native: true,
                                    }}
EKSAD's avatar
EKSAD committed
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
                                        }
                                    }}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
                                        }
                                    }}
EKSAD's avatar
EKSAD committed
171 172 173 174 175 176
                                    >
                                    {companies.map((option) => (
                                        <option key={option.value} value={option.value}>
                                        {option.label}
                                        </option>
                                    ))}
EKSAD's avatar
EKSAD committed
177 178
                                </TextField>
                            </div>
EKSAD's avatar
EKSAD committed
179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266
                            <div style={{ padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    id="description"
                                    label="Deskripsi"
                                    // value={this.props.data.business_unit_name}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
                                        }
                                    }}
                                >
                                </TextField>
                            </div>
                            <div style={{ padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    id="uom"
                                    label="UOM"
                                    // value={this.props.data.business_unit_name}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
                                        }
                                    }}
                                >
                                </TextField>
                            </div>
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                <TextField
                                    id="dataType"
                                    style={{ width: '100%' }}
                                    select
                                    label="Tipe Data"
                                    // onChange={handleChange}
                                    helperText=""
                                    SelectProps={{
                                        native: true,
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
                                        }
                                    }}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
                                        }
                                    }}
                                    >
                                    {dataTypes.map((option) => (
                                        <option key={option.value} value={option.value}>
                                        {option.label}
                                        </option>
                                    ))}
                                </TextField>
                            </div>
EKSAD's avatar
EKSAD committed
267 268 269 270

                            <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
EKSAD's avatar
EKSAD committed
271
                                    // value={this.props.data.status}
EKSAD's avatar
EKSAD committed
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294
                                    id="realValue"
                                    label="Nilai Seharusnya"
                                    value="-"
                                    disabled
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
                                        }
                                    }}
                                />
                            </div>
EKSAD's avatar
EKSAD committed
295 296 297
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                            <DatePicker
                                    margin="normal"
EKSAD's avatar
EKSAD committed
298
                                    id="startDate"
EKSAD's avatar
EKSAD committed
299 300
                                    value={startDate}
                                    onChange={this.handleStartDate}
EKSAD's avatar
EKSAD committed
301
                                    label="Berlaku Mulai"
EKSAD's avatar
EKSAD committed
302 303 304 305
                                    format="dd MMMM yyyy"
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}
EKSAD's avatar
EKSAD committed
306 307 308 309 310
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
EKSAD's avatar
EKSAD committed
311
                                            paddingLeft: 10    
EKSAD's avatar
EKSAD committed
312 313 314 315 316
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
EKSAD's avatar
EKSAD committed
317
                                            color: '#7e8085',
EKSAD's avatar
EKSAD committed
318 319 320 321 322
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
                                        }
                                    }}
EKSAD's avatar
EKSAD committed
323 324 325

                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
EKSAD's avatar
EKSAD committed
326
                            </div>
EKSAD's avatar
EKSAD committed
327
                            <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
EKSAD's avatar
EKSAD committed
328 329 330
                                <TextField
                                    style={{ width: '100%' }}
                                    value="Aktif"
EKSAD's avatar
EKSAD committed
331 332 333 334 335
                                    id="status"
                                    label="Status"
                                    disabled
                                    inputProps={{
                                        style: {
EKSAD's avatar
EKSAD committed
336 337 338 339
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
EKSAD's avatar
EKSAD committed
340 341 342 343 344
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
EKSAD's avatar
EKSAD committed
345 346 347 348
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
EKSAD's avatar
EKSAD committed
349 350 351 352 353 354 355 356
                                        }
                                    }}
                                />
                            </div>

                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                <div style={{display: 'flex'}}>
                                    <Typography style={{ fontSize: 11, width: '20%' }}>Dibuat</Typography>
EKSAD's avatar
EKSAD committed
357
                                    <Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
EKSAD's avatar
EKSAD committed
358 359 360
                                </div>
                                <div style={{display: 'flex'}}>
                                    <Typography style={{ fontSize: 11, width: '20%' }}>Diubah</Typography>
EKSAD's avatar
EKSAD committed
361
                                    <Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
EKSAD's avatar
EKSAD committed
362 363 364 365 366 367
                                </div>
                            </div>
                        </div>

                        <div className="column-2">
                            <div style={{ padding: 10, borderRadius: 5 }}>
EKSAD's avatar
EKSAD committed
368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403
                            <TextField
                                    id="reportType"
                                    style={{ width: '100%' }}
                                    select
                                    label="Jenis Laporan"
                                    // onChange={handleChange}
                                    helperText=""
                                    SelectProps={{
                                        native: true,
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
                                        }
                                    }}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
                                        }
                                    }}
                                    >
                                    {reportTypes.map((option) => (
                                        <option key={option.value} value={option.value}>
                                        {option.label}
                                        </option>
                                    ))}
                                </TextField>
                            </div>
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
EKSAD's avatar
EKSAD committed
404 405
                                <TextField
                                    style={{ width: '100%' }}
EKSAD's avatar
EKSAD committed
406 407
                                    id="order"
                                    label="Order"
EKSAD's avatar
EKSAD committed
408
                                    // value=""
EKSAD's avatar
EKSAD committed
409 410
                                    inputProps={{
                                        style: {
EKSAD's avatar
EKSAD committed
411 412 413 414
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
EKSAD's avatar
EKSAD committed
415 416 417 418 419
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
EKSAD's avatar
EKSAD committed
420 421 422 423
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
EKSAD's avatar
EKSAD committed
424 425 426 427 428
                                        }
                                    }}
                                >
                                </TextField>
                            </div>
EKSAD's avatar
EKSAD committed
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469
                            <div style={{ padding: 10, borderRadius: 5 }}>
                            <TextField
                                    id="parent"
                                    style={{ width: '100%' }}
                                    select
                                    label="Parent"
                                    // onChange={handleChange}
                                    helperText=""
                                    SelectProps={{
                                        native: true,
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
                                        }
                                    }}
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
                                        }
                                    }}
                                    >
                                    {parents.map((option) => (
                                        <option key={option.value} value={option.value}>
                                        {option.label}
                                        </option>
                                    ))}
                                </TextField>
                            </div>
                            <div style={{ padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    id="weight"
                                    label="Weight"
EKSAD's avatar
EKSAD committed
470
                                    // value=""
EKSAD's avatar
EKSAD committed
471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
                                        }
                                    }}
                                >
                                </TextField>
                            </div>
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    id="formula"
                                    label="Formula"
EKSAD's avatar
EKSAD committed
496
                                    // value=""
EKSAD's avatar
EKSAD committed
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
                                        }
                                    }}
                                >
                                </TextField>
                            </div>
                            <div className="margin-top-10px"  style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
                                <TextField
                                    style={{ width: '100%' }}
                                    value="-"
                                    id="isWrongCondition"
                                    label="Kondisi Jika Salah"
                                    disabled
                                    inputProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            color: '#7e8085',
                                            paddingLeft: 10
                                        }
                                    }}
                                />
                            </div>
EKSAD's avatar
EKSAD committed
543
                            <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
EKSAD's avatar
EKSAD committed
544 545 546 547 548
                                <DatePicker
                                    margin="normal"
                                    id="endDate"
                                    value={endDate}
                                    onChange={this.handleEndDate}
EKSAD's avatar
EKSAD committed
549
                                    label="Berlaku Hingga"
EKSAD's avatar
EKSAD committed
550 551 552 553
                                    format="dd MMMM yyyy"
                                    KeyboardButtonProps={{
                                        'aria-label': 'change date',
                                    }}
EKSAD's avatar
EKSAD committed
554 555
                                    inputProps={{
                                        style: {
EKSAD's avatar
EKSAD committed
556 557
                                            fontSize: 11,
                                            fontWeight: 600,
EKSAD's avatar
EKSAD committed
558 559
                                            fontFamily: 'Nunito Sans, sans-serif',
                                            paddingLeft: 10    
EKSAD's avatar
EKSAD committed
560 561 562 563 564
                                        }
                                    }}
                                    InputLabelProps={{
                                        style: {
                                            fontSize: 11,
EKSAD's avatar
EKSAD committed
565
                                            color: '#7e8085',
EKSAD's avatar
EKSAD committed
566 567
                                            fontWeight: 600,
                                            fontFamily: 'Nunito Sans, sans-serif',
EKSAD's avatar
EKSAD committed
568
                                            paddingLeft: 10
EKSAD's avatar
EKSAD committed
569 570
                                        }
                                    }}
EKSAD's avatar
EKSAD committed
571 572 573

                                    style={{ padding: 0, margin: 0, width: '100%' }}
                                />
EKSAD's avatar
EKSAD committed
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 600
                            </div>
                        </div>

                    </div>

                    <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
                        <div className="column-1" style={{ alignSelf: 'center' }}>
                            <button
                                type="button"
                                onClick={() => this.props.onClickClose()}
                            >
                                <div style={{ width: 102, height: 30, border: 'solid 1px #354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                    <span style={{ color: '#354960', fontSize: 11 }}>Batal</span>
                                </div>
                            </button>
                        </div>
                        <div className="column-2" style={{ display: 'flex', justifyContent: 'flex-end', alignItems: 'center' }}>
                            <div style={{ width: 102, height: 30, backgroundColor: '#354960', borderRadius: 5, alignItems: 'center', display: 'flex', justifyContent: 'center' }}>
                                <span style={{ color: '#fff', fontSize: 11 }}>Simpan</span>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        )
    }
}