Commit ad8b6bd1 authored by EKSAD's avatar EKSAD

Update

parent 781f2df9
...@@ -121,6 +121,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -121,6 +121,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
const getReportType = () => api.get('report/get_all_report') const getReportType = () => api.get('report/get_all_report')
const searchReportItems = (body) => api.post('/item_report/search_item_report', body) const searchReportItems = (body) => api.post('/item_report/search_item_report', body)
const createReportItems = (body) => api.post('/item_report/create_item_report', body) const createReportItems = (body) => api.post('/item_report/create_item_report', body)
const updateReportItems = (body) => api.post('/item_report/update_item_report', body)
const checkUploadReportItems = (body) => api.post('/item_report/check_import', body) const checkUploadReportItems = (body) => api.post('/item_report/check_import', body)
const uploadReportItems = (body) => api.post('/item_report/import_item_report', body) const uploadReportItems = (body) => api.post('/item_report/import_item_report', body)
const getItemReportHierarki = () => api.get('item_report/get_item_report_hierarki') const getItemReportHierarki = () => api.get('item_report/get_item_report_hierarki')
...@@ -193,6 +194,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') => ...@@ -193,6 +194,7 @@ const create = (baseURL = 'https://tia.eksad.com/tia-reporting-dev/public/') =>
getReportItems, getReportItems,
searchReportItems, searchReportItems,
createReportItems, createReportItems,
updateReportItems,
getInputType, getInputType,
getReportType, getReportType,
checkUploadReportItems, checkUploadReportItems,
......
...@@ -708,13 +708,13 @@ export default class ReportItems extends Component { ...@@ -708,13 +708,13 @@ export default class ReportItems extends Component {
] ]
return ( return (
<div>
{this.state.itemReport === true ?
<div style={{ height: this.props.height }}> <div style={{ height: this.props.height }}>
{/* <Row> */}
<div className={"main-color"} style={{ height: 199, width: '100%' }} /> <div className={"main-color"} style={{ height: 199, width: '100%' }} />
{this.state.itemReport === true ?
<div> <div>
<div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}> <div style={{ display: 'flex', flexDirection: 'row', justifyContent: 'space-between', paddingRight: 25, paddingLeft: 25, marginTop: -150 }}>
<label style={{ width: '20%', color: 'white', fontSize: 16, alignSelf: 'center', paddingTop: 8 }}>Master Data - Item Report</label> <label style={{ color: 'white', fontSize: 16, alignSelf: 'center', width: '20%', }}>Master Data - Item Report</label>
<div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}> <div style={{ color: 'white', width: '50%', height: 37, display: 'flex', backgroundColor: 'white', borderWidth: 2, alignItems: 'center', borderRadius: 6, paddingLeft: 5, paddingRight: 5, alignSelf: 'center' }}>
<img src={Images.searchBlack} style={{ marginRight: 10 }} /> <img src={Images.searchBlack} style={{ marginRight: 10 }} />
<InputBase <InputBase
...@@ -731,7 +731,6 @@ export default class ReportItems extends Component { ...@@ -731,7 +731,6 @@ export default class ReportItems extends Component {
backgroundColor: 'transparent', backgroundColor: 'transparent',
cursor: 'pointer', cursor: 'pointer',
borderColor: 'transparent', borderColor: 'transparent',
padding: 0,
margin: 5 margin: 5
}} }}
onClick={() => this.downloadFile()} onClick={() => this.downloadFile()}
...@@ -794,7 +793,6 @@ export default class ReportItems extends Component { ...@@ -794,7 +793,6 @@ export default class ReportItems extends Component {
</MuiThemeProvider> </MuiThemeProvider>
</div> </div>
</div> </div>
</div>
: :
this.state.visualisasi == true ? this.state.visualisasi == true ?
<VisualReportItems <VisualReportItems
......
...@@ -24,7 +24,6 @@ export default class CreateReportItems extends Component { ...@@ -24,7 +24,6 @@ export default class CreateReportItems extends Component {
formula: '', formula: '',
realVal: '', realVal: '',
condition: null, condition: null,
inputValue: '',
date: new Date(), date: new Date(),
listInputType: null, listInputType: null,
listCompany: null, listCompany: null,
...@@ -137,7 +136,6 @@ export default class CreateReportItems extends Component { ...@@ -137,7 +136,6 @@ export default class CreateReportItems extends Component {
else { else {
this.addReportItems() this.addReportItems()
} }
} }
addReportItems() { addReportItems() {
......
import React, { Component } from 'react'; import React, { Component } from 'react';
import { TextField, Typography } from '@material-ui/core'; import { TextField, Typography } from '@material-ui/core';
import { DatePicker } from '@material-ui/pickers'; import { DatePicker } from '@material-ui/pickers';
import format from "date-fns/format";
import Autocomplete from '@material-ui/lab/Autocomplete';
import * as R from 'ramda'
const companies = [ const companies = [
{ {
...@@ -66,26 +69,132 @@ export default class EditReportItems extends Component { ...@@ -66,26 +69,132 @@ export default class EditReportItems extends Component {
constructor(props) { constructor(props) {
super(props) super(props)
this.state = { this.state = {
startDate: new Date(), tempData: null,
endDate: new Date(), InputType: null,
company: null,
parent: null,
reportType: null,
startDate: null,
endDate: null,
order: null,
description: '',
uom: '',
weight: null,
formula: '',
realVal: '',
condition: null,
date: new Date(),
listInputType: null,
listCompany: null,
listReportType: null,
listParent: null,
errorOrder: false,
errorDesc: false,
errorFormula: false,
errorRV: false,
errorStartDate: false,
errorEndDate: false,
msgErrorOrder: '',
msgErrorDesc: '',
msgErrorFormula: '',
msgErrorRV: '',
msgErrorSD: '',
msgErrorED: '',
disabledFormula: true,
disabledCondt: true,
disabledValue: true,
options: ['WARNING', 'STOPPER']
} }
} }
handleStartDate = (date) => { componentDidMount() {
this.setState({ console.log(this.props.data);
startDate: date }
});
};
handleEndDate = (date) => { 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 },
errorOrder: false,
errorDesc: false,
errorFormula: false,
errorRV: false,
errorStartDate: false,
errorEndDate: false,
msgErrorOrder: '',
msgErrorDesc: '',
msgErrorFormula: '',
msgErrorRV: '',
msgErrorSD: '',
msgErrorED: '',
})
} else if (isDate && type === 'end_date') {
this.setState({ this.setState({
endDate: date ...data, tempData: { ...this.state.tempData, end_date: format(e, 'yyyy-MM-dd') },
}); errorOrder: false,
}; errorDesc: false,
errorFormula: false,
errorRV: false,
errorStartDate: false,
errorEndDate: false,
msgErrorOrder: '',
msgErrorDesc: '',
msgErrorFormula: '',
msgErrorRV: '',
msgErrorSD: '',
msgErrorED: '',
})
} else {
this.setState({
...data, tempData: { ...this.state.tempData, [e.target.name]: e.target.value },
errorOrder: false,
errorDesc: false,
errorFormula: false,
errorRV: false,
errorStartDate: false,
errorEndDate: false,
msgErrorOrder: '',
msgErrorDesc: '',
msgErrorFormula: '',
msgErrorRV: '',
msgErrorSD: '',
msgErrorED: '',
})
}
}
validasi() {
// alert('coba ya')
if (R.isNil(this.state.reportType)) return alert("Jenis Laporan is Required.");
if (R.isNil(this.state.company)) return alert("Perusahaan is Required.");
else if (R.isNil(this.state.order)) {
this.setState({errorOrder: true, msgErrorOrder: 'Order Harus Diisi'})
}
else if (R.isEmpty(this.state.description)) {
this.setState({errorDesc: true, msgErrorDesc: 'Deskripsi Harus Diisi'})
}
else if (R.isNil(this.state.parent)) return alert("Parent ID is Required.")
else if (R.isNil(this.state.InputType)) return alert("Tipe Data is Required.");
else if (this.state.disabledFormula === false && R.isEmpty(this.state.formula)) {
this.setState({errorFormula: true, msgErrorFormula: 'Formula Harus Diisi'})
}
else if (this.state.disabledValue === false && R.isEmpty(this.state.realVal)) {
this.setState({errorRV: true, msgErrorRV: 'Nilai Seharusnya Harus Diisi'})
}
else if (this.state.disabledCondt === false && R.isEmpty(this.state.condition)) return alert("Kondisi Jika Salah is Required.")
else if (R.isNil(this.state.startDate)) {
this.setState({errorStartDate: true, msgErrorSD: 'Start Date tidak boleh kosong'})
}
else if (R.isNil(this.state.endDate)) {
this.setState({errorEndDate: true, msgErrorED: 'End Date tidak boleh kosong'})
}
else {
this.addReportItems()
}
componentDidMount() {
console.log(this.props.data);
} }
render() { render() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment