Commit 369c4090 authored by fahrur huzain's avatar fahrur huzain

Merge branch 'dev/fahrur' into 'ENV-DEV'

validasi default company

See merge request !2048
parents 558c3acf e4b9c097
...@@ -690,7 +690,13 @@ export default class CreateParameter extends Component { ...@@ -690,7 +690,13 @@ export default class CreateParameter extends Component {
}else { }else {
if (this.state.getTypes.setting_group_name == "REPORT_SUBMIT_PERIOD") { if (this.state.getTypes.setting_group_name == "REPORT_SUBMIT_PERIOD") {
if (R.isEmpty(data.value)) { if (R.isEmpty(data.value)) {
if (R.isNil(this.state.getPerusahaan)){
}else {
if (this.state.getPerusahaan.company_name == "Default"){
}else {
this.setState({errorValue: true, msgErrorValue: 'Value Cannot be Empty'}) this.setState({errorValue: true, msgErrorValue: 'Value Cannot be Empty'})
}
}
} else { } else {
if (R.isNil(this.state.getParameter)) { if (R.isNil(this.state.getParameter)) {
} else { } else {
...@@ -735,8 +741,16 @@ export default class CreateParameter extends Component { ...@@ -735,8 +741,16 @@ export default class CreateParameter extends Component {
if (R.isNil(this.state.getTypes)) { if (R.isNil(this.state.getTypes)) {
} else { } else {
if (this.state.getTypes.setting_group_name == "CURRENCY_MONEY_FORMAT") { if (this.state.getTypes.setting_group_name == "CURRENCY_MONEY_FORMAT") {
if (R.isNil(this.state.getParameter)){
}else {
if (R.isNil(this.state.getPerusahaan)){
}else {
if (R.isNil(this.state.getFormatData)){
this.updateParameterCurrebcyMoneyFormat() this.updateParameterCurrebcyMoneyFormat()
} else if (this.state.getTypes.setting_group_name == "CURRENCY") { }
}
}
} else if (this.state.getTypes.setticonng_group_name == "CURRENCY") {
if (R.isNil(this.state.getReportName)) { if (R.isNil(this.state.getReportName)) {
} else { } else {
if (R.isEmpty(data.value)) { if (R.isEmpty(data.value)) {
...@@ -756,8 +770,33 @@ export default class CreateParameter extends Component { ...@@ -756,8 +770,33 @@ export default class CreateParameter extends Component {
} }
} }
} }
} else if (this.state.getTypes.setting_group_name == "THRESHOLD_VARIANCE" || this.state.getTypes.setting_group_name == "THRESHOLD_CONTROL" ) {
if (R.isEmpty(data.minValue)) {
} else {
if (data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0, 1) != "0" && data.minValue.length <= minMaxValidasi.minLength) {
if (R.isEmpty(data.maxValue)) {
} else {
if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0, 1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
this.updateParameter()
}
}
}
}
} else if (this.state.getTypes.setting_group_name == "REPORT_SUBMIT_PERIOD") { } else if (this.state.getTypes.setting_group_name == "REPORT_SUBMIT_PERIOD") {
if (R.isEmpty(data.value)) { if (R.isEmpty(data.value)) {
if (this.state.getPerusahaan.company_name == "Default"){
if (R.isEmpty(data.minValue)) {
} else {
if(data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0,1) != "0" && data.minValue.length <= minMaxValidasi.minLength){
if (R.isEmpty(data.maxValue)) {
} else {
if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0, 1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
this.updateParameter()
}
}
}
}
}
} else { } else {
if (data.value.match(response.regexValue) && data.value.length <= response.valueLength) { if (data.value.match(response.regexValue) && data.value.length <= response.valueLength) {
if (R.isEmpty(data.minValue)) { if (R.isEmpty(data.minValue)) {
...@@ -774,14 +813,30 @@ export default class CreateParameter extends Component { ...@@ -774,14 +813,30 @@ export default class CreateParameter extends Component {
} }
} }
}else { }else {
if (R.isNil(this.state.getParameter)){
}else {
if (R.isNil(this.state.getPerusahaan)){
}else {
if (R.isNil(this.state.getFormatData)){
this.updateParameter() this.updateParameter()
} }
} }
}
}
}
}else { }else {
if (R.isNil(this.state.getTypes)) { if (R.isNil(this.state.getTypes)) {
} else { } else {
if (this.state.getTypes.setting_group_name == "CURRENCY_MONEY_FORMAT") { if (this.state.getTypes.setting_group_name == "CURRENCY_MONEY_FORMAT") {
if (R.isNil(this.state.getParameter)){
}else {
if (R.isNil(this.state.getPerusahaan)){
}else {
if (R.isNil(this.state.getFormatData)){
this.createParameterCurrebcyMoneyFormat() this.createParameterCurrebcyMoneyFormat()
}
}
}
} else if (this.state.getTypes.setting_group_name == "CURRENCY") { } else if (this.state.getTypes.setting_group_name == "CURRENCY") {
if (R.isNil(this.state.getReportName)) { if (R.isNil(this.state.getReportName)) {
} else { } else {
...@@ -802,8 +857,33 @@ export default class CreateParameter extends Component { ...@@ -802,8 +857,33 @@ export default class CreateParameter extends Component {
} }
} }
} }
} else if (this.state.getTypes.setting_group_name == "THRESHOLD_VARIANCE" || this.state.getTypes.setting_group_name == "THRESHOLD_CONTROL" ) {
if (R.isEmpty(data.minValue)) {
} else {
if (data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0, 1) != "0" && data.minValue.length <= minMaxValidasi.minLength) {
if (R.isEmpty(data.maxValue)) {
} else {
if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0, 1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
this.createParameter()
}
}
}
}
} else if (this.state.getTypes.setting_group_name == "REPORT_SUBMIT_PERIOD") { } else if (this.state.getTypes.setting_group_name == "REPORT_SUBMIT_PERIOD") {
if (R.isEmpty(data.value)) { if (R.isEmpty(data.value)) {
if (this.state.getPerusahaan.company_name == "Default"){
if (R.isEmpty(data.minValue)) {
} else {
if(data.minValue.match(minMaxValidasi.minMaxRegex) && data.minValue.substring(0,1) != "0" && data.minValue.length <= minMaxValidasi.minLength) {
if (R.isEmpty(data.maxValue)) {
} else {
if (data.maxValue.match(minMaxValidasi.minMaxRegex) && data.maxValue.substring(0,1) != "0" && data.maxValue.length <= minMaxValidasi.maxLength) {
this.createParameter()
}
}
}
}
}
} else { } else {
if (data.value.match(response.regexValue) && data.value.length <= response.valueLength) { if (data.value.match(response.regexValue) && data.value.length <= response.valueLength) {
if (R.isEmpty(data.minValue)) { if (R.isEmpty(data.minValue)) {
...@@ -820,11 +900,19 @@ export default class CreateParameter extends Component { ...@@ -820,11 +900,19 @@ export default class CreateParameter extends Component {
} }
} }
}else { }else {
if (R.isNil(this.state.getParameter)){
}else {
if (R.isNil(this.state.getPerusahaan)){
}else {
if (R.isNil(this.state.getFormatData)){
this.createParameter() this.createParameter()
} }
} }
} }
} }
}
}
}
validasiFormatResponse(){ validasiFormatResponse(){
if (R.isNil(this.state.getTypes)){ if (R.isNil(this.state.getTypes)){
...@@ -848,34 +936,27 @@ export default class CreateParameter extends Component { ...@@ -848,34 +936,27 @@ export default class CreateParameter extends Component {
if (R.isNil(this.state.getParameter)) { if (R.isNil(this.state.getParameter)) {
obj = { regexValue: (/\b\d{4}\b/), valueLength: 4 } obj = { regexValue: (/\b\d{4}\b/), valueLength: 4 }
} else { } else {
console.log(this.state.getParameter.setting_type_name);
switch (this.state.getParameter.setting_type_name) { switch (this.state.getParameter.setting_type_name) {
case "MASTER_BUDGET": case "MASTER_BUDGET":
obj = { regexValue: (/\b\d{4}\b/), valueLength: 4 } obj = { regexValue: (/\b\d{4}\b/), valueLength: 4 }
console.log("masuk MB" + this.state.regexValue + " panjang" + this.state.valueLength);
break break
case "MONTHLY_REPORT": case "MONTHLY_REPORT":
obj = { obj = {
regexValue: (/^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}$/), regexValue: (/^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}$/),
valueLength: 8 valueLength: 8
} }
console.log("masuk MR" + this.state.regexValue + " panjang" + this.state.valueLength);
break break
case "OUTLOOK_Q1": case "OUTLOOK_Q1":
obj = { regexValue: (/Q1\s\d{4}/), valueLength: 7 } obj = { regexValue: (/Q1\s\d{4}/), valueLength: 7 }
console.log("masuk Q1" + this.state.regexValue + " panjang" + this.state.valueLength);
break break
case "OUTLOOK_Q2": case "OUTLOOK_Q2":
obj = { regexValue: (/Q2\s\d{4}/), valueLength: 7 } obj = { regexValue: (/Q2\s\d{4}/), valueLength: 7 }
console.log("masuk Q2" + this.state.regexValue + " panjang" + this.state.valueLength);
break break
case "OUTLOOK_Q3": case "OUTLOOK_Q3":
obj = { regexValue: (/Q3\s\d{4}/), valueLength: 7 } obj = { regexValue: (/Q3\s\d{4}/), valueLength: 7 }
console.log("masuk Q3" + this.state.regexValue + " panjang" + this.state.valueLength);
break break
case "OUTLOOK_PA": case "OUTLOOK_PA":
obj = { regexValue: (/Q1\s\d{4}/), valueLength: 7 } obj = { regexValue: (/Q1\s\d{4}/), valueLength: 7 }
console.log("masuk PA" + this.state.regexValue + " panjang" + this.state.valueLength);
break break
default: default:
obj = { regexValue: (/Q1\s\d{4}/), valueLength: 7 } obj = { regexValue: (/Q1\s\d{4}/), valueLength: 7 }
...@@ -947,7 +1028,6 @@ export default class CreateParameter extends Component { ...@@ -947,7 +1028,6 @@ export default class CreateParameter extends Component {
if (R.isNil(this.state.getTypes)) { if (R.isNil(this.state.getTypes)) {
obj = { minMaxRegex: (/^-?\d+\.?\d+$/), minLength: this.state.minValue.length, maxLength: this.state.maxValue.length } obj = { minMaxRegex: (/^-?\d+\.?\d+$/), minLength: this.state.minValue.length, maxLength: this.state.maxValue.length }
} else { } else {
console.log(this.state.getTypes.setting_group_name);
switch (this.state.getTypes.setting_group_name) { switch (this.state.getTypes.setting_group_name) {
case "CURRENCY": case "CURRENCY":
obj = { minMaxRegex: (/\b\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\b/), minLength: 11, maxLength: 11, regexValue: (/^\d+$/)} obj = { minMaxRegex: (/\b\d{1,2}\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}\b/), minLength: 11, maxLength: 11, regexValue: (/^\d+$/)}
......
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