Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion assets/styles/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -673,7 +684,7 @@ div .reservation-yearly-day {
position: absolute;
left: 0;
top: 0;
z-index: 2;
z-index: 3;
padding: .5rem;
}
.month-reservationstartend {
Expand Down
11 changes: 8 additions & 3 deletions templates/Reservations/reservation_table.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@
<tbody>
{% 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 #}
Expand Down Expand Up @@ -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 %}
<td class="reservation text-center cell-{{ cell.position }}{{ cell.startsAtDayBoundary ? ' day-start' : '' }}"
<td class="reservation text-center cell-{{ cell.position }}{{ cell.startsAtDayBoundary ? ' day-start' : '' }}{{ todayCss }}"
colspan="{{ cell.span }}"
>
<div data-action="click->reservations#openReservationAction"
Expand All @@ -139,12 +144,12 @@
</td>
{% elseif cell.type == 'blocked' %}
{# Blocked cell #}
<td class="td-blocked" colspan="{{ cell.span }}">
<td class="td-blocked{{ todayCss }}" colspan="{{ cell.span }}">
<div class="blocked-inner"></div>
</td>
{% else %}
{# Empty half-day cell #}
<td class="td-empty td-half td-half-{{ cell.side }}{{ cell.startsAtDayBoundary ? ' day-start' : '' }}"
<td class="td-empty td-half td-half-{{ cell.side }}{{ cell.startsAtDayBoundary ? ' day-start' : '' }}{{ todayCss }}"
data-day="{{ cell.date }}" data-appartment="{{ row.apartment.id }}"
data-tdnumber="{{ emptyTdNr }}"
></td>
Expand Down
14 changes: 11 additions & 3 deletions templates/Reservations/reservation_table_month.html.twig
Original file line number Diff line number Diff line change
@@ -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') %}
Expand Down Expand Up @@ -104,10 +106,16 @@

{% set tdContent = tdContent ~ '<div class="' ~ resCss ~'" style="' ~ style ~'"'~ action|raw ~' title="'~ block('popTitle') ~'" data-bs-content="'~ block('popBody')|raw ~'">&nbsp;</div> ' ~ dummyContent %}
{% endfor %}
<td colspan="2" class="text-center reservation-yearly-parent{{ noEvents }}"
{# highlight today with overlay and bold day number #}
{% set isToday = tmpDateFormatted == todayDate %}
{% set todayCss = isToday ? ' reservation-table-today' : '' %}
<td colspan="2" class="text-center reservation-yearly-parent{{ noEvents }}{{ todayCss }}"
style="width: {{ 100 / 7}}%" data-day="{{ tmpDate|date("Y-m-d") }}">
<div class="d-flex w-100 h-100">{{ tdContent|raw }}</div>
<div class="reservation-yearly-day">{{ tmpDate|date('d') }}</div>
{% if isToday %}<div class="reservation-table-today-overlay position-absolute top-0 start-0 w-100 h-100"></div>{% endif %}
<div class="d-flex w-100 h-100">
{{ tdContent|raw }}
</div>
<div class="reservation-yearly-day{% if isToday %} fw-bold{% endif %}">{{ tmpDate|date('d') }}</div>
</td>


Expand Down