@extends('layouts.account')
@php
$isNew = ! $listing->exists;
$answers = $listing->exists ? $listing->specificationValues() : [];
@endphp
@section('title', $isNew ? __('Create a listing') : $listing->title)
@section('heading', $isNew ? __('Create a listing') : __('Edit listing'))
@section('subheading', $isNew
? __('Choose a category first — it decides what else we ask for.')
: $listing->reference.' · '.$listing->status->label())
@section('account')
@if (session('error'))
{{ session('error') }}
@endif
@if (! $isNew && $listing->status === \App\Enums\ListingStatus::Rejected && $listing->rejection_reason)
{{ $listing->rejection_reason }}
@endif
@if (! $isNew && ! $listing->isEditable())
{{ __('It is with our team for review. You can edit it again once a decision is made.') }}
@endif
{{--
The category is chosen before anything else, because it decides which
fields exist. Changing it reloads the form rather than guessing — the
attribute set is server-owned, and a client-side guess would drift.
--}}
@if ($isNew && ! $category)
{{ __('What are you listing?') }}
{{ __('Pick the closest category. It decides which details buyers can filter on.') }}
@else
{{-- Status actions are a separate form: editing and publishing are
different decisions and must not share a submit button. --}}
@if (! $isNew && $transitions)
{{ __('Status') }}
{{ $listing->status->description() }}
@foreach ($transitions as $target)
@endforeach
@endif
@endif
@endsection