@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
@csrf @unless ($isNew) @method('PUT') @endunless

{{ __('The basics') }}

{{ __('Price') }}

@error('price')

{{ $message }}

@enderror
{{-- A period only means anything for a recurring intent. --}}
{{-- The dynamic half. Every field below comes from the category's attribute bindings — nothing here is named in this template. --}} @foreach ($attributeGroups as $groupName => $groupAttributes)

{{ $groupName }}

@foreach ($groupAttributes as $attribute) @include('account.listings.partials.attribute-field', [ 'attribute' => $attribute, 'value' => old('attributes.'.$attribute->code, $answers[$attribute->code] ?? null), ]) @endforeach
@endforeach

{{ __('Where it is') }}

{{ __('Who buyers contact') }}

{{ __('Leave blank to use the details on your seller profile.') }}

@unless ($isNew) {{ __('Photographs & files') }} @endunless {{ __('Cancel') }}
{{-- 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)
@csrf
@endforeach
@endif @endif @endsection