{% extends "base.html" %} {% from "components/listing_card.html" import listing_card with context %} {% from "components/premium_badge.html" import premium_badge %} {% from "components/reputation.html" import rep_detail %} {% from "components/trust_badges.html" import trust_badges %} {% block title %}{{ listing.title }} · CampusCart{% endblock %} {% block content %} {% set seller = listing.seller %} {% set seller_name = seller.profile.full_name if seller.profile else seller.email %} {% set seller_pic = seller.profile.profile_picture if seller.profile else None %} {% set can_toggle = current_user.is_authenticated and not is_owner %} {% if can_toggle %} {# One toggle endpoint reused by the heart and the Save button. #} {% set fav_action = url_for('marketplace.unfavorite' if is_saved else 'marketplace.favorite', public_id=listing.public_id) %} {% endif %}

Product Description

{{ listing.description }}

{{ listing.category.name }}
{% if is_featured_now(listing) %} {% endif %}

{{ listing.title }}

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

{% if listing.status.value == 'reserved' %}
This item is currently reserved for another buyer.
{% elif listing.status.value == 'sold' %}
This item has been sold.
{% endif %}
Condition
{{ listing.condition.value|title }}
Location
{{ listing.location or 'On campus' }}
{% if not is_owner %}
{% if current_user.is_authenticated and listing.status.value == 'available' %} Message Seller {% elif current_user.is_authenticated and listing.status.value != 'available' %} {% else %} Message Seller {% endif %} {% if can_toggle %}
{% else %} Save for Later {% endif %}
{# ---- Review CTA (buyer of a completed transaction) ---- #} {% if review_ctx %}
{% if review_ctx.already_reviewed %}

Review submitted

{% else %} Leave Review for {{ review_ctx.review_for|title }} {% endif %}
{% endif %} {% if listing.negotiable %}

Negotiate with the seller through secure chat.

{% endif %} {# ---- Report listing ---- #} {% if can_report %} {% if already_reported %}

You've reported this listing — our moderators are reviewing it.

{% else %} {% endif %} {% elif not current_user.is_authenticated %} Report Listing {% endif %} {% endif %}
{# ---- Listing Tools (owner only) ---- Full-width, vertically-stacked management actions grouped into Premium Features and Manage Listing. Every action maps to an existing route; premium-gated tools degrade to an upsell and lifecycle actions that aren't valid yet render disabled. Buyers never reach this block (guarded by is_owner). #} {% if is_owner %} {% set _premium = can_feature_listing(current_user) %} {% set _featured = is_featured_now(listing) %} {% set _status = listing.status.value %}

Listing Tools

{% if _premium %}Premium{% endif %}
{# ---- Premium Features ---- #}

Premium Features

{% if _premium %} {% if _featured %} Change Featured Featured · {{ featured_days_left(listing) }} day{{ '' if featured_days_left(listing) == 1 else 's' }} left {% elif _status == 'available' %}
{% else %} Feature Listing {% endif %} View Analytics {% else %} Feature Listing View Analytics

Upgrade to Premium to feature listings and unlock seller analytics.

{% endif %}

{# ---- Manage Listing ---- #}

Manage Listing

Edit Listing {% if _status == 'reserved' %} {% elif _status == 'sold' %} Transaction Completed {% else %} Complete Transaction {% endif %} {# ---- Review CTA (seller of a completed transaction) ---- #} {% if review_ctx %} {% if review_ctx.already_reviewed %} Review Submitted {% else %} Leave Review for {{ review_ctx.review_for|title }} {% endif %} {% endif %}
{% endif %}

Seller Information

{% if seller_pic %} {{ seller_name }} {% else %} {% endif %} {% if seller.is_student_verified %} {% endif %}
{{ seller_name }} {{ premium_badge(seller, 'Premium Seller', 'sm') }}
{{ 'Verified student' if seller.is_student_verified else 'Student' }}
View Profile
{# Seller reputation — cached values only (no AVG/COUNT at render). #} {{ rep_detail(seller_reputation) }} {# All earned trust badges (auto-derived from cached reputation). #} {{ trust_badges(seller_badges) }}
Member since {{ seller.created_at.strftime('%b %Y') }}
Status {{ 'Verified' if seller.is_student_verified else 'Active' }}
Safe Buying Tips

Meet in public campus areas, inspect items before payment, and keep the whole conversation on CampusCart until you're ready.

{% if related %} {% endif %}
{# ---- Report Listing modal ---- #} {% if can_report and not already_reported and report_form %} {% endif %} {# ---- Delete confirmation modal (owner only) ---- #} {% if is_owner %} {% include "components/delete_listing_modal.html" %} {% endif %} {# ---- Complete Transaction confirmation (owner, reserved listing) ---- #} {% if is_owner and listing.status.value == 'reserved' %} {% endif %} {% endblock %}