@@ -94,6 +94,7 @@ export default {
},
},
show: {required: true, type: Boolean, default: false},
+ models: {required: false, type: Function, default: null}
},
data() {
return {
@@ -110,7 +111,7 @@ export default {
this.id = Math.random()
this.$root.$on("change", this.storeValue) // bootstrap modal placed at document so have to listen at root of component
- if (this.models !== null){
+ if (this.models !== null) {
this.Models = this.models // override models definition file with prop
}
},
diff --git a/vue/src/utils/models.js b/vue/src/utils/models.js
index f554c887..27e7546d 100644
--- a/vue/src/utils/models.js
+++ b/vue/src/utils/models.js
@@ -279,7 +279,7 @@ export class Models {
apiName: "Unit",
paginated: true,
create: {
- params: [["name", "plural_name", "description","open_data_slug",]],
+ params: [["name", "plural_name", "description", "open_data_slug",]],
form: {
show_help: true,
name: {
@@ -600,10 +600,19 @@ export class Models {
},
},
create: {
- params: [['base_amount', 'base_unit', 'converted_amount', 'converted_unit', 'food', 'open_data_slug']],
+ params: [['food', 'base_amount', 'base_unit', 'converted_amount', 'converted_unit', 'open_data_slug']],
form: {
show_help: true,
// TODO add proper help texts for everything
+ food: {
+ form_field: true,
+ type: "lookup",
+ field: "food",
+ list: "FOOD",
+ list_label: "name",
+ label: "Food",
+ multiple: false,
+ },
base_amount: {
form_field: true,
type: "text",
@@ -636,15 +645,6 @@ export class Models {
label: "converted_unit",
multiple: false,
},
- food: {
- form_field: true,
- type: "lookup",
- field: "food",
- list: "FOOD",
- list_label: "name",
- label: "Food",
- multiple: false,
- },
open_data_slug: {
form_field: true,
type: "text",