From 38aeb64407cd3d2e24f59de9db11a373352f9ef5 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Thu, 9 Jun 2016 12:58:53 -0400 Subject: [PATCH] Use red background for overdue tickets --- .../mods-for-hesk-calendar-admin-readonly.js | 4 ++++ js/calendar/mods-for-hesk-calendar.js | 16 ++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/js/calendar/mods-for-hesk-calendar-admin-readonly.js b/js/calendar/mods-for-hesk-calendar-admin-readonly.js index c9cb3cff..0fecbfa0 100644 --- a/js/calendar/mods-for-hesk-calendar-admin-readonly.js +++ b/js/calendar/mods-for-hesk-calendar-admin-readonly.js @@ -84,6 +84,10 @@ $(document).ready(function() { $(this).popover('destroy'); }, eventRender: function(event, element) { + if (event.type === 'TICKET' && moment(event.start).endOf("day").isBefore(moment())) { + $('[data-date="' + event.start.format('YYYY-MM-DD') + '"]').css('background', '#f2dede'); + } + if (event.fontIconMarkup !== undefined) { element.find('span.fc-title').html(event.fontIconMarkup + ' ' + element.find('span.fc-title').text()); } diff --git a/js/calendar/mods-for-hesk-calendar.js b/js/calendar/mods-for-hesk-calendar.js index f666f4af..e7f38fc4 100644 --- a/js/calendar/mods-for-hesk-calendar.js +++ b/js/calendar/mods-for-hesk-calendar.js @@ -102,6 +102,10 @@ $(document).ready(function() { $cell.attr('title', 'Click to add event'); }, eventRender: function(event, element) { + if (event.type === 'TICKET' && moment(event.start).endOf("day").isBefore(moment())) { + $('[data-date="' + event.start.format('YYYY-MM-DD') + '"]').css('background', '#f2dede'); + } + if (event.fontIconMarkup !== undefined) { element.find('span.fc-title').html(event.fontIconMarkup + ' ' + element.find('span.fc-title').text()); } @@ -273,7 +277,7 @@ function buildEvent(id, dbObject) { owner: dbObject.owner, priority: dbObject.priority, textColor: calculateTextColor(dbObject.categoryColor), - fontIconMarkup: getIcon(dbObject, calculateTextColor(dbObject.categoryColor)) + fontIconMarkup: getIcon(dbObject) }; } @@ -297,14 +301,11 @@ function buildEvent(id, dbObject) { }; } -function getIcon(dbObject, textColor) { - console.log(textColor); +function getIcon(dbObject) { var endOfDay = moment(dbObject.startTime).endOf("day"); - var iconColor = textColor === 'white' ? '' : 'color: red'; - if (moment(endOfDay).isBefore(moment())) { - return ''; + return ''; } return ''; @@ -436,8 +437,7 @@ function respondToDragAndDrop(event, delta, revertFunc) { }, success: function() { event.fontIconMarkup = getIcon({ - startTime: event.start, - textColor: event.textColor + startTime: event.start }); $('#calendar').fullCalendar('updateEvent', event); $.jGrowl($('#lang_ticket_due_date_updated').text(), { theme: 'alert-success', closeTemplate: '' });