schedule working, clean up
This commit is contained in:
@@ -1,8 +1,5 @@
|
||||
<template>
|
||||
<div v-if="formState.ready" v-resize="onResize" class="my-n8">
|
||||
<!-- `{{ "focus:" + focus }}` {{ diagInfo() }}
|
||||
{{ evInfo }}
|
||||
{{ events }}-->
|
||||
<gz-error :error-box-message="formState.errorBoxMessage"></gz-error>
|
||||
|
||||
<v-sheet height="64">
|
||||
@@ -83,16 +80,6 @@
|
||||
@mouseup:time="endDragExtend"
|
||||
@mouseleave.native="cancelDrag"
|
||||
>
|
||||
<!--
|
||||
@touchstart:time="startTime"
|
||||
|
||||
@touchmove:time="mouseMoveDa
|
||||
@touchend:event="touchEndEvent"
|
||||
@touchstart:event="touchStartEvent"yView"
|
||||
@touchmove:day="mouseMoveMonthView"
|
||||
@touchend:day="endDragExtend"
|
||||
@touchend:time="endDragExtend"
|
||||
-->
|
||||
<template v-slot:event="{ event, timed, eventSummary }">
|
||||
<div class="v-event-draggable">
|
||||
<v-icon small :color="event.textColor" class="mr-1">{{
|
||||
@@ -417,43 +404,8 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
/*
|
||||
|
||||
TODO NEXT:
|
||||
|
||||
|
||||
Move common functionality out of home-schedule to be re-used in svc-schedule and also potentially other scheds like customer view of workorders or visual calendar view of work for a single customer for techs etc
|
||||
the more I can move out of it the easier to do more scheds in other places
|
||||
|
||||
DOCS:
|
||||
how to use the schedule
|
||||
|
||||
Investigate: can AyaNova be a calendar source for Google calendar and others (like provide ical)
|
||||
so they can view, move around but create would be outside that but provided for when refresh.
|
||||
This way a user could just use their built in calendar app rather than fighting with our implementation
|
||||
Make a case with whatever is found if it looks like a v.next thing
|
||||
keywords google calendar feed url
|
||||
https://stayrony.github.io/Create-iCal-ics-Files-in-net-Core/
|
||||
http://blog.bennymichielsen.be/2013/11/11/exposing-ical-data-in-webapi/
|
||||
https://blog.elmah.io/generate-calendar-in-ical-format-with-net-using-ical-net/
|
||||
https://stackoverflow.com/questions/49032408/i-am-trying-to-provide-google-calendar-with-url-of-calendar-served-by-iis-asp-n
|
||||
Looks like you just provide text back in ical format so would need a token system of some kind I guess since google calendar is not going to login
|
||||
Maybe a sync option via the ayanova app is what is needed, i.e. they have a menu option to download as ical or sync as ical in ayanova and the device recognizes the url protocol or other type and syncs
|
||||
this might be a workaround to security issues and users can just update as needed for offline working
|
||||
ical maybe has urls to open objects in it somehow as well so they can clickthrough google calendar to the source object??
|
||||
|
||||
|
||||
reporting - make it happen
|
||||
could just default to regular reporting list, doesn't absolutely need to be a calendar at least at first
|
||||
as long as it has all appointments consolidated in single list
|
||||
|
||||
Move on to the shared service schedule with categories being people and all that entails
|
||||
|
||||
*/
|
||||
|
||||
// const FORM_CUSTOM_TEMPLATE_KEY = "home-schedule";
|
||||
const FORM_KEY = "home-schedule";
|
||||
const CLICK_DETECT_TIMEOUT = 100;
|
||||
const CLICK_DETECT_TIMEOUT = 200; //100 is a bit too fast to recognize a click
|
||||
export default {
|
||||
async created() {
|
||||
let vm = this;
|
||||
@@ -475,7 +427,6 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
//formCustomTemplateKey: FORM_CUSTOM_TEMPLATE_KEY,
|
||||
focus: "",
|
||||
viewType: "month",
|
||||
selectedEvent: {},
|
||||
@@ -578,15 +529,9 @@ export default {
|
||||
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
|
||||
|
||||
//console.log("extendBottom setting extendEvent");
|
||||
this.extendEvent = event;
|
||||
this.createStart = event.start;
|
||||
this.extendOriginal = event.end;
|
||||
} else {
|
||||
//probably don't need this, was diagnosing new on click on locked items
|
||||
////console.log("extendBottom not editable");
|
||||
// // this.dragged = false;
|
||||
// // this.extendEvent = null;
|
||||
}
|
||||
},
|
||||
async endDragExtend() {
|
||||
@@ -595,29 +540,20 @@ export default {
|
||||
//on create then dragged is set to false and createStart is only value set, dragEvent is null and extendEvent is null
|
||||
|
||||
//Handle the event, could be one of three things: changing an event start time, changing an event length or creating a new event
|
||||
////console.log("end drag extend");
|
||||
if (this.extendEvent && this.extendEvent.type == 0) {
|
||||
//console.log("end drag extend NEW");
|
||||
//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;
|
||||
} else {
|
||||
////console.log("end drag extend MODIFY??");
|
||||
if (!this.dragged) {
|
||||
//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
|
||||
//console.log("end drag extend NOPE NOT MODIFY, MUST BE MOREINFO", {
|
||||
// dragEvent: 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
|
||||
return;
|
||||
}
|
||||
//console.log("end drag extend YES MODIFY");
|
||||
//MODIFY existing event, drag or extend
|
||||
if (this.dragEvent || this.extendEvent) {
|
||||
let param = { type: null, id: null, start: null, end: null };
|
||||
|
||||
if (this.dragEvent) {
|
||||
// && this.dragged
|
||||
|
||||
param.type = this.dragEvent.type;
|
||||
param.id = this.dragEvent.id;
|
||||
param.start = window.$gz.locale.localScheduleFormatToUTC8601String(
|
||||
@@ -658,7 +594,6 @@ export default {
|
||||
}
|
||||
this.dragTime = null;
|
||||
this.dragEvent = null;
|
||||
//console.log("endDragExtend setting extendEvent to null");
|
||||
this.extendEvent = null;
|
||||
this.createStart = null;
|
||||
this.extendOriginal = null;
|
||||
@@ -666,7 +601,6 @@ export default {
|
||||
cancelDrag() {
|
||||
if (this.extendEvent) {
|
||||
if (this.extendOriginal) {
|
||||
//console.log("cancelDrag setting extendEvent");
|
||||
this.extendEvent.end = this.extendOriginal;
|
||||
} else {
|
||||
const i = this.events.indexOf(this.extendEvent);
|
||||
@@ -675,7 +609,6 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
//console.log("cancelDrag setting extendEvent to null");
|
||||
this.extendEvent = null;
|
||||
this.createStart = null;
|
||||
this.dragTime = null;
|
||||
@@ -685,8 +618,6 @@ export default {
|
||||
//# mouse down on an event triggers this call
|
||||
if (event) {
|
||||
if (event.editable) {
|
||||
//console.log("startDrag editable event: ", event);
|
||||
|
||||
//My work around to disambiguate dragging and clicking
|
||||
clearTimeout(this.dragTimeout);
|
||||
this.dragged = false;
|
||||
@@ -698,7 +629,6 @@ export default {
|
||||
this.dragTime = null;
|
||||
this.extendOriginal = null;
|
||||
} else {
|
||||
//console.log("startDrag not editable");
|
||||
this.dragged = false;
|
||||
this.dragEvent = event;
|
||||
// this.extendEvent = null;
|
||||
@@ -711,16 +641,8 @@ export default {
|
||||
if (!this.dragEvent && !this.extendEvent) {
|
||||
return;
|
||||
}
|
||||
//console.log("mouseMoveDayView has event, processing...");
|
||||
const mouse = this.toTime(tms);
|
||||
if (this.dragEvent && this.dragTime !== null) {
|
||||
//console.log("mousemovedayview dragging");
|
||||
|
||||
////console.log("mouseMoveDAyView::dragging path ", {
|
||||
// dragged: this.dragged,
|
||||
// dragEvent: this.dragEvent,
|
||||
// dragTime: this.dragTime
|
||||
// });
|
||||
//# DRAGGING PATH
|
||||
const start = this.dragEvent.start;
|
||||
const end = this.dragEvent.end;
|
||||
@@ -731,7 +653,6 @@ export default {
|
||||
this.dragEvent.start = newStart;
|
||||
this.dragEvent.end = newEnd;
|
||||
} else if (this.extendEvent && this.createStart !== null) {
|
||||
//console.log("mouseMoveDAyView::extending path ", this.extendEvent);
|
||||
//# EXTENDING PATH
|
||||
const mouseRounded = this.roundTime(mouse, false);
|
||||
const min = Math.min(mouseRounded, this.createStart);
|
||||
@@ -767,16 +688,13 @@ export default {
|
||||
//# DAY VIEW *DRAG* EXISTING START EVENT (not extend)
|
||||
//(also called on simple click to view schedule more info)
|
||||
if (this.dragEvent.editable) {
|
||||
//console.log("startTime calculating this.dragTime");
|
||||
const start = this.dragEvent.start;
|
||||
this.dragTime = mouse - start;
|
||||
} else {
|
||||
//console.log("startTime AVOIDED calculating this.dragTime");
|
||||
}
|
||||
} else {
|
||||
//# DAY VIEW CREATE START EVENT
|
||||
this.createStart = this.roundTime(mouse);
|
||||
//console.log("startTime setting extendEvent");
|
||||
this.extendEvent = {
|
||||
name: "-",
|
||||
color: this.$store.state.darkMode ? "white" : "black",
|
||||
@@ -911,11 +829,6 @@ export default {
|
||||
nativeEvent.stopPropagation();
|
||||
},
|
||||
async fetchEvents({ start, end }) {
|
||||
window.$gz.store.commit(
|
||||
"logItem",
|
||||
`fetchEvents:${JSON.stringify({ start: start.date, end: end.date })}`
|
||||
);
|
||||
// console.log("FetchEvents:", { start: start.date, end: end.date });
|
||||
try {
|
||||
window.$gz.form.deleteAllErrorBoxErrors(this);
|
||||
let res = await window.$gz.api.post("schedule/personal", {
|
||||
@@ -939,10 +852,6 @@ export default {
|
||||
this.formState.serverError = res.error;
|
||||
window.$gz.form.setErrorBoxErrors(this);
|
||||
} else {
|
||||
// window.$gz.store.commit(
|
||||
// "logItem",
|
||||
// `fetchEvents::MAPPING, res.data is: ${JSON.stringify(res.data)}`
|
||||
// );
|
||||
this.events = res.data.map(x => {
|
||||
return {
|
||||
...x,
|
||||
@@ -968,7 +877,7 @@ export default {
|
||||
//and trying to load the events manually is not working out as the calendar reports a different
|
||||
//start and end than it provides for the change event
|
||||
//this is brutal but works
|
||||
// window.location.reload();
|
||||
window.location.reload();
|
||||
}
|
||||
//eom
|
||||
}
|
||||
@@ -1131,7 +1040,6 @@ async function getFormUserOptions(vm) {
|
||||
window.$gz.form.setErrorBoxErrors(vm);
|
||||
} else {
|
||||
if (res.data == null) {
|
||||
//console.log("getFormUserOptions null setting default");
|
||||
//make a default
|
||||
vm.formUserOptions = {
|
||||
firstTime: "00:00",
|
||||
|
||||
Reference in New Issue
Block a user