This commit is contained in:
2019-05-01 19:08:51 +00:00
parent 9a51e8c4e8
commit 3ebf647d53
3 changed files with 106 additions and 56 deletions

View File

@@ -74,7 +74,7 @@ All platforms and browsers
- Wire up delete menu item - Wire up delete menu item
- api code is stubbed out for delete, need to write that as well - api code is stubbed out for delete, need to write that as well
- DONE TODO navigating through menu doesn't "back" properly when clicking back on browser controls - DONE TODO navigating through menu doesn't "back" properly when clicking back on browser controls
= TODO: widget form now not localized title at menu top
- Widget list, refresh page causes items per page to reset back to 5 from custom setting, it should cache that shit at least for a session anyway - Widget list, refresh page causes items per page to reset back to 5 from custom setting, it should cache that shit at least for a session anyway

View File

@@ -13,6 +13,7 @@ export default {
handleMenuChange(vm, ctx) { handleMenuChange(vm, ctx) {
vm.appBar.isMain = ctx.isMain; vm.appBar.isMain = ctx.isMain;
vm.appBar.icon = ctx.icon; vm.appBar.icon = ctx.icon;
vm.appBar.title = ctx.title; vm.appBar.title = ctx.title;
//set the help url if presented or default to the top of the index //set the help url if presented or default to the top of the index
vm.appBar.helpUrl = ctx.helpUrl ? ctx.helpUrl : "index.html"; vm.appBar.helpUrl = ctx.helpUrl ? ctx.helpUrl : "index.html";

View File

@@ -13,7 +13,7 @@
transition="scale-transition" transition="scale-transition"
class="multi-line" class="multi-line"
outline outline
>{{formState.errorBoxMessage}}</v-alert> >{{ formState.errorBoxMessage }}</v-alert>
</v-flex> </v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
<v-text-field <v-text-field
@@ -23,8 +23,11 @@
@click:clear="onChange('name')" @click:clear="onChange('name')"
:counter="255" :counter="255"
:label="this.$gzlocale.get('WidgetName')" :label="this.$gzlocale.get('WidgetName')"
:rules="[this.$gzform.max255(this,'name'),this.$gzform.required(this,'name')]" :rules="[
:error-messages="this.$gzform.serverErrors(this,'name')" this.$gzform.max255(this, 'name'),
this.$gzform.required(this, 'name')
]"
:error-messages="this.$gzform.serverErrors(this, 'name')"
ref="name" ref="name"
@change="onChange('name')" @change="onChange('name')"
></v-text-field> ></v-text-field>
@@ -37,8 +40,8 @@
@click:clear="onChange('serial')" @click:clear="onChange('serial')"
:counter="10" :counter="10"
:label="this.$gzlocale.get('WidgetSerial')" :label="this.$gzlocale.get('WidgetSerial')"
:rules="[this.$gzform.maxLength(this,'serial',10)]" :rules="[this.$gzform.maxLength(this, 'serial', 10)]"
:error-messages="this.$gzform.serverErrors(this,'serial')" :error-messages="this.$gzform.serverErrors(this, 'serial')"
ref="serial" ref="serial"
@change="onChange('serial')" @change="onChange('serial')"
></v-text-field> ></v-text-field>
@@ -52,8 +55,11 @@
:counter="10" :counter="10"
:label="this.$gzlocale.get('WidgetCount')" :label="this.$gzlocale.get('WidgetCount')"
ref="count" ref="count"
:rules="[this.$gzform.integerValid(this,'count'),this.$gzform.required(this,'count')]" :rules="[
:error-messages="this.$gzform.serverErrors(this,'count')" this.$gzform.integerValid(this, 'count'),
this.$gzform.required(this, 'count')
]"
:error-messages="this.$gzform.serverErrors(this, 'count')"
required required
@change="onChange('count')" @change="onChange('count')"
type="number" type="number"
@@ -68,8 +74,11 @@
:label="this.$gzlocale.get('WidgetDollarAmount')" :label="this.$gzlocale.get('WidgetDollarAmount')"
ref="dollarAmount" ref="dollarAmount"
required required
:rules="[this.$gzform.decimalValid(this,'dollarAmount'),this.$gzform.required(this,'dollarAmount')]" :rules="[
:error-messages="this.$gzform.serverErrors(this,'dollarAmount')" this.$gzform.decimalValid(this, 'dollarAmount'),
this.$gzform.required(this, 'dollarAmount')
]"
:error-messages="this.$gzform.serverErrors(this, 'dollarAmount')"
@change="onChange('dollarAmount')" @change="onChange('dollarAmount')"
type="number" type="number"
></v-text-field> ></v-text-field>
@@ -81,16 +90,18 @@
v-model="obj.startDate" v-model="obj.startDate"
:readonly="this.formState.readOnly" :readonly="this.formState.readOnly"
ref="startDate" ref="startDate"
:error-messages="this.$gzform.serverErrors(this,'startDate')" :error-messages="this.$gzform.serverErrors(this, 'startDate')"
@change="onChange('startDate')" @change="onChange('startDate')"
></gz-date-time-picker> ></gz-date-time-picker>
</v-flex> </v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2> <v-flex xs12 sm6 lg4 xl3 px-2>
<gz-date-time-picker <gz-date-time-picker
:label="this.$gzlocale.get('WidgetEndDate')" :label="this.$gzlocale.get('WidgetEndDate')"
:rules="[this.$gzform.datePrecedence(this,'startDate','endDate')]" :rules="[
:error-messages="this.$gzform.serverErrors(this,'endDate')" this.$gzform.datePrecedence(this, 'startDate', 'endDate')
]"
:error-messages="this.$gzform.serverErrors(this, 'endDate')"
v-model="obj.endDate" v-model="obj.endDate"
:readonly="this.formState.readOnly" :readonly="this.formState.readOnly"
ref="endDate" ref="endDate"
@@ -103,7 +114,7 @@
:readonly="this.formState.readOnly" :readonly="this.formState.readOnly"
:label="this.$gzlocale.get('Active')" :label="this.$gzlocale.get('Active')"
ref="active" ref="active"
:error-messages="this.$gzform.serverErrors(this,'active')" :error-messages="this.$gzform.serverErrors(this, 'active')"
required required
@change="onChange('active')" @change="onChange('active')"
></v-checkbox> ></v-checkbox>
@@ -114,8 +125,11 @@
:readonly="this.formState.readOnly" :readonly="this.formState.readOnly"
:label="this.$gzlocale.get('WidgetRoles')" :label="this.$gzlocale.get('WidgetRoles')"
ref="roles" ref="roles"
:rules="[this.$gzform.integerValid(this,'roles'),this.$gzform.required(this,'roles')]" :rules="[
:error-messages="this.$gzform.serverErrors(this,'roles')" this.$gzform.integerValid(this, 'roles'),
this.$gzform.required(this, 'roles')
]"
:error-messages="this.$gzform.serverErrors(this, 'roles')"
required required
@change="onChange('roles')" @change="onChange('roles')"
type="number" type="number"
@@ -125,15 +139,15 @@
<v-layout align-left justify-center row wrap mt-5> <v-layout align-left justify-center row wrap mt-5>
<v-flex xs6 sm4> <v-flex xs6 sm4>
READY: {{formState.ready}} READY: {{ formState.ready }}
<br> <br>
LOADING: {{formState.loading}} LOADING: {{ formState.loading }}
<br> <br>
DIRTY: {{formState.dirty}} DIRTY: {{ formState.dirty }}
<br> <br>
VALID: {{formState.valid}} VALID: {{ formState.valid }}
<br> <br>
READONLY: {{formState.readOnly}} READONLY: {{ formState.readOnly }}
<br> <br>
</v-flex> </v-flex>
</v-layout> </v-layout>
@@ -154,7 +168,7 @@
</template> </template>
<script> <script>
/* Xeslint-disable */ /* eslint-disable */
//import ayatype from "../api/ayatype"; //import ayatype from "../api/ayatype";
function clickHandler(menuItem) { function clickHandler(menuItem) {
@@ -207,6 +221,7 @@ export default {
// // has access to `this` component instance. // // has access to `this` component instance.
// }, // },
beforeCreate() { beforeCreate() {
console.log("BEFORE CREATE CALLED");
//Cache all required lt keys //Cache all required lt keys
var ltKeysRequired = [ var ltKeysRequired = [
"Widget", "Widget",
@@ -236,45 +251,80 @@ export default {
"WidgetCustom16" "WidgetCustom16"
]; ];
var vm = this; var vm = this;
//console.log("B4CREATE FETCHING KEYS NOW");
this.$gzlocale this.$gzlocale
.fetch(ltKeysRequired) .fetch(ltKeysRequired)
.then(() => (this.formState.ready = true)) //.then(() => console.log("KEYS FETCHED"))
.then(function() {
vm.$gzevent.$emit("menu-change", {
isMain: false,
icon: "fa-splotch",
title: vm.$gzlocale.get("Widget"),
helpUrl: "intro/#searching",
menuItems: [
{
title: vm.$gzlocale.get("Save"),
icon: "save",
surface: true,
key: "inventory-widget-edit:save",
vm: vm
},
{
title: vm.$gzlocale.get("Delete"),
icon: "trash-alt",
surface: true,
key: "inventory-widget-edit:delete",
vm: vm
},
{ divider: true, inset: false },
{
title: vm.$gzlocale.get("Duplicate"),
icon: "clone",
key: "inventory-widget-edit:duplicate",
vm: vm
}
]
});
})
.then(() => (vm.formState.ready = true))
.catch(err => { .catch(err => {
this.formState.ready = true; vm.formState.ready = true;
vm.$gzHandleFormError(err); vm.$gzHandleFormError(err);
}); });
}, },
created() { created() {
this.$gzevent.$emit("menu-change", { //console.log("CREATED CALLED");
isMain: false, // this.$gzevent.$emit("menu-change", {
icon: "fa-splotch", // isMain: false,
title: this.$gzlocale.get("Widget"), // icon: "fa-splotch",
helpUrl: "intro/#searching", // title: this.$gzlocale.get("Widget"),
// helpUrl: "intro/#searching",
menuItems: [ // menuItems: [
{ // {
title: this.$gzlocale.get("Save"), // title: this.$gzlocale.get("Save"),
icon: "save", // icon: "save",
surface: true, // surface: true,
key: "inventory-widget-edit:save", // key: "inventory-widget-edit:save",
vm: this // vm: this
}, // },
{ // {
title: this.$gzlocale.get("Delete"), // title: this.$gzlocale.get("Delete"),
icon: "trash-alt", // icon: "trash-alt",
surface: true, // surface: true,
key: "inventory-widget-edit:delete", // key: "inventory-widget-edit:delete",
vm: this // vm: this
}, // },
{ divider: true, inset: false }, // { divider: true, inset: false },
{ // {
title: this.$gzlocale.get("Duplicate"), // title: this.$gzlocale.get("Duplicate"),
icon: "clone", // icon: "clone",
key: "inventory-widget-edit:duplicate", // key: "inventory-widget-edit:duplicate",
vm: this // vm: this
} // }
] // ]
}); // });
this.$gzevent.$on("menu-click", clickHandler); this.$gzevent.$on("menu-click", clickHandler);
this.getDataFromApi(); this.getDataFromApi();
@@ -436,8 +486,7 @@ export default {
}; };
</script> </script>
<style> <style></style>
</style>
/* /*
Sample widget record api v8 Sample widget record api v8