Skip to content

Commit

Permalink
Fix drag and drop for due + edit dates
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelfolaron committed Sep 21, 2024
1 parent a33d185 commit 37dd4c6
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 9 deletions.
1 change: 1 addition & 0 deletions app/Domain/Calendar/Js/calendarController.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ leantime.calendarController = (function () {
title: jQuery(eventEl).find(".titleContainer strong").text(),
borderColor: 'var(--accent2)',
enitityType: "ticket",
dateContext: "edit",
duration: '01:00',
url: '#/tickets/showTicket/' + jQuery(eventEl).attr("data-val"),
};
Expand Down
50 changes: 41 additions & 9 deletions app/Domain/Calendar/Templates/showMyCalendar.tpl.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,13 @@
backgroundColor: '<?= $calendar['backgroundColor'] ?? "var(--accent2)" ?>',
borderColor: '<?= $calendar['borderColor'] ?? "var(--accent2)" ?>',
enitityType: "event",
dateContext: '<?= $calendar['dateContext'] ?? "plan" ?>',
<?php else : ?>
url: '<?=CURRENT_URL ?>#/tickets/showTicket/<?php echo $calendar['id'] ?>?projectId=<?php echo $calendar['projectId'] ?>',
backgroundColor: '<?= $calendar['backgroundColor'] ?? "var(--accent2)" ?>',
borderColor: '<?= $calendar['borderColor'] ?? "var(--accent2)" ?>',
enitityType: "ticket",
dateContext: '<?= $calendar['dateContext'] ?? "edit" ?>',
<?php endif; ?>
},
<?php endforeach; ?>
Expand Down Expand Up @@ -203,14 +205,28 @@
eventDrop: function (event) {

if(event.event.extendedProps.enitityType == "ticket") {
jQuery.ajax({
type : 'PATCH',
url : leantime.appUrl + '/api/tickets',
data : {

let dataVal = {};

if(event.event.extendedProps.dateContext == "due") {

dataVal = {
id: event.event.extendedProps.enitityId,
dateToFinish: event.event.startStr
}

}else{
dataVal = {
id: event.event.extendedProps.enitityId,
editFrom: event.event.startStr,
editTo: event.event.endStr
}
}

jQuery.ajax({
type : 'PATCH',
url : leantime.appUrl + '/api/tickets',
data : dataVal
});

}else if(event.event.extendedProps.enitityType == "event") {
Expand All @@ -229,15 +245,31 @@
eventResize: function (event) {

if(event.event.extendedProps.enitityType == "ticket") {
jQuery.ajax({
type : 'PATCH',
url : leantime.appUrl + '/api/tickets',
data : {

let dataVal = {};

if(event.event.extendedProps.dateContext == "due") {

dataVal = {
id: event.event.extendedProps.enitityId,
dateToFinish: event.event.startStr
}

}else{
dataVal = {
id: event.event.extendedProps.enitityId,
editFrom: event.event.startStr,
editTo: event.event.endStr
}
})
}

jQuery.ajax({
type : 'PATCH',
url : leantime.appUrl + '/api/tickets',
data : dataVal
});


}else if(event.event.extendedProps.enitityType == "event") {

jQuery.ajax({
Expand Down

0 comments on commit 37dd4c6

Please sign in to comment.