From 2c38ef7809e1e46e9f35aadfd92796edf4497cf8 Mon Sep 17 00:00:00 2001 From: Raz Date: Tue, 15 Apr 2025 08:58:35 +0200 Subject: [PATCH] add confirm call button --- .../tournaments/tournament_info.html | 40 +++++++++++++++---- tournaments/urls.py | 1 + tournaments/views.py | 15 +++++++ 3 files changed, 49 insertions(+), 7 deletions(-) diff --git a/tournaments/templates/tournaments/tournament_info.html b/tournaments/templates/tournaments/tournament_info.html index 4678658..4df2031 100644 --- a/tournaments/templates/tournaments/tournament_info.html +++ b/tournaments/templates/tournaments/tournament_info.html @@ -17,7 +17,6 @@
{% if tournament.enable_online_registration and team %}

Votre équipe

-
{% if team.needs_confirmation %}
@@ -72,7 +71,7 @@ {% endif %}
-
+
{% for player in team.players_sorted_by_rank %}
{{ player.name }}
{% endfor %} @@ -81,11 +80,38 @@

Inscrits le {{ team.local_registration_date }}

+ + {% if team.call_date %} +
+

Convocation

+
+ Vous avez été convoqué(e)s le {{ team.local_call_date|date:"d/m/Y à H:i" }} +
+ + {% if team.confirmation_date %} +
+ Convocation confirmée le {{ team.confirmation_date|date:"d/m/Y à H:i" }} +
+ {% else %} +
+ Merci de confirmer la réception de votre convocation. +
+
+ {% csrf_token %} + +
+ {% endif %} +
+ {% endif %} + {% if tournament.should_request_payment and team.is_in_waiting_list < 0 %} -
+
+

Paiement

{% if team.is_paid %} -
+
Paiement confirmé
{% else %} @@ -113,12 +139,12 @@ {% endif %} {% if tournament.is_unregistration_possible %} -
+
{% if tournament.is_refund_possible and team.is_paid %} -

+

Si vous vous désinscrivez, votre inscription sera remboursée automatiquement sur votre carte bancaire. {% if tournament.refund_date_limit %} -
Remboursement possible jusqu'au {{ tournament.refund_date_limit|date:"d/m/Y à H:i" }} +

Remboursement possible jusqu'au {{ tournament.refund_date_limit|date:"d/m/Y à H:i" }}
{% endif %}

{% endif %} diff --git a/tournaments/urls.py b/tournaments/urls.py index f712e37..ad16615 100644 --- a/tournaments/urls.py +++ b/tournaments/urls.py @@ -15,6 +15,7 @@ urlpatterns = [ path("c/", views.club_broadcast, name="club-broadcast"), path("c//go", views.club_broadcast_auto, name="club-broadcast-auto"), path('tournaments/webhook/stripe/', payment_service.PaymentService.stripe_webhook, name='stripe_webhook'), + path('tournament//confirm-call/', views.confirm_call, name='confirm_call'), path('tournaments//payment/success/', views.tournament_payment_success, name='tournament-payment-success'), path('tournaments//proceed-to-payment/', views.proceed_to_payment, name='proceed_to_payment'), path("tournament//", diff --git a/tournaments/views.py b/tournaments/views.py index 36018b9..589ec05 100644 --- a/tournaments/views.py +++ b/tournaments/views.py @@ -1475,6 +1475,21 @@ def cancel_registration(request, tournament_id): messages.info(request, "Processus d'inscription annulé.") return redirect('tournament-info', tournament_id=tournament_id) +@login_required +def confirm_call(request, tournament_id): + if request.method == 'POST': + tournament = get_object_or_404(Tournament, pk=tournament_id) + team = tournament.get_user_team_registration(request.user) + + if team and team.call_date: + team.confirmation_date = timezone.now() + team.save() + # messages.success(request, 'Réception de la convocation confirmée.') + else: + messages.error(request, 'Une erreur est survenue.') + + return redirect('tournament-info', tournament_id=tournament_id) + class UserListExportView(LoginRequiredMixin, View): def get(self, request, *args, **kwargs): users = CustomUser.objects.order_by('date_joined')