2026-02-06 14:56:56 +02:00
@ extends ( 'layouts.app' )
@ section ( 'content' )
2026-02-14 16:11:09 +02:00
< div class = "max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12" >
<!-- Header -->
< div class = "mb-8" >
2026-10-17 16:24:26 +03:00
< h1 class = "text-3xl font-bold text-gray-900 dark:text-white" > Product Management </ h1 >
< p class = "mt-2 text-sm text-gray-600 dark:text-gray-400" > Review and manage submitted products </ p >
2026-02-14 16:11:09 +02:00
</ div >
2026-02-06 14:56:56 +02:00
2026-02-14 16:11:09 +02:00
<!-- Status Filter -->
2026-10-17 16:24:26 +03:00
< div class = "bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 mb-6" >
2026-02-14 16:11:09 +02:00
< div class = "px-6 py-4" >
2026-10-17 16:24:26 +03:00
< h2 class = "text-lg font-medium text-gray-900 dark:text-white mb-4" > Filter by Status </ h2 >
2026-02-14 16:11:09 +02:00
< div class = "flex flex-wrap gap-3" >
< a href = "{{ route('products.manage') }}"
2026-10-17 16:24:26 +03:00
class = "inline-flex items-center px-4 py-2 rounded-md text-sm font-medium {{ !request('status') || request('status') == 'pending' ? 'bg-yellow-100 dark:bg-yellow-900/30 text-yellow-800 dark:text-yellow-200 ring-2 ring-yellow-600' : 'bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 ring-1 ring-gray-300 dark:ring-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700' }}" >
2026-02-14 16:11:09 +02:00
< svg class = "mr-2 h-5 w-5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" ></ path >
</ svg >
Pending
< span class = "ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium {{ !request('status') || request('status') == 'pending' ? 'bg-yellow-200 text-yellow-800' : 'bg-gray-200 text-gray-700' }}" >
{{ $statusCounts [ 'pending' ] }}
</ span >
</ a >
2026-02-06 14:56:56 +02:00
2026-02-14 16:11:09 +02:00
< a href = "{{ route('products.manage', ['status' => 'approved']) }}"
2026-10-17 16:24:26 +03:00
class = "inline-flex items-center px-4 py-2 rounded-md text-sm font-medium {{ request('status') == 'approved' ? 'bg-green-100 dark:bg-green-900/30 text-green-800 dark:text-green-200 ring-2 ring-green-600' : 'bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 ring-1 ring-gray-300 dark:ring-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700' }}" >
2026-02-14 16:11:09 +02:00
< svg class = "mr-2 h-5 w-5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" ></ path >
</ svg >
Approved
< span class = "ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium {{ request('status') == 'approved' ? 'bg-green-200 text-green-800' : 'bg-gray-200 text-gray-700' }}" >
{{ $statusCounts [ 'approved' ] }}
</ span >
</ a >
2026-02-06 14:56:56 +02:00
2026-02-14 16:11:09 +02:00
< a href = "{{ route('products.manage', ['status' => 'rejected']) }}"
2026-10-17 16:24:26 +03:00
class = "inline-flex items-center px-4 py-2 rounded-md text-sm font-medium {{ request('status') == 'rejected' ? 'bg-red-100 dark:bg-red-900/30 text-red-800 dark:text-red-200 ring-2 ring-red-600' : 'bg-white dark:bg-gray-800 text-gray-700 dark:text-gray-300 ring-1 ring-gray-300 dark:ring-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700' }}" >
2026-02-14 16:11:09 +02:00
< svg class = "mr-2 h-5 w-5" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M10 14l2-2m0 0l2-2m-2 2l-2-2m2 2l2 2m7-2a9 9 0 11-18 0 9 9 0 0118 0z" ></ path >
</ svg >
Rejected
< span class = "ml-2 inline-flex items-center px-2.5 py-0.5 rounded-full text-xs font-medium {{ request('status') == 'rejected' ? 'bg-red-200 text-red-800' : 'bg-gray-200 text-gray-700' }}" >
{{ $statusCounts [ 'rejected' ] }}
</ span >
</ a >
2026-02-06 14:56:56 +02:00
</ div >
</ div >
</ div >
2026-02-14 16:11:09 +02:00
<!-- Products List -->
@ if ( $products -> count () > 0 )
< div class = "space-y-4" >
@ foreach ( $products as $product )
2026-10-17 16:24:26 +03:00
< div class = "bg-white dark:bg-gray-800 rounded-lg shadow-sm border border-gray-200 dark:border-gray-700 overflow-hidden hover:shadow-md transition-shadow" >
2026-02-14 16:11:09 +02:00
< div class = "p-6" >
< div class = "flex items-start gap-4" >
<!-- Thumbnail -->
< div class = "flex-shrink-0" >
@ if ( $product -> thumbnail_url )
< img src = "{{ $product->thumbnail_url }}"
alt = "{{ $product->title }}"
2026-10-17 16:24:26 +03:00
class = "w-20 h-20 rounded-lg object-cover border border-gray-200 dark:border-gray-700" >
2026-02-14 16:11:09 +02:00
@ else
2026-10-17 16:24:26 +03:00
< div class = "w-20 h-20 rounded-lg bg-gradient-to-br from-gray-100 to-gray-200 flex items-center justify-center border border-gray-200 dark:border-gray-700" >
< svg class = "h-8 w-8 text-gray-400 dark:text-gray-500" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
2026-02-14 16:11:09 +02:00
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" ></ path >
</ svg >
</ div >
@ endif
</ div >
<!-- Content -->
< div class = "flex-1 min-w-0" >
< div class = "flex items-start justify-between" >
< div class = "flex-1" >
2026-10-17 16:24:26 +03:00
< h3 class = "text-lg font-semibold text-gray-900 dark:text-white" >
2026-02-14 16:11:09 +02:00
< a href = "{{ route('products.show', $product ) }}" class = "hover:text-primary-600" >
{{ $product -> title }}
</ a >
</ h3 >
2026-10-17 16:24:26 +03:00
< p class = "mt-1 text-sm text-gray-600 dark:text-gray-400 line-clamp-2" > {{ $product -> description }} </ p >
2026-02-14 16:11:09 +02:00
< div class = "mt-3 flex flex-wrap items-center gap-4 text-sm" >
2026-10-17 16:24:26 +03:00
< span class = "inline-flex items-center px-2.5 py-0.5 rounded-md bg-primary-100 dark:bg-primary-900 text-primary-800 dark:text-primary-200 font-medium" >
2026-02-14 16:11:09 +02:00
{{ $product -> category -> name }}
</ span >
2026-10-17 16:24:26 +03:00
< span class = "inline-flex items-center text-gray-500 dark:text-gray-400" >
2026-02-14 16:11:09 +02:00
< svg class = "mr-1.5 h-4 w-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" ></ path >
</ svg >
< a href = "{{ route('profile.show', $product->user ) }}" class = "hover:text-primary-600" >
{{ $product -> user -> name }}
</ a >
</ span >
2026-10-17 16:24:26 +03:00
< span class = "inline-flex items-center text-gray-500 dark:text-gray-400" >
2026-02-14 16:11:09 +02:00
< svg class = "mr-1.5 h-4 w-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M8 7V3m8 4V3m-9 8h10M5 21h14a2 2 0 002-2V7a2 2 0 00-2-2H5a2 2 0 00-2 2v12a2 2 0 002 2z" ></ path >
</ svg >
{{ $product -> created_at -> format ( 'M j, Y' ) }}
</ span >
2026-10-17 16:24:26 +03:00
< span class = "text-gray-400 dark:text-gray-500" > • </ span >
< span class = "text-gray-500 dark:text-gray-400" > {{ $product -> created_at -> diffForHumans () }} </ span >
2026-02-14 16:11:09 +02:00
</ div >
</ div >
<!-- Status Badge -->
< div class = "ml-4 flex-shrink-0" >
@ if ( $product -> isPending ())
2026-10-17 16:24:26 +03:00
< span class = "inline-flex items-center px-3 py-1 rounded-md text-sm font-medium bg-yellow-100 text-yellow-800 dark:text-yellow-200" >
2026-02-14 16:11:09 +02:00
Pending
</ span >
@ elseif ( $product -> isApproved ())
2026-10-17 16:24:26 +03:00
< span class = "inline-flex items-center px-3 py-1 rounded-md text-sm font-medium bg-green-100 text-green-800 dark:text-green-200" >
2026-02-14 16:11:09 +02:00
Approved
</ span >
@ elseif ( $product -> isRejected ())
2026-10-17 16:24:26 +03:00
< span class = "inline-flex items-center px-3 py-1 rounded-md text-sm font-medium bg-red-100 text-red-800 dark:text-red-200" >
2026-02-14 16:11:09 +02:00
Rejected
</ span >
@ endif
</ div >
</ div >
<!-- Actions -->
< div class = "mt-4 flex items-center gap-2" >
@ if ( $product -> isPending () || $product -> isRejected ())
< form action = "{{ route('products.approve', $product ) }}" method = "POST" >
@ csrf
< button type = "submit" class = "inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md text-white bg-green-600 hover:bg-green-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500" >
< svg class = "mr-1.5 h-4 w-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M5 13l4 4L19 7" ></ path >
</ svg >
Approve
</ button >
</ form >
@ endif
@ if ( $product -> isPending () || $product -> isApproved ())
< form action = "{{ route('products.reject', $product ) }}" method = "POST" onsubmit = "return confirm('Are you sure you want to reject this product?');" >
@ csrf
< button type = "submit" class = "inline-flex items-center px-3 py-1.5 border border-transparent text-sm font-medium rounded-md text-white bg-red-600 hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500" >
< svg class = "mr-1.5 h-4 w-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M6 18L18 6M6 6l12 12" ></ path >
</ svg >
Reject
</ button >
</ form >
@ endif
2026-10-17 16:24:26 +03:00
< a href = "{{ route('products.show', $product ) }}" class = "inline-flex items-center px-3 py-1.5 border border-gray-300 dark:border-gray-600 text-sm font-medium rounded-md text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500" >
2026-02-14 16:11:09 +02:00
< svg class = "mr-1.5 h-4 w-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M15 12a3 3 0 11-6 0 3 3 0 016 0z" ></ path >
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" ></ path >
</ svg >
View
</ a >
@ can ( 'edit-product' , $product )
2026-10-17 16:24:26 +03:00
< a href = "{{ route('products.edit', $product ) }}" class = "inline-flex items-center px-3 py-1.5 border border-gray-300 dark:border-gray-600 text-sm font-medium rounded-md text-gray-700 dark:text-gray-300 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary-500" >
2026-02-14 16:11:09 +02:00
< svg class = "mr-1.5 h-4 w-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z" ></ path >
</ svg >
Edit
</ a >
@ endcan
@ can ( 'delete-product' , $product )
< form action = "{{ route('products.destroy', $product ) }}" method = "POST" onsubmit = "return confirm('Are you sure you want to delete this product permanently?');" >
@ csrf
@ method ( 'DELETE' )
2026-10-17 16:24:26 +03:00
< button type = "submit" class = "inline-flex items-center px-3 py-1.5 border border-red-300 dark:border-red-700 text-sm font-medium rounded-md text-red-700 dark:text-red-300 bg-white dark:bg-gray-800 hover:bg-red-50 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-red-500" >
2026-02-14 16:11:09 +02:00
< svg class = "mr-1.5 h-4 w-4" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" ></ path >
</ svg >
Delete
</ button >
</ form >
@ endcan
</ div >
</ div >
</ div >
</ div >
</ div >
@ endforeach
</ div >
<!-- Pagination -->
@ if ( $products -> hasPages ())
< div class = "mt-6" >
{{ $products -> appends ([ 'status' => request ( 'status' )]) -> links () }}
</ div >
@ endif
@ else
2026-10-17 16:24:26 +03:00
< div class = "text-center py-12 bg-gray-50 dark:bg-gray-900 rounded-lg border border-gray-200 dark:border-gray-700" >
< svg class = "mx-auto h-12 w-12 text-gray-400 dark:text-gray-500" fill = "none" stroke = "currentColor" viewBox = "0 0 24 24" >
2026-02-14 16:11:09 +02:00
< path stroke - linecap = "round" stroke - linejoin = "round" stroke - width = "2" d = "M20 13V6a2 2 0 00-2-2H6a2 2 0 00-2 2v7m16 0v5a2 2 0 01-2 2H6a2 2 0 01-2-2v-5m16 0h-2.586a1 1 0 00-.707.293l-2.414 2.414a1 1 0 01-.707.293h-3.172a1 1 0 01-.707-.293l-2.414-2.414A1 1 0 006.586 13H4" ></ path >
</ svg >
2026-10-17 16:24:26 +03:00
< h3 class = "mt-2 text-sm font-medium text-gray-900 dark:text-white" > No products found </ h3 >
< p class = "mt-1 text-sm text-gray-500 dark:text-gray-400" >
2026-02-14 16:11:09 +02:00
No products with status : < strong > {{ request ( 'status' , 'pending' ) }} </ strong >
</ p >
</ div >
@ endif
2026-02-06 14:56:56 +02:00
</ div >
@ endsection