feat: importar csv y auditar ediciones

This commit is contained in:
mono
2026-10-25 18:20:04 -05:00
parent 8e286d6fec
commit 01b5ee64cc
23 changed files with 483 additions and 19 deletions

View File

@@ -0,0 +1,31 @@
# Spec Delta
## Purpose
Garantiza que cambios posteriores al registro original de productores, productos y ventas sean explicables y aparezcan en la información exportada y reportada.
## ADDED Requirements
### Requirement: Editar registros operativos
The system SHALL allow editing producers, products, and sales from the application UI.
#### Scenario: Editar producto
- **WHEN** user edits a product and confirms with actor and reason
- **THEN** the product stores the new values
- **AND** the edit appears in the audit history
### Requirement: Auditoría obligatoria
The system SHALL require actor and non-empty reason for every edit and SHALL store before and after values with timestamp.
#### Scenario: Edición sin motivo
- **WHEN** user attempts to save an edit without actor or reason
- **THEN** the edit is not persisted
- **AND** an inline validation message identifies the missing data
### Requirement: Corrección de venta trazable
The system SHALL update inventory consistently when an existing sale is edited and SHALL preserve the original and corrected sale snapshots.
#### Scenario: Cambiar cantidad vendida
- **WHEN** user changes a sale line quantity with a valid audit reason
- **THEN** compensating inventory movement is recorded
- **AND** the audit entry identifies the original and new sale values

View File

@@ -0,0 +1,33 @@
# Spec Delta
## Purpose
Permite cargar rápidamente el inventario inicial desde archivos CSV locales, creando sólo las entidades que no existen y evitando duplicados por diferencias de formato en los nombres.
## ADDED Requirements
### Requirement: Importar inventario CSV
The system SHALL import CSV rows with product name, producer name, unit price, and optional quantity columns.
#### Scenario: Importación válida
- **GIVEN** a CSV with the required headers
- **WHEN** user previews and confirms the import
- **THEN** missing producers and products are created
- **AND** a positive quantity creates an initial inventory movement
- **AND** empty or zero quantity creates no movement
### Requirement: Comparación normalizada
The system SHALL match producer and product names ignoring case, accents, BOM, and redundant surrounding whitespace.
#### Scenario: Evitar duplicado
- **GIVEN** an existing producer `La Familia González`
- **WHEN** CSV contains ` la familia gonzalez `
- **THEN** the row uses the existing producer instead of creating a duplicate
### Requirement: Errores de importación
The system SHALL report invalid rows without persisting invalid records and SHALL show a summary of created, reused, skipped, and failed rows.
#### Scenario: Precio inválido
- **WHEN** a row has a non-numeric or negative price
- **THEN** that row is rejected with its line number and reason
- **AND** valid rows remain importable

View File

@@ -0,0 +1,28 @@
# Spec Delta
## Purpose
Permite que una persona siempre entienda dónde está y pueda volver a Inicio o al paso anterior sin depender del botón físico del dispositivo.
## ADDED Requirements
### Requirement: Navegación global visible
The system SHALL show a shared navigation context with a home action, back action, and breadcrumbs on every application view.
#### Scenario: Volver desde Jornada
- **WHEN** user navigates from Inicio to Jornada
- **THEN** the view shows the breadcrumb `Inicio > Jornada`
- **AND** selecting Inicio returns to the dashboard
- **AND** selecting Atrás returns to the previous route
#### Scenario: Fallback de Atrás
- **GIVEN** the user opened a deep link without router history
- **WHEN** user selects Atrás
- **THEN** the system navigates to Inicio instead of leaving the application
### Requirement: Navegación responsive
The system SHALL expose the same destinations through a visible desktop menu and an accessible mobile menu.
#### Scenario: Menú móvil
- **WHEN** viewport width is narrow
- **THEN** user can open the menu, choose Inventario, close it, and return to Inicio