Commit 61a0b252 authored by EKSAD's avatar EKSAD

create edit report item

parent bc0608d6
...@@ -18,7 +18,7 @@ export default class CreateReportItems extends Component { ...@@ -18,7 +18,7 @@ export default class CreateReportItems extends Component {
reportType: null, reportType: null,
startDate: null, startDate: null,
endDate: null, endDate: null,
order: null, order: '',
description: '', description: '',
uom: '', uom: '',
weight: null, weight: null,
...@@ -145,7 +145,7 @@ export default class CreateReportItems extends Component { ...@@ -145,7 +145,7 @@ export default class CreateReportItems extends Component {
"company_id": this.state.company.company_id, "company_id": this.state.company.company_id,
"description": this.state.description, "description": this.state.description,
"orders": this.state.order, "orders": this.state.order,
"parent": this.state.parent.item_report_id, "parent": this.state.parent === null ? null : this.state.parent.item_report_id,
"type_report_id": this.state.InputType.type_report_id, "type_report_id": this.state.InputType.type_report_id,
"formula": this.state.formula, "formula": this.state.formula,
"uom": this.state.uom, "uom": this.state.uom,
...@@ -158,12 +158,14 @@ export default class CreateReportItems extends Component { ...@@ -158,12 +158,14 @@ export default class CreateReportItems extends Component {
console.log(payload) console.log(payload)
api.create().createReportItems(payload).then((response) => { api.create().createReportItems(payload).then((response) => {
console.log(response) console.log(response)
if (response.data) {
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.props.onClickClose() this.props.onClickClose()
this.props.refresh() this.props.refresh()
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
}
}) })
} }
...@@ -301,14 +303,12 @@ export default class CreateReportItems extends Component { ...@@ -301,14 +303,12 @@ export default class CreateReportItems extends Component {
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
} }
...@@ -329,12 +329,11 @@ export default class CreateReportItems extends Component { ...@@ -329,12 +329,11 @@ export default class CreateReportItems extends Component {
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
value={this.state.reportType} value={this.state.reportType}
/> />
...@@ -356,12 +355,11 @@ export default class CreateReportItems extends Component { ...@@ -356,12 +355,11 @@ export default class CreateReportItems extends Component {
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
value={this.state.company} value={this.state.company}
/> />
...@@ -374,22 +372,19 @@ export default class CreateReportItems extends Component { ...@@ -374,22 +372,19 @@ export default class CreateReportItems extends Component {
id="orders" id="orders"
name="order" name="order"
label="Order" label="Order"
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, null)}
value={this.state.order} value={this.state.order}
error={this.state.errorOrder} error={this.state.errorOrder}
helperText={this.state.msgErrorOrder} helperText={this.state.msgErrorOrder}
onChange={(e) => this.handleChange(e, '')}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
} }
...@@ -416,14 +411,12 @@ export default class CreateReportItems extends Component { ...@@ -416,14 +411,12 @@ export default class CreateReportItems extends Component {
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
} }
...@@ -446,12 +439,11 @@ export default class CreateReportItems extends Component { ...@@ -446,12 +439,11 @@ export default class CreateReportItems extends Component {
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
value={this.state.parent} value={this.state.parent}
/> />
...@@ -472,14 +464,12 @@ export default class CreateReportItems extends Component { ...@@ -472,14 +464,12 @@ export default class CreateReportItems extends Component {
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
} }
...@@ -500,14 +490,12 @@ export default class CreateReportItems extends Component { ...@@ -500,14 +490,12 @@ export default class CreateReportItems extends Component {
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
} }
...@@ -537,12 +525,11 @@ export default class CreateReportItems extends Component { ...@@ -537,12 +525,11 @@ export default class CreateReportItems extends Component {
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
value={this.state.InputType} value={this.state.InputType}
/> />
...@@ -563,14 +550,12 @@ export default class CreateReportItems extends Component { ...@@ -563,14 +550,12 @@ export default class CreateReportItems extends Component {
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
} }
...@@ -597,14 +582,12 @@ export default class CreateReportItems extends Component { ...@@ -597,14 +582,12 @@ export default class CreateReportItems extends Component {
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
} }
...@@ -628,12 +611,11 @@ export default class CreateReportItems extends Component { ...@@ -628,12 +611,11 @@ export default class CreateReportItems extends Component {
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { fontSize: 11,fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
/> />
</div> </div>
...@@ -648,7 +630,7 @@ export default class CreateReportItems extends Component { ...@@ -648,7 +630,7 @@ export default class CreateReportItems extends Component {
id="startDate" id="startDate"
label="Berlaku Mulai" label="Berlaku Mulai"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.startDate} value={this.state.startDate == "" ? null : this.state.startDate}
error={this.state.errorStartDate} error={this.state.errorStartDate}
helperText={this.state.msgErrorSD} helperText={this.state.msgErrorSD}
onChange={(e) => this.handleChange(e, 'start_date')} onChange={(e) => this.handleChange(e, 'start_date')}
...@@ -658,7 +640,6 @@ export default class CreateReportItems extends Component { ...@@ -658,7 +640,6 @@ export default class CreateReportItems extends Component {
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
...@@ -666,7 +647,6 @@ export default class CreateReportItems extends Component { ...@@ -666,7 +647,6 @@ export default class CreateReportItems extends Component {
style: { style: {
fontSize: 11, fontSize: 11,
color: '#7e8085', color: '#7e8085',
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
...@@ -682,7 +662,7 @@ export default class CreateReportItems extends Component { ...@@ -682,7 +662,7 @@ export default class CreateReportItems extends Component {
id="endDate" id="endDate"
label="Berlaku Hingga" label="Berlaku Hingga"
format="dd MMMM yyyy" format="dd MMMM yyyy"
value={this.state.endDate} value={this.state.endDate == "" ? null : this.state.endDate}
error={this.state.errorEndDate} error={this.state.errorEndDate}
helperText={this.state.msgErrorED} helperText={this.state.msgErrorED}
onChange={(e) => this.handleChange(e, 'end_date')} onChange={(e) => this.handleChange(e, 'end_date')}
...@@ -693,7 +673,6 @@ export default class CreateReportItems extends Component { ...@@ -693,7 +673,6 @@ export default class CreateReportItems extends Component {
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
...@@ -701,7 +680,6 @@ export default class CreateReportItems extends Component { ...@@ -701,7 +680,6 @@ export default class CreateReportItems extends Component {
style: { style: {
fontSize: 11, fontSize: 11,
color: '#7e8085', color: '#7e8085',
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
...@@ -724,14 +702,12 @@ export default class CreateReportItems extends Component { ...@@ -724,14 +702,12 @@ export default class CreateReportItems extends Component {
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085', color: '#7e8085',
} }
......
...@@ -161,12 +161,8 @@ export default class EditReportItems extends Component { ...@@ -161,12 +161,8 @@ export default class EditReportItems extends Component {
getDetailReportItems() { getDetailReportItems() {
api.create().getDetailReportItems(this.props.data.item_report_id).then((response) => { api.create().getDetailReportItems(this.props.data.item_report_id).then((response) => {
this.getInputType()
this.getPerusahaan()
this.getReportType()
this.getParent()
if (response.data.status === 'success') { if (response.data.status === 'success') {
this.setState({ tempData: response.data.data}) this.setState({ tempData: response.data.data}, () => this.getInputType(), this.getPerusahaan(), this.getReportType(),)
console.log(response.data.data) console.log(response.data.data)
} else { } else {
alert(response.data.message) alert(response.data.message)
...@@ -215,7 +211,7 @@ export default class EditReportItems extends Component { ...@@ -215,7 +211,7 @@ export default class EditReportItems extends Component {
}; };
let index = companyData.findIndex((val) => val.company_id === this.state.tempData.company_id) let index = companyData.findIndex((val) => val.company_id === this.state.tempData.company_id)
this.setState({listCompany: defaultProps, company: index === -1 ? null : companyData[index]}) this.setState({listCompany: defaultProps, company: index === -1 ? null : companyData[index]}, () => this.getParent())
} else { } else {
alert(response.data.message) alert(response.data.message)
} }
...@@ -276,12 +272,11 @@ export default class EditReportItems extends Component { ...@@ -276,12 +272,11 @@ export default class EditReportItems extends Component {
} }
render() { render() {
const { startDate, endDate } = this.state;
return ( return (
<div className="test app-popup-show"> <div className="test app-popup-show">
<div className="popup-content background-white border-radius" style={{ borderRadius: 8 }}> <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="popup-panel grid grid-2x main-color" style={{ height: 64, borderTopRightRadius: 8, borderTopLeftRadius: 8 }}>
<div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}> <div className="col-1" style={{ maxWidth: "inherit", display: 'flex', alignItems: 'center' }}>
<div className="popup-title"> <div className="popup-title">
<span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Edit Data</span> <span style={{ color: '#fff', fontSize: 16, fontWeight: 'bold' }}>Edit Data</span>
...@@ -298,8 +293,7 @@ export default class EditReportItems extends Component { ...@@ -298,8 +293,7 @@ export default class EditReportItems extends Component {
</div> </div>
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="border-bottom grid grid-2x grid-mobile-none gap-15px" style={{ padding: 20 }}>
<div className="column-1"> <div className="column-1">
<div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}> <div style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField <TextField
...@@ -313,20 +307,45 @@ export default class EditReportItems extends Component { ...@@ -313,20 +307,45 @@ export default class EditReportItems extends Component {
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif' fontFamily: 'Nunito Sans, sans-serif'
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
/> />
</div> </div>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{padding: 10}}>
<Autocomplete
{...this.state.listReportType}
id="reportType"
onChange={(event, newInputValue) => this.setState({reportType: newInputValue}, () => this.getParent())}
debug
renderInput={(params) =>
<TextField {...params}
label="Jenis Laporan"
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.reportType}
/>
</div>
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{padding: 10}} > <div className="margin-top-10px" style={{padding: 10}} >
<Autocomplete <Autocomplete
{...this.state.listCompany} {...this.state.listCompany}
...@@ -339,37 +358,36 @@ export default class EditReportItems extends Component { ...@@ -339,37 +358,36 @@ export default class EditReportItems extends Component {
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
value={this.state.company} value={this.state.company}
/> />
</div> </div>
<div style={{ padding: 10, borderRadius: 5 }}> </div>
<div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="description" id="order"
label="Deskripsi" label="Order"
name="description" name="order"
error={this.state.errorDesc} value={this.state.tempData === null ? '' : this.state.tempData.order}
helperText={this.state.msgErrorDesc} error={this.state.errorOrder}
helperText={this.state.msgErrorOrder}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.description}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif' fontFamily: 'Nunito Sans, sans-serif'
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
...@@ -377,25 +395,29 @@ export default class EditReportItems extends Component { ...@@ -377,25 +395,29 @@ export default class EditReportItems extends Component {
> >
</TextField> </TextField>
</div> </div>
<div style={{ padding: 10, borderRadius: 5 }}> </div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="uom" id="description"
label="UOM" label="Deskripsi"
name="uom" name="description"
error={this.state.errorDesc}
helperText={this.state.msgErrorDesc}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.uom} value={this.state.tempData === null ? '' : this.state.tempData.description}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif' fontFamily: 'Nunito Sans, sans-serif'
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
...@@ -403,152 +425,77 @@ export default class EditReportItems extends Component { ...@@ -403,152 +425,77 @@ export default class EditReportItems extends Component {
> >
</TextField> </TextField>
</div> </div>
<div className="margin-top-10px" style={{padding: 10}}> </div>
<div className="column-2">
<div className="margin-top-10px" style={{padding: 10}} >
<Autocomplete <Autocomplete
{...this.state.listInputType} {...this.state.listParent}
id="inputType" id="parentId"
onChange={(event, newInputValue) => this.setState({InputType: newInputValue}, () => console.log(this.state.InputType))} onChange={(event, newInputValue) => this.setState({parent: newInputValue})}
disabled={this.state.reportType == null || this.state.company == null}
debug debug
renderInput={(params) => renderInput={(params) =>
<TextField {...params} <TextField {...params}
label="Tipe Data" label="Parent ID"
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
value={this.state.InputType} value={this.state.parent}
/> />
</div> </div>
<div className="margin-top-10px" style={{ padding: 10 }}>
<TextField
style={{ width: '100%' }}
id="condition_it_should_be"
label="Nilai Seharusnya"
disabled={this.state.InputType == null? true : (this.state.InputType.type_report_name === 'Validation'? false : true)}
name="condition_it_should_be"
onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.condition_it_should_be}
inputProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif'
}
}}
InputLabelProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
/>
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<DatePicker
margin="normal"
id="startDate"
label="Berlaku Mulai"
format="dd MMMM yyyy"
value={this.state.tempData === null ? null : this.state.tempData.start_date}
error={this.state.errorStartDate}
helperText={this.state.msgErrorSD}
onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div> </div>
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
value={this.state.tempData === null ? '' : this.state.tempData.status} id="uom"
id="status" label="UOM"
label="Status" name="uom"
disabled onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.uom}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif' fontFamily: 'Nunito Sans, sans-serif'
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
/> >
</div> </TextField>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div style={{display: 'flex'}}>
<Typography style={{ fontSize: 11, width: '20%' }}>Dibuat</Typography>
<Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
</div>
<div style={{display: 'flex'}}>
<Typography style={{ fontSize: 11, width: '20%' }}>Diubah</Typography>
<Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
</div>
</div> </div>
</div> </div>
<div className="column-2"> <div className="column-2">
<div className="margin-top-10px" style={{padding: 10}}>
<Autocomplete
{...this.state.listReportType}
id="reportType"
onChange={(event, newInputValue) => this.setState({reportType: newInputValue}, () => this.getParent())}
debug
renderInput={(params) =>
<TextField {...params}
label="Jenis Laporan"
InputLabelProps={{
style: {
fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }}
/>}
value={this.state.reportType}
/>
</div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="order" id="weight"
label="Order" label="Weight"
name="order" name="weight"
value={this.state.tempData === null ? '' : this.state.tempData.order}
error={this.state.errorOrder}
helperText={this.state.msgErrorOrder}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.weight}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif' fontFamily: 'Nunito Sans, sans-serif'
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
...@@ -556,48 +503,53 @@ export default class EditReportItems extends Component { ...@@ -556,48 +503,53 @@ export default class EditReportItems extends Component {
> >
</TextField> </TextField>
</div> </div>
<div style={{padding: 10}} > </div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{padding: 10}}>
<Autocomplete <Autocomplete
{...this.state.listParent} {...this.state.listInputType}
id="parentId" id="inputType"
onChange={(event, newInputValue) => this.setState({parent: newInputValue})} onChange={(event, newInputValue) => this.setState({InputType: newInputValue}, () => console.log(this.state.InputType))}
disabled={this.state.reportType == null || this.state.company == null}
debug debug
renderInput={(params) => renderInput={(params) =>
<TextField {...params} <TextField {...params}
label="Parent ID" label="Tipe Data"
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
value={this.state.parent} value={this.state.InputType}
/> />
</div> </div>
<div style={{ padding: 10, borderRadius: 5 }}> </div>
<div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="weight" id="formula"
label="Weight" label="Formula"
name="weight" disabled={this.state.InputType == null? true : (this.state.InputType.type_report_name === 'Formula' || this.state.InputType.type_report_name === 'Validation'? false : true)}
name="formula"
error={this.state.errorFormula}
helperText={this.state.msgErrorFormula}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.weight} value={this.state.tempData === null ? '' : this.state.tempData.formula}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif' fontFamily: 'Nunito Sans, sans-serif'
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
...@@ -605,35 +557,36 @@ export default class EditReportItems extends Component { ...@@ -605,35 +557,36 @@ export default class EditReportItems extends Component {
> >
</TextField> </TextField>
</div> </div>
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> </div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
id="formula" id="condition_it_should_be"
label="Formula" label="Nilai Seharusnya"
disabled={this.state.InputType == null? true : (this.state.InputType.type_report_name === 'Formula' || this.state.InputType.type_report_name === 'Validation'? false : true)} disabled={this.state.InputType == null? true : (this.state.InputType.type_report_name === 'Validation'? false : true)}
name="formula" name="condition_it_should_be"
error={this.state.errorFormula}
helperText={this.state.msgErrorFormula}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, '')}
value={this.state.tempData === null ? '' : this.state.tempData.formula} value={this.state.tempData === null ? '' : this.state.tempData.condition_it_should_be}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif' fontFamily: 'Nunito Sans, sans-serif'
} }
}} }}
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
> />
</TextField>
</div> </div>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{padding: 10}}> <div className="margin-top-10px" style={{padding: 10}}>
<Autocomplete <Autocomplete
value={this.state.tempData === null ? '' : this.state.tempData.condition} value={this.state.tempData === null ? '' : this.state.tempData.condition}
...@@ -649,15 +602,36 @@ export default class EditReportItems extends Component { ...@@ -649,15 +602,36 @@ export default class EditReportItems extends Component {
InputLabelProps={{ InputLabelProps={{
style: { style: {
fontSize: 11, fontSize: 11,
fontWeight: 600,
fontFamily: 'Nunito Sans, sans-serif', fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085' color: '#7e8085'
} }
}} }}
InputProps={{ ...params.InputProps, style: { fontSize: 11, fontWeight: 600, fontFamily: 'Nunito Sans, sans-serif' } }} InputProps={{ ...params.InputProps, style: { fontSize: 11, fontFamily: 'Nunito Sans, sans-serif' } }}
/>} />}
/> />
</div> </div>
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<DatePicker
margin="normal"
id="startDate"
label="Berlaku Mulai"
format="dd MMMM yyyy"
value={this.state.tempData === null ? null : this.state.tempData.start_date}
error={this.state.errorStartDate}
helperText={this.state.msgErrorSD}
onChange={(e) => this.handleChange(e, 'start_date')}
KeyboardButtonProps={{
'aria-label': 'change date',
}}
style={{ padding: 0, margin: 0, width: '100%' }}
/>
</div>
</div>
<div className="column-2">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<DatePicker <DatePicker
margin="normal" margin="normal"
...@@ -677,7 +651,46 @@ export default class EditReportItems extends Component { ...@@ -677,7 +651,46 @@ export default class EditReportItems extends Component {
/> />
</div> </div>
</div> </div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField
style={{ width: '100%' }}
value={this.state.tempData === null ? '' : this.state.tempData.status}
id="status"
label="Status"
disabled
inputProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif'
}
}}
InputLabelProps={{
style: {
fontSize: 11,
fontFamily: 'Nunito Sans, sans-serif',
color: '#7e8085'
}
}}
/>
</div>
</div>
</div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1">
<div className="margin-top-10px" style={{ padding: 10, borderRadius: 5 }}>
<div style={{display: 'flex'}}>
<Typography style={{ fontSize: 11, width: '20%' }}>Dibuat</Typography>
<Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
</div>
<div style={{display: 'flex'}}>
<Typography style={{ fontSize: 11, width: '20%' }}>Diubah</Typography>
<Typography style={{ fontSize: 11 }}>: Admin - 21 Jul 2020, 18:45</Typography>
</div>
</div>
</div>
</div> </div>
<div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}> <div className="border-top grid grid-2x" style={{ height: 56, backgroundColor: '#f5f5f5', paddingLeft: 20, paddingRight: 20 }}>
......
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