php artisan migrate:fresh y php artisan importar:excel, les tengo que pasar el archivo csv

This commit is contained in:
gianella
2026-04-04 20:59:30 -03:00
parent d1467ca098
commit b4476431e4
9 changed files with 224 additions and 61 deletions
+49 -9
View File
@@ -35,24 +35,64 @@
</style>
@endpush
<x-section-header subtitle="Inicio" title="Catalogo de " highlight="Productos"/>
<x-section-header subtitle="Inicio" title="Catálogo de " highlight="Productos"/>
<div class="w-full max-w-5xl mx-auto px-4">
<div class="mb-8 bg-stone-200/30 dark:bg-neutral-950/30 p-5 rounded-xl border border-neutral-200 dark:border-neutral-800">
<!-- BLOQUE 1: Búsqueda rápida con Select2 (Te lleva directo al producto) -->
<div class="mb-4 bg-stone-200/30 dark:bg-neutral-950/30 p-5 rounded-xl border border-neutral-200 dark:border-neutral-800">
<label for="buscador-catalogo" class="block text-sm font-semibold text-gray-800 dark:text-gray-300 mb-2">
Búsqueda rápida por similitud
Salto rápido a producto específico
</label>
<select id="buscador-catalogo" class="w-full">
<option value="">Escribe para buscar un producto...</option>
@foreach ($allProducts as $p)
<option value="{{ route('catalogo.show', $p->id) }}">
{{ $p->description }} - ${{ number_format($p->price, 2, ',', '.') }}
{{ $p->name }} - ${{ number_format($p->price, 2, ',', '.') }}
</option>
@endforeach
</select>
</div>
<!-- BLOQUE 2: Filtros de la Grilla -->
<form action="{{ route('catalogo.index') }}" method="GET" class="mb-8 flex flex-col md:flex-row gap-3 bg-stone-200/30 dark:bg-neutral-950/30 p-4 rounded-xl border border-neutral-200 dark:border-neutral-800">
<div class="relative w-full md:w-1/2">
<input type="text" name="search" value="{{ request('search') }}"
class="block w-full p-3 text-sm text-black dark:text-white border border-neutral-400 dark:border-neutral-700 rounded-lg bg-white dark:bg-neutral-900 placeholder-gray-600 dark:placeholder-gray-500 focus:ring-neon-lime focus:border-neon-lime"
placeholder="Buscar en el catálogo...">
</div>
<div class="w-full md:w-1/3">
<select name="type" onchange="this.form.submit()"
class="block w-full p-3 text-sm text-black dark:text-white border border-neutral-400 dark:border-neutral-700 rounded-lg bg-white dark:bg-neutral-900 focus:ring-neon-lime focus:border-neon-lime cursor-pointer">
<option value="">Todas las Categorías</option>
<option value="bike" {{ request('type') == 'bike' ? 'selected' : '' }}>Bicicletas</option>
<option value="clothing" {{ request('type') == 'clothing' ? 'selected' : '' }}>Indumentaria</option>
<option value="accessory" {{ request('type') == 'accessory' ? 'selected' : '' }}>Accesorios</option>
<option value="spare" {{ request('type') == 'spare' ? 'selected' : '' }}>Repuestos</option>
<option value="children" {{ request('type') == 'children' ? 'selected' : '' }}>Infantil</option>
<option value="rollers" {{ request('type') == 'rollers' ? 'selected' : '' }}>Rollers</option>
<option value="skate" {{ request('type') == 'skate' ? 'selected' : '' }}>Skate</option>
<option value="other" {{ request('type') == 'other' ? 'selected' : '' }}>Otros</option>
</select>
</div>
<div class="flex gap-2">
<button type="submit" class="px-5 py-3 text-sm font-bold text-neutral-900 bg-neon-lime rounded-lg hover:bg-[#b3e600] transition-colors">
Filtrar
</button>
@if(request('search') || request('type'))
<a href="{{ route('catalogo.index') }}" title="Limpiar Filtros" class="flex items-center justify-center p-3 text-sm font-bold text-red-600 bg-red-100 dark:bg-red-900/30 rounded-lg hover:bg-red-200 transition-colors">
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18 17.94 6M18 18 6.06 6"/>
</svg>
</a>
@endif
</div>
</form>
<!-- GRILLA DE PRODUCTOS -->
@if ($products->count() > 0)
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
@foreach ($products as $product)
@@ -60,7 +100,7 @@
{{-- Imagen si existe --}}
@if (!empty($product->image_path))
<img src="{{ asset('storage/' . $product->image_path) }}" alt="{{ $product->description }}"
<img src="{{ asset('storage/' . $product->image_path) }}" alt="{{ $product->name }}"
class="w-full h-40 object-cover rounded mb-4">
@else
<div class="w-full border border-neutral-200 dark:border-neutral-800 h-40 bg-stone-200 dark:bg-stone-900 flex items-center justify-center rounded mb-4">
@@ -78,14 +118,14 @@
{{-- Botón --}}
<a href="{{ route('catalogo.show', $product->id) }}"
class="mt-4 block w-full bg-neutral-900 dark:bg-neon-lime/80 uppercase text-neon-lime dark:text-black font-semibold py-2 rounded-lg text-center shadow-md shadow-gray-900/10 dark:shadow-neon-lime/10 hover:bg-neon-lime hover:dark:bg-neutral-900/70 border border-transparent hover:text-black hover:dark:text-neon-lime hover:border-black hover:dark:border-neon-lime transition-all">
Ver +
Ver Detalle
</a>
</div>
@endforeach
</div>
@else
<p class="text-center text-gray-400 dark:text-gray-600 mt-10">No hay productos disponibles.</p>
<p class="text-center text-gray-600 dark:text-gray-400 mt-10 font-medium">No se encontraron productos con esos filtros.</p>
@endif
<div class="mt-8">
@@ -106,12 +146,12 @@
width: '100%'
});
// 2. Evento: Cuando el usuario hace clic en una opción de la lista
// 2. Evento: Cuando el usuario hace clic en una opción de la lista Select2
$('#buscador-catalogo').on('select2:select', function (e) {
let urlDestino = $(this).val();
if (urlDestino) {
// Redirigimos a la página del producto
// Redirigimos a la página del detalle del producto
window.location.href = urlDestino;
}
});