@extends('admin.layouts.app') @section('title', admin_trans('offers')) @section('page-title', admin_trans('offers')) @section('content')
@foreach(request()->except(['search', 'page']) as $key => $value) @if(is_array($value)) @foreach($value as $v) @endforeach @else @endif @endforeach
{{ admin_trans('add_offer') }}

{{ admin_trans('filters') }}

@if(request('search'))@endif @if($currentCountry && $availableLocales->count() > 1)
@endif
@if($availableStores->count() > 0) @php $storesArray = $availableStores->map(function($countryStore) { $translation = $countryStore->store->translations->first(); return [ 'id' => $countryStore->store_id, 'name' => $translation->name ?? 'Store #' . $countryStore->store_id ]; })->toArray(); @endphp @endif @if($brands->count() > 0) @php $brandsArray = $brands->map(function($brand) { $translation = $brand->translations->first(); return [ 'id' => $brand->id, 'name' => $translation->name ?? 'Brand #' . $brand->id ]; })->toArray(); @endphp @endif @if($categories->count() > 0) @php $categoriesArray = $categories->map(function($category) { $translation = $category->translations->first(); return [ 'id' => $category->id, 'name' => $translation->name ?? 'Category #' . $category->id ]; })->toArray(); @endphp @endif
{{ admin_trans('apply_filters') }}
@if(request()->hasAny(['search', 'locale_id', 'status', 'type', 'store_id', 'brand_id', 'category_id', 'featured', 'expiry', 'date_from', 'date_to', 'sort']))
{{ admin_trans('clear_all_filters') }}
@endif
{{ admin_trans('activate') }} {{ admin_trans('deactivate') }} {{ admin_trans('feature') }} {{ admin_trans('unfeature') }} {{ admin_trans('expire') }} {{ admin_trans('delete') }} {{ admin_trans('clear') }}
@if ($offers->isEmpty()) @if($currentCountry) {{ admin_trans('add_offer') }} @else

{{ admin_trans('use_country_filter_navbar') }}

@endif @else @foreach ($offers as $offer) @php $translation = $offer->translations->first(); $storeTranslation = $offer->countryStore->store->translations->first(); @endphp @if ($offer->getFirstMediaUrl('images')) Offer @else
@endif
{{ $translation->title ?? 'Offer #' . $offer->id }}
@if($offer->is_exclusive) {{ admin_trans('exclusive') }} @endif @if($offer->is_free_shipping) {{ admin_trans('free_shipping') }} @endif @if($offer->is_new_customer) {{ admin_trans('new_customer') }} @endif
@if($offer->code)
{{ admin_trans('code') }}: {{ $offer->code }}
@endif @if ($translation && $translation->description)
{{ Str::limit(strip_tags($translation->description), 60) }}
@endif
{{ $storeTranslation->name ?? 'Store #' . $offer->countryStore->store_id }}
@if($offer->brand) @php $brandTranslation = $offer->brand->translations->first(); @endphp
{{ $brandTranslation->name ?? 'Brand #' . $offer->brand_id }}
@endif
{{ admin_trans($offer->type) }}
@if($offer->discount_value)
{{ $offer->discount_value }}%
@endif @if($offer->promotion_value)
@if($offer->promotion_type === 'monetary') {{ $offer->promotion_value }} {{ $offer->currency }} @elseif($offer->promotion_type === 'percent') {{ $offer->promotion_value }}% @elseif(in_array($offer->promotion_type, ['upto_monetary', 'upto_percent'])) {{ admin_trans('up_to') }} {{ $offer->promotion_value }} @endif
@endif @if($offer->regular_price && $offer->sale_price)
{{ $offer->regular_price }} → {{ $offer->sale_price }}
@endif
{{ $offer->favorites_count ?? 0 }}
{{ $offer->views_count ?? 0 }}
{{ $offer->uses_count ?? 0 }}
@if($offer->expires_at) @php $expiryDate = \Carbon\Carbon::parse($offer->expires_at); $isExpired = $expiryDate->isPast(); $isExpiringSoon = $expiryDate->diffInDays(now()) <= 7 && !$isExpired; @endphp
{{ $expiryDate->format('d/m/Y') }}
@if($isExpired) {{ admin_trans('expired') }} @elseif($isExpiringSoon) {{ admin_trans('expires_soon') }} @else {{ $expiryDate->diffForHumans() }} @endif
@else
{{ admin_trans('no_expiry') }}
@endif
@csrf @method('PATCH')
@csrf @method('PATCH')
@endforeach
@if ($offers->hasPages())
@endif @endif

{{ admin_trans('offer_statistics') }}

{{ admin_trans('favorites') }}

{{ admin_trans('views') }}

{{ admin_trans('uses') }}

{{ admin_trans('impressions') }}

{{ admin_trans('popularity_score') }}

{{ admin_trans('saving_percentage') }}

%

{{ admin_trans('created_at') }}

{{ admin_trans('expires_at') }}

{{ admin_trans('last_usage') }}

@endsection @push('scripts') @endpush