Do not display the hour if its the same as the row one (calendar table view).

This commit is contained in:
Alex Tselegidis 2016-07-24 11:23:56 +02:00
parent 7ed43cdad2
commit 4e2368c544

View file

@ -601,8 +601,8 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
var eventDuration = Math.round((endDate - startDate) / 60000); var eventDuration = Math.round((endDate - startDate) / 60000);
$event.html( $event.html(
(appointment.customer.first_name + ' ' + appointment.customer.last_name).trim() + appointment.customer.last_name +
' ' + startDate.toString('HH:mm') + ' (' + eventDuration + '\')' ' <span class="hour">' + startDate.toString('HH:mm') + '</span> (' + eventDuration + '\')'
); );
$event.data(appointment); $event.data(appointment);
@ -622,6 +622,11 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
$event.appendTo($(tr).prev().find('td').eq(cellIndex)); $event.appendTo($(tr).prev().find('td').eq(cellIndex));
// Remove the hour from the event if it is the same as the row.
if (eventDate.toString('HH:mm') === $(tr).prev().find('td').eq(0).text()) {
$event.find('.hour').remove();
}
return false; return false;
} }
}); });
@ -656,8 +661,8 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
var eventDuration = Math.round((endDate - eventDate) / 60000); var eventDuration = Math.round((endDate - eventDate) / 60000);
var $event = $('<div class="event unavailability" />'); var $event = $('<div class="event unavailability" />');
$event.html((unavailability.notes || EALang['unavailable']) + ' ' + eventDate.toString('HH:mm') $event.html((unavailability.notes || EALang['unavailable']) +
+ ' (' + eventDuration + '\')'); ' <span class="hour">' + eventDate.toString('HH:mm') + '</span> (' + eventDuration + '\')');
$event.data(unavailability); $event.data(unavailability);
@ -671,6 +676,12 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
if (eventDate < cellDate) { if (eventDate < cellDate) {
$event.appendTo($(tr).prev().find('td').eq(1)); $event.appendTo($(tr).prev().find('td').eq(1));
// Remove the hour from the event if it is the same as the row.
if (eventDate.toString('HH:mm') === $(tr).prev().find('td').eq(0).text()) {
$event.find('.hour').remove();
}
return false; return false;
} }
}); });
@ -700,7 +711,9 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
var eventDuration = Math.round((endDate - eventDate) / 60000); var eventDuration = Math.round((endDate - eventDate) / 60000);
var $event = $('<div class="event unavailability break" />'); var $event = $('<div class="event unavailability break" />');
$event.html(EALang['break'] + ' ' + eventDate.toString('HH:mm') + ' (' + eventDuration + '\')'); $event.html(
EALang['break'] +
' <span class="hour">' + eventDate.toString('HH:mm') + '</span> (' + eventDuration + '\')');
$event.data(entry); $event.data(entry);
@ -713,6 +726,11 @@ window.BackendCalendarTableView = window.BackendCalendarTableView || {};
}); });
if (eventDate < cellDate) { if (eventDate < cellDate) {
// Remove the hour from the event if it is the same as the row.
if (eventDate.toString('HH:mm') === $(tr).prev().find('td').eq(0).text()) {
$event.find('.hour').remove();
}
$(tr).prev().find('td:gt(0)').each(function(index, td) { $(tr).prev().find('td:gt(0)').each(function(index, td) {
$event.clone().appendTo($(td)); $event.clone().appendTo($(td));
}); });