diff --git a/assets/styles/app.css b/assets/styles/app.css index 81023914..d1894bbc 100644 --- a/assets/styles/app.css +++ b/assets/styles/app.css @@ -616,6 +616,17 @@ body { background-color: var(--feb-weekend-bg) !important; } +#reservation-table tbody td.reservation-table-today { + background-color: rgba(13, 110, 253, 0.08) !important; +} + +/* Overlay for today highlight in yearly view */ +.reservation-table-today-overlay { + pointer-events: none; + z-index: 2; + background: rgba(13, 110, 253, 0.18); + border-radius: 0.25rem; +} /* remove bottom border of tr for multiple reservations of one apartment (select tr where the next tr has border-top-0 class) */ #reservation-table tr:has( + .border-top-0) { @@ -673,7 +684,7 @@ div .reservation-yearly-day { position: absolute; left: 0; top: 0; - z-index: 2; + z-index: 3; padding: .5rem; } .month-reservationstartend { diff --git a/templates/Reservations/reservation_table.html.twig b/templates/Reservations/reservation_table.html.twig index f52130c8..ca30dabb 100644 --- a/templates/Reservations/reservation_table.html.twig +++ b/templates/Reservations/reservation_table.html.twig @@ -91,6 +91,7 @@ {% set totalColumnCount = grid.dayColumns|length * 2 + 1 %} {% set emptyTdNr = 0 %} + {% set todayDate = 'now'|date('Y-m-d') %} {% for row in grid.rows %} {# Subsidiary group header #} @@ -122,10 +123,14 @@ {# ── Cells ── #} {% for cell in row.cells %} + {% set cellEndOffset = cell.startsAtDayBoundary ? ((cell.span - 1) / 2)|round(0, 'floor') : (cell.span / 2)|round(0, 'floor') %} + {% set cellEndDate = cell.date|date_modify('+' ~ cellEndOffset ~ ' day')|date('Y-m-d') %} + {% set isSingleDayCell = cell.span <= 2 %} + {% set todayCss = isSingleDayCell and todayDate >= cell.date and todayDate <= cellEndDate ? ' reservation-table-today' : '' %} {% if cell.type == 'reservation' %} {# Reservation cell #} {% set reservation = cell.reservation %} -
{% elseif cell.type == 'blocked' %} {# Blocked cell #} - +
{% else %} {# Empty half-day cell #} - diff --git a/templates/Reservations/reservation_table_month.html.twig b/templates/Reservations/reservation_table_month.html.twig index e6530b08..7bbab90e 100644 --- a/templates/Reservations/reservation_table_month.html.twig +++ b/templates/Reservations/reservation_table_month.html.twig @@ -1,5 +1,7 @@ {# year and month are provided #} {% set startDate = date(year ~ '-' ~ month ~ '-01 UTC') %} +{# set today date for highlight #} +{% set todayDate = 'now'|date('Y-m-d') %} {# this is a dummy date where the first of month is monday which is used for the table header #} {% set dummyDate = date('2021-11-01 UTC') %} @@ -104,10 +106,16 @@ {% set tdContent = tdContent ~ '
 
' ~ dummyContent %} {% endfor %} - -
{{ tdContent|raw }}
-
{{ tmpDate|date('d') }}
+ {% if isToday %}
{% endif %} +
+ {{ tdContent|raw }} +
+
{{ tmpDate|date('d') }}