{% extends "base.html" %} {% block title %}{{ listing.title }} · Messages{% endblock %} {% block content %}
{# Negotiation summary — relocated from the sidebar to the top of the conversation. Pinned above the scrolling messages; same logic/links. #} {% set latest_offer = (conversation.offers|sort(attribute='created_at', reverse=true)|first) if conversation and conversation.offers else none %}
Active Negotiation
{% if latest_offer %}
Current Offer ₹{{ "{:,.2f}".format(latest_offer.amount) }}
Status {{ latest_offer.status.value|title }}
Last Updated
Open Negotiation {% elif conversation %}

No offer yet — start bargaining by sending an offer.

Open Negotiation {% else %}

No offer yet — make an offer to begin bargaining.

Open Negotiation {% endif %}
{% include "chat/_conversation_timeline.html" %}
{% if is_closed %}
This conversation is closed.
{% elif messaging_state and messaging_state.limit_reached %} {% include "advertisements/_ad_rewarded.html" %} {% else %} {% if messaging_state and messaging_state.counting_active and not messaging_state.premium %}

Messages remaining: {{ messaging_state.total_remaining }} / {{ messaging_state.allowance }} Premium members chat without limits

{% if messaging_state.can_watch_ad %} {# Opens the rewarded-ad modal; the reward is granted only after the simulated ad completes and the user presses Continue. A future cooldown (config REWARDED_AD_COOLDOWN_SECONDS > 0) swaps the button for the countdown chip via JS. #} {% endif %}
{# Temporary reward banner: a reused static node (hidden by default). After a reward is claimed, initRewardExtras() reveals it from the persisted signal, holds it ~4.5s, then slides it away and sets it hidden — reclaiming the space so the chat returns to full height. No permanent "Latest Reward" card, so history is never shrunk. #} {% endif %}
{{ form.hidden_tag() }}
{{ form.message(class="ct-composer-input", rows="1", placeholder="Type your message…", aria_label="Message", **{"data-emoji-target": ""}) }}

Keep the conversation on CampusCart for campus safety.

{% endif %}
{# Rewarded-advertisement modal — one instance, shared by every Watch Ad trigger in this thread (inline composer notice + limit-reached card). #} {% if not is_closed and conversation and messaging_state and messaging_state.can_watch_ad %} {% include "advertisements/_rewarded_ad_modal.html" %} {% endif %} {# Reward-claim feedback (shown once, on the reload after a reward is claimed). Reused static nodes — JS toggles them; no elements are created at runtime. #} {% if conversation %} {% endif %} {% endblock %}