Commit 4ede5db7 authored by EKSAD's avatar EKSAD

Update validasi report item

parent 8fcf1da3
This diff is collapsed.
......@@ -147,32 +147,32 @@ export default class CreateReportItems extends Component {
validasi() {
// alert('coba ya')
if (R.isNil(this.state.reportType)) {
this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report type is required.'})
this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report type cannot be empty.'})
} else if (R.isNil(this.state.company)){
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company is required.'})
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company name cannot be empty.'})
} else if (R.isEmpty(this.state.order)) {
this.setState({ errorOrder: true, msgErrorOrder: 'Order is required.' })
this.setState({ errorOrder: true, msgErrorOrder: 'Order cannot be empty.' })
}
else if (R.isEmpty(this.state.description)) {
this.setState({ errorDesc: true, msgErrorDesc: 'Description is required.' })
this.setState({ errorDesc: true, msgErrorDesc: 'Description cannot be empty.' })
}
else if (R.isNil(this.state.InputType)) {
this.setState({ errorTipeData: true, msgErrorTipeData: 'Data type is required.' })
this.setState({ errorTipeData: true, msgErrorTipeData: 'Data type cannot be empty.' })
}
else if (this.state.disabledFormula === false && R.isEmpty(this.state.formula)) {
this.setState({ errorFormula: true, msgErrorFormula: 'Formula is required.' })
this.setState({ errorFormula: true, msgErrorFormula: 'Formula cannot be empty.' })
}
else if (this.state.disabledValue === false && R.isEmpty(this.state.realVal)) {
this.setState({ errorRV: true, msgErrorRV: 'True value is required.' })
this.setState({ errorRV: true, msgErrorRV: 'True value cannot be empty.' })
}
else if (this.state.disabledCondt === false && R.isEmpty(this.state.condition)) {
this.setState({ errorCondition: true, msgErrorCondition: 'False condition is required.' })
this.setState({ errorCondition: true, msgErrorCondition: 'False condition cannot be empty.' })
}
else if (R.isNil(this.state.startDate)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start date is required.' })
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From cannot be empty.' })
}
else if (R.isNil(this.state.endDate)) {
this.setState({ errorEndDate: true, msgErrorED: 'End date is required.' })
this.setState({ errorEndDate: true, msgErrorED: 'Valid To cannot be empty.' })
}
else {
this.addReportItems()
......
......@@ -128,25 +128,25 @@ export default class EditReportItems extends Component {
validasi() {
// alert('coba ya')
if (R.isNil(this.state.reportType)){
this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report type is required.'})
this.setState({errorJenisLaporan: true, msgErrorJenisLaporan: 'Report type cannot be empty.'})
} else if (R.isNil(this.state.company)){
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company is required.'})
this.setState({ errorPerusahaan: true, msgErrorPerusahaan: 'Company name cannot be empty.'})
} else if (R.isEmpty(this.state.tempData.order)) {
this.setState({ errorOrder: true, msgErrorOrder: 'Order is required..' })
this.setState({ errorOrder: true, msgErrorOrder: 'Order cannot be empty.' })
} else if (R.isEmpty(this.state.tempData.description)) {
this.setState({ errorDesc: true, msgErrorDesc: 'Description is required..' })
this.setState({ errorDesc: true, msgErrorDesc: 'Description cannot be empty.' })
} else if (R.isNil(this.state.InputType)) {
this.setState({ errorTipeData: true, msgErrorTipeData: 'Data type is required.' })
this.setState({ errorTipeData: true, msgErrorTipeData: 'Data type cannot be empty.' })
} else if ((this.state.InputType.type_item_report_name === 'Formula' && R.isEmpty(this.state.tempData.formula)) || (this.state.InputType.type_item_report_name === 'Validation' && R.isEmpty(this.state.tempData.formula))) {
this.setState({ errorFormula: true, msgErrorFormula: 'Formula is required.' })
this.setState({ errorFormula: true, msgErrorFormula: 'Formula cannot be empty.' })
} else if (this.state.InputType.type_item_report_name === 'Validation' && R.isEmpty(this.state.tempData.condition_it_should_be)) {
this.setState({ errorRV: true, msgErrorRV: 'True value is required.' })
this.setState({ errorRV: true, msgErrorRV: 'True value cannot be empty.' })
} else if (this.state.InputType.type_item_report_name === 'Validation' && R.isNil(this.state.tempData.condition_if_wrong)) {
this.setState({ errorCondition: true, msgErrorCondition: 'False condition is required.' })
this.setState({ errorCondition: true, msgErrorCondition: 'False condition cannot be empty.' })
} else if (R.isNil(this.state.tempData.start_date)) {
this.setState({ errorStartDate: true, msgErrorSD: 'Start date is required.' })
this.setState({ errorStartDate: true, msgErrorSD: 'Valid From cannot be empty.' })
} else if (R.isNil(this.state.tempData.end_date)) {
this.setState({ errorEndDate: true, msgErrorED: 'End date is required.' })
this.setState({ errorEndDate: true, msgErrorED: 'Valid To cannot be empty.' })
} else {
this.updateReportItems()
}
......
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