{% extends "base.html" %} {% block title %}Import — {{ line_data.get('product_name', 'Garment') }}{% endblock %} {% block styles %} {% endblock %} {# ── Classification → base_category map for JS style switching ── #} {% block content %}

Import

← Queue
{# ── Left: email sidebar ── #}
Orders {% for q in queue_rows if q.status != 'unimplemented' %} {% endfor %}
{# ── Centre: garment form ── #}
{# Order line pills #} {% if scraped_lines | length > 1 %}
{% for line in scraped_lines %} {% set is_imported = loop.index0 in imported_lines %} {% set is_excluded = loop.index0 in excluded_lines %} {% set has_error = line.get('scrape_error') and not line.get('product') %} {{ line.get('product_name', 'Item ' ~ loop.index) | truncate(28, true, '…') }} {% endfor %}
{% endif %} {# Scrape status notice #} {% if scrape_status == 'success' and product %}
Product data scraped successfully.
{% elif scrape_status == 'error' or (line_data.get('scrape_error') and not product) %}
Product page unavailable: {{ line_data.get('scrape_error', 'scrape failed') }}. Form pre-filled from email data only.
{% else %}
Product page not yet scraped.
{% endif %}
{% set colour = product.get('colour') or (line_data.get('raw', {}).get('colour', '').split('/')[0].strip() if line_data.get('raw') else '') %} {% set colour_sec = product.get('colour_secondary') or '' %} {% for c in colours %}
£
{% set mats = product.get('materials', []) %} {% if mats %} {% for mat in mats %} {% set name = mat[0] if mat is sequence and mat | length == 2 else mat.get('name', '') %} {% set pct = mat[1] if mat is sequence and mat | length == 2 else mat.get('percentage', '') %}
{% endfor %} {% else %}
{% endif %}
{% for m in material_names %}
{# ── Style fields — shown/hidden by classification ── #} {# /style-section #} {# Hidden image URL inputs — synced from thumbnail selection #}
{% for img in product.get('images', []) %} {% endfor %}
{% if product.get('url') %}
↗ {{ product.url | truncate(60, true, '…') }}
{% endif %} {# Set toggle #}
{# Set panel #}
{% if line_idx in imported_lines %} Already imported {% elif line_idx in excluded_lines %} Excluded {% else %} {% endif %}
{# ── Right: images ── #}

Images

{% set images = product.get('images', []) %} {% if images %} {% for img in images %} {% set url = img.url if img is mapping else img %}
Image {{ loop.index }}
{% endfor %} {% else %}

{% if line_data.get('scrape_error') %}Not available — page scrape failed. {% else %}No images found.{% endif %}

{% endif %}
{% endblock %} {% block scripts %} {% endblock %}