This commit is contained in:
@@ -24,6 +24,10 @@ todo: need a role collection control of some kind for things like case 3417.
|
|||||||
ideally it binds to a single value and can extract back out of that value bitwise all the correct items in the list checked
|
ideally it binds to a single value and can extract back out of that value bitwise all the correct items in the list checked
|
||||||
This way can bind it to a single bit field value and be efficient FTW$!
|
This way can bind it to a single bit field value and be efficient FTW$!
|
||||||
|
|
||||||
|
|
||||||
|
todo: user options form put color picker last it's pushing down the entire last row
|
||||||
|
also, can it be shorter, there's probably a setting for that
|
||||||
|
|
||||||
todo: need to test a license downgrade of techs once have User creation stuff done
|
todo: need to test a license downgrade of techs once have User creation stuff done
|
||||||
|
|
||||||
todo: Administration - translation
|
todo: Administration - translation
|
||||||
|
|||||||
@@ -112,7 +112,8 @@ export default {
|
|||||||
let userRole = window.$gz.store.state.roles;
|
let userRole = window.$gz.store.state.roles;
|
||||||
|
|
||||||
//calculate the effective rights
|
//calculate the effective rights
|
||||||
//a non zero result of the bitwise calculation means true and zero means false so using !! to force it into a boolean value (contrary to some style guides that say !! is obscure but I say it saves a lot of typing)
|
//a non zero result of the bitwise calculation means true and zero means false so using !! to force it into a boolean value
|
||||||
|
//(contrary to some style guides that say !! is obscure but I say it saves a lot of typing)
|
||||||
let canChange = !!(userRole & objectRoleRights.Change);
|
let canChange = !!(userRole & objectRoleRights.Change);
|
||||||
let canReadFullRecord = !!(userRole & objectRoleRights.ReadFullRecord);
|
let canReadFullRecord = !!(userRole & objectRoleRights.ReadFullRecord);
|
||||||
|
|
||||||
|
|||||||
76
ayanova/src/components/role-control.vue
Normal file
76
ayanova/src/components/role-control.vue
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
<template>
|
||||||
|
<v-select
|
||||||
|
:items="availableRoles"
|
||||||
|
item-text="name"
|
||||||
|
item-value="id"
|
||||||
|
multiple
|
||||||
|
chips
|
||||||
|
hint="select roles"
|
||||||
|
persistent-hint
|
||||||
|
:value="rolevalue()"
|
||||||
|
@input="handleInput"
|
||||||
|
:readonly="readonly"
|
||||||
|
:disabled="disabled"
|
||||||
|
:label="label"
|
||||||
|
:rules="rules"
|
||||||
|
:error-messages="allErrors()"
|
||||||
|
:data-cy="!!$ay.dev ? 'roleinput:' + testId : false"
|
||||||
|
></v-select>
|
||||||
|
</template>
|
||||||
|
<script>
|
||||||
|
/* Xeslint-disable */
|
||||||
|
export default {
|
||||||
|
async created() {
|
||||||
|
//get the available roles
|
||||||
|
//first make sure it's cached
|
||||||
|
await window.$gz.enums.fetchEnumList("AuthorizationRoles");
|
||||||
|
this.availableRoles = window.$gz.enums.getSelectionList(
|
||||||
|
"AuthorizationRoles"
|
||||||
|
);
|
||||||
|
//window.$gz.form.addNoSelectionItem(vm.selectLists.objectTypes);
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
internalValue: null,
|
||||||
|
availableRoles: []
|
||||||
|
};
|
||||||
|
},
|
||||||
|
watch: {
|
||||||
|
value(val) {
|
||||||
|
this.internalValue = val;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
label: String,
|
||||||
|
rules: Array,
|
||||||
|
"error-messages": { type: Array, default: null },
|
||||||
|
value: { type: Number, default: 0 },
|
||||||
|
readonly: { type: Boolean, default: false },
|
||||||
|
disabled: { type: Boolean, default: false },
|
||||||
|
error: {
|
||||||
|
type: String,
|
||||||
|
required: false
|
||||||
|
},
|
||||||
|
testId: String
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
allErrors() {
|
||||||
|
let ret = "";
|
||||||
|
if (this.error != null) {
|
||||||
|
ret = this.error;
|
||||||
|
}
|
||||||
|
if (this.errorMessages != null && this.errorMessages.length > 0) {
|
||||||
|
ret += this.errorMessages.toString();
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
},
|
||||||
|
rolevalue() {
|
||||||
|
//turn ineternalValue numeric bitfield role value into list of selected roles
|
||||||
|
},
|
||||||
|
handleInput(value) {
|
||||||
|
//turn list of selected roles into single bitfield value
|
||||||
|
//and emit it
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
@@ -44,6 +44,7 @@ import dataTable from "./components/gz-data-table.vue";
|
|||||||
import customFieldsControl from "./components/custom-fields-control.vue";
|
import customFieldsControl from "./components/custom-fields-control.vue";
|
||||||
import currencyControl from "./components/currency-control.vue";
|
import currencyControl from "./components/currency-control.vue";
|
||||||
import decimalControl from "./components/decimal-control.vue";
|
import decimalControl from "./components/decimal-control.vue";
|
||||||
|
import roleControl from "./components/role-control.vue";
|
||||||
import errorControl from "./components/error-control.vue";
|
import errorControl from "./components/error-control.vue";
|
||||||
import reportSelectorControl from "./components/report-selector-control.vue";
|
import reportSelectorControl from "./components/report-selector-control.vue";
|
||||||
import reportViewerControl from "./components/report-viewer-control.vue";
|
import reportViewerControl from "./components/report-viewer-control.vue";
|
||||||
@@ -183,6 +184,7 @@ Vue.component("gz-data-table", dataTable);
|
|||||||
Vue.component("gz-custom-fields", customFieldsControl);
|
Vue.component("gz-custom-fields", customFieldsControl);
|
||||||
Vue.component("gz-currency", currencyControl);
|
Vue.component("gz-currency", currencyControl);
|
||||||
Vue.component("gz-decimal", decimalControl);
|
Vue.component("gz-decimal", decimalControl);
|
||||||
|
Vue.component("gz-role-picker", roleControl);
|
||||||
Vue.component("gz-error", errorControl);
|
Vue.component("gz-error", errorControl);
|
||||||
Vue.component("gz-report-selector", reportSelectorControl);
|
Vue.component("gz-report-selector", reportSelectorControl);
|
||||||
Vue.component("gz-report-viewer", reportViewerControl);
|
Vue.component("gz-report-viewer", reportViewerControl);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
<v-row v-if="formState.ready">
|
<v-row v-if="formState.ready">
|
||||||
<v-col>
|
<v-col>
|
||||||
<v-form ref="form">
|
<v-form ref="form">
|
||||||
|
todo: set password, maybe set user options?
|
||||||
<v-row>
|
<v-row>
|
||||||
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
<gz-error :errorBoxMessage="formState.errorBoxMessage"></gz-error>
|
||||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||||
@@ -14,7 +15,7 @@
|
|||||||
:clearable="!formState.readOnly"
|
:clearable="!formState.readOnly"
|
||||||
@click:clear="fieldValueChanged('name')"
|
@click:clear="fieldValueChanged('name')"
|
||||||
:counter="255"
|
:counter="255"
|
||||||
:label="$ay.t('UserName')"
|
:label="$ay.t('Name')"
|
||||||
:rules="[
|
:rules="[
|
||||||
form().max255(this, 'name'),
|
form().max255(this, 'name'),
|
||||||
form().required(this, 'name')
|
form().required(this, 'name')
|
||||||
@@ -25,94 +26,39 @@
|
|||||||
@input="fieldValueChanged('name')"
|
@input="fieldValueChanged('name')"
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
</v-col>
|
</v-col>
|
||||||
<v-col
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||||
v-if="form().showMe(this, 'Serial')"
|
|
||||||
cols="12"
|
|
||||||
sm="6"
|
|
||||||
lg="4"
|
|
||||||
xl="3"
|
|
||||||
>
|
|
||||||
<v-text-field
|
<v-text-field
|
||||||
v-model="obj.serial"
|
v-model="obj.employeeNumber"
|
||||||
:readonly="true"
|
|
||||||
:disabled="formState.readOnly"
|
|
||||||
:label="$ay.t('UserSerial')"
|
|
||||||
:data-cy="!!$ay.dev ? 'serial' : false"
|
|
||||||
></v-text-field>
|
|
||||||
</v-col>
|
|
||||||
<v-col
|
|
||||||
v-if="form().showMe(this, 'Count')"
|
|
||||||
cols="12"
|
|
||||||
sm="6"
|
|
||||||
lg="4"
|
|
||||||
xl="3"
|
|
||||||
>
|
|
||||||
<v-text-field
|
|
||||||
v-model="obj.count"
|
|
||||||
:readonly="formState.readOnly"
|
:readonly="formState.readOnly"
|
||||||
:disabled="formState.readOnly"
|
:disabled="formState.readOnly"
|
||||||
:clearable="!formState.readOnly"
|
:clearable="!formState.readOnly"
|
||||||
@click:clear="fieldValueChanged('count')"
|
@click:clear="fieldValueChanged('employeeNumber')"
|
||||||
:counter="10"
|
:counter="255"
|
||||||
:label="$ay.t('UserCount')"
|
:label="$ay.t('UserEmployeeNumber')"
|
||||||
ref="count"
|
:rules="[
|
||||||
:data-cy="!!$ay.dev ? 'count' : false"
|
form().max255(this, 'employeeNumber'),
|
||||||
:rules="[form().integerValid(this, 'count')]"
|
form().required(this, 'employeeNumber')
|
||||||
:error-messages="form().serverErrors(this, 'count')"
|
]"
|
||||||
@input="fieldValueChanged('count')"
|
:error-messages="form().serverErrors(this, 'employeeNumber')"
|
||||||
type="number"
|
ref="employeeNumber"
|
||||||
|
:data-cy="!!$ay.dev ? 'employeeNumber' : false"
|
||||||
|
@input="fieldValueChanged('employeeNumber')"
|
||||||
></v-text-field>
|
></v-text-field>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<v-col
|
<v-col cols="12" sm="6" lg="4" xl="3">
|
||||||
v-if="form().showMe(this, 'DollarAmount')"
|
<gz-role-picker
|
||||||
cols="12"
|
:label="$ay.t('AuthorizationRoles')"
|
||||||
sm="6"
|
v-model="obj.roles"
|
||||||
lg="4"
|
|
||||||
xl="3"
|
|
||||||
>
|
|
||||||
<gz-currency
|
|
||||||
v-model="obj.dollarAmount"
|
|
||||||
:readonly="formState.readOnly"
|
:readonly="formState.readOnly"
|
||||||
:disabled="formState.readOnly"
|
:disabled="formState.readOnly"
|
||||||
:label="$ay.t('UserDollarAmount')"
|
ref="roles"
|
||||||
ref="dollarAmount"
|
testId="roles"
|
||||||
:data-cy="!!$ay.dev ? 'dollarAmount' : false"
|
:error-messages="form().serverErrors(this, 'roles')"
|
||||||
:rules="[
|
@input="fieldValueChanged('roles')"
|
||||||
form().decimalValid(this, 'dollarAmount'),
|
></gz-role-picker>
|
||||||
form().required(this, 'dollarAmount')
|
|
||||||
]"
|
|
||||||
:error-messages="form().serverErrors(this, 'dollarAmount')"
|
|
||||||
@input="fieldValueChanged('dollarAmount')"
|
|
||||||
></gz-currency>
|
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
||||||
<gz-date-time-picker
|
|
||||||
:label="$ay.t('UserStartDate')"
|
|
||||||
v-model="obj.startDate"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
:disabled="formState.readOnly"
|
|
||||||
ref="startDate"
|
|
||||||
testId="startDate"
|
|
||||||
:error-messages="form().serverErrors(this, 'startDate')"
|
|
||||||
@input="fieldValueChanged('startDate')"
|
|
||||||
></gz-date-time-picker>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col cols="12" sm="6" lg="4" xl="3">
|
|
||||||
<gz-date-time-picker
|
|
||||||
:label="$ay.t('UserEndDate')"
|
|
||||||
:rules="[form().datePrecedence(this, 'startDate', 'endDate')]"
|
|
||||||
:error-messages="form().serverErrors(this, 'endDate')"
|
|
||||||
v-model="obj.endDate"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
:disabled="formState.readOnly"
|
|
||||||
ref="endDate"
|
|
||||||
testId="endDate"
|
|
||||||
@input="fieldValueChanged('endDate')"
|
|
||||||
></gz-date-time-picker>
|
|
||||||
</v-col>
|
|
||||||
<v-col
|
<v-col
|
||||||
v-if="form().showMe(this, 'Active')"
|
v-if="form().showMe(this, 'Active')"
|
||||||
cols="12"
|
cols="12"
|
||||||
@@ -132,27 +78,6 @@
|
|||||||
></v-checkbox>
|
></v-checkbox>
|
||||||
</v-col>
|
</v-col>
|
||||||
|
|
||||||
<v-col
|
|
||||||
v-if="form().showMe(this, 'UserId')"
|
|
||||||
cols="12"
|
|
||||||
sm="6"
|
|
||||||
lg="4"
|
|
||||||
xl="3"
|
|
||||||
>
|
|
||||||
<gz-pick-list
|
|
||||||
:ayaType="ayaTypes().User"
|
|
||||||
:showEditIcon="true"
|
|
||||||
v-model="obj.userId"
|
|
||||||
:readonly="formState.readOnly"
|
|
||||||
:disabled="formState.readOnly"
|
|
||||||
:label="$ay.t('User')"
|
|
||||||
ref="userid"
|
|
||||||
:data-cy="!!$ay.dev ? 'userid' : false"
|
|
||||||
:error-messages="form().serverErrors(this, 'userid')"
|
|
||||||
@input="fieldValueChanged('userid')"
|
|
||||||
></gz-pick-list>
|
|
||||||
</v-col>
|
|
||||||
|
|
||||||
<v-col
|
<v-col
|
||||||
v-if="form().showMe(this, 'UserType')"
|
v-if="form().showMe(this, 'UserType')"
|
||||||
cols="12"
|
cols="12"
|
||||||
@@ -326,23 +251,21 @@ export default {
|
|||||||
usertypes: []
|
usertypes: []
|
||||||
},
|
},
|
||||||
obj: {
|
obj: {
|
||||||
//IMPORTANT NOTE: Fields that are NON NULLABLE in the schema for the table but *are* hideable **MUST** have a default value set here or else there will be no way to save the record
|
|
||||||
//I.E. Serial, usertype fields
|
|
||||||
id: 0,
|
id: 0,
|
||||||
concurrency: 0,
|
concurrency: 0,
|
||||||
name: null,
|
|
||||||
serial: 0,
|
|
||||||
dollarAmount: null,
|
|
||||||
active: null,
|
active: null,
|
||||||
|
name: null,
|
||||||
|
roles: null,
|
||||||
userType: 0,
|
userType: 0,
|
||||||
startDate: null,
|
employeeNumber: null,
|
||||||
endDate: null,
|
|
||||||
notes: null,
|
notes: null,
|
||||||
count: null,
|
customerId: null,
|
||||||
|
headOfficeId: null,
|
||||||
|
subVendorId: null,
|
||||||
wiki: null,
|
wiki: null,
|
||||||
customFields: "{}",
|
customFields: "{}",
|
||||||
tags: [],
|
tags: [],
|
||||||
userId: null
|
lastLogin: null
|
||||||
},
|
},
|
||||||
formState: {
|
formState: {
|
||||||
ready: false,
|
ready: false,
|
||||||
@@ -729,15 +652,12 @@ async function initForm(vm) {
|
|||||||
async function fetchTranslatedText(vm) {
|
async function fetchTranslatedText(vm) {
|
||||||
await window.$gz.translation.cacheTranslations([
|
await window.$gz.translation.cacheTranslations([
|
||||||
"User",
|
"User",
|
||||||
"UserName",
|
"Name",
|
||||||
"UserSerial",
|
"UserEmployeeNumber",
|
||||||
"UserDollarAmount",
|
"AuthorizationRoles",
|
||||||
"UserCount",
|
|
||||||
"User",
|
|
||||||
"UserType",
|
|
||||||
"UserStartDate",
|
|
||||||
"UserEndDate",
|
|
||||||
"UserNotes",
|
"UserNotes",
|
||||||
|
"UserType",
|
||||||
|
"Active",
|
||||||
"UserCustom1",
|
"UserCustom1",
|
||||||
"UserCustom2",
|
"UserCustom2",
|
||||||
"UserCustom3",
|
"UserCustom3",
|
||||||
@@ -766,5 +686,3 @@ async function populateSelectionLists(vm) {
|
|||||||
vm.selectLists.usertypes = window.$gz.enums.getSelectionList("usertype");
|
vm.selectLists.usertypes = window.$gz.enums.getSelectionList("usertype");
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style></style>
|
|
||||||
|
|||||||
Reference in New Issue
Block a user