{# Chat button (both roles) — other user is the opposite of current role #}
{% set other_id = order.buyer_id if is_seller else product.seller_id %}
Chat
{# Seller actions #}
{% if is_seller %}
{% if order.status == 'pending' %}
{% endif %}
{% endif %}
{# Complete (both parties can do it) #}
{% if order.status == 'confirmed' %}
{% endif %}
{# Cancel (buyer) #}
{% if not is_seller and order.status in ('pending', 'confirmed') %}
{% endif %}
{# Leave review (buyer, completed, no review yet) #}
{% if not is_seller and order.status == 'completed' and not order.review %}
Review
{% endif %}
{# Already reviewed #}
{% if not is_seller and order.review %}
Edit review
{% endif %}
{% endfor %}
{% else %}
{{ empty_state(
icon='shopping-bag',
title='No orders yet',
message='Browse the marketplace to find something you like.' if tab == 'buying' else 'No incoming orders — list something to start selling.',
cta_url=url_for('main.index') if tab == 'buying' else url_for('products.publish'),
cta_text='Browse items' if tab == 'buying' else 'List an item'
) }}
{% endif %}