Laurent 7 months ago
commit ee19f9c410
  1. BIN
      shop/static/shop/images/products/PC001/blanc/hat-logo.png
  2. BIN
      shop/static/shop/images/products/PC001/bleu-sport/hat-logo.png
  3. BIN
      shop/static/shop/images/products/PC004/blanc-bleu-sport/shirt_logo.png
  4. BIN
      shop/static/shop/images/products/PC005/blanc-bleu-sport/skirt_logo.png
  5. BIN
      shop/static/shop/images/products/PC006/bleu-sport-blanc/shirt-logo.png
  6. BIN
      shop/static/shop/images/products/PC007/blanc-bleu-sport/short_logo.png
  7. 6
      shop/templates/shop/product_list.html
  8. 24
      tournaments/models/player_registration.py
  9. 17
      tournaments/static/tournaments/css/style.css
  10. 53
      tournaments/templates/registration/my_tournaments.html
  11. 8
      tournaments/templates/tournaments/tournament_row.html
  12. 1
      tournaments/urls.py
  13. 34
      tournaments/views.py

Binary file not shown.

After

Width:  |  Height:  |  Size: 855 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1016 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 266 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 424 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 401 KiB

@ -18,6 +18,12 @@
{% endif %} {% endif %}
</nav> </nav>
<div class="info-box" style="border-left: 4px solid #f39200; padding: 12px; margin: 20px 12px;">
<h3 style="color: #505050; margin-top: 0;">Bienvenue sur la boutique Padel Club des copains !</h3>
<p style="margin-top: 10px; margin-bottom: 0;"><strong>Photos :</strong> Les photos des vêtements n'ont pas encore le logo, la description indique où il situera.
<p style="margin-top: 10px; margin-bottom: 0;"><strong>Livraison :</strong> Commandez en ligne et récupérez votre commande en main propre lors de votre prochaine session de padel au club !</p>
</div>
<nav class="margin10"> <nav class="margin10">
<a class="confirm-nav-button" href="{% url 'shop:view_cart' %}">Voir mon panier ({{ total }} €)</a> <a class="confirm-nav-button" href="{% url 'shop:view_cart' %}">Voir mon panier ({{ total }} €)</a>
{% if cart_items %} {% if cart_items %}

@ -104,20 +104,36 @@ class PlayerRegistration(SideStoreModel):
if not self.team_registration: if not self.team_registration:
return None return None
tournament = self.team_registration.tournament
tournament_status_team_count = tournament.get_tournament_status_team_count()
status = { status = {
'header': "Équipes",
'position': tournament_status_team_count,
'display_box': True, 'display_box': True,
'box_class': 'gray', 'box_class': 'gray',
'short_label': 'inscrit' 'short_label': 'inscrit'
} }
tournament = self.team_registration.tournament
team = self.team_registration team = self.team_registration
# Tournament is ended with results # Tournament is ended with results
if tournament.get_online_registration_status() is OnlineRegistrationStatus.ENDED_WITH_RESULTS: if tournament.get_online_registration_status() is OnlineRegistrationStatus.ENDED_WITH_RESULTS:
if team.get_final_ranking_component(): if team.final_ranking:
status['box_class'] = 'light-green' status['header'] = 'Rang'
status['short_label'] = team.get_final_ranking_component() status['position'] = f"{team.final_ranking} / {tournament_status_team_count}"
if tournament.display_points_earned and team.points_earned:
if team.final_ranking == 1:
status['box_class'] = 'light-gold'
elif team.final_ranking == 2:
status['box_class'] = 'light-silver'
elif team.final_ranking == 3:
status['box_class'] = 'light-bronze'
else:
status['box_class'] = 'light-beige'
status['short_label'] = f"{team.points_earned} pts"
else:
status['display_box'] = False
return status return status
# Team has walked out # Team has walked out

@ -691,6 +691,23 @@ h-margin {
color: white !important; color: white !important;
} }
.light-gold {
background-color: gold !important;
}
.light-silver {
background-color: silver !important;
}
.light-bronze {
background-color: #cd7f32 !important;
color: white !important;
}
.light-beige {
background-color: #fae7ce !important;
}
.table-row-element { .table-row-element {
width: 100%; width: 100%;
line-height: 1.2; line-height: 1.2;

@ -13,25 +13,35 @@
<div class="grid-x"> <div class="grid-x">
<div class="cell medium-10 large-5 topblock padding10"> <div class="cell medium-10 large-5 topblock padding10">
<div> <div>
<label class="title">Vos tournois en cours</label> <div class="table-row-5-colums-tournament header">
<label class="title">Vos tournois en cours</label>
</div>
{% if running_tournaments %} {% if running_tournaments %}
{% for tournament in running_tournaments %} {% for tournament in running_tournaments %}
{% include 'tournaments/tournament_row.html' %} {% include 'tournaments/tournament_row.html' %}
{% endfor %} {% endfor %}
{% else %} {% else %}
Aucun tournoi en cours <div>
Aucun tournoi en cours
</div>
{% endif %} {% endif %}
</div> </div>
<div> <div>
<label class="title">Vos tournois à venir</label> <div class="table-row-5-colums-tournament header">
<label class="title">Vos tournois à venir</label>
</div>
{% if upcoming_tournaments %} {% if upcoming_tournaments %}
{% for tournament in upcoming_tournaments %} {% for tournament in upcoming_tournaments %}
{% include 'tournaments/tournament_row.html' %} {% include 'tournaments/tournament_row.html' %}
{% endfor %} {% endfor %}
{% else %} {% else %}
Aucun tournoi à venir <div>
Aucun tournoi à venir
</div>
{% endif %} {% endif %}
</div> </div>
@ -39,13 +49,26 @@
<div class="cell large-offset-1 medium-10 large-5 topblock padding10"> <div class="cell large-offset-1 medium-10 large-5 topblock padding10">
<div> <div>
<label class="title">Vos tournois terminés</label>
<div class="table-row-5-colums-tournament header">
<label class="title">Vos tournois terminés</label>
</div>
{% if ended_tournaments %} {% if ended_tournaments %}
{% for tournament in ended_tournaments %} {% for tournament in ended_tournaments %}
{% include 'tournaments/tournament_row.html' %} {% include 'tournaments/tournament_row.html' %}
{% endfor %} {% endfor %}
<div class="table-row-5-colums-tournament footer">
{% if ended_tournaments|length >= 12 %}
<div class="small">
<a href="{% url 'all-my-ended-tournaments' %}">voir tous vos tournois terminés</a>
</div>
{% endif %}
</div>
{% else %} {% else %}
Aucun tournoi terminé <div>
Aucun tournoi terminé
</div>
{% endif %} {% endif %}
</div> </div>
</div> </div>

@ -21,17 +21,19 @@
<div class="small">{{ tournament.localized_day_duration }}</div> <div class="small">{{ tournament.localized_day_duration }}</div>
</div> </div>
<div class="table-row-element tournament-status center"> <div class="table-row-element tournament-status center">
<div class="small">Équipes</div>
<div class="very-large">{{ tournament.get_tournament_status_team_count }}</div>
{% if user.is_authenticated %} {% if user.is_authenticated %}
{% with user_registration_status=tournament|get_player_status:user %} {% with user_registration_status=tournament|get_player_status:user %}
{% if user_registration_status %} {% if user_registration_status %}
<div class="small">{{ user_registration_status.header }}</div>
<div class="very-large">{{ user_registration_status.position }}</div>
{% if user_registration_status.display_box %} {% if user_registration_status.display_box %}
<div class="box small {{ user_registration_status.box_class }}"> <div class="box small {{ user_registration_status.box_class }}">
{{ user_registration_status.short_label }} {{ user_registration_status.short_label }}
</div> </div>
{% endif %} {% endif %}
{% else %} {% else %}
<div class="small">Équipes</div>
<div class="very-large">{{ tournament.get_tournament_status_team_count }}</div>
{% if status.display_box %} {% if status.display_box %}
<div class="box small {{ status.box_class }}"> <div class="box small {{ status.box_class }}">
{{ status.short_label }} {{ status.short_label }}
@ -40,6 +42,8 @@
{% endif %} {% endif %}
{% endwith %} {% endwith %}
{% else %} {% else %}
<div class="small">Équipes</div>
<div class="very-large">{{ tournament.get_tournament_status_team_count }}</div>
{% if status.display_box %} {% if status.display_box %}
<div class="box small {{ status.box_class }}"> <div class="box small {{ status.box_class }}">
{{ status.short_label }} {{ status.short_label }}

@ -60,6 +60,7 @@ urlpatterns = [
path('signup/', views.signup, name='signup'), # URL pattern for signup path('signup/', views.signup, name='signup'), # URL pattern for signup
# path('profile/', views.profile, name='profile'), # URL pattern for signup # path('profile/', views.profile, name='profile'), # URL pattern for signup
path('my-tournaments/', views.my_tournaments, name='my-tournaments'), # URL pattern for signup path('my-tournaments/', views.my_tournaments, name='my-tournaments'), # URL pattern for signup
path('all_my_ended_tournaments/', views.all_my_ended_tournaments, name='all-my-ended-tournaments'), # URL pattern for signup
path('tournaments/<str:tournament_id>/register/', views.register_tournament, name='register_tournament'), path('tournaments/<str:tournament_id>/register/', views.register_tournament, name='register_tournament'),
path('tournaments/<str:tournament_id>/unregister/', views.unregister_tournament, name='unregister_tournament'), path('tournaments/<str:tournament_id>/unregister/', views.unregister_tournament, name='unregister_tournament'),
path('password_reset/', auth_views.PasswordResetView.as_view(), name='password_reset'), path('password_reset/', auth_views.PasswordResetView.as_view(), name='password_reset'),

@ -898,15 +898,45 @@ def my_tournaments(request):
# Get filtered tournaments using the helper function # Get filtered tournaments using the helper function
upcoming_tournaments = filter_user_tournaments(future_tournaments(None)) upcoming_tournaments = filter_user_tournaments(future_tournaments(None))
running_tournaments = filter_user_tournaments(live_tournaments(None)) running_tournaments = filter_user_tournaments(live_tournaments(None))
ended_tournaments = filter_user_tournaments(finished_tournaments(None)) ended_tournaments = filter_user_tournaments([t for t in finished_tournaments(None) if not t.is_canceled()])
return render(request, 'registration/my_tournaments.html', { return render(request, 'registration/my_tournaments.html', {
'upcoming_tournaments': upcoming_tournaments, 'upcoming_tournaments': upcoming_tournaments,
'running_tournaments': running_tournaments, 'running_tournaments': running_tournaments,
'ended_tournaments': ended_tournaments, 'ended_tournaments': ended_tournaments[:12],
'user_name': user.username 'user_name': user.username
}) })
@login_required
def all_my_ended_tournaments(request):
user_licence_id = request.user.licence_id
# If no licence_id, return empty lists
if user_licence_id is None:
return render(request, '/tournaments.html', {
'tournaments': [],
'title': "Palmarès",
})
# Get all tournaments for the user based on their licence
validator = LicenseValidator(user_licence_id)
stripped_license = validator.stripped_license
def filter_user_tournaments(tournaments):
return [t for t in tournaments if t.team_registrations.filter(
player_registrations__licence_id__icontains=stripped_license,
walk_out=False
).exists()]
ended_tournaments = filter_user_tournaments(finished_tournaments(None))
return render(request,
"tournaments/tournaments_list.html",
{
'tournaments': ended_tournaments,
'title': "Palmarès",
})
from django.contrib.auth.mixins import LoginRequiredMixin from django.contrib.auth.mixins import LoginRequiredMixin
class ProfileUpdateView(LoginRequiredMixin, UpdateView): class ProfileUpdateView(LoginRequiredMixin, UpdateView):

Loading…
Cancel
Save