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 {
errorEndDate: false,
errorGroup: false,
errorPerusahaan: false,
errorThresholdCurrency: false,
msgErrorThresholdCurrency: '',
msgErrorPerusahaan: '',
msgErrorGroup: '',
msgErrorParameter: '',
......@@ -643,6 +645,8 @@ export default class CreateParameter extends Component {
errorEndDate: false,
errorGroup: false,
errorPerusahaan: false,
errorThresholdCurrency: false,
msgErrorThresholdCurrency: '',
msgErrorPerusahaan: '',
msgErrorGroup: '',
msgErrorParameter: '',
......@@ -672,6 +676,8 @@ export default class CreateParameter extends Component {
errorEndDate: false,
errorGroup: false,
errorPerusahaan: false,
errorThresholdCurrency: false,
msgErrorThresholdCurrency: '',
msgErrorPerusahaan: '',
msgErrorGroup: '',
msgErrorParameter: '',
......@@ -702,6 +708,8 @@ export default class CreateParameter extends Component {
errorEndDate: false,
errorGroup: false,
errorPerusahaan: false,
errorThresholdCurrency: false,
msgErrorThresholdCurrency: '',
msgErrorPerusahaan: '',
msgErrorGroup: '',
msgErrorParameter: '',
......@@ -1202,15 +1210,36 @@ export default class CreateParameter extends Component {
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() {
let data = await this.validasiValueData()
let minMaxValidasi = await this.validasiMinMaxValue()
if (R.isEmpty(data.maxValue)) {
this.validasiMaxResponse()
this.validasiCurrencyTC()
} else {
if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0, 1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
} else {
this.validasiMaxResponse()
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 {
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,11 +1260,20 @@ export default class CreateParameter extends Component {
this.validasiMinResponse()
this.validasiFormatData()
} else {
if (data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0, 1) != "0" && data.minValue.length <= minMaxValidasi.minLength) {
this.validasiFormatData()
} else {
this.validasiMinResponse()
this.validasiFormatData()
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()
} else {
this.validasiMinResponse()
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()
}
}
}
}
......@@ -1503,11 +1541,11 @@ export default class CreateParameter extends Component {
onChange={(event, newInputValue) => this.setState({ getPerusahaan: newInputValue }, () => this.clearMessage())}
renderInput={(params) =>
<TextField {...params}
error={this.state.errorPerusahaan}
helperText={this.state.msgErrorPerusahaan}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Company Name" />}
error={this.state.errorPerusahaan}
helperText={this.state.msgErrorPerusahaan}
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Company Name" />}
value={this.state.getPerusahaan}
/>
</div>
......@@ -1534,8 +1572,8 @@ export default class CreateParameter extends Component {
}}
name="description"
onChange={(e) => this.handleChange(e, '')}
// error={this.state.errorDeskripsi}
// helperText={this.state.msgErrorDeskripsi}
// error={this.state.errorDeskripsi}
// helperText={this.state.msgErrorDeskripsi}
>
</TextField>
</div>
......@@ -1572,8 +1610,8 @@ export default class CreateParameter extends Component {
}
// this.handleChange(coba, 'value')}
}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
>
</TextField>
</div>
......@@ -1635,8 +1673,8 @@ export default class CreateParameter extends Component {
InputProps={{ ...params.InputProps, style: { fontSize: 11 } }}
InputLabelProps={{ style: { fontSize: 11, color: '#7e8085' } }}
label="Type Report"
// error={this.state.errorPerusahaan}
// helperText={this.state.msgErrorPerusahaan}
// error={this.state.errorPerusahaan}
// helperText={this.state.msgErrorPerusahaan}
/>}
value={this.state.getReportName}
/>
......@@ -2081,8 +2119,8 @@ export default class CreateParameter extends Component {
}
// this.handleChange(coba, 'value')}
}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
// error={this.state.errorOrder}
// helperText={this.state.msgErrorOrder}
>
</TextField>
</div>
......
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