@7365admin1/layer-common 4.185.3 → 4.186.1

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @iservice365/layer-common
2
2
 
3
+ ## 4.186.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c86da17: MA role editor keeps offering the view rights for provider modules the MA monitors (Daily Occurrence Book, patrol logs, attendance, checklists) even when its module list predates them.
8
+ - d5f68bd: Add Vehicle: the QR sticker picker searches all of the site's blank stickers as you type (e.g. TLR120 or 120), not only the first 50.
9
+ - 7d504ea: Vehicle QR: sticker pick lists show only the sticker number (TLR002 / No. 2); the long code is hidden in the vehicle list (copy button kept).
10
+
11
+ ## 4.186.0
12
+
13
+ ### Minor Changes
14
+
15
+ - 03688ea: Property Management role catalogue: view-only Daily Occurrence Book keys for the managing agent (Services at this site > Security).
16
+ - ea351d5: Vehicle QR stickers: blank stickers print only the QR code and sticker number by default (no long code, no words, blank strip); new "QR + serial number only" button for vehicle stickers too.
17
+
3
18
  ## 4.185.3
4
19
 
5
20
  ### Patch Changes
@@ -4047,11 +4062,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
4047
4062
  `utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
4048
4063
  own rule from two endpoints the console already calls, unprojected:
4049
4064
 
4050
- GET /api/members/user/:user/app/admin the Seven365 staff membership
4051
- GET /api/roles/id/:role that membership's role document
4065
+ GET /api/members/user/:user/app/admin the Seven365 staff membership
4066
+ GET /api/roles/id/:role that membership's role document
4052
4067
 
4053
- owner = member.type === "admin" && role.type === "admin" && role.default === true
4054
- staff = member.type === "admin" && role.type === "admin"
4068
+ owner = member.type === "admin" && role.type === "admin" && role.default === true
4069
+ staff = member.type === "admin" && role.type === "admin"
4055
4070
 
4056
4071
  `role.default` is the marker because it is the only property of a platform
4057
4072
  staff role no API caller can set - `role.controller.ts` validates create and
@@ -225,6 +225,7 @@ import {
225
225
  effectiveModules,
226
226
  ownerGrant,
227
227
  siteModulesForOrg,
228
+ withMaMonitorModules,
228
229
  } from "../utils/org-modules";
229
230
  import { withoutDeniedResources } from "../utils/module-routes";
230
231
 
@@ -420,10 +421,13 @@ const offeredPermissions = computed(() =>
420
421
  withoutDeniedResources(catalogueForOwnerGrant(
421
422
  catalogueForOrg(
422
423
  props.permissions ?? {},
423
- effectiveModules(
424
- (orgForModules.value as any)?.modules,
425
- // Only the site's OWN organisation is narrowed by it (owner Q1).
426
- siteModulesForOrg(siteForModules.value as any, props.orgId)
424
+ withMaMonitorModules(
425
+ effectiveModules(
426
+ (orgForModules.value as any)?.modules,
427
+ // Only the site's OWN organisation is narrowed by it (owner Q1).
428
+ siteModulesForOrg(siteForModules.value as any, props.orgId)
429
+ ),
430
+ props.type
427
431
  )
428
432
  ),
429
433
  ownerGrant(orgForModules.value as any, grantRole.value as any, props.type)
@@ -287,11 +287,15 @@
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 && qrPickItems.length > 1" class="w-100 mt-3">
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"
298
+ @focus="selectQrPickText"
295
299
  density="comfortable"
296
300
  :hint="newPlateNumbers.filter(Boolean).length > 1 ? 'Linked to the first plate number above.' : 'Type a sticker number to find it.'"
297
301
  persistent-hint
@@ -595,16 +599,53 @@ const {
595
599
  */
596
600
  const qrPicks = ref<BlankPick[]>([]);
597
601
  const qrPick = ref("");
598
- const qrPickItems = computed(() => [
599
- ...qrPicks.value.map((p) => ({ title: blankPickLabel(p), value: p.code })),
600
- { title: "No sticker", value: "" },
601
- ]);
602
+ // the picked sticker stays listed while a search shows other numbers
603
+ const qrPicked = ref<BlankPick | null>(null);
604
+ const qrPickSearch = ref("");
605
+ const qrPickItems = computed(() => {
606
+ const list = qrPicked.value && !qrPicks.value.some((p) => p.code === qrPicked.value!.code)
607
+ ? [qrPicked.value, ...qrPicks.value]
608
+ : qrPicks.value;
609
+ return [...list.map((p) => ({ title: blankPickLabel(p), value: p.code })), { title: "No sticker", value: "" }];
610
+ });
611
+ watch(qrPick, (code) => {
612
+ qrPicked.value = [qrPicked.value, ...qrPicks.value].find((p) => p?.code === code) ?? null;
613
+ });
614
+ // shown when the site has any free sticker - a search with no match keeps it open
615
+ const qrPickerOn = ref(false);
616
+ /*
617
+ * Search the site's whole list on the server as the person types (owner
618
+ * 2026-11-17: a site can hold hundreds of blank stickers; the first 50 alone
619
+ * could not find TLR120).
620
+ */
621
+ // only the latest search may fill the list - a slower earlier answer is dropped
622
+ let qrPickAsked = 0;
623
+ async function loadQrPicks(search = "") {
624
+ const asked = ++qrPickAsked;
625
+ const res = await getBlankStickersBySerial(prop.site, { search, limit: 50 });
626
+ if (asked === qrPickAsked) qrPicks.value = res.items;
627
+ return res;
628
+ }
629
+ // clicking the field selects the picked sticker's text, so typing replaces it
630
+ function selectQrPickText(e: FocusEvent) {
631
+ const input = e.target as HTMLInputElement | null;
632
+ if (input?.select) setTimeout(() => input.select(), 0);
633
+ }
634
+ let qrPickTimer: ReturnType<typeof setTimeout> | undefined;
635
+ watch(qrPickSearch, (v) => {
636
+ clearTimeout(qrPickTimer);
637
+ const text = String(v ?? "");
638
+ // picking a line puts its label in the search text - that is not a search
639
+ if (qrPickItems.value.some((i) => i.title === text)) return;
640
+ qrPickTimer = setTimeout(() => loadQrPicks(text).catch(() => {}), 250);
641
+ });
602
642
  onMounted(async () => {
603
643
  if (!prop.qrLink || prop.mode !== "add") return;
604
644
  try {
605
- const res = await getBlankStickersBySerial(prop.site, { limit: 50 });
606
- qrPicks.value = res.items;
645
+ const res = await loadQrPicks();
646
+ qrPickerOn.value = res.items.length > 0;
607
647
  qrPick.value = res.next?.code ?? "";
648
+ qrPicked.value = res.next ?? null;
608
649
  } catch {
609
650
  qrPicks.value = []; // ponytail: no list, no picker - the vehicle still adds
610
651
  }
@@ -615,7 +656,7 @@ async function linkPickedSticker(plates: string[]): Promise<{ text: string; ok:
615
656
  const code = qrPick.value;
616
657
  const plate = plates[0];
617
658
  if (!code || !plate) return { text: "", ok: true };
618
- const label = blankPickLabel(qrPicks.value.find((p) => p.code === code) ?? { token: code, code });
659
+ const label = blankPickLabel(qrPicked.value?.code === code ? qrPicked.value : qrPicks.value.find((p) => p.code === code) ?? { token: code, code });
619
660
  try {
620
661
  const found = await checkExistingPlates({ site: prop.site, plateNumbers: [plate] });
621
662
  const key = (v: unknown) => String(v ?? "").replace(/[^A-Za-z0-9]/g, "").toUpperCase();
@@ -673,7 +673,7 @@ const qrError = ref("");
673
673
  const qrLinkHint = computed(() => (qrCodeToLink.value ? stickerCodeHint(qrCodeToLink.value) : ""));
674
674
  // the combobox keeps a typed-but-not-committed code in its search text
675
675
  const qrSearch = ref("");
676
- // the pick-list's stickers ("TLR002 - ABCD-..."), by sticker number with the next one first
676
+ // the pick-list's stickers ("TLR002" - the long code only for an unnumbered sticker), by sticker number with the next one first
677
677
  const qrPicks = ref<BlankPick[]>([]);
678
678
  const qrCodes = computed(() => qrPicks.value.map(blankPickLabel));
679
679
  const qrSummary = ref<BlankSummary | null>(null);
@@ -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 printed on it. Paste it
24
- on a car, then link it to that vehicle in Vehicles &gt; 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 &gt; 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">
@@ -115,7 +115,7 @@
115
115
  </tr>
116
116
  </tbody>
117
117
  </v-table>
118
- <v-alert v-if="isBlank && design.shape !== 'square' && design.text === 'none'" type="warning" variant="tonal"
118
+ <v-alert v-if="isBlank && design.blankCode !== 'hide' && design.shape !== 'square' && design.text === 'none'" type="warning" variant="tonal"
119
119
  density="compact" class="my-2" data-test="vehicle-qr-blank-notext">
120
120
  With "No text" nothing is printed under the shape - neither the sticker's code nor its number - so these stickers
121
121
  can only be linked by scanning them with iMA365 / iSecure365. Pick another Text option to print it.
@@ -125,9 +125,8 @@
125
125
  {{ blankWithoutNumber }} sticker(s) have no sticker number, so their long code is still printed on them.
126
126
  </v-alert>
127
127
  <p v-if="isBlank && design.blankCode === 'hide'" class="text-caption text-medium-emphasis my-2">
128
- Each sticker has a cut-off strip under the dashed line saying it is not linked yet - cut it off before pasting
129
- the sticker on the car. To link one, pick its sticker number in Vehicles &gt; Link QR sticker, or scan it with
130
- iMA365 / iSecure365.
128
+ Each sticker prints only the QR code and its sticker number. To link one, pick its sticker number in
129
+ Vehicles &gt; Link QR sticker (or when adding a vehicle), or scan it with iMA365 / iSecure365.
131
130
  </p>
132
131
  <p v-else-if="isBlank" class="text-caption text-medium-emphasis my-2">
133
132
  Each sticker has a cut-off strip under the dashed line saying it is not linked yet - cut it off before pasting
@@ -174,16 +173,16 @@
174
173
  <v-select v-model="design.theme" :items="STICKER_THEMES" item-value="id" label="Colours" density="compact"
175
174
  hide-details />
176
175
  </v-col>
177
- <v-col v-if="design.shape !== 'square'" cols="12" sm="6" md="4">
176
+ <v-col v-if="design.shape !== 'square' && !blankQrSerialOnly" cols="12" sm="6" md="4">
178
177
  <v-select v-model="design.text" :items="TEXT_OPTIONS" label="Text" density="compact" hide-details
179
178
  data-test="vehicle-qr-text" />
180
179
  </v-col>
181
- <v-col v-if="design.shape === 'square' || design.text !== 'none'" cols="12" sm="6" md="4">
180
+ <v-col v-if="(design.shape === 'square' || design.text !== 'none') && !blankQrSerialOnly" cols="12" sm="6" md="4">
182
181
  <v-select v-model="design.label" :items="LABEL_OPTIONS"
183
182
  :label="design.plate === 'hide' ? 'Words on the sticker' : 'Words under the plate'" density="compact"
184
183
  hide-details />
185
184
  </v-col>
186
- <v-col cols="12" sm="6" md="4">
185
+ <v-col v-if="!blankQrSerialOnly" cols="12" sm="6" md="4">
187
186
  <v-select v-model="design.serial" :items="SERIAL_OPTIONS" label="Serial number" density="compact"
188
187
  hide-details data-test="vehicle-qr-serial" />
189
188
  </v-col>
@@ -203,6 +202,8 @@
203
202
  <div class="d-flex align-center flex-wrap">
204
203
  <v-switch v-model="design.cutLines" label="Show cut lines" color="primary" density="compact" hide-details
205
204
  inset class="mt-1 mr-4" data-test="vehicle-qr-cut-lines" />
205
+ <v-btn variant="tonal" color="primary" size="small" class="text-none mr-2" data-test="vehicle-qr-qr-serial-only"
206
+ @click="qrSerialOnly">QR + serial number only</v-btn>
206
207
  <v-btn variant="text" size="small" class="text-none" @click="resetDesign">Back to the standard look</v-btn>
207
208
  </div>
208
209
  <v-alert type="warning" variant="tonal" density="compact" class="mt-2" data-test="vehicle-qr-size-info">
@@ -218,7 +219,7 @@
218
219
  <v-alert type="info" variant="tonal" density="compact" class="mt-2" data-test="vehicle-qr-cut-guide">
219
220
  How to cut: first cut the sheet into pieces through the middle of the gaps (the small + marks show where),
220
221
  then cut round each sticker {{ design.cutLines ? "on the light-grey line" : "along its edge" }} - with scissors
221
- or a cutting machine. Cut off the strip with the unit and owner before pasting.
222
+ or a cutting machine.{{ blankQrSerialOnly ? "" : " Cut off the strip under each sticker before pasting." }}
222
223
  </v-alert>
223
224
  <v-alert type="info" variant="tonal" density="compact" class="mt-2" data-test="vehicle-qr-save-guide">
224
225
  To print the same stickers again later: <b>Save sheet file</b> keeps this exact sheet on your computer - open
@@ -371,9 +372,15 @@ const siteName = ref("");
371
372
  const DESIGN_KEY = "vehicleQrStickerDesign";
372
373
  // The serial choice is kept on its own, only when the person picks it.
373
374
  const SERIAL_KEY = "vehicleQrStickerSerial";
375
+ // Likewise the long-code choice (its default changed to "hide" on 17 Nov 2026).
376
+ const BLANK_CODE_KEY = "vehicleQrStickerBlankCode";
374
377
  function loadDesign(): StickerDesign {
375
378
  try {
376
- return rememberedDesign(JSON.parse(localStorage.getItem(DESIGN_KEY) || "null"), localStorage.getItem(SERIAL_KEY));
379
+ return rememberedDesign(
380
+ JSON.parse(localStorage.getItem(DESIGN_KEY) || "null"),
381
+ localStorage.getItem(SERIAL_KEY),
382
+ localStorage.getItem(BLANK_CODE_KEY),
383
+ );
377
384
  } catch {
378
385
  return { ...DEFAULT_STICKER_DESIGN };
379
386
  }
@@ -396,9 +403,25 @@ watch(
396
403
  }
397
404
  },
398
405
  );
406
+ watch(
407
+ () => design.blankCode,
408
+ (b) => {
409
+ try {
410
+ localStorage.setItem(BLANK_CODE_KEY, String(b));
411
+ } catch {
412
+ /* not saved - nothing else to do */
413
+ }
414
+ },
415
+ );
399
416
  function resetDesign() {
400
417
  Object.assign(design, DEFAULT_STICKER_DESIGN);
401
418
  }
419
+ // Blank stickers printing only the QR and the number: text, words and serial place do not apply.
420
+ const blankQrSerialOnly = computed(() => isBlank.value && design.blankCode === "hide");
421
+ /** One click: the QR code and the serial number, nothing else (blank and vehicle stickers alike). */
422
+ function qrSerialOnly() {
423
+ Object.assign(design, { blankCode: "hide", plate: "hide", serial: "sticker", label: "none", text: "below" });
424
+ }
402
425
 
403
426
  // A small live picture of every QR shape in the current dots / corners / colours.
404
427
  const SAMPLE = "HTTPS://APP.ISERVICE365.ORG/Q/SamplePreviewToken0000";
@@ -1,14 +1,14 @@
1
1
  <template>
2
2
  <span class="d-inline-flex align-center ga-1 text-caption" data-test="vehicle-sticker-code">
3
3
  <span v-if="label" class="text-medium-emphasis">{{ label }}</span>
4
- <code class="vehicle-sticker-code">{{ code }}</code>
4
+ <!-- the long code is hidden (owner 2026-11-17: too long; the sticker number beside it is what people use) - copy still gives it -->
5
5
  <v-btn :icon="copied ? 'mdi-check' : 'mdi-content-copy'" flat size="x-small" density="compact"
6
- aria-label="Copy sticker code" @click.stop="copy" />
6
+ aria-label="Copy sticker code" title="Copy sticker code" @click.stop="copy" />
7
7
  </span>
8
8
  </template>
9
9
 
10
10
  <script setup lang="ts">
11
- // A blank sticker's printed code, with a copy button. Shown only when the server sent it.
11
+ // Copy button for a sticker's long code (the code itself is not shown). Shown only when the server sent it.
12
12
  const props = defineProps<{ code: string; label?: string }>();
13
13
  const copied = ref(false);
14
14
  async function copy() {
@@ -21,7 +21,3 @@ async function copy() {
21
21
  }
22
22
  }
23
23
  </script>
24
-
25
- <style scoped>
26
- .vehicle-sticker-code { font-size: 0.75rem; letter-spacing: 0.02em; }
27
- </style>
@@ -689,6 +689,25 @@ export default function usePropertyPermission() {
689
689
  "Allows the user to view the service providers' daily checklists at the site (areas, units and history). View only.",
690
690
  },
691
691
  },
692
+ // The managing agent's VIEW of the security company's Daily Occurrence Book at the site (owner, 17 Nov 2026):
693
+ // "Services at this site" > Security > Daily Occurrence Book. View only - the Security catalogue's own keys,
694
+ // which API-core checks on the book list, one book and its entries (dob / dobEntry gates).
695
+ "daily-occurrence-books": {
696
+ "see-all-daily-occurrence": {
697
+ check: true,
698
+ description: "Allows the user to view the security company's Daily Occurrence Books at the site. View only.",
699
+ },
700
+ "see-daily-occurrence-details": {
701
+ check: true,
702
+ description: "Allows the user to open a Daily Occurrence Book and download it. View only.",
703
+ },
704
+ },
705
+ "daily-occurrence-entries": {
706
+ "see-daily-occurrence-entries-details": {
707
+ check: true,
708
+ description: "Allows the user to read the entries in a Daily Occurrence Book. View only.",
709
+ },
710
+ },
692
711
  "attendance-mgmt": {
693
712
  "see-all-attendance": {
694
713
  check: true,
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.185.3",
5
+ "version": "4.186.1",
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.",
@@ -189,6 +189,33 @@ export function effectiveModules(
189
189
  return allowed.length ? allowed : org;
190
190
  }
191
191
 
192
+ /**
193
+ * Provider modules a managing agent only MONITORS at its sites (owner
194
+ * 2026-11-17). The MA's own module list does not decide them - core's
195
+ * `MA_MONITOR_MODULES` (module-gate.util.ts) holds the same keys - so the MA
196
+ * role editor keeps offering their view rights even when the list predates them.
197
+ */
198
+ export const MA_MONITOR_MODULES: readonly string[] = Object.freeze([
199
+ "daily-occurrence-books",
200
+ "daily-occurrence-entries",
201
+ "virtual-patrol",
202
+ "nfc-patrol",
203
+ "attendance-mgmt",
204
+ "cleaning-schedule-mgmt",
205
+ "landscape-schedule-mgmt",
206
+ "pest-schedule-mgmt",
207
+ "pool-schedule-mgmt",
208
+ "area-mgmt",
209
+ "unit-mgmt",
210
+ "schedule-task-mgmt",
211
+ ]);
212
+
213
+ /** An MA role editor's module list plus the provider modules it monitors; any other type unchanged. `[]` (= everything) stays `[]`. */
214
+ export function withMaMonitorModules(modules: string[], type: unknown): string[] {
215
+ if (type !== "property_management_agency" || !modules.length) return modules;
216
+ return [...new Set([...modules, ...MA_MONITOR_MODULES])];
217
+ }
218
+
192
219
  /**
193
220
  * The site tier, but only for the organisation that OWNS the site.
194
221
  *
@@ -166,10 +166,9 @@ export function blankPickSerial(i: Pick<BlankPick, "serialNo" | "serialLabel">):
166
166
  return n ? String(i.serialLabel ?? "").trim() || `No. ${n}` : "";
167
167
  }
168
168
 
169
- /** "TLR002 - ABCD-EFGH-..." - or just the code for a sticker with no number. */
169
+ /** "TLR002" - the long code only for a sticker with no number (owner 2026-11-17: the code is too long to read). */
170
170
  export function blankPickLabel(i: BlankPick): string {
171
- const sn = blankPickSerial(i);
172
- return sn ? `${sn} - ${i.code}` : i.code;
171
+ return blankPickSerial(i) || i.code;
173
172
  }
174
173
 
175
174
  /** Ascending by sticker number; stickers with no number last, in the order they came. */
@@ -158,8 +158,8 @@ export const PLATE_OPTIONS: { value: PlateChoice; title: string }[] = [
158
158
  ];
159
159
 
160
160
  export const BLANK_CODE_OPTIONS: { value: BlankCodeChoice; title: string }[] = [
161
- { value: "print", title: "Print (default)" },
162
- { value: "hide", title: "Hide - QR code and sticker number only" },
161
+ { value: "hide", title: "Hide - QR code and sticker number only (default)" },
162
+ { value: "print", title: "Print the long code too" },
163
163
  ];
164
164
 
165
165
  export const LABEL_OPTIONS: { value: LabelChoice; title: string }[] = [
@@ -193,7 +193,8 @@ export const DEFAULT_STICKER_DESIGN: StickerDesign = {
193
193
  cutLines: true,
194
194
  serial: "sticker",
195
195
  plate: "show",
196
- blankCode: "print",
196
+ // Client ask (TLR, 17 Nov 2026): blank stickers print the QR and the sticker number only.
197
+ blankCode: "hide",
197
198
  };
198
199
 
199
200
  /** A saved or typed-in design with anything unknown replaced by the default. */
@@ -227,9 +228,10 @@ export function normalizeDesign(raw: unknown): StickerDesign {
227
228
  * change, so a saved serial of "off" may only be the old default; the serial
228
229
  * choice counts only when it was saved on its own (the person picked it).
229
230
  */
230
- export function rememberedDesign(saved: unknown, savedSerial: unknown): StickerDesign {
231
+ export function rememberedDesign(saved: unknown, savedSerial: unknown, savedBlankCode?: unknown): StickerDesign {
231
232
  const r = saved && typeof saved === "object" ? (saved as Record<string, unknown>) : {};
232
- return normalizeDesign({ ...r, serial: savedSerial });
233
+ // Same for the long code: a saved "print" may only be the old default.
234
+ return normalizeDesign({ ...r, serial: savedSerial, blankCode: savedBlankCode });
233
235
  }
234
236
 
235
237
  /**
@@ -237,9 +239,12 @@ export function rememberedDesign(saved: unknown, savedSerial: unknown): StickerD
237
239
  * code whose tab under the shape would be left empty (no serial or words on
238
240
  * it) is printed with no tab, so no bare paper tab hangs under the shape.
239
241
  * Blank stickers always print their code or sticker number in the tab, so they keep it.
242
+ * Blank stickers with the long code hidden print the QR and the sticker number
243
+ * only: no extra words, and a shaped code always gets its tab for the number.
240
244
  */
241
245
  export function printedDesign(design: unknown, blank = false, siteName = ""): StickerDesign {
242
246
  const d = normalizeDesign(design);
247
+ if (blank && d.blankCode === "hide") return { ...d, label: "none", text: "below" };
243
248
  const tabEmpty = d.serial !== "sticker" && d.serial !== "both" && !stickerLabel(d, siteName);
244
249
  return !blank && d.plate === "hide" && isSilhouette(d.shape) && d.text === "below" && tabEmpty ? { ...d, text: "none" } : d;
245
250
  }
@@ -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
 
@@ -449,6 +450,11 @@ function cardContext(design: StickerDesign, siteName: string | undefined, n: num
449
450
  };
450
451
  }
451
452
 
453
+ /** "QR + serial number only": nothing but the number under the code (no words, no Seven365 line). */
454
+ function qrAndSerialOnly(item: StickerItem, c: CardContext): boolean {
455
+ return !c.label && (blankCodeHidden(item, c) || (!item.blank && c.hidePlate));
456
+ }
457
+
452
458
  /** The sticker itself (frame + QR + plate words) - what goes on the car. */
453
459
  function cardHtml(item: StickerItem, face: string, c: CardContext): string {
454
460
  const { lines, serialText } = headLines(item, c);
@@ -470,7 +476,7 @@ function cardHtml(item: StickerItem, face: string, c: CardContext): string {
470
476
  (lines.length ? `<div class="plate"${lines.length > 1 || blankCodeHidden(item, c) ? ` style="font-size:${plateSizeMm(longest, c.cardW - 6, 4.6)}mm"` : ""}>${plate}</div>` : "") +
471
477
  serial +
472
478
  label +
473
- `<div class="brand"><span class="mark" style="background:${c.ink}">7</span>Powered by Seven365</div>` +
479
+ (qrAndSerialOnly(item, c) ? "" : `<div class="brand"><span class="mark" style="background:${c.ink}">7</span>Powered by Seven365</div>`) +
474
480
  `</div>`;
475
481
  return `<div class="card" style="color:${c.ink}"><div class="face">${face}</div>${words}</div>`;
476
482
  }
@@ -495,7 +501,10 @@ export function buildStickerDocument(
495
501
  const { place, owner } = installerLine(item);
496
502
  const [noteHead, noteRest] = blankStripNote(item, design).split(" - ");
497
503
  const sn = stripSerial(item) ? `<span class="sn">${escapeHtml(stickerSerial(item))}</span>` : "";
498
- const strip = item.blank
504
+ // QR + number only: the strip stays blank (the number is on the sticker; link it by that number)
505
+ const strip = item.blank && blankCodeHidden(item, design)
506
+ ? `<div class="cut${c.bare ? " free" : ""} blank"></div>`
507
+ : item.blank
499
508
  ? `<div class="cut${c.bare ? " free" : ""} blank"><div>${sn}<b>${escapeHtml(noteHead)}</b></div><div>${escapeHtml(noteRest)}</div></div>`
500
509
  : `<div class="cut${c.bare ? " free" : ""}"><div>${sn}<b>${escapeHtml(place || "-")}</b></div><div class="owner">Owner: ${escapeHtml(owner || "-")}</div></div>`;
501
510
  return (
@@ -554,6 +563,8 @@ function cardWordsSvg(item: StickerItem, c: CardContext): string {
554
563
  } else {
555
564
  if (serialText) rows.push(word(serialText, true));
556
565
  if (label) rows.push(word(label, false));
566
+ }
567
+ if (!c.tag && !qrAndSerialOnly(item, c)) {
557
568
  // the Seven365 line: grey rule, the ink "7" mark and the words, centred together
558
569
  const textW = 10.061 * 6 * PT;
559
570
  const groupW = 3.2 + 1 + textW;