{% for privateMessage in privateMessages %}
<div class="media mb-4 font-size-14" id="private-message-{{ privateMessage.id }}" style="background-color:{% if app.user.id == privateMessage.author.id %}#CCCCCC{% else %}#CCCCFF{% endif %};padding: 15px; border-radius: 15px;">
<div class="media-body">
<h5 class="mt-0 font-size-15">
{{ privateMessage.createdAt|date('Y-m-d H:i') }}<br/>
{{ privateMessage.author.companyName }} ({{ privateMessage.author.username }})
{% if privateMessage.inquiry is not null %}
<br/>
Do zapytania: <a href="{{ path('client_inquiry_details', {'id': privateMessage.inquiry.id }) }}#comments">{{ privateMessage.inquiry.make.name }} {{ privateMessage.inquiry.model }}</a><br/>
Nr rej: <a href="{{ path('client_inquiry_details', {'id': privateMessage.inquiry.id }) }}#comments">{{ privateMessage.inquiry.registrationNumber }}</a><br/>
Numer VIN: <a href="{{ path('client_inquiry_details', {'id': privateMessage.inquiry.id }) }}#comments">{{ privateMessage.inquiry.vin }}</a><br/>
{% elseif privateMessage.offer is not null %}
<br/>Do Twojej oferty dotyczącej: <a href="{{ path('client_offer_details', {'id': privateMessage.offer.id }) }}">{{ privateMessage.offer.inquiry.make.name }} {{ privateMessage.offer.inquiry.model }}</a>
{% endif %}
</h5>
<br/>
{{ privateMessage.content|raw }}
<br/>
{% if privateMessage.attachmentFiles|length > 0 %}
<div class="row">
<div class="col-12">
<h5 class="mb-4 pb-1 font-size-12">Załączniki ({{ privateMessage.attachmentFiles|length }})</h5>
</div>
</div>
<div class="row">
<div class="col-12">
<div class="lightbox2-parent-container">
{% for attachmentFile in privateMessage.attachmentFiles %}
{% if attachmentFile.fileType == 'image' %}
<a href="{{ asset(attachmentFile.url) }}" data-lightbox="private-message-images-{{ privateMessage.id }}" style="display: inline;">
<div class="avatar-title rounded bg-soft-primary text-primary " style="background-color: black; width: 90px; height: 60px; display: inline-block; background-size: cover; background-position: center center; background-repeat: no-repeat; background-image: url({{ miniatureFiles['privateMessage'][attachmentFile.id]['100x100'].url }})"></div>
</a>
{% endif %}
{% endfor %}
</div>
{% for attachmentFile in privateMessage.attachmentFiles %}
{% if attachmentFile.fileType == 'file' %}
<div class="p-2 border rounded mb-2" style="background-color: white;">
<div class="media">
<div class="avatar-sm font-weight-bold mr-3">
<span class="avatar-title rounded bg-soft-primary text-primary">
<i class="uil-file font-size-18"></i>
</span>
</div>
<div class="media-body">
<a href="{{ path('private_message_get_file', {'id': attachmentFile.id}) }}" class="d-inline-block mt-2">{{ attachmentFile.originalFileName }}</a>
</div>
<div class="float-right mt-1">
<a href="{{ path('private_message_get_file', {'id': attachmentFile.id}) }}" class="p-2"><i class="uil-download-alt font-size-18"></i></a>
</div>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>
{% endif %}
<div class="row">
<div class="col-12">
<p class="text-muted">
{% if privateMessage.readAt is null and notificationsForMessages[privateMessage.id] is defined and not notificationsForMessages[privateMessage.id].isRead and notificationsForMessages[privateMessage.id].recipient.id == app.user.id %}
<a class="loader-button btn btn-primary [ read-notification-from-module ] text-white read-notification-{{ notificationsForMessages[privateMessage.id].id }}"
data-action="{{ path('notification_read', {'id': notificationsForMessages[privateMessage.id].id}) }}"
style="animation: blinker 1s linear infinite;"
data-toggle="tooltip" data-html="true" data-placement="top" data-original-title="Pamiętaj, aby oznaczać wiadomość jako przeczytaną, dzięki temu będziesz mieć porządek oraz zniknie czerwona koperta informująca o nowej wiadomości"
>
<i class="fa fa-spinner fa-spin d-none loader-button-mark"></i> Oznacz jako przeczytane <i class="fa fa-envelope" style="color: red;"></i>
</a>
{% endif %}
{% if privateMessage.readAt is not null and notificationsForMessages[privateMessage.id] is defined and notificationsForMessages[privateMessage.id].isRead %}
{% if notificationsForMessages[privateMessage.id].recipient.id == app.user.id %}
<a class="badge badge-light [ unread-notification-from-module ] text-white unread-notification-{{ notificationsForMessages[privateMessage.id].id }}" data-action="{{ path('notification_unread', {'id': notificationsForMessages[privateMessage.id].id}) }}" style="background: gray; color: black;">Oznacz jako NIE przeczytane</a>
{% endif %}
<br/>
<small>Przeczytana {{ privateMessage.readAt|date('Y-m-d H:i') }} przez {{ notificationsForMessages[privateMessage.id].recipient }}</small><br/>
{% endif %}
</p>
</div>
</div>
<div class="row">
<div class="col-12" style="text-align: left;">
{% if app.user.id == privateMessage.author.id and app.user.canDeletePrivateMessages %}
<button class="btn btn-sm btn-danger [ delete-private-message-from-module ] " data-message-id="{{ privateMessage.id }}">Usuń</button>
{% endif %}
</div>
</div>
</div>
<hr>
</div>
{% endfor %}