@extends('layouts.main') @section('title') {{ __('Edit Listing') }} @endsection @section('page-title')

@yield('title')

@endsection @php // Shown for modules / categories without an image, or whose image fails to load. $placeholderImage = \App\Services\CachingService::getSystemSettings('placeholder_image') ?: asset('assets/images/logo/placeholder.png'); $itemIsReel = ($item->item_type ?? 'normal') === 'reel'; $itemVideo = $item->itemVideo; $currentVideoType = $itemVideo?->video_type ?? ''; $currentVideoLink = $itemVideo?->video_link ?? ''; $currentVideoFile = $itemVideo?->video_file ?? ''; $currentVideoTypeLabel = match ($currentVideoType) { 'youtube_link' => __('Youtube Link'), 'vimeo_link' => __('Vimeo Link'), 'other_link' => __('Other Link'), 'file' => __('Custom'), default => __('None'), }; $seoData = $seoTranslations ?? []; $translationFor = fn ($langId) => isset($translations) ? ($translations instanceof \Illuminate\Support\Collection ? $translations->get($langId) : ($translations[$langId] ?? null)) : null; // The edit reason is only asked (and required) for another user's listing — as update() checks. $needsEditReason = $item->user_id != auth()->id(); $slugHost = parse_url(\App\Services\CachingService::getSystemSettings('web_url') ?: config('app.url'), PHP_URL_HOST) ?: ''; $wizardSteps = [ ['target' => 'wizard-module', 'label' => __('Module')], ['target' => 'format', 'label' => __('Format')], ['target' => 'categories', 'label' => __('Category')], ['target' => 'listing', 'label' => __('Basic Info')], ['target' => 'custom', 'label' => __('Listing Details'), 'id' => 'custom-tab-item', 'hidden' => true], ['target' => 'seo', 'label' => __('SEO Details')], ['target' => 'images', 'label' => __('Media')], ['target' => 'address', 'label' => __('Location')], ['target' => 'review', 'label' => __('Review')], ]; @endphp @section('content')
@csrf @method('PUT') {{-- Only scopes the category list; an item's module comes from its category. --}} {{-- Selected category path, read by the AI description generator. --}} {{ collect($categoryTrail)->pluck('name')->join(', ') }}
{{-- 1. Module: parent of the ads type and category steps --}} {{-- Not id="module": an element id becomes a global, and select2 / jstree then take window.module for a code module. --}}

{{ __('What are you listing?') }}

{{ __('Choose the appropriate module for your advertisement.') }}

{{ __('Current Modules') }}
@forelse ($modules as $module) @empty

{{ __('No active modules found.') }}

@endforelse
{{-- 2. Format: regular or video (reel) ad --}}

{{ __('Advertisement Format') }}

{{ __('Choose how your listing will be displayed to buyers.') }}

{{-- 3. Category: drill down to a leaf category of the module --}}

{{ __('Select Category') }}

{{ __('Where does this belong in') }} ?

{{ __('Selected') }}:
{{-- 4. Basic Info: title / description (per language), contact, pricing --}}

{{ __('Basic Details') }}

{{ __('The essential information required for every listing.') }}

@if(($geminiAutoTranslateEnabled ?? false) && $languages->count() > 1) @endif {{-- Default language: always required --}}
@if($geminiEnabled ?? false) @endif
{{-- Other languages: title and description only, optional --}} @foreach ($languages as $lang) @if ($lang->id != $defaultLanguage->id) @php $translation = $translationFor($lang->id); @endphp @endif @endforeach
{{-- Options come from the category's module (pricing_modes) — see items/partials/module-rules. --}}
{{-- Visibility / required / labels are set by applyPricingMode() on load. --}}
{{-- 5. Listing Details: the category's custom fields (rendered by loadCustomFields) --}}
{{ __('Select a category to load custom fields.') }}
{{-- 6. SEO Details --}}

{{ __('SEO Details') }}

{{ __('Optimize how your listing appears in search engines.') }}

@if($geminiEnabled ?? false) @endif @foreach ($languages->sortByDesc(fn ($lang) => $lang->id == $defaultLanguage->id) as $lang) @php $isDefaultSeo = $lang->id == $defaultLanguage->id; @endphp @endforeach
{{-- URLs always read LTR, also in RTL layouts (corners fixed in custom.css). --}}
@if ($slugHost) {{ $slugHost }}/ @endif
{{ __('Optional. Lowercase letters, numbers and hyphens; generated when left empty.') }}
{{-- 7. Media --}}

{{ __('Media Upload') }}

{{ __('High-quality images and video increase engagement.') }}

{{-- VIDEO ADS (reel only) --}} @if ($item->reel && $item->reel->video)
@if ($item->reel->thumbnail) @else @endif
{{ __('Current Video Ad') }}
{{ __('Upload below to replace') }}
{{ __('Preview') }}
@endif

{{ __('Drag & Drop your video here') }}

{{ __('or') }}

{{ __('Upload Video') }}
{{ __('Maximum Size') }} : {{ \App\Services\CachingService::getSystemSettings('reel_max_file_size_mb') ?: 50 }} MB {{ __('Recommended Video Ratio') }} : 9:16
{{-- Selected (new) reel file card --}}
{{-- AD IMAGES: existing images + new uploads (first one is the cover) --}} {{-- Existing + new images --}} {{-- Hidden checkboxes: existing images marked for deletion --}}
@foreach ($item->gallery_images as $img) @endforeach
{{-- PRODUCT VIDEO --}}
@include('items.partials.reel-edit-modal')
{{-- 8. Location --}}

{{ __('Select your location') }}

{{ __('Choose where this listing is located.') }}

address) style="display: none;" @endunless>
{{ __('Address') }}

{{ $item->address }}

@if(($mapProvider ?? 'free_api') === 'free_api')
{{ __('Or') }}
@endif {{-- Submitted values --}}
{{-- 9. Review & Publish (read-only summary, filled by renderListingReview) --}}

{{ __('Review & Update') }}

{{ __('Please verify all your changes carefully before updating the listing.') }}

{{ __('Listing Ready') }}

{{ __('Module') }}
{{ __('Ad Format') }}
{{ __('Category') }}
{{ __('Title') }}
{{ __('Description') }}
{{ __('Contact Phone') }}
{{ __('Pricing Model') }}
{{ __('Amount') }}
{{ __('Core Information') }}
{{ __('Additional Details') }}
{{ __('Ad Images') }}
{{ __('Video Ad') }}
{{ __('Product Video') }}
{{ __('Location') }}
{{ __('SEO Status') }}
@if ($needsEditReason) @endif
@if(($geminiEnabled ?? false) && $languages->count() > 1) {{-- Auto Translate Language Picker Modal --}} @endif @if(($mapProvider ?? 'free_api') === 'free_api') @endif {{-- Trim blocking overlay — covers entire page while MediaRecorder is processing --}} {{-- ALL IMAGES MODAL --}} @endsection @section('script') @include('items.partials.module-rules') @endsection