From 663843ef5dd4d2d5b95a08aec444f174fbf0f3aa Mon Sep 17 00:00:00 2001 From: Raz Date: Mon, 9 Dec 2024 11:13:19 +0100 Subject: [PATCH] enhance ui online reg --- tournaments/static/tournaments/css/style.css | 24 +++++++++++-- tournaments/templates/profile.html | 4 +-- .../templates/register_tournament.html | 36 +++++++++++++------ tournaments/templates/registration/login.html | 2 +- .../registration/password_reset_complete.html | 2 +- .../registration/password_reset_confirm.html | 2 +- .../registration/password_reset_form.html | 2 +- .../templates/registration/signup.html | 2 +- .../tournaments/tournament_info.html | 8 +++-- tournaments/views.py | 19 +++++++++- 10 files changed, 78 insertions(+), 23 deletions(-) diff --git a/tournaments/static/tournaments/css/style.css b/tournaments/static/tournaments/css/style.css index a3b5bea..3998cf8 100644 --- a/tournaments/static/tournaments/css/style.css +++ b/tournaments/static/tournaments/css/style.css @@ -125,14 +125,19 @@ tr { } */ .rounded-button { - background-color: #f39200; /* Green background */ - color: white; /* White text */ + background-color: #fae7ce; /* Green background */ + color: #707070; /* White text */ padding: 15px 32px; /* Some padding */ font-size: 1em; font-weight: 800; cursor: pointer; /* Add a mouse pointer on hover */ border-radius: 16px; /* Rounded corners */ } +.rounded-button:hover { + background-color: #f39200; /* Same background color on hover */ + color: white; /* Same text color on hover */ + text-decoration: none; /* Prevent underline on hover */ +} .numbers { font-feature-settings: "tnum"; @@ -705,3 +710,18 @@ h-margin { font-size: x-small; vertical-align: super; } + +.alert { + color: red; /* Make the text red */ + font-weight: bold; /* Optional: Make the text bold */ +} + +.destructive-button { + background-color: #ff4d4d; /* Red background */ + color: white; /* White text */ +} + +.destructive-button:hover { + background-color: #cc0000; /* Darker red on hover */ + color: white; /* White text on hover */ +} diff --git a/tournaments/templates/profile.html b/tournaments/templates/profile.html index ffde179..f2ce22c 100644 --- a/tournaments/templates/profile.html +++ b/tournaments/templates/profile.html @@ -17,7 +17,7 @@
{% csrf_token %} {{ form.as_p }} - +
@@ -26,7 +26,7 @@
{% csrf_token %} {{ password_change_form.as_p }} - +
diff --git a/tournaments/templates/register_tournament.html b/tournaments/templates/register_tournament.html index fd723ab..ff7cf89 100644 --- a/tournaments/templates/register_tournament.html +++ b/tournaments/templates/register_tournament.html @@ -54,7 +54,11 @@ {% if current_players|length < 2 %}
- + {% if current_players|length == 1 %} +
+ Inscrivez votre partenaire +
+ {% endif %} {% if user_without_licence and tournament.license_is_required %}
Une licence est obligatoire pour vous inscrire : @@ -76,16 +80,27 @@ {{ add_player_form.last_name.label_tag }} {{ add_player_form.last_name }} {% if tournament.license_is_required is False %} - {{ add_player_form.licence_id.label_tag }}{% if tournament.license_is_required is False %}(facultatif){% endif %} + {{ add_player_form.licence_id.label_tag }} + {% if tournament.license_is_required is False %}(facultatif){% endif %} {{ add_player_form.licence_id }} {% endif %} {% endif %} -
@@ -93,14 +108,13 @@ {% if current_players|length >= tournament.minimum_player_per_team %} - +
+
+
+ +
{% endif %} - - {% for message in messages %} -
{{ message }}
- {% endfor %} - {% endif %}
diff --git a/tournaments/templates/registration/login.html b/tournaments/templates/registration/login.html index ddd1521..c8cf291 100644 --- a/tournaments/templates/registration/login.html +++ b/tournaments/templates/registration/login.html @@ -19,7 +19,7 @@ - +

Mot de passe oublié ? diff --git a/tournaments/templates/registration/password_reset_complete.html b/tournaments/templates/registration/password_reset_complete.html index a701c7b..7aac4d0 100644 --- a/tournaments/templates/registration/password_reset_complete.html +++ b/tournaments/templates/registration/password_reset_complete.html @@ -11,7 +11,7 @@ Votre mot de passe a été réinitialisé avec succès. Vous pouvez maintenant vous connecter avec votre nouveau mot de passe.

- Se connecter + Se connecter

diff --git a/tournaments/templates/registration/password_reset_confirm.html b/tournaments/templates/registration/password_reset_confirm.html index cb0dc0a..0d09311 100644 --- a/tournaments/templates/registration/password_reset_confirm.html +++ b/tournaments/templates/registration/password_reset_confirm.html @@ -15,7 +15,7 @@ - +

Retour à la connexion diff --git a/tournaments/templates/registration/password_reset_form.html b/tournaments/templates/registration/password_reset_form.html index 318f44d..0872462 100644 --- a/tournaments/templates/registration/password_reset_form.html +++ b/tournaments/templates/registration/password_reset_form.html @@ -11,7 +11,7 @@ {% csrf_token %} - +

Retour à la connexion diff --git a/tournaments/templates/registration/signup.html b/tournaments/templates/registration/signup.html index 7cdcee6..40ca09d 100644 --- a/tournaments/templates/registration/signup.html +++ b/tournaments/templates/registration/signup.html @@ -14,7 +14,7 @@

{% csrf_token %} {{ form.as_p }} - +
diff --git a/tournaments/templates/tournaments/tournament_info.html b/tournaments/templates/tournaments/tournament_info.html index 6c445da..5beae08 100644 --- a/tournaments/templates/tournaments/tournament_info.html +++ b/tournaments/templates/tournaments/tournament_info.html @@ -69,7 +69,7 @@

- S'inscrire + S'inscrire

{% else %} @@ -116,7 +116,11 @@ {% if is_captain %}

- Se désinscrire + + Se désinscrire +

{% else %}

diff --git a/tournaments/views.py b/tournaments/views.py index c64c6fb..eddf5c8 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -619,7 +619,10 @@ def register_tournament(request, tournament_id): validator = LicenseValidator(licence_id) if validator.validate_license() is False and tournament.license_is_required is True: - messages.error(request, f"Le numéro de licence est invalide, la lettre ne correspond pas. {validator.computed_license_key}") + if len(licence_id) == 0: + messages.error(request, f"Le numéro de licence est obligatoire.") + else: + messages.error(request, f"Le numéro de licence est invalide, la lettre ne correspond pas.") return render(request, 'register_tournament.html', { 'team_form': team_form, 'add_player_form': add_player_form, @@ -691,6 +694,20 @@ def register_tournament(request, tournament_id): request.session['is_woman'] = data['is_woman'] request.session.modified = True # Ensure session is updated add_player_form.first_tournament = True + if add_player_form.names_is_valid() is False: + if len(request.session.get('team_registration', [])) == 0: + messages.error(request, "Pour confirmer votre inscription votre prénom et votre nom sont obligatoires.") + else: + messages.error(request, "Pour rajouter un partenaire, son prénom et son nom sont obligatoires.") + return render(request, 'register_tournament.html', { + 'team_form': team_form, + 'add_player_form': add_player_form, + 'tournament': tournament, + 'registration_successful': registration_successful, + 'current_players': request.session['team_registration'], + 'user_without_licence': user_without_licence + }) +