edit SupermarketCategoryRelations

This commit is contained in:
smilerz
2021-09-14 13:01:51 -05:00
parent b7fe3e38e6
commit 508284c046
17 changed files with 159608 additions and 211 deletions

View File

@ -6,12 +6,8 @@
<p v-if="f.type=='instruction'">{{f.label}}</p>
<!-- this lookup is single selection -->
<lookup-input v-if="f.type=='lookup'"
:label="f.label"
:value="f.value"
:field="f.field"
:form="f"
:model="listModel(f.list)"
:sticky_options="f.sticky_options || undefined"
:create_new="f.allow_create"
@change="storeValue"/> <!-- TODO add ability to create new items associated with lookup -->
<!-- TODO: add multi-selection input list -->
<checkbox-input v-if="f.type=='checkbox'"
@ -65,7 +61,8 @@ export default {
id: undefined,
form_data: {},
form: {},
dirty: false
dirty: false,
special_handling: false
}
},
mounted() {
@ -93,7 +90,7 @@ export default {
methods: {
doAction: function(){
this.dirty = false
this.$emit('finish-action', {'form_data': this.form_data })
this.$emit('finish-action', {'form_data': this.detectOverride(this.form_data) })
},
cancelAction: function() {
if (this.dirty) {
@ -110,6 +107,14 @@ export default {
} else {
return Models[m]
}
},
detectOverride: function(form) {
for (const [k, v] of Object.entries(form)) {
if (form[k].__override__) {
form[k] = form[k].__override__
}
}
return form
}
}
}