diff --git a/frontend/main.ts b/frontend/main.ts index dcea3f5..9d9bd2d 100644 --- a/frontend/main.ts +++ b/frontend/main.ts @@ -189,6 +189,17 @@ function initTripSidebar(triggerElement: HTMLElement) { let body = document.querySelector(triggerElement.dataset.body); let bodyElement = body.cloneNode(true); let bodyContainerElement = sidebarElement.querySelector('.body-js'); + + /* Quickfix duplicate ids checkboxes */ + const checkboxes = >bodyElement.querySelectorAll('input[type="checkbox"]'); + + Array.prototype.forEach.call(checkboxes, (checkbox: HTMLElement) => { + if(checkbox) { + checkbox.parentElement?.setAttribute('for', checkbox.id + 'js'); + checkbox.id += 'js'; + } + }); + if(bodyContainerElement) { bodyContainerElement.innerHTML = ''; bodyContainerElement.append(bodyElement); diff --git a/templates/index.html.tera b/templates/index.html.tera index b18438b..75648d9 100644 --- a/templates/index.html.tera +++ b/templates/index.html.tera @@ -131,7 +131,7 @@ {{ macros::input(label='Anzahl Ruderer', name='max_people', type='number', required=true, value=planned_event.max_people, min='0') }} {{ macros::input(label='Anzahl Steuerleute', name='planned_amount_cox', type='number', value=planned_event.planned_amount_cox, required=true, min='0') }} - {{ macros::checkbox(label='Immer anzeigen', name='always_show') }} + {{ macros::checkbox(label='Immer anzeigen', name='always_show', id=planned_event.id,checked=planned_event.always_show) }} {{ macros::input(label='Anmerkungen', name='notes', type='input', value=planned_event.notes) }}