Agregue catalogo y un poco de vistaUsuario
This commit is contained in:
@@ -1,6 +1,45 @@
|
||||
<x-app>
|
||||
<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 ($productos->count() > 0)
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 md:grid-cols-3 gap-6">
|
||||
@foreach ($productos 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
|
||||
|
||||
</x-app>
|
||||
{{-- 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>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
|
||||
<H1>BIENVENIDO {{Auth::user()->name}} </H1>
|
||||
<form action="{{route('logout')}}" method="post">
|
||||
<x-appc>
|
||||
<H1>BIENVENIDO {{ Auth::user()->name }} </H1>
|
||||
<a href="{{ route('catalogo') }}">Ir a catalogo</a>
|
||||
<form action="{{ route('logout') }}" method="post">
|
||||
@csrf
|
||||
<button type="submit">Logout</button>
|
||||
</form>
|
||||
</x-appc>
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
<x-appc>
|
||||
<div class="max-w-6xl mx-auto px-4 py-8 text-white">
|
||||
<a href="{{ route('catalogo') }}">Volver a catalogo</a>
|
||||
<h1>Titulo: {{ $producto->nombre }}</h1>
|
||||
<p>
|
||||
<b>Categoria:</b> {{ $producto->Categoria }}
|
||||
</p>
|
||||
<p>
|
||||
{{ $producto->content }}
|
||||
</p>
|
||||
</div>
|
||||
</x-appc>
|
||||
Reference in New Issue
Block a user