fix feedback intern

timetoconfirm
Raz 7 months ago
parent e708fb8b70
commit c95c9f403b
  1. 8
      tournaments/services/email_service.py
  2. 377
      tournaments/templates/register_tournament.html
  3. 11
      tournaments/templates/tournaments/tournament_info.html
  4. 12
      tournaments/views.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):

@ -13,194 +13,209 @@
</nav>
<div class="grid-x">
<div class="cell medium-6 large-6 padding10">
<h1 class="club padding10">Inscription : {{ tournament.display_name }} {{ tournament.get_federal_age_category_display}}</h1 >
<div class="bubble">
<div class="semibold">{{ tournament.local_start_date_formatted }}</div>
<div class="semibold">{{ tournament.event.club.name }}</div>
{% if tournament.has_club_address %}
<div>{{ tournament.event.club.address }}</div>
<div>{{ tournament.event.club.city_zipcode }}</div>
{% endif %}
<hr/>
{% if registration_successful %}
<p class="topblock">Merci, l'inscription a bien été envoyée au juge-arbitre.</p>
{% if registration_paid %}
<p><strong>✅ Votre paiement a bien été effectué et enregistré.</strong></p>
{% endif %}
<p style="text-align: justify;">
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.
</p>
{% else %}
{% if not registration_successful %}
<div class="info-box topblock">
<p>Votre session d'inscription est active. Complétez le formulaire dans le délai accordé pour confirmer votre participation et garantir votre place.</p>
{% if not cart_data.is_cart_expired %}
<p class="semibold highlight">Votre session d'inscription expirera le {{ cart_data.expiry|date:"d/m/Y à H:i" }}</p>
<p>Temps restant: <span id="countdown" data-expiry="{{ cart_data.expiry|date:'Y-m-d H:i:s' }}">{{ cart_data.expiry|timeuntil }}</span></p>
{% else %}
<p class="alert alert-danger">
Votre session d'inscription a expiré. Veuillez recommencer le processus d'inscription. Votre place n'est plus garantie.
</p>
{% endif %}
</div>
{% endif %}
<div class="bubble">
{% if team_form.errors %}
<div>
{% for field in team_form %}
{% if field.errors %}
{% for error in field.errors %}
<div class="alert">{{ field.label }} : {{ error }}</div>
{% endfor %}
{% endif %}
{% endfor %}
</div>
{% endif %}
{% if registration_successful %}
<p>Merci, l'inscription a bien été envoyée au juge-arbitre.</p>
<p style="text-align: justify;">
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.
</p>
{% else %}
{% if not registration_successful %}
<div class="info-box">
<p>Votre session d'inscription est active. Complétez le formulaire dans le délai accordé pour confirmer votre participation et garantir votre place.</p>
{% if not cart_data.is_cart_expired %}
<p class="semibold highlight">Votre session d'inscription expirera le {{ cart_data.expiry|date:"d/m/Y à H:i" }}</p>
<p>Temps restant: <span id="countdown" data-expiry="{{ cart_data.expiry|date:'Y-m-d H:i:s' }}">{{ cart_data.expiry|timeuntil }}</span></p>
{% else %}
<p class="alert alert-danger">
Votre session d'inscription a expiré. Veuillez recommencer le processus d'inscription. Votre place n'est plus garantie.
</p>
{% endif %}
</div>
{% endif %}
{% if team_form.errors %}
<div>
{% for field in team_form %}
{% if field.errors %}
{% for error in field.errors %}
<div class="alert">{{ field.label }} : {{ error }}</div>
{% endfor %}
{% endif %}
{% endfor %}
</div>
{% endif %}
{% if messages %}
<div class="messages">
{% for message in messages %}
<div class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %}">
{{ message }}
</div>
{% endfor %}
</div>
{% endif %}
<form method="post">
{% csrf_token %}
<!-- Team Registration Form -->
<div>
<p>
<div class="semibold">
Informations de contact
</div>
</p>
{% if team_form.non_field_errors %}
{% for error in team_form.non_field_errors %}
<p>{{ error }}</p>
{% endfor %}
{% endif %}
{{ team_form.as_p }} <!-- Render team registration form fields here -->
</div>
<!-- Show players added to the team only if there are players added -->
{% if current_players %}
<p>
<div class="semibold">
Constitution de votre équipe
</div>
</p>
<ul>
{% for player in current_players %}
<li>
<div>
{{ player.first_name }} {{ player.last_name }}{% if player.licence_id %} ({{ player.licence_id }}){% endif %}
</div>
<div>
{{ player.club_name }}
</div>
<div>
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 %}
</div>
{% if not forloop.first %}
<div>
<button type="submit" name="remove_player" class="btn small-button">
modifier
</button>
</div>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
<!-- Add Player Form -->
{% if current_players|length < 2 %}
<div>
{% if current_players|length == 1 %}
<div class="semibold">
Inscrivez votre partenaire
</div>
{% endif %}
{% if current_players|length == 0 and add_player_form.user_without_licence and tournament.license_is_required %}
<div class="semibold">
Une licence est obligatoire pour vous inscrire :
</div>
{% 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 %}
<div class="semibold">
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.
</div>
<div class="semibold">
Précisez les informations du joueur :
</div>
{% endif %}
{% if messages %}
<div class="messages">
{% for message in messages %}
<div class="alert {% if message.tags %}alert-{{ message.tags }}{% endif %}">
{{ message }}
</div>
{% endfor %}
</div>
{% 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 }}
<form method="post">
{% csrf_token %}
<!-- Team Registration Form -->
<div>
<p>
<div class="semibold">
Informations de contact
</div>
</p>
{% if team_form.non_field_errors %}
{% for error in team_form.non_field_errors %}
<p>{{ error }}</p>
{% endfor %}
{% endif %}
{{ team_form.as_p }} <!-- Render team registration form fields here -->
</div>
<!-- Show players added to the team only if there are players added -->
{% if current_players %}
<p>
<div class="semibold">
Constitution de votre équipe
</div>
</p>
<ul>
{% for player in current_players %}
<li>
<div>
{{ player.first_name }} {{ player.last_name }}{% if player.licence_id %} ({{ player.licence_id }}){% endif %}
</div>
<div>
{{ player.club_name }}
</div>
<div>
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 %}
</div>
{% if not forloop.first %}
<div>
<button type="submit" name="remove_player" class="btn small-button">
modifier
</button>
</div>
{% endif %}
</li>
{% endfor %}
</ul>
{% endif %}
<!-- Add Player Form -->
{% if current_players|length < 2 %}
<div>
{% if current_players|length == 1 %}
<div class="semibold">
Inscrivez votre partenaire
</div>
{% endif %}
{% if current_players|length == 0 and add_player_form.user_without_licence and tournament.license_is_required %}
<div class="semibold">
Une licence est obligatoire pour vous inscrire :
</div>
{% 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 %}
<div class="semibold">
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.
</div>
<div class="semibold">
Précisez les informations du joueur :
</div>
{% 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 %}
<button type="submit" name="add_player" class="rounded-button">
{% if add_player_form.user_without_licence %}
Confirmer
{% else %}
{% if current_players|length == 0 %}
Confirmer
{% else %}
Ajouter un partenaire
{% endif %}
{% endif %}
</button>
</div>
{% endif %}
<!-- Show players added to the team only if there are players added -->
{% if current_players|length >= tournament.minimum_player_per_team %}
<div class="margin10">
</div>
<div class="semibold margin10">
{% 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 %}
</div>
<div>
{% if tournament.should_request_payment and cart_data.waiting_list_position < 0 %}
<div class="semibold">
Confirmer votre inscription en payant immédiatement :
</div>
<button type="submit" name="proceed_to_payment" class="rounded-button">
Procéder au paiement ({{ tournament.team_fee }}€)
</button>
{% 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 %}
<div class="semibold topmargin20">
Ou confirmer votre inscription et payer sur place le jour du tournoi :
</div>
{% endif %}
<button type="submit" name="register_team" class="rounded-button">
{% if cart_data.waiting_list_position < 0 %}
Confirmer l'inscription
{% else %}
Se mettre en liste d'attente
{% endif %}
</button>
{% endif %}
</div>
{% endif %}
</form>
{% endif %}
{% endif %}
<button type="submit" name="add_player" class="rounded-button">
{% if add_player_form.user_without_licence %}
Confirmer
{% else %}
{% if current_players|length == 0 %}
Confirmer
{% else %}
Ajouter un partenaire
{% endif %}
{% endif %}
</button>
</div>
{% endif %}
<!-- Show players added to the team only if there are players added -->
{% if current_players|length >= tournament.minimum_player_per_team %}
<div class="margin10">
</div>
<div class="semibold margin10">
{% 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 %}
</div>
<div>
{% if tournament.should_request_payment and cart_data.waiting_list_position < 0 %}
<button type="submit" name="proceed_to_payment" class="rounded-button">
Procéder au paiement ({{ tournament.team_fee }}€)
</button>
{% endif %}
{% if tournament.should_request_payment is False or tournament.online_payment_is_mandatory is False or cart_data.waiting_list_position >= 0 %}
<button type="submit" name="register_team" class="rounded-button">
{% if cart_data.waiting_list_position < 0 %}
Confirmer l'inscription
{% else %}
Se mettre en liste d'attente
{% endif %}
</button>
{% endif %}
</div>
{% endif %}
</form>
{% endif %}
</div>
</div>
</div>
</div>

@ -150,15 +150,10 @@
<div class="cell medium-12 large-6 padding10">
<h1 class="club padding10">{{ tournament.display_name }} {{ tournament.get_federal_age_category_display}}</h1>
<div class="bubble">
{% if tournament.event.name %}
<label class="semibold">{{ tournament.event.name }}</label>
{% endif %}
<div class="semibold">{{ tournament.local_start_date_formatted }}</div>
<div>{{ tournament.day_duration_formatted }}</div>
<div>{{ tournament.court_count }} terrains</div>
<p>
<div class="semibold">{{ tournament.local_start_date_formatted }}</div>
<div>{{ tournament.day_duration_formatted }}</div>
<div>{{ tournament.court_count }} terrains</div>
</p>
<hr/>

@ -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:

Loading…
Cancel
Save