diff --git a/ayanova/src/api/form-custom-template.js b/ayanova/src/api/form-custom-template.js
new file mode 100644
index 00000000..48f27514
--- /dev/null
+++ b/ayanova/src/api/form-custom-template.js
@@ -0,0 +1,27 @@
+/* ZZeslint-disable */
+import store from "../store";
+import gzapi from "./gzapi";
+import _ from "../libs/lodash.min.js";
+
+export default {
+ get(formKey) {
+ return new Promise(function getFormTemplate(resolve) {
+ // debugger;
+ 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();
+ });
+ } else {
+ resolve(store.state.formCustom[formKey]);
+ }
+ });
+ }
+};
diff --git a/ayanova/src/components/custom-fields-control.vue b/ayanova/src/components/custom-fields-control.vue
index b2d2c010..1c571dab 100644
--- a/ayanova/src/components/custom-fields-control.vue
+++ b/ayanova/src/components/custom-fields-control.vue
@@ -4,8 +4,10 @@
{{ this.$gzlocale.get("ObjectCustomFieldCustomGrid") }}
+
FORMKEY: {{ formKey }}
+ TEMPLATE: {{ this.$store.state.formSettings[formKey] }}
+ CUSTOM FIELD DATA:
- TODO: turn this into controls
{{ value }}
@@ -23,7 +25,8 @@ export default {
};
},
props: {
- value: String
+ value: String,
+ formKey: String //used to grab template from store
},
watch: {
value(val) {
diff --git a/ayanova/src/main.js b/ayanova/src/main.js
index 1c1b0dbf..497ed5e9 100644
--- a/ayanova/src/main.js
+++ b/ayanova/src/main.js
@@ -25,6 +25,7 @@ import locale from "./api/locale";
import gzapi from "./api/gzapi";
import gzreport from "./api/gzreport";
import gzform from "./api/gzform";
+import gzformcustomtemplate from "./api/form-custom-template";
import roles from "./api/authorizationroles";
import gztype from "./api/ayatype";
import "@/assets/css/main.css";
@@ -49,6 +50,9 @@ Object.defineProperty(Vue.prototype, "$_", { value: lodash });
Object.defineProperty(Vue.prototype, "$gzlocale", { value: locale });
Object.defineProperty(Vue.prototype, "$gzapi", { value: gzapi });
Object.defineProperty(Vue.prototype, "$gzform", { value: gzform });
+Object.defineProperty(Vue.prototype, "$gzformcustomtemplate", {
+ value: gzformcustomtemplate
+});
Object.defineProperty(Vue.prototype, "$gzreport", { value: gzreport });
Object.defineProperty(Vue.prototype, "$gzHandleFormError", {
value: errorHandler.handleFormError
diff --git a/ayanova/src/store.js b/ayanova/src/store.js
index 01d5a12d..08bde6e1 100644
--- a/ayanova/src/store.js
+++ b/ayanova/src/store.js
@@ -28,7 +28,8 @@ export default new Vuex.Store({
},
navItems: [],
logArray: [],
- formSettings: {} //this is the settings on forms that survive a refresh like grid number of items to show etc
+ formSettings: {}, //this is the settings on forms that survive a refresh like grid number of items to show etc
+ formCustomTemplate: {} //this is the custom fields settings for forms
},
mutations: {
login(state, data) {
@@ -40,6 +41,7 @@ export default new Vuex.Store({
state.userName = data.userName;
},
logout(state) {
+ //Things that are reset on logout
state.apiToken = "-";
state.authenticated = false;
state.userId = 0;
@@ -47,6 +49,7 @@ export default new Vuex.Store({
state.roles = 0;
state.navItems = [];
state.localeText = {};
+ state.formCustomTemplate = {};
state.apiUrl = "";
state.locale.decimalSeparator = ".";
state.locale.currencySymbol = "$";
@@ -61,6 +64,9 @@ export default new Vuex.Store({
addLocaleText(state, data) {
state.localeText[data.key] = data.value;
},
+ addFormCustom(state, data) {
+ state.formCustom[data.formKey] = data.value;
+ },
setLocale(state, data) {
// mutate state
state.locale.decimalSeparator = data.decimalSeparator;
diff --git a/ayanova/src/views/inventory-widget-edit.vue b/ayanova/src/views/inventory-widget-edit.vue
index 576ec3ed..87fce037 100644
--- a/ayanova/src/views/inventory-widget-edit.vue
+++ b/ayanova/src/views/inventory-widget-edit.vue
@@ -164,6 +164,7 @@
{
- if (res.error) {
- throw res.error;
- }
- vm.pickLists.roles = res.data;
- });
+ return vm.$gzapi.get("AyaEnumPickList/list/authorizationroles").then(res => {
+ if (res.error) {
+ throw res.error;
+ }
+ vm.pickLists.roles = res.data;
+ });
+}
+
+//////////////////////
+//
+//
+function fetchFormCustomTemplate(vm) {
+ return vm.$gzformcustomtemplate.get(FORM_CUSTOM_TEMPLATE_KEY).then(res => {
+ if (res.error) {
+ throw res.error;
+ }
+ vm.pickLists.roles = res.data;
+ });
}
//////////////////////