diff --git a/css/style.css b/css/style.css index 809a794..4cc97f5 100644 --- a/css/style.css +++ b/css/style.css @@ -2579,47 +2579,21 @@ a.ms1-trad-link.btn-aide-trad{ gap:8px; } -.inscr-mobile-statut-radio{ - display:flex; - flex-direction:column; - gap:6px; -} - -.inscr-mobile-statut-option{ - display:flex; - align-items:center; - gap:8px; - margin:0; - padding:8px 10px; - border:1px solid #dee2e6; - border-radius:4px; - background:#f8f9fa; +.inscr-mobile-statut-select{ + max-width:100%; font-size:14px; - font-weight:500; - cursor:pointer; + padding:6px 10px; + height:auto; + min-height:34px; } -.inscr-mobile-statut-option:has(.inscr-mobile-statut-option__input:checked){ - border-color:#0d6efd; - background:#e7f1ff; -} - -.inscr-mobile-statut-option__input{ - margin:0; - flex-shrink:0; -} - -.inscr-mobile-statut-option__label{ - flex:1; - line-height:1.3; -} - -.inscr-mobile-field-block--statut.inscr-mobile-statut--saved .inscr-mobile-statut-option:has(.inscr-mobile-statut-option__input:checked){ +.inscr-mobile-field-block--statut.inscr-mobile-statut--saved .inscr-mobile-statut-select{ border-color:#198754; - background:#d1e7dd; + background-color:#d1e7dd; } -.inscr-mobile-field-block--statut.inscr-mobile-statut--error{ +.inscr-mobile-field-block--statut.inscr-mobile-statut--error .inscr-mobile-statut-select{ + border-color:#dc3545; animation:inscr-mobile-statut-shake .35s ease; } diff --git a/inc_footer_scripts.php b/inc_footer_scripts.php index 1c135cd..6de23ed 100644 --- a/inc_footer_scripts.php +++ b/inc_footer_scripts.php @@ -3458,12 +3458,12 @@ if ($strLangue == 'fr') { var pendingStatutXhr = null; var lastStatutParId = null; - $body.on('change', '.inscr-mobile-statut-option__input', function () { - var $input = $(this); - var $group = $input.closest('.inscr-mobile-statut-radio'); - var $block = $input.closest('.inscr-mobile-field-block--statut'); - var intParId = $group.data('par_id'); - var strCode = $input.val(); + $body.on('change', '.inscr-mobile-statut-select', function () { + var $select = $(this); + var $block = $select.closest('.inscr-mobile-field-block--statut'); + var intParId = $select.data('par_id'); + var strCode = $select.val(); + var strPrev = $select.data('prev'); if (!intParId || !strCode) { return; @@ -3487,20 +3487,27 @@ if ($strLangue == 'fr') { pendingStatutXhr = null; $preloader.fadeOut('slow'); if (result && result.state === 'success') { + $select.data('prev', strCode); $block.addClass('inscr-mobile-statut--saved'); window.setTimeout(function () { $block.removeClass('inscr-mobile-statut--saved'); }, 1200); } else { + $select.val(strPrev); $block.addClass('inscr-mobile-statut--error'); } }, 'json').fail(function () { pendingStatutXhr = null; $preloader.fadeOut('slow'); + $select.val(strPrev); $block.addClass('inscr-mobile-statut--error'); }); }); + moduleInscr.querySelectorAll('.inscr-mobile-statut-select').forEach(function (el) { + el.dataset.prev = el.value; + }); + var params = new URLSearchParams(window.location.search); if (params.get('pec_id')) { moduleInscr.scrollIntoView({block: 'start'}); diff --git a/php/inc_fx_inscriptions_mobile.php b/php/inc_fx_inscriptions_mobile.php index ecf1595..58cfd77 100644 --- a/php/inc_fx_inscriptions_mobile.php +++ b/php/inc_fx_inscriptions_mobile.php @@ -220,9 +220,9 @@ function fxInscrMobileRenderStatutField($intParId, $strCurrent, $intEveId, $strL } $strCurrent = fxInscrMobileResolveParStatutCourse($strCurrent); - $strGroupName = 'inscr_statut_' . (int)$intParId; + $strSelectId = 'inscr_statut_' . (int)$intParId; - echo '