@extends('admin.layouts.app') @section('title', isset($offer) ? admin_trans('edit_offer') : admin_trans('add_offer')) @section('page-title', isset($offer) ? admin_trans('edit_offer') : admin_trans('add_offer')) @section('content')
{{ admin_trans('back_to_offers') }}

{{ isset($offer) ? admin_trans('edit_offer') : admin_trans('add_offer') }}

@if(isset($offer))

{{ admin_trans('offer_id') }}: #{{ $offer->id }}

@endif
@if(!$currentCountry)

{{ admin_trans('no_country_selected') }}

{{ admin_trans('select_country_to_manage_offers') }}

@else
{{ $currentCountry->flag_emoji }}

{{ isset($offer) ? admin_trans('editing_offer_for') : admin_trans('creating_offer_for') }}

{{ $currentCountry->getName() }}

@csrf @if(isset($offer)) @method('PUT') @endif
@php $storesArray = $availableStores->map(function($countryStore) { $translation = $countryStore->store->translations->first(); return [ 'id' => $countryStore->id, 'name' => $translation->name ?? 'Store #' . $countryStore->store_id ]; })->toArray(); $selectedStore = isset($offer) ? $offer->country_store_id : old('country_store_id'); @endphp
@php $brandsArray = $brands->map(function($brand) { $translation = $brand->translations->first(); return [ 'id' => $brand->id, 'name' => $translation->name ?? 'Brand #' . $brand->id ]; })->toArray(); $selectedBrand = isset($offer) ? $offer->brand_id : old('brand_id'); @endphp
@if($availableLocales->count() > 0)
@foreach($availableLocales as $locale) @endforeach
@foreach($availableLocales as $locale) @php $translation = isset($offer) ? $offer->translations->where('locale_id', $locale->id)->first() : null; @endphp
direction === 'rtl') dir="rtl" @endif> {{-- Offer Title --}} {{-- FIXED: Offer Description with Enhanced RTL Dark Mode Support --}} @if($loop->first) {{ admin_trans('offer_description') }} @endif {{-- Final URL --}}
@endforeach
@endif
@if($categories->count() > 0)
@foreach($categories as $category) @php $categoryTranslation = $category->translations->first(); $categoryName = $categoryTranslation->name ?? 'Category #' . $category->id; $isSelected = isset($offer) ? $offer->categories->contains($category->id) : false; @endphp @endforeach
@endif @if($occasions->count() > 0)
@foreach($occasions as $occasion) @php $occasionTranslation = $occasion->translations->first(); $occasionName = $occasionTranslation->name ?? 'Occasion #' . $occasion->id; $isSelected = isset($offer) ? $offer->occasions->contains($occasion->id) : false; @endphp @endforeach
@endif
@if(isset($offer) && $offer->getMedia('images')->count() > 0)

{{ admin_trans('current_images') }}

@foreach($offer->getMedia('images') as $media)
Offer Image
@endforeach
@endif
{{ admin_trans('cancel') }} {{ isset($offer) ? admin_trans('update_offer') : admin_trans('create_offer') }}
@endif
@endsection @push('scripts') @endpush