@extends('admin.layouts.app') @section('title', 'Products') @section('page_title', 'Products') @section('content')

Manage Products

Review, approve, renew, update status or remove marketplace listings.

{{-- SUCCESS MESSAGE --}} @if(session('success'))
{{ session('success') }}
@endif {{-- FILTERS --}}
{{-- PRODUCTS TABLE --}}
@forelse($products as $product) @php /* |-------------------------------------------------------------------------- | PRODUCT IMAGE |-------------------------------------------------------------------------- */ $images = is_array($product->images) ? $product->images : json_decode($product->images ?? '[]', true); $firstImage = is_array($images) ? ($images[0] ?? null) : null; /* |-------------------------------------------------------------------------- | EXPIRATION SYSTEM |-------------------------------------------------------------------------- */ $expiresAt = $product->expires_at; /* * Product is expired when: * * is_active = false * * OR * * expires_at does not exist * * OR * * current date >= expires_at */ $isExpired = !$product->is_active || !$expiresAt || now()->greaterThanOrEqualTo($expiresAt); /* |-------------------------------------------------------------------------- | DAYS LEFT |-------------------------------------------------------------------------- */ $daysLeft = $expiresAt && !$isExpired ? max( 0, (int) ceil( now()->diffInHours($expiresAt, false) / 24 ) ) : 0; /* |-------------------------------------------------------------------------- | PRICE |-------------------------------------------------------------------------- */ $displayPrice = $product->discount_price ?: $product->price; @endphp {{-- PRODUCT --}} {{-- SELLER --}} {{-- PRICE --}} {{-- APPROVAL --}} {{-- LISTING TIME --}} {{-- PRODUCT STATUS --}} {{-- ACTIONS --}} @empty @endforelse
Product Seller Price Approval Listing Time Status Actions
@if($firstImage) {{ $product->title }} @else
P
@endif
{{ \Illuminate\Support\Str::limit($product->title, 32) }}
{{ $product->category ?: 'No category' }}
{{ optional($product->user)->name ?: 'Deleted user' }}
{{ optional($product->user)->email }}
${{ number_format($displayPrice, 2) }} @if( $product->discount_price && $product->price && $product->discount_price < $product->price )
${{ number_format($product->price, 2) }}
@endif
@if($product->is_approved) Approved @else Pending @endif @if($isExpired) Expired @if($expiresAt)
Expired: {{ $expiresAt->format('M d, Y') }}
@else
No expiration date
@endif @else {{ $daysLeft }} days left
Until {{ $expiresAt->format('M d, Y') }}
@endif
@if($isExpired) Expired @elseif($product->status === 'sold') Sold @else Active @endif
{{-- VIEW --}} View {{-- APPROVE / UNAPPROVE --}}
@csrf @method('PATCH')
{{-- SOLD / AVAILABLE --}}
@csrf @method('PATCH')
{{-- ========================================================= --}} {{-- ADMIN FREE 15 DAY RENEWAL --}} {{-- ========================================================= --}} @if($isExpired)
@csrf @method('PATCH')
@endif {{-- DELETE --}}
@csrf @method('DELETE')
No products found.
{{-- PAGINATION --}}
{{ $products->links() }}
@endsection