This commit is contained in:
@@ -45,8 +45,19 @@ export default {
|
|||||||
}
|
}
|
||||||
return (store.state.roles & desiredRole) != 0;
|
return (store.state.roles & desiredRole) != 0;
|
||||||
},
|
},
|
||||||
/////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
|
// Get a default empty rights object so that it can be present when a
|
||||||
|
// form first loads
|
||||||
//
|
//
|
||||||
|
defaultRightsObject() {
|
||||||
|
return {
|
||||||
|
change: false,
|
||||||
|
read: false,
|
||||||
|
delete: false
|
||||||
|
};
|
||||||
|
},
|
||||||
|
/////////////////////////////////
|
||||||
|
// oType is the name of the object type as defined in ayatype.js
|
||||||
//
|
//
|
||||||
getRights(vm, oType) {
|
getRights(vm, oType) {
|
||||||
//from bizroles.cs:
|
//from bizroles.cs:
|
||||||
@@ -58,11 +69,7 @@ export default {
|
|||||||
//DELETE = SAME AS CHANGE FOR NOW (There is no specific delete right for now though it's checked for by routes in Authorized.cs in case we want to add it in future as a separate right from create.)
|
//DELETE = SAME AS CHANGE FOR NOW (There is no specific delete right for now though it's checked for by routes in Authorized.cs in case we want to add it in future as a separate right from create.)
|
||||||
//NOTE: biz rules can supersede this, this is just for general rights purposes, if an object has restrictive business rules they will take precedence every time.
|
//NOTE: biz rules can supersede this, this is just for general rights purposes, if an object has restrictive business rules they will take precedence every time.
|
||||||
|
|
||||||
var ret = {
|
var ret = this.defaultRightsObject();
|
||||||
change: false,
|
|
||||||
read: false,
|
|
||||||
delete: false
|
|
||||||
};
|
|
||||||
|
|
||||||
//Get the type name from the type enum value
|
//Get the type name from the type enum value
|
||||||
var typeName = _.findKey(vm.$gztype, function(o) {
|
var typeName = _.findKey(vm.$gztype, function(o) {
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ import Vue from "vue";
|
|||||||
import errorHandler from "./errorhandler";
|
import errorHandler from "./errorhandler";
|
||||||
import store from "../store";
|
import store from "../store";
|
||||||
|
|
||||||
|
|
||||||
var triggeringChange = false;
|
var triggeringChange = false;
|
||||||
|
|
||||||
function isEmpty(o) {
|
function isEmpty(o) {
|
||||||
|
|||||||
@@ -27,6 +27,8 @@ export default function initialize() {
|
|||||||
//Everyone has a home
|
//Everyone has a home
|
||||||
addNavItem(locale.get("Home"), "home", "/");
|
addNavItem(locale.get("Home"), "home", "/");
|
||||||
|
|
||||||
|
//NOTE: If a user has read full record or better then they should have access to that area
|
||||||
|
|
||||||
if (
|
if (
|
||||||
roles.hasRole(roles.AUTHORIZATION_ROLES.TechLimited) ||
|
roles.hasRole(roles.AUTHORIZATION_ROLES.TechLimited) ||
|
||||||
roles.hasRole(roles.AUTHORIZATION_ROLES.TechFull) ||
|
roles.hasRole(roles.AUTHORIZATION_ROLES.TechFull) ||
|
||||||
@@ -45,7 +47,9 @@ export default function initialize() {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
roles.hasRole(roles.AUTHORIZATION_ROLES.InventoryLimited) ||
|
roles.hasRole(roles.AUTHORIZATION_ROLES.InventoryLimited) ||
|
||||||
roles.hasRole(roles.AUTHORIZATION_ROLES.InventoryFull)
|
roles.hasRole(roles.AUTHORIZATION_ROLES.InventoryFull) ||
|
||||||
|
roles.hasRole(roles.AUTHORIZATION_ROLES.BizAdminLimited) ||
|
||||||
|
roles.hasRole(roles.AUTHORIZATION_ROLES.BizAdminFull)
|
||||||
) {
|
) {
|
||||||
addNavItem(locale.get("Inventory"), "dolly", "/inventory");
|
addNavItem(locale.get("Inventory"), "dolly", "/inventory");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,10 +23,10 @@
|
|||||||
}}</span>
|
}}</span>
|
||||||
</v-toolbar-title>
|
</v-toolbar-title>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
<v-btn icon @click="newItem()">
|
<v-btn v-if="this.rights.change" icon @click="newItem()">
|
||||||
<v-icon>fa-plus-circle</v-icon>
|
<v-icon>fa-plus-circle</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn icon>
|
<v-btn icon @click="filterMe()">
|
||||||
<v-icon>fa-filter</v-icon>
|
<v-icon>fa-filter</v-icon>
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-btn icon @click="getDataFromApi()">
|
<v-btn icon @click="getDataFromApi()">
|
||||||
@@ -47,21 +47,36 @@
|
|||||||
:rows-per-page-items="rowsPerPageItems"
|
:rows-per-page-items="rowsPerPageItems"
|
||||||
:rows-per-page-text="this.$gzlocale.get('RowsPerPage')"
|
:rows-per-page-text="this.$gzlocale.get('RowsPerPage')"
|
||||||
class="elevation-1"
|
class="elevation-1"
|
||||||
|
select-all
|
||||||
>
|
>
|
||||||
<template slot="items" slot-scope="props">
|
<template slot="items" slot-scope="props">
|
||||||
<td class="text-xs-left">{{ props.item.name | capitalize }}</td>
|
<td>
|
||||||
<td class="text-xs-left">{{ props.item.serial }}</td>
|
<v-checkbox
|
||||||
<td class="text-xs-left">
|
v-model="props.selected"
|
||||||
|
primary
|
||||||
|
hide-details
|
||||||
|
></v-checkbox>
|
||||||
|
</td>
|
||||||
|
<td class="text-xs-left" @click="editItem(props.item)">
|
||||||
|
{{ props.item.name | capitalize }}
|
||||||
|
</td>
|
||||||
|
<td class="text-xs-left" @click="editItem(props.item)">
|
||||||
|
{{ props.item.serial }}
|
||||||
|
</td>
|
||||||
|
<td class="text-xs-left" @click="editItem(props.item)">
|
||||||
{{ props.item.dollarAmount | currency }}
|
{{ props.item.dollarAmount | currency }}
|
||||||
</td>
|
</td>
|
||||||
<td class="text-xs-left">{{ props.item.active | boolastext }}</td>
|
<td class="text-xs-left" @click="editItem(props.item)">
|
||||||
<td class="text-xs-left">{{ props.item.roles }}</td>
|
{{ props.item.active | boolastext }}
|
||||||
<td class="text-xs-left">{{ props.item.startDate | shortdate }}</td>
|
</td>
|
||||||
<td class="text-xs-left">{{ props.item.endDate | shortdate }}</td>
|
<td class="text-xs-left" @click="editItem(props.item)">
|
||||||
<td class="justify-center layout px-0">
|
{{ props.item.roles }}
|
||||||
<v-icon class="mr-3" @click="editItem(props.item)"
|
</td>
|
||||||
>fa-pencil-alt</v-icon
|
<td class="text-xs-left" @click="editItem(props.item)">
|
||||||
>
|
{{ props.item.startDate | shortdate }}
|
||||||
|
</td>
|
||||||
|
<td class="text-xs-left" @click="editItem(props.item)">
|
||||||
|
{{ props.item.endDate | shortdate }}
|
||||||
</td>
|
</td>
|
||||||
</template>
|
</template>
|
||||||
</v-data-table>
|
</v-data-table>
|
||||||
@@ -71,12 +86,13 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
/* Xeslint-disable */
|
/* eslint-disable */
|
||||||
const FORM_KEY = "inventorywidgetlist";
|
const FORM_KEY = "inventorywidgetlist";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
beforeCreate() {
|
beforeCreate() {
|
||||||
var that = this;
|
var that = this;
|
||||||
|
|
||||||
this.$gzlocale
|
this.$gzlocale
|
||||||
.fetch([
|
.fetch([
|
||||||
"Widget",
|
"Widget",
|
||||||
@@ -97,6 +113,8 @@ export default {
|
|||||||
});
|
});
|
||||||
})
|
})
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
//don't have access to local data object until here
|
||||||
|
that.rights = this.$gzrole.getRights(this, this.$gztype.Widget);
|
||||||
var formSettings = that.$gzform.getFormSettings(FORM_KEY);
|
var formSettings = that.$gzform.getFormSettings(FORM_KEY);
|
||||||
/**
|
/**
|
||||||
* {
|
* {
|
||||||
@@ -140,6 +158,7 @@ export default {
|
|||||||
appError: null,
|
appError: null,
|
||||||
serverError: {}
|
serverError: {}
|
||||||
},
|
},
|
||||||
|
rights: this.$gzrole.defaultRightsObject(),
|
||||||
totalItems: 0,
|
totalItems: 0,
|
||||||
Items: [],
|
Items: [],
|
||||||
loading: true,
|
loading: true,
|
||||||
@@ -149,6 +168,7 @@ export default {
|
|||||||
selected: [],
|
selected: [],
|
||||||
rowsPerPageItems: [5, 10, 25, 99],
|
rowsPerPageItems: [5, 10, 25, 99],
|
||||||
rowsPerPageText: "blah per blah",
|
rowsPerPageText: "blah per blah",
|
||||||
|
selected: [],
|
||||||
headers: [
|
headers: [
|
||||||
{
|
{
|
||||||
text: "WidgetName",
|
text: "WidgetName",
|
||||||
@@ -181,6 +201,9 @@ export default {
|
|||||||
params: { id: 0 }
|
params: { id: 0 }
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
filterMe() {
|
||||||
|
console.log(this.selected);
|
||||||
|
},
|
||||||
getDataFromApi() {
|
getDataFromApi() {
|
||||||
var that = this;
|
var that = this;
|
||||||
var listOptions = {
|
var listOptions = {
|
||||||
|
|||||||
@@ -201,6 +201,7 @@ function generateMenu(vm, readOnly) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
if (readOnly != true) {
|
if (readOnly != true) {
|
||||||
|
//TODO: Handle new record here
|
||||||
menuOptions.menuItems = [
|
menuOptions.menuItems = [
|
||||||
{
|
{
|
||||||
title: vm.$gzlocale.get("Save"),
|
title: vm.$gzlocale.get("Save"),
|
||||||
@@ -276,6 +277,19 @@ export default {
|
|||||||
//id 0 means create a new record don't load one
|
//id 0 means create a new record don't load one
|
||||||
if (this.$route.params.id != 0) {
|
if (this.$route.params.id != 0) {
|
||||||
this.getDataFromApi();
|
this.getDataFromApi();
|
||||||
|
} else {
|
||||||
|
//setup for new record
|
||||||
|
//first get rights, are they allowed here at all?
|
||||||
|
//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);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeRouteLeave(to, from, next) {
|
beforeRouteLeave(to, from, next) {
|
||||||
@@ -354,8 +368,9 @@ export default {
|
|||||||
.get(url)
|
.get(url)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.error) {
|
if (res.error) {
|
||||||
|
//Not found?
|
||||||
if (res.error.code == "2010") {
|
if (res.error.code == "2010") {
|
||||||
//notify error then navigate backwards
|
//notify not found error then navigate backwards
|
||||||
vm.$gzdialog
|
vm.$gzdialog
|
||||||
.displayLTErrorMessage(vm, "ErrorAPI2010")
|
.displayLTErrorMessage(vm, "ErrorAPI2010")
|
||||||
.then(() => {
|
.then(() => {
|
||||||
|
|||||||
Reference in New Issue
Block a user