Monedero configurable por servicio y artículo
- Campo genera_monedero (default true) en servicios e items de inventario - Puntos proporcionales a las líneas elegibles al liquidar la venta - Toggle con icono Wallet en Servicios e Inventario
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { FC } from 'react';
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { useSearchParams } from 'react-router-dom';
|
||||
import { Boxes, Plus, AlertTriangle, PackageCheck, ArrowDownToLine, ArrowUpFromLine, History } from 'lucide-react';
|
||||
import { Boxes, Plus, AlertTriangle, PackageCheck, ArrowDownToLine, ArrowUpFromLine, History, Wallet } from 'lucide-react';
|
||||
import Layout from '../components/Layout';
|
||||
import MovimientosPanel from '../components/inventario/MovimientosPanel';
|
||||
import AlertasPanel from '../components/inventario/AlertasPanel';
|
||||
@@ -153,6 +153,16 @@ const Inventario: FC = () => {
|
||||
}
|
||||
};
|
||||
|
||||
const toggleMonedero = async (it: InventoryItem) => {
|
||||
try {
|
||||
await odooApi.updateInventoryItem(it.id, { genera_monedero: it.genera_monedero === false });
|
||||
toast.success(it.genera_monedero === false ? 'El artículo ahora genera monedero' : 'El artículo ya no genera monedero');
|
||||
load();
|
||||
} catch {
|
||||
toast.error('Error al actualizar monedero');
|
||||
}
|
||||
};
|
||||
|
||||
const lvl = summary.levels;
|
||||
|
||||
return (
|
||||
@@ -276,6 +286,17 @@ const Inventario: FC = () => {
|
||||
<td className="px-4 py-3 text-theme-muted">{it.expiry_date || '—'}</td>
|
||||
<td className="px-4 py-3">
|
||||
<div className="flex justify-end gap-2">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="ghost"
|
||||
onClick={() => toggleMonedero(it)}
|
||||
title={it.genera_monedero === false ? 'No genera monedero — clic para activar' : 'Genera monedero — clic para desactivar'}
|
||||
>
|
||||
<Wallet
|
||||
size={14}
|
||||
className={it.genera_monedero === false ? 'text-theme-muted opacity-50' : 'text-theme-accent'}
|
||||
/>
|
||||
</Button>
|
||||
<Button size="sm" variant="outline" onClick={() => openHistory(it)}><History size={14} /></Button>
|
||||
<Button size="sm" onClick={() => openAdjust(it)}>Ajustar</Button>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user