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:
36
server/api/print/cut.post.ts
Normal file
36
server/api/print/cut.post.ts
Normal file
@@ -0,0 +1,36 @@
|
||||
// Endpoint para cortar papel
|
||||
import { buildFromOperations } 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 { type = 'feed' } = body as { type?: string }
|
||||
|
||||
const inner = buildFromOperations([{ op: 'cut', type }])
|
||||
const soap = buildSoapEnvelope(inner)
|
||||
|
||||
const result = await sendToPrinter(
|
||||
soap,
|
||||
config.printerHost,
|
||||
config.printerDeviceId,
|
||||
parseInt(config.printerTimeoutMs)
|
||||
)
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user