27 lines
7.2 KiB
HTML
27 lines
7.2 KiB
HTML
{% load jalali %}{% for item in conversation %}
|
||
<article class="message {% if item.is_internal %}note{% elif item.author == viewer_user %}mine{% endif %}" data-message {% if item.deleted_at %}data-message-deleted{% endif %} data-message-id="{{ item.public_id }}" data-date="{{ item.created_at|date:'Y-m-d' }}" data-day-label="{{ item.created_at|jalali_date }}"{% if item.author == viewer_user and not item.is_internal and not item.deleted_at %} data-chat-coach-own data-chat-coach-at="{{ item.created_at|date:'U' }}"{% endif %}>
|
||
<div class="message-avatar" aria-hidden="true">{{ item.author_name|slice:':1' }}</div>
|
||
<div class="message-bubble">
|
||
<header><b>{{ item.author_name }}</b>{% if item.is_internal %}<span class="internal-label">🔒 یادداشت داخلی</span>{% endif %}<time title="{{ item.created_at|jalali_datetime }}">{{ item.created_at|persian_time }}</time></header>
|
||
{% if item.deleted_at and not perms.messaging.view_deleted_message_content %}
|
||
<p class="deleted-message">این پیام توسط فرستنده حذف شده است.</p>
|
||
{% else %}
|
||
{% if item.body %}<p>{{ item.body|linebreaksbr }}</p>{% endif %}
|
||
{% if item.deleted_at %}<small class="danger">حذفشده در {{ item.deleted_at|jalali_datetime }}</small>{% endif %}
|
||
{% if item.edited_at %}<span class="edited-label">ویرایش شده</span>{% if perms.messaging.view_message_revisions and not limited_share %}<a class="revision-link" href="{% url 'messages:revisions' item.public_id %}">تاریخچه</a>{% endif %}{% endif %}
|
||
{% if item.attachments.all %}<div class="attachment-list">{% for file in item.attachments.all %}
|
||
{% if file.attachment_type == 'IMAGE' %}<div class="attachment attachment-image"><button type="button" data-image-open data-image-src="{% if limited_share %}{% url 'staff_tickets:shared_message_attachment' item.received_share.public_id file.public_id %}{% else %}{% url 'attachments:view' file.public_id %}{% endif %}" data-image-name="{{ file.original_name }}"><img src="{% if limited_share %}{% url 'staff_tickets:shared_message_attachment' item.received_share.public_id file.public_id %}{% else %}{% url 'attachments:view' file.public_id %}{% endif %}" alt="{{ file.original_name }}"><span>{{ file.original_name }} · {{ file.file_size|filesizeformat }}</span></button><a class="attachment-download" href="{% if limited_share %}{% url 'staff_tickets:shared_message_attachment_download' item.received_share.public_id file.public_id %}{% else %}{% url 'attachments:download' file.public_id %}{% endif %}" download>⇩ دانلود تصویر</a></div>
|
||
{% elif file.attachment_type == 'VOICE' %}<div class="attachment attachment-audio"><span>🎙 پیام صوتی</span><audio controls preload="metadata" src="{% if limited_share %}{% url 'staff_tickets:shared_message_attachment' item.received_share.public_id file.public_id %}{% else %}{% url 'attachments:view' file.public_id %}{% endif %}"></audio><a href="{% if limited_share %}{% url 'staff_tickets:shared_message_attachment_download' item.received_share.public_id file.public_id %}{% else %}{% url 'attachments:download' file.public_id %}{% endif %}">دریافت فایل</a></div>
|
||
{% else %}<a class="attachment attachment-file" href="{% if limited_share %}{% url 'staff_tickets:shared_message_attachment_download' item.received_share.public_id file.public_id %}{% else %}{% url 'attachments:download' file.public_id %}{% endif %}"><span class="file-icon">⇩</span><span><b>{{ file.original_name }}</b><small>{{ file.get_attachment_type_display }} · {{ file.file_size|filesizeformat }}</small></span></a>{% endif %}
|
||
{% endfor %}</div>{% endif %}
|
||
{% endif %}
|
||
{% if item.received_share %}<small class="received-share-attribution">{% include "tickets/_staff_share_icon.html" %} اشتراک توسط {{ item.received_share.granted_by.staff_profile.display_name|default:item.received_share.granted_by.username }} · <time>{{ item.received_share.created_at|jalali_datetime }}</time>{% if item.received_share.note %}<details><summary aria-label="توضیح اشتراک">ⓘ</summary>{{ item.received_share.note }}</details>{% endif %}</small>{% endif %}
|
||
<div class="staff-message-footer">
|
||
{% if not limited_share %}{% with receipts=item.read_receipts.all %}{% if receipts %}<details class="message-receipts"><summary>✓ دیدهشده توسط {{ receipts|length }} نفر</summary><ul>{% for receipt in receipts %}<li><span>{{ receipt.reader_name }}</span><time>{{ receipt.read_at|jalali_datetime }}</time></li>{% endfor %}</ul></details>{% endif %}{% endwith %}{% endif %}
|
||
{% if item.author == user and not item.deleted_at and not limited_share %}<details class="message-menu" data-message-menu><summary aria-label="عملیات پیام" title="عملیات پیام"><span aria-hidden="true">•••</span></summary><div class="message-menu-panel" role="dialog" aria-label="عملیات پیام"><div class="message-menu-choices" data-message-menu-choices><button type="button" class="message-choice message-choice-edit" data-message-edit-open><span class="message-choice-icon" aria-hidden="true">✎</span><span><b>ویرایش</b><small>اصلاح متن پیام</small></span><span class="message-choice-arrow" aria-hidden="true">‹</span></button><form method="post" action="{% url 'messages:delete' item.public_id %}" onsubmit="return confirm('از حذف این پیام مطمئن هستید؟')">{% csrf_token %}<input type="hidden" name="next" value="{{ request.path }}"><button type="submit" class="message-choice message-choice-delete"><span class="message-choice-icon" aria-hidden="true">⌫</span><span><b>حذف</b><small>حذف پیام از گفتگو</small></span></button></form></div><div class="message-editor" data-message-editor hidden><header class="message-menu-head"><button type="button" class="message-editor-back" data-message-edit-back aria-label="بازگشت به عملیات">→</button><div><b>ویرایش پیام</b><small>متن اصلاحشده در تاریخچه ثبت میشود</small></div><button type="button" class="message-menu-close" data-message-menu-close aria-label="بستن">×</button></header><form class="message-edit-form" method="post" action="{% url 'messages:edit' item.public_id %}">{% csrf_token %}<label for="edit-{{ item.public_id }}">متن پیام</label><textarea id="edit-{{ item.public_id }}" name="body" maxlength="4000" data-message-edit-input data-original-value="{{ item.body }}">{{ item.body }}</textarea><div class="message-edit-meta"><span>متن را دقیق و کوتاه نگه دارید</span><span data-message-edit-count>{{ item.body|length }} / ۴۰۰۰</span></div><input type="hidden" name="next" value="{{ request.path }}"><div class="message-menu-actions"><button type="submit" class="message-edit-save">ذخیره تغییرات</button><button type="button" class="message-edit-cancel" data-message-menu-close>انصراف</button></div></form></div></div></details>{% endif %}
|
||
{% include 'tickets/_staff_message_share.html' %}
|
||
</div>
|
||
</div>
|
||
</article>
|
||
{% empty %}<div class="conversation-empty"><span>✦</span><h3>هنوز مکاتبهای ثبت نشده است</h3><p>شرح کامل درخواست یا پاسخ خود را در فرم پایین ثبت کنید.</p></div>{% endfor %}
|