Commit 9fbd6063 authored by fahrur huzain's avatar fahrur huzain

validasi parameter currencyTC

parent 06d229aa
...@@ -615,6 +615,8 @@ export default class CreateParameter extends Component { ...@@ -615,6 +615,8 @@ export default class CreateParameter extends Component {
errorEndDate: false, errorEndDate: false,
errorGroup: false, errorGroup: false,
errorPerusahaan: false, errorPerusahaan: false,
errorThresholdCurrency: false,
msgErrorThresholdCurrency: '',
msgErrorPerusahaan: '', msgErrorPerusahaan: '',
msgErrorGroup: '', msgErrorGroup: '',
msgErrorParameter: '', msgErrorParameter: '',
...@@ -643,6 +645,8 @@ export default class CreateParameter extends Component { ...@@ -643,6 +645,8 @@ export default class CreateParameter extends Component {
errorEndDate: false, errorEndDate: false,
errorGroup: false, errorGroup: false,
errorPerusahaan: false, errorPerusahaan: false,
errorThresholdCurrency: false,
msgErrorThresholdCurrency: '',
msgErrorPerusahaan: '', msgErrorPerusahaan: '',
msgErrorGroup: '', msgErrorGroup: '',
msgErrorParameter: '', msgErrorParameter: '',
...@@ -672,6 +676,8 @@ export default class CreateParameter extends Component { ...@@ -672,6 +676,8 @@ export default class CreateParameter extends Component {
errorEndDate: false, errorEndDate: false,
errorGroup: false, errorGroup: false,
errorPerusahaan: false, errorPerusahaan: false,
errorThresholdCurrency: false,
msgErrorThresholdCurrency: '',
msgErrorPerusahaan: '', msgErrorPerusahaan: '',
msgErrorGroup: '', msgErrorGroup: '',
msgErrorParameter: '', msgErrorParameter: '',
...@@ -702,6 +708,8 @@ export default class CreateParameter extends Component { ...@@ -702,6 +708,8 @@ export default class CreateParameter extends Component {
errorEndDate: false, errorEndDate: false,
errorGroup: false, errorGroup: false,
errorPerusahaan: false, errorPerusahaan: false,
errorThresholdCurrency: false,
msgErrorThresholdCurrency: '',
msgErrorPerusahaan: '', msgErrorPerusahaan: '',
msgErrorGroup: '', msgErrorGroup: '',
msgErrorParameter: '', msgErrorParameter: '',
...@@ -1202,15 +1210,36 @@ export default class CreateParameter extends Component { ...@@ -1202,15 +1210,36 @@ export default class CreateParameter extends Component {
return obj; return obj;
} }
validasiCurrencyTC(){
console.log(this.state.getThresholdCurrency)
console.log(this.state.errorThresholdCurrency)
console.log(this.state.msgErrorThresholdCurrency)
if (R.isNil(this.state.getThresholdCurrency)){
this.setState({ errorThresholdCurrency: true, msgErrorThresholdCurrency: 'Currency Cannot be Empty' })
}
}
async validasiMaxValue() { async validasiMaxValue() {
let data = await this.validasiValueData() let data = await this.validasiValueData()
let minMaxValidasi = await this.validasiMinMaxValue() let minMaxValidasi = await this.validasiMinMaxValue()
if (R.isEmpty(data.maxValue)) { if (R.isEmpty(data.maxValue)) {
this.validasiMaxResponse() this.validasiMaxResponse()
this.validasiCurrencyTC()
} else { } else {
if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0, 1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) { if (R.isNil(this.state.getTypes)){
if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0,1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
this.validasiCurrencyTC()
} else { } else {
this.validasiMaxResponse() this.validasiMaxResponse()
this.validasiCurrencyTC()
}
}else {
if (data.maxValue.match(minMaxValidasi.minMaxRegex) && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.maxValue.substring(0,1) != "0" : true ) && data.maxValue.length <= minMaxValidasi.maxLength) {
this.validasiCurrencyTC()
} else {
this.validasiMaxResponse()
this.validasiCurrencyTC()
}
} }
} }
} }
...@@ -1231,12 +1260,21 @@ export default class CreateParameter extends Component { ...@@ -1231,12 +1260,21 @@ export default class CreateParameter extends Component {
this.validasiMinResponse() this.validasiMinResponse()
this.validasiFormatData() this.validasiFormatData()
} else { } else {
if (data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0, 1) != "0" && data.minValue.length <= minMaxValidasi.minLength) { if (R.isNil(this.state.getTypes)){
if(data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0,1) != "0" && data.minValue.length <= minMaxValidasi.minLength){
this.validasiFormatData() this.validasiFormatData()
} else { } else {
this.validasiMinResponse() this.validasiMinResponse()
this.validasiFormatData() this.validasiFormatData()
} }
}else {
if(data.minValue.match(minMaxValidasi.minMaxRegex) && (this.state.getTypes.setting_group_name != "THRESHOLD_CONTROL" ? data.minValue.substring(0,1) != "0" : true ) && data.minValue.length <= minMaxValidasi.minLength){
this.validasiFormatData()
} else {
this.validasiMinResponse()
this.validasiFormatData()
}
}
} }
} }
......
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