This commit is contained in:
@@ -45,8 +45,23 @@
|
|||||||
v-model="item.visible"
|
v-model="item.visible"
|
||||||
:label="lt('FormFieldVisible')"
|
:label="lt('FormFieldVisible')"
|
||||||
:ref="item.key"
|
:ref="item.key"
|
||||||
:disabled="!item.hideable"
|
:disabled="item.stockRequired"
|
||||||
|
@change="visibleChanged(item)"
|
||||||
></v-checkbox>
|
></v-checkbox>
|
||||||
|
<v-checkbox
|
||||||
|
v-model="item.required"
|
||||||
|
:label="lt('FormFieldEntryRequired')"
|
||||||
|
:disabled="item.stockRequired"
|
||||||
|
@change="requiredChanged(item)"
|
||||||
|
></v-checkbox>
|
||||||
|
<v-select
|
||||||
|
v-if="item.custom"
|
||||||
|
v-model="item.type"
|
||||||
|
:items="pickLists.formFieldDataTypes"
|
||||||
|
item-text="name"
|
||||||
|
item-value="id"
|
||||||
|
:label="lt('FormfieldDataType')"
|
||||||
|
></v-select>
|
||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
{{ item }}
|
{{ item }}
|
||||||
</v-card>
|
</v-card>
|
||||||
@@ -59,7 +74,6 @@
|
|||||||
</v-container>
|
</v-container>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
//LTDisplay [FieldKey] , Visible, Required, DataType (if custom)
|
|
||||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
/* Xeslint-disable */
|
/* Xeslint-disable */
|
||||||
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
@@ -95,9 +109,6 @@ export default {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
// Fetch as needed
|
|
||||||
// this.getDataFromApi();
|
|
||||||
|
|
||||||
//NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here
|
//NOTE: this would normally be in getDataFromAPI but this form doesn't really need that function so doing it here
|
||||||
//modify the menu as necessary
|
//modify the menu as necessary
|
||||||
generateMenu(this, false); //default is never read only and passing in this vm
|
generateMenu(this, false); //default is never read only and passing in this vm
|
||||||
@@ -106,7 +117,17 @@ export default {
|
|||||||
return {
|
return {
|
||||||
obj: [],
|
obj: [],
|
||||||
formCustomTemplateKey: this.$route.params.formCustomTemplateKey,
|
formCustomTemplateKey: this.$route.params.formCustomTemplateKey,
|
||||||
|
pickLists: {
|
||||||
|
formFieldDataTypes: [
|
||||||
|
{ name: this.lt("FormFieldDataTypesCurrency"), id: "currency" },
|
||||||
|
{ name: this.lt("FormFieldDataTypesDateOnly"), id: "date" },
|
||||||
|
{ name: this.lt("FormFieldDataTypesTimeOnly"), id: "time" },
|
||||||
|
{ name: this.lt("FormFieldDataTypesDateTime"), id: "datetime" },
|
||||||
|
{ name: this.lt("FormFieldDataTypesText"), id: "text" },
|
||||||
|
{ name: this.lt("FormFieldDataTypesNumber"), id: "number" },
|
||||||
|
{ name: this.lt("FormFieldDataTypesTrueFalse"), id: "bool" }
|
||||||
|
]
|
||||||
|
},
|
||||||
formState: {
|
formState: {
|
||||||
ready: false,
|
ready: false,
|
||||||
dirty: false,
|
dirty: false,
|
||||||
@@ -161,66 +182,24 @@ export default {
|
|||||||
canDuplicate: function() {
|
canDuplicate: function() {
|
||||||
return this.formState.valid && !this.formState.dirty;
|
return this.formState.valid && !this.formState.dirty;
|
||||||
}
|
}
|
||||||
// ,
|
|
||||||
// getTemplateItemForField: function(customTemplateFieldKey) {
|
|
||||||
// //first check template
|
|
||||||
// var templateItem = window.$gz.formCustomTemplate.getFieldTemplateValue(
|
|
||||||
// this.formCustomTemplateKey,
|
|
||||||
// availableFieldItem.key
|
|
||||||
// );
|
|
||||||
// if(templateItem==undefined){
|
|
||||||
// templateItem=
|
|
||||||
// }
|
|
||||||
// return templateItem;
|
|
||||||
// },
|
|
||||||
// fullName: {
|
|
||||||
// // getter
|
|
||||||
// get: function() {
|
|
||||||
// return this.firstName + " " + this.lastName;
|
|
||||||
// },
|
|
||||||
// // setter
|
|
||||||
// set: function(newValue) {
|
|
||||||
// var names = newValue.split(" ");
|
|
||||||
// this.firstName = names[0];
|
|
||||||
// this.lastName = names[names.length - 1];
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
},
|
},
|
||||||
components: {},
|
components: {},
|
||||||
methods: {
|
methods: {
|
||||||
lt: function(ltkey) {
|
lt: function(ltkey) {
|
||||||
return window.$gz.locale.get(ltkey);
|
return window.$gz.locale.get(ltkey);
|
||||||
|
},
|
||||||
|
visibleChanged: function(item) {
|
||||||
|
//Note: stock items can't be changed so no need to take that into account
|
||||||
|
if (item.required && item.visible == false) {
|
||||||
|
item.required = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
requiredChanged: function(item) {
|
||||||
|
//Note: stock items can't be changed so no need to take that into account
|
||||||
|
if (item.required && item.visible == false) {
|
||||||
|
item.visible = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// ,
|
|
||||||
// canHide: function(availableFieldItem) {
|
|
||||||
// //Two things can prevent allowing hide, if the template says it's required and / or if the aviailable fields record
|
|
||||||
// //hideable value is false
|
|
||||||
// var templateSaysRequired = false;
|
|
||||||
// var availableFieldsSayHideable = true;
|
|
||||||
|
|
||||||
// //first check template
|
|
||||||
// var templateItem = window.$gz.formCustomTemplate.getFieldTemplateValue(
|
|
||||||
// this.formCustomTemplateKey,
|
|
||||||
// availableFieldItem.key
|
|
||||||
// );
|
|
||||||
|
|
||||||
// if (
|
|
||||||
// templateItem &&
|
|
||||||
// templateItem.required !== undefined &&
|
|
||||||
// templateItem.required === true //it's text
|
|
||||||
// ) {
|
|
||||||
// templateSaysRequired = true;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// //Now check availableFields collection
|
|
||||||
// if (availableFieldItem.hideable != true) {
|
|
||||||
// availableFieldsSayHideable = false;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// return (
|
|
||||||
// templateSaysRequired === false && availableFieldsSayHideable === true
|
|
||||||
// );
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -295,9 +274,9 @@ function initDataObject(vm) {
|
|||||||
var objItem = {
|
var objItem = {
|
||||||
key: faf.key,
|
key: faf.key,
|
||||||
title: window.$gz.locale.get(faf.key),
|
title: window.$gz.locale.get(faf.key),
|
||||||
hideable: faf.hideable,
|
stockRequired: !faf.hideable,
|
||||||
custom: faf.custom,
|
custom: faf.custom,
|
||||||
required: templateItem.required === true,
|
required: faf.hideable === false || templateItem.required === true,
|
||||||
visible: templateItem.hide !== true,
|
visible: templateItem.hide !== true,
|
||||||
type: templateItem.type
|
type: templateItem.type
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user