var guest_reload = false; const getCustomConsent = () => { let customConsents = []; $(".custom-consent-chb:checked").each((index, element) => { customConsents = [...customConsents, $(element).val()] }); if(customConsents.length == 0) { return false; } return customConsents.join(','); } // The checkin submit buttons are always clickable; pressing one runs the form checks and, if something is wrong, // shows the errors (hidden by .checkin-pending until the first press) and scrolls to the first problem const validateCheckinOnSubmit = (button) => { const popup = $(button).closest('.checkinPopup'); popup.removeClass('checkin-pending'); if (validateBasicForm()) { return true; } const scope = popup.length ? popup : $(document); const firstProblem = scope.find('.is-invalid:visible').first(); const target = firstProblem.length ? firstProblem : scope.find('#checking-error-reporting'); if (target.length) { target[0].scrollIntoView({ behavior: 'smooth', block: 'center' }); } return false; } // The modern checkin dialog is requested only on pages that load its stylesheet (header_restyle.php) const modernCheckinEnabled = () => $('link[href*="checkin_modern.css"]').length > 0; // Last valid discount code of the open checkin form, for the summary's estimate: { code, percent, route, toParams } let ckmDiscount = null; // Puts a loaded checkin form (logged-in, guest or register) into its dialog and opens it; the two-panel layout gets its dialog class and setup const showCheckinForm = (popup, html) => { ckmDiscount = null; popup.html(html).addClass('checkin-pending'); const isModernForm = popup.find('.ckm').length > 0; if (isModernForm) { popup.dialog('option', 'dialogClass', 'ckm-dialog'); } popup.dialog('open'); if (isModernForm) { initModernCheckinForm(popup); } }; // The same form shown in the page instead of a dialog (group register page): a card (.ckm-inline) in holder. // It is put into the page before the HTML, so the form's own scripts find their elements const showCheckinFormInline = (holder, html) => { ckmDiscount = null; const card = $('
'); const popup = $('
').appendTo(card); holder.empty().append(card); popup.html(html); if (popup.find('.ckm').length) { initModernCheckinForm(popup); } else { // A message instead of the form (e.g. registrations closed) keeps the page's own look card.removeClass('ckm-dialog ckm-inline'); } }; // Styled replacement for the native dropdown of a