Files
LauckCycles/resources/views/catalogo.blade.php
T
2025-12-09 19:54:15 -03:00

46 lines
2.1 KiB
PHP

<x-appc>
<div class="max-w-6xl mx-auto px-4 py-8">
<h1 class="text-center text-2xl font-bold mb-8">CATÁLOGO</h1>
@if ($products->count() > 0)
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6">
@foreach ($products as $prod)
<div class="p-4 border rounded-lg shadow-md bg-white hover:shadow-lg transition">
{{-- Imagen si existe --}}
@if (!empty($prod->imagen))
<img src="{{ asset('storage/' . $prod->imagen) }}" alt="{{ $prod->name }}"
class="w-full h-40 object-cover rounded mb-4">
@else
<div class="w-full h-40 bg-gray-200 flex items-center justify-center rounded mb-4">
<span class="text-gray-500 text-sm">Sin imagen</span>
</div>
@endif
{{-- Nombre --}}
<h2 class="text-lg font-semibold text-gray-800">{{ $prod->nombre }}</h2>
{{-- Descripción corta --}}
@if (!empty($prod->descripcion))
<p class="text-sm text-gray-600 mt-2">{{ $prod->descripcion }}</p>
@endif
{{-- Precio --}}
@if (!empty($prod->precio))
<p class="text-blue-600 font-bold mt-3">${{ number_format($prod->precio, 2, ',', '.') }}</p>
@endif
{{-- Botón --}}
<a href="{{ route('productos.vistaUsuario', $prod) }}"
class="mt-4 block w-full bg-blue-500 text-white py-2 rounded-lg text-center hover:bg-blue-600">
Ver producto
</a>
</div>
@endforeach
</div>
@else
<p class="text-center text-gray-600 mt-10">No hay productos disponibles.</p>
@endif
</div>
</x-appc>