Commit e4b9c097 authored by fahrur huzain's avatar fahrur huzain

validasi default company

parent 558c3acf
......@@ -690,7 +690,13 @@ export default class CreateParameter extends Component {
}else {
if (this.state.getTypes.setting_group_name == "REPORT_SUBMIT_PERIOD") {
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'})
}
}
} else {
if (R.isNil(this.state.getParameter)) {
} else {
......@@ -735,8 +741,16 @@ export default class CreateParameter extends Component {
if (R.isNil(this.state.getTypes)) {
} else {
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()
} else if (this.state.getTypes.setting_group_name == "CURRENCY") {
}
}
}
} else if (this.state.getTypes.setticonng_group_name == "CURRENCY") {
if (R.isNil(this.state.getReportName)) {
} else {
if (R.isEmpty(data.value)) {
......@@ -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") {
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 {
if (data.value.match(response.regexValue) && data.value.length <= response.valueLength) {
if (R.isEmpty(data.minValue)) {
......@@ -774,14 +813,30 @@ export default class CreateParameter extends Component {
}
}
}else {
if (R.isNil(this.state.getParameter)){
}else {
if (R.isNil(this.state.getPerusahaan)){
}else {
if (R.isNil(this.state.getFormatData)){
this.updateParameter()
}
}
}
}
}
}else {
if (R.isNil(this.state.getTypes)) {
} else {
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()
}
}
}
} else if (this.state.getTypes.setting_group_name == "CURRENCY") {
if (R.isNil(this.state.getReportName)) {
} else {
......@@ -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") {
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 {
if (data.value.match(response.regexValue) && data.value.length <= response.valueLength) {
if (R.isEmpty(data.minValue)) {
......@@ -820,11 +900,19 @@ export default class CreateParameter extends Component {
}
}
}else {
if (R.isNil(this.state.getParameter)){
}else {
if (R.isNil(this.state.getPerusahaan)){
}else {
if (R.isNil(this.state.getFormatData)){
this.createParameter()
}
}
}
}
}
}
}
validasiFormatResponse(){
if (R.isNil(this.state.getTypes)){
......@@ -848,34 +936,27 @@ export default class CreateParameter extends Component {
if (R.isNil(this.state.getParameter)) {
obj = { regexValue: (/\b\d{4}\b/), valueLength: 4 }
} else {
console.log(this.state.getParameter.setting_type_name);
switch (this.state.getParameter.setting_type_name) {
case "MASTER_BUDGET":
obj = { regexValue: (/\b\d{4}\b/), valueLength: 4 }
console.log("masuk MB" + this.state.regexValue + " panjang" + this.state.valueLength);
break
case "MONTHLY_REPORT":
obj = {
regexValue: (/^(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s\d{4}$/),
valueLength: 8
}
console.log("masuk MR" + this.state.regexValue + " panjang" + this.state.valueLength);
break
case "OUTLOOK_Q1":
obj = { regexValue: (/Q1\s\d{4}/), valueLength: 7 }
console.log("masuk Q1" + this.state.regexValue + " panjang" + this.state.valueLength);
break
case "OUTLOOK_Q2":
obj = { regexValue: (/Q2\s\d{4}/), valueLength: 7 }
console.log("masuk Q2" + this.state.regexValue + " panjang" + this.state.valueLength);
break
case "OUTLOOK_Q3":
obj = { regexValue: (/Q3\s\d{4}/), valueLength: 7 }
console.log("masuk Q3" + this.state.regexValue + " panjang" + this.state.valueLength);
break
case "OUTLOOK_PA":
obj = { regexValue: (/Q1\s\d{4}/), valueLength: 7 }
console.log("masuk PA" + this.state.regexValue + " panjang" + this.state.valueLength);
break
default:
obj = { regexValue: (/Q1\s\d{4}/), valueLength: 7 }
......@@ -947,7 +1028,6 @@ export default class CreateParameter extends Component {
if (R.isNil(this.state.getTypes)) {
obj = { minMaxRegex: (/^-?\d+\.?\d+$/), minLength: this.state.minValue.length, maxLength: this.state.maxValue.length }
} else {
console.log(this.state.getTypes.setting_group_name);
switch (this.state.getTypes.setting_group_name) {
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+$/)}
......
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