Remove QR code from printed labels, keep barcode only
Deploy to LXC / deploy (push) Successful in 19s
Deploy to LXC / deploy (push) Successful in 19s
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,9 +3,7 @@ import { db } from '$lib/server/db/index.js';
|
|||||||
import { components } from '$lib/server/db/schema.js';
|
import { components } from '$lib/server/db/schema.js';
|
||||||
import { eq } from 'drizzle-orm';
|
import { eq } from 'drizzle-orm';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import { generateQrSvg } from '$lib/server/qr.js';
|
|
||||||
import { generateBarcodeSvg } from '$lib/server/barcode.js';
|
import { generateBarcodeSvg } from '$lib/server/barcode.js';
|
||||||
import { env } from '$env/dynamic/private';
|
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ params }) => {
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
const [component] = await db
|
const [component] = await db
|
||||||
@@ -21,10 +19,8 @@ export const load: PageServerLoad = async ({ params }) => {
|
|||||||
|
|
||||||
if (!component) error(404, 'Component not found');
|
if (!component) error(404, 'Component not found');
|
||||||
|
|
||||||
const url = `${env.BASE_URL ?? 'http://localhost:5173'}/components/${params.id}`;
|
|
||||||
const qrSvg = await generateQrSvg(url);
|
|
||||||
const shortId = component.id.slice(0, 8).toUpperCase();
|
const shortId = component.id.slice(0, 8).toUpperCase();
|
||||||
const barcodeDataUrl = await generateBarcodeSvg(shortId);
|
const barcodeDataUrl = await generateBarcodeSvg(shortId);
|
||||||
|
|
||||||
return { component, qrSvg, barcodeDataUrl, shortId };
|
return { component, barcodeDataUrl, shortId };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,10 +37,7 @@
|
|||||||
|
|
||||||
{#each Array(copies) as _}
|
{#each Array(copies) as _}
|
||||||
<div class="label" style="width: 70mm; height: 29mm; background: white; color: black; box-sizing: border-box; padding: 1.5mm 2mm; margin: 0 auto 8px auto; border: 1px dashed #ccc; overflow: hidden;">
|
<div class="label" style="width: 70mm; height: 29mm; background: white; color: black; box-sizing: border-box; padding: 1.5mm 2mm; margin: 0 auto 8px auto; border: 1px dashed #ccc; overflow: hidden;">
|
||||||
<div style="display: flex; align-items: center; gap: 3mm; height: 100%; font-family: Arial, Helvetica, sans-serif;">
|
<div style="display: flex; align-items: center; height: 100%; font-family: Arial, Helvetica, sans-serif;">
|
||||||
<div style="width: 23mm; height: 23mm; flex-shrink: 0;">
|
|
||||||
{@html data.qrSvg}
|
|
||||||
</div>
|
|
||||||
<div style="flex: 1; min-width: 0;">
|
<div style="flex: 1; min-width: 0;">
|
||||||
<div style="font-size: 10pt; font-weight: bold; color: #000; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
<div style="font-size: 10pt; font-weight: bold; color: #000; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
||||||
{data.component.title}
|
{data.component.title}
|
||||||
|
|||||||
@@ -3,9 +3,7 @@ import { db } from '$lib/server/db/index.js';
|
|||||||
import { devices } from '$lib/server/db/schema.js';
|
import { devices } from '$lib/server/db/schema.js';
|
||||||
import { eq } from 'drizzle-orm';
|
import { eq } from 'drizzle-orm';
|
||||||
import { error } from '@sveltejs/kit';
|
import { error } from '@sveltejs/kit';
|
||||||
import { generateQrSvg } from '$lib/server/qr.js';
|
|
||||||
import { generateBarcodeSvg } from '$lib/server/barcode.js';
|
import { generateBarcodeSvg } from '$lib/server/barcode.js';
|
||||||
import { env } from '$env/dynamic/private';
|
|
||||||
|
|
||||||
export const load: PageServerLoad = async ({ params }) => {
|
export const load: PageServerLoad = async ({ params }) => {
|
||||||
const [device] = await db
|
const [device] = await db
|
||||||
@@ -24,10 +22,8 @@ export const load: PageServerLoad = async ({ params }) => {
|
|||||||
|
|
||||||
if (!device) error(404, 'Device not found');
|
if (!device) error(404, 'Device not found');
|
||||||
|
|
||||||
const url = `${env.BASE_URL ?? 'http://localhost:5173'}/devices/${params.id}`;
|
|
||||||
const qrSvg = await generateQrSvg(url);
|
|
||||||
const shortId = device.id.slice(0, 8).toUpperCase();
|
const shortId = device.id.slice(0, 8).toUpperCase();
|
||||||
const barcodeDataUrl = await generateBarcodeSvg(shortId);
|
const barcodeDataUrl = await generateBarcodeSvg(shortId);
|
||||||
|
|
||||||
return { device, qrSvg, barcodeDataUrl, shortId };
|
return { device, barcodeDataUrl, shortId };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -37,10 +37,7 @@
|
|||||||
|
|
||||||
{#each Array(copies) as _}
|
{#each Array(copies) as _}
|
||||||
<div class="label" style="width: 70mm; height: 29mm; background: white; color: black; box-sizing: border-box; padding: 1.5mm 2mm; margin: 0 auto 8px auto; border: 1px dashed #ccc; overflow: hidden;">
|
<div class="label" style="width: 70mm; height: 29mm; background: white; color: black; box-sizing: border-box; padding: 1.5mm 2mm; margin: 0 auto 8px auto; border: 1px dashed #ccc; overflow: hidden;">
|
||||||
<div style="display: flex; align-items: center; gap: 3mm; height: 100%; font-family: Arial, Helvetica, sans-serif;">
|
<div style="display: flex; align-items: center; height: 100%; font-family: Arial, Helvetica, sans-serif;">
|
||||||
<div style="width: 23mm; height: 23mm; flex-shrink: 0;">
|
|
||||||
{@html data.qrSvg}
|
|
||||||
</div>
|
|
||||||
<div style="flex: 1; min-width: 0;">
|
<div style="flex: 1; min-width: 0;">
|
||||||
<div style="font-size: 10pt; font-weight: bold; color: #000; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
<div style="font-size: 10pt; font-weight: bold; color: #000; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
|
||||||
{data.device.title}
|
{data.device.title}
|
||||||
|
|||||||
Reference in New Issue
Block a user