This commit is contained in:
2020-02-12 19:26:20 +00:00
parent 30edb0b7cf
commit 35785b26b6

View File

@@ -361,13 +361,12 @@ function ensureTemplateIsInStore(vm) {
function initDataObject(vm) { function initDataObject(vm) {
//http://localhost:7575/api/v8/ObjectFields/ObjectFields/widget //http://localhost:7575/api/v8/ObjectFields/ObjectFields/widget
var url = var url = "FormFieldsDefinitions/" + vm.$route.params.formCustomTemplateKey;
"ObjectFields/ObjectFields/" + vm.$route.params.formCustomTemplateKey;
return window.$gz.api.get(url).then(res => { return window.$gz.api.get(url).then(res => {
if (res.error) { if (res.error) {
throw res.error; throw res.error;
} }
debugger;
//set vm.obj to the combined synthesized snapshot array of template and availble fields for working data for this form //set vm.obj to the combined synthesized snapshot array of template and availble fields for working data for this form
// - {key, ltdisplay, hideable, custom, required, hide, type} // - {key, ltdisplay, hideable, custom, required, hide, type}
//Iterate ObjectFields //Iterate ObjectFields
@@ -378,16 +377,16 @@ function initDataObject(vm) {
var faf = res.data[i]; var faf = res.data[i];
//get the customTemplate record for this field if it exists //get the customTemplate record for this field if it exists
var templateItem = (templateItem = window.$gz.formCustomTemplate.getFieldTemplateValue( var templateItem = window.$gz.formCustomTemplate.getFieldTemplateValue(
vm.formCustomTemplateKey, vm.formCustomTemplateKey,
faf.key faf.fieldKey
)); );
//handle non-existent template item (expected) //handle non-existent template item (expected)
if (templateItem === undefined || templateItem === null) { if (templateItem === undefined || templateItem === null) {
templateItem = { templateItem = {
required: false, required: false,
hide: faf.custom ? true : false, //hide if custom because it's not set to display if it's not present, all others are stock fields hide: faf.isCustomField ? true : false, //hide if custom because it's not set to display if it's not present, all others are stock fields
type: "text" type: "text"
}; };
} }
@@ -395,10 +394,10 @@ function initDataObject(vm) {
// var canHide=faf.hideable && templateItem.required!==true; // var canHide=faf.hideable && templateItem.required!==true;
var objItem = { var objItem = {
key: faf.key, key: faf.fieldKey,
title: window.$gz.locale.get(faf.key), title: window.$gz.locale.get(faf.ltKey),
stockRequired: !faf.hideable, stockRequired: !faf.hideable,
custom: faf.custom, custom: faf.isCustomField,
required: faf.hideable === false || templateItem.required === true, required: faf.hideable === false || templateItem.required === true,
visible: templateItem.hide !== true, visible: templateItem.hide !== true,
type: templateItem.type type: templateItem.type