diff --git a/ayanova/src/api/form-custom-template.js b/ayanova/src/api/form-custom-template.js
index 48f27514..1ee26c31 100644
--- a/ayanova/src/api/form-custom-template.js
+++ b/ayanova/src/api/form-custom-template.js
@@ -1,4 +1,4 @@
-/* ZZeslint-disable */
+/* eslint-disable */
import store from "../store";
import gzapi from "./gzapi";
import _ from "../libs/lodash.min.js";
@@ -6,21 +6,20 @@ import _ from "../libs/lodash.min.js";
export default {
get(formKey) {
return new Promise(function getFormTemplate(resolve) {
- // debugger;
- if (!_.has(store.state.formCustom, formKey)) {
+ if (!_.has(store.state.formCustom, formKey)) {
//fetch and populate the store
- fetch(gzapi.APIUrl("formcustom/" + formKey))
- .then(gzapi.status)
- .then(gzapi.json)
- .then(response => {
- store.commit("addLocaleText", {
- formKey: formKey,
- value: response
- });
- resolve();
+ gzapi.get("formcustom/" + formKey).then(res => {
+ debugger;
+ if (res.error) {
+ throw res.error;
+ }
+
+ store.commit("addFormCustomTemplateItem", {
+ formKey: formKey,
+ value: JSON.parse(res.data.template)
});
- } else {
- resolve(store.state.formCustom[formKey]);
+ resolve();
+ });
}
});
}
diff --git a/ayanova/src/components/custom-fields-control.vue b/ayanova/src/components/custom-fields-control.vue
index 1c571dab..ba82bdf6 100644
--- a/ayanova/src/components/custom-fields-control.vue
+++ b/ayanova/src/components/custom-fields-control.vue
@@ -5,7 +5,7 @@
FORMKEY: {{ formKey }}
- TEMPLATE: {{ this.$store.state.formSettings[formKey] }}
+ TEMPLATE: {{ this.$store.state.formCustomTemplate[formKey] }}
CUSTOM FIELD DATA:
{{ value }}
diff --git a/ayanova/src/store.js b/ayanova/src/store.js
index 08bde6e1..593844b2 100644
--- a/ayanova/src/store.js
+++ b/ayanova/src/store.js
@@ -64,8 +64,8 @@ export default new Vuex.Store({
addLocaleText(state, data) {
state.localeText[data.key] = data.value;
},
- addFormCustom(state, data) {
- state.formCustom[data.formKey] = data.value;
+ addFormCustomTemplateItem(state, data) {
+ state.formCustomTemplate[data.formKey] = data.value;
},
setLocale(state, data) {
// mutate state
diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue
index 87fce037..304d5db2 100644
--- a/ayanova/src/views/inventory-widget-edit.vue
+++ b/ayanova/src/views/inventory-widget-edit.vue
@@ -617,7 +617,9 @@ var JUST_DELETED = false;
//
//
function initForm(vm) {
- return fetchLocaleText(vm).then(populatePickLists(vm));
+ return fetchLocaleText(vm).then(
+ populatePickLists(vm).then(fetchFormCustomTemplate(vm))
+ );
}
//////////////////////
@@ -636,12 +638,7 @@ function populatePickLists(vm) {
//
//
function fetchFormCustomTemplate(vm) {
- return vm.$gzformcustomtemplate.get(FORM_CUSTOM_TEMPLATE_KEY).then(res => {
- if (res.error) {
- throw res.error;
- }
- vm.pickLists.roles = res.data;
- });
+ return vm.$gzformcustomtemplate.get(FORM_CUSTOM_TEMPLATE_KEY);
}
//////////////////////