diff --git a/tournaments/services/email_service.py b/tournaments/services/email_service.py index 98f5c5f..1bdf904 100644 --- a/tournaments/services/email_service.py +++ b/tournaments/services/email_service.py @@ -430,18 +430,18 @@ class TournamentEmailService: deadline_str = time_to_confirm.astimezone(tournament.timezone()).strftime("%d/%m/%Y à %H:%M (%Z)") # Confirmation required message - action_text = "Pour confirmer votre participation au tournoi, cliquez sur ce lien ou contactez rapidement le juge-arbitre." + action_text = f"Pour confirmer votre participation au tournoi, cliquez sur ce lien pour {url_info} ou contactez rapidement le juge-arbitre." warning_text = f"⚠️ ATTENTION : Vous avez jusqu'au {deadline_str} pour confirmer votre participation. Passé ce délai, votre place sera automatiquement proposée à l'équipe suivante sur liste d'attente.\n\n" elif captain.registration_status == RegistrationStatus.PENDING: - action_text = "Pour confirmer votre participation au tournoi, cliquez sur ce lien ou contactez rapidement le juge-arbitre." + action_text = f"Pour confirmer votre participation au tournoi, cliquez sur ce lien pour {url_info} ou contactez rapidement le juge-arbitre." warning_text = "⚠️ ATTENTION : Actuellement, il n'y a pas de liste d'attente pour ce tournoi. Dès qu'une liste d'attente se formera, vous recevrez un email avec un délai précis pour confirmer votre participation.\n\n" else: # Standard message for teams already confirmed - action_text = "Si vous n'êtes plus disponible pour participer à ce tournoi, cliquez sur ce lien ou contactez rapidement le juge-arbitre." + action_text = f"Si vous n'êtes plus disponible pour participer à ce tournoi, cliquez sur ce lien pour {url_info} ou contactez rapidement le juge-arbitre." warning_text = "" # Construct the complete message - return f"\n\n{warning_text}{action_text}{url_info}{account_info}" + return f"\n\n{warning_text}{action_text}{account_info}" @staticmethod def notify(captain, other_player, tournament, message_type: TeamEmailType): diff --git a/tournaments/templates/register_tournament.html b/tournaments/templates/register_tournament.html index 464b01e..a2ff531 100644 --- a/tournaments/templates/register_tournament.html +++ b/tournaments/templates/register_tournament.html @@ -13,194 +13,209 @@
-

Inscription : {{ tournament.display_name }} {{ tournament.get_federal_age_category_display}}

+
+
{{ tournament.local_start_date_formatted }}
+
{{ tournament.event.club.name }}
+ {% if tournament.has_club_address %} +
{{ tournament.event.club.address }}
+
{{ tournament.event.club.city_zipcode }}
+ {% endif %} +
+ {% if registration_successful %} +

Merci, l'inscription a bien été envoyée au juge-arbitre.

+ {% if registration_paid %} +

✅ Votre paiement a bien été effectué et enregistré.

+ {% endif %} +

+ Un email de confirmation a été envoyé à l'adresse associée à votre compte Padel Club ({{ user.email }}). Pensez à vérifier vos spams si vous ne recevez pas l'email. En cas de problème, contactez le juge-arbitre. +

+ {% else %} + {% if not registration_successful %} +
+

Votre session d'inscription est active. Complétez le formulaire dans le délai accordé pour confirmer votre participation et garantir votre place.

+ {% if not cart_data.is_cart_expired %} +

Votre session d'inscription expirera le {{ cart_data.expiry|date:"d/m/Y à H:i" }}

+

Temps restant: {{ cart_data.expiry|timeuntil }}

+ {% else %} +

+ Votre session d'inscription a expiré. Veuillez recommencer le processus d'inscription. Votre place n'est plus garantie. +

+ {% endif %} +
+ {% endif %} -
+ {% if team_form.errors %} +
+ {% for field in team_form %} + {% if field.errors %} + {% for error in field.errors %} +
{{ field.label }} : {{ error }}
+ {% endfor %} + {% endif %} + {% endfor %} +
+ {% endif %} - {% if registration_successful %} -

Merci, l'inscription a bien été envoyée au juge-arbitre.

-

- Un email de confirmation a été envoyé à l'adresse associée à votre compte Padel Club ({{ user.email }}). Pensez à vérifier vos spams si vous ne recevez pas l'email. En cas de problème, contactez le juge-arbitre. -

- {% else %} - {% if not registration_successful %} -
-

Votre session d'inscription est active. Complétez le formulaire dans le délai accordé pour confirmer votre participation et garantir votre place.

- {% if not cart_data.is_cart_expired %} -

Votre session d'inscription expirera le {{ cart_data.expiry|date:"d/m/Y à H:i" }}

-

Temps restant: {{ cart_data.expiry|timeuntil }}

- {% else %} -

- Votre session d'inscription a expiré. Veuillez recommencer le processus d'inscription. Votre place n'est plus garantie. -

- {% endif %} -
- {% endif %} - - {% if team_form.errors %} -
- {% for field in team_form %} - {% if field.errors %} - {% for error in field.errors %} -
{{ field.label }} : {{ error }}
- {% endfor %} - {% endif %} - {% endfor %} -
- {% endif %} - - {% if messages %} -
- {% for message in messages %} -
- {{ message }} -
- {% endfor %} -
- {% endif %} - -
- {% csrf_token %} - - -
-

-

- Informations de contact -
-

- {% if team_form.non_field_errors %} - {% for error in team_form.non_field_errors %} -

{{ error }}

- {% endfor %} - {% endif %} - - {{ team_form.as_p }} -
- - - {% if current_players %} -

-

- Constitution de votre équipe -
-

-
    - {% for player in current_players %} -
  • -
    - {{ player.first_name }} {{ player.last_name }}{% if player.licence_id %} ({{ player.licence_id }}){% endif %} -
    -
    - {{ player.club_name }} -
    -
    - Classement à ce jour : {% if player.rank %}{{ player.rank }}{% if player.computed_rank and player.rank != player.computed_rank %} ({{ player.computed_rank }}){% endif %}{% else %}Non classé ({{ player.computed_rank }}){% endif %} -
    - {% if not forloop.first %} -
    - -
    - {% endif %} -
  • - {% endfor %} -
- {% endif %} - - - {% if current_players|length < 2 %} -
- {% if current_players|length == 1 %} -
- Inscrivez votre partenaire -
- {% endif %} - {% if current_players|length == 0 and add_player_form.user_without_licence and tournament.license_is_required %} -
- Une licence est obligatoire pour vous inscrire : -
- {% endif %} - - {% if tournament.license_is_required %} - {{ add_player_form.licence_id.label_tag }} - {{ add_player_form.licence_id }} - {% endif %} - {% if add_player_form.first_tournament or add_player_form.user_without_licence or tournament.license_is_required is False %} - {% if not add_player_form.user_without_licence and tournament.license_is_required is True %} -
- Padel Club n'a pas trouvé votre partenaire, il se peut qu'il s'agisse de son premier tournoi. Contacter le juge-arbitre après l'inscription si ce n'est pas le cas. -
-
- Précisez les informations du joueur : -
- {% endif %} + {% if messages %} +
+ {% for message in messages %} +
+ {{ message }} +
+ {% endfor %} +
+ {% endif %} - {% if not add_player_form.user_without_licence %} - {{ add_player_form.first_name.label_tag }} - {{ add_player_form.first_name }} - {{ add_player_form.last_name.label_tag }} - {{ add_player_form.last_name }} - {% endif %} - {% 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 }} + + {% csrf_token %} + + +
+

+

+ Informations de contact +
+

+ {% if team_form.non_field_errors %} + {% for error in team_form.non_field_errors %} +

{{ error }}

+ {% endfor %} + {% endif %} + + {{ team_form.as_p }} +
+ + + {% if current_players %} +

+

+ Constitution de votre équipe +
+

+
    + {% for player in current_players %} +
  • +
    + {{ player.first_name }} {{ player.last_name }}{% if player.licence_id %} ({{ player.licence_id }}){% endif %} +
    +
    + {{ player.club_name }} +
    +
    + Classement à ce jour : {% if player.rank %}{{ player.rank }}{% if player.computed_rank and player.rank != player.computed_rank %} ({{ player.computed_rank }}){% endif %}{% else %}Non classé ({{ player.computed_rank }}){% endif %} +
    + {% if not forloop.first %} +
    + +
    + {% endif %} +
  • + {% endfor %} +
+ {% endif %} + + + {% if current_players|length < 2 %} +
+ {% if current_players|length == 1 %} +
+ Inscrivez votre partenaire +
+ {% endif %} + {% if current_players|length == 0 and add_player_form.user_without_licence and tournament.license_is_required %} +
+ Une licence est obligatoire pour vous inscrire : +
+ {% endif %} + + {% if tournament.license_is_required %} + {{ add_player_form.licence_id.label_tag }} + {{ add_player_form.licence_id }} + {% endif %} + {% if add_player_form.first_tournament or add_player_form.user_without_licence or tournament.license_is_required is False %} + {% if not add_player_form.user_without_licence and tournament.license_is_required is True %} +
+ Padel Club n'a pas trouvé votre partenaire, il se peut qu'il s'agisse de son premier tournoi. Contacter le juge-arbitre après l'inscription si ce n'est pas le cas. +
+
+ Précisez les informations du joueur : +
+ {% endif %} + + {% if not add_player_form.user_without_licence %} + {{ add_player_form.first_name.label_tag }} + {{ add_player_form.first_name }} + {{ add_player_form.last_name.label_tag }} + {{ add_player_form.last_name }} + {% endif %} + {% 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 }} + {% endif %} + {% endif %} + + +
+ {% endif %} + + + {% if current_players|length >= tournament.minimum_player_per_team %} +
+
+
+ {% if cart_data.waiting_list_position == 1 %} + Tournoi complet, {{ cart_data.waiting_list_position }} équipe en liste d'attente actuellement. + {% elif cart_data.waiting_list_position > 1 %} + Tournoi complet, {{ cart_data.waiting_list_position }} équipes en liste d'attente actuellement. + {% elif cart_data.waiting_list_position == 0 %} + Tournoi complet, vous seriez la première équipe en liste d'attente. + {% endif %} +
+ +
+ {% if tournament.should_request_payment and cart_data.waiting_list_position < 0 %} +
+ Confirmer votre inscription en payant immédiatement : +
+ + {% endif %} + {% if tournament.should_request_payment is False or tournament.online_payment_is_mandatory is False or cart_data.waiting_list_position >= 0 %} + {% if tournament.should_request_payment and cart_data.waiting_list_position < 0 %} +
+ Ou confirmer votre inscription et payer sur place le jour du tournoi : +
+ {% endif %} + + {% endif %} +
+ {% endif %} + {% endif %} - {% endif %} - - -
- {% endif %} - - - {% if current_players|length >= tournament.minimum_player_per_team %} -
-
-
- {% if cart_data.waiting_list_position == 1 %} - Tournoi complet, {{ cart_data.waiting_list_position }} équipe en liste d'attente actuellement. - {% elif cart_data.waiting_list_position > 1 %} - Tournoi complet, {{ cart_data.waiting_list_position }} équipes en liste d'attente actuellement. - {% elif cart_data.waiting_list_position == 0 %} - Tournoi complet, vous seriez la première équipe en liste d'attente. - {% endif %} -
- -
- {% if tournament.should_request_payment and cart_data.waiting_list_position < 0 %} - - {% endif %} - {% if tournament.should_request_payment is False or tournament.online_payment_is_mandatory is False or cart_data.waiting_list_position >= 0 %} - - {% endif %} -
- {% endif %} - - {% endif %} -
+
diff --git a/tournaments/templates/tournaments/tournament_info.html b/tournaments/templates/tournaments/tournament_info.html index cb3e128..90abf3b 100644 --- a/tournaments/templates/tournaments/tournament_info.html +++ b/tournaments/templates/tournaments/tournament_info.html @@ -150,15 +150,10 @@

{{ tournament.display_name }} {{ tournament.get_federal_age_category_display}}

- - {% if tournament.event.name %} - - {% endif %} - +
{{ tournament.local_start_date_formatted }}
+
{{ tournament.day_duration_formatted }}
+
{{ tournament.court_count }} terrains

-

{{ tournament.local_start_date_formatted }}
-
{{ tournament.day_duration_formatted }}
-
{{ tournament.court_count }} terrains


diff --git a/tournaments/views.py b/tournaments/views.py index b256e2b..27c1d65 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -167,6 +167,13 @@ def tournament_info(request, tournament_id): team_registration = None is_captain = False player_register_check = None + storage = messages.get_messages(request) + for _ in storage: + pass + + if len(storage._loaded_messages) == 1: + del storage._loaded_messages[0] + if request.user.is_authenticated: # Assuming user's licence_id is stored in the user profile (e.g., request.user.licence_id) @@ -1149,6 +1156,7 @@ def tournament_payment_success(request, tournament_id): source_page = request.session.get('payment_source_page', 'tournament_info') if source_page == 'register_tournament': request.session['registration_successful'] = True + request.session['registration_paid'] = True messages.success(request, "Paiement réussi et inscription confirmée !") else: @@ -1183,6 +1191,7 @@ def register_tournament(request, tournament_id): # Check for registration_successful flag registration_successful = request.session.pop('registration_successful', False) + registration_paid = request.session.pop('registration_paid', False) # If registration was successful, render success page immediately if registration_successful: @@ -1196,6 +1205,7 @@ def register_tournament(request, tournament_id): context = { 'tournament': tournament, 'registration_successful': True, + 'registration_paid': registration_paid, 'current_players': [], 'cart_data': {'players': []} } @@ -1259,6 +1269,7 @@ def register_tournament(request, tournament_id): 'tournament': tournament, 'current_players': cart_data['players'], 'registration_successful': False, + 'registration_paid': False, 'cart_data': cart_data } @@ -1420,6 +1431,7 @@ def handle_register_team_request(request, tournament, cart_manager, context): ) context['registration_successful'] = True + context['registration_paid'] = False context['current_players'] = [] context['add_player_form'] = None # No more adding players after success else: