refactor(web): pantallas y formularios separados por módulo (ventas, compras, inventario)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
8b0b8afc87
commit
c5368c7ad0
10 files changed
+358
-311
No files matched your search
@@ -0,0 +1,58 @@
|
||||
import {
|
||||
type DocumentLayout,
|
||||
FIELDS,
|
||||
blankLine,
|
||||
commentsOnly,
|
||||
descriptionColumn,
|
||||
itemColumn,
|
||||
priceColumn,
|
||||
quantityColumn,
|
||||
today,
|
||||
warehouseColumn,
|
||||
} from '../document-layouts';
|
||||
|
||||
/** Entradas y salidas de mercancía: artículo, cantidad, almacén y precio (opcional: si falta, SAP usa el costo). */
|
||||
export const goodsLayout: DocumentLayout = {
|
||||
lines: { key: 'DocumentLines', fields: ['ItemCode', 'ItemDescription', 'Quantity', 'UoMEntry', 'WarehouseCode', 'Price'], base: false },
|
||||
header: { left: [FIELDS.docDate], right: [FIELDS.docNum] },
|
||||
footer: commentsOnly,
|
||||
columns: [itemColumn, descriptionColumn, quantityColumn, { ...warehouseColumn, required: true }, priceColumn],
|
||||
newHeader: () => ({ DocDate: today() }),
|
||||
newLine: () => ({ ...blankLine(), Price: null }),
|
||||
immutable: true,
|
||||
requiredLine: [{ key: 'WarehouseCode', label: 'el almacén' }],
|
||||
};
|
||||
|
||||
/** Transferencias de stock y solicitudes de traslado: almacén origen y destino en la cabecera y en cada línea. */
|
||||
const transfer = (immutable: boolean): DocumentLayout => ({
|
||||
lines: { key: 'StockTransferLines', fields: ['ItemCode', 'ItemDescription', 'Quantity', 'FromWarehouseCode', 'WarehouseCode'], base: false },
|
||||
header: { left: [FIELDS.fromWarehouse, FIELDS.toWarehouse], right: [FIELDS.docNum, FIELDS.docDate] },
|
||||
footer: commentsOnly,
|
||||
columns: [
|
||||
itemColumn,
|
||||
descriptionColumn,
|
||||
quantityColumn,
|
||||
{
|
||||
...warehouseColumn,
|
||||
key: 'FromWarehouseCode',
|
||||
title: 'Almacén origen',
|
||||
required: true,
|
||||
lookup: { ...warehouseColumn.lookup!, apply: (wh, line) => ({ ...line, FromWarehouseCode: wh['WarehouseCode'] }) },
|
||||
},
|
||||
{ ...warehouseColumn, title: 'Almacén destino', required: true },
|
||||
],
|
||||
newHeader: () => ({ DocDate: today() }),
|
||||
newLine: (header) => ({
|
||||
...blankLine(),
|
||||
FromWarehouseCode: header['FromWarehouse'] ?? '',
|
||||
WarehouseCode: header['ToWarehouse'] ?? '',
|
||||
}),
|
||||
immutable,
|
||||
requiredLine: [
|
||||
{ key: 'FromWarehouseCode', label: 'el almacén origen' },
|
||||
{ key: 'WarehouseCode', label: 'el almacén destino' },
|
||||
],
|
||||
});
|
||||
|
||||
export const transferLayout: DocumentLayout = transfer(true);
|
||||
export const transferRequestLayout: DocumentLayout = transfer(false);
|
||||
Reference in new issue
Block a user