This commit is contained in:
2021-07-28 21:39:59 +00:00
parent aae0c92a13
commit 1762905d37
3 changed files with 23 additions and 32 deletions

View File

@@ -518,6 +518,7 @@ CURRENTLY DOING: PM stuff:
Add back end rules as necessary for quotes and PM's
Sanity checks for PM settings will be a must here
GenerateBeforeInterval must be less than repeatinterval
exclude days of week can't be *all* days of the week
test help links
Child->grandchild data lists for quotes and pm's like workorders
release

View File

@@ -1,6 +1,6 @@
<template>
<v-select
:items="availableRoles"
:items="daysOfWeek"
item-text="name"
item-value="id"
multiple
@@ -13,7 +13,7 @@
:label="label"
:rules="rules"
:error-messages="errorMessages"
:data-cy="'roleinput:' + testId"
:data-cy="'dayinput:' + testId"
></v-select>
</template>
<script>
@@ -23,27 +23,13 @@
export default {
async created() {
await window.$gz.enums.fetchEnumList("AuthorizationRoles");
let rawRoles = window.$gz.enums.getSelectionList("AuthorizationRoles");
if (this.limitSelectionTo == null) {
this.availableRoles = rawRoles;
} else {
if (this.limitSelectionTo == "inside") {
//CustomerRestricted=2048, Customer=4096
this.availableRoles = rawRoles.filter(
z => z.id != 2048 && z.id != 4096
);
} else {
this.availableRoles = rawRoles.filter(
z => z.id == 2048 || z.id == 4096
);
}
}
await window.$gz.enums.fetchEnumList("DaysOfWeek");
this.daysOfWeek = window.$gz.enums.getSelectionList("DaysOfWeek");
},
data() {
return {
internalValue: null,
availableRoles: []
daysOfWeek: []
};
},
props: {
@@ -53,17 +39,16 @@ export default {
value: { type: Number, default: 0 },
readonly: { type: Boolean, default: false },
disabled: { type: Boolean, default: false },
limitSelectionTo: { type: String, default: null }, //"inside" - no customer roles, "outside" - no non-customer roles
testId: { type: String, default: null }
},
computed: {
selectedValue() {
let ret = [];
if (this.value != null && this.value != 0) {
for (let i = 0; i < this.availableRoles.length; i++) {
let role = this.availableRoles[i];
if (!!(this.value & role.id)) {
ret.push(role.id);
for (let i = 0; i < this.daysOfWeek.length; i++) {
let day = this.daysOfWeek[i];
if (!!(this.value & day.id)) {
ret.push(day.id);
}
}
}
@@ -75,8 +60,8 @@ export default {
let newValue = 0;
if (value != null && value != [] && value.length > 0) {
for (let i = 0; i < value.length; i++) {
let role = value[i];
newValue = newValue | role;
let day = value[i];
newValue = newValue | day;
}
}
this.$emit("input", newValue);

View File

@@ -135,13 +135,16 @@
</v-row>
</v-col>
ExcludeDaysOfWeek
<v-col cols="12" sm="6" lg="4" xl="3">
<v-checkbox
<GZDaysOfWeek
:label="$ay.t('ExcludeDaysOfWeek')"
v-model="value.excludeDaysOfWeek"
label="Monday"
value="0"
></v-checkbox>
:readonly="formState.readOnly"
ref="excludeDaysOfWeek"
data-cy="excludeDaysOfWeek"
:error-messages="form().serverErrors(this, 'excludeDaysOfWeek')"
@input="fieldValueChanged('excludeDaysOfWeek')"
></GZDaysOfWeek>
</v-col>
<v-col cols="12" sm="6" lg="4" xl="3">
@@ -521,9 +524,11 @@
////////////////////////////////////////////////////////////////////////////////////////////////////////////
import GzWoAddress from "./work-order-address.vue";
import GZDaysOfWeek from "./days-of-week-control.vue";
export default {
components: {
GzWoAddress
GzWoAddress,
GZDaysOfWeek
},
data() {
return {