{% extends "base.html" %} {% block title %}{{ listing.title }} · Listing · Admin{% endblock %} {% set seller = listing.seller %} {% set profile = seller.profile if seller else None %} {% set seller_name = profile.full_name if profile else (seller.email.split('@')[0] if seller else '—') %} {% set is_deleted = listing.deleted_at is not none %} {% set status = listing.status.value %} {# One quick-action form: posts a single `action` to the shared endpoint. #} {% macro action(label, value, icon, cls, confirm=None) %}
{% endmacro %} {% block content %}
Back to listings {# ---------- Header ---------- #}
{# Gallery #}
{% if listing.images %} {% else %}
{% endif %}
{# Info #}

{{ listing.title }}

{{ status|title }} {% if detail.is_featured %} Featured{% endif %} {% if detail.is_reported %} Reported{% endif %}
₹{{ "{:,.0f}".format(listing.price) }} {% if listing.negotiable %}Negotiable{% endif %}
Category
{{ listing.category.name if listing.category else '—' }}
Condition
{{ listing.condition.value }}
{% if listing.location %}
Location
{{ listing.location }}
{% endif %}
Listing ID
{{ listing.public_id }}
Created
{{ listing.created_at.strftime('%d %b %Y, %H:%M') }}
{% if listing.expires_at %}
Expires
{{ listing.expires_at.strftime('%d %b %Y') }}
{% endif %} {% if is_deleted %}
Deleted
{{ listing.deleted_at.strftime('%d %b %Y, %H:%M') }}
{% endif %}
{# Seller #}
{% if profile and profile.profile_picture %} {% else %}{{ seller_name[0]|upper }}{% endif %}
{# ---------- Quick actions (only valid ones) ---------- #}
{% if not is_deleted %} View Public Listing {% endif %} {% if detail.is_featured %} {{ action('Remove Feature', 'unfeature', 'bi-star', 'btn-outline-warning') }} {% elif not is_deleted and status == 'available' %} {{ action('Feature Listing', 'feature', 'bi-stars', 'btn-warning') }} {% endif %} {% if not is_deleted and status == 'available' %} {{ action('Mark Reserved', 'reserved', 'bi-bookmark-check', 'btn-outline-secondary') }} {% endif %} {% if not is_deleted and status in ['available', 'reserved'] %} {{ action('Mark Sold', 'sold', 'bi-cart-check', 'btn-outline-secondary', confirm='Mark this listing as sold?') }} {% endif %} {% if is_deleted %} {{ action('Restore', 'restore', 'bi-arrow-counterclockwise', 'btn-outline-success') }} {% else %} {{ action('Soft Delete', 'delete', 'bi-trash3', 'btn-outline-danger', confirm='Soft-delete this listing? It will be removed from the marketplace.') }} {% endif %}
{# ---------- Analytics ---------- #} {% set a = detail.analytics %}
{% for label, value, icon, color in [ ('Views', a.views, 'bi-eye-fill', 'info'), ('Favorites', a.favorites, 'bi-heart-fill', 'danger'), ('Offers', a.offers, 'bi-tag-fill', 'secondary'), ('Conversations', a.conversations, 'bi-chat-dots-fill', 'primary') ] %}
{{ "{:,}".format(value) }}
{{ label }}
{% endfor %}
{# ---------- Featured + view history ---------- #}

Featured status & view history

{% if detail.is_featured %}

Featured until {{ detail.featured_until.strftime('%d %b %Y') }} ({{ detail.featured_days_left }} day{{ '' if detail.featured_days_left == 1 else 's' }} left)

{% else %}

This listing is not currently featured.

{% endif %} {% set vh = detail.view_history %}
Total view events
{{ "{:,}".format(vh.events) }}
Unique signed-in viewers
{{ "{:,}".format(vh.unique_viewers) }}
Unique sessions
{{ "{:,}".format(vh.unique_sessions) }}
Last viewed
{{ vh.last_viewed.strftime('%d %b %Y') if vh.last_viewed else '—' }}
{# ---------- Recent activity ---------- #}

Recent activity

{% if detail.recent_activity %}
    {% for act in detail.recent_activity %}
  • {{ act.text }}

  • {% endfor %}
{% else %}

No recent activity.

{% endif %}
{# ---------- Description ---------- #}

Description

{{ listing.description }}

{% endblock %}