From 6e5ea7168e205580b28e94aa3f483bf512891ece Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Wed, 10 Apr 2024 09:13:23 +0200 Subject: [PATCH] Ask for confirmation before dropping changes or unregistering a player --- .../src/main/webapp/WEB-INF/translations/fr | 2 + .../main/webapp/js/tour-registration.inc.js | 25 +++- .../main/webapp/tour-registration.inc.html | 110 +++++++++--------- 3 files changed, 78 insertions(+), 59 deletions(-) diff --git a/view-webapp/src/main/webapp/WEB-INF/translations/fr b/view-webapp/src/main/webapp/WEB-INF/translations/fr index 80c7aad..7446e6e 100644 --- a/view-webapp/src/main/webapp/WEB-INF/translations/fr +++ b/view-webapp/src/main/webapp/WEB-INF/translations/fr @@ -35,6 +35,7 @@ Delete Supprimer Director Directeur Download Télécharger Download the standalone web interface module which suits your need, then follow Télécharger le module d’interface web qui correspond à vos besoins, puis suivez +Drop changes? Abandonner les changements ? Edit Éditer Encoding Encodage Enter the magic word Entrer le mot magique @@ -127,6 +128,7 @@ Tournament name Nom du tournoi Tournament type Type de tournoi Unpair Désapparier Unregister Désinscrire +Unregister this player? Désinscrire ce joueur ? Update Mettre à jour We offer you the flexibility to use Nous vous offrons la flexibilité d’utiliser Welcome to Bienvenue sur diff --git a/view-webapp/src/main/webapp/js/tour-registration.inc.js b/view-webapp/src/main/webapp/js/tour-registration.inc.js index 5d33193..3b0184d 100644 --- a/view-webapp/src/main/webapp/js/tour-registration.inc.js +++ b/view-webapp/src/main/webapp/js/tour-registration.inc.js @@ -157,6 +157,12 @@ onLoad(() => { }); $('#cancel-register').on('click', e => { e.preventDefault(); + if ($('#player-form').hasClass('edit') && !$('#register').hasClass('disabled')) { + let confirmMessage = $('#drop-changes').text(); + if (!confirm(confirmMessage)) { + return false; + } + } close_modal(); searchHighlight = undefined; return false; @@ -246,6 +252,7 @@ onLoad(() => { } form.removeClass('add'); $('#player').removeClass('create').addClass('edit'); + $('#register').addClass('disabled'); modal('player'); } }); @@ -310,12 +317,15 @@ onLoad(() => { $('#unregister').on('click', e => { let form = $('#player-form')[0]; let id = form.val('id'); - api.deleteJson(`tour/${tour_id}/part/${id}`) - .then(ret => { - if (ret !== 'error') { - window.location.reload(); - } - }); + let confirmMessage = $('#unregister-player').text(); + if (confirm(confirmMessage)) { + api.deleteJson(`tour/${tour_id}/part/${id}`) + .then(ret => { + if (ret !== 'error') { + window.location.reload(); + } + }); + } }); $('#reg-status').on('click', e => { let current = $('#final-reg').hasClass('final'); @@ -429,4 +439,7 @@ onLoad(() => { $('#browse-players').on('click', e => { search('*'); }); + $('.player-fields').on('change input', e => { + $('#register').removeClass('disabled'); + }); }); diff --git a/view-webapp/src/main/webapp/tour-registration.inc.html b/view-webapp/src/main/webapp/tour-registration.inc.html index 767429e..7188830 100644 --- a/view-webapp/src/main/webapp/tour-registration.inc.html +++ b/view-webapp/src/main/webapp/tour-registration.inc.html @@ -146,71 +146,73 @@
-
-
- - - +
+
+
+ + + +
+
+ + + +
-
- - - -
-
-
-
- - - + #set($defaultCountry = $translate.defaultCountry[$request.lang]) #foreach($country in $countries.countries) - + #end - + +
+
+ + + +
-
- - - -
-
-
-
- - - + #levels() - + +
+
+ + + +
-
- - - -
-
-
- -
- - -
- +
+ +
+ + +
+ #foreach($r in [1..$tour.rounds]) -
- - -
+
+ + +
#end +
#end + + #[[