| @@ -8,8 +8,12 @@ | ||
| 8 | 8 | function handleChangeEvent( e ) { |
| 9 | 9 | if ( 'INPUT' === e.target.nodeName && 'checkbox' === e.target.type && e.target.parentNode.classList.contains( 'frm_toggle_block' ) ) { |
| 10 | 10 | handleToggleChangeEvent( e ); |
| 11 | 11 | } |
| 12 | + | |
| 13 | + if ( 'frm_currency' === e.target.id) { | |
| 14 | + syncCurrencyOptions( e.target ); | |
| 15 | + } | |
| 12 | 16 | } |
| 13 | 17 | |
| 14 | 18 | function handleKeyDownEvent( e ) { |
| 15 | 19 | switch ( e.key ) { |
| @@ -20,8 +24,21 @@ | ||
| 20 | 24 | } |
| 21 | 25 | |
| 22 | 26 | function handleToggleChangeEvent( e ) { |
| 23 | 27 | e.target.nextElementSibling.setAttribute( 'aria-checked', e.target.checked ? 'true' : 'false' ); |
| 28 | + } | |
| 29 | + | |
| 30 | + /** | |
| 31 | + * Updates the currency formatting options based on the selected currency. | |
| 32 | + * | |
| 33 | + * @param {HTMLSelectElement} currencySelect The currency select element. | |
| 34 | + */ | |
| 35 | + function syncCurrencyOptions( currencySelect ) { | |
| 36 | + const currency = frmSettings.currencies[ currencySelect.value ]; | |
| 37 | + | |
| 38 | + document.getElementById( 'frm_thousand_separator' ).value = currency.thousand_separator; | |
| 39 | + document.getElementById( 'frm_decimal_separator' ).value = currency.decimal_separator; | |
| 40 | + document.getElementById( 'frm_decimals' ).value = currency.decimals; | |
| 24 | 41 | } |
| 25 | 42 | |
| 26 | 43 | function handleSpaceDownEvent( e ) { |
| 27 | 44 | if ( e.target.classList.contains( 'frm_toggle' ) ) { |