refactor(ui): Rediseño completo de UI con Nuxt UI 4

- Nuevo layout responsivo mobile-first con tabs inferiores
- Sidebar colapsable en desktop con cola de impresión
- Sistema de templates reutilizables con localStorage
- Soporte Dark/Light mode con UColorModeButton
- Composables usePrintQueue y useTemplates para estado global
- Componentes modulares: CommandBuilder, QuickActions, PrintQueue, QueueItem
- Navegación por tabs: Constructor | Cola | Templates
This commit is contained in:
2025-11-24 17:46:20 -06:00
parent f3c13b356b
commit 470ecef4f1
39 changed files with 16114 additions and 1856 deletions

View File

@@ -0,0 +1,54 @@
// Endpoint genérico de impresión que acepta una lista de operaciones
import { buildFromOperations, type Operation } from '~/server/utils/eposBuilder'
import { buildSoapEnvelope, sendToPrinter, parsePrinterResponse } from '~/server/utils/printer'
export default defineEventHandler(async (event) => {
try {
const config = useRuntimeConfig()
const body = await readBody(event)
const {
operations = [],
dryRun = false
} = body as {
operations?: Operation[]
dryRun?: boolean
}
// Construir el XML interior con las operaciones
const inner = buildFromOperations(operations)
const soap = buildSoapEnvelope(inner)
// Si es dryRun, devolver solo el XML sin enviar a la impresora
if (dryRun) {
return {
ok: true,
dryRun: true,
soap
}
}
// Enviar a la impresora
const result = await sendToPrinter(
soap,
config.printerHost,
config.printerDeviceId,
parseInt(config.printerTimeoutMs)
)
// Parsear la respuesta
const { success, code } = parsePrinterResponse(result.data)
return {
ok: success,
httpStatus: result.status,
code,
raw: result.data
}
} catch (err: any) {
return {
ok: false,
error: err.message
}
}
})