Commit 6d12fce3 authored by Dida Adams Arizona's avatar Dida Adams Arizona

Merge branch 'GGMAC' into 'master'

push

See merge request !1206
parents 87576ef4 ef813eab
...@@ -75,6 +75,7 @@ export default class CreateMasterDataCAT extends Component { ...@@ -75,6 +75,7 @@ export default class CreateMasterDataCAT extends Component {
maxAchDisable: true, maxAchDisable: true,
listPeriode: null, listPeriode: null,
// periode: null, // periode: null,
getParent: []
} }
} }
...@@ -135,20 +136,21 @@ export default class CreateMasterDataCAT extends Component { ...@@ -135,20 +136,21 @@ export default class CreateMasterDataCAT extends Component {
getParentIR() { getParentIR() {
let payload = { let payload = {
"report_id":3, "report_id": 3,
"years":this.state.periode.periode "years": this.state.periode.periode
} }
api.create().getParentItemReport(payload).then(response => { api.create().getParentItemReport(payload).then(response => {
console.log(payload) console.log(payload)
console.log(response) console.log(response)
if (response.data) { if (response.data) {
if (response.data.status === "success") { if (response.data.status === "success") {
response.data.data.map((item) => { this.setState({ getParent: response.data.data.filter((val) => String(val.type_item_report_name).toLocaleLowerCase() != 'break')})
console.log(item.description) // response.data.data.map((item) => {
this.setState({ // console.log(item.description)
itemReport1 : String(item.description).toLocaleLowerCase().includes("financial").tolocal ? item.description : null // this.setState({
}) // itemReport1: String(item.description).toLocaleLowerCase().includes("financial").tolocal ? item.description : null
}) // })
// })
} }
} else { } else {
this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false }) this.setState({ alert: true, messageAlert: response.problem, tipeAlert: 'error', loading: false })
...@@ -157,70 +159,79 @@ export default class CreateMasterDataCAT extends Component { ...@@ -157,70 +159,79 @@ export default class CreateMasterDataCAT extends Component {
}) })
} }
handleChange(e, type) { handleChange(e, item) {
let data = this.state // let data = this.state
let isDate = type !== '' ? true : false // let isDate = type !== '' ? true : false
if (isDate && type === 'start_date') { let dataSource = this.state.getParent
this.setState({ let indexID = dataSource.findIndex((val) => val.item_report_id == item.item_report_id)
...data, startDate: format(e, 'yyyy-MM-dd'), endDate: null, // console.log(indexID)
errorOrder: false, if (indexID != -1) {
errorDesc: false, dataSource[indexID].weight = e.target.value
errorFormula: false, this.setState({getParent: dataSource}, () => {
errorRV: false, console.log(this.state.getParent);
errorStartDate: false,
errorEndDate: false,
errorTipeData: false,
errorCondition: false,
msgErrorTipeData: '',
msgErrorCondition: '',
msgErrorOrder: '',
msgErrorDesc: '',
msgErrorFormula: '',
msgErrorRV: '',
msgErrorSD: '',
msgErrorED: '',
})
} else if (isDate && type === 'end_date') {
this.setState({
...data, endDate: format(e, 'yyyy-MM-dd'),
errorOrder: false,
errorDesc: false,
errorFormula: false,
errorRV: false,
errorStartDate: false,
errorEndDate: false,
errorTipeData: false,
errorCondition: false,
msgErrorTipeData: '',
msgErrorCondition: '',
msgErrorOrder: '',
msgErrorDesc: '',
msgErrorFormula: '',
msgErrorRV: '',
msgErrorSD: '',
msgErrorED: '',
})
} else {
this.setState({
...data, [e.target.name]: e.target.value,
errorOrder: false,
errorDesc: false,
errorFormula: false,
errorRV: false,
errorStartDate: false,
errorEndDate: false,
errorTipeData: false,
errorCondition: false,
msgErrorTipeData: '',
msgErrorCondition: '',
msgErrorOrder: '',
msgErrorDesc: '',
msgErrorFormula: '',
msgErrorRV: '',
msgErrorSD: '',
msgErrorED: '',
}) })
} }
// if (isDate && type === 'start_date') {
// this.setState({
// ...data, startDate: format(e, 'yyyy-MM-dd'), endDate: null,
// errorOrder: false,
// errorDesc: false,
// errorFormula: false,
// errorRV: false,
// errorStartDate: false,
// errorEndDate: false,
// errorTipeData: false,
// errorCondition: false,
// msgErrorTipeData: '',
// msgErrorCondition: '',
// msgErrorOrder: '',
// msgErrorDesc: '',
// msgErrorFormula: '',
// msgErrorRV: '',
// msgErrorSD: '',
// msgErrorED: '',
// })
// } else if (isDate && type === 'end_date') {
// this.setState({
// ...data, endDate: format(e, 'yyyy-MM-dd'),
// errorOrder: false,
// errorDesc: false,
// errorFormula: false,
// errorRV: false,
// errorStartDate: false,
// errorEndDate: false,
// errorTipeData: false,
// errorCondition: false,
// msgErrorTipeData: '',
// msgErrorCondition: '',
// msgErrorOrder: '',
// msgErrorDesc: '',
// msgErrorFormula: '',
// msgErrorRV: '',
// msgErrorSD: '',
// msgErrorED: '',
// })
// } else {
// this.setState({
// ...data, [e.target.name]: e.target.value,
// errorOrder: false,
// errorDesc: false,
// errorFormula: false,
// errorRV: false,
// errorStartDate: false,
// errorEndDate: false,
// errorTipeData: false,
// errorCondition: false,
// msgErrorTipeData: '',
// msgErrorCondition: '',
// msgErrorOrder: '',
// msgErrorDesc: '',
// msgErrorFormula: '',
// msgErrorRV: '',
// msgErrorSD: '',
// msgErrorED: '',
// })
// }
} }
validasi() { validasi() {
...@@ -657,8 +668,11 @@ export default class CreateMasterDataCAT extends Component { ...@@ -657,8 +668,11 @@ export default class CreateMasterDataCAT extends Component {
</div> </div>
</div> </div>
{this.state.getParent.map((item, index) => {
return (
<div>
<div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} > <div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10, fontWeight: 'bold' }}>Item Report - 1</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10, fontWeight: 'bold' }}>{`Item Report - ${index + 1}`}</Typography>
</div> </div>
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
...@@ -666,7 +680,7 @@ export default class CreateMasterDataCAT extends Component { ...@@ -666,7 +680,7 @@ export default class CreateMasterDataCAT extends Component {
<div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}> <div className="margin-top-10px" style={{ backgroundColor: '#e8e8e8', padding: 10, borderRadius: 5 }}>
<TextField <TextField
style={{ width: '100%' }} style={{ width: '100%' }}
value={'-'} value={item.item_report_id}
id="ID" id="ID"
label="ID" label="ID"
disabled disabled
...@@ -696,7 +710,7 @@ export default class CreateMasterDataCAT extends Component { ...@@ -696,7 +710,7 @@ export default class CreateMasterDataCAT extends Component {
disabled disabled
// onChange={(e) => this.handleChange(e, null)} // onChange={(e) => this.handleChange(e, null)}
// value={this.state.order} // value={this.state.order}
value={'CAT'} value={item.report_name}
// error={this.state.errorOrder} // error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder} // helperText={this.state.msgErrorOrder}
inputProps={{ inputProps={{
...@@ -730,7 +744,7 @@ export default class CreateMasterDataCAT extends Component { ...@@ -730,7 +744,7 @@ export default class CreateMasterDataCAT extends Component {
disabled disabled
// onChange={(e) => this.handleChange(e, null)} // onChange={(e) => this.handleChange(e, null)}
// value={this.state.order} // value={this.state.order}
value={'item report name'} value={item.description}
// error={this.state.errorOrder} // error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder} // helperText={this.state.msgErrorOrder}
inputProps={{ inputProps={{
...@@ -758,8 +772,8 @@ export default class CreateMasterDataCAT extends Component { ...@@ -758,8 +772,8 @@ export default class CreateMasterDataCAT extends Component {
id="weight1" id="weight1"
name="weight1" name="weight1"
label="Weight" label="Weight"
value={this.state.weight} value={item.weight}
onChange={(e) => this.handleChange(e, '')} onChange={(e) => this.handleChange(e, item)}
inputProps={{ inputProps={{
style: { style: {
fontSize: 11, fontSize: 11,
...@@ -778,8 +792,12 @@ export default class CreateMasterDataCAT extends Component { ...@@ -778,8 +792,12 @@ export default class CreateMasterDataCAT extends Component {
</div> </div>
</div> </div>
</div> </div>
</div>
)
})}
<div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} >
{/* <div style={{ borderBottom: 'solid 1px #c4c4c4', margin: 20, marginBottom: 10 }} >
<Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10, fontWeight: 'bold' }}>Item Report - 2</Typography> <Typography style={{ fontSize: '12px', color: '#4b4b4b', padding: 10, fontWeight: 'bold' }}>Item Report - 2</Typography>
</div> </div>
...@@ -1143,7 +1161,7 @@ export default class CreateMasterDataCAT extends Component { ...@@ -1143,7 +1161,7 @@ export default class CreateMasterDataCAT extends Component {
</TextField> </TextField>
</div> </div>
</div> </div>
</div> </div> */}
<div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}> <div className="grid grid-2x grid-mobile-none gap-15px" style={{ paddingLeft: 20, paddingRight: 20 }}>
<div className="column-1"> <div className="column-1">
......
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