Merge branch 'giane' of https://github.com/BryamE/ProyectoLauck into nLucas
This commit is contained in:
@@ -0,0 +1,83 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Console\Commands;
|
||||||
|
|
||||||
|
use Illuminate\Console\Command;
|
||||||
|
use App\Models\Product;
|
||||||
|
use App\Models\Supplier;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class ImportarExcelLimpio extends Command
|
||||||
|
{
|
||||||
|
// Este es el comando que vas a escribir en la terminal
|
||||||
|
protected $signature = 'importar:excel';
|
||||||
|
protected $description = 'Importa el catálogo limpio desde el archivo CSV';
|
||||||
|
|
||||||
|
public function handle()
|
||||||
|
{
|
||||||
|
$this->info("Iniciando importación del Excel limpio...");
|
||||||
|
|
||||||
|
// 1. Asegurarnos de que existe el proveedor comodín (para evitar el error de la llave foránea)
|
||||||
|
Supplier::firstOrCreate(
|
||||||
|
['id' => 1],
|
||||||
|
[
|
||||||
|
'name' => 'Proveedor General Lauck',
|
||||||
|
'phone' => '0000000000'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$rutaCompleta = storage_path('app/imports/catalogo_limpio.csv');
|
||||||
|
|
||||||
|
if (!file_exists($rutaCompleta)) {
|
||||||
|
$this->error("No se encontró el archivo en: " . $rutaCompleta);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$file = fopen($rutaCompleta, 'r');
|
||||||
|
|
||||||
|
// Saltamos la primera fila (porque son los títulos: tipo, descripcion, costo, precio)
|
||||||
|
fgetcsv($file);
|
||||||
|
|
||||||
|
$contador = 0;
|
||||||
|
|
||||||
|
while (($fila = fgetcsv($file, 1000, ',')) !== false) {
|
||||||
|
|
||||||
|
// Asignamos las columnas del Excel (0 a 3)
|
||||||
|
$tipoRaw = strtolower(trim($fila[0] ?? ''));
|
||||||
|
$descripcion = trim($fila[1] ?? '');
|
||||||
|
$costoRaw = trim($fila[2] ?? '');
|
||||||
|
$precioRaw = trim($fila[3] ?? '');
|
||||||
|
|
||||||
|
// Si la descripción está vacía, saltamos la fila
|
||||||
|
if (empty($descripcion)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// --- Lógica de limpieza de Tipos ---
|
||||||
|
// Si en el Excel dice "bicicleta", lo guardamos como "bike" para mantener el estándar.
|
||||||
|
$tipoFinal = ($tipoRaw === 'bicicleta') ? 'bike' : $tipoRaw;
|
||||||
|
|
||||||
|
// --- Lógica de limpieza de Precios ("$ 7,200" -> 7200.0) ---
|
||||||
|
// Borramos el signo peso, los espacios y las comas de los miles
|
||||||
|
$costoLimpio = (float) str_replace(['$', ' ', ','], '', $costoRaw);
|
||||||
|
$precioLimpio = (float) str_replace(['$', ' ', ','], '', $precioRaw);
|
||||||
|
|
||||||
|
// Guardamos en la base de datos
|
||||||
|
Product::updateOrCreate(
|
||||||
|
['name' => $descripcion], // Buscamos por descripción
|
||||||
|
[
|
||||||
|
'type' => $tipoFinal,
|
||||||
|
'cost' => $costoLimpio,
|
||||||
|
'price' => $precioLimpio,
|
||||||
|
'stock_quantity' => 20, // Al ser lista de precios, entra con stock 0
|
||||||
|
'min_stock_alert' => 5,
|
||||||
|
'suppliers_id' => 1,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
$contador++;
|
||||||
|
}
|
||||||
|
|
||||||
|
fclose($file);
|
||||||
|
$this->info("¡Éxito! Se importaron/actualizaron {$contador} productos.");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,30 +8,40 @@ use Illuminate\Http\Request;
|
|||||||
class CatalogoController extends Controller
|
class CatalogoController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Muestra los registros de ventas con buscador y paginación.
|
* Muestra el catálogo público de productos.
|
||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
// Consulta base
|
// 1. Atrapamos lo que el usuario escribió o seleccionó
|
||||||
$query = Product::query();
|
$query = $request->input('search');
|
||||||
|
$type = $request->input('type');
|
||||||
|
|
||||||
// Lógica del Buscador: Si recibimos algo en el input "search"
|
// --- CONSULTA PARA LA GRILLA (PAGINADA) ---
|
||||||
if ($request->has('search')) {
|
$productsQuery = Product::query();
|
||||||
$searchTerm = $request->input('search');
|
|
||||||
|
|
||||||
$query->where(function($q) use ($searchTerm) {
|
$productsQuery->when($query, function ($q) use ($query) {
|
||||||
$q->where('name', 'like', "%{$searchTerm}%")
|
return $q->where('name', 'like', "%{$query}%");
|
||||||
->orWhere('sku', 'like', "%{$searchTerm}%");
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if ($type) {
|
||||||
|
$productsQuery->where('type', $type);
|
||||||
|
} else {
|
||||||
|
$productsQuery->where('type', '!=', 'service');
|
||||||
}
|
}
|
||||||
$query->whereIn('type', ['bike', 'accessory', 'clothing', 'spare']);
|
|
||||||
$query->where('stock_quantity', '>', 0); // Solo mostrar si tiene stock
|
//mostrar si tiene stock mayor a 0
|
||||||
|
$productsQuery->where('stock_quantity', '>', 0);
|
||||||
|
|
||||||
// Resultados paginados
|
// Resultados paginados
|
||||||
$products = $query->paginate(12)->withQueryString(); // withQueryString mantiene la búsqueda al cambiar de página
|
$products = $productsQuery->orderBy('name', 'asc')->paginate(12)->withQueryString();
|
||||||
|
|
||||||
|
$allProducts = Product::where('type', '!=', 'service')
|
||||||
|
->where('stock_quantity', '>', 0)
|
||||||
|
->orderBy('name', 'asc')
|
||||||
|
->get();
|
||||||
|
|
||||||
// Devuelve la vista
|
// Devuelve la vista
|
||||||
return view('catalogo.index', compact('products'));
|
return view('catalogo.index', compact('products', 'allProducts'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function show(Product $product)
|
public function show(Product $product)
|
||||||
|
|||||||
@@ -59,8 +59,11 @@ class ClientController extends Controller
|
|||||||
else if ($request->input('origin') === 'taller') {
|
else if ($request->input('origin') === 'taller') {
|
||||||
|
|
||||||
// Si vino de taller, volvemos a taller con el cliente nuevo
|
// Si vino de taller, volvemos a taller con el cliente nuevo
|
||||||
return redirect()->route('taller.create', ['new_client_id' => $client->id])
|
return redirect()->route('taller.create', [
|
||||||
->with('success', 'Cliente creado. Ya puedes seleccionarlo.');
|
'new_client_id' => $client->id,
|
||||||
|
'new_client_name' => $client->name,
|
||||||
|
'new_client_phone' => $client->phone
|
||||||
|
])->with('success', 'Cliente creado. Ya puedes seleccionarlo.');
|
||||||
}
|
}
|
||||||
|
|
||||||
// 3. Si no, vuelvo al index de clientes
|
// 3. Si no, vuelvo al index de clientes
|
||||||
|
|||||||
@@ -14,35 +14,35 @@ class ProductosController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Request $request)
|
public function index(Request $request)
|
||||||
{
|
{
|
||||||
// Recuperamos lo escrito en el buscador (si aplica)
|
|
||||||
$query = $request->input('search');
|
$query = $request->input('search');
|
||||||
$status = $request->input('stock_status');
|
$status = $request->input('stock_status');
|
||||||
|
$type = $request->input('type');
|
||||||
|
|
||||||
// Construimos la consulta
|
|
||||||
$products = Product::query()
|
$products = Product::query()
|
||||||
->when($query, function ($q) use ($query) {
|
->when($query, function ($q) use ($query) {
|
||||||
// Filtra por nombre o SKU
|
return $q->where('name', 'like', "%{$query}%");
|
||||||
return $q->where('name', 'like', "%{$query}%")
|
})
|
||||||
->orWhere('sku', 'like', "%{$query}%");
|
->when($type, function ($q) use ($type) {
|
||||||
|
return $q->where('type', $type);
|
||||||
})
|
})
|
||||||
->when($status, function ($q) use ($status) {
|
->when($status, function ($q) use ($status) {
|
||||||
if ($status === 'low') {
|
if ($status === 'low') {
|
||||||
// Rojo: Menor o igual a la alerta
|
return $q->whereColumn('stock_quantity', '<', 'min_stock_alert')
|
||||||
return $q->whereColumn('stock_quantity', '<', 'min_stock_alert');
|
->where('type', '!=', 'service');
|
||||||
}
|
}
|
||||||
elseif ($status === 'medium') {
|
elseif ($status === 'medium') {
|
||||||
// Amarillo: Mayor al min y menor o igual al min + 5
|
|
||||||
return $q->whereColumn('stock_quantity', '>=', 'min_stock_alert')
|
return $q->whereColumn('stock_quantity', '>=', 'min_stock_alert')
|
||||||
->whereRaw('stock_quantity <= (min_stock_alert + 5)');
|
->whereRaw('stock_quantity <= (min_stock_alert + 5)')
|
||||||
|
->where('type', '!=', 'service');
|
||||||
}
|
}
|
||||||
elseif ($status === 'ok') {
|
elseif ($status === 'ok') {
|
||||||
// Verde: Stock saludable
|
return $q->whereRaw('stock_quantity > (min_stock_alert + 5)')
|
||||||
return $q->whereRaw('stock_quantity > (min_stock_alert + 5)');
|
->where('type', '!=', 'service');
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->orderBy('stock_quantity', 'asc') // Ordenamos primero los que tienen poco stock (Alerta visual)
|
->orderBy('stock_quantity', 'asc') // Ordena primero los que tienen poco stock
|
||||||
->paginate(10) // Paginamos de a 10
|
->paginate(10) // Muestra de a 10 productos
|
||||||
->withQueryString(); // Mantiene el filtro de búsqueda al cambiar de página
|
->withQueryString(); // Mantiene los filtros al pasar a la página 2, 3, etc.
|
||||||
|
|
||||||
return view('productos.index', compact('products'));
|
return view('productos.index', compact('products'));
|
||||||
}
|
}
|
||||||
@@ -62,30 +62,21 @@ class ProductosController extends Controller
|
|||||||
{
|
{
|
||||||
// 1. Validamos los datos con las nuevas columnas
|
// 1. Validamos los datos con las nuevas columnas
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'name' => 'required|string|max:255',
|
'name' => 'required|string|max:255', // CORREGIDO: description en lugar de name
|
||||||
'sku' => 'nullable|string|unique:products,sku|max:50', // SKU único
|
|
||||||
'description' => 'nullable|string',
|
|
||||||
'price' => 'required|numeric|min:0',
|
'price' => 'required|numeric|min:0',
|
||||||
'cost' => 'nullable|numeric|min:0', // Costo opcional
|
'cost' => 'nullable|numeric|min:0',
|
||||||
'stock_quantity' => 'required|integer|min:0',
|
'stock_quantity' => 'required|integer|min:0',
|
||||||
'min_stock_alert' => 'required|integer|min:0',
|
'min_stock_alert' => 'required|integer|min:0',
|
||||||
'type' => 'required|in:bike,accessory,clothing,spare', // Solo permite estos valores
|
'type' => 'required|in:bike,accessory,clothing,spare,service,children,skate,rollers,other',
|
||||||
'serial_number' => 'nullable|string|max:100',
|
'serial_number' => 'nullable|string|max:100',
|
||||||
'image' => 'nullable|image|mimes:jpeg,png,jpg,webp|max:2048',
|
'image' => 'nullable|image|mimes:jpeg,png,jpg,webp|max:2048',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// 2. Si no viene SKU, generamos uno automático (Opcional pero útil)
|
// 2. Validacion de imagenes
|
||||||
if (empty($validated['sku'])) {
|
|
||||||
$validated['sku'] = 'GEN-' . strtoupper(uniqid());
|
|
||||||
}
|
|
||||||
|
|
||||||
// 3. Validacion de imagenes
|
|
||||||
if ($request->hasFile('image')) {
|
if ($request->hasFile('image')) {
|
||||||
// Guarda el archivo en storage/app/public/products y devuelve la ruta
|
|
||||||
$path = $request->file('image')->store('products', 'public');
|
$path = $request->file('image')->store('products', 'public');
|
||||||
$validated['image_path'] = $path;
|
$validated['image_path'] = $path;
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($validated['image']);
|
unset($validated['image']);
|
||||||
|
|
||||||
// Para no romper la logica del supplier
|
// Para no romper la logica del supplier
|
||||||
@@ -94,7 +85,7 @@ class ProductosController extends Controller
|
|||||||
// 3. Creamos el producto
|
// 3. Creamos el producto
|
||||||
Product::create($validated);
|
Product::create($validated);
|
||||||
|
|
||||||
// 4. Redireccionamos con mensaje de éxito (Necesitas el componente Alert en el layout)
|
// 4. Redireccionamos
|
||||||
return redirect()->route('productos.index')
|
return redirect()->route('productos.index')
|
||||||
->with('success', 'Producto creado correctamente.');
|
->with('success', 'Producto creado correctamente.');
|
||||||
}
|
}
|
||||||
@@ -121,34 +112,27 @@ class ProductosController extends Controller
|
|||||||
public function update(Request $request, Product $product)
|
public function update(Request $request, Product $product)
|
||||||
{
|
{
|
||||||
$validated = $request->validate([
|
$validated = $request->validate([
|
||||||
'name' => 'required|string|max:255',
|
'name' => 'required|string|max:255', // CORREGIDO
|
||||||
// Validamos que el SKU sea único PERO ignoramos el ID de este producto actual
|
'type' => 'required|in:bike,accessory,clothing,spare,service,children,skate,rollers,other', // CORREGIDO
|
||||||
'sku' => ['nullable', 'string', Rule::unique('products')->ignore($product->id)],
|
|
||||||
'description' => 'nullable|string',
|
|
||||||
'price' => 'required|numeric|min:0',
|
'price' => 'required|numeric|min:0',
|
||||||
'cost' => 'nullable|numeric|min:0',
|
'cost' => 'nullable|numeric|min:0',
|
||||||
'stock_quantity' => 'required|integer|min:0',
|
'stock_quantity' => 'required|integer|min:0',
|
||||||
'min_stock_alert' => 'required|integer|min:0',
|
'min_stock_alert' => 'required|integer|min:0',
|
||||||
'type' => 'required|in:bike,accessory,clothing,spare',
|
|
||||||
'serial_number' => 'nullable|string|max:100',
|
'serial_number' => 'nullable|string|max:100',
|
||||||
|
|
||||||
'image' => 'nullable|image|mimes:jpeg,png,jpg,webp|max:2048',
|
'image' => 'nullable|image|mimes:jpeg,png,jpg,webp|max:2048',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// 2. Manejo de imagen al actualizar
|
// 2. Manejo de imagen al actualizar
|
||||||
if ($request->hasFile('image')) {
|
if ($request->hasFile('image')) {
|
||||||
// Borrar la imagen anterior
|
|
||||||
if ($product->image_path) {
|
if ($product->image_path) {
|
||||||
Storage::disk('public')->delete($product->image_path);
|
Storage::disk('public')->delete($product->image_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Guardar la nueva
|
|
||||||
$path = $request->file('image')->store('products', 'public');
|
$path = $request->file('image')->store('products', 'public');
|
||||||
$validated['image_path'] = $path;
|
$validated['image_path'] = $path;
|
||||||
}
|
}
|
||||||
unset($validated['image']);
|
unset($validated['image']);
|
||||||
|
|
||||||
// Para no romper la logica del supplier
|
|
||||||
$validated['suppliers_id'] = 1;
|
$validated['suppliers_id'] = 1;
|
||||||
|
|
||||||
$product->update($validated);
|
$product->update($validated);
|
||||||
@@ -162,6 +146,10 @@ class ProductosController extends Controller
|
|||||||
*/
|
*/
|
||||||
public function destroy(Product $product)
|
public function destroy(Product $product)
|
||||||
{
|
{
|
||||||
|
if ($product->image_path) {
|
||||||
|
Storage::disk('public')->delete($product->image_path);
|
||||||
|
}
|
||||||
|
|
||||||
$product->delete();
|
$product->delete();
|
||||||
return redirect()->route('productos.index')
|
return redirect()->route('productos.index')
|
||||||
->with('success', 'Producto eliminado.');
|
->with('success', 'Producto eliminado.');
|
||||||
|
|||||||
@@ -35,9 +35,9 @@ class TallerController extends Controller
|
|||||||
{
|
{
|
||||||
$clients = Client::orderBy('name')->get();
|
$clients = Client::orderBy('name')->get();
|
||||||
|
|
||||||
$products = Product::whereIn('type', ['accessory','spare'])
|
$products = Product::whereIn('type', ['accessory','spare', 'service'])
|
||||||
->where('stock_quantity', '>', 0)
|
->where('stock_quantity', '>', 0)
|
||||||
->get(['id', 'name', 'price', 'sku', 'stock_quantity']); // Solo campos necesarios
|
->get(['id', 'name', 'price', 'stock_quantity']); // Solo campos necesarios
|
||||||
|
|
||||||
return view('taller.create', compact('clients', 'products'));
|
return view('taller.create', compact('clients', 'products'));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
|
|
||||||
class Supplier extends Model
|
class Supplier extends Model
|
||||||
{
|
{
|
||||||
protected $fillable = [ 'name', 'phone', 'email' ];
|
protected $fillable = [ 'name', 'phone'];
|
||||||
|
|
||||||
public function products()
|
public function products()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ return new class extends Migration
|
|||||||
$table->id();
|
$table->id();
|
||||||
$table->string('name');
|
$table->string('name');
|
||||||
$table->string('phone');
|
$table->string('phone');
|
||||||
$table->string('email');
|
$table->string('email')->nullable();
|
||||||
$table->timestamps();
|
$table->timestamps();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,18 +13,18 @@ return new class extends Migration
|
|||||||
{
|
{
|
||||||
Schema::create('products', function (Blueprint $table) {
|
Schema::create('products', function (Blueprint $table) {
|
||||||
$table->id();
|
$table->id();
|
||||||
$table->enum('type', ['bike', 'accessory', 'clothing', 'service']);
|
$table->enum('type', ['bike', 'accessory', 'clothing', 'spare', 'children', 'skate', 'rollers','other']); // Tipo de producto
|
||||||
//$table->string('name');
|
//$table->string('name');
|
||||||
//$table->string('sku')->unique()->nullable(); // Código de barras o interno
|
//$table->string('sku')->unique()->nullable(); // Código de barras o interno
|
||||||
$table->text('description')->nullable();
|
$table->text('name')->nullable();
|
||||||
|
|
||||||
$table->decimal('price', 10, 2); // Precio venta
|
$table->decimal('price', 10, 2); // Precio venta
|
||||||
$table->decimal('cost', 10, 2)->nullable(); // Costo (solo admin)
|
$table->decimal('cost', 10, 2)->nullable(); // Costo (solo admin)
|
||||||
|
|
||||||
$table->integer('stock_quantity')->default(0);
|
$table->integer('stock_quantity')->default(100);
|
||||||
$table->integer('min_stock_alert'); // Alerta
|
$table->integer('min_stock_alert')->default(5); // Alerta
|
||||||
|
|
||||||
|
|
||||||
$table->enum('type', ['bike', 'accessory', 'clothing', 'spare']); // Tipo de producto
|
|
||||||
$table->string('serial_number')->nullable(); // Solo para bicis
|
$table->string('serial_number')->nullable(); // Solo para bicis
|
||||||
|
|
||||||
$table->foreignId('suppliers_id')->constrained()->default(1);
|
$table->foreignId('suppliers_id')->constrained()->default(1);
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Database\Seeders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Seeder;
|
||||||
|
use App\Models\Product;
|
||||||
|
use App\Models\Supplier; // <-- Importamos el modelo de proveedor
|
||||||
|
|
||||||
|
class ProductosInicialesSeeder extends Seeder
|
||||||
|
{
|
||||||
|
public function run()
|
||||||
|
{
|
||||||
|
// 1. Creamos el proveedor por defecto (ID 1) para que no falle la llave foránea
|
||||||
|
Supplier::firstOrCreate(
|
||||||
|
['id' => 1],
|
||||||
|
[
|
||||||
|
'name' => 'Proveedor 1',
|
||||||
|
'phone' => '123456789',
|
||||||
|
'email' => 'proveedor1@example.com'
|
||||||
|
]
|
||||||
|
);
|
||||||
|
|
||||||
|
// 2. Tus datos convertidos a un array nativo de PHP
|
||||||
|
$productos = [
|
||||||
|
['type' => 'clothing', 'name' => 'MALLAS CORTAS indubike', 'cost' => 3920, 'price' => 4900],
|
||||||
|
['type' => 'clothing', 'name' => 'Malla corta ITOKU', 'cost' => 3920, 'price' => 4900],
|
||||||
|
['type' => 'clothing', 'name' => 'MALLAS CON TIRADORES', 'cost' => 4640, 'price' => 5800],
|
||||||
|
['type' => 'clothing', 'name' => 'MALLA SQUADRA', 'cost' => 4640, 'price' => 5800],
|
||||||
|
['type' => 'clothing', 'name' => 'CALZA LARGA C/BADANA TERMICA', 'cost' => 3280, 'price' => 4100],
|
||||||
|
['type' => 'clothing', 'name' => 'CALZA LARGA S/ BADANA', 'cost' => 3280, 'price' => 4100],
|
||||||
|
['type' => 'clothing', 'name' => 'ABRIGO DE PIERNAS', 'cost' => 1504, 'price' => 1880],
|
||||||
|
['type' => 'clothing', 'name' => 'CHALECO ITOKU', 'cost' => 1520, 'price' => 1900],
|
||||||
|
['type' => 'clothing', 'name' => 'Camiseta argentina azul', 'cost' => 1680, 'price' => 2100],
|
||||||
|
['type' => 'clothing', 'name' => 'Camiseta itoko', 'cost' => 1680, 'price' => 2100],
|
||||||
|
['type' => 'clothing', 'name' => 'CAMISETA INDUBIKE', 'cost' => 1680, 'price' => 2100],
|
||||||
|
['type' => 'clothing', 'name' => 'CAMISETA SIDI', 'cost' => 3120, 'price' => 3900],
|
||||||
|
['type' => 'clothing', 'name' => 'CAMISETA LIMA', 'cost' => 3120, 'price' => 3900],
|
||||||
|
['type' => 'clothing', 'name' => 'CAMPERA SIDI INDUBIQUE', 'cost' => 3040, 'price' => 3800],
|
||||||
|
['type' => 'clothing', 'name' => 'CAMPERA SQUADRA', 'cost' => 3040, 'price' => 3800],
|
||||||
|
['type' => 'clothing', 'name' => 'CAMPERAS solbike', 'cost' => 3040, 'price' => 3800],
|
||||||
|
['type' => 'clothing', 'name' => 'CAMPERA ITUKO', 'cost' => 3040, 'price' => 3800],
|
||||||
|
['type' => 'clothing', 'name' => 'campera licra especial indubike', 'cost' => 3040, 'price' => 3800],
|
||||||
|
['type' => 'clothing', 'name' => 'ROMPEBIENTO ITUKO', 'cost' => 1520, 'price' => 1900],
|
||||||
|
['type' => 'clothing', 'name' => 'REMERA TERMICA NEGRA', 'cost' => 1520, 'price' => 1900],
|
||||||
|
['type' => 'clothing', 'name' => 'GUANTES LICRA ECONOMICOS', 'cost' => 1520, 'price' => 1900],
|
||||||
|
['type' => 'clothing', 'name' => 'GUANTES EXTREMO', 'cost' => 2240, 'price' => 2800],
|
||||||
|
['type' => 'clothing', 'name' => 'GUANTES', 'cost' => 2240, 'price' => 2800],
|
||||||
|
['type' => 'clothing', 'name' => 'GUANTES COACH', 'cost' => 2240, 'price' => 2800],
|
||||||
|
['type' => 'clothing', 'name' => 'GUANTES DE NIÑO RECREO', 'cost' => 2240, 'price' => 2800],
|
||||||
|
['type' => 'clothing', 'name' => 'GUANTES VAIRO', 'cost' => 2240, 'price' => 2800],
|
||||||
|
['type' => 'clothing', 'name' => 'GUANTES CON DEDOS', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'accessory', 'name' => 'BOLSA BAJO ASIENTO EXT CHICA', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'accessory', 'name' => 'BOLSA BAJO ASIENTO GRANDE', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'accessory', 'name' => 'BOLSA TRIANGULO', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'accessory', 'name' => 'PORTA CELULAR', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'clothing', 'name' => 'CASCO ECONOMICO 10V', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'clothing', 'name' => 'CASCO 20 V', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'clothing', 'name' => 'CASCO 22V D CARRERA', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'clothing', 'name' => 'CASCO DE NIÑO', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'clothing', 'name' => 'casco masz1', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'clothing', 'name' => 'Cascos de niña con rodilleras rosa', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'clothing', 'name' => 'CASCO BMK ASFALTOCCCC', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'clothing', 'name' => 'Casco de BMX roler/scate', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'clothing', 'name' => 'Cascos de niño chico (3 años)', 'cost' => 2640, 'price' => 3300],
|
||||||
|
['type' => 'accessory', 'name' => 'ALFORJA', 'cost' => 2640, 'price' => 3300],
|
||||||
|
];
|
||||||
|
|
||||||
|
// 3. Insertamos usando updateOrCreate para no duplicar si lo corrés dos veces
|
||||||
|
foreach ($productos as $item) {
|
||||||
|
Product::updateOrCreate(
|
||||||
|
['name' => $item['name']], // Busca por descripcion
|
||||||
|
[
|
||||||
|
'type' => $item['type'],
|
||||||
|
'cost' => $item['cost'],
|
||||||
|
'price' => $item['price'],
|
||||||
|
'stock_quantity' => 100, // Inicia con stock por defecto
|
||||||
|
'min_stock_alert' => 5, // Alerta por defecto
|
||||||
|
'suppliers_id' => 1,
|
||||||
|
]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->command->info('¡Productos y proveedor insertados correctamente!');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,12 @@
|
|||||||
<x-layout title="Agenda">
|
<x-layout title="Agenda">
|
||||||
|
<style>
|
||||||
|
:root {
|
||||||
|
--fc-border-color: #979393a4 !important;
|
||||||
|
}
|
||||||
|
html.dark {
|
||||||
|
--fc-border-color: #5c5a5b !important;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
||||||
<div class="flex w-full justify-between items-end mb-6">
|
<div class="flex w-full justify-between items-end mb-6">
|
||||||
|
|
||||||
|
|||||||
@@ -1,14 +1,105 @@
|
|||||||
<x-layout title="Catalogo - Lauck">
|
<x-layout title="Catalogo - Lauck">
|
||||||
|
|
||||||
<!-- Header -->
|
@push('styles')
|
||||||
<x-section-header subtitle="Inicio" title="Catalogo de " highlight="Productos"/>
|
<link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
|
||||||
|
<style>
|
||||||
|
/* Adaptación de Select2 para Dark Mode y tema Lime */
|
||||||
|
html.dark .select2-container--default .select2-selection--single {
|
||||||
|
background-color: #171717; /* bg-neutral-900 */
|
||||||
|
border: 1px solid #262626; /* border-neutral-800 */
|
||||||
|
height: 42px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
border-radius: 0.5rem;
|
||||||
|
}
|
||||||
|
html.dark .select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||||
|
color: #d4d4d4; /* text-gray-300 */
|
||||||
|
}
|
||||||
|
html.dark .select2-dropdown {
|
||||||
|
background-color: #171717;
|
||||||
|
border: 1px solid #262626;
|
||||||
|
color: #d4d4d4;
|
||||||
|
}
|
||||||
|
html.dark .select2-search__field {
|
||||||
|
background-color: #262626;
|
||||||
|
color: #fff;
|
||||||
|
border: 1px solid #404040;
|
||||||
|
}
|
||||||
|
html.dark .select2-container--default .select2-results__option--highlighted[aria-selected] {
|
||||||
|
background-color: #84cc16; /* bg-lime-500 */
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
|
html.dark .select2-results__option[aria-selected=true] {
|
||||||
|
background-color: #262626;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
@endpush
|
||||||
|
|
||||||
<div class="w-full max-w-5xl">
|
<x-section-header subtitle="Inicio" title="Catálogo de " highlight="Productos"/>
|
||||||
|
|
||||||
|
<div class="w-full max-w-5xl mx-auto px-4">
|
||||||
|
|
||||||
|
<!-- 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">
|
||||||
|
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->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 -->
|
||||||
|
<!-- GRILLA DE PRODUCTOS -->
|
||||||
@if ($products->count() > 0)
|
@if ($products->count() > 0)
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
@foreach ($products as $product)
|
@foreach ($products as $product)
|
||||||
<div class="group p-4 border bg-stone-200/30 dark:bg-neutral-950/30 border-neutral-200 dark:border-neutral-800 rounded-xl hover:border-lime-500 hover:dark:border-neon-lime hover:-translate-y-1 transition-all duration-300">
|
<!-- ACÁ ESTÁ EL PRIMER CAMBIO: Agregamos "flex flex-col h-full" -->
|
||||||
|
<div class="group flex flex-col h-full p-4 border bg-stone-200/30 dark:bg-neutral-950/30 border-neutral-200 dark:border-neutral-800 rounded-xl hover:border-lime-500 hover:dark:border-neon-lime hover:-translate-y-1 transition-all duration-300">
|
||||||
|
|
||||||
{{-- Imagen si existe --}}
|
{{-- Imagen si existe --}}
|
||||||
@if (!empty($product->image_path))
|
@if (!empty($product->image_path))
|
||||||
<img src="{{ asset('storage/' . $product->image_path) }}" alt="{{ $product->name }}"
|
<img src="{{ asset('storage/' . $product->image_path) }}" alt="{{ $product->name }}"
|
||||||
@@ -19,15 +110,8 @@
|
|||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
{{-- Nombre --}}
|
<!-- ACÁ ESTÁ EL SEGUNDO CAMBIO: Agregamos "flex-1" al título -->
|
||||||
<h2 class="text-lg font-semibold text-black dark:text-white">{{ $product->name }}</h2>
|
<h2 class="text-lg font-semibold text-black dark:text-white flex-1">{{ $product->name }}</h2>
|
||||||
|
|
||||||
{{-- Descripción corta --}}
|
|
||||||
<div class="h-10 overflow-y-auto [scrollbar-width:none]">
|
|
||||||
@if (!empty($product->description))
|
|
||||||
<p class="text-sm text-gray-700 dark:text-gray-400 mt-2">{{ $product->description }}</p>
|
|
||||||
@endif
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{{-- Precio --}}
|
{{-- Precio --}}
|
||||||
@if (!empty($product->price))
|
@if (!empty($product->price))
|
||||||
@@ -35,20 +119,47 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
{{-- Botón --}}
|
{{-- Botón --}}
|
||||||
<a href="{{ route('catalogo.show', $product) }}"
|
<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">
|
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>
|
</a>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@else
|
@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
|
@endif
|
||||||
|
|
||||||
<div class="mt-3">
|
<div class="mt-8">
|
||||||
{{ $products->links() }}
|
{{ $products->links() }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@push('scripts')
|
||||||
|
<script src="https://code.jquery.com/jquery-3.7.1.min.js"></script>
|
||||||
|
<script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
$(document).ready(function() {
|
||||||
|
// 1. Inicializamos Select2
|
||||||
|
$('#buscador-catalogo').select2({
|
||||||
|
placeholder: "🔍 Ej: Bici R12 o Guantes...",
|
||||||
|
allowClear: true,
|
||||||
|
width: '100%'
|
||||||
|
});
|
||||||
|
|
||||||
|
// 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 detalle del producto
|
||||||
|
window.location.href = urlDestino;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
@endpush
|
||||||
|
|
||||||
</x-layout>
|
</x-layout>
|
||||||
|
|||||||
@@ -5,44 +5,77 @@
|
|||||||
<!-- Mensajes de feedback -->
|
<!-- Mensajes de feedback -->
|
||||||
<x-ui.alert />
|
<x-ui.alert />
|
||||||
|
|
||||||
<!-- Barra de Herramientas (Buscador + Botón Crear) -->
|
<!-- Barra de Herramientas (Buscador + Botones) -->
|
||||||
<div class="w-full flex flex-col md:flex-row justify-between items-center gap-4 mb-6">
|
<div class="w-full flex flex-col xl:flex-row justify-between items-start xl:items-center gap-4 mb-6">
|
||||||
<!-- Buscador -->
|
|
||||||
<form action="{{ route('productos.index') }}" method="GET" class="w-full lg:w-2/3 flex flex-col sm:flex-row gap-3">
|
<!-- Buscador y Filtros -->
|
||||||
<div class="relative w-full sm:w-2/3">
|
<form action="{{ route('productos.index') }}" method="GET" class="w-full xl:w-4/5 flex flex-col md:flex-row gap-3">
|
||||||
|
|
||||||
|
<!-- 1. Buscador por Texto -->
|
||||||
|
<div class="relative w-full md:w-2/5">
|
||||||
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
<div class="absolute inset-y-0 start-0 flex items-center ps-3 pointer-events-none">
|
||||||
<svg class="w-4 h-4 text-gray-600 dark:text-gray-500" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
<svg class="w-4 h-4 text-gray-600 dark:text-gray-500" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 20 20">
|
||||||
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
|
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m19 19-4-4m0-7A7 7 0 1 1 1 8a7 7 0 0 1 14 0Z"/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<input type="text" name="search" value="{{ request('search') }}"
|
<input type="text" name="search" value="{{ request('search') }}"
|
||||||
class="block w-full p-3 ps-10 text-sm text-black dark:text-white border border-neutral-400 dark:border-neutral-700 rounded-lg bg-neutral-200 dark:bg-neutral-800 placeholder-gray-600 dark:placeholder-gray-500"
|
class="block w-full p-3 ps-10 text-sm text-black dark:text-white border border-neutral-400 dark:border-neutral-700 rounded-lg bg-neutral-200 dark:bg-neutral-800 placeholder-gray-600 dark:placeholder-gray-500 focus:ring-neon-lime focus:border-neon-lime"
|
||||||
placeholder="Buscar por nombre, SKU o marca...">
|
placeholder="Buscar por nombre">
|
||||||
</div>
|
</div>
|
||||||
<!-- Filtro de Estado de Stock -->
|
|
||||||
<div class="w-full sm:w-1/3">
|
<!-- 2. Filtro de Categoría (Tipo) -->
|
||||||
<select name="stock_status" onchange="this.form.submit()"
|
<div class="w-full md:w-1/4">
|
||||||
|
<select name="type" onchange="this.form.submit()"
|
||||||
class="block w-full p-3 text-sm text-black dark:text-white border border-neutral-300 dark:border-neutral-700 rounded-lg bg-neutral-200 dark:bg-neutral-800 focus:ring-neon-lime focus:border-neon-lime cursor-pointer">
|
class="block w-full p-3 text-sm text-black dark:text-white border border-neutral-300 dark:border-neutral-700 rounded-lg bg-neutral-200 dark:bg-neutral-800 focus:ring-neon-lime focus:border-neon-lime cursor-pointer">
|
||||||
<option value="">Todos</option>
|
<option value="">Todas las Categorías</option>
|
||||||
<option value="low" {{ request('stock_status') == 'low' ? 'selected' : '' }} class="text-red-600 dark:text-red-300">Stock en Alerta</option>
|
<option value="bike" {{ request('type') == 'bike' ? 'selected' : '' }}>Bicicletas</option>
|
||||||
<option value="medium" {{ request('stock_status') == 'medium' ? 'selected' : '' }} class="text-yellow-600 dark:text-yellow-300">Stock Bajo</option>
|
<option value="clothing" {{ request('type') == 'clothing' ? 'selected' : '' }}>Indumentaria</option>
|
||||||
<option value="ok" {{ request('stock_status') == 'ok' ? 'selected' : '' }} class="text-green-600 dark:text-green-300">Stock Normal</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>
|
||||||
|
<option value="service" {{ request('type') == 'service' ? 'selected' : '' }}>Servicios</option>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- 3. Filtro de Estado de Stock -->
|
||||||
|
<div class="w-full md:w-1/4">
|
||||||
|
<select name="stock_status" onchange="this.form.submit()"
|
||||||
|
class="block w-full p-3 text-sm text-black dark:text-white border border-neutral-300 dark:border-neutral-700 rounded-lg bg-neutral-200 dark:bg-neutral-800 focus:ring-neon-lime focus:border-neon-lime cursor-pointer">
|
||||||
|
<option value="">Cualquier Stock</option>
|
||||||
|
<option value="low" {{ request('stock_status') == 'low' ? 'selected' : '' }} class="text-red-600 dark:text-red-300 font-semibold">Stock en Alerta</option>
|
||||||
|
<option value="medium" {{ request('stock_status') == 'medium' ? 'selected' : '' }} class="text-yellow-600 dark:text-yellow-300 font-semibold">Stock Bajo</option>
|
||||||
|
<option value="ok" {{ request('stock_status') == 'ok' ? 'selected' : '' }} class="text-green-600 dark:text-green-300 font-semibold">Stock Normal</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- Botón Limpiar Filtros -->
|
||||||
|
@if(request('search') || request('type') || request('stock_status'))
|
||||||
|
<div class="w-full md:w-auto flex">
|
||||||
|
<a href="{{ route('productos.index') }}" title="Limpiar Filtros"
|
||||||
|
class="flex items-center justify-center p-3 text-sm font-bold text-red-600 dark:text-red-400 bg-red-100 dark:bg-red-900/30 rounded-lg hover:bg-red-200 dark:hover:bg-red-900/50 border border-red-200 dark:border-red-800 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>
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- Botón Nuevo -->
|
<!-- Botón Nuevo -->
|
||||||
<a href="{{ route('productos.create') }}" class="w-full md:w-auto text-center px-5 py-3 text-sm font-bold text-neon-lime dark:text-neutral-900 bg-neutral-950 dark:bg-neon-lime rounded-lg hover:bg-neutral-900/80 hover:dark:bg-[#b3e600] transition-colors uppercase tracking-wide">
|
<a href="{{ route('productos.create') }}" class="w-full xl:w-auto text-center px-5 py-3 text-sm font-bold text-neon-lime dark:text-neutral-900 bg-neutral-950 dark:bg-neon-lime rounded-lg hover:bg-neutral-900/80 hover:dark:bg-[#b3e600] transition-colors uppercase tracking-wide">
|
||||||
+ Nuevo Producto
|
+ Nuevo Producto
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tabla de Productos -->
|
<!-- Tabla de Productos -->
|
||||||
<div class="relative overflow-x-auto shadow-md sm:rounded-lg border border-gray-400 dark:border-neutral-800 w-full">
|
<div class="relative overflow-x-auto shadow-md sm:rounded-lg border border-gray-400 dark:border-neutral-800 w-full">
|
||||||
<table class="w-full text-sm text-left rtl:text-right text-neutral-900 dark:text-white">
|
<table class="w-full text-sm text-left rtl:text-right text-neutral-900 dark:text-white">
|
||||||
<thead class="text-xs text-neutral-800 dark:text-gray-300 uppercase bg-gray-400 dark:bg-neutral-800 border-b border-gray-300 dark:border-neutral-700">
|
<thead class="text-xs text-neutral-800 dark:text-gray-300 uppercase bg-gray-400 dark:bg-neutral-800 border-b border-gray-300 dark:border-neutral-700">
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="col" class="px-6 py-3">Producto / SKU</th>
|
<th scope="col" class="px-6 py-3">Producto</th>
|
||||||
<th scope="col" class="px-6 py-3">Tipo</th>
|
<th scope="col" class="px-6 py-3">Tipo</th>
|
||||||
<th scope="col" class="px-6 py-3">Precio</th>
|
<th scope="col" class="px-6 py-3">Precio</th>
|
||||||
<th scope="col" class="px-6 py-3 text-center">Stock</th>
|
<th scope="col" class="px-6 py-3 text-center">Stock</th>
|
||||||
@@ -54,13 +87,16 @@
|
|||||||
<tr class="bg-gray-200/50 dark:bg-neutral-900/50 border-b border-gray-400 dark:border-neutral-800 hover:bg-gray-400 hover:dark:bg-neutral-800 transition-colors group">
|
<tr class="bg-gray-200/50 dark:bg-neutral-900/50 border-b border-gray-400 dark:border-neutral-800 hover:bg-gray-400 hover:dark:bg-neutral-800 transition-colors group">
|
||||||
<td class="px-6 py-4 font-medium whitespace-nowrap">
|
<td class="px-6 py-4 font-medium whitespace-nowrap">
|
||||||
<div class="text-base font-bold">{{ $product->name }}</div>
|
<div class="text-base font-bold">{{ $product->name }}</div>
|
||||||
<div class="text-xs text-gray-600 dark:text-gray-400 font-mono">{{ $product->sku }}</div>
|
<div class="text-xs text-gray-600 dark:text-gray-400 font-mono">{{ $product->sku ?? 'Sin SKU' }}</div>
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4">
|
<td class="px-6 py-4">
|
||||||
@if($product->type === 'bike') <x-ui.badge color="neon">Bicicleta</x-ui.badge>
|
@if($product->type === 'bike') <x-ui.badge color="neon">Bicicleta</x-ui.badge>
|
||||||
@elseif($product->type === 'clothing') <x-ui.badge color="blue">Indumentaria</x-ui.badge>
|
@elseif($product->type === 'clothing') <x-ui.badge color="blue">Indumentaria</x-ui.badge>
|
||||||
@elseif($product->type === 'spare') <x-ui.badge color="gray">Repuesto</x-ui.badge>
|
@elseif($product->type === 'spare') <x-ui.badge color="gray">Repuesto</x-ui.badge>
|
||||||
@else <x-ui.badge color="yellow">Accesorio</x-ui.badge> @endif
|
@elseif($product->type === 'children') <x-ui.badge color="pink">Infantil</x-ui.badge>
|
||||||
|
@elseif($product->type === 'rollers') <x-ui.badge color="purple">Rollers</x-ui.badge>
|
||||||
|
@elseif($product->type === 'skate') <x-ui.badge color="orange">Skate</x-ui.badge>
|
||||||
|
@else <x-ui.badge color="yellow">Accesorio / Otro</x-ui.badge> @endif
|
||||||
</td>
|
</td>
|
||||||
<td class="px-6 py-4 font-mono">
|
<td class="px-6 py-4 font-mono">
|
||||||
${{ number_format($product->price, 2) }}
|
${{ number_format($product->price, 2) }}
|
||||||
@@ -107,6 +143,7 @@
|
|||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Paginación -->
|
<!-- Paginación -->
|
||||||
<div class="mt-4 w-full">
|
<div class="mt-4 w-full">
|
||||||
{{ $products->links() }}
|
{{ $products->links() }}
|
||||||
|
|||||||
@@ -27,19 +27,23 @@
|
|||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-bold text-gray-400 uppercase mb-2">Propietario</label>
|
<label class="block text-xs font-bold text-gray-400 uppercase mb-2">Propietario</label>
|
||||||
<select name="client_id" class="w-full bg-neutral-900 border border-neutral-700 text-white rounded-lg p-2.5 focus:ring-neon-lime focus:border-neon-lime">
|
<select name="client_id" class="w-full bg-neutral-900 border border-neutral-700 text-white rounded-lg p-2.5 focus:ring-neon-lime focus:border-neon-lime">
|
||||||
|
<option value="" disabled {{ !request('new_client_id') ? 'selected' : '' }}>-- Seleccione un propietario --</option>
|
||||||
@foreach($clients as $client)
|
@foreach($clients as $client)
|
||||||
<option value="{{ $client->id }}">{{ $client->name }}</option>
|
|
||||||
|
<option value="{{ $client->id }}" {{ request('new_client_id') == $client->id ? 'selected' : '' }}>
|
||||||
|
{{ $client->name }}
|
||||||
|
</option>
|
||||||
@endforeach
|
@endforeach
|
||||||
</select>
|
</select>
|
||||||
<a href="{{ route('clients.create', ['origin' => 'taller']) }}" class="text-xs text-neon-lime hover:underline mt-1 inline-block">+ Nuevo Cliente</a>
|
<a href="{{ route('clients.create', ['origin' => 'taller']) }}" class="text-xs text-neon-lime hover:underline mt-1 inline-block">+ Nuevo Cliente</a>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<label class="block text-xs font-bold text-gray-400 uppercase mb-2">Teléfono Aviso</label>
|
<label class="block text-xs font-bold text-gray-400 uppercase mb-2">Teléfono Aviso</label>
|
||||||
<input type="text" name="contact_phone" placeholder="Ingresar numero de telefono" class="w-full bg-neutral-900 border border-neutral-700 text-white rounded-lg p-2.5 focus:ring-neon-lime focus:border-neon-lime">
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
|
<input type="text" name="contact_phone" value="{{ request('new_client_phone') }}" placeholder="Ingresar numero de telefono" class="w-full bg-neutral-900 border border-neutral-700 text-white rounded-lg p-2.5 focus:ring-neon-lime focus:border-neon-lime">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<!-- 2. Diagnóstico y Repuestos -->
|
<!-- 2. Diagnóstico y Repuestos -->
|
||||||
<div class="border-b border-neutral-800 pb-6">
|
<div class="border-b border-neutral-800 pb-6">
|
||||||
<h3 class="text-white font-bold uppercase tracking-wider text-sm mb-4 flex items-center gap-2">
|
<h3 class="text-white font-bold uppercase tracking-wider text-sm mb-4 flex items-center gap-2">
|
||||||
|
|||||||
Reference in New Issue
Block a user