{% extends "base.html" %} {% block title %}{{ ticket.ticket_number }} | {{ app_name }}{% endblock %} {% block content %}

{{ ticket.ticket_number }}

{{ ticket.title }}

{{ ticket.description }}

{% if ticket.is_approved %} {{ ltext('Approved / معتمدة') }} {% endif %} {% if ticket.is_paid_ticket %} {{ ltext('Paid / مأجورة') }}{% if ticket.paid_amount is not none %} - {{ '%.2f'|format(ticket.paid_amount) }} {{ ticket.paid_currency }}{% endif %} {% endif %}
{% if ticket_permissions.can_edit_content %} {{ t('edit') }} {% endif %} {% if ticket_permissions.can_cancel %}
{% endif %}
{{ ltext('Status / الحالة') }}{{ ticket.status.name if ticket.status else 'N/A'|ltext }}
{{ ltext('Priority / الأولوية') }}{{ ticket.priority.name if ticket.priority else 'N/A'|ltext }}
{{ ltext('Company / الشركة') }}{{ ticket.company.name if ticket.company else t('internal') }}
{{ ltext('Department / القسم') }}{{ ticket.department.name if ticket.department else t('unassigned') }}
{{ ltext('Assignee / المكلّف') }}{{ ticket.assigned_to.full_name if ticket.assigned_to else t('unassigned') }}
{{ ltext('Created By / أنشئت بواسطة') }}{{ ticket.created_by.full_name if ticket.created_by else t('system') }}
{% if ticket.is_approved %}

{{ ltext('Approval / الاعتماد') }}

{{ ltext('This ticket is locked for general editing. Only admins can edit the full content. Status, internal notes, and attachments remain available. / هذه التذكرة مقفلة من التعديل العام. فقط الأدمن يمكنه تعديل كامل المحتوى. تبقى الحالة والملاحظات الداخلية والمرفقات متاحة.') }}

{% if ticket.approval_notes %}

{{ ltext('Notes / ملاحظات') }}: {{ ticket.approval_notes }}

{% endif %}
{% endif %}

{{ ltext('Tags / الوسوم') }}

{% for tag in ticket.tags %} {{ tag.name }} {% else %} {{ ltext('No tags assigned. / لا توجد وسوم.') }} {% endfor %}

{{ t('public_conversation') }}

{% for comment in comments %}
{{ comment.author.full_name if comment.author else t('system') }} {{ comment.created_at.strftime('%Y-%m-%d %H:%M') }}

{{ comment.content }}

{% else %}

{{ ltext('No public comments yet. / لا توجد تعليقات عامة.') }}

{% endfor %}
{% if ticket_permissions.can_comment %}
{{ comment_form.hidden_tag() }} {{ comment_form.submit(class="button") }}
{% endif %}
{% if ticket_permissions.can_add_note %}

{{ t('internal_notes') }}

{% for note in notes %}
{{ note.author.full_name if note.author else t('system') }} {{ note.created_at.strftime('%Y-%m-%d %H:%M') }}

{{ note.content }}

{% else %}

{{ ltext('No internal notes. / لا توجد ملاحظات داخلية.') }}

{% endfor %}
{{ note_form.hidden_tag() }} {{ note_form.submit(class="button") }}
{% endif %}

{{ t('assignment_status') }}

{% if ticket_permissions.can_assign %}
{{ assignment_form.hidden_tag() }} {{ assignment_form.submit(class="button") }}
{% endif %} {% if ticket_permissions.can_change_status %}
{{ status_form.hidden_tag() }} {{ status_form.submit(class="button button-secondary") }}
{% endif %}
{% if ticket_permissions.can_approve %}

{{ ltext('Approval Control / التحكم بالاعتماد') }}

{{ approval_form.hidden_tag() }} {{ approval_form.submit(class="button", value=(ltext('Unlock Ticket / فتح قفل التذكرة') if ticket.is_approved else ltext('Approve Ticket / اعتماد التذكرة'))) }}
{% endif %} {% if ticket_permissions.can_mark_paid %}

{{ ltext('Paid Ticket / تذكرة مأجورة') }}

{{ paid_form.hidden_tag() }} {% if ticket.company_id %} {% else %}

{{ ltext('External paid-ticket access is available only for tickets linked to a company. / إظهار التذكرة المأجورة للمستخدمين الخارجيين متاح فقط للتذاكر المرتبطة بشركة.') }}

{% endif %} {{ paid_form.submit(class="button") }}
{% if ticket.is_paid_ticket %}
{% endif %}
{% endif %} {% if ticket_permissions.can_upload %}

{{ t('attachments') }}

{{ attachment_form.hidden_tag() }} {{ attachment_form.submit(class="button") }}
{% endif %}

{{ t('attachments') }}

    {% for attachment in ticket.attachments.all() %}
  • {{ attachment.file.original_name }} {{ attachment.file.size_bytes|filesize }}
  • {% else %}
  • {{ ltext('No attachments uploaded. / لا توجد مرفقات.') }}
  • {% endfor %}

{{ t('activity_timeline') }}

{% for activity in activities %}
{{ activity.actor.full_name if activity.actor else t('system') }} {{ activity.created_at.strftime('%Y-%m-%d %H:%M') }}

{{ activity.message }}

{% else %}

{{ ltext('No activity logged. / لا يوجد نشاط.') }}

{% endfor %}
{% if ticket_permissions.can_merge %}

{{ t('merge_ticket') }}

{% endif %}
{% endblock %}