This commit is contained in:
@@ -23,7 +23,7 @@ ACTIONS:
|
|||||||
XNOPE, doesn't offer to filter, only sort and I'm happy with it for now.If it basically is working well enough regardless of filtering roles then see if its even conceivable that server could filter roles
|
XNOPE, doesn't offer to filter, only sort and I'm happy with it for now.If it basically is working well enough regardless of filtering roles then see if its even conceivable that server could filter roles
|
||||||
maybe the client sends a lot of or i.e. roles = (64 or 1234 or 32768) however that shit has to work
|
maybe the client sends a lot of or i.e. roles = (64 or 1234 or 32768) however that shit has to work
|
||||||
if conceivable then need to make a copy of the ay-data-list-view.vue and modify to work with roles as a filter
|
if conceivable then need to make a copy of the ay-data-list-view.vue and modify to work with roles as a filter
|
||||||
Make sure can print, bulk ops etc
|
XMake sure can print, bulk ops etc
|
||||||
If all is well then move it into the regular adm-users and replicate to cust-users and ditch the shitty current half-ass grid
|
If all is well then move it into the regular adm-users and replicate to cust-users and ditch the shitty current half-ass grid
|
||||||
Remove the routes that were being used for inside and outside user lists as they are no longer reqd.
|
Remove the routes that were being used for inside and outside user lists as they are no longer reqd.
|
||||||
$profit
|
$profit
|
||||||
@@ -58,7 +58,7 @@ todo: Initialize has an expired license section that prevents all other options
|
|||||||
todo: Case 3595 Mass delete extension
|
todo: Case 3595 Mass delete extension
|
||||||
Do this early as it will be copied over and over again
|
Do this early as it will be copied over and over again
|
||||||
|
|
||||||
|
todo: test import User record
|
||||||
|
|
||||||
............................................................
|
............................................................
|
||||||
|
|
||||||
|
|||||||
@@ -1,156 +1,80 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
<gz-report-selector ref="reportSelector"></gz-report-selector>
|
||||||
<v-data-table
|
<gz-extensions
|
||||||
v-model="selected"
|
:ayaType="ayType"
|
||||||
:headers="headers"
|
:selectedItems="selectedItems"
|
||||||
:items="obj"
|
ref="extensions"
|
||||||
class="elevation-1"
|
|
||||||
:disable-pagination="true"
|
|
||||||
:disable-filtering="true"
|
|
||||||
hide-default-footer
|
|
||||||
@click:row="rowClick"
|
|
||||||
:sort-by="['name']"
|
|
||||||
:header-props="{ sortByText: $ay.t('Sort') }"
|
|
||||||
data-cy="usersTable"
|
|
||||||
>
|
>
|
||||||
<template v-slot:[`item.active`]="{ item }">
|
</gz-extensions>
|
||||||
<v-simple-checkbox v-model="item.active" disabled></v-simple-checkbox>
|
<gz-data-table
|
||||||
</template>
|
ref="gzdatatable"
|
||||||
<!-- Keeping as an example of custom narrowing a single column <template v-slot:[`item.roles`]="{ item }">
|
formKey="adm-users"
|
||||||
<div class="red--text text-truncate" style="max-width: 150px;">
|
:dataListKey="dataListKey"
|
||||||
{{ item.roles }}
|
:dataListFilter="dataListFilter"
|
||||||
</div>
|
:dataListSort="dataListSort"
|
||||||
</template> -->
|
:showSelect="rights.change"
|
||||||
</v-data-table>
|
:metaView="metaView"
|
||||||
|
v-on:selection-change="handleSelected"
|
||||||
|
data-cy="insideUsersTable"
|
||||||
|
>
|
||||||
|
</gz-data-table>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const FORM_KEY = "adm-users";
|
const FORM_KEY = "adm-users";
|
||||||
export default {
|
export default {
|
||||||
async created() {
|
created() {
|
||||||
let vm = this;
|
//Inside users only
|
||||||
try {
|
this.metaView = JSON.stringify([
|
||||||
await initForm(vm);
|
{
|
||||||
|
fld: "usertype",
|
||||||
|
filter: {
|
||||||
|
items: [
|
||||||
|
{ op: "!=", value: 3 },
|
||||||
|
{ op: "!=", value: 4 }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
vm.rights = window.$gz.role.getRights(window.$gz.type.User);
|
//outside users only
|
||||||
vm.formState.readOnly = !vm.rights.change;
|
// this.metaView = JSON.stringify([
|
||||||
vm.formState.ready = true;
|
// {
|
||||||
window.$gz.eventBus.$on("menu-click", clickHandler);
|
// fld: "usertype",
|
||||||
await vm.getDataFromApi();
|
// filter: {
|
||||||
vm.formState.loading = false;
|
// items: [
|
||||||
} catch (err) {
|
// { op: "=", value: 3 },
|
||||||
vm.formState.ready = true;
|
// { op: "=", value: 4 }
|
||||||
window.$gz.errorHandler.handleFormError(err, vm);
|
// ],
|
||||||
}
|
// any: true
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// ]);
|
||||||
|
|
||||||
|
this.rights = window.$gz.role.getRights(window.$gz.type.User);
|
||||||
|
window.$gz.eventBus.$on("menu-click", clickHandler);
|
||||||
|
generateMenu(this);
|
||||||
},
|
},
|
||||||
|
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
window.$gz.eventBus.$off("menu-click", clickHandler);
|
window.$gz.eventBus.$off("menu-click", clickHandler);
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
obj: [],
|
currentListViewId: 1,
|
||||||
headers: [],
|
dataListKey: "InsideUserDataList",
|
||||||
selected: [],
|
dataListFilter: "",
|
||||||
formState: {
|
dataListSort: "",
|
||||||
ready: false,
|
metaView: undefined,
|
||||||
loading: true,
|
|
||||||
errorBoxMessage: null,
|
|
||||||
appError: null,
|
|
||||||
serverError: {}
|
|
||||||
},
|
|
||||||
rights: window.$gz.role.defaultRightsObject(),
|
rights: window.$gz.role.defaultRightsObject(),
|
||||||
availableRoles: [],
|
ayType: window.$gz.type.User,
|
||||||
timeZoneName: window.$gz.locale.getBrowserTimeZoneName(),
|
selectedItems: []
|
||||||
languageName: window.$gz.locale.getBrowserLanguages(),
|
|
||||||
hour12: window.$gz.locale.getHour12()
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
rowClick(item) {
|
handleSelected(selected) {
|
||||||
window.$gz.eventBus.$emit("openobject", {
|
this.selectedItems = selected;
|
||||||
type: window.$gz.type.User,
|
|
||||||
id: item.id,
|
|
||||||
inside: true
|
|
||||||
});
|
|
||||||
},
|
|
||||||
rolesDisplayFromRoles(roles) {
|
|
||||||
let roleNames = [];
|
|
||||||
if (roles != null && roles != 0) {
|
|
||||||
for (let i = 0; i < this.availableRoles.length; i++) {
|
|
||||||
let role = this.availableRoles[i];
|
|
||||||
if (!!(roles & role.id)) {
|
|
||||||
roleNames.push(role.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return roleNames.join(", ");
|
|
||||||
},
|
|
||||||
async getDataFromApi() {
|
|
||||||
let vm = this;
|
|
||||||
vm.formState.loading = true;
|
|
||||||
|
|
||||||
window.$gz.form.deleteAllErrorBoxErrors(vm);
|
|
||||||
try {
|
|
||||||
let res = await window.$gz.api.get("user/list");
|
|
||||||
|
|
||||||
if (res.error) {
|
|
||||||
if (res.error.code == "2010") {
|
|
||||||
window.$gz.form.handleObjectNotFound(vm);
|
|
||||||
}
|
|
||||||
vm.formState.serverError = res.error;
|
|
||||||
window.$gz.form.setErrorBoxErrors(vm);
|
|
||||||
} else {
|
|
||||||
if (res.data) {
|
|
||||||
/* Id = z.Id,
|
|
||||||
Active = z.Active,
|
|
||||||
Name = z.Name,
|
|
||||||
Roles = z.Roles,
|
|
||||||
UserType = z.UserType,
|
|
||||||
EmployeeNumber = z.EmployeeNumber,
|
|
||||||
LastLogin = z.LastLogin */
|
|
||||||
let ret = [];
|
|
||||||
for (let i = 0; i < res.data.length; i++) {
|
|
||||||
let o = res.data[i];
|
|
||||||
ret.push({
|
|
||||||
id: o.id,
|
|
||||||
name: o.name,
|
|
||||||
employeeNumber: o.employeeNumber,
|
|
||||||
active: o.active,
|
|
||||||
userType: window.$gz.enums.get("insideusertype", o.userType),
|
|
||||||
lastLogin: window.$gz.locale.utcDateToShortDateAndTimeLocalized(
|
|
||||||
o.lastLogin,
|
|
||||||
this.timeZoneName,
|
|
||||||
this.languageName,
|
|
||||||
this.hour12
|
|
||||||
),
|
|
||||||
roles: this.rolesDisplayFromRoles(o.roles)
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
vm.obj = ret;
|
|
||||||
} else {
|
|
||||||
vm.rawObj = [];
|
|
||||||
vm.obj = [];
|
|
||||||
}
|
|
||||||
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
dirty: false,
|
|
||||||
valid: true,
|
|
||||||
loading: false
|
|
||||||
});
|
|
||||||
generateMenu(vm);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
window.$gz.form.setFormState({
|
|
||||||
vm: vm,
|
|
||||||
loading: false
|
|
||||||
});
|
|
||||||
window.$gz.errorHandler.handleFormError(error, vm);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -171,19 +95,54 @@ async function clickHandler(menuItem) {
|
|||||||
params: { recordid: 0 }
|
params: { recordid: 0 }
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
// case "extensions":
|
case "extensions":
|
||||||
// let res = await m.vm.$refs.extensions.open();
|
let res = await m.vm.$refs.extensions.open(
|
||||||
// break;
|
m.vm.$refs.gzdatatable.getDataListSelection(window.$gz.type.User)
|
||||||
|
);
|
||||||
|
break;
|
||||||
|
case "report":
|
||||||
|
if (m.id != null) {
|
||||||
|
//last report selected is in m.id
|
||||||
|
m.vm.$router.push({
|
||||||
|
name: "ay-report",
|
||||||
|
params: { recordid: m.id, ayatype: window.$gz.type.User }
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
//general report selector chosen
|
||||||
|
|
||||||
|
let res = await m.vm.$refs.reportSelector.open(
|
||||||
|
m.vm.$refs.gzdatatable.getDataListSelection(window.$gz.type.User)
|
||||||
|
);
|
||||||
|
|
||||||
|
//if null for no selection
|
||||||
|
//just bail out
|
||||||
|
if (res == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
//persist last report selected
|
||||||
|
window.$gz.form.setLastReport(FORM_KEY, res);
|
||||||
|
|
||||||
|
//Now open the report viewer...
|
||||||
|
m.vm.$router.push({
|
||||||
|
name: "ay-report",
|
||||||
|
params: { recordid: res.id, ayatype: window.$gz.type.User }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
case "directnotify":
|
case "directnotify":
|
||||||
//nav to direct notify with list of users appended to route
|
//nav to direct notify with list of users appended to route
|
||||||
if (m.vm.selected.length == 0) {
|
let selected = m.vm.$refs.gzdatatable.getDataListSelection(
|
||||||
|
window.$gz.type.User
|
||||||
|
).selectedRowIds;
|
||||||
|
if (selected.length == 0) {
|
||||||
m.vm.$router.push({
|
m.vm.$router.push({
|
||||||
name: "home-notify-direct"
|
name: "home-notify-direct"
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
m.vm.$router.push({
|
m.vm.$router.push({
|
||||||
name: "home-notify-direct",
|
name: "home-notify-direct",
|
||||||
params: { userIdList: m.vm.selected.map(z => z.id).toString() }
|
params: { userIdList: selected.toString() }
|
||||||
|
//params: { userIdList: m.vm.selected.map(z => z.id).toString() }
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@@ -221,32 +180,32 @@ function generateMenu(vm) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
//STUB REPORTS
|
//REPORTS
|
||||||
//## NOTE: This form is not based on a DataList so it cannot be printed
|
|
||||||
//if it was a datalist then all would be as normal
|
|
||||||
//not sure why it's not a datalist
|
|
||||||
|
|
||||||
//Report not Print, print is a further option
|
//Report not Print, print is a further option
|
||||||
// menuOptions.menuItems.push({
|
menuOptions.menuItems.push({
|
||||||
// title: "Report",
|
title: "Report",
|
||||||
// icon: "$ayiFileAlt",
|
icon: "$ayiFileAlt",
|
||||||
// key: FORM_KEY + ":report",
|
key: FORM_KEY + ":report",
|
||||||
// vm: vm
|
vm: vm
|
||||||
// });
|
});
|
||||||
|
|
||||||
// menuOptions.menuItems.push({
|
//get last report selected
|
||||||
// title: "stub: Last report used",
|
let lastReport = window.$gz.form.getLastReport(FORM_KEY);
|
||||||
// icon: "$ayiFileAlt",
|
if (lastReport != null) {
|
||||||
// key: FORM_KEY + ":report:STUBlastusedreportid",
|
menuOptions.menuItems.push({
|
||||||
// vm: vm
|
title: lastReport.name,
|
||||||
// });
|
icon: "$ayiFileAlt",
|
||||||
|
key: FORM_KEY + ":report:" + lastReport.id,
|
||||||
|
vm: vm
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
// menuOptions.menuItems.push({
|
menuOptions.menuItems.push({
|
||||||
// title: "Extensions",
|
title: "Extensions",
|
||||||
// icon: "fa - puzzle-piece",
|
icon: "$ayiPuzzlePiece",
|
||||||
// key: FORM_KEY + ":extensions",
|
key: FORM_KEY + ":extensions",
|
||||||
// vm: vm
|
vm: vm
|
||||||
// });
|
});
|
||||||
|
|
||||||
menuOptions.menuItems.push({
|
menuOptions.menuItems.push({
|
||||||
title: "DirectNotification",
|
title: "DirectNotification",
|
||||||
@@ -257,55 +216,4 @@ function generateMenu(vm) {
|
|||||||
|
|
||||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
/////////////////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
async function initForm(vm) {
|
|
||||||
await fetchTranslatedText(vm);
|
|
||||||
await cacheEnums(vm);
|
|
||||||
await createTableHeaders(vm);
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////
|
|
||||||
//
|
|
||||||
// Ensures UI translated text is available
|
|
||||||
//
|
|
||||||
async function fetchTranslatedText(vm) {
|
|
||||||
await window.$gz.translation.cacheTranslations([
|
|
||||||
"User",
|
|
||||||
"UserEmployeeNumber",
|
|
||||||
"Active",
|
|
||||||
"UserType",
|
|
||||||
"LastLogin",
|
|
||||||
"AuthorizationRoles"
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
async function cacheEnums(vm) {
|
|
||||||
//ensure the enum values required are pre-fetched
|
|
||||||
await window.$gz.enums.fetchEnumList("insideusertype");
|
|
||||||
await window.$gz.enums.fetchEnumList("AuthorizationRoles");
|
|
||||||
vm.availableRoles = window.$gz.enums.getSelectionList("AuthorizationRoles");
|
|
||||||
}
|
|
||||||
|
|
||||||
//////////////////////
|
|
||||||
//
|
|
||||||
//
|
|
||||||
async function createTableHeaders(vm) {
|
|
||||||
vm.headers = [
|
|
||||||
{ text: vm.$ay.t("User"), value: "name" },
|
|
||||||
{ text: vm.$ay.t("UserEmployeeNumber"), value: "employeeNumber" },
|
|
||||||
{ text: vm.$ay.t("Active"), value: "active" },
|
|
||||||
{ text: vm.$ay.t("UserType"), value: "userType" },
|
|
||||||
{ text: vm.$ay.t("LastLogin"), value: "lastLogin" }
|
|
||||||
];
|
|
||||||
//Add roles if not narrowest width
|
|
||||||
if (vm.$vuetify.breakpoint.name != "xs") {
|
|
||||||
vm.headers.push({ text: vm.$ay.t("AuthorizationRoles"), value: "roles" });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
</gz-extensions>
|
</gz-extensions>
|
||||||
<gz-data-table
|
<gz-data-table
|
||||||
ref="gzdatatable"
|
ref="gzdatatable"
|
||||||
formKey="inside-User-list"
|
formKey="adm-users"
|
||||||
:dataListKey="dataListKey"
|
:dataListKey="dataListKey"
|
||||||
:dataListFilter="dataListFilter"
|
:dataListFilter="dataListFilter"
|
||||||
:dataListSort="dataListSort"
|
:dataListSort="dataListSort"
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
const FORM_KEY = "inside-user-list";
|
const FORM_KEY = "adm-users";
|
||||||
export default {
|
export default {
|
||||||
created() {
|
created() {
|
||||||
//Inside users only
|
//Inside users only
|
||||||
@@ -129,7 +129,19 @@ async function clickHandler(menuItem) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "directnotify":
|
||||||
|
//nav to direct notify with list of users appended to route
|
||||||
|
if (m.vm.selected.length == 0) {
|
||||||
|
m.vm.$router.push({
|
||||||
|
name: "home-notify-direct"
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
m.vm.$router.push({
|
||||||
|
name: "home-notify-direct",
|
||||||
|
params: { userIdList: m.vm.selected.map(z => z.id).toString() }
|
||||||
|
});
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
window.$gz.eventBus.$emit(
|
window.$gz.eventBus.$emit(
|
||||||
"notify-warning",
|
"notify-warning",
|
||||||
@@ -190,6 +202,15 @@ function generateMenu(vm) {
|
|||||||
key: FORM_KEY + ":extensions",
|
key: FORM_KEY + ":extensions",
|
||||||
vm: vm
|
vm: vm
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
menuOptions.menuItems.push({
|
||||||
|
title: "DirectNotification",
|
||||||
|
icon: "$ayiCommentAlt",
|
||||||
|
key: FORM_KEY + ":directnotify",
|
||||||
|
vm: vm
|
||||||
|
});
|
||||||
|
|
||||||
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
window.$gz.eventBus.$emit("menu-change", menuOptions);
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user