Merge branch 'lucas' of https://github.com/BryamE/ProyectoLauck into bryam
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Product;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CatalogoController extends Controller
|
||||
{
|
||||
|
||||
public function catalogo()
|
||||
{
|
||||
$productos = Product::all();
|
||||
return view('catalogo', compact('productos'));
|
||||
}
|
||||
}
|
||||
@@ -62,4 +62,9 @@ class ProductosController extends Controller
|
||||
$producto->delete();
|
||||
return redirect(route('productos.index'));
|
||||
}
|
||||
|
||||
public function vistaUsuario($id){
|
||||
$producto = Product::find($id);
|
||||
return view('productos.vistaUsuario', compact('producto'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ class RegisterController extends Controller
|
||||
{
|
||||
$userData = $request->validate([
|
||||
'name' => ['required', 'string'],
|
||||
'email' => ['required', 'email'],
|
||||
'email' => ['required', 'email', 'unique:users,email'],
|
||||
'password' => ['required', 'confirmed']
|
||||
]);
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -2,14 +2,12 @@
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4"></script>
|
||||
<title>{{ $title ?? 'Lauck - Home' }}</title>
|
||||
</head>
|
||||
|
||||
<body class="bg-neutral-900 relative pb-50 min-h-screen">
|
||||
<nav class="bg-white border-gray-200 dark:bg-gray-900">
|
||||
<div class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
|
||||
@@ -99,5 +97,4 @@
|
||||
</div>
|
||||
</footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -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>
|
||||
@@ -1,11 +1,13 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Bicicletería Lauck - Registro</title>
|
||||
<script src="https://cdn.tailwindcss.com"></script>
|
||||
</head>
|
||||
|
||||
<body class="bg-gradient-to-br from-blue-500 to-blue-700 flex items-center justify-center min-h-screen px-4">
|
||||
|
||||
<div class="flex flex-col items-center space-y-6 w-full max-w-lg">
|
||||
@@ -19,30 +21,44 @@
|
||||
<h2 class="text-2xl font-bold mb-2 text-center">Registrarse</h2>
|
||||
<p class="mb-6 text-center text-gray-600">Por favor completá el formulario para crear una cuenta.</p>
|
||||
|
||||
<form action="{{route('register.store')}}" method="post" class="space-y-5">
|
||||
<form action="{{ route('register.store') }}" method="post" class="space-y-5">
|
||||
@csrf
|
||||
@if ($errors->any())
|
||||
<div>
|
||||
<ul>
|
||||
@foreach ($errors->all() as $error)
|
||||
<li>{{ $error }}</li>
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
@endif
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Nombre completo</label>
|
||||
<input type="text" name="name" required class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
|
||||
<input type="text" name="name" required
|
||||
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Correo electrónico</label>
|
||||
<input type="email" name="email" required class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
|
||||
<input type="email" name="email" required
|
||||
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Contraseña</label>
|
||||
<input type="password" name="password" required class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
|
||||
<input type="password" name="password" required
|
||||
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<label class="block text-sm font-medium text-gray-700 mb-1">Confirmar contraseña</label>
|
||||
<input type="password" name="password_confirmation" required class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
|
||||
<input type="password" name="password_confirmation" required
|
||||
class="w-full px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-400">
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<input type="submit" name="submit" value="Registrarse" class="w-full bg-blue-600 text-white py-2 rounded-md hover:bg-blue-700 transition-colors">
|
||||
<input type="submit" name="submit" value="Registrarse"
|
||||
class="w-full bg-blue-600 text-white py-2 rounded-md hover:bg-blue-700 transition-colors">
|
||||
</div>
|
||||
|
||||
<p class="text-center text-sm text-gray-600">
|
||||
@@ -53,4 +69,5 @@
|
||||
</div>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
@@ -2,4 +2,3 @@
|
||||
<x-slot name="title">Lauck - Inicio</x-slot>
|
||||
<x-slot name="navTitle">Bienvenido</x-slot>
|
||||
</x-appc>
|
||||
|
||||
|
||||
+3
-1
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\AuthController;
|
||||
use App\Http\Controllers\CatalogoController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\HomeController;
|
||||
use App\Http\Controllers\LoginController;
|
||||
@@ -46,4 +47,5 @@ Route::middleware(['auth'])->group(function () {
|
||||
Route::delete('/productos/{id}', [ProductosController::class,'destroy'])->name('productos.destroy');
|
||||
});
|
||||
|
||||
Route::view('catalogo','catalogo')->name('catalogo');
|
||||
Route::get('/catalogo', [CatalogoController::class,'catalogo'])->name('catalogo');
|
||||
Route::get('/productos/{id}/vistaUsuario', [ProductosController::class,'vistaUsuario'])->name('productos.vistaUsuario');
|
||||
|
||||
Reference in New Issue
Block a user