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) {
window.$gz.errorHandler.handleFormError(error, vm);
} finally {
// //console.log("Setting ready, view Type is:", vm.viewType);
vm.formState.ready = true;
}
},
@@ -383,7 +382,6 @@ export default {
methods: {
newItem(atype) {
let newEvent = this.events[this.events.length - 1];
console.log("new item", { type: atype, event: newEvent });
const addStart = window.$gz.locale.localScheduleFormatToUTC8601String(
newEvent.start,
this.timeZoneName
@@ -433,8 +431,6 @@ export default {
this.newItemDialog = false;
},
startDrag({ event }) {
// console.log("startDrag", event);
if (event) {
if (event.editable) {
//My work around to disambiguate dragging and clicking
@@ -453,8 +449,6 @@ export default {
}
},
extendBottom(event) {
// console.log("extendBottom", event);
if (event.editable) {
//My work around to disambiguate extending and clicking
clearTimeout(this.dragTimeout);
@@ -474,12 +468,6 @@ export default {
//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
// 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
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.dragEvent = null;
this.extendEvent = null;
@@ -544,13 +525,10 @@ export default {
this.extendOriginal = null;
},
cancelDrag() {
// console.log("cancelDrag");
if (this.extendEvent) {
// console.log("Cancel drag A path (cancel?)");
if (this.extendOriginal) {
this.extendEvent.end = this.extendOriginal;
} else {
//console.log("Cancel drag B path (do it?)");
const i = this.events.indexOf(this.extendEvent);
if (i !== -1) {
this.events.splice(i, 1);
@@ -572,7 +550,6 @@ export default {
const mouse = this.toTime(tms);
if (this.dragEvent && this.dragTime !== null) {
//# DRAGGING PATH
//console.log("mouseMoveDayView tms:", JSON.stringify(tms));
const start = this.dragEvent.start;
const end = this.dragEvent.end;
const duration = end - start;
@@ -581,15 +558,11 @@ export default {
const newEnd = newStart + duration;
this.dragEvent.start = newStart;
this.dragEvent.end = newEnd;
//console.log("DRAG DAY VIEW:", { mouse: mouse, tms: tms });
} else if (this.extendEvent && this.createStart !== null) {
//# EXTENDING PATH
//console.log("mouseMoveDayView:Extending path");
const mouseRounded = this.roundTime(mouse, false);
//console.log("mouseMoveDayView mouseRounded:", mouseRounded);
const min = Math.min(mouseRounded, this.createStart);
const max = Math.max(mouseRounded, this.createStart);
this.extendEvent.start = min;
this.extendEvent.end = max;
}
@@ -598,25 +571,9 @@ export default {
if (!this.dragEvent) {
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
//need to get the actual start time as it isn't in the mouse date
const dragEventStartDate = new Date(this.dragEvent.start);
// console.log("eventStartDate", eventStartDate);
const mouseDate = new Date(
dd.year,
dd.month - 1,
@@ -631,7 +588,6 @@ export default {
startTime(tms) {
//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);
if (this.dragEvent && this.dragTime === null) {
@@ -641,10 +597,6 @@ export default {
} else {
//# DAY VIEW CREATE START EVENT
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 = {
name: "-",
color: this.$store.state.darkMode ? "white" : "black",
@@ -736,18 +688,10 @@ export default {
});
},
async showevInfo({ nativeEvent, event }) {
console.log("showevInfo, event: ", {
event: event,
dragged: this.dragged
});
//workaround to disambiguate drag click from view more info click
if (this.dragged) {
return;
}
//this.dragged = false;
//console.log("showevInfo, dragevent is:", this.dragEvent);
////console.log("showevInfo:event ", JSON.stringify(event));
let route = null;
this.evInfo = {};
@@ -781,29 +725,8 @@ export default {
nativeEvent.stopPropagation();
},
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 {
window.$gz.form.deleteAllErrorBoxErrors(this);
let res = await window.$gz.api.post("schedule/personal", {
view: window.$gz.util.calendarViewToAyaNovaEnum(this.viewType),
start: window.$gz.locale.localTimeDateStringToUTC8601String(
@@ -983,12 +906,7 @@ function getFormSettings(vm) {
vm.viewType = formSettings.temp.viewType;
vm.focus = formSettings.temp.focus;
// //console.log("getFormSettings, got:", JSON.stringify(formSettings));
// //console.log("getFormSetting, vm.viewType is:", vm.viewType);
return formSettings;
// formSettings.temp.page = 0;
// formSettings.saved.dataTable.listViewId = -1;
// formSettings.saved.dataTable.unsavedListView = LIST_VIEW.listView;
}
function saveFormSettings(vm) {
@@ -996,7 +914,6 @@ function saveFormSettings(vm) {
formSettings.temp = { viewType: vm.viewType, focus: vm.focus };
window.$gz.form.setFormSettings(FORM_KEY, formSettings);
////console.log("SaveFormSettings, saving:", JSON.stringify(formSettings));
}
//////////////////////////////////////////////////////////