@extends('layouts.app') @section('title', 'Deals of the Day') @section('content')

Deals of the Day


Active deals

Products currently in a deal, with countdown until prices are restored.

@if($activeDeals->isEmpty())

No active deals.

@else
@foreach($activeDeals as $deal) @foreach($deal->dealProducts as $dp) @endforeach @endforeach
Image Product Deal applied Compare discount Time left Actions
@if($dp->image_url) @else @endif {{ $dp->title }} @if($deal->profit_type === 'percentage') {{ number_format($deal->profit_value, 0) }}% profit @else ${{ number_format($deal->profit_value, 2) }} profit @endif
Cost {{ $dp->cost !== null ? '$' . number_format($dp->cost, 2) : '—' }}
Sale ${{ number_format($dp->deal_price, 2) }}
{{ number_format($deal->compare_discount_percent ?? 0, 0) }}% off -- @if($loop->first && Route::has('deals.edit')) Edit
@csrf @method('DELETE')
@elseif($loop->first) — @else — @endif
@endif

Recent deals

Last 10 deals. Finished deals cannot be edited or deleted; create a new deal instead.

@if($deals->isEmpty())

No deals yet.

@else
@foreach($deals as $deal) @php $first = $deal->dealProducts->first(); $isFinished = $deal->restored || ($deal->ends_at && $deal->ends_at->isPast()); @endphp @endforeach
Deal # Image Product Starts Ends Status Actions
#{{ $deal->id }} @if($first && $first->image_url) @else @endif @if($first) {{ $first->title }} @if($deal->dealProducts->count() > 1)
+{{ $deal->dealProducts->count() - 1 }} more @endif @else — @endif
{{ $deal->starts_at ? $deal->starts_at->copy()->timezone(config('app.deals_display_timezone', 'America/New_York'))->format('m/d/Y g:i A') : '—' }} {{ $deal->ends_at ? $deal->ends_at->copy()->timezone(config('app.deals_display_timezone', 'America/New_York'))->format('m/d/Y g:i A') : '—' }} @if($isFinished) Finished @else Running @endif @if(!$isFinished && Route::has('deals.edit')) Edit
@csrf @method('DELETE')
@else @endif
{{ $deals->links('vendor.pagination.simple-default') }} @endif @push('scripts') @endpush @endsection