@7365admin1/layer-common 4.97.1-staging.704 → 4.97.1-staging.706
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -287,11 +287,14 @@
|
|
|
287
287
|
"No sticker" adds the vehicle alone. With several plates the
|
|
288
288
|
sticker goes on the first plate, as Link QR sticker does per plate.
|
|
289
289
|
-->
|
|
290
|
-
<div v-if="prop.qrLink &&
|
|
290
|
+
<div v-if="prop.qrLink && qrPickerOn" class="w-100 mt-3">
|
|
291
291
|
<InputLabel title="QR sticker" />
|
|
292
292
|
<v-autocomplete
|
|
293
293
|
v-model="qrPick"
|
|
294
|
+
v-model:search="qrPickSearch"
|
|
294
295
|
:items="qrPickItems"
|
|
296
|
+
no-filter
|
|
297
|
+
placeholder="Type a sticker number, e.g. TLR120 or 120"
|
|
295
298
|
density="comfortable"
|
|
296
299
|
:hint="newPlateNumbers.filter(Boolean).length > 1 ? 'Linked to the first plate number above.' : 'Type a sticker number to find it.'"
|
|
297
300
|
persistent-hint
|
|
@@ -595,16 +598,45 @@ const {
|
|
|
595
598
|
*/
|
|
596
599
|
const qrPicks = ref<BlankPick[]>([]);
|
|
597
600
|
const qrPick = ref("");
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
601
|
+
// the picked sticker stays listed while a search shows other numbers
|
|
602
|
+
const qrPicked = ref<BlankPick | null>(null);
|
|
603
|
+
const qrPickSearch = ref("");
|
|
604
|
+
const qrPickItems = computed(() => {
|
|
605
|
+
const list = qrPicked.value && !qrPicks.value.some((p) => p.code === qrPicked.value!.code)
|
|
606
|
+
? [qrPicked.value, ...qrPicks.value]
|
|
607
|
+
: qrPicks.value;
|
|
608
|
+
return [...list.map((p) => ({ title: blankPickLabel(p), value: p.code })), { title: "No sticker", value: "" }];
|
|
609
|
+
});
|
|
610
|
+
watch(qrPick, (code) => {
|
|
611
|
+
qrPicked.value = [qrPicked.value, ...qrPicks.value].find((p) => p?.code === code) ?? null;
|
|
612
|
+
});
|
|
613
|
+
// shown when the site has any free sticker - a search with no match keeps it open
|
|
614
|
+
const qrPickerOn = ref(false);
|
|
615
|
+
/*
|
|
616
|
+
* Search the site's whole list on the server as the person types (owner
|
|
617
|
+
* 2026-11-17: a site can hold hundreds of blank stickers; the first 50 alone
|
|
618
|
+
* could not find TLR120).
|
|
619
|
+
*/
|
|
620
|
+
async function loadQrPicks(search = "") {
|
|
621
|
+
const res = await getBlankStickersBySerial(prop.site, { search, limit: 50 });
|
|
622
|
+
qrPicks.value = res.items;
|
|
623
|
+
return res;
|
|
624
|
+
}
|
|
625
|
+
let qrPickTimer: ReturnType<typeof setTimeout> | undefined;
|
|
626
|
+
watch(qrPickSearch, (v) => {
|
|
627
|
+
clearTimeout(qrPickTimer);
|
|
628
|
+
const text = String(v ?? "");
|
|
629
|
+
// picking a line puts its label in the search text - that is not a search
|
|
630
|
+
if (qrPickItems.value.some((i) => i.title === text)) return;
|
|
631
|
+
qrPickTimer = setTimeout(() => loadQrPicks(text).catch(() => {}), 250);
|
|
632
|
+
});
|
|
602
633
|
onMounted(async () => {
|
|
603
634
|
if (!prop.qrLink || prop.mode !== "add") return;
|
|
604
635
|
try {
|
|
605
|
-
const res = await
|
|
606
|
-
|
|
636
|
+
const res = await loadQrPicks();
|
|
637
|
+
qrPickerOn.value = res.items.length > 0;
|
|
607
638
|
qrPick.value = res.next?.code ?? "";
|
|
639
|
+
qrPicked.value = res.next ?? null;
|
|
608
640
|
} catch {
|
|
609
641
|
qrPicks.value = []; // ponytail: no list, no picker - the vehicle still adds
|
|
610
642
|
}
|
|
@@ -615,7 +647,7 @@ async function linkPickedSticker(plates: string[]): Promise<{ text: string; ok:
|
|
|
615
647
|
const code = qrPick.value;
|
|
616
648
|
const plate = plates[0];
|
|
617
649
|
if (!code || !plate) return { text: "", ok: true };
|
|
618
|
-
const label = blankPickLabel(qrPicks.value.find((p) => p.code === code) ?? { token: code, code });
|
|
650
|
+
const label = blankPickLabel(qrPicked.value?.code === code ? qrPicked.value : qrPicks.value.find((p) => p.code === code) ?? { token: code, code });
|
|
619
651
|
try {
|
|
620
652
|
const found = await checkExistingPlates({ site: prop.site, plateNumbers: [plate] });
|
|
621
653
|
const key = (v: unknown) => String(v ?? "").replace(/[^A-Za-z0-9]/g, "").toUpperCase();
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
</v-btn-toggle>
|
|
21
21
|
<div v-if="mode === 'blank'" data-test="vehicle-qr-blank">
|
|
22
22
|
<p class="text-body-2 mb-3">
|
|
23
|
-
Make QR stickers before you know which car each is for. Each sticker has its own code
|
|
24
|
-
on a car, then link it to that vehicle in Vehicles > Link QR sticker - or scan it with iMA365 / iSecure365
|
|
23
|
+
Make QR stickers before you know which car each is for. Each sticker has its own QR code and sticker number. Paste
|
|
24
|
+
it on a car, then link it to that vehicle by its number in Vehicles > Link QR sticker - or scan it with iMA365 / iSecure365
|
|
25
25
|
and pick the vehicle there. Until it is linked, scanning it shows "not linked yet".
|
|
26
26
|
</p>
|
|
27
27
|
<p v-if="blankSummary" class="text-body-2 font-weight-medium mb-3" data-test="vehicle-qr-blank-summary">
|
|
@@ -219,7 +219,7 @@
|
|
|
219
219
|
<v-alert type="info" variant="tonal" density="compact" class="mt-2" data-test="vehicle-qr-cut-guide">
|
|
220
220
|
How to cut: first cut the sheet into pieces through the middle of the gaps (the small + marks show where),
|
|
221
221
|
then cut round each sticker {{ design.cutLines ? "on the light-grey line" : "along its edge" }} - with scissors
|
|
222
|
-
or a cutting machine. Cut off the strip
|
|
222
|
+
or a cutting machine.{{ blankQrSerialOnly ? "" : " Cut off the strip under each sticker before pasting." }}
|
|
223
223
|
</v-alert>
|
|
224
224
|
<v-alert type="info" variant="tonal" density="compact" class="mt-2" data-test="vehicle-qr-save-guide">
|
|
225
225
|
To print the same stickers again later: <b>Save sheet file</b> keeps this exact sheet on your computer - open
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.706",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
|
@@ -211,14 +211,15 @@ export function stickerSerial(item: Pick<StickerItem, "serialNo" | "serialLabel"
|
|
|
211
211
|
/**
|
|
212
212
|
* A blank sticker printed with its sticker number in place of the long code
|
|
213
213
|
* (design "Sticker code: Hide"). Only when it HAS a number - a sticker never
|
|
214
|
-
* goes out with neither the code nor a number on it.
|
|
214
|
+
* goes out with neither the code nor a number on it. Also a vehicle's sticker
|
|
215
|
+
* that came from a blank one (its "plate" is that blank code) when reprinted.
|
|
215
216
|
*/
|
|
216
|
-
export function blankCodeHidden(item: Pick<StickerItem, "blank" | "serialNo" | "serialLabel">, design: Pick<StickerDesign, "blankCode">): boolean {
|
|
217
|
-
return !!item.blank && design.blankCode === "hide" && !!stickerSerial(item);
|
|
217
|
+
export function blankCodeHidden(item: Pick<StickerItem, "blank" | "serialNo" | "serialLabel" | "plateNumber">, design: Pick<StickerDesign, "blankCode">): boolean {
|
|
218
|
+
return (!!item.blank || isBlankCode(text(item.plateNumber))) && design.blankCode === "hide" && !!stickerSerial(item);
|
|
218
219
|
}
|
|
219
220
|
|
|
220
221
|
/** The strip under a blank sticker: link by number when the code is not on it. */
|
|
221
|
-
export function blankStripNote(item: Pick<StickerItem, "blank" | "serialNo" | "serialLabel">, design: Pick<StickerDesign, "blankCode">): string {
|
|
222
|
+
export function blankStripNote(item: Pick<StickerItem, "blank" | "serialNo" | "serialLabel" | "plateNumber">, design: Pick<StickerDesign, "blankCode">): string {
|
|
222
223
|
return blankCodeHidden(item, design) ? BLANK_STRIP_NOTE_NUMBER : BLANK_STRIP_NOTE;
|
|
223
224
|
}
|
|
224
225
|
|
|
@@ -501,7 +502,7 @@ export function buildStickerDocument(
|
|
|
501
502
|
const [noteHead, noteRest] = blankStripNote(item, design).split(" - ");
|
|
502
503
|
const sn = stripSerial(item) ? `<span class="sn">${escapeHtml(stickerSerial(item))}</span>` : "";
|
|
503
504
|
// QR + number only: the strip stays blank (the number is on the sticker; link it by that number)
|
|
504
|
-
const strip = blankCodeHidden(item, design)
|
|
505
|
+
const strip = item.blank && blankCodeHidden(item, design)
|
|
505
506
|
? `<div class="cut${c.bare ? " free" : ""} blank"></div>`
|
|
506
507
|
: item.blank
|
|
507
508
|
? `<div class="cut${c.bare ? " free" : ""} blank"><div>${sn}<b>${escapeHtml(noteHead)}</b></div><div>${escapeHtml(noteRest)}</div></div>`
|