Files
besttechfrom.eu/resources/views/products/index.blade.php
T
2026-02-08 14:13:22 +02:00

202 lines
11 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
@extends('layouts.app')
@php
$title = 'Discover Products - ' . config('app.name');
@endphp
@section('content')
<!-- Hero Section -->
<div class="bg-gradient-to-br from-primary-50 via-white to-accent-50 border-b border-gray-200">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-12 sm:py-16">
<div class="text-center max-w-3xl mx-auto">
<h1 class="text-4xl sm:text-5xl font-bold text-gray-900 mb-4">
Discover the best tech from Europe
</h1>
<p class="text-lg text-gray-600 mb-8">
Find amazing products built by European makers and companies
</p>
<!-- Hero Search -->
<div class="max-w-2xl mx-auto">
<form method="GET" action="{{ route('products.index') }}">
<div class="relative">
<input type="text"
name="search"
value="{{ request('search') }}"
placeholder="Search for products..."
class="w-full px-6 py-4 text-lg border-2 border-gray-300 rounded-full focus:border-primary-500 focus:ring-2 focus:ring-primary-200 transition-all duration-200">
<button type="submit"
class="absolute right-2 top-1/2 -translate-y-1/2 bg-primary-600 text-white px-6 py-2 rounded-full hover:bg-primary-700 transition-colors">
<svg class="h-5 w-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"></path>
</svg>
</button>
</div>
</form>
</div>
</div>
</div>
</div>
<!-- Main Content -->
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<!-- Filters & Sorting -->
<div class="mb-8">
<div class="bg-white rounded-xl shadow-sm border border-gray-200 p-4">
<form method="GET" action="{{ route('products.index') }}" class="space-y-4 lg:space-y-0" x-data="{ showFilters: false }">
<!-- Filter Toggle (Mobile) -->
<div class="lg:hidden">
<button @click="showFilters = !showFilters"
type="button"
class="w-full btn-secondary flex items-center justify-between">
<span>Filters & Sort</span>
<svg class="h-5 w-5" :class="{ 'rotate-180': showFilters }" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7"></path>
</svg>
</button>
</div>
<!-- Filters Grid -->
<div :class="{ 'hidden': !showFilters }"
class="lg:block grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-5 gap-4">
<!-- Search (hidden on desktop as it's in hero) -->
<div class="lg:hidden">
<input type="text"
name="search"
value="{{ request('search') }}"
placeholder="Search..."
class="input">
</div>
<!-- Category Filter -->
<div>
<label for="category" class="block text-sm font-medium text-gray-700 mb-1">Category</label>
<select name="category" id="category" class="input">
<option value="">All Categories</option>
@foreach($categories as $category)
<option value="{{ $category->id }}" {{ request('category') == $category->id ? 'selected' : '' }}>
{{ $category->name }}
</option>
@endforeach
</select>
</div>
<!-- Date Range Filter -->
<div>
<label for="date_range" class="block text-sm font-medium text-gray-700 mb-1">Time Period</label>
<select name="date_range" id="date_range" class="input">
<option value="">All Time</option>
<option value="today" {{ request('date_range') === 'today' ? 'selected' : '' }}>Today</option>
<option value="week" {{ request('date_range') === 'week' ? 'selected' : '' }}>This Week</option>
<option value="month" {{ request('date_range') === 'month' ? 'selected' : '' }}>This Month</option>
<option value="year" {{ request('date_range') === 'year' ? 'selected' : '' }}>This Year</option>
</select>
</div>
<!-- Sort By -->
<div>
<label for="sort" class="block text-sm font-medium text-gray-700 mb-1">Sort By</label>
<select name="sort" id="sort" class="input">
<option value="newest" {{ request('sort') === 'newest' || !request('sort') ? 'selected' : '' }}>Newest</option>
<option value="popular" {{ request('sort') === 'popular' ? 'selected' : '' }}>Most Popular</option>
<option value="oldest" {{ request('sort') === 'oldest' ? 'selected' : '' }}>Oldest</option>
</select>
</div>
<!-- Action Buttons -->
<div class="flex items-end space-x-2">
<button type="submit" class="btn-primary flex-1 lg:flex-none">
Apply
</button>
<a href="{{ route('products.index') }}" class="btn-outline flex-1 lg:flex-none">
Clear
</a>
</div>
</div>
<!-- Active Filters Tags -->
@if(request()->hasAny(['search', 'category', 'date_range', 'sort']))
<div class="flex flex-wrap gap-2 pt-4 border-t border-gray-200">
<span class="text-sm font-medium text-gray-700">Active filters:</span>
@if(request('search'))
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm bg-primary-100 text-primary-800">
Search: "{{ request('search') }}"
<a href="{{ route('products.index', request()->except('search')) }}" class="ml-2 hover:text-primary-900">×</a>
</span>
@endif
@if(request('category'))
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm bg-primary-100 text-primary-800">
{{ $categories->find(request('category'))->name ?? 'Unknown' }}
<a href="{{ route('products.index', request()->except('category')) }}" class="ml-2 hover:text-primary-900">×</a>
</span>
@endif
@if(request('date_range'))
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm bg-primary-100 text-primary-800">
{{ ucfirst(request('date_range')) }}
<a href="{{ route('products.index', request()->except('date_range')) }}" class="ml-2 hover:text-primary-900">×</a>
</span>
@endif
@if(request('sort') && request('sort') !== 'newest')
<span class="inline-flex items-center px-3 py-1 rounded-full text-sm bg-primary-100 text-primary-800">
{{ ucfirst(request('sort')) }}
<a href="{{ route('products.index', request()->except('sort')) }}" class="ml-2 hover:text-primary-900">×</a>
</span>
@endif
</div>
@endif
</form>
</div>
</div>
<!-- Results Summary -->
@if($products->total() > 0)
<div class="mb-6">
<p class="text-sm text-gray-600">
Showing <span class="font-semibold text-gray-900">{{ $products->firstItem() }}</span> to
<span class="font-semibold text-gray-900">{{ $products->lastItem() }}</span> of
<span class="font-semibold text-gray-900">{{ $products->total() }}</span> products
</p>
</div>
@endif
<!-- Products Grid -->
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6 mb-8">
@forelse($products as $product)
@include('components.product.card', ['product' => $product])
@empty
<!-- Empty State -->
<div class="col-span-full">
<div class="text-center py-16">
<svg class="mx-auto h-16 w-16 text-gray-400 mb-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.172 16.172a4 4 0 015.656 0M9 10h.01M15 10h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg>
<h3 class="text-lg font-medium text-gray-900 mb-2">No products found</h3>
<p class="text-gray-600 mb-6">
@if(request()->hasAny(['search', 'category', 'date_range']))
Try adjusting your search or filters to find what you're looking for.
@else
Be the first to submit a product!
@endif
</p>
@auth
<a href="{{ route('products.create') }}" class="btn-primary inline-flex items-center space-x-2">
<svg class="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 4v16m8-8H4"></path>
</svg>
<span>Submit a Product</span>
</a>
@endauth
</div>
</div>
@endforelse
</div>
<!-- Pagination -->
@if($products->hasPages())
<div class="flex justify-center">
{{ $products->links() }}
</div>
@endif
</div>
@endsection