This commit is contained in:
@@ -34,6 +34,8 @@ export default {
|
|||||||
});
|
});
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
} else {
|
||||||
|
resolve();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ export default {
|
|||||||
value: String,
|
value: String,
|
||||||
formKey: String, //used to grab template from store
|
formKey: String, //used to grab template from store
|
||||||
readOnly: Boolean
|
readOnly: Boolean
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
c2: {
|
c2: {
|
||||||
get: function() {
|
get: function() {
|
||||||
@@ -154,7 +154,7 @@ export default {
|
|||||||
//
|
//
|
||||||
var cData = JSON.parse(this.value);
|
var cData = JSON.parse(this.value);
|
||||||
|
|
||||||
//then set item in the cData
|
//then set item in the cData
|
||||||
//TODO: This will likely need also to be converted because dates and stuff
|
//TODO: This will likely need also to be converted because dates and stuff
|
||||||
//initial naive attempt: (tostring is suspect)
|
//initial naive attempt: (tostring is suspect)
|
||||||
cData[dataKey] = newValue.toString();
|
cData[dataKey] = newValue.toString();
|
||||||
@@ -180,10 +180,11 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//trigger the template fetch
|
//trigger the template fetch
|
||||||
|
|
||||||
//var v=this.$store.state.formCustomTemplate[this.formKey];
|
//var v=this.$store.state.formCustomTemplate[this.formKey];
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
console.log("custom-fields-control::BEFORECREATE: TOP");
|
||||||
if (this.$gzdevmode()) {
|
if (this.$gzdevmode()) {
|
||||||
//debugger;
|
//debugger;
|
||||||
if (!this.formKey) {
|
if (!this.formKey) {
|
||||||
|
|||||||
@@ -39,6 +39,11 @@ import customFieldsControl from "./components/custom-fields-control.vue";
|
|||||||
// LIBS AND GLOBAL ITEMS
|
// LIBS AND GLOBAL ITEMS
|
||||||
// (https://medium.com/js-dojo/use-any-javascript-library-with-vue-js-3f7e2a4974a8)
|
// (https://medium.com/js-dojo/use-any-javascript-library-with-vue-js-3f7e2a4974a8)
|
||||||
//
|
//
|
||||||
|
todo: move all this shit to Window.$gz as subkeys on it and then modify all the caller code that used to use vm vue property version
|
||||||
|
//then modify the inventory-widget-edit form initialization shit so that the stuff needed after form loads still happens but the before is moved to route before enter and that it's all called
|
||||||
|
//with two separate methods: One standard one for init form before it is loaded and one for init form stuff for after it's loaded. BeforeLoadInit, AfterLoadInit or something
|
||||||
|
window.$gzlocale = locale;
|
||||||
|
window.$gzformcustomtemplate = gzformcustomtemplate;
|
||||||
Object.defineProperty(Vue.prototype, "$gztype", { value: gztype });
|
Object.defineProperty(Vue.prototype, "$gztype", { value: gztype });
|
||||||
Object.defineProperty(Vue.prototype, "$gzrole", { value: roles });
|
Object.defineProperty(Vue.prototype, "$gzrole", { value: roles });
|
||||||
Object.defineProperty(Vue.prototype, "$gzevent", { value: gzeventbus });
|
Object.defineProperty(Vue.prototype, "$gzevent", { value: gzeventbus });
|
||||||
|
|||||||
@@ -206,19 +206,68 @@ const FORM_BASE_URL = "Widget/";
|
|||||||
const FORM_CUSTOM_TEMPLATE_KEY = "widget";
|
const FORM_CUSTOM_TEMPLATE_KEY = "widget";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
beforeRouteEnter(to, from, next) {
|
||||||
|
//debugger;
|
||||||
|
console.log("beforeRouteEnter: TOP");
|
||||||
|
|
||||||
|
var ltKeysRequired = [
|
||||||
|
"Widget",
|
||||||
|
"WidgetName",
|
||||||
|
"WidgetSerial",
|
||||||
|
"WidgetDollarAmount",
|
||||||
|
"WidgetCount",
|
||||||
|
"WidgetRoles",
|
||||||
|
"WidgetStartDate",
|
||||||
|
"WidgetEndDate",
|
||||||
|
"WidgetNotes",
|
||||||
|
"WidgetCustom1",
|
||||||
|
"WidgetCustom2",
|
||||||
|
"WidgetCustom3",
|
||||||
|
"WidgetCustom4",
|
||||||
|
"WidgetCustom5",
|
||||||
|
"WidgetCustom6",
|
||||||
|
"WidgetCustom7",
|
||||||
|
"WidgetCustom8",
|
||||||
|
"WidgetCustom9",
|
||||||
|
"WidgetCustom10",
|
||||||
|
"WidgetCustom11",
|
||||||
|
"WidgetCustom12",
|
||||||
|
"WidgetCustom13",
|
||||||
|
"WidgetCustom14",
|
||||||
|
"WidgetCustom15",
|
||||||
|
"WidgetCustom16"
|
||||||
|
];
|
||||||
|
|
||||||
|
$gzlocale
|
||||||
|
.fetch(ltKeysRequired)
|
||||||
|
.then(
|
||||||
|
$gzformcustomtemplate.get(FORM_CUSTOM_TEMPLATE_KEY).then(next())
|
||||||
|
);
|
||||||
|
|
||||||
|
console.log("beforeRouteEnter: BOTTOM");
|
||||||
|
// //very important as this in conjunction with the menu options means
|
||||||
|
// //navigation guards work properly by just sending people here
|
||||||
|
// next(() => {
|
||||||
|
// auth.logout();
|
||||||
|
// next();
|
||||||
|
// });
|
||||||
|
},
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
console.log("BEFORECREATE: TOP");
|
console.log("BEFORECREATE: TOP");
|
||||||
var vm = this;
|
var vm = this;
|
||||||
initForm(this)
|
initForm(this)
|
||||||
.then(() => {
|
.then(() => {
|
||||||
vm.formState.ready = true;
|
vm.formState.ready = true;
|
||||||
|
console.log("BEFORECREATE: INITFORM THEN");
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
vm.formState.ready = true;
|
vm.formState.ready = true;
|
||||||
vm.$gzHandleFormError(err);
|
vm.$gzHandleFormError(err);
|
||||||
});
|
});
|
||||||
|
console.log("BEFORECREATE: BOTTOM");
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
|
console.log("CREATED: TOP");
|
||||||
this.rights = this.$gzrole.getRights(this, this.$gztype.Widget);
|
this.rights = this.$gzrole.getRights(this, this.$gztype.Widget);
|
||||||
|
|
||||||
this.$gzevent.$on("menu-click", clickHandler);
|
this.$gzevent.$on("menu-click", clickHandler);
|
||||||
@@ -626,9 +675,7 @@ var JUST_DELETED = false;
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
function initForm(vm) {
|
function initForm(vm) {
|
||||||
return vm.$gzformcustomtemplate.get(FORM_CUSTOM_TEMPLATE_KEY).then(fetchLocaleText(vm).then(
|
return populatePickLists(vm);
|
||||||
populatePickLists(vm))
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//////////////////////
|
//////////////////////
|
||||||
@@ -646,38 +693,38 @@ function populatePickLists(vm) {
|
|||||||
//////////////////////
|
//////////////////////
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
function fetchLocaleText(vm) {
|
// function fetchLocaleText(vm) {
|
||||||
//Cache all required lt keys
|
// //Cache all required lt keys
|
||||||
var ltKeysRequired = [
|
// var ltKeysRequired = [
|
||||||
"Widget",
|
// "Widget",
|
||||||
"WidgetName",
|
// "WidgetName",
|
||||||
"WidgetSerial",
|
// "WidgetSerial",
|
||||||
"WidgetDollarAmount",
|
// "WidgetDollarAmount",
|
||||||
"WidgetCount",
|
// "WidgetCount",
|
||||||
"WidgetRoles",
|
// "WidgetRoles",
|
||||||
"WidgetStartDate",
|
// "WidgetStartDate",
|
||||||
"WidgetEndDate",
|
// "WidgetEndDate",
|
||||||
"WidgetNotes",
|
// "WidgetNotes",
|
||||||
"WidgetCustom1",
|
// "WidgetCustom1",
|
||||||
"WidgetCustom2",
|
// "WidgetCustom2",
|
||||||
"WidgetCustom3",
|
// "WidgetCustom3",
|
||||||
"WidgetCustom4",
|
// "WidgetCustom4",
|
||||||
"WidgetCustom5",
|
// "WidgetCustom5",
|
||||||
"WidgetCustom6",
|
// "WidgetCustom6",
|
||||||
"WidgetCustom7",
|
// "WidgetCustom7",
|
||||||
"WidgetCustom8",
|
// "WidgetCustom8",
|
||||||
"WidgetCustom9",
|
// "WidgetCustom9",
|
||||||
"WidgetCustom10",
|
// "WidgetCustom10",
|
||||||
"WidgetCustom11",
|
// "WidgetCustom11",
|
||||||
"WidgetCustom12",
|
// "WidgetCustom12",
|
||||||
"WidgetCustom13",
|
// "WidgetCustom13",
|
||||||
"WidgetCustom14",
|
// "WidgetCustom14",
|
||||||
"WidgetCustom15",
|
// "WidgetCustom15",
|
||||||
"WidgetCustom16"
|
// "WidgetCustom16"
|
||||||
];
|
// ];
|
||||||
|
|
||||||
return vm.$gzlocale.fetch(ltKeysRequired);
|
// return vm.$gzlocale.fetch(ltKeysRequired);
|
||||||
}
|
// }
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
<style></style>
|
||||||
|
|||||||
Reference in New Issue
Block a user