This commit is contained in:
2019-06-05 23:45:44 +00:00
parent e4cdad6974
commit 629b93295e
2 changed files with 53 additions and 42 deletions

View File

@@ -50,9 +50,8 @@ TODO: Grid / LIST VIEW = I know customers will want to control what shows in the
- Security and business rules may affect this as well, for some users they have rights to some of the record but not all of it, i.e. subcontractor so we do need granular field level control over what goes out from the server and at the client expectations
- Maybe list objects also return a list of fields the current user will expect to see so the list can be pre-set up with the columns at the client *then* the data fetched to populate the list
- Server should not send fields that are restricted or have them blocked out or something.
TODO: Grid list view should be easier to open, the open button should not be at the far right but more of the whole entire element or a larger portion of it maybe?
DONE: Grid list view should be easier to open, the open button should not be at the far right but more of the whole entire element or a larger portion of it maybe?
TODO: Outstanding case with vuetify bug in clear button when readonly, check if fixed and if it isn't might need a workaround
TODO: code the user options with the currency symbol etc on the server and then update client to fetch them. Use static values instad in locale.
Locale should fetch those settings the first time it sees they are not present so that they are refreshed upon use and are not stored in localstorage
(or should they be? anyway, can work that out later)

View File

@@ -191,7 +191,7 @@ function clickHandler(menuItem) {
//////////////////////
//
//
function generateMenu(vm, readOnly) {
function generateMenu(vm) {
var menuOptions = {
isMain: false,
icon: "fa-splotch",
@@ -200,32 +200,34 @@ function generateMenu(vm, readOnly) {
menuItems: []
};
if (readOnly != true) {
//TODO: Handle new record here
menuOptions.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"),
//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: "inventory-widget-edit:save",
vm: vm
});
}
icon: "clone",
key: "inventory-widget-edit:duplicate",
vm: vm
}
];
if (vm.rights.delete) {
menuOptions.menuItems.push({
title: vm.$gzlocale.get("Delete"),
icon: "trash-alt",
surface: true,
key: "inventory-widget-edit:delete",
vm: vm
});
}
if (vm.rights.change) {
menuOptions.menuItems.push({
title: vm.$gzlocale.get("Duplicate"),
icon: "clone",
key: "inventory-widget-edit:duplicate",
vm: vm
});
}
vm.$gzevent.$emit("menu-change", menuOptions);
@@ -266,7 +268,11 @@ export default {
var vm = this;
this.$gzlocale
.fetch(ltKeysRequired)
.then(() => (vm.formState.ready = true))
.then(() => {
//don't have access to local data object until here
vm.rights = this.$gzrole.getRights(this, this.$gztype.Widget);
vm.formState.ready = true;
})
.catch(err => {
vm.formState.ready = true;
vm.$gzHandleFormError(err);
@@ -279,17 +285,21 @@ export default {
this.getDataFromApi();
} else {
//setup for new record
//first get rights, are they allowed here at all?
var readOnly = this.rights.change;
//Update the form status
// this.$gzform.setFormState({
// vm: this,
// dirty: false,
// valid: true,
// loading: false,
// readOnly: res.readOnly ? true : false
// });
// //modify the menu as necessary
// generateMenu(this, res.readOnly);
this.$gzform.setFormState({
vm: this,
dirty: false,
valid: true,
loading: false,
readOnly: readOnly
});
//it's a new record so it can't be deleted so...
this.rights.delete = false;
//modify the menu as necessary
generateMenu(this);
}
},
beforeRouteLeave(to, from, next) {
@@ -322,7 +332,8 @@ export default {
errorBoxMessage: null,
appError: null,
serverError: {}
}
},
rights: this.$gzrole.defaultRightsObject()
};
},
//WATCHERS
@@ -423,7 +434,8 @@ export default {
} else {
//Logic for detecting if a post or put: if id then it was a post, if no id then it was a put
if (res.id) {
//Handle "post" of new record
//Handle "post" of new record (CREATE)
//wouldn't this be cleaner if it just opened the new record directly since the url still has zero in the id field??
vm.obj = res.data;
vm.$gzform.setFormState({
vm: vm,
@@ -431,7 +443,7 @@ export default {
readOnly: res.readOnly ? true : false
});
} else {
//Handle "put" of an existing record
//Handle "put" of an existing record (UPDATE)
vm.obj.concurrencyToken = res.data.concurrencyToken;
vm.$gzform.setFormState({
vm: vm,