{% import 'macro/accordion.html' as accordion %}
{% import 'macro/badge.html' as badge %}
{% import 'macro/card.html' as card %}
{% import 'macro/form.html' as form %}
{# Render badges in configured order based on context (grid view vs detail view) #}
{{ badge.render_ordered_badges(item, brickset_tags, brickset_owners, brickset_storages, brickset_purchase_locations, solo=solo, last=last, context='detail' if solo else 'grid') }}
{# Show notes based on context and config #}
{% if item.fields.description and item.fields.description | trim %}
{% if (solo and config['SHOW_NOTES_DETAIL']) or (not solo and config['SHOW_NOTES_GRID']) %}
{{ item.fields.description }}
{% endif %}
{% endif %}
{% if not tiny and brickset_statuses | length %}
{% for status in brickset_statuses %}
{% if item.fields.instance_count is defined and item.fields.instance_count > 1 %}
{# Consolidated set - show mixed status indicator #}
{% set status_count = item.fields[status.as_column() + '_count'] %}
{% set total_count = item.fields.instance_count %}
{% if status_count == 0 %}
{# None checked #}
{% elif status_count == total_count %}
{# All checked #}
{% else %}
{# Partial - some checked #}
{% endif %}
{% else %}
{# Individual set - use normal checkbox #}
{{ form.checkbox(status.fields.name, item.fields.id, status.as_dataset(), status.url_for_set_state(item.fields.id), item.fields[status.as_column()], parent='set', delete=delete) }}
{% endif %}
{% endfor %}
{% endif %}
{% if solo %}
{% if not delete %}
{% if not config['HIDE_SET_INSTRUCTIONS'] %}
{{ accordion.header('Instructions', 'instructions', 'set-details', expanded=open_instructions, quantity=item.instructions | length, icon='file-line', class='p-0') }}
{% if item.instructions | length %}
{% for instruction in item.instructions %}
{{ instruction.filename }}
{% endfor %}
{% else %}
No instructions file found.
{% if g.login.is_authenticated() %}
Upload an instructions file
{% endif %}
{% endif %}
{% if g.login.is_authenticated() %}
Download instructions
{% endif %}