Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bike logistics #65

Merged
merged 5 commits into from
Sep 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions apps/challenge/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@ def __init__(self, *args, **kwargs):
),
url='user-AllPersons-ac',
required=False)
bikes_phone = CHPhoneNumberField(label=_('N° de contact vélos'),
required=False)

def clean_day(self):
day = self.cleaned_data['day']
Expand All @@ -140,6 +142,7 @@ class Meta:
'superleader',
'apples',
'helpers_time', 'helpers_place',
'bikes_concept', 'bikes_phone',
'comments']


Expand Down
29 changes: 29 additions & 0 deletions apps/challenge/migrations/0045_auto_20170904_1750.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.11.4 on 2017-09-04 15:50
from __future__ import unicode_literals

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('challenge', '0044_season_state'),
]

operations = [
migrations.AlterModelOptions(
name='season',
options={'ordering': ['year', '-season', 'cantons'], 'verbose_name': 'Saison', 'verbose_name_plural': 'Saisons'},
),
migrations.AddField(
model_name='session',
name='bikes_concept',
field=models.CharField(blank=True, max_length=512, verbose_name='Logistique v\xe9los'),
),
migrations.AddField(
model_name='session',
name='bikes_phone',
field=models.CharField(blank=True, max_length=13, verbose_name='N\xb0 de contact v\xe9los'),
),
]
6 changes: 6 additions & 0 deletions apps/challenge/models/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ class Session(Address, models.Model):
helpers_place = models.CharField(_("Lieu rendez-vous moniteurs"),
max_length=512, blank=True)
apples = models.CharField(_("Pommes"), max_length=512, blank=True)
bikes_concept = models.CharField(_('Logistique vélos'),
max_length=512, blank=True)
bikes_phone = models.CharField(_('N° de contact vélos'),
max_length=13, blank=True)
comments = models.TextField(_('Remarques'), blank=True)

class Meta:
Expand All @@ -91,6 +95,8 @@ def errors(self):
errors.append(_('Mauvais temps'))
if not self.apples:
errors.append(_('Pommes'))
if not self.bikes_concept and not self.bikes_phone:
errors.append(_('Logistique vélos'))
if not self.address_city:
errors.append(_('Emplacement'))
# Check the qualifications
Expand Down
27 changes: 21 additions & 6 deletions apps/challenge/templates/challenge/session_detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ <h1>
<a class="btn btn-primary pull-right" href="{% url 'session-update' seasonpk=season.pk pk=session.pk %}">{% trans "Éditer" %}</a>
</div>
{% endif %}
<table class="table">
<table class="table table-condensed">
<tr><th>{% trans "Établissement" %}</th>
<td><a href="{% url 'organization-detail' session.orga.pk %}">{{ session.orga }}</a>
{% if session.orga.coordinator_fullname %}
Expand Down Expand Up @@ -77,8 +77,23 @@ <h1>
</td>
</tr>
{% endif %}
{% if session.apples %}
<tr><th>{% trans "Pommes" %}</th><td>{{ session.apples }}</td></tr>
{% if session.apples or session.bikes_concept or session.bikes_phone %}
<tr><th>{% trans "Logistique" %}</th>
<td><dl class="dl-horizontal small">
{% if session.apples %}
<dt>{% trans "Pommes" %}</dt>
<dd>{{ session.apples }}</dd>
{% endif %}
{% if session.bikes_concept or session.bikes_phone %}
<dt>{% trans "Livraison de vélos" %}</dt>
<dd>
{{ session.bikes_concept }}{% if session.bikes_concept and session.bikes_phone %}<br />{% endif %}
{{ session.bikes_phone|tel_link }}
</dd>
{% endif %}
</dl>
</td>
</tr>
{% endif %}
<tr><th><span class="visible-print-inline">{% trans "Rendez-vous moniteurs" %}</span>
<a class="hidden-print" href="{% url 'session-staff-choices' season.pk session.pk %}" title="{% trans "Disponibilités" %}">{% trans "Moniteurs" %}</a></th>
Expand All @@ -88,7 +103,7 @@ <h1>
</tr>

{% if session.errors %}
<tr><th>{% trans "Erreurs" %}</th><td>{{ session.errors }}</td></tr>
<tr class="hidden-print"><th>{% trans "Erreurs" %}</th><td>{{ session.errors }}</td></tr>
{% endif %}
{% if session.comments %}
<tr><th>{% trans "Remarques" %}</th><td>{{ session.comments }}</td></tr>
Expand All @@ -104,9 +119,9 @@ <h2 class="hidden-print">{% trans "Qualifs" %}</h2>
{% for quali in session.qualifications.all %}
<th>{% if not quali.errors %}{% include "ok.html" %}{% endif%}
{{ forloop.counter }} - {% if season.manager_can_crud %}<a href="{% url 'quali-update' seasonpk=season.pk sessionpk=session.pk pk=quali.pk %}">{{ quali.name }}</a>{% else %}{{ quali.name }}{% endif %}
{% if quali.errors %}
{% if quali.errors %}<span class="hidden-print">
<br />
{{ quali.errors }}
{{ quali.errors }}</span>
{% endif %}
</th>
{% endfor %}
Expand Down
2 changes: 2 additions & 0 deletions apps/challenge/templates/challenge/session_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ <h3>{% trans "Emplacement" %}</h3>
<h3>{% trans "Logistique" %}</h3>
{% bootstrap_field form.superleader layout='horizontal' size='small' %}
{% bootstrap_field form.fallback_plan layout='horizontal' size='small' %}
{% bootstrap_field form.bikes_concept layout='horizontal' size='small' %}
{% bootstrap_field form.bikes_phone layout='horizontal' size='small' %}
{% bootstrap_field form.apples layout='horizontal' size='small' %}
{% bootstrap_field form.helpers_time layout='horizontal' size='small' %}
{% bootstrap_field form.helpers_place layout='horizontal' size='small' %}
Expand Down
6 changes: 5 additions & 1 deletion apps/challenge/views/season.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,8 @@ def get_dataset(self):
# Logistique
u('Moniteur + / Photographe'),
u('Mauvais temps'),
u('Logistique vélos'),
u('N° de contact vélos'),
u('Pommes'),
u('Total vélos'),
u('Total casques'),
Expand Down Expand Up @@ -326,6 +328,8 @@ def get_dataset(self):
tel=session.superleader.profile.natel
) if session.superleader else '',
str(session.fallback),
session.bikes_concept,
session.bikes_phone,
session.apples,
session.n_bikes,
session.n_helmets,
Expand All @@ -334,7 +338,7 @@ def get_dataset(self):
if session.n_qualifications:
for quali in session.qualifications.all():
if not len(col):
col = [''] * 12
col = [''] * 14
col.append(quali.name)
col.append(
EXPORT_NAMETEL.format(
Expand Down
4 changes: 4 additions & 0 deletions apps/challenge/views/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,8 @@ def get_dataset(self):
# Logistique
u('Moniteur + / Photographe'),
u('Mauvais temps'),
u('Logistique vélos'),
u('N° de contact vélos'),
u('Pommes'),
u('Total vélos'),
u('Total casques'),
Expand Down Expand Up @@ -234,6 +236,8 @@ def get_dataset(self):
tel=session.superleader.profile.natel
) if session.superleader else '',
str(session.fallback),
session.bikes_concept,
session.bikes_phone,
session.apples,
session.n_bikes,
session.n_helmets,
Expand Down
2 changes: 1 addition & 1 deletion apps/orga/templates/orga/organization_filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ <h4 class="modal-title">{% trans "Filtrer la liste des établissements" %}</h4>
<td>{{ orga.address_canton }}</td>
<td>{{ orga.coordinator_fullname }}</td>
<td>{% if orga.coordinator_natel %}
<a class="tel" href="tel:{{ orga.coordinator_natel|tel_int }}">{{ orga.coordinator_natel }}</a>
{{ orga.coordinator_natel|tel_link }}
{% endif %}</td>
<td>{% if orga.coordinator_email %}
<a class="email" href="mailto:{{ orga.mailtolink|urlencode }}">{{ orga.coordinator_email }}</a>
Expand Down
1 change: 1 addition & 0 deletions apps/orga/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def filter_wide(queryset, name, value):
if value:
allfields_filter = [
Q(name__icontains=value),
Q(abbr__icontains=value),
Q(address_street__icontains=value),
Q(address_zip__contains=value),
Q(address_city__icontains=value),
Expand Down
4 changes: 4 additions & 0 deletions defivelo/static/style/partials/_challenge.scss
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@
display: inline-block;
}
}

table.table-condensed dl {
margin-bottom: 0;
}