{% extends 'base.html.twig' %}
{% block title %}Affichage d'un Post{% endblock %}
{% block body %}
<div style="height: auto; margin:15px 15px; list-style-type: none; border: 2px solid white; border-radius: 10px; padding: 20px; font-size: 20px;">
<h1 style="display:flex;flex-direction:row; justify-content:center;box-shadow: 15px 1px 55px #5ED9F4; padding: 15px 15px;">{{ postDetails.title }}</h1>
<!-- Pseudo et date de création et catégorie -->
<p style="font-size: 20px;">
Créé par <strong>
<a href="{{ path('app_envoyer_message', { 'username': postDetails.username }) }}">
{{ postDetails.username }}
</a>
</strong> le {{ postDetails.creationDate|date('d/m/Y H:i') }} | {{ postDetails.name }}
</p>
<!-- Image facultative -->
{% if postDetails.image %}
<div style="text-align: center;">
<img src="{{ asset('uploads/images/' ~ postDetails.image) }}" style="max-width: 60%; ">
</div>
{% endif %}
<hr>
<!-- Contenu principal du post -->
<div>
<p style="font-size: 20px;"><strong>{{ postDetails.username }}</strong> : {{ postDetails.content }}</p>
</div>
<!-- Réponses au post -->
<div>
{% for response in postDetails.responses %}
<p><strong><a href="{{ path('app_envoyer_message', { 'username': response.username }) }}">{{ response.username }}</a></strong>: {{ response.content }}</p>
{% endfor %}
</div>
</div>
<!-- Formulaire de réponse -->
{% if app.user %}
<div>
<h3>Répondre au Post</h3>
<form method="post" action="{{ path('app_repondre_au_post', { 'id': postDetails.id }) }}">
<textarea name="response" rows="4" cols="50"></textarea><br>
<button type="submit" style="padding: 10px 10px;">Envoyer</button>
</form>
</div>
{% endif %}
{% endblock %}