{% extends "admin/base.html" %} {% block title %}{{ 'Edit' if listing else 'Create' }} Listing | Admin{% endblock %} {% block content %}

Inventory

{{ 'Edit Listing' if listing else 'Create Listing' }}

{% if listing %}

{{ listing.public_stock_number or listing.stock_number }} / {{ listing.title_en }}

{% endif %}
Back to Listings {% if listing and listing.is_published %} View Listing {% endif %}

English Content

{% if listing %} {% endif %}
{% if listing %}

Trust & Inventory

Location and Verification

Last checked: {{ listing.last_listing_verified_date or 'Not verified' }}

Workbench

AI and Gallery Tools

Keep the main content above clean; manage generated text, previews, and gallery rows here.

AI Listing Content

Generate text from stored listing facts only. Prices are excluded.

{% if not ai_status.enabled %}Disabled{% elif not ai_status.active_configured %}Key missing{% else %}{{ ai_status.provider|title }} ready{% endif %}
AI Dashboard

AI Sign / Logo Edit

Select image rows below, add notes, then generate previews.

{{ "OpenAI key ready" if openai_key.configured else "OpenAI key missing" }}
Selected 0 images
{% if listing %}

Mechanical Inspection

Inspection Report

AI-generates a powertrain-specific inspection report from this listing's specs; the shop reviews, approves & stamps (or revokes) via the shop portal.

{% if inspection_report %} {% set ist = inspection_report.status %} {% if ist == 'approved' %}Approved {% elif ist == 'pending' %}Pending shop review {% elif ist == 'changes_requested' %}Changes requested {% elif ist == 'revoked' %}Revoked{% endif %} {{ inspection_report.powertrain_type }} {% else %} No report yet {% endif %}
{% if inspection_report %}
Public link

{% if inspection_report.status == 'approved' %}Live on the listing page (Inspection button).{% else %}Visible to customers once the shop approves.{% endif %}

Shop review link

Send this portal URL to the shop (one link for all reports).

{% set data = inspection_data %} {% include "partials/inspection_section_editor.html" %}
{% endif %}
{% endif %} {% if pending_ai_edits %}

AI Edit Previews

Review generated outputs before replacing originals or adding angles to the gallery.

{{ pending_ai_edits|length }} pending
{% for edit in pending_ai_edits %}

Preview #{{ edit.id }}

{{ "Additional angle" if edit.edit_kind == 'angle' else "Replacement edit" }}

Image order {{ edit.sort_order or "unknown" }} | Source image ID {{ edit.source_image_id }} | Created {{ (edit.created_at or "")|replace("T", " ") }}

{% if edit.prompt %}

Request: {{ edit.prompt }}

{% endif %}
Edit again
{% endfor %}
{% endif %}

Gallery Images

Use rows for daily work: drag to reorder, tick rows for AI edits or deletion, and open advanced controls only when needed.

{{ images|length }} images
{% for image in images %} {% set image_src = get_image_display_path(image) %} {% set original_src = get_original_image_display_path(image) %}
Drag
{{ 'Primary' if image.is_primary else 'Secondary' }} {{ "Public" if image.is_public else "Hidden" }} {% if image.generated_local_path %} {{ "Using AI" if image.use_generated_image else "AI saved" }} {% endif %} {% if image.is_ai_generated %} AI angle {% endif %}

{{ image.alt_text or listing.title_en }}

{% if image.generated_local_path %}
{% endif %}
Details (move, AI angles, paths)

Generate angles from this image

0 selected

Choose up to 3 angles. You can start another image while this one runs.

{% for angle in angle_choices %} {% endfor %}

Ready. No angles run until you select them here.

Paths

Original local: {{ image.local_path }}

Displayed: {{ image_src }}

Generated: {{ image.generated_local_path or "None" }}

Remote: {{ image.image_url }}

OpenAI file: {{ image.openai_file_id or "Not cached" }}

{% else %}

No images are attached to this listing yet.

{% endfor %}
{% endif %} {% endblock %}