aboutsummaryrefslogtreecommitdiff
path: root/assets/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'assets/main.js')
-rw-r--r--assets/main.js22
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')