From 3d7626f1e9891dffdf504e502927e79c0614cbd5 Mon Sep 17 00:00:00 2001 From: John Cardinal Date: Fri, 17 Sep 2021 22:23:42 +0000 Subject: [PATCH] --- ayanova/src/views/home-schedule.vue | 75 +++++++++++++++++++++++------ 1 file changed, 59 insertions(+), 16 deletions(-) diff --git a/ayanova/src/views/home-schedule.vue b/ayanova/src/views/home-schedule.vue index 1f80017d..3de674eb 100644 --- a/ayanova/src/views/home-schedule.vue +++ b/ayanova/src/views/home-schedule.vue @@ -384,22 +384,39 @@ export default { //on create then 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 - if (this.dragEvent) { - //dragEvent.start is the new start time for this event to be set - console.log("endDragExtend: event is DRAG of existing event", { - dragEventStart: new Date(this.dragEvent.start).toString(), - dragTime: this.dragTime - }); - } else if (this.extendEvent) { - //extendEvent.End is the new end time for this event to be set - //However, it *is* possible to drag up beyond the start which sets start and end so to be safe should set both... - console.log("endDragExtend: event is EXTEND of existing event", { - extendEventStart: new Date(this.extendEvent.start).toString(), - extendEventEnd: new Date(this.extendEvent.end).toString() - //extendEventStart: new Date(this.extendEvent.start).toString(), - //extendOriginal: this.extendOriginal, - //createStart: this.createStart - }); + + //ADJUSTMENT EVENTS + if (this.dragEvent || this.extendEvent) { + let param = { type: null, id: null, start: null, end: null }; + + if (this.dragEvent) { + param.type = this.dragEvent.type; + param.id = this.dragEvent.id; + (param.start = this.dragEvent.start), + (param.end = this.dragEvent.end); + } else { + param.type = this.extendEvent.type; + param.id = this.extendEvent.id; + (param.start = this.extendEvent.start), + (param.end = this.extendEvent.end); + } + + //post it + //--- + try { + window.$gz.form.deleteAllErrorBoxErrors(this); + + let res = await window.$gz.api.post("schedule/adjust", param); + + if (res.error) { + this.formState.serverError = res.error; + window.$gz.form.setErrorBoxErrors(this); + } else { + } + } catch (error) { + window.$gz.errorHandler.handleFormError(error, this); + } + //--- } else if (this.createStart && !this.dragEvent && !this.extendEvent) { console.log( "endDragExtend: event is CREATE for new event", @@ -407,6 +424,32 @@ export default { ); } + //dragevent: + // //dragEvent.start is the new start time for this event to be set + // console.log("endDragExtend: event is DRAG of existing event", { + // dragEventStart: new Date(this.dragEvent.start).toString(), + // dragTime: this.dragTime + // }); + // else if (this.extendEvent) { + // //extendEvent.start is the new start time (if dragged upwards beyond start) + // //extendEvent.end is the new end time for this event to be set + // //to be safe should set both start and end here + // console.log("endDragExtend: event is EXTEND of existing event", { + // extendEventStart: new Date(this.extendEvent.start).toString(), + // extendEventEnd: new Date(this.extendEvent.end).toString() + // //extendEventStart: new Date(this.extendEvent.start).toString(), + // //extendOriginal: this.extendOriginal, + // //createStart: this.createStart + // }); + // } + + /* +/schedule/adjust post + public AyaType Type { get; set; } + public long Id { get; set; } + public DateTime Start { get; set; } + public DateTime End { get; set; } +*/ // console.log("endDragExtend, deets: ", { // dragEvent: this.dragEvent, // dragTime: this.dragTime,