Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/Http/Controllers/BlCuentaCobroController.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ class BlCuentaCobroController extends Controller
{
public function index()
{
// .items.empaque.producto
// .producto
$user = Auth::user();
$cuentas = BlCuentaCobro::with(['items.marcacion.pedido', 'usuario'])->get();
$cuentas = BlCuentaCobro::with(['items.marcacion.pedido.items.empaque', 'usuario'])->get();
return Inertia::render('BLCuentaCobro', [
'user' => $user,
'cuentasCobro' => $cuentas,
Expand Down
81 changes: 64 additions & 17 deletions resources/js/components/BL/ListaInventario.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// resources/js/Components/ListaInventario.jsx
import React from 'react';
import React, { useState } from 'react';

const ListaInventario = ({
productos,
Expand All @@ -14,11 +14,45 @@ const ListaInventario = ({
onLimpiarFiltros,
onEstanteriaClick
}) => {
const [expandida, setExpandida] = useState(true);

const toggleExpandida = () => {
setExpandida(!expandida);
};

// Si está contraída, mostrar solo un ícono pequeño
if (!expandida) {
return (
<div className="w-16 bg-white/80 backdrop-blur-sm border border-white/30 shadow-2xl rounded-3xl p-4 flex flex-col items-center justify-center">
<button
onClick={toggleExpandida}
className="p-3 bg-blue-500 text-white rounded-full hover:bg-blue-600 transition-all duration-300 hover:scale-110"
title="Expandir lista de inventario"
>
<svg className="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M9 5l7 7-7 7" />
</svg>
</button>
<span className="text-xs text-gray-600 mt-2 text-center">Mostrar Lista</span>
</div>
);
}

// Si está expandida, mostrar la lista completa
return (
<div className="w-[450px] bg-white/80 backdrop-blur-sm border border-white/30 shadow-2xl rounded-3xl p-6 overflow-hidden flex flex-col">
{/* Header */}
<div className="w-full sm:w-[350px] md:w-[400px] lg:w-[450px] bg-white/80 backdrop-blur-sm border border-white/30 shadow-2xl rounded-3xl p-6 overflow-hidden flex flex-col transition-all duration-300">
{/* Header con botón de cerrar */}
<div className="flex justify-between items-center mb-4">
<h2 className="text-2xl font-bold text-gray-800">📦 Inventario</h2>
<button
onClick={toggleExpandida}
className="p-2 text-gray-500 hover:text-gray-700 hover:bg-gray-100 rounded-full transition-all duration-200"
title="Contraer lista"
>
<svg className="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />
</svg>
</button>
</div>

{/* Filtros y búsqueda */}
Expand All @@ -27,22 +61,22 @@ const ListaInventario = ({
<input
type="text"
placeholder="Buscar producto, color, tipo o ubicación..."
className="flex-1 border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
className="flex-1 border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm"
value={busqueda}
onChange={(e) => onBusquedaChange(e.target.value)}
/>
<button
className="bg-blue-500 text-white px-4 py-2 rounded-lg hover:bg-blue-600 transition"
className="bg-blue-500 text-white px-3 py-2 rounded-lg hover:bg-blue-600 transition text-sm whitespace-nowrap"
onClick={onLimpiarFiltros}
>
Limpiar
</button>
</div>

<div className="flex items-center gap-2">
<span className="text-gray-700 font-medium">Categoría:</span>
<span className="text-gray-700 font-medium text-sm">Categoría:</span>
<select
className="border border-gray-300 rounded-lg px-3 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500"
className="border border-gray-300 rounded-lg px-2 py-2 focus:outline-none focus:ring-2 focus:ring-blue-500 text-sm flex-1"
value={categoriaFiltro}
onChange={(e) => onCategoriaChange(e.target.value)}
>
Expand All @@ -56,11 +90,11 @@ const ListaInventario = ({
{/* Información de filtros activos */}
{filtro && (
<div className="mb-4 p-3 bg-blue-50 border border-blue-200 rounded-lg flex justify-between items-center">
<span className="text-blue-700">
<span className="text-blue-700 text-sm">
Filtrado por: <strong>{filtro}</strong>
</span>
<button
className="text-blue-600 hover:text-blue-800 text-sm font-medium"
className="text-blue-600 hover:text-blue-800 text-xs font-medium"
onClick={() => onFiltroChange(null)}
>
Quitar filtro
Expand All @@ -69,7 +103,7 @@ const ListaInventario = ({
)}

{/* Contador de resultados */}
<div className="mb-3 text-sm text-gray-600">
<div className="mb-3 text-xs text-gray-600">
Mostrando {productosFiltrados.length} de {productos.length} productos
{productosFiltrados.some(p => !p.tiene_ubicacion) && (
<span className="text-red-500 ml-2">⚠️ Algunos sin ubicación</span>
Expand All @@ -82,38 +116,51 @@ const ListaInventario = ({
productosFiltrados.map((p) => (
<div
key={p.id}
className={`border-b border-gray-200 py-3 px-2 hover:bg-blue-50 rounded-lg transition cursor-pointer flex justify-between items-center ${
className={`border-b border-gray-200 py-2 px-2 hover:bg-blue-50 rounded-lg transition cursor-pointer flex justify-between items-center ${
!p.tiene_ubicacion ? 'bg-red-50 border-l-4 border-l-red-400' : ''
}`}
onClick={() => onEstanteriaClick(p.estanteria)}
>
<div className="max-w-[60%]">
<div className="font-medium text-gray-800 text-base truncate">
<div className="font-medium text-gray-800 text-sm truncate">
{p.descripcion || `${p.tipo_producto} ${p.color_nombre} ${p.tamanio}`}
{!p.tiene_ubicacion && (
<span className="text-red-500 text-xs ml-2">⚠️ Sin ubicación</span>
<span className="text-red-500 text-xs ml-1">⚠️</span>
)}
</div>
<div className="text-xs text-gray-500">
<div className="text-xs text-gray-500 truncate">
{p.tipo_producto} • {p.color_nombre} • {p.tamanio}
</div>
</div>
<div className="text-right max-w-[40%]">
<div className={`text-sm font-medium truncate ${
<div className={`text-xs font-medium truncate ${
!p.tiene_ubicacion ? 'text-red-700' : 'text-gray-700'
}`}>
{p.estanteria}
</div>
<div className="text-xs text-gray-500">{p.stock_total} unidades</div>
<div className="text-xs text-gray-500">{p.stock_total}u</div>
</div>
</div>
))
) : (
<div className="text-center py-8 text-gray-500">
<div className="text-center py-8 text-gray-500 text-sm">
No se encontraron productos con los filtros aplicados
</div>
)}
</div>

{/* Botón flotante para contraer (alternativo) */}
<div className="mt-4 pt-4 border-t border-gray-200">
<button
onClick={toggleExpandida}
className="w-full py-2 bg-gray-100 text-gray-600 rounded-lg hover:bg-gray-200 transition flex items-center justify-center gap-2 text-sm"
>
<svg className="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24">
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M15 19l-7-7 7-7" />
</svg>
Ocultar lista
</button>
</div>
</div>
);
};
Expand Down
Loading
Loading