This commit is contained in:
2019-06-17 23:34:33 +00:00
parent 5dfb97759a
commit 1f84f24105
2 changed files with 188 additions and 234 deletions

View File

@@ -24,8 +24,6 @@ export default {
}
if (needIt.length == 0) {
//eslint-disable-next-line
debugger;
resolve();
return;
}
@@ -38,8 +36,7 @@ export default {
_.forEach(response.data, function commitFetchedLTItemToStore(item) {
store.commit("addLocaleText", item);
});
//eslint-disable-next-line
debugger;
resolve();
});
});

View File

@@ -121,8 +121,11 @@
></v-checkbox>
</v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2>
<v-text-field
<v-select
v-model="obj.roles"
:items="pickLists.roles"
item-text="name"
item-value="id"
:readonly="this.formState.readOnly"
:label="this.$gzlocale.get('WidgetRoles')"
ref="roles"
@@ -133,10 +136,31 @@
:error-messages="this.$gzform.serverErrors(this, 'roles')"
required
@change="onChange('roles')"
></v-select>
</v-flex>
<v-flex xs12 sm6 lg4 xl3 px-2>
<v-text-field
v-model="obj.roles"
:readonly="this.formState.readOnly"
:label="this.$gzlocale.get('WidgetRoles')"
ref="roles2"
:rules="[
this.$gzform.integerValid(this, 'roles2'),
this.$gzform.required(this, 'roles2')
]"
:error-messages="this.$gzform.serverErrors(this, 'roles2')"
required
@change="onChange('roles2')"
type="number"
></v-text-field>
</v-flex>
</v-layout>
<v-layout align-left justify-center row wrap mt-5>
<v-flex xs6 sm4>
PICKLISTS: {{ pickLists.roles }}
<br />
</v-flex>
</v-layout>
<!-- <v-layout align-left justify-center row wrap mt-5>
<v-flex xs6 sm4>
READY: {{ formState.ready }}
@@ -164,226 +188,18 @@
const FORM_KEY = "inventory-widget-edit";
const FORM_BASE_URL = "Widget/";
/////////////////////////////
//
//
function clickHandler(menuItem) {
if (!menuItem) {
return;
}
var m = this.$gzmenu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "save":
m.vm.submit();
break;
case "delete":
m.vm.remove();
break;
case "duplicate":
m.vm.duplicate();
break;
case "report":
var reportList = m.vm.$gzreport.availableReports("WIDGET");
var selectedItem = reportList[0].value;
m.vm.$gzdialog
.getReportChoice(m.vm, reportList, selectedItem)
.then(res => {
if (res) {
m.vm.$gzevent.$emit(
"notify-success",
FORM_KEY + "::report click, selected is: [" + res + "]"
);
}
});
break;
default:
m.vm.$gzevent.$emit(
"notify-warning",
FORM_KEY + "::context click: [" + m.key + "]"
);
}
}
}
//////////////////////
//
//
function generateMenu(vm) {
// console.log("Generating menu");
// console.log("GENERATE MENU: Rights currently are:");
// console.log(vm.rights);
var menuOptions = {
isMain: false,
icon: "fa-splotch",
title: vm.$gzlocale.get("Widget"),
helpUrl: "intro/#searching",
menuItems: []
};
//TODO: save and new? Or only from main?
if (vm.rights.change) {
menuOptions.menuItems.push({
title: vm.$gzlocale.get("Save"),
icon: "save",
surface: true,
key: FORM_KEY + ":save",
vm: vm
});
}
if (vm.rights.delete) {
menuOptions.menuItems.push({
title: vm.$gzlocale.get("Delete"),
icon: "trash-alt",
surface: true,
key: FORM_KEY + ":delete",
vm: vm
});
}
if (vm.rights.change) {
menuOptions.menuItems.push({
title: vm.$gzlocale.get("Duplicate"),
icon: "clone",
key: FORM_KEY + ":duplicate",
vm: vm
});
}
//STUB REPORTS
menuOptions.menuItems.push({
title: vm.$gzlocale.get("Print"),
icon: "print",
key: FORM_KEY + ":report",
vm: vm
});
vm.$gzevent.$emit("menu-change", menuOptions);
}
var JUST_DELETED = false;
//////////////////////
//
//
function initForm(vm) {
return populatePickLists(vm).then(() => {
return fetchLocaleText(vm);
//eslint-disable-next-line
debugger;
});
//return fetchLocaleText().then(populatePickLists(vm));
}
function populatePickLists(vm) {
return vm.$gzapi
.get("AyaEnumPickList/list/authorizationroles") //roles
.then(res => {
if (res.error) {
throw res.error;
}
//populate here but for now show it
//eslint-disable-next-line
debugger;
});
}
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).then(() => {
//eslint-disable-next-line
debugger;
});
}
export default {
beforeCreate() {
//console.log("BEFORECREATE: TOP");
var vm = this;
initForm(this)
.then(() => {
//eslint-disable-next-line
debugger;
vm.formState.ready = true;
})
.catch(err => {
vm.formState.ready = true;
vm.$gzHandleFormError(err);
});
// //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"
// ];
// this.$gzlocale
// .fetch(ltKeysRequired)
// .then(() => {
// //populate all form pick list data
// populatePickLists().then(() => {
// //don't have access to local data object until here
// vm.formState.ready = true;
// });
// })
// .catch(err => {
// vm.formState.ready = true;
// vm.$gzHandleFormError(err);
// });
},
created() {
// console.log("CREATED: TOP");
@@ -448,27 +264,9 @@ export default {
components: {},
data() {
return {
/*
this needs to have all properties set that *could* exist for a widget up front here in declaration
{"data":{"id":100,"concurrencyToken":2197,"name":"Handmade Cotton Chair 122","serial":100,"dollarAmount":811.47000,"active":true,"roles":8212,
"startDate":"2019-06-06T08:48:13.059631Z","endDate":"2019-06-06T12:38:30.654906Z",
"notes":"Minima qui assumenda.","count":0,"customFields":null,"tags":["indigo","brown","silver","gold"]}}
{
id: 0,
concurrencyToken: 0,
name: "",
serial: 0,
dollarAmount: 0,
active: false,
roles: 0,
startDate: "",
endDate: "",
notes: "",
count: 0,
customFields: [],
tags: []
}
*/
pickLists: {
roles: []
},
obj: {
id: 0,
concurrencyToken: 0,
@@ -702,6 +500,165 @@ export default {
}
}
};
/////////////////////////////
//
//
function clickHandler(menuItem) {
if (!menuItem) {
return;
}
var m = this.$gzmenu.parseMenuItem(menuItem);
if (m.owner == FORM_KEY && !m.disabled) {
switch (m.key) {
case "save":
m.vm.submit();
break;
case "delete":
m.vm.remove();
break;
case "duplicate":
m.vm.duplicate();
break;
case "report":
var reportList = m.vm.$gzreport.availableReports("WIDGET");
var selectedItem = reportList[0].value;
m.vm.$gzdialog
.getReportChoice(m.vm, reportList, selectedItem)
.then(res => {
if (res) {
m.vm.$gzevent.$emit(
"notify-success",
FORM_KEY + "::report click, selected is: [" + res + "]"
);
}
});
break;
default:
m.vm.$gzevent.$emit(
"notify-warning",
FORM_KEY + "::context click: [" + m.key + "]"
);
}
}
}
//////////////////////
//
//
function generateMenu(vm) {
// console.log("Generating menu");
// console.log("GENERATE MENU: Rights currently are:");
// console.log(vm.rights);
var menuOptions = {
isMain: false,
icon: "fa-splotch",
title: vm.$gzlocale.get("Widget"),
helpUrl: "intro/#searching",
menuItems: []
};
//TODO: save and new? Or only from main?
if (vm.rights.change) {
menuOptions.menuItems.push({
title: vm.$gzlocale.get("Save"),
icon: "save",
surface: true,
key: FORM_KEY + ":save",
vm: vm
});
}
if (vm.rights.delete) {
menuOptions.menuItems.push({
title: vm.$gzlocale.get("Delete"),
icon: "trash-alt",
surface: true,
key: FORM_KEY + ":delete",
vm: vm
});
}
if (vm.rights.change) {
menuOptions.menuItems.push({
title: vm.$gzlocale.get("Duplicate"),
icon: "clone",
key: FORM_KEY + ":duplicate",
vm: vm
});
}
//STUB REPORTS
menuOptions.menuItems.push({
title: vm.$gzlocale.get("Print"),
icon: "print",
key: FORM_KEY + ":report",
vm: vm
});
vm.$gzevent.$emit("menu-change", menuOptions);
}
var JUST_DELETED = false;
//////////////////////
//
//
function initForm(vm) {
return fetchLocaleText(vm).then(populatePickLists(vm));
}
//////////////////////
//
//
function populatePickLists(vm) {
return vm.$gzapi
.get("AyaEnumPickList/list/authorizationroles") //roles
.then(res => {
if (res.error) {
throw res.error;
}
vm.pickLists.roles = res.data;
});
}
//////////////////////
//
//
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);
}
</script>
<style></style>