This commit is contained in:
@@ -384,22 +384,39 @@ export default {
|
|||||||
//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
|
||||||
|
|
||||||
//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.dragEvent) {
|
|
||||||
//dragEvent.start is the new start time for this event to be set
|
//ADJUSTMENT EVENTS
|
||||||
console.log("endDragExtend: event is DRAG of existing event", {
|
if (this.dragEvent || this.extendEvent) {
|
||||||
dragEventStart: new Date(this.dragEvent.start).toString(),
|
let param = { type: null, id: null, start: null, end: null };
|
||||||
dragTime: this.dragTime
|
|
||||||
});
|
if (this.dragEvent) {
|
||||||
} else if (this.extendEvent) {
|
param.type = this.dragEvent.type;
|
||||||
//extendEvent.End is the new end time for this event to be set
|
param.id = this.dragEvent.id;
|
||||||
//However, it *is* possible to drag up beyond the start which sets start and end so to be safe should set both...
|
(param.start = this.dragEvent.start),
|
||||||
console.log("endDragExtend: event is EXTEND of existing event", {
|
(param.end = this.dragEvent.end);
|
||||||
extendEventStart: new Date(this.extendEvent.start).toString(),
|
} else {
|
||||||
extendEventEnd: new Date(this.extendEvent.end).toString()
|
param.type = this.extendEvent.type;
|
||||||
//extendEventStart: new Date(this.extendEvent.start).toString(),
|
param.id = this.extendEvent.id;
|
||||||
//extendOriginal: this.extendOriginal,
|
(param.start = this.extendEvent.start),
|
||||||
//createStart: this.createStart
|
(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) {
|
} else if (this.createStart && !this.dragEvent && !this.extendEvent) {
|
||||||
console.log(
|
console.log(
|
||||||
"endDragExtend: event is CREATE for new event",
|
"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: ", {
|
// console.log("endDragExtend, deets: ", {
|
||||||
// dragEvent: this.dragEvent,
|
// dragEvent: this.dragEvent,
|
||||||
// dragTime: this.dragTime,
|
// dragTime: this.dragTime,
|
||||||
|
|||||||
Reference in New Issue
Block a user