This commit is contained in:
2021-09-19 23:17:59 +00:00
parent 67f2d81ccd
commit 8cc00b0a4f

View File

@@ -335,7 +335,6 @@ export default {
} catch (error) { } catch (error) {
window.$gz.errorHandler.handleFormError(error, vm); window.$gz.errorHandler.handleFormError(error, vm);
} finally { } finally {
// //console.log("Setting ready, view Type is:", vm.viewType);
vm.formState.ready = true; vm.formState.ready = true;
} }
}, },
@@ -383,7 +382,6 @@ export default {
methods: { methods: {
newItem(atype) { newItem(atype) {
let newEvent = this.events[this.events.length - 1]; let newEvent = this.events[this.events.length - 1];
console.log("new item", { type: atype, event: newEvent });
const addStart = window.$gz.locale.localScheduleFormatToUTC8601String( const addStart = window.$gz.locale.localScheduleFormatToUTC8601String(
newEvent.start, newEvent.start,
this.timeZoneName this.timeZoneName
@@ -433,8 +431,6 @@ export default {
this.newItemDialog = false; this.newItemDialog = false;
}, },
startDrag({ event }) { startDrag({ event }) {
// console.log("startDrag", event);
if (event) { if (event) {
if (event.editable) { if (event.editable) {
//My work around to disambiguate dragging and clicking //My work around to disambiguate dragging and clicking
@@ -453,8 +449,6 @@ export default {
} }
}, },
extendBottom(event) { extendBottom(event) {
// console.log("extendBottom", event);
if (event.editable) { if (event.editable) {
//My work around to disambiguate extending and clicking //My work around to disambiguate extending and clicking
clearTimeout(this.dragTimeout); clearTimeout(this.dragTimeout);
@@ -474,12 +468,6 @@ export default {
//on extend then extendEvent (actual event), extendOriginal and createStart are set, dragEvent is null //on extend then extendEvent (actual event), extendOriginal and createStart are set, dragEvent is null
//on create then createStart is only value set, dragEvent is null and extendEvent is null //on create then createStart is only value set, dragEvent is null and extendEvent is null
// console.log("endDragExtend ", {
// dragEvent: this.dragEvent,
// extendEvent: this.extendEvent,
// createStart: this.createStart
// });
//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) {
@@ -530,13 +518,6 @@ export default {
} }
} }
} }
// else if (this.createStart && !this.dragEvent && !this.extendEvent) {
// // console.log(
// // "endDragExtend: event is CREATE for new event",
// // new Date(this.createStart).toString()
// // );
// }
this.dragTime = null; this.dragTime = null;
this.dragEvent = null; this.dragEvent = null;
this.extendEvent = null; this.extendEvent = null;
@@ -544,13 +525,10 @@ export default {
this.extendOriginal = null; this.extendOriginal = null;
}, },
cancelDrag() { cancelDrag() {
// console.log("cancelDrag");
if (this.extendEvent) { if (this.extendEvent) {
// console.log("Cancel drag A path (cancel?)");
if (this.extendOriginal) { if (this.extendOriginal) {
this.extendEvent.end = this.extendOriginal; this.extendEvent.end = this.extendOriginal;
} else { } else {
//console.log("Cancel drag B path (do it?)");
const i = this.events.indexOf(this.extendEvent); const i = this.events.indexOf(this.extendEvent);
if (i !== -1) { if (i !== -1) {
this.events.splice(i, 1); this.events.splice(i, 1);
@@ -572,7 +550,6 @@ export default {
const mouse = this.toTime(tms); const mouse = this.toTime(tms);
if (this.dragEvent && this.dragTime !== null) { if (this.dragEvent && this.dragTime !== null) {
//# DRAGGING PATH //# DRAGGING PATH
//console.log("mouseMoveDayView tms:", JSON.stringify(tms));
const start = this.dragEvent.start; const start = this.dragEvent.start;
const end = this.dragEvent.end; const end = this.dragEvent.end;
const duration = end - start; const duration = end - start;
@@ -581,15 +558,11 @@ export default {
const newEnd = newStart + duration; const newEnd = newStart + duration;
this.dragEvent.start = newStart; this.dragEvent.start = newStart;
this.dragEvent.end = newEnd; this.dragEvent.end = newEnd;
//console.log("DRAG DAY VIEW:", { mouse: mouse, tms: tms });
} else if (this.extendEvent && this.createStart !== null) { } else if (this.extendEvent && this.createStart !== null) {
//# EXTENDING PATH //# EXTENDING PATH
//console.log("mouseMoveDayView:Extending path");
const mouseRounded = this.roundTime(mouse, false); const mouseRounded = this.roundTime(mouse, false);
//console.log("mouseMoveDayView mouseRounded:", mouseRounded);
const min = Math.min(mouseRounded, this.createStart); const min = Math.min(mouseRounded, this.createStart);
const max = Math.max(mouseRounded, this.createStart); const max = Math.max(mouseRounded, this.createStart);
this.extendEvent.start = min; this.extendEvent.start = min;
this.extendEvent.end = max; this.extendEvent.end = max;
} }
@@ -598,25 +571,9 @@ export default {
if (!this.dragEvent) { if (!this.dragEvent) {
return; return;
} }
// console.log(
// "mouseMoveMonthView:",
// JSON.stringify({
// dd: dd,
// dragEvent: this.dragEvent
// })
// );
/*
NOTE: dd Date is the actual start of the event being dragged helpfully, NOT the mouse itself so I can just use that date as the appointment start date as it starts with that date but on
release it ends with whatever date is dragged to
mouseMoveMonthView: {
"dd":{"date":"2021-11-10","time":"","year":2021,"month":11,"day":10,"weekday":3,"hour":0,"minute":0,"hasDay":true,"hasTime":false,"past":false,"present":false,"future":true},
"dragEvent":{"start":1636515000000,"end":1636523100000,"timed":true,"name":"6 Parker, Ryan and Denesik","color":"#00ccff","textColor":"black","type":41,"id":33}
}
*/
//# DRAGGING PATH MONTH VIEW //# DRAGGING PATH MONTH VIEW
//need to get the actual start time as it isn't in the mouse date //need to get the actual start time as it isn't in the mouse date
const dragEventStartDate = new Date(this.dragEvent.start); const dragEventStartDate = new Date(this.dragEvent.start);
// console.log("eventStartDate", eventStartDate);
const mouseDate = new Date( const mouseDate = new Date(
dd.year, dd.year,
dd.month - 1, dd.month - 1,
@@ -631,7 +588,6 @@ export default {
startTime(tms) { startTime(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
// console.log("startTime", tms);
const mouse = this.toTime(tms); const mouse = this.toTime(tms);
if (this.dragEvent && this.dragTime === null) { if (this.dragEvent && this.dragTime === null) {
@@ -641,10 +597,6 @@ export default {
} else { } else {
//# DAY VIEW CREATE START EVENT //# DAY VIEW CREATE START EVENT
this.createStart = this.roundTime(mouse); this.createStart = this.roundTime(mouse);
// console.log(
// "startTime::STUB Create new element, popup FAB speeddial here"
// );
//console.log("startTime, create start:", this.createStart);
this.extendEvent = { this.extendEvent = {
name: "-", name: "-",
color: this.$store.state.darkMode ? "white" : "black", color: this.$store.state.darkMode ? "white" : "black",
@@ -736,18 +688,10 @@ export default {
}); });
}, },
async showevInfo({ nativeEvent, event }) { async showevInfo({ nativeEvent, event }) {
console.log("showevInfo, event: ", {
event: event,
dragged: this.dragged
});
//workaround to disambiguate drag click from view more info click //workaround to disambiguate drag click from view more info click
if (this.dragged) { if (this.dragged) {
return; return;
} }
//this.dragged = false;
//console.log("showevInfo, dragevent is:", this.dragEvent);
////console.log("showevInfo:event ", JSON.stringify(event));
let route = null; let route = null;
this.evInfo = {}; this.evInfo = {};
@@ -781,29 +725,8 @@ export default {
nativeEvent.stopPropagation(); nativeEvent.stopPropagation();
}, },
async fetchEvents({ start, end }) { async fetchEvents({ start, end }) {
// console.trace(
// "UPDATE RANGE:",
// JSON.stringify({ start: start.date, end: end.date })
// );
// //console.log(
// "TZ Offset",
// window.$gz.locale.getTZOffset(this.timeZoneName)
// );
/*
public enum PersonalScheduleWorkOrderColorSource : int
{
None = 0,
WorkOrderStatus = 2,
WorkOrderItemStatus = 3,
WorkOrderItemPriority = 4
}
*/
// console.trace("fetchEvents, viewtype is", this.viewType);
try { try {
window.$gz.form.deleteAllErrorBoxErrors(this); window.$gz.form.deleteAllErrorBoxErrors(this);
let res = await window.$gz.api.post("schedule/personal", { let res = await window.$gz.api.post("schedule/personal", {
view: window.$gz.util.calendarViewToAyaNovaEnum(this.viewType), view: window.$gz.util.calendarViewToAyaNovaEnum(this.viewType),
start: window.$gz.locale.localTimeDateStringToUTC8601String( start: window.$gz.locale.localTimeDateStringToUTC8601String(
@@ -983,12 +906,7 @@ function getFormSettings(vm) {
vm.viewType = formSettings.temp.viewType; vm.viewType = formSettings.temp.viewType;
vm.focus = formSettings.temp.focus; vm.focus = formSettings.temp.focus;
// //console.log("getFormSettings, got:", JSON.stringify(formSettings));
// //console.log("getFormSetting, vm.viewType is:", vm.viewType);
return formSettings; return formSettings;
// formSettings.temp.page = 0;
// formSettings.saved.dataTable.listViewId = -1;
// formSettings.saved.dataTable.unsavedListView = LIST_VIEW.listView;
} }
function saveFormSettings(vm) { function saveFormSettings(vm) {
@@ -996,7 +914,6 @@ function saveFormSettings(vm) {
formSettings.temp = { viewType: vm.viewType, focus: vm.focus }; formSettings.temp = { viewType: vm.viewType, focus: vm.focus };
window.$gz.form.setFormSettings(FORM_KEY, formSettings); window.$gz.form.setFormSettings(FORM_KEY, formSettings);
////console.log("SaveFormSettings, saving:", JSON.stringify(formSettings));
} }
////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////