{% extends 'base.html' %} {% load static i18n %} {% load widget_tweaks %} {% block customCSS %} {% endblock %} {% block content %} {% comment %} NOTE: The variable 'meeting' has been renamed to 'interview' (ScheduledInterview) NOTE: The variable 'meeting.slug' has been renamed to 'interview.slug' NOTE: All 'meeting' URL names (update_meeting, delete_meeting, etc.) have been renamed {% endcomment %}
{# --- TOP BAR / BACK BUTTON & ACTIONS (EDIT/DELETE) --- #}
{# Back Button #} {% trans "Back to Interviews" %} {# Edit and Delete Buttons #}
{% trans "Edit Interview" %} {# DELETE MEETING FORM #}
{% csrf_token %}
{# ========================================================= #} {# --- MAIN TITLE AT TOP --- #} {# ========================================================= #} {% with zoom_details=interview.zoom_details.0 %}

{% if interview.schedule.interview_type == 'Remote' %} {{ zoom_details.topic|default:"[Remote Interview]" }} {% else %} {{ interview.schedule.location|default:"[Onsite Interview]" }} {% endif %} {{ interview.status|title|default:'N/A' }} ({{ interview.schedule.interview_type }})

{# ========================================================= #} {# --- SECTION 1: INTERVIEW & CONNECTION/LOCATION CARDS SIDE BY SIDE --- #} {# ========================================================= #}
{# --- LEFT HALF: INTERVIEW DETAIL CARD --- #}

{% trans "Candidate & Job" %}

{# NOTE: Assuming ScheduledInterview has direct relations to candidate and job #}
{% trans "Candidate Email" %}:
{% trans "Job Type" %}:
{{ interview.job.job_type|default:"N/A" }}
{% if interview.candidate.belong_to_agency %} {% endif %}
{# --- RIGHT HALF: CONNECTION/LOCATION DETAILS CARD --- #}

{% trans "Time & Location" %}

{% trans "Date & Time" %}:
{{ interview.interview_date|date:"M d, Y"|default:"N/A" }} @ {{ interview.interview_time|time:"H:i"|default:"N/A" }}
{% trans "Duration" %}:
{{ interview.schedule.interview_duration|default:"N/A" }} {% trans "minutes" %}
{% if interview.schedule.interview_type == 'Onsite' %} {# --- Onsite Details --- #}
{% trans "Location" %}:
{{ interview.schedule.location|default:"TBD" }}
{% elif interview.schedule.interview_type == 'Remote' and zoom_details %} {# --- Remote/Zoom Details --- #}

{% trans "Remote Details" %}

{% trans "Meeting ID" %}:
{{ zoom_details.meeting_id|default:"N/A" }}
{% trans "Host Email" %}:
{{ zoom_details.host_email|default:"N/A" }}
{% if zoom_details.join_url %}
{% trans "Copied!" %}
{% trans "Join URL" %}: {{ zoom_details.join_url }}
{% endif %} {% else %}

{% trans "Location/Connection details are not available for this interview type." %}

{% endif %}
{% endwith %} {# ========================================================= #} {# --- SECTION 2: PERSONNEL TABLES --- #} {# ========================================================= #}
{# --- PARTICIPANTS TABLE --- #}

{% trans "Assigned Participants" %}

{# External Participants #} {% for participant in interview.participants.all %} {% endfor %} {# System Users (Internal Participants) #} {% for user in interview.system_users.all %} {% endfor %}
{% trans "Name" %} {% trans "Role/Designation" %} {% trans "Email" %} {% trans "Phone Number" %} {% trans "Source Type" %}
{{participant.name}} {{participant.designation}} {{participant.email}} {{participant.phone}} {% trans "External Participants" %}
{{user.get_full_name}} {% trans "System User" %} {{user.email}} {{user.phone}} {% trans "System User" %}
{# ========================================================= #} {# --- SECTION 3: COMMENTS (CORRECTED) --- #} {# ========================================================= #}
{% trans "Comments" %} ({% if interview.comments %}{{ interview.comments.count }}{% else %}0{% endif %})
{# 1. COMMENT DISPLAY & IN-PAGE EDIT FORMS #}
{# NOTE: Assuming comment model has a ForeignKey to ScheduledInterview called 'interview' #} {% if interview.comments.all %} {% for comment in interview.comments.all|dictsortreversed:"created_at" %}
{# Read-Only Comment View #}
{% if comment.author == user or user.is_staff %}
{# Edit Button: Toggles the hidden form #} {# Delete Form: Submits a POST request #}
{% csrf_token %}
{% endif %}

{{ comment.content|linebreaksbr }}

{# Hidden Edit Form #}
{% endfor %} {% else %}

{% trans "No comments yet. Be the first to comment!" %}

{% endif %}

{# 2. NEW COMMENT SUBMISSION (Remains the same) #}
{% trans "Add a New Comment" %}
{% if user.is_authenticated %}
{% csrf_token %} {% if comment_form %} {{ comment_form.as_p }} {% else %}
{% endif %}
{% else %}

{% trans "You must be logged in to add a comment." %}

{% endif %}
{# --- MODALS (Updated to use interview.slug) --- #} {% endblock %} {% block customJS %} {% endblock %}