diff --git a/src/resources/badaso/pages/crud-generated/add.vue b/src/resources/badaso/pages/crud-generated/add.vue index 06a8579a..866aeec1 100644 --- a/src/resources/badaso/pages/crud-generated/add.vue +++ b/src/resources/badaso/pages/crud-generated/add.vue @@ -430,13 +430,7 @@ export default { // init data rows const dataRows = {}; for (const row of this.dataType.dataRows) { - if ( - (row && row.value) || - row.type == "switch" || - row.type == "slider" - ) { - dataRows[row.field] = row.value; - } + dataRows[row.field] = row.value; if (row.type == "data_identifier") { dataRows[row.field] = this.userId; } diff --git a/src/resources/badaso/pages/crud-generated/edit.vue b/src/resources/badaso/pages/crud-generated/edit.vue index a1aec5be..6a107f26 100644 --- a/src/resources/badaso/pages/crud-generated/edit.vue +++ b/src/resources/badaso/pages/crud-generated/edit.vue @@ -494,11 +494,9 @@ export default { data.value = val.split(","); } } else if (data.type == "switch") { - data.value = this.record[ - this.$caseConvert.stringSnakeToCamel(data.field) - ] - ? this.record[this.$caseConvert.stringSnakeToCamel(data.field)] - : false; + const val = this.record[this.$caseConvert.stringSnakeToCamel(data.field)]; + + data.value = val > 0 ? true : false; } else if (data.type == "slider") { data.value = parseInt( this.record[this.$caseConvert.stringSnakeToCamel(data.field)]