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; return 3;
case "4day": case "4day":
return 4; return 4;
case "category":
return 5;
default: default:
throw new Error( throw new Error(

View File

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