family: fix weekly agenda & current week init (#69836)
This commit is contained in:
parent
84fb0e9ab0
commit
dab16066fa
|
@ -2,7 +2,10 @@ $(function () {
|
|||
function initAgendaCell($cell, prefix) {
|
||||
const $weekList = $(prefix + '--week-list', $cell);
|
||||
const $slider = $(prefix + '--slider', $cell);
|
||||
const $currentWeek = $(prefix + '--week-title.current', $cell);
|
||||
let $currentWeek = $(prefix + '--week-title.current', $cell);
|
||||
if (!$currentWeek.length) {
|
||||
$currentWeek = $(prefix + '--week-title:first', $cell);
|
||||
}
|
||||
const $nextWeekButton = $(prefix + '--next-week', $cell);
|
||||
const $previousWeekButton = $(prefix + '--previous-week', $cell);
|
||||
const $editAgendaBtn = $(prefix + '--edit-btn', $cell);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<div class="weekly-agenda-cell weekly-agenda-cell-{{ cell.pk }}" data-cell-id="{{ cell.pk }}">
|
||||
{% with first_monday=json.data.0.date|date|adjust_to_week_monday last_item=json.data|last %}
|
||||
{% with last_day=last_item.date|date|adjust_to_week_monday|add_days:6 %}
|
||||
{% now 'Y-m-W' as current_week %}
|
||||
{% now 'W' as current_week %}
|
||||
{% spaceless %}
|
||||
<button class="weekly-agenda-cell--previous-week">←</button>
|
||||
<div class="weekly-agenda-cell--week-list">
|
||||
|
@ -19,7 +19,7 @@
|
|||
{% for day in first_monday|iterate_days_until:last_day %}
|
||||
{% if day.weekday == 0 %}
|
||||
{% with sunday=day|add_days:6 %}
|
||||
<div class="weekly-agenda-cell--week-title {% if current_week == day|date:'Y-m-W' %}current{% endif %}"
|
||||
<div class="weekly-agenda-cell--week-title {% if current_week == day|date:'W' %}current{% endif %}"
|
||||
{% if booking_form_url %}data-edit-url="{{ booking_form_url }}{% if '?' in booking_form_url %}&{% else %}?{% endif %}current={{ day|adjust_to_week_monday|date:'Y-m-d' }}"{% endif %}>
|
||||
{% blocktrans with day_date=day|date:'d/m' sunday_date=sunday|date:'d/m' %}Week<br class="weekbreak"> of {{ day_date }} to {{ sunday_date }}{% endblocktrans %}
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue