diff options
author | Joris | 2021-10-10 21:21:06 +0200 |
---|---|---|
committer | Joris | 2021-10-10 21:21:34 +0200 |
commit | 99466c6ceb848cf8147645f25deea89804b7b279 (patch) | |
tree | ba184c40a8d30bfc76dcb2882420822c5518e199 /assets | |
parent | 6e695bf7a0253b4f6d1db78fa4310616d8a1357f (diff) |
Filter payments by start and end date
Diffstat (limited to 'assets')
-rw-r--r-- | assets/main.js | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/assets/main.js b/assets/main.js index 3dd4b6e..1b5620f 100644 --- a/assets/main.js +++ b/assets/main.js @@ -9,6 +9,7 @@ if (path == '/login') { } else if (path == '/') { // Payment table allow_select_reset() + allow_date_reset() } else if (path == '/payment') { // Payment creation @@ -67,6 +68,7 @@ function allow_select_reset() { button.className = 'g-Form__ResetSelect' button.onclick = function() { select.selectedIndex = 0 + button.style = 'visibility: hidden' } if (select.selectedIndex === 0) { button.style = 'visibility: hidden' @@ -79,6 +81,26 @@ function allow_select_reset() { }) } +function allow_date_reset() { + document.querySelectorAll('input[type="date"]').forEach(input => { + const button = document.createElement('input') + button.type = 'button' + button.value = 'Effacer' + button.className = 'g-Form__ResetSelect' + button.onclick = function() { + input.value = '' + button.style = 'visibility: hidden' + } + if (input.value === '') { + button.style = 'visibility: hidden' + } + input.onchange = function() { + button.style = 'visibility: visible' + } + input.parentNode.appendChild(button) + }) +} + function control_remove_button() { const removeInput = document.getElementsByName('remove-input')[0] const removeButton = document.getElementById('remove-button') |