This commit is contained in:
2021-10-04 23:19:10 +00:00
parent 2c909146ea
commit 23167cf6dc
2 changed files with 223 additions and 314 deletions

View File

@@ -138,7 +138,7 @@
<template> <template>
<v-row justify="center"> <v-row justify="center">
<v-dialog max-width="600px" v-model="moreInfoDialog"> <v-dialog max-width="600px" v-model="moreInfoDialog">
<v-card color="grey lighten-4" min-width="350px" flat> <v-card>
<v-toolbar> <v-toolbar>
<v-btn icon @click="openScheduledItem()"> <v-btn icon @click="openScheduledItem()">
<v-icon color="primary">{{ iconForSelectedEvent() }}</v-icon> <v-icon color="primary">{{ iconForSelectedEvent() }}</v-icon>
@@ -411,7 +411,6 @@
</template> </template>
<script> <script>
const FORM_KEY = "home-schedule"; const FORM_KEY = "home-schedule";
const CLICK_DETECT_TIMEOUT = 100; //100 is a bit too fast to recognize a click
export default { export default {
async created() { async created() {
const vm = this; const vm = this;
@@ -526,12 +525,6 @@ export default {
extendBottom(event) { extendBottom(event) {
//console.log("extend bottom fired"); //console.log("extend bottom fired");
if (event.editable) { if (event.editable) {
//My work around to disambiguate extending and clicking
// clearTimeout(this.dragTimeout);
// this.dragged = false;
// this.dragTimeout = setTimeout(() => {
// this.dragged = true;
// }, CLICK_DETECT_TIMEOUT); // Min delay to be regarded as extend instead of click, also affects click time to display more info, too short needs faster click
//capture time to see if it's a click or a drag/extend //capture time to see if it's a click or a drag/extend
this.lastMouseDownMS = new Date().getTime(); this.lastMouseDownMS = new Date().getTime();
this.extendEvent = event; this.extendEvent = event;
@@ -540,12 +533,6 @@ export default {
} }
}, },
async endDragExtend() { async endDragExtend() {
// console.log("EndDragExtend", {
// extendEvent: this.extendEvent,
// dragged: this.dragged,
// dragEvent: this.dragEvent,
// lastMS: this.lastMouseDownMS
// });
//On drag then dragged is set to true and dragEvent and dragTime are set //On drag then dragged is set to true and dragEvent and dragTime are set
//on extend then dragged is set to true extendEvent (actual event), extendOriginal and createStart are set, dragEvent is null //on extend then dragged is set to true extendEvent (actual event), extendOriginal and createStart are set, dragEvent is null
//on create then dragged is set to false and createStart is only value set, dragEvent is null and extendEvent is null //on create then dragged is set to false and createStart is only value set, dragEvent is null and extendEvent is null
@@ -555,12 +542,7 @@ export default {
//NEW, prompt for deets and create or if cancelled then just remove this faux event from events list (it will be the last one in the array) //NEW, prompt for deets and create or if cancelled then just remove this faux event from events list (it will be the last one in the array)
this.newItemDialog = true; this.newItemDialog = true;
} else { } else {
// if (!this.dragged) { //MORE INFO
// //we're here due to mouse up but it's not a drag or an extend so it's a More Info mouse up click so bail out now
// this.dragEvent = null; //this needs to be set or it will keep dragging off an editable event even as the moreinfo dialog show
// return;
// }
if (this.lastMouseDownMS != null && this.itWasAClickNotADrag()) { if (this.lastMouseDownMS != null && this.itWasAClickNotADrag()) {
await this.showMoreInfo(this.dragEvent); await this.showMoreInfo(this.dragEvent);
this.dragEvent = null; //this needs to be set or it will keep dragging off an editable event even as the moreinfo dialog show this.dragEvent = null; //this needs to be set or it will keep dragging off an editable event even as the moreinfo dialog show
@@ -632,34 +614,22 @@ export default {
}, },
startDrag({ event }) { startDrag({ event }) {
//# mouse down on an event triggers this call //# mouse down on an event triggers this call
//console.log("StartDrag, event:", JSON.stringify(event));
if (event) { if (event) {
this.lastMouseDownMS = new Date().getTime(); //snapshot time to disambiguate drag vs click this.lastMouseDownMS = new Date().getTime(); //snapshot time to disambiguate drag vs click
if (event.editable) { if (event.editable) {
//My work around to disambiguate dragging and clicking
//clearTimeout(this.dragTimeout);
// console.log("startDrag in editable set dragged false");
this.dragged = false; this.dragged = false;
// this.dragTimeout = setTimeout(() => {
// this.dragged = true;
// console.log("startDrag event timer fired, dragged set to true");
// }, CLICK_DETECT_TIMEOUT); // Min delay to be regarded as extend instead of click, also affects click time to display more info, too short needs faster click
this.dragEvent = event; this.dragEvent = event;
this.dragTime = null; this.dragTime = null;
this.extendOriginal = null; this.extendOriginal = null;
} else { } else {
this.dragged = false; this.dragged = false;
this.dragEvent = event; this.dragEvent = event;
// this.extendEvent = null;
this.dragTime = null; this.dragTime = null;
} }
} }
}, },
itWasAClickNotADrag() { itWasAClickNotADrag() {
if (this.lastMouseDownMS == null) { if (this.lastMouseDownMS == null) {
//console.trace("lastMouseDownMS is null!!");
// return true;
if (this.$ay.dev) { if (this.$ay.dev) {
throw new Error("lastMouseDownMS is null!"); throw new Error("lastMouseDownMS is null!");
} else { } else {
@@ -672,7 +642,6 @@ export default {
} }
const elapsed = new Date().getTime() - this.lastMouseDownMS; const elapsed = new Date().getTime() - this.lastMouseDownMS;
this.lastMouseDownMS = null; this.lastMouseDownMS = null;
// console.log("itWasAClickNotADrag elapsed:", elapsed);
return elapsed < 200; return elapsed < 200;
}, },
mouseMoveDayView(tms) { mouseMoveDayView(tms) {
@@ -727,7 +696,6 @@ export default {
if (this.dragEvent.editable) { if (this.dragEvent.editable) {
const start = this.dragEvent.start; const start = this.dragEvent.start;
this.dragTime = mouse - start; this.dragTime = mouse - start;
} else {
} }
} else { } else {
//# DAY VIEW CREATE START EVENT //# DAY VIEW CREATE START EVENT
@@ -762,21 +730,6 @@ export default {
tms.minute tms.minute
).getTime(); ).getTime();
}, },
diagInfo() {
if (this.$refs.calendar) {
return (
"cal" +
JSON.stringify({
start: this.$refs.calendar.start,
end: this.$refs.calendar.end,
focus: this.focus,
firstInterval: this.$refs.calendar.firstInterval
})
);
} else {
return "no calendar";
}
},
typeToLabel() { typeToLabel() {
switch (this.viewType) { switch (this.viewType) {
case "month": case "month":
@@ -822,12 +775,6 @@ export default {
}); });
}, },
async showMoreInfo(event) { async showMoreInfo(event) {
//console.log("showMoreInfo, event is", event);
//workaround to disambiguate drag click from view more info click
// if (this.dragged) {
// return;
// }
// console.log("showMoreINfo not dragged, popping up");
this.selectedEvent = event; this.selectedEvent = event;
let route = null; let route = null;
this.evInfo = {}; this.evInfo = {};
@@ -852,21 +799,6 @@ export default {
window.$gz.form.setErrorBoxErrors(this); window.$gz.form.setErrorBoxErrors(this);
} }
} }
// const open = () => {
// this.selectedEvent = event;
// this.selectedElement = nativeEvent.target;
// requestAnimationFrame(() =>
// requestAnimationFrame(() => (this.moreInfoDialog = true))
// );
// };
// if (this.moreInfoDialog) {
// this.moreInfoDialog = false;
// requestAnimationFrame(() => requestAnimationFrame(() => open()));
// } else {
// open();
// }
// console.log("show more info stopping propagation");
// nativeEvent.stopPropagation();
}, },
async fetchEvents({ start, end }) { async fetchEvents({ start, end }) {
try { try {

View File

@@ -74,7 +74,6 @@
:locale="languageName" :locale="languageName"
:event-more-text="$ay.t('More')" :event-more-text="$ay.t('More')"
:first-time="formUserOptions.firstTime" :first-time="formUserOptions.firstTime"
@click:event="showMoreInfo"
@click:more="viewDay" @click:more="viewDay"
@click:date="viewDay" @click:date="viewDay"
@change="fetchEvents" @change="fetchEvents"
@@ -152,193 +151,202 @@
</v-row> </v-row>
</template> </template>
<!-- MORE INFO DIALOG --> <!-- MORE INFO DIALOG -->
<v-menu <template>
v-model="moreInfoDialog" <v-row justify="center">
:close-on-content-click="false" <v-dialog max-width="600px" v-model="moreInfoDialog">
:activator="selectedElement" <v-card>
offset-x <v-toolbar>
> <v-btn icon @click="openScheduledItem()">
<v-card color="grey lighten-4" min-width="350px" flat> <v-icon color="primary">{{ iconForSelectedEvent() }}</v-icon>
<v-toolbar> </v-btn>
<v-btn icon @click="openScheduledItem()"> <v-toolbar-title>{{ selectedEvent.name }}</v-toolbar-title>
<v-icon color="primary">{{ iconForSelectedEvent() }}</v-icon> </v-toolbar>
</v-btn> <v-card-text>
<v-toolbar-title>{{ selectedEvent.name }}</v-toolbar-title> <!--reminder -->
</v-toolbar> <template v-if="selectedEvent.type == $ay.ayt().Reminder">
<v-card-text> <div>
<!--reminder --> <span class="text-h6">{{ $ay.t("ReminderName") }}:</span>
<template v-if="selectedEvent.type == $ay.ayt().Reminder"> <span class="text-body-1 ml-2">{{ evInfo.name }}</span>
<div> </div>
<span class="text-h6">{{ $ay.t("ReminderName") }}:</span> <div>
<span class="text-body-1 ml-2">{{ evInfo.name }}</span> <span class="text-h6"
</div> >{{ $ay.t("DashboardScheduled") }}:</span
<div> >
<span class="text-h6">{{ $ay.t("DashboardScheduled") }}:</span> <span class="text-body-1 ml-2"
<span class="text-body-1 ml-2" >{{ $ay.dt(evInfo.startDate) }}&nbsp;&mdash;&nbsp;{{
>{{ $ay.dt(evInfo.startDate) }}&nbsp;&mdash;&nbsp;{{ $ay.dt(evInfo.stopDate)
$ay.dt(evInfo.stopDate) }}</span
}}</span >
> </div>
</div> <div>
<div> <span class="text-h6">{{ $ay.t("ReminderNotes") }}:</span>
<span class="text-h6">{{ $ay.t("ReminderNotes") }}:</span> <span class="text-body-1 ml-2">
<span class="text-body-1 ml-2"> <v-icon class="mr-3" :color="evInfo.color"
<v-icon class="mr-3" :color="evInfo.color" >$ayiSquareFull</v-icon
>$ayiSquareFull</v-icon >{{ evInfo.notes }}</span
>{{ evInfo.notes }}</span >
> </div>
</div> </template>
</template> <!--review -->
<!--review --> <template v-if="selectedEvent.type == $ay.ayt().Review">
<template v-if="selectedEvent.type == $ay.ayt().Review"> <div class="mb-1" v-if="evInfo.aType">
<div class="mb-1" v-if="evInfo.aType"> <v-icon
<v-icon large
large color="primary"
color="primary" @click="openObject(evInfo.aType, evInfo.objectId)"
@click="openObject(evInfo.aType, evInfo.objectId)" >{{ $ay.util().iconForType(evInfo.aType) }}</v-icon
>{{ $ay.util().iconForType(evInfo.aType) }}</v-icon ><span
><span class="text-h6"
class="text-h6" @click="openObject(evInfo.aType, evInfo.objectId)"
@click="openObject(evInfo.aType, evInfo.objectId)" >
> {{ evInfo.reviewObjectViz }}</span
{{ evInfo.reviewObjectViz }}</span >
> </div>
</div> <div>
<div> <span class="text-h6">{{ $ay.t("ReviewName") }}:</span>
<span class="text-h6">{{ $ay.t("ReviewName") }}:</span> <span class="text-body-1 ml-2">{{ evInfo.name }}</span>
<span class="text-body-1 ml-2">{{ evInfo.name }}</span> </div>
</div> <div>
<div> <span class="text-h6">{{ $ay.t("ReviewDate") }}:</span>
<span class="text-h6">{{ $ay.t("ReviewDate") }}:</span> <span class="text-body-1 ml-2">{{
<span class="text-body-1 ml-2">{{ $ay.dt(evInfo.reviewDate)
$ay.dt(evInfo.reviewDate) }}</span>
}}</span> </div>
</div> <div>
<div> <span class="text-h6">{{ $ay.t("ReviewNotes") }}:</span>
<span class="text-h6">{{ $ay.t("ReviewNotes") }}:</span> <span class="text-body-1 ml-2"> {{ evInfo.notes }}</span>
<span class="text-body-1 ml-2"> {{ evInfo.notes }}</span> </div>
</div>
<template v-if="evInfo.completedDate"> <template v-if="evInfo.completedDate">
<div> <div>
<span class="text-h6" <span class="text-h6"
>{{ $ay.t("ReviewCompletedDate") }}:</span >{{ $ay.t("ReviewCompletedDate") }}:</span
> >
<span class="text-body-1 ml-2">{{ <span class="text-body-1 ml-2">{{
$ay.dt(evInfo.completedDate) $ay.dt(evInfo.completedDate)
}}</span> }}</span>
</div> </div>
<div> <div>
<span class="text-h6" <span class="text-h6"
>{{ $ay.t("ReviewCompletionNotes") }}:</span >{{ $ay.t("ReviewCompletionNotes") }}:</span
> >
<span class="text-body-1 ml-2"> <span class="text-body-1 ml-2">
{{ evInfo.completionNotes }}</span {{ evInfo.completionNotes }}</span
> >
</div> </div>
</template> </template>
</template> </template>
<!--woitemscheduleduser --> <!--woitemscheduleduser -->
<template <template
v-if="selectedEvent.type == $ay.ayt().WorkOrderItemScheduledUser" v-if="
> selectedEvent.type == $ay.ayt().WorkOrderItemScheduledUser
<div> "
<span class="text-h6">{{ $ay.t("WorkOrder") }}:</span>
<span class="text-body-1 ml-2"
>{{ evInfo.serial }}&nbsp; {{ evInfo.customerViz }}</span
> >
</div> <div>
<div> <span class="text-h6">{{ $ay.t("WorkOrder") }}:</span>
<span class="text-h6">{{ $ay.t("Tags") }}:</span> <span class="text-body-1 ml-2"
<span class="text-body-1 ml-2">{{ >{{ evInfo.serial }}&nbsp; {{ evInfo.customerViz }}</span
$ay.util().formatTags(evInfo.wotags) >
}}</span> </div>
</div> <div>
<div> <span class="text-h6">{{ $ay.t("Tags") }}:</span>
<span class="text-h6">{{ $ay.t("DashboardScheduled") }}:</span> <span class="text-body-1 ml-2">{{
<span class="text-body-1 ml-2" $ay.util().formatTags(evInfo.wotags)
>{{ $ay.dt(evInfo.startDate) }}&nbsp;&mdash;&nbsp;{{ }}</span>
$ay.dt(evInfo.stopDate) </div>
}}</span <div>
> <span class="text-h6"
</div> >{{ $ay.t("DashboardScheduled") }}:</span
<div> >
<span class="text-h6" <span class="text-body-1 ml-2"
>{{ >{{ $ay.dt(evInfo.startDate) }}&nbsp;&mdash;&nbsp;{{
$ay.t("WorkOrderItemScheduledUserEstimatedQuantity") $ay.dt(evInfo.stopDate)
}}:</span }}</span
> >
<span class="text-body-1 ml-2">{{ evInfo.qty }}</span> </div>
</div> <div>
<div> <span class="text-h6"
<span class="text-h6" >{{
>{{ $ay.t("WorkOrderItemScheduledUserServiceRateID") }}:</span $ay.t("WorkOrderItemScheduledUserEstimatedQuantity")
> }}:</span
<span class="text-body-1 ml-2">{{ evInfo.rate }}</span> >
</div> <span class="text-body-1 ml-2">{{ evInfo.qty }}</span>
</div>
<div>
<span class="text-h6"
>{{
$ay.t("WorkOrderItemScheduledUserServiceRateID")
}}:</span
>
<span class="text-body-1 ml-2">{{ evInfo.rate }}</span>
</div>
<div v-if="evInfo.haswostatus"> <div v-if="evInfo.haswostatus">
<span class="text-h6">{{ $ay.t("WorkOrderStatus") }}:</span> <span class="text-h6">{{ $ay.t("WorkOrderStatus") }}:</span>
<span class="text-body-1 ml-2">{{ evInfo.wostatus }}</span> <span class="text-body-1 ml-2">{{ evInfo.wostatus }}</span>
<v-icon :color="evInfo.wostatuscolor" class="ml-4" <v-icon :color="evInfo.wostatuscolor" class="ml-4"
>$ayiFlag</v-icon >$ayiFlag</v-icon
> >
<v-icon <v-icon
color="primary" color="primary"
v-if="evInfo.wostatuslocked" v-if="evInfo.wostatuslocked"
class="ml-4" class="ml-4"
>$ayiLock</v-icon >$ayiLock</v-icon
> >
<v-icon <v-icon
color="primary" color="primary"
v-if="evInfo.wostatuscompleted" v-if="evInfo.wostatuscompleted"
class="ml-4" class="ml-4"
>$ayiCheckCircle</v-icon >$ayiCheckCircle</v-icon
> >
</div> </div>
<div> <div>
<span class="text-h6" <span class="text-h6"
>{{ $ay.t("WorkOrderItemSummary") }}:</span >{{ $ay.t("WorkOrderItemSummary") }}:</span
> >
<span class="text-body-1 ml-2"> <span class="text-body-1 ml-2">
<v-icon class="mr-3" :color="evInfo.woitemstatuscolor" <v-icon class="mr-3" :color="evInfo.woitemstatuscolor"
>$ayiCircle</v-icon >$ayiCircle</v-icon
>{{ evInfo.woitemstatus }}</span >{{ evInfo.woitemstatus }}</span
> >
</div> </div>
<div> <div>
<span class="text-h6" <span class="text-h6"
>{{ $ay.t("WorkOrderItemPriorityID") }}:</span >{{ $ay.t("WorkOrderItemPriorityID") }}:</span
> >
<span class="text-body-1 ml-2"> <span class="text-body-1 ml-2">
<v-icon class="mr-3" :color="evInfo.woitemprioritycolor" <v-icon class="mr-3" :color="evInfo.woitemprioritycolor"
>$ayiFireAlt</v-icon >$ayiFireAlt</v-icon
>{{ evInfo.woitempriority }}</span >{{ evInfo.woitempriority }}</span
> >
</div> </div>
<div> <div>
<span class="text-h6">{{ $ay.t("WorkOrderItemTags") }}:</span> <span class="text-h6"
<span class="text-body-1 ml-2">{{ >{{ $ay.t("WorkOrderItemTags") }}:</span
$ay.util().formatTags(evInfo.woitemtags) >
}}</span> <span class="text-body-1 ml-2">{{
</div> $ay.util().formatTags(evInfo.woitemtags)
</template> }}</span>
</v-card-text> </div>
<v-card-actions> </template>
<v-btn color="primary" text @click="openScheduledItem()">{{ </v-card-text>
$ay.t("Open") <v-card-actions>
}}</v-btn> <v-btn color="primary" text @click="openScheduledItem()">{{
$ay.t("Open")
}}</v-btn>
<v-spacer v-if="!$vuetify.breakpoint.xs"></v-spacer> <v-spacer v-if="!$vuetify.breakpoint.xs"></v-spacer>
<v-btn color="primary" text @click="moreInfoDialog = false"> <v-btn color="primary" text @click="moreInfoDialog = false">
{{ $ay.t("Close") }} {{ $ay.t("Close") }}
</v-btn> </v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-menu> </v-dialog>
</v-row>
</template>
</v-sheet> </v-sheet>
<template> <template>
<v-row justify="center"> <v-row justify="center">
@@ -399,7 +407,6 @@
</template> </template>
<script> <script>
const FORM_KEY = "svc-schedule"; const FORM_KEY = "svc-schedule";
const CLICK_DETECT_TIMEOUT = 200; //100 is a bit too fast to recognize a click
export default { export default {
async created() { async created() {
const vm = this; const vm = this;
@@ -452,7 +459,8 @@ export default {
hour12: window.$gz.locale.getHour12(), hour12: window.$gz.locale.getHour12(),
formUserOptions: {}, formUserOptions: {},
tempFirstTime: null, tempFirstTime: null,
availableUsers: [] availableUsers: [],
lastMouseDownMS: null
}; };
}, },
methods: { methods: {
@@ -514,13 +522,8 @@ export default {
extendBottom(event) { extendBottom(event) {
if (event.editable) { if (event.editable) {
//My work around to disambiguate extending and clicking //capture time to see if it's a click or a drag/extend
clearTimeout(this.dragTimeout); this.lastMouseDownMS = new Date().getTime();
this.dragged = false;
this.dragTimeout = setTimeout(() => {
this.dragged = true;
}, CLICK_DETECT_TIMEOUT); // Min delay to be regarded as extend instead of click, also affects click time to display more info, too short needs faster click
this.extendEvent = event; this.extendEvent = event;
this.createStart = event.start; this.createStart = event.start;
this.extendOriginal = event.end; this.extendOriginal = event.end;
@@ -538,21 +541,16 @@ export default {
//Handle the event, could be one of three things: changing an event start time, changing an event length or creating a new event //Handle the event, could be one of three things: changing an event start time, changing an event length or creating a new event
if (this.extendEvent && this.extendEvent.type == 0) { if (this.extendEvent && this.extendEvent.type == 0) {
// console.log(
// "endDragExtend::extendEvent",
// JSON.stringify(this.extendEvent)
// );
//NEW, prompt for deets and create or if cancelled then just remove this faux event from events list (it will be the last one in the array) //NEW, prompt for deets and create or if cancelled then just remove this faux event from events list (it will be the last one in the array)
this.newItemDialog = true; this.newItemDialog = true;
} else { } else {
//console.log("dragged:", this.dragged); //MORE INFO
if (!this.dragged) { if (this.lastMouseDownMS != null && this.itWasAClickNotADrag()) {
//we're here due to mouse up but it's not a drag or an extend so it's a More Info mouse up click so bail out now await this.showMoreInfo(this.dragEvent);
this.dragEvent = null; //this needs to be set or it will keep dragging off an editable event even as the moreinfo dialog show this.dragEvent = null; //this needs to be set or it will keep dragging off an editable event even as the moreinfo dialog show
return; return;
} }
//MODIFY existing event, drag or extend //MODIFY existing event, drag or extend
//console.log("endDragExtend::dragEvent", JSON.stringify(this.dragEvent));
if (this.dragEvent || this.extendEvent) { if (this.dragEvent || this.extendEvent) {
const param = { type: null, id: null, start: null, end: null }; const param = { type: null, id: null, start: null, end: null };
@@ -613,29 +611,40 @@ export default {
this.createStart = null; this.createStart = null;
this.dragTime = null; this.dragTime = null;
this.dragEvent = null; this.dragEvent = null;
this.lastMouseDownMS = null;
}, },
startDrag({ event }) { startDrag({ event }) {
//# mouse down on an event triggers this call //# mouse down on an event triggers this call
if (event) { if (event) {
this.lastMouseDownMS = new Date().getTime(); //snapshot time to disambiguate drag vs click
if (event.editable) { if (event.editable) {
//My work around to disambiguate dragging and clicking
clearTimeout(this.dragTimeout);
this.dragged = false; this.dragged = false;
this.dragTimeout = setTimeout(() => {
this.dragged = true;
}, CLICK_DETECT_TIMEOUT); // Min delay to be regarded as extend instead of click, also affects click time to display more info, too short needs faster click
this.dragEvent = event; this.dragEvent = event;
this.dragTime = null; this.dragTime = null;
this.extendOriginal = null; this.extendOriginal = null;
} else { } else {
this.dragged = false; this.dragged = false;
this.dragEvent = event; this.dragEvent = event;
// this.extendEvent = null;
this.dragTime = null; this.dragTime = null;
} }
} }
}, },
itWasAClickNotADrag() {
if (this.lastMouseDownMS == null) {
if (this.$ay.dev) {
throw new Error("lastMouseDownMS is null!");
} else {
window.$gz.store.commit(
"logItem",
"home-schedule:lastMouseDownMS is unexpectedly null"
);
return true; //least dangerous option in production
}
}
const elapsed = new Date().getTime() - this.lastMouseDownMS;
this.lastMouseDownMS = null;
return elapsed < 200;
},
mouseMoveDayView(tms) { mouseMoveDayView(tms) {
//no event being dragged or exgtended? //no event being dragged or exgtended?
if (!this.dragEvent && !this.extendEvent) { if (!this.dragEvent && !this.extendEvent) {
@@ -684,22 +693,18 @@ export default {
if (!tms.category && this.viewType == "category") { if (!tms.category && this.viewType == "category") {
return; return;
} }
console.log("startTime, tms:", JSON.stringify(tms));
//This is called on the start of dragging an existing schedule item or drag extending a NEW schedule item //This is called on the start of dragging an existing schedule item or drag extending a NEW schedule item
const mouse = this.toTime(tms); const mouse = this.toTime(tms);
if (this.dragEvent && this.dragTime === null) { if (this.dragEvent && this.dragTime === null) {
console.log("startTime drag path");
//# DAY VIEW *DRAG* EXISTING START EVENT (not extend) //# DAY VIEW *DRAG* EXISTING START EVENT (not extend)
//(also called on simple click to view schedule more info) //(also called on simple click to view schedule more info)
if (this.dragEvent.editable) { if (this.dragEvent.editable) {
const start = this.dragEvent.start; const start = this.dragEvent.start;
this.dragTime = mouse - start; this.dragTime = mouse - start;
} else {
console.log("startTime NOT EDITABLE!");
} }
} else { } else {
//# DAY VIEW CREATE START EVENT //# DAY VIEW CREATE START EVENT
console.log("startTime create start path");
this.createStart = this.roundTime(mouse); this.createStart = this.roundTime(mouse);
this.extendEvent = { this.extendEvent = {
name: "-", name: "-",
@@ -731,21 +736,6 @@ export default {
tms.minute tms.minute
).getTime(); ).getTime();
}, },
diagInfo() {
if (this.$refs.calendar) {
return (
"cal" +
JSON.stringify({
start: this.$refs.calendar.start,
end: this.$refs.calendar.end,
focus: this.focus,
firstInterval: this.$refs.calendar.firstInterval
})
);
} else {
return "no calendar";
}
},
typeToLabel() { typeToLabel() {
switch (this.viewType) { switch (this.viewType) {
case "month": case "month":
@@ -791,11 +781,8 @@ export default {
id: this.selectedEvent.id id: this.selectedEvent.id
}); });
}, },
async showMoreInfo({ nativeEvent, event }) { async showMoreInfo(event) {
//workaround to disambiguate drag click from view more info click this.selectedEvent = event;
if (this.dragged) {
return;
}
let route = null; let route = null;
this.evInfo = {}; this.evInfo = {};
switch (event.type) { switch (event.type) {
@@ -813,22 +800,12 @@ export default {
const res = await window.$gz.api.get(route); const res = await window.$gz.api.get(route);
if (!res.error) { if (!res.error) {
this.evInfo = res.data; this.evInfo = res.data;
this.moreInfoDialog = true;
} else {
this.formState.serverError = res.error;
window.$gz.form.setErrorBoxErrors(this);
} }
} }
const open = () => {
this.selectedEvent = event;
this.selectedElement = nativeEvent.target;
requestAnimationFrame(() =>
requestAnimationFrame(() => (this.moreInfoDialog = true))
);
};
if (this.moreInfoDialog) {
this.moreInfoDialog = false;
requestAnimationFrame(() => requestAnimationFrame(() => open()));
} else {
open();
}
nativeEvent.stopPropagation();
}, },
async fetchEvents({ start, end }) { async fetchEvents({ start, end }) {
try { try {