{% extends "base.html" %} {% block title %}Report {{ report.public_id[:8] }} · Admin{% endblock %} {% set status_badge = {'pending': 'warning', 'under_review': 'info', 'resolved': 'success', 'dismissed': 'secondary'} %} {% set status = report.status.value %} {% set is_open = status in ['pending', 'under_review'] %} {% set listing = detail.listing %} {% set listing_removed = listing and listing.deleted_at is not none %} {% set assigned_to_me = report.moderator_id and report.moderator_id == current_user.id %} {% set assigned_other = report.moderator_id and not assigned_to_me %} {% set convos = detail.conversations %} {% set sh = detail.seller_history %} {% macro action(label, value, icon, cls, confirm=None, block=False, disabled=False, hint=None) %}
{% if hint %}

{{ hint }}

{% endif %}
{% endmacro %} {% macro disabled_action(label, icon, cls, hint) %}

{{ hint }}

{% endmacro %} {% block content %}
Back to reports {# ================= Report summary (understand the report at a glance) ================= #}

Report {{ report.public_id[:8] }}

{{ status.replace('_',' ')|title }} {{ detail.reason }} {{ report.entity_type.value }} {% if assigned_to_me %} Assigned to You {% elif assigned_other %} {{ detail.moderator_name }} {% endif %}
Report ID{{ report.public_id[:12] }}
Status{{ status.replace('_',' ')|title }}
Assigned moderator{{ detail.moderator_name or 'Unassigned' }}
Reported{{ report.created_at.strftime('%d %b %Y, %H:%M') }}
Reason{{ detail.reason }}
Listing {% if listing %}{{ listing.title }}{% else %}—{% endif %}
Seller {% if detail.seller_public_id %}{{ detail.seller_name }}{% else %}{{ detail.seller_name }}{% endif %}
Reporter{{ detail.reporter_name }}
Conversations{{ convos.conversation_count }}
Messages{{ convos.total_messages }}
Offers{{ convos.total_offers }}
{% if report.description %}
{{ report.description }}
{% endif %}
{# ================= Conversation (wide) + sticky moderation action center ================= #}

Conversation History

{% if convos.conversation_count %}
{{ convos.total_messages }} Message{{ '' if convos.total_messages == 1 else 's' }} {{ convos.total_offers }} Offer{{ '' if convos.total_offers == 1 else 's' }} {% if convos.conversation_count == 1 %} {{ convos.groups[0].buyer_name }} ↔ {{ convos.groups[0].seller_name }} {% else %} {{ convos.conversation_count }} conversations {% endif %}
{% endif %}
{% if convos.conversation_count %}
{% endif %}
{% if not convos.conversation_count %}

No conversations occurred for this listing before the report.

{% else %}
{% for g in convos.groups %}
{% if convos.conversation_count > 1 %}
{{ g.buyer_name }} ↔ {{ g.seller_name }} {{ g.message_count }} msg · {{ g.offer_count }} offer{{ '' if g.offer_count == 1 else 's' }}
{% endif %} {% for e in g.events %} {% if e.kind == 'offer' %} {% set right = e.offer_kind == 'counter' %}
{{ 'Counter Offer' if right else 'Offer' }} {{ e.status_label }}
₹{{ "{:,.0f}".format(e.amount) }}
{% if e.content %}
“{{ e.content }}”
{% endif %}
{% elif e.kind == 'system' %}
{{ e.content }} · {{ e.timestamp.strftime('%d %b, %H:%M') }}
{% else %} {% set right = e.role == 'seller' %}
{{ e.sender[0]|upper }} {{ e.sender }} · {{ e.role|title }}
{{ e.content }}
{% endif %} {% endfor %}
{% endfor %}

Read-only · visible to moderators only.

{% endif %}
{# ---------- Sticky moderation action center ---------- #}

Moderation Actions

{% if is_open %} {# Assignment #}

Assignment

{% if not report.moderator_id %} {{ action('Assign to Me', 'assign', 'bi-person-check', 'btn-primary', block=True) }} {% elif assigned_to_me %} Assigned to You ✓ {% else %}
Assigned to: {{ detail.moderator_name }}
{{ action('Reassign to me', 'assign', 'bi-arrow-left-right', 'btn-outline-warning', block=True, confirm='This report is assigned to ' ~ detail.moderator_name ~ '. Reassign it to yourself?') }} {% endif %} {% if status == 'pending' %} {{ action('Mark Under Review', 'under_review', 'bi-search', 'btn-outline-info', block=True) }} {% endif %}
{# Resolution — all decisions in one place #}

Resolution

{% if detail.seller_public_id %} {% else %} {{ disabled_action('Warn Seller', 'bi-exclamation-triangle', 'btn-outline-warning', 'No seller is associated with this report.') }} {% endif %} {% if listing and not listing_removed %} {{ action('Remove Listing', 'remove_listing', 'bi-trash3', 'btn-outline-danger', block=True, confirm='Remove the reported listing and resolve this report?') }} {% elif listing_removed %} {{ disabled_action('Remove Listing', 'bi-trash3', 'btn-outline-danger', 'This listing has already been removed.') }} Restore Listing {% else %} {{ disabled_action('Remove Listing', 'bi-trash3', 'btn-outline-danger', 'No listing is attached to this report.') }} {% endif %}
{% else %}

This report is {{ status.replace('_',' ')|title }} and closed to further action.

{% endif %} {% if report.moderator_notes %}
Notes: {{ report.moderator_notes }}
{% endif %} {# Notification delivery — makes it obvious that both parties have already been told the outcome (or why the reported user wasn't). #} {% set nd = detail.notification_delivery %} {% if nd.show %}

Notification Delivery

  • {{ 'Reporter notified' if nd.reporter_notified else 'Reporter not notified' }}
  • {{ 'Reported user notified' if nd.reported_notified else 'No notification sent to reported user' }}
{% if not nd.reported_notified %}

Reason: No moderation action taken.

{% endif %} {% if nd.sent_at %}

Sent

{% endif %}
{% endif %}
{# ================= Reported listing + seller history / timeline + audit ================= #}
{# Reported listing #}

Reported listing

{% if listing %}

{{ listing.title }}

₹{{ "{:,.0f}".format(listing.price) }}

{{ listing.category.name if listing.category else '' }} · {{ listing.status.value|title }} {% if listing_removed %}Removed{% endif %}

Open in Listing Management
{% else %}

The reported entity is a {{ report.entity_type.value }} ({{ report.entity_public_id[:8] }}).

{% endif %}
{# Seller moderation history #}

Seller moderation history

{% if sh %}
{{ sh.total_reports }}Total reports
{{ sh.open_reports }}Open
{{ sh.warnings }}Warnings
{{ sh.active_listings }}Active listings
{{ sh.removed_listings }}Removed listings
{% endif %}

Previous reports

{% if detail.previous_reports %} {% else %}

This seller has no previous moderation history.

{% endif %}
{# Moderator timeline #}

Timeline

    {% for t in detail.timeline %}
  • {{ t.text }}

  • {% endfor %}
{# Audit history #}

Audit history

{% if detail.audit_history %}
    {% for h in detail.audit_history %}
  • {{ h.label }}

  • {% endfor %}
{% else %}

No moderator actions have been recorded yet.

{% endif %}
{# ---------- Warn Seller modal ---------- #} {% if is_open and detail.seller_public_id %} {% endif %}
{% endblock %} {% block scripts %} {% endblock %}