This commit is contained in:
2019-03-06 20:09:04 +00:00
parent 0aa3c29a87
commit 0242b5ba03
3 changed files with 72 additions and 36 deletions

View File

@@ -45,7 +45,7 @@ export default {
beforeCreate() {
//created() {
//check pre-requisites exist just in case
if (!this.$xdayjs) {
if (!this.$dayjs) {
throw "GzDateAndTimePicker: the DayJS library is required and missing";
}
},

View File

@@ -11,20 +11,22 @@ import errorHandler from "./api/errorhandler";
import NProgress from "nprogress";
import "nprogress/nprogress.css";
import dayjs from "dayjs";
import locale from "./api/locale";
import gzdateandtimepicker from "./components/gzdateandtimepicker.vue";
/////////////////////////////////////////////////////////////////
// LIBS AND GLOBAL STUFF
// LIBS AND GLOBAL ITEMS
// (https://medium.com/js-dojo/use-any-javascript-library-with-vue-js-3f7e2a4974a8)
//
Object.defineProperty(Vue.prototype, "$dayjs", { value: dayjs });
Object.defineProperty(Vue.prototype, "$gzlocale", { value: locale });
/////////////////////////////////////////////////////////////////
// FORM VALIDATION
//
import VeeValidate from "vee-validate";
Vue.use(VeeValidate);
Vue.config.productionTip = false;
//Vue.config.productionTip = false;
/////////////////////////////////////////////////////////////////
// ERROR HANDLING

View File

@@ -89,37 +89,13 @@
/* eslint-disable */
// type="checkbox"
//import store from "../store";
import locale from "../api/locale";
//import locale from "../api/locale";
import api from "../api/apiutil";
//import dayjs from "dayjs";
//import _ from "../utils/libs/lodash.js";
export default {
components: {},
data() {
return {
obj: {},
lc: locale,
// dayjsLib: dayjs,
theDate: new Date(),
date: new Date().toISOString().substr(0, 10),
menu: false,
modal: false,
menu2: false
};
},
computed: {
// dateFormatted() {
// // var value = this.obj.startDate;
// // if (!value) return "";
// // var dj = dayjs(value);
// // return dj.format("YYYY-MM-DD hh:mm:ss A");
// return this.obj.startDate
// ? dayjs(this.obj.startDate).format("YYYY-MM-DD hh:mm:ss A")
// : "";
// //return this.obj.startDate ? moment(this.date).format("dddd, MMMM Do YYYY") : "";
// }
},
beforeRouteEnter(to, from, next) {
beforeCreate() {
//debugger;
//Cache all required lt keys
var ltKeysRequired = [
"Widget",
@@ -147,11 +123,69 @@ export default {
"WidgetCustom14",
"WidgetCustom15",
"WidgetCustom16"
].concat(locale.commonKeysEditForm);
locale.fetch(ltKeysRequired).then(() => {
next();
});
].concat(this.$gzlocale.commonKeysEditForm);
this.$gzlocale.fetch(ltKeysRequired);
},
components: {},
data() {
return {
obj: {},
lc: this.$gzlocale,
// dayjsLib: dayjs,
theDate: new Date(),
date: new Date().toISOString().substr(0, 10),
menu: false,
modal: false,
menu2: false
};
},
computed: {
// dateFormatted() {
// // var value = this.obj.startDate;
// // if (!value) return "";
// // var dj = dayjs(value);
// // return dj.format("YYYY-MM-DD hh:mm:ss A");
// return this.obj.startDate
// ? dayjs(this.obj.startDate).format("YYYY-MM-DD hh:mm:ss A")
// : "";
// //return this.obj.startDate ? moment(this.date).format("dddd, MMMM Do YYYY") : "";
// }
}
,
// beforeRouteEnter(to, from, next) {
// // debugger;
// //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"
// ].concat(this.$gzlocale.commonKeysEditForm);
// this.$gzlocale.fetch(ltKeysRequired).then(() => {
// next();
// });
// },
mounted() {
// debugger;
// this.getDataFromApi();
@@ -184,7 +218,7 @@ export default {
test() {
// debugger;
console.log(this.lc.decimalParse(this.obj.dollarAmount));
//console.log(this.lc.decimalParse(this.obj.dollarAmount));
}
},
created() {