feat: UI completa funcional para todos los módulos
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import Dexie, { Table } from 'dexie';
|
||||
import Dexie, { type Table } from 'dexie';
|
||||
import type { Productor, Producto, MovimientoInventario, Venta, VentaLinea, Gasto, Ajuste, CuadreCaja } from '@toldo/core';
|
||||
|
||||
export class ToldoDB extends Dexie {
|
||||
|
||||
@@ -14,14 +14,13 @@ export class ProductoRepository {
|
||||
return db.productos.get(id);
|
||||
}
|
||||
|
||||
async create(producto: Producto): Promise<string> {
|
||||
// Ensure uniqueness by (productorId, nombrePresentacion)
|
||||
async create(producto: Producto): Promise<any> {
|
||||
const exists = await db.productos
|
||||
.where('[productorId+nombrePresentacion]')
|
||||
.equals([producto.productorId, producto.nombrePresentacion])
|
||||
.first();
|
||||
if (exists) throw new Error('Ya existe un producto con ese nombre para este productor');
|
||||
return db.productos.add(producto);
|
||||
return db.productos.add(producto as any);
|
||||
}
|
||||
|
||||
async update(producto: Producto): Promise<number> {
|
||||
|
||||
@@ -10,8 +10,8 @@ export class ProductorRepository {
|
||||
return db.productores.get(id);
|
||||
}
|
||||
|
||||
async create(productor: Productor): Promise<string> {
|
||||
return db.productores.add(productor);
|
||||
async create(productor: Productor): Promise<any> {
|
||||
return db.productores.add(productor as any);
|
||||
}
|
||||
|
||||
async update(productor: Productor): Promise<number> {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { db } from '@toldo/data';
|
||||
import type { Ajuste, MovimientoInventario } from '@toldo/core';
|
||||
import type { Ajuste } from '@toldo/core';
|
||||
import { validateAjusteMotivo } from '@toldo/core';
|
||||
|
||||
export class AjustesService {
|
||||
|
||||
@@ -11,7 +11,7 @@ export class InventarioService {
|
||||
cantidad,
|
||||
createdAt: new Date()
|
||||
};
|
||||
return db.movimientosInventario.add(mov.id, mov);
|
||||
return db.movimientosInventario.add(mov);
|
||||
}
|
||||
|
||||
async registrarIngresoSemana(productoId: string, cantidad: number, fecha: Date, recibidoPor: string) {
|
||||
@@ -24,7 +24,7 @@ export class InventarioService {
|
||||
recibidoPor,
|
||||
createdAt: new Date()
|
||||
};
|
||||
return db.movimientosInventario.add(mov.id, mov);
|
||||
return db.movimientosInventario.add(mov);
|
||||
}
|
||||
|
||||
async calcularSaldoProducto(productoId: string): Promise<number> {
|
||||
|
||||
Reference in New Issue
Block a user