This commit is contained in:
2021-10-01 19:20:37 +00:00
parent 5e423767bf
commit 7d19f9e0a1
2 changed files with 27 additions and 7 deletions

View File

@@ -903,6 +903,8 @@ export default {
return 3;
case "4day":
return 4;
case "category":
return 5;
default:
throw new Error(

View File

@@ -1,8 +1,8 @@
<template>
<div v-if="formState.ready" v-resize="onResize" class="my-n8">
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
<!-- {{ availableUsers }} -->
{{ formUserOptions }}
<!-- {{ categories }}<br />
{{ events }} -->
<v-sheet height="64">
<v-toolbar flat class="ml-n3">
<v-btn outlined class="xxmr-4" color="grey darken-2" @click="setToday">
@@ -39,6 +39,11 @@
</v-btn>
</template>
<v-list>
<v-list-item @click="viewType = 'category'">
<v-list-item-title>{{
$ay.t("ScheduleCategory")
}}</v-list-item-title>
</v-list-item>
<v-list-item @click="viewType = 'day'">
<v-list-item-title>{{ $ay.t("ScheduleDay") }}</v-list-item-title>
</v-list-item>
@@ -75,16 +80,21 @@
@change="fetchEvents"
@mousedown:event="startDrag"
@mousedown:time="startTime"
@mousedown:time-category="startTime"
@mousemove:time="mouseMoveDayView"
@mousemove:time-category="mouseMoveDayView"
@mousemove:day="mouseMoveMonthView"
@mouseup:day="endDragExtend"
@mouseup:day-category="endDragExtend"
@mouseup:time="endDragExtend"
@mouseup:time-category="endDragExtend"
@mouseleave.native="cancelDrag"
category-show-all
category-hide-dynamic
:categories="categories"
category-text="name"
category-for-invalid="UNKNOWN USER"
>
<!-- @mousemove:day-category="mouseMoveMonthView" category-hide-dynamic -->
<template v-slot:event="{ event, timed, eventSummary }">
<div class="v-event-draggable">
<v-icon small :color="event.textColor" class="mr-1">{{
@@ -747,6 +757,8 @@ export default {
return this.$ay.t("ScheduleDay");
case "4day":
return this.$ay.t("Schedule4Day");
case "category":
return this.$ay.t("ScheduleCategory");
}
},
onResize() {
@@ -754,7 +766,7 @@ export default {
},
viewDay({ date }) {
this.focus = date;
this.viewType = "day";
this.viewType = "category";
},
getEventColor(event) {
return event.color;
@@ -822,7 +834,7 @@ export default {
async fetchEvents({ start, end }) {
try {
window.$gz.form.deleteAllErrorBoxErrors(this);
const res = await window.$gz.api.post("schedule/personal", {
const res = await window.$gz.api.post("schedule/svc", {
view: window.$gz.util.calendarViewToAyaNovaEnum(this.viewType),
dark: this.$store.state.darkMode,
start: window.$gz.locale.localTimeDateStringToUTC8601String(
@@ -836,12 +848,14 @@ export default {
wisuColorSource: this.formUserOptions.wisuColorSource,
wisu: this.formUserOptions.wisu, //workorder item scheduled user records
reviews: this.formUserOptions.reviews,
reminders: this.formUserOptions.reminders
reminders: this.formUserOptions.reminders,
users: this.formUserOptions.users
});
if (res.error) {
this.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(this);
} else {
const vm = this;
this.events = res.data.map(x => {
return {
...x,
@@ -852,7 +866,8 @@ export default {
end: window.$gz.locale.utcDateToScheduleCompatibleFormatLocalized(
x.end,
this.timeZoneName
)
),
category: vm.availableUsers.find(a => a.id == x.userId).name
};
});
}
@@ -1070,6 +1085,9 @@ async function getFormUserOptions(vm) {
} else {
vm.formUserOptions = JSON.parse(res.data.options);
}
vm.categories = vm.formUserOptions.users.map(x => {
return vm.availableUsers.find(a => a.id == x);
});
//takes local time in "HH:MM" format and converts to ISO UTC format for picker consumption
const d = new Date();
const temp = new Date(