X-Git-Url: https://git.rapsys.eu/airbundle/blobdiff_plain/e8293888190417411cdcd0fc071db891ba76676c..cf75f3aba45829a2bf7a0e469f3de9335d481d89:/Resources/views/session/view.html.twig?ds=inline

diff --git a/Resources/views/session/view.html.twig b/Resources/views/session/view.html.twig
index 52139cf..02df6db 100644
--- a/Resources/views/session/view.html.twig
+++ b/Resources/views/session/view.html.twig
@@ -1,162 +1,210 @@
 {% extends '@RapsysAir/body.html.twig' %}
 {% block content %}
-<section id="dashboard">
-	<h2>
-		<a href="{{ path('rapsys_air_session_view', {'id': session.id}) }}">{{ session.title }}</a>
-		<a href="{{ path('rapsys_air_location_view', {'id': session.location.id}) }}">{{ session.location.at }}</a>
-	</h2>
-	<div class="panel calendar">
-		<div class="grid">
-			<section class="cell">
-				<h3>{% trans %}Organizer{% endtrans %}</h3>
-				<dl>
-					<dt>{% trans %}Attributed to{% endtrans %}</dt>
-					<dd>
-						{% if session.application is null %}
-							{% trans %}None{% endtrans %}
-						{% else %}
-							<a href="{{ path('rapsys_air_user_view', {'id': session.application.user.id}) }}">{{ session.application.user.title }}</a>
-						{% endif %}
-					</dd>
-				</dl>
-				<dl>
-					<dt>TODO: text organisateur</dt>
-					<dd>TODO: text organisateur</dd>
-				</dl>
-			</section>
-			<section class="cell">
-				<h3>{% trans %}Schedule{% endtrans %}</h3>
-				<dl>
-					<dt>{% trans %}Slot{% endtrans %}</dt>
-					<dd>{{ session.slot.title }}</dd>
-				</dl>
-				<dl>
-					<dt>{% trans %}Start{% endtrans %}</dt>
-					<dd>{{ session.start.format('Y-m-d H:i:s') }}</dd>
-				</dl>
-				<dl>
-					<dt>{% trans %}Stop{% endtrans %}</dt>
-					<dd>
-						{% if session.start.format('Y-m-d') != session.stop.format('Y-m-d') %}
-							{{ session.stop.format('Y-m-d H:i:s') }}
-						{% else %}
-							{{ session.stop.format('H:i:s') }}
-						{% endif %}
-					</dd>
-				</dl>
-				<dl>
-					<dt>{% trans %}Length{% endtrans %}</dt>
-					<dd>{{ session.length.format('H:i:s') }}</dd>
-				</dl>
-				<dl>
-					<dt>{% trans %}Locked{% endtrans %}</dt>
-					<dd>
-						{% if session.locked is null %}
-							{% trans %}None{% endtrans %}
+	<article id="dashboard"{% if session.application.canceled is defined and session.application.canceled %} class="canceled"{% endif %}>
+		<header>
+			<h2>
+				<a href="{{ path('rapsys_air_session_view', {'id': session.id}) }}">{{ session.title }}</a>
+				{% if session.application.id is defined and session.application.id %}
+					<a href="{{ path('rapsys_air_user_view', {'id': session.application.user.id}) }}">{{ session.application.user.by }}</a>
+				{% endif %}
+				<a href="{{ path('rapsys_air_location_view', {'id': session.location.id}) }}">{{ session.location.at }}</a>
+			</h2>
+			<p>{{ description }}</p>
+		</header>
+		<div class="panel">
+			<div class="grid four">
+				<section class="cell">
+					<h3>{% trans %}Organizer{% endtrans %}</h3>
+					<dl>
+						<dt>{% trans %}Attributed to{% endtrans %}</dt>
+						<dd>
+							{% if session.application is null %}
+								{% trans %}None{% endtrans %}
+							{% else %}
+								<a href="{{ path('rapsys_air_user_view', {'id': session.application.user.id}) }}">{{ session.application.user.title }}</a>
+							{% endif %}
+						</dd>
+					</dl>
+					{% if session.snippet.description is defined and session.snippet.description %}
+						<dl>
+							<dt>{% trans %}Description{% endtrans %}</dt>
+							<dd>{{ session.snippet.description|striptags|markdown_to_html }}</dd>
+						</dl>
+					{% endif %}
+					{% if session.snippet.class is defined and session.snippet.class %}
+						<dl>
+							<dt>{% trans %}Class{% endtrans %}</dt>
+							<dd>{{ session.snippet.class|striptags|markdown_to_html }}</dd>
+						</dl>
+					{% endif %}
+					{% if session.snippet.contact is defined and session.snippet.contact %}
+						<dl>
+							<dt>{% trans %}Contact{% endtrans %}</dt>
+							<dd><a href="{{ session.snippet.contact }}">{{ 'Send a message to %pseudonym%'|trans({'%pseudonym%': session.application.user.title}) }}</a></dd>
+						</dl>
+					{% endif %}
+					{% if session.snippet.donate is defined and session.snippet.donate %}
+						<dl>
+							<dt>{% trans %}Donate{% endtrans %}</dt>
+							<dd><a href="{{ session.snippet.donate }}">{{ 'Donate to %pseudonym%'|trans({'%pseudonym%': session.application.user.title}) }}</a></dd>
+						</dl>
+					{% endif %}
+					{% if session.snippet.link is defined and session.snippet.link %}
+						<dl>
+							<dt>{% trans %}Link{% endtrans %}</dt>
+							<dd><a href="{{ session.snippet.link }}">{{ 'Link to %pseudonym%'|trans({'%pseudonym%': session.application.user.title}) }}</a></dd>
+						</dl>
+					{% endif %}
+					{% if session.snippet.profile is defined and session.snippet.profile %}
+						<dl>
+							<dt>{% trans %}Social network{% endtrans %}</dt>
+							<dd><a href="{{ session.snippet.profile }}">{{ 'Consult %pseudonym% profile'|trans({'%pseudonym%': session.application.user.title}) }}</a></dd>
+						</dl>
+					{% endif %}
+					{% if session.snippet.rate is defined and session.snippet.rate %}
+						{% if session.snippet.hat is defined and session.snippet.hat %}
+							<dl>
+								<dt>{% trans %}Contribution{% endtrans %}</dt>
+								<dd>{% if session.snippet.rate == 0 %}{% trans %}To the hat, to cover the costs: talc, electricity, bicycle, server{% endtrans %}{% else %}{{ 'To the hat, ideally %rate% €, to cover the costs: talc, electricity, bicycle, server'|trans({'%rate%': session.snippet.rate}) }}{% endif %}</dd>
+							</dl>
 						{% else %}
-							{{ session.locked.format('Y-m-d H:i:s') }}
+							<dl>
+								<dt>{% trans %}Rate{% endtrans %}</dt>
+								<dd>{% if session.snippet.rate == 0 %}{% trans %}Free{% endtrans %}{% else %}{{ session.snippet.rate }} €{% endif %}</dd>
+							</dl>
 						{% endif %}
-					</dd>
-				</dl>
-				<dl>
-					<dt>{% trans %}Created{% endtrans %}</dt>
-					<dd>{{ session.created.format('Y-m-d H:i:s') }}</dd>
-				</dl>
-				<dl>
-					<dt>{% trans %}Updated{% endtrans %}</dt>
-					<dd>{{ session.updated.format('Y-m-d H:i:s') }}</dd>
-				</dl>
-			</section>
-			<section class="cell">
-				<h3>{% trans %}Weather{% endtrans %}</h3>
-				{% if session.rainrisk is not null %}
+					{% endif %}
+				</section>
+				<section class="cell">
+					<h3>{% trans %}Schedule{% endtrans %}</h3>
 					<dl>
-						<dt>{% trans %}Rainrisk{% endtrans %}</dt>
-						<dd>{{ session.rainrisk }}</dd>
+						<dt>{% trans %}Date{% endtrans %}</dt>
+						<dd>{{ session.start|localizeddate('long', 'none') }}</dd>
 					</dl>
-				{% endif %}
-				{% if session.rainfall is not null %}
 					<dl>
-						<dt>{% trans %}Rainfall{% endtrans %}</dt>
-						<dd>{{ session.rainfall }}</dd>
+						<dt>{% trans %}Start{% endtrans %}</dt>
+						<dd>{{ session.start|localizeddate('none', 'medium') }}</dd>
 					</dl>
-				{% endif %}
-				{% if session.realfeel is not null %}
 					<dl>
-						<dt>{% trans %}Realfeel{% endtrans %}</dt>
-						<dd>{{ session.realfeel }}</dd>
+						<dt>{% trans %}Stop{% endtrans %}</dt>
+						<dd>{{ session.stop|localizeddate('none', 'medium') }}</dd>
 					</dl>
-				{% endif %}
-				{% if session.realfeelmin is not null %}
 					<dl>
-						<dt>{% trans %}Realfeel min{% endtrans %}</dt>
-						<dd>{{ session.realfeelmin }}</dd>
+						<dt>{% trans %}Length{% endtrans %}</dt>
+						<dd>{{ session.length|localizeddate('none', 'short', null, null, 'HH:mm') }}</dd>
 					</dl>
-				{% endif %}
-				{% if session.realfeelmax is not null %}
 					<dl>
-						<dt>{% trans %}Realfeel max{% endtrans %}</dt>
-						<dd>{{ session.realfeelmax }}</dd>
+						<dt>{% trans %}Slot{% endtrans %}</dt>
+						<dd>{{ session.slot.title }}</dd>
 					</dl>
-				{% endif %}
-				{% if session.temperature is not null %}
 					<dl>
-						<dt>{% trans %}Temperature{% endtrans %}</dt>
-						<dd>{{ session.temperature }}</dd>
+						<dt>{% trans %}Locked{% endtrans %}</dt>
+						<dd>
+							{% if session.locked is null %}
+								{% trans %}None{% endtrans %}
+							{% else %}
+								{{ session.locked|localizeddate('long', 'medium') }}
+							{% endif %}
+						</dd>
 					</dl>
-				{% endif %}
-				{% if session.temperaturemin is not null %}
 					<dl>
-						<dt>{% trans %}Temperature min{% endtrans %}</dt>
-						<dd>{{ session.temperaturemin }}</dd>
+						<dt>{% trans %}Created{% endtrans %}</dt>
+						<dd>{{ session.created|localizeddate('long', 'medium') }}</dd>
 					</dl>
-				{% endif %}
-				{% if session.temperaturemax is not null %}
 					<dl>
-						<dt>{% trans %}Temperature max{% endtrans %}</dt>
-						<dd>{{ session.temperaturemax }}</dd>
+						<dt>{% trans %}Updated{% endtrans %}</dt>
+						<dd>{{ session.updated|localizeddate('long', 'medium') }}</dd>
 					</dl>
-				{% endif %}
-			</section>
-			<section class="cell">
-				<h3>{% trans %}Location{% endtrans %}</h3>
-				<dl>
-					{# infos #}
-					<dt>{% trans %}Location{% endtrans %}</dt>
-					<dd><a href="{{ path('rapsys_air_location_view', {'id': session.location.id}) }}">{{ session.location.title }}</a></dd>
-				</dl>
-				<dl>
-					{# location #}
-					<dt>{% trans %}Address{% endtrans %}</dt>
-					<dd>
-						{{ session.location.address }}
-						{{ session.location.zipcode }} {{ session.location.city }}
-					</dd>
-				</dl>
-				<dl>
-					<dt>{% trans %}Maps{% endtrans %}</dt>
-					<dd><a href="https://www.google.fr/maps/@{{ session.location.latitude }},{{ session.location.longitude }},19z">Google Maps</a></dd>
-					<dd><a href="https://www.openstreetmap.org/#map=19/{{ session.location.latitude }}/{{ session.location.longitude }}">OpenStreetMap</a></dd>
-				</dl>
-				<dl>
-					<dt>{% trans %}Minimap{% endtrans %}</dt>
-					<dd>TODO: minimap</dd>
-				</dl>
-			</section>
+				</section>
+				<section class="cell">
+					<h3>{% trans %}Weather{% endtrans %}</h3>
+					{% if session.rainrisk is not null %}
+						<dl>
+							<dt>{% trans %}Rainrisk{% endtrans %}</dt>
+							<dd>{{ session.rainrisk }}</dd>
+						</dl>
+					{% endif %}
+					{% if session.rainfall is not null %}
+						<dl>
+							<dt>{% trans %}Rainfall{% endtrans %}</dt>
+							<dd>{{ session.rainfall }}</dd>
+						</dl>
+					{% endif %}
+					{% if session.realfeel is not null %}
+						<dl>
+							<dt>{% trans %}Realfeel{% endtrans %}</dt>
+							<dd>{{ session.realfeel }}</dd>
+						</dl>
+					{% endif %}
+					{% if session.realfeelmin is not null %}
+						<dl>
+							<dt>{% trans %}Realfeel min{% endtrans %}</dt>
+							<dd>{{ session.realfeelmin }}</dd>
+						</dl>
+					{% endif %}
+					{% if session.realfeelmax is not null %}
+						<dl>
+							<dt>{% trans %}Realfeel max{% endtrans %}</dt>
+							<dd>{{ session.realfeelmax }}</dd>
+						</dl>
+					{% endif %}
+					{% if session.temperature is not null %}
+						<dl>
+							<dt>{% trans %}Temperature{% endtrans %}</dt>
+							<dd>{{ session.temperature }}</dd>
+						</dl>
+					{% endif %}
+					{% if session.temperaturemin is not null %}
+						<dl>
+							<dt>{% trans %}Temperature min{% endtrans %}</dt>
+							<dd>{{ session.temperaturemin }}</dd>
+						</dl>
+					{% endif %}
+					{% if session.temperaturemax is not null %}
+						<dl>
+							<dt>{% trans %}Temperature max{% endtrans %}</dt>
+							<dd>{{ session.temperaturemax }}</dd>
+						</dl>
+					{% endif %}
+				</section>
+				<section class="cell">
+					<h3>{% trans %}Location{% endtrans %}</h3>
+					<dl>
+						{# infos #}
+						<dt>{% trans %}Location{% endtrans %}</dt>
+						<dd><a href="{{ path('rapsys_air_location_view', {'id': session.location.id}) }}">{{ session.location.title }}</a></dd>
+					</dl>
+					<dl>
+						{# location #}
+						<dt>{% trans %}Address{% endtrans %}</dt>
+						<dd>
+							{{ session.location.address }}
+							{{ session.location.zipcode }} {{ session.location.city }}
+						</dd>
+					</dl>
+					<dl>
+						<dt>{% trans %}Maps{% endtrans %}</dt>
+						<dd><a href="https://www.google.fr/maps/@{{ session.location.latitude }},{{ session.location.longitude }},19z">Google Maps</a></dd>
+						<dd><a href="https://www.openstreetmap.org/#map=19/{{ session.location.latitude }}/{{ session.location.longitude }}">OpenStreetMap</a></dd>
+					</dl>
+					<dl>
+						<dt>{% trans %}Minimap{% endtrans %}</dt>
+						<dd>TODO: minimap</dd>
+					</dl>
+				</section>
+			</div>
+			{{ include('@RapsysAir/form/_toolbox.html.twig') }}
 		</div>
-		{{ include('@RapsysAir/form/_toolbox.html.twig') }}
-	</div>
-	<div class="panel candidate">
-		<section>
+		<article>
 			<h3>{% trans %}Candidates{% endtrans %}</h3>
-			<div class="grid">
+			<div class="panel grid four">
 				{% if session.applications is null %}
 					<section class="cell">
 						{% trans %}None{% endtrans %}
 					</section>
 				{% else %}
 					{% for application in session.applications %}
-						<section class="cell">
+						<article class="cell">
 							<h4><a href="{{ path('rapsys_air_user_view', {'id': application.user.id} ) }}">{{ application.user.title }}</a></h4>
 							<dl>
 								<dt>{% trans %}Score{% endtrans %}</dt>
@@ -169,11 +217,11 @@
 							</dl>
 							<dl>
 								<dt>{% trans %}Created{% endtrans %}</dt>
-								<dd>{{ application.created.format('Y-m-d H:i:s') }}</dd>
+								<dd>{{ application.created|localizeddate('long', 'medium') }}</dd>
 							</dl>
 							<dl>
 								<dt>{% trans %}Updated{% endtrans %}</dt>
-								<dd>{{ application.updated.format('Y-m-d H:i:s') }}</dd>
+								<dd>{{ application.updated|localizeddate('long', 'medium') }}</dd>
 							</dl>
 							<dl>
 								<dt>{% trans %}Canceled{% endtrans %}</dt>
@@ -181,15 +229,15 @@
 									{% if application.canceled is null %}
 										{% trans %}None{% endtrans %}
 									{% else %}
-										{{ application.canceled.format('Y-m-d H:i:s') }}
+										{{ application.canceled|localizeddate('long', 'medium') }}
 									{% endif %}
 								</dd>
 							</dl>
-						</section>
+						</article>
 					{% endfor %}
 				{% endif %}
 			</div>
-		</section>
-	</div>
-</section>
+		</article>
+	</article>
+	{{ include('@RapsysAir/default/_location.html.twig') }}
 {% endblock %}