{% extends 'agent/base_agent.html' %} {% block title %}Chat with {{ visitor_id }} | Agent Desk | ChatLab{% endblock %} {% block agent_dash_active %}active{% endblock %} {% block messages_display %}{% endblock %} {% block custom_styles %} body { overflow: hidden !important; height: 100% !important; height: 100dvh !important; } /* Adjust main content container to fill height exactly minus header */ .main-content { padding: 0 !important; position: fixed; top: 56px; bottom: 0; left: 0; right: 0; display: flex; flex-direction: column; overflow: hidden; min-height: 0 !important; height: auto !important; } .chat-layout-wrapper { display: flex; flex-direction: column; flex: 1; background: var(--bg-card); overflow: hidden; height: 100%; width: 100%; position: relative; min-height: 0; } .agent-msg-row:hover .msg-actions { opacity: 1 !important; } .edit-msg-btn:hover { color: var(--primary-blue) !important; } .delete-msg-btn:hover { color: #b91c1c !important; } @media (max-width: 768px) { .msg-actions { opacity: 0.6 !important; } } .chat-page-header { padding: 10px 16px; background: var(--bg-card); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 0.5rem; position: sticky; top: 0; z-index: 10; } .chat-controls-wrapper { display: flex; align-items: center; gap: 12px; width: 100%; } .attachment-buttons-container { display: flex; gap: 6px; flex-shrink: 0; } .input-and-send-container { display: flex; gap: 8px; flex-grow: 1; align-items: flex-end; } .attach-icon-btn { background: var(--hover-bg); border: none; color: var(--primary-blue); width: 38px; height: 38px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: background-color 0.2s; outline: none; } .attach-icon-btn:hover { background: #e4e6eb; } .quicktype-btn { background: var(--hover-bg); border: 1px solid var(--border-color); border-radius: 16px; padding: 6px 12px; font-size: 0.85rem; color: var(--text-primary); cursor: pointer; transition: background-color 0.2s; outline: none; } .quicktype-btn:hover { background: #e4e6eb; } /* MOBILE RESPONSIVE LAYOUT */ @media (max-width: 576px) { .chat-page-header { flex-direction: column; align-items: flex-start; padding: 10px; } .top-action-btns { width: 100%; display: flex; gap: 0.5rem; margin-top: 0.25rem; } .top-action-btns a, .top-action-btns form, .top-action-btns button { flex: 1; width: 100%; } .top-action-btns button, .top-action-btns a { padding: 0.5rem 0 !important; font-size: 0.8rem !important; text-align: center; justify-content: center; } .chat-controls-wrapper { flex-direction: column; align-items: flex-start; gap: 8px; } .attachment-buttons-container { width: 100%; justify-content: flex-start; border-bottom: 1px solid var(--border-color); padding-bottom: 6px; } .input-and-send-container { width: 100%; } } {% endblock %} {% block header_center %} Active Chat {% endblock %} {% block workspace %}

{% if visitor_profile_pic %} Profile {% endif %} {{ visitor_name|default:visitor_id }}

{% if visitor_id|slice:":3" == "fb_" %} Messenger {% elif visitor_id|slice:":3" == "wa_" %} WhatsApp {% else %} Web {% endif %} {% if escalation.ai_mode_active %} AI Active {% else %} Manual Mode {% endif %} ยท Chatting as {{ user.agent_name|default:user.username }}
Back
{% csrf_token %}
{% for m in messages %} {% if m.sender == 'visitor' %}
{{ visitor_name|default:"Visitor" }}
{% if m.message_type == 'image' %} {% if m.attachment %} {% elif m.attachment_url %} {% endif %} {% elif m.message_type == 'voice' %} {% if m.attachment %} {% elif m.attachment_url %} {% endif %} {% elif m.message_type == 'file' %} {% if m.attachment %} ๐Ÿ“Ž {{ m.content }} {% elif m.attachment_url %} ๐Ÿ“Ž {{ m.content }} {% endif %} {% else %} {{ m.content|linebreaksbr }} {% endif %}
{% elif m.sender == 'agent' %}
You
{% if m.message_type == 'image' %} {% if m.attachment %} {% elif m.attachment_url %} {% endif %} {% elif m.message_type == 'voice' %} {% if m.attachment %} {% elif m.attachment_url %} {% endif %} {% elif m.message_type == 'file' %} {% if m.attachment %} ๐Ÿ“Ž {{ m.content }} {% elif m.attachment_url %} ๐Ÿ“Ž {{ m.content }} {% endif %} {% else %} {{ m.content|linebreaksbr }} {% endif %}
{% elif m.sender == 'bot' %}
Website
{% if m.message_type == 'image' %} {% if m.attachment %} {% elif m.attachment_url %} {% endif %} {% elif m.message_type == 'voice' %} {% if m.attachment %} {% elif m.attachment_url %} {% endif %} {% elif m.message_type == 'file' %} {% if m.attachment %} ๐Ÿ“Ž {{ m.content }} {% elif m.attachment_url %} ๐Ÿ“Ž {{ m.content }} {% endif %} {% else %} {{ m.content|linebreaksbr }} {% endif %}
{% else %}
โ€” {{ m.content }} โ€”
{% endif %} {% endfor %}
{% csrf_token %}
{% endblock %}