Skip to content

Commit

Permalink
[FIX] resource_booking: portal responsive booking calendar table goin…
Browse files Browse the repository at this point in the history
…g wider and no x scroll
  • Loading branch information
rrebollo authored and norlinhenrik committed Feb 8, 2024
1 parent 442f10e commit 4d678fb
Showing 1 changed file with 105 additions and 98 deletions.
203 changes: 105 additions & 98 deletions resource_booking/templates/portal.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,110 +32,117 @@
</a>
</div>
<!-- Monthly calendar -->
<table class="table table-responsive-md text-center">
<thead t-if="booking.requester_advice">
<tr>
<td colspan="7">
<div t-field="booking.requester_advice" />
</td>
</tr>
</thead>
<thead class="thead-dark">
<tr>
<th class="text-left">
<a
t-if="start > now"
t-att-href="booking.get_portal_url(suffix='/schedule/%d/%d' % (start_previous.year, start_previous.month))"
class="btn btn-secondary"
title="Previous month"
>
<i class="fa fa-chevron-left" />
</a>
</th>
<th
class="align-middle"
colspan="5"
t-out="start.strftime('%B %Y')"
/>
<th class="text-right">
<a
t-att-href="booking.get_portal_url(suffix='/schedule/%d/%d' % (start_next.year, start_next.month))"
class="btn btn-secondary"
title="Next month"
>
<i class="fa fa-chevron-right" />
</a>
</th>
</tr>
</thead>
<thead>
<tr>
<t t-foreach="calendar.iterweekdays()" t-as="weekday">
<div class="table-responsive-md">
<table class="table text-center">
<thead t-if="booking.requester_advice">
<tr>
<td colspan="7">
<div t-field="booking.requester_advice" />
</td>
</tr>
</thead>
<thead class="thead-dark">
<tr>
<th class="text-left">
<a
t-if="start > now"
t-att-href="booking.get_portal_url(suffix='/schedule/%d/%d' % (start_previous.year, start_previous.month))"
class="btn btn-secondary"
title="Previous month"
>
<i class="fa fa-chevron-left" />
</a>
</th>
<th
t-att-title="weekday_names[str(weekday + 1)]"
t-out="weekday_names[str(weekday + 1)][:3]"
class="align-middle"
colspan="5"
t-out="start.strftime('%B %Y')"
/>
</t>
</tr>
</thead>
<tbody>
<t
t-foreach="calendar.monthdatescalendar(start.year, start.month)"
t-as="week"
>
<tr>
<t t-foreach="week" t-as="day">
<td
t-att-class="day.month != start.month and 'text-muted'"
<th class="text-right">
<a
t-att-href="booking.get_portal_url(suffix='/schedule/%d/%d' % (start_next.year, start_next.month))"
class="btn btn-secondary"
title="Next month"
>
<t
t-if="day.month == start.month and slots.get(day)"
<i class="fa fa-chevron-right" />
</a>
</th>
</tr>
</thead>
<thead>
<tr>
<t t-foreach="calendar.iterweekdays()" t-as="weekday">
<th
t-att-title="weekday_names[str(weekday + 1)]"
t-out="weekday_names[str(weekday + 1)][:3]"
/>
</t>
</tr>
</thead>
<tbody>
<t
t-foreach="calendar.monthdatescalendar(start.year, start.month)"
t-as="week"
>
<tr>
<t t-foreach="week" t-as="day">
<td
t-att-class="day.month != start.month and 'text-muted'"
>
<!-- Day dropdown -->
<div class="dropdown">
<button
class="btn btn-primary dropdown-toggle"
type="button"
data-bs-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
t-out="day.day"
t-attf-id="dropdown-trigger-#{day.isoformat()}"
/>
<div
class="dropdown-menu slots-dropdown"
t-attf-aria-labelledby="dropdown-trigger-#{day.isoformat()}"
>
<t t-foreach="slots[day]" t-as="slot">
<!-- Hour item to open confirmation -->
<button
class="dropdown-item"
type="button"
data-bs-toggle="modal"
t-attf-data-bs-target="#modal-confirm-#{int(slot.timestamp())}"
t-out="slot.strftime(time_format)"
/>
</t>
<t
t-if="day.month == start.month and slots.get(day)"
>
<!-- Day dropdown -->
<div class="dropdown">
<button
class="btn btn-primary dropdown-toggle"
type="button"
data-bs-toggle="dropdown"
aria-haspopup="true"
aria-expanded="false"
t-out="day.day"
t-attf-id="dropdown-trigger-#{day.isoformat()}"
/>
<div
class="dropdown-menu slots-dropdown"
t-attf-aria-labelledby="dropdown-trigger-#{day.isoformat()}"
>
<t
t-foreach="slots[day]"
t-as="slot"
>
<!-- Hour item to open confirmation -->
<button
class="dropdown-item"
type="button"
data-bs-toggle="modal"
t-attf-data-bs-target="#modal-confirm-#{int(slot.timestamp())}"
t-out="slot.strftime(time_format)"
/>
</t>
</div>
</div>
</div>
</t>
<t t-else="">
<t t-out="day.day" />
</t>
</td>
</t>
</t>
<t t-else="">
<t t-out="day.day" />
</t>
</td>
</t>
</tr>
</t>
</tbody>
<tfoot>
<tr>
<td
colspan="7"
> All times are displayed using this timezone: <strong
t-field="booking.type_id.resource_calendar_id.tz"
/>
</td>
</tr>
</t>
</tbody>
<tfoot>
<tr>
<td colspan="7">
All times are displayed using this timezone:
<strong t-field="booking.type_id.resource_calendar_id.tz" />
</td>
</tr>
</tfoot>
</table>
</tfoot>
</table>
</div>
<!-- Hour confirmation modals -->
<t
t-foreach="calendar.monthdatescalendar(start.year, start.month)"
Expand Down

0 comments on commit 4d678fb

Please sign in to comment.