This commit is contained in:
2025-12-07 22:42:23 +01:00
parent d33b908775
commit 8faaef1ef5
3 changed files with 15 additions and 14 deletions

View File

@@ -1,9 +1,9 @@
import { FastifyInstance } from "fastify";
import {createInvoicePDF, createTimeSheetPDF} from "../utils/pdf";
import {encodeBase64ToNiimbot, generateLabel, useNextNumberRangeNumber} from "../utils/functions";
//import {encodeBase64ToNiimbot, generateLabel, useNextNumberRangeNumber} from "../utils/functions";
import dayjs from "dayjs";
import { ready as zplReady } from 'zpl-renderer-js'
import { renderZPL } from "zpl-image";
//import { ready as zplReady } from 'zpl-renderer-js'
//import { renderZPL } from "zpl-image";
import customParseFormat from "dayjs/plugin/customParseFormat.js";
import isoWeek from "dayjs/plugin/isoWeek.js";
@@ -155,7 +155,7 @@ export default async function functionRoutes(server: FastifyInstance) {
}
})
server.post('/print/zpl/preview', async (req, reply) => {
/*server.post('/print/zpl/preview', async (req, reply) => {
const { zpl, widthMm = 50, heightMm = 30, dpmm = 8, asBase64 = false } = req.body as {zpl:string,widthMm:number,heightMm:number,dpmm:number,asBase64:string}
console.log(widthMm,heightMm,dpmm)
@@ -192,6 +192,6 @@ export default async function functionRoutes(server: FastifyInstance) {
console.error('[ZPL Preview Error]', err)
return reply.code(500).send({ error: err.message || 'Failed to render ZPL' })
}
})
})*/
}

View File

@@ -7,7 +7,7 @@ export default async function staffTimeRoutes(server: FastifyInstance) {
server.post(
'/staff/time',
async (req, reply) => {
const { started_at, stopped_at, type = 'work', description, user_id } = req.body
const { started_at, stopped_at, type = 'work', description, user_id } = req.body as any
const userId = req.user.user_id
const tenantId = req.user.tenant_id

View File

@@ -1,11 +1,11 @@
import {FastifyInstance} from "fastify";
import { PNG } from 'pngjs'
import { ready as zplReady } from 'zpl-renderer-js'
import { Utils } from '@mmote/niimbluelib'
import { createCanvas } from 'canvas'
import bwipjs from 'bwip-js'
import Sharp from 'sharp'
import fs from 'fs'
// import { PNG } from 'pngjs'
// import { ready as zplReady } from 'zpl-renderer-js'
// import { Utils } from '@mmote/niimbluelib'
// import { createCanvas } from 'canvas'
// import bwipjs from 'bwip-js'
// import Sharp from 'sharp'
// import fs from 'fs'
export const useNextNumberRangeNumber = async (server:FastifyInstance, tenantId:number,numberRange)=> {
const {data:tenant} = await server.supabase.from("tenants").select().eq("id",tenantId).single()
@@ -29,6 +29,7 @@ export const useNextNumberRangeNumber = async (server:FastifyInstance, tenantId:
}
}
/*
export async function encodeBase64ToNiimbot(base64Png, printDirection = 'top') {
// 1⃣ PNG dekodieren
const buffer = Buffer.from(base64Png, 'base64')
@@ -140,4 +141,4 @@ export async function generateLabel(context,width,height) {
const base64 = final.toString('base64')
return base64
}
}*/