This commit is contained in:
2019-07-19 00:10:06 +00:00
parent 2137d57e76
commit 300105ad41
4 changed files with 92 additions and 37 deletions

View File

@@ -206,19 +206,68 @@ const FORM_BASE_URL = "Widget/";
const FORM_CUSTOM_TEMPLATE_KEY = "widget";
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() {
console.log("BEFORECREATE: TOP");
var vm = this;
initForm(this)
.then(() => {
vm.formState.ready = true;
console.log("BEFORECREATE: INITFORM THEN");
})
.catch(err => {
vm.formState.ready = true;
vm.$gzHandleFormError(err);
});
console.log("BEFORECREATE: BOTTOM");
},
created() {
console.log("CREATED: TOP");
this.rights = this.$gzrole.getRights(this, this.$gztype.Widget);
this.$gzevent.$on("menu-click", clickHandler);
@@ -626,9 +675,7 @@ var JUST_DELETED = false;
// }
function initForm(vm) {
return vm.$gzformcustomtemplate.get(FORM_CUSTOM_TEMPLATE_KEY).then(fetchLocaleText(vm).then(
populatePickLists(vm))
);
return populatePickLists(vm);
}
//////////////////////
@@ -646,38 +693,38 @@ function populatePickLists(vm) {
//////////////////////
//
//
function fetchLocaleText(vm) {
//Cache all required lt keys
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"
];
// function fetchLocaleText(vm) {
// //Cache all required lt keys
// 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"
// ];
return vm.$gzlocale.fetch(ltKeysRequired);
}
// return vm.$gzlocale.fetch(ltKeysRequired);
// }
</script>
<style></style>