@7365admin1/layer-common 4.96.0 → 4.97.1-staging.500
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 +10 -4
- package/assets/css/primitives.css +57 -0
- package/assets/css/screens.css +8 -4
- package/components/AccessCardDetailsDialog.vue +59 -6
- package/components/AccessCardPreviewDialog.vue +371 -53
- package/components/AppSelect.vue +143 -4
- package/components/BuildingUnitFormEdit.vue +6 -0
- package/components/BuildingUnitManagement.vue +298 -0
- package/components/Dialog/UpdateMoreAction.vue +11 -1
- package/components/DocumentForm.vue +407 -112
- package/components/DocumentManagement.vue +213 -12
- package/components/Facility/BookingSetup.vue +63 -0
- package/components/HidAccessLogDashboard.vue +74 -17
- package/components/HidAccessPermissions.vue +424 -0
- package/components/HidIntercomManagement.vue +183 -14
- package/components/HidProfileQrCode.vue +332 -0
- package/components/HidQrCodeConfiguration.vue +17 -195
- package/components/HidReaderManagement.vue +398 -0
- package/components/HidReaderUserRoster.vue +44 -3
- package/components/HidUserEnrollment.vue +2239 -276
- package/components/InvitationClientForm.vue +19 -1
- package/components/Nfc/NFCPatrolRouteForm.vue +109 -58
- package/components/Nfc/NFCPatrolRouteMain.vue +3 -18
- package/components/Nfc/PatrolReport/PatrolActivityTable.vue +0 -8
- package/components/Nfc/PatrolReport/PatrolRouteSummary.vue +1 -1
- package/components/ServiceProviderMain.vue +48 -0
- package/components/SiteProviderChange.vue +371 -0
- package/components/TableMain.vue +22 -7
- package/components/VehicleQrStickerDialog.vue +64 -4
- package/components/VisitorForm.vue +12 -0
- package/components/VisitorManagement.vue +267 -5
- package/composables/useAccessManagement.ts +17 -1
- package/composables/useCustomerSite.ts +29 -0
- package/composables/useDocument.ts +7 -0
- package/composables/useFacility.ts +11 -0
- package/composables/useHidAmico.ts +165 -0
- package/composables/useHidNavigation.ts +25 -1
- package/composables/useHidReaderSelection.ts +50 -0
- package/composables/useMember.ts +12 -0
- package/composables/useNFCPatrolReport.ts +36 -32
- package/composables/useNFCPatrolReportFilters.ts +21 -3
- package/composables/useNFCPatrolRoute.ts +10 -3
- package/composables/usePeople.ts +19 -0
- package/composables/useServiceProvider.ts +45 -2
- package/composables/useSiteCategory.ts +45 -0
- package/package.json +1 -1
- package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
- package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
- package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
- package/types/document.d.ts +14 -0
- package/types/facility.d.ts +4 -0
- package/types/member.d.ts +4 -0
- package/types/nfc-patrol-report.ts +0 -2
- package/types/people.d.ts +28 -1
- package/types/service-provider.d.ts +5 -0
- package/types/site.d.ts +7 -1
- package/utils/hid-enrolment-subject.ts +344 -0
- package/utils/hid-permission-assignments.ts +198 -0
- package/utils/hid-reader-selection.ts +52 -0
- package/utils/nfc-patrol-time.ts +99 -0
- package/utils/occupancy-role.ts +109 -0
- package/utils/service-type.ts +30 -0
- package/utils/vehicle-qr-design.ts +304 -20
- package/utils/vehicle-qr-sticker.ts +126 -20
|
@@ -8,16 +8,97 @@
|
|
|
8
8
|
* pasted on the car.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
import {
|
|
11
|
+
import {
|
|
12
|
+
DEFAULT_STICKER_DESIGN,
|
|
13
|
+
QR_MM,
|
|
14
|
+
cardSize,
|
|
15
|
+
isSilhouette,
|
|
16
|
+
qrTop,
|
|
17
|
+
silhouetteLayout,
|
|
18
|
+
stickerLabel,
|
|
19
|
+
stickerTheme,
|
|
20
|
+
type FrameShape,
|
|
21
|
+
type StickerDesign,
|
|
22
|
+
} from "./vehicle-qr-design.ts";
|
|
12
23
|
|
|
13
24
|
/** The server's most vehicles per request (POST /api/vehicles/qr/stickers). */
|
|
14
25
|
export const STICKER_MAX_PER_REQUEST = 500;
|
|
15
26
|
|
|
16
|
-
/** A4 sheet: 4 columns x 4 rows of 47 mm cells. */
|
|
27
|
+
/** A4 sheet with the classic cards: 4 columns x 4 rows of 47 mm cells. */
|
|
17
28
|
export const STICKER_COLUMNS = 4;
|
|
18
29
|
export const STICKER_ROWS = 4;
|
|
19
30
|
export const STICKERS_PER_PAGE = STICKER_COLUMNS * STICKER_ROWS;
|
|
20
31
|
|
|
32
|
+
/** Printer margin on every side of the A4 sheet, mm. */
|
|
33
|
+
export const SHEET_MARGIN = 5;
|
|
34
|
+
const PAGE_W = 210 - SHEET_MARGIN * 2;
|
|
35
|
+
const PAGE_H = 297 - SHEET_MARGIN * 2;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* How stickers sit on the A4 sheet. A cell = the sticker + the installer strip
|
|
39
|
+
* under it; `gap` is the empty cutting gap between cells (no ink in it except
|
|
40
|
+
* the small + cut marks in its middle).
|
|
41
|
+
*/
|
|
42
|
+
export type SheetLayout = { cols: number; rows: number; cellW: number; cardH: number; stripH: number; gap: number };
|
|
43
|
+
|
|
44
|
+
export function sheetLayout(frame: FrameShape): SheetLayout {
|
|
45
|
+
// Cut-out shapes are 62 mm wide: 3 across. Cards stay 4 x 4 = 16.
|
|
46
|
+
return isSilhouette(frame)
|
|
47
|
+
? { cols: 3, rows: 4, cellW: cardSize(frame).w, cardH: cardSize(frame).h, stripH: 10, gap: 4 }
|
|
48
|
+
: { cols: STICKER_COLUMNS, rows: STICKER_ROWS, cellW: cardSize(frame).w, cardH: cardSize(frame).h, stripH: 11, gap: 3 };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export const perSheet = (l: SheetLayout) => l.cols * l.rows;
|
|
52
|
+
|
|
53
|
+
/** "12 stickers per A4 sheet with 4 mm cutting gaps" */
|
|
54
|
+
export function sheetSummary(frame: FrameShape): string {
|
|
55
|
+
const l = sheetLayout(frame);
|
|
56
|
+
return `${perSheet(l)} stickers per A4 sheet with ${l.gap} mm cutting gaps`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** Top-left of the sticker grid inside the printable area, so it sits in the middle of the sheet. */
|
|
60
|
+
function gridOrigin(l: SheetLayout): { x: number; y: number; w: number; h: number } {
|
|
61
|
+
const w = l.cols * l.cellW + (l.cols - 1) * l.gap;
|
|
62
|
+
const h = l.rows * (l.cardH + l.stripH) + (l.rows - 1) * l.gap;
|
|
63
|
+
return { x: (PAGE_W - w) / 2, y: (PAGE_H - h) / 2, w, h };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Cut marks for one sheet, as SVG over the printable area: a small + in the
|
|
68
|
+
* middle of every cutting gap crossing, and short ticks just outside the grid
|
|
69
|
+
* where each gap meets its edge - line a ruler up on them to cut the sheet
|
|
70
|
+
* into pieces.
|
|
71
|
+
*/
|
|
72
|
+
export function cropMarksSvg(l: SheetLayout): string {
|
|
73
|
+
const g = gridOrigin(l);
|
|
74
|
+
const cellH = l.cardH + l.stripH;
|
|
75
|
+
const xs = Array.from({ length: l.cols - 1 }, (_, i) => g.x + (i + 1) * l.cellW + i * l.gap + l.gap / 2);
|
|
76
|
+
const ys = Array.from({ length: l.rows - 1 }, (_, i) => g.y + (i + 1) * cellH + i * l.gap + l.gap / 2);
|
|
77
|
+
const r = (v: number) => Math.round(v * 100) / 100;
|
|
78
|
+
const arm = Math.min(1.2, l.gap / 2 - 0.3);
|
|
79
|
+
const tickX = Math.max(0.6, g.y - 0.4);
|
|
80
|
+
const tickY = Math.max(0.6, g.x - 0.4);
|
|
81
|
+
const lines: string[] = [];
|
|
82
|
+
const line = (x1: number, y1: number, x2: number, y2: number) =>
|
|
83
|
+
lines.push(`<line x1="${r(x1)}" y1="${r(y1)}" x2="${r(x2)}" y2="${r(y2)}"/>`);
|
|
84
|
+
for (const x of xs) {
|
|
85
|
+
line(x, g.y - tickX, x, g.y - 0.2);
|
|
86
|
+
line(x, g.y + g.h + 0.2, x, g.y + g.h + tickX);
|
|
87
|
+
for (const y of ys) {
|
|
88
|
+
line(x - arm, y, x + arm, y);
|
|
89
|
+
line(x, y - arm, x, y + arm);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
for (const y of ys) {
|
|
93
|
+
line(g.x - tickY, y, g.x - 0.2, y);
|
|
94
|
+
line(g.x + g.w + 0.2, y, g.x + g.w + tickY, y);
|
|
95
|
+
}
|
|
96
|
+
return (
|
|
97
|
+
`<svg class="marks" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 ${PAGE_W} ${PAGE_H}" width="${PAGE_W}mm" height="${PAGE_H}mm">` +
|
|
98
|
+
`<g stroke="#555" stroke-width="0.15">${lines.join("")}</g></svg>`
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
|
|
21
102
|
export type StickerItem = {
|
|
22
103
|
vehicleId: string;
|
|
23
104
|
qr: string;
|
|
@@ -141,25 +222,38 @@ export function escapeHtml(value: unknown): string {
|
|
|
141
222
|
.replace(/'/g, "'");
|
|
142
223
|
}
|
|
143
224
|
|
|
144
|
-
|
|
145
|
-
|
|
225
|
+
// Printed at 100% ("Actual size"): every size below is real millimetres on paper.
|
|
226
|
+
function printCss(l: SheetLayout): string {
|
|
227
|
+
const g = gridOrigin(l);
|
|
228
|
+
return `
|
|
229
|
+
@page { size: A4; margin: ${SHEET_MARGIN}mm; }
|
|
146
230
|
* { box-sizing: border-box; }
|
|
147
231
|
html, body { margin: 0; padding: 0; background: #fff; color: #111; font-family: Arial, Helvetica, sans-serif; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
|
|
148
|
-
.page { display: grid; grid-template-columns: repeat(${
|
|
232
|
+
.page { position: relative; display: grid; grid-template-columns: repeat(${l.cols}, ${l.cellW}mm); grid-auto-rows: ${l.cardH + l.stripH}mm; gap: ${l.gap}mm; justify-content: start; align-content: start; padding: ${g.y}mm 0 0 ${g.x}mm; width: ${PAGE_W}mm; height: ${PAGE_H}mm; margin: 0 auto; overflow: hidden; break-after: page; }
|
|
149
233
|
.page:last-child { break-after: auto; }
|
|
150
|
-
.
|
|
151
|
-
.
|
|
152
|
-
.
|
|
234
|
+
.marks { position: absolute; left: 0; top: 0; width: ${PAGE_W}mm; height: ${PAGE_H}mm; pointer-events: none; }
|
|
235
|
+
.cell { width: ${l.cellW}mm; break-inside: avoid; }
|
|
236
|
+
.card { position: relative; width: ${l.cellW}mm; height: ${l.cardH}mm; }
|
|
237
|
+
.face, .face svg { position: absolute; inset: 0; width: ${l.cellW}mm; height: ${l.cardH}mm; display: block; overflow: visible; }
|
|
153
238
|
.words { position: absolute; left: 3mm; right: 3mm; bottom: 2mm; display: flex; flex-direction: column; align-items: center; justify-content: space-between; text-align: center; }
|
|
154
|
-
.
|
|
239
|
+
.words.band { bottom: auto; justify-content: center; gap: 0.6mm; }
|
|
240
|
+
.plate { font-size: 13pt; font-weight: 800; letter-spacing: 0.3mm; line-height: 1.1; white-space: nowrap; }
|
|
155
241
|
.hint { font-size: 5.8pt; line-height: 1.2; opacity: 0.85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
|
|
156
242
|
.brand { display: flex; align-items: center; justify-content: center; gap: 1mm; font-size: 6pt; border-top: 0.2mm solid #ccc; width: 100%; padding-top: 1mm; }
|
|
157
243
|
.mark { width: 3.2mm; height: 3.2mm; border-radius: 0.8mm; color: #fff; font-weight: 800; font-size: 5pt; line-height: 3.2mm; text-align: center; }
|
|
158
|
-
.cut { margin-top: 1.2mm; border-top: 0.3mm dashed #666; padding-top: 1mm; font-size: 6.5pt; line-height: 1.25; color: #111;
|
|
244
|
+
.cut { margin-top: 1.2mm; border-top: 0.3mm dashed #666; padding-top: 1mm; font-size: 6.5pt; line-height: 1.25; color: #111; height: ${l.stripH - 1.2}mm; overflow: hidden; }
|
|
245
|
+
.cut.free { margin-top: 1.6mm; border-top: 0; padding-top: 0; height: ${l.stripH - 1.6}mm; }
|
|
159
246
|
.cut .owner { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
160
247
|
.cut .note { color: #666; font-size: 5.5pt; }
|
|
161
|
-
@media screen { body { background: #e9e9e9; zoom: 0.75; padding: 4mm 0; } .page { background: #fff; margin-bottom: 4mm;
|
|
248
|
+
@media screen { body { background: #e9e9e9; zoom: 0.75; padding: 4mm 0; } .page { background: #fff; margin-bottom: 4mm; box-shadow: 0 0 2mm rgba(0,0,0,.25); } }
|
|
162
249
|
`;
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/** Plate font size (mm) that fits the cut-out shape's plate box. */
|
|
253
|
+
function plateSizeMm(plate: string, boxW: number): number {
|
|
254
|
+
// bold capitals are about 0.74 em wide, plus 0.3 mm letter spacing each
|
|
255
|
+
return Math.round(Math.min(4.6, (boxW / Math.max(plate.length, 1) - 0.3) / 0.74) * 100) / 100;
|
|
256
|
+
}
|
|
163
257
|
|
|
164
258
|
/**
|
|
165
259
|
* One full HTML document: A4 sheets of stickers. `faceSvgs` is parallel to
|
|
@@ -174,22 +268,34 @@ export function buildStickerDocument(
|
|
|
174
268
|
const design = opts.design ?? DEFAULT_STICKER_DESIGN;
|
|
175
269
|
const { ink } = stickerTheme(design.theme);
|
|
176
270
|
const label = stickerLabel(design, opts.siteName);
|
|
271
|
+
const layout = sheetLayout(design.frame);
|
|
272
|
+
const shape = isSilhouette(design.frame) ? silhouetteLayout(design.frame) : null;
|
|
177
273
|
const wordsTop = qrTop(design.frame) + QR_MM + 0.8;
|
|
178
274
|
const cells = items.map((item, i) => {
|
|
179
275
|
const { place, owner } = installerLine(item);
|
|
276
|
+
const plate = escapeHtml(item.plateNumber);
|
|
277
|
+
// Cut-out shapes: plate (and words) in the box under the QR; no brand line - there is no room.
|
|
278
|
+
const words = shape
|
|
279
|
+
? `<div class="words band" style="left:${shape.band.x}mm;right:auto;top:${shape.band.y}mm;width:${shape.band.w}mm;height:${shape.band.h}mm">` +
|
|
280
|
+
`<div class="plate" style="font-size:${plateSizeMm(text(item.plateNumber), shape.band.w)}mm">${plate}</div>` +
|
|
281
|
+
(label ? `<div class="hint">${escapeHtml(label)}</div>` : "") +
|
|
282
|
+
`</div>`
|
|
283
|
+
: `<div class="words" style="top:${wordsTop}mm">` +
|
|
284
|
+
`<div class="plate">${plate}</div>` +
|
|
285
|
+
(label ? `<div class="hint">${escapeHtml(label)}</div>` : "") +
|
|
286
|
+
`<div class="brand"><span class="mark" style="background:${ink}">7</span>Powered by Seven365</div>` +
|
|
287
|
+
`</div>`;
|
|
180
288
|
return (
|
|
181
289
|
`<div class="cell"><div class="card" style="color:${ink}">` +
|
|
182
290
|
`<div class="face">${faceSvgs[i] ?? ""}</div>` +
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
`<div class="brand"><span class="mark" style="background:${ink}">7</span>Powered by Seven365</div>` +
|
|
187
|
-
`</div></div>` +
|
|
188
|
-
`<div class="cut"><div><b>${escapeHtml(place || "-")}</b></div>` +
|
|
291
|
+
words +
|
|
292
|
+
`</div>` +
|
|
293
|
+
`<div class="cut${shape ? " free" : ""}"><div><b>${escapeHtml(place || "-")}</b></div>` +
|
|
189
294
|
`<div class="owner">Owner: ${escapeHtml(owner || "-")}</div>` +
|
|
190
|
-
`<div class="note"
|
|
295
|
+
`<div class="note">${shape ? "Installer: cut out the sticker, then paste on this car" : "Installer: cut here, then paste on this car"}</div></div></div>`
|
|
191
296
|
);
|
|
192
297
|
});
|
|
193
|
-
const
|
|
194
|
-
|
|
298
|
+
const marks = cropMarksSvg(layout);
|
|
299
|
+
const pages = stickerPages(cells, perSheet(layout)).map((p) => `<div class="page">${marks}${p.join("")}</div>`);
|
|
300
|
+
return `<!doctype html><html><head><meta charset="utf-8"><title>Vehicle QR stickers</title><style>${printCss(layout)}</style></head><body>${pages.join("")}</body></html>`;
|
|
195
301
|
}
|