@7365admin1/layer-common 4.32.0 → 4.32.1-staging.365
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 +4 -4
- package/assets/css/robot-hero.css +26 -0
- package/components/AccessCardAddForm.vue +5 -4
- package/components/AccessCardAssignToUnitForm.vue +3 -2
- package/components/AccessCardPreviewDialog.vue +4 -3
- package/components/Dialog/DeleteConfirmation.vue +17 -2
- package/components/Dialog/ReusablePrompt.vue +26 -3
- package/components/Dialog/UpdateMoreAction.vue +11 -1
- package/components/DocumentForm.vue +407 -112
- package/components/DocumentManagement.vue +213 -12
- package/components/EntryPass/QrTemplatePreview.vue +21 -25
- package/components/EntryPassInformation.vue +119 -24
- package/components/Facility/BookingSetup.vue +63 -0
- package/components/HidAccessLogDashboard.vue +41 -8
- package/components/HidAccessPermissions.vue +424 -0
- package/components/HidIntercomManagement.vue +148 -14
- package/components/HidProfileQrCode.vue +332 -0
- package/components/HidReaderManagement.vue +26 -0
- package/components/HidReaderUserRoster.vue +44 -3
- package/components/HidUserEnrollment.vue +845 -155
- package/components/InvitationClientForm.vue +19 -1
- package/components/NotificationBell.vue +39 -3
- package/components/Robot/ActivityLog.vue +113 -0
- package/components/Robot/AlertsTable.vue +1 -0
- package/components/Robot/Detail.vue +8 -5
- package/components/Robot/Form.vue +170 -214
- package/components/Robot/MiniMap.vue +7 -1
- package/components/Robot/SiteAlerts.vue +117 -0
- package/components/Robot/SiteScreen.vue +69 -5
- package/components/VehicleForm.vue +45 -2
- package/components/VehicleManagement.vue +95 -10
- package/components/VisitorManagement.vue +267 -5
- package/composables/useAccessManagement.ts +5 -0
- package/composables/useCleaningPermission.ts +4 -4
- package/composables/useCommonPermission.ts +16 -0
- package/composables/useDocument.ts +7 -0
- package/composables/useFacility.ts +11 -0
- package/composables/useHidAmico.ts +117 -0
- package/composables/useHidNavigation.ts +25 -1
- package/composables/useHidReaderSelection.ts +50 -0
- package/composables/useLandscapingPermission.ts +4 -4
- package/composables/useMechanicalElectricalPermission.ts +4 -4
- package/composables/usePeople.ts +19 -0
- package/composables/usePestControlPermission.ts +4 -4
- package/composables/usePoolMaintenancePermission.ts +4 -4
- package/composables/useRobotBuilding.ts +9 -12
- package/composables/useRobots.ts +53 -4
- package/composables/useSecurityPermission.ts +4 -10
- package/composables/useSiteCategory.ts +45 -0
- package/composables/useSiteEntryPassSettings.ts +26 -0
- package/composables/useWebUsb.ts +14 -11
- 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/people.d.ts +28 -1
- package/utils/hid-permission-assignments.ts +190 -0
- package/utils/hid-reader-selection.ts +52 -0
- package/utils/notification-target.ts +75 -0
- package/utils/occupancy-role.ts +109 -0
- package/utils/robot-display.ts +146 -0
- package/utils/vehicle-actions.ts +12 -4
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import {
|
|
2
|
+
EMPTY_HID_READER_CHOICE,
|
|
3
|
+
resolveHidReaderId,
|
|
4
|
+
type HidReaderChoice,
|
|
5
|
+
} from "../utils/hid-reader-selection";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* ONE HID READER CHOICE, SHARED BY EVERY HID SCREEN.
|
|
9
|
+
*
|
|
10
|
+
* Declared at MODULE scope on purpose. Each screen held its own `ref("")`, and
|
|
11
|
+
* because the HID screens are separate pages the ref was rebuilt on every
|
|
12
|
+
* navigation — HID Reader Users, HID Cards, Access Logs and HID QR Code each
|
|
13
|
+
* reset to the first reader no matter what had just been picked next door.
|
|
14
|
+
*
|
|
15
|
+
* A module-scoped ref is enough because moving between those pages is a ROUTE
|
|
16
|
+
* change, not a page load: the menu's items carry a `route` and
|
|
17
|
+
* `NavigationItem.vue` renders them through `:to`, so vue-router handles them
|
|
18
|
+
* and this module is never re-evaluated.
|
|
19
|
+
*
|
|
20
|
+
* Deliberately NOT persisted. `localStorage` would carry the choice through a
|
|
21
|
+
* hard refresh as well, which is a real but much smaller benefit than the
|
|
22
|
+
* navigation case, and it is worth adding only once somebody has felt the
|
|
23
|
+
* absence. See `utils/hid-reader-selection.ts` for the staleness rule that
|
|
24
|
+
* would have to hold either way.
|
|
25
|
+
*
|
|
26
|
+
* Intercom keeps its own reader and is not wired to this. Its question is which
|
|
27
|
+
* panel you are calling, not which door you are administering, and joining them
|
|
28
|
+
* would mean switching reader on Access Logs changed who you would dial.
|
|
29
|
+
*/
|
|
30
|
+
const choice = ref<HidReaderChoice>({ ...EMPTY_HID_READER_CHOICE });
|
|
31
|
+
|
|
32
|
+
export default function useHidReaderSelection() {
|
|
33
|
+
/** Remember a choice. The site travels with it; an id alone means nothing. */
|
|
34
|
+
function selectHidReader(siteId: string, readerId: string) {
|
|
35
|
+
choice.value = { siteId: String(siteId ?? ""), readerId: String(readerId ?? "") };
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* The reader this screen should show, given the readers it just loaded.
|
|
40
|
+
*
|
|
41
|
+
* Call it after the reader list arrives, and write the answer back with
|
|
42
|
+
* `selectHidReader` so the screens agree on what "current" means even when
|
|
43
|
+
* one of them had to fall back to the first reader.
|
|
44
|
+
*/
|
|
45
|
+
function resolveForSite(siteId: string, readers: readonly { _id?: unknown }[]) {
|
|
46
|
+
return resolveHidReaderId(siteId, readers, choice.value);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return { choice, selectHidReader, resolveForSite };
|
|
50
|
+
}
|
|
@@ -25,8 +25,8 @@ export default function useLandscapingPermission() {
|
|
|
25
25
|
invitationPermissions,
|
|
26
26
|
memberPermissions,
|
|
27
27
|
rolePermissions,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
tradeFeedbackPermissions,
|
|
29
|
+
tradeWorkOrderPermissions,
|
|
30
30
|
bulletinBoardPermissions,
|
|
31
31
|
serviceProviderPermissions,
|
|
32
32
|
|
|
@@ -37,8 +37,8 @@ export default function useLandscapingPermission() {
|
|
|
37
37
|
members: memberPermissions,
|
|
38
38
|
roles: rolePermissions,
|
|
39
39
|
invitations: invitationPermissions,
|
|
40
|
-
feedbacks:
|
|
41
|
-
work_orders:
|
|
40
|
+
feedbacks: tradeFeedbackPermissions,
|
|
41
|
+
work_orders: tradeWorkOrderPermissions,
|
|
42
42
|
"bulletin-board": bulletinBoardPermissions,
|
|
43
43
|
"service-provider-mgmt": serviceProviderPermissions,
|
|
44
44
|
// Owner decision 3A, 2026-09-11: Emergency Contacts is offered in the
|
|
@@ -26,8 +26,8 @@ export default function useMechanicalElectricalPermission() {
|
|
|
26
26
|
invitationPermissions,
|
|
27
27
|
memberPermissions,
|
|
28
28
|
rolePermissions,
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
tradeFeedbackPermissions,
|
|
30
|
+
tradeWorkOrderPermissions,
|
|
31
31
|
bulletinBoardPermissions,
|
|
32
32
|
|
|
33
33
|
inventoryPermissions,
|
|
@@ -39,8 +39,8 @@ export default function useMechanicalElectricalPermission() {
|
|
|
39
39
|
members: memberPermissions,
|
|
40
40
|
roles: rolePermissions,
|
|
41
41
|
invitations: invitationPermissions,
|
|
42
|
-
feedbacks:
|
|
43
|
-
work_orders:
|
|
42
|
+
feedbacks: tradeFeedbackPermissions,
|
|
43
|
+
work_orders: tradeWorkOrderPermissions,
|
|
44
44
|
"bulletin-board": bulletinBoardPermissions,
|
|
45
45
|
// This app's sidebar gates Area, Unit and Settings on `area-mgmt`,
|
|
46
46
|
// `unit-mgmt` and `site-settings`, and its pages exist -- but the catalogue
|
package/composables/usePeople.ts
CHANGED
|
@@ -115,6 +115,24 @@ export default function () {
|
|
|
115
115
|
});
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
+
/**
|
|
119
|
+
* The blocks, levels and units at a site that actually have an occupant.
|
|
120
|
+
* The other half of the unit picker: this narrows the cascade, then
|
|
121
|
+
* `getPeopleByUnit` answers "which person in this unit?".
|
|
122
|
+
*/
|
|
123
|
+
async function getOccupiedStructure(
|
|
124
|
+
site: string,
|
|
125
|
+
{ type = "", status = "active", block = "", level = "" } = {}
|
|
126
|
+
) {
|
|
127
|
+
return await useNuxtApp().$api<Record<string, any>>(
|
|
128
|
+
`/api/people/site/${site}/occupied-structure`,
|
|
129
|
+
{
|
|
130
|
+
method: "GET",
|
|
131
|
+
query: { type, status, block, level },
|
|
132
|
+
}
|
|
133
|
+
);
|
|
134
|
+
}
|
|
135
|
+
|
|
118
136
|
async function getPeopleByUnit(
|
|
119
137
|
_id: string,
|
|
120
138
|
{ status = "active", type = "" } = {}
|
|
@@ -148,6 +166,7 @@ export default function () {
|
|
|
148
166
|
findPersonByPlateNumberMultipleResult,
|
|
149
167
|
findPersonByContact,
|
|
150
168
|
getPeopleByUnit,
|
|
169
|
+
getOccupiedStructure,
|
|
151
170
|
searchCompanyList,
|
|
152
171
|
findUsersByPlateNumber,
|
|
153
172
|
reviewResidentPerson,
|
|
@@ -25,8 +25,8 @@ export default function usePestControlPermission() {
|
|
|
25
25
|
invitationPermissions,
|
|
26
26
|
memberPermissions,
|
|
27
27
|
rolePermissions,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
tradeFeedbackPermissions,
|
|
29
|
+
tradeWorkOrderPermissions,
|
|
30
30
|
bulletinBoardPermissions,
|
|
31
31
|
serviceProviderPermissions,
|
|
32
32
|
|
|
@@ -37,8 +37,8 @@ export default function usePestControlPermission() {
|
|
|
37
37
|
members: memberPermissions,
|
|
38
38
|
roles: rolePermissions,
|
|
39
39
|
invitations: invitationPermissions,
|
|
40
|
-
feedbacks:
|
|
41
|
-
work_orders:
|
|
40
|
+
feedbacks: tradeFeedbackPermissions,
|
|
41
|
+
work_orders: tradeWorkOrderPermissions,
|
|
42
42
|
"bulletin-board": bulletinBoardPermissions,
|
|
43
43
|
"service-provider-mgmt": serviceProviderPermissions,
|
|
44
44
|
// Owner answer Q5, 2026-09-11: Emergency Contacts is offered in the Pest
|
|
@@ -25,8 +25,8 @@ export default function usePoolMaintenancePermission() {
|
|
|
25
25
|
invitationPermissions,
|
|
26
26
|
memberPermissions,
|
|
27
27
|
rolePermissions,
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
tradeFeedbackPermissions,
|
|
29
|
+
tradeWorkOrderPermissions,
|
|
30
30
|
bulletinBoardPermissions,
|
|
31
31
|
serviceProviderPermissions,
|
|
32
32
|
|
|
@@ -37,8 +37,8 @@ export default function usePoolMaintenancePermission() {
|
|
|
37
37
|
members: memberPermissions,
|
|
38
38
|
roles: rolePermissions,
|
|
39
39
|
invitations: invitationPermissions,
|
|
40
|
-
feedbacks:
|
|
41
|
-
work_orders:
|
|
40
|
+
feedbacks: tradeFeedbackPermissions,
|
|
41
|
+
work_orders: tradeWorkOrderPermissions,
|
|
42
42
|
"bulletin-board": bulletinBoardPermissions,
|
|
43
43
|
"service-provider-mgmt": serviceProviderPermissions,
|
|
44
44
|
// Owner answer Q5, 2026-09-11: Emergency Contacts is offered in the Pool
|
|
@@ -3,18 +3,18 @@ import { computed, ref, watch, type Ref } from "vue";
|
|
|
3
3
|
/**
|
|
4
4
|
* One site's building for the HERO building map and lift queue: the robots
|
|
5
5
|
* at the site this app may see (the API narrows by app), the ones of the type
|
|
6
|
-
* on screen, and the site's saved building map - the newest map saved
|
|
7
|
-
*
|
|
6
|
+
* on screen, and the site's saved building map - the newest map saved at the
|
|
7
|
+
* SITE (`/building-maps?site=`), whichever robot type it was saved from: the
|
|
8
|
+
* building belongs to the site, so a map drawn in Hygiene shows in Security.
|
|
8
9
|
*
|
|
9
|
-
* ponytail: the first 50 robots at the site
|
|
10
|
-
* site-level map endpoint when a site holds more robots than that.
|
|
10
|
+
* ponytail: the first 50 robots at the site; the map read is one call.
|
|
11
11
|
*/
|
|
12
12
|
export default function useRobotBuilding(
|
|
13
13
|
organization: Ref<string>,
|
|
14
14
|
site: Ref<string>,
|
|
15
15
|
type: Ref<"cleaning" | "security">,
|
|
16
16
|
) {
|
|
17
|
-
const { getSiteFleet, getSiteSummary,
|
|
17
|
+
const { getSiteFleet, getSiteSummary, listSiteBuildingMaps, getBuildingMap } = useRobots();
|
|
18
18
|
|
|
19
19
|
/** Every robot at the site this app may see, both types where the app shows both. */
|
|
20
20
|
const all = ref<Array<Record<string, any>>>([]);
|
|
@@ -26,12 +26,9 @@ export default function useRobotBuilding(
|
|
|
26
26
|
/** The robots of the type on screen (scope isolation: the other type is never drawn). */
|
|
27
27
|
const rows = computed(() => all.value.filter((r) => r.type === type.value));
|
|
28
28
|
|
|
29
|
-
async function loadMap(
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
.flatMap((p) => (p.status === "fulfilled" ? p.value?.items ?? [] : []))
|
|
33
|
-
.sort((a: any, b: any) => new Date(b.updatedAt ?? 0).getTime() - new Date(a.updatedAt ?? 0).getTime());
|
|
34
|
-
return summaries[0] ? await getBuildingMap(String(summaries[0]._id)) : null;
|
|
29
|
+
async function loadMap() {
|
|
30
|
+
const newest = (await listSiteBuildingMaps(site.value, { limit: 1 }))?.items?.[0];
|
|
31
|
+
return newest ? await getBuildingMap(String(newest._id)) : null;
|
|
35
32
|
}
|
|
36
33
|
|
|
37
34
|
let run = 0;
|
|
@@ -47,7 +44,7 @@ export default function useRobotBuilding(
|
|
|
47
44
|
if (mine !== run) return;
|
|
48
45
|
all.value = fleet?.items ?? [];
|
|
49
46
|
names.value = { siteName: summary?.site?.name ?? "", clientName: summary?.client?.name ?? "" };
|
|
50
|
-
const found = await loadMap(
|
|
47
|
+
const found = await loadMap();
|
|
51
48
|
if (mine !== run) return;
|
|
52
49
|
map.value = found;
|
|
53
50
|
} catch (e: any) {
|
package/composables/useRobots.ts
CHANGED
|
@@ -85,6 +85,7 @@ export default function useRobots() {
|
|
|
85
85
|
*/
|
|
86
86
|
function createRobot(payload: {
|
|
87
87
|
name: string;
|
|
88
|
+
brand?: string;
|
|
88
89
|
appKey: string;
|
|
89
90
|
appToken: string;
|
|
90
91
|
type?: "cleaning" | "security";
|
|
@@ -98,11 +99,11 @@ export default function useRobots() {
|
|
|
98
99
|
}
|
|
99
100
|
|
|
100
101
|
/**
|
|
101
|
-
* Rename a robot,
|
|
102
|
-
*
|
|
103
|
-
*
|
|
102
|
+
* Rename a robot, set its serial, or REPLACE its credentials (both together;
|
|
103
|
+
* the stored pair is never shown, so it can only be replaced). The brand is
|
|
104
|
+
* not editable - a different brand is a different robot.
|
|
104
105
|
*/
|
|
105
|
-
function updateRobot(id: string, payload: { name?: string; robotSn?: string }) {
|
|
106
|
+
function updateRobot(id: string, payload: { name?: string; robotSn?: string; appKey?: string; appToken?: string }) {
|
|
106
107
|
return useNuxtApp().$api<Record<string, any>>(`/api/robots/${id}`, {
|
|
107
108
|
method: "PATCH",
|
|
108
109
|
query: { appSlug },
|
|
@@ -281,6 +282,50 @@ export default function useRobots() {
|
|
|
281
282
|
});
|
|
282
283
|
}
|
|
283
284
|
|
|
285
|
+
/**
|
|
286
|
+
* The SITE's saved building maps, newest first: the building belongs to the
|
|
287
|
+
* site, so a map saved from a cleaning robot is the Security app's too.
|
|
288
|
+
*/
|
|
289
|
+
function listSiteBuildingMaps(site: string, { page = 1, limit = 10 } = {}) {
|
|
290
|
+
return useNuxtApp().$api<Record<string, any>>("/api/robots/building-maps", {
|
|
291
|
+
method: "GET",
|
|
292
|
+
query: { site, page, limit, appSlug },
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/* ------------------------------------------ alerts + activity log */
|
|
297
|
+
|
|
298
|
+
/**
|
|
299
|
+
* The site's open faults and robots not reporting (Alerts, README §6),
|
|
300
|
+
* faults first, paged; `faults` = real faults only (the header bell).
|
|
301
|
+
* Narrowed to this app's robot types.
|
|
302
|
+
*/
|
|
303
|
+
function getSiteFaults(site: string, { page = 1, limit = 25, type = "" }: { page?: number; limit?: number; type?: string } = {}) {
|
|
304
|
+
return useNuxtApp().$api<Record<string, any>>("/api/robots/faults", {
|
|
305
|
+
method: "GET",
|
|
306
|
+
query: { site, page, limit, type: type || undefined, appSlug },
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Who did what to the site's robots (Activity log, README §7), newest
|
|
312
|
+
* first, paged; `robot` narrows to one robot. Read only.
|
|
313
|
+
*/
|
|
314
|
+
function getSiteActivity(site: string, { page = 1, limit = 25, robot = "", type = "" }: { page?: number; limit?: number; robot?: string; type?: string } = {}) {
|
|
315
|
+
return useNuxtApp().$api<Record<string, any>>("/api/robots/activity", {
|
|
316
|
+
method: "GET",
|
|
317
|
+
query: { site, page, limit, robot: robot || undefined, type: type || undefined, appSlug },
|
|
318
|
+
});
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/** The Activity log network-wide (Seven365 Super Admin only). */
|
|
322
|
+
function getNetworkActivity({ page = 1, limit = 25 }: { page?: number; limit?: number } = {}) {
|
|
323
|
+
return useNuxtApp().$api<Record<string, any>>("/api/robots/network/activity", {
|
|
324
|
+
method: "GET",
|
|
325
|
+
query: { page, limit },
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
|
|
284
329
|
function getBuildingMap(mapId: string) {
|
|
285
330
|
return useNuxtApp().$api<Record<string, any>>(`/api/robots/building-maps/${mapId}`, {
|
|
286
331
|
method: "GET",
|
|
@@ -348,6 +393,10 @@ export default function useRobots() {
|
|
|
348
393
|
|
|
349
394
|
return {
|
|
350
395
|
listBuildingMaps,
|
|
396
|
+
listSiteBuildingMaps,
|
|
397
|
+
getSiteFaults,
|
|
398
|
+
getSiteActivity,
|
|
399
|
+
getNetworkActivity,
|
|
351
400
|
getBuildingMap,
|
|
352
401
|
createBuildingMap,
|
|
353
402
|
updateBuildingMap,
|
|
@@ -63,11 +63,8 @@ export default function useSecurityPermission() {
|
|
|
63
63
|
check: true,
|
|
64
64
|
description: "Allows the user to update feedback details.",
|
|
65
65
|
},
|
|
66
|
-
"delete-feedback":
|
|
67
|
-
|
|
68
|
-
description:
|
|
69
|
-
"Allows the user to remove a feedback from the system permanently.",
|
|
70
|
-
},
|
|
66
|
+
// No "delete-feedback": deleting a feedback is for Property Management
|
|
67
|
+
// and the feedback's creator only - the same rule as work orders.
|
|
71
68
|
},
|
|
72
69
|
|
|
73
70
|
work_orders: {
|
|
@@ -88,11 +85,8 @@ export default function useSecurityPermission() {
|
|
|
88
85
|
check: true,
|
|
89
86
|
description: "Allows the user to update work-order details.",
|
|
90
87
|
},
|
|
91
|
-
"delete-work-order":
|
|
92
|
-
|
|
93
|
-
description:
|
|
94
|
-
"Allows the user to remove a work-order from the system permanently.",
|
|
95
|
-
},
|
|
88
|
+
// No "delete-work-order": deleting a work order is for Property
|
|
89
|
+
// Management and the work order's creator only (Harris, 2026-09-23).
|
|
96
90
|
},
|
|
97
91
|
|
|
98
92
|
"building-mgmt": {
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* THE CATEGORY OF THE SITE THE USER IS CURRENTLY IN.
|
|
3
|
+
*
|
|
4
|
+
* One shared answer, published once by the application's layout from the site
|
|
5
|
+
* it already loaded for the switcher, and read by anything that has to behave
|
|
6
|
+
* differently on a commercial or industrial site - the business Add Tenant
|
|
7
|
+
* form, the tenant list. Publishing it rather than re-fetching it per
|
|
8
|
+
* component means no two screens can disagree about which site this is.
|
|
9
|
+
*
|
|
10
|
+
* READ FROM THE CUSTOMER-SITE RECORD, NOT THE SITE RECORD. Both carry a
|
|
11
|
+
* `category` and `customer-site.service` keeps them equal (it writes the site
|
|
12
|
+
* on create and on update), but `siteSchema` DEFAULTS the site's own copy to
|
|
13
|
+
* `commercial` - so a site created without an explicit category reads back as
|
|
14
|
+
* commercial there even when it is a residential estate. The customer-site
|
|
15
|
+
* copy has no default: it is either the category somebody chose or nothing.
|
|
16
|
+
*
|
|
17
|
+
* An empty category means "not published yet" or "never set", and every
|
|
18
|
+
* caller must behave as it did before this existed - never assume commercial
|
|
19
|
+
* from silence.
|
|
20
|
+
*/
|
|
21
|
+
const BUSINESS_SITE_CATEGORIES: string[] = ["commercial", "industrial"];
|
|
22
|
+
|
|
23
|
+
export default function useSiteCategory() {
|
|
24
|
+
const siteCategory = useState<string>("current-site-category", () => "");
|
|
25
|
+
|
|
26
|
+
function setSiteCategory(value?: string | null) {
|
|
27
|
+
siteCategory.value = typeof value === "string" ? value : "";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The categories whose units are LET TO A BUSINESS rather than lived in.
|
|
32
|
+
*
|
|
33
|
+
* These are the sites where a unit has an owner, an occupier and often a
|
|
34
|
+
* person in charge who is neither, so they are the sites that ask for a
|
|
35
|
+
* tenant's standing and print it back (see `OCCUPANCY_ROLE_OPTIONS`).
|
|
36
|
+
*
|
|
37
|
+
* The category never changes what the APPLICATION is called: the rail says
|
|
38
|
+
* Property Management on every site it serves.
|
|
39
|
+
*/
|
|
40
|
+
const isBusinessSite = computed(() =>
|
|
41
|
+
BUSINESS_SITE_CATEGORIES.includes(siteCategory.value),
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
return { siteCategory, isBusinessSite, setSiteCategory };
|
|
45
|
+
}
|
|
@@ -27,9 +27,35 @@ export default function useSiteEntryPassSettings() {
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
+
/**
|
|
31
|
+
* The encrypted ACM URL the access-card screens hand to API-core, which
|
|
32
|
+
* decrypts it and sends the ACM commands to that host.
|
|
33
|
+
*
|
|
34
|
+
* Resolves the site's own "Enter entrypass URL" setting first, the way
|
|
35
|
+
* `VisitorForm` does for contractor passes. The access-card forms used to
|
|
36
|
+
* call `/api/encrypt-acm-url` with no `url`, so every site's door/lift
|
|
37
|
+
* levels and access groups came from the route's hardcoded default host
|
|
38
|
+
* whatever the site had configured. A site with no URL set, or whose
|
|
39
|
+
* settings cannot be read, still gets that default.
|
|
40
|
+
*/
|
|
41
|
+
async function getEncryptedAcmUrl(siteId: string): Promise<string> {
|
|
42
|
+
let rawUrl = "";
|
|
43
|
+
try {
|
|
44
|
+
const settings: any = await getBySiteId(siteId);
|
|
45
|
+
rawUrl = String(settings?.data?.settings?.url ?? "").trim();
|
|
46
|
+
} catch {
|
|
47
|
+
// No entry pass settings for this site yet - the default host applies.
|
|
48
|
+
}
|
|
49
|
+
const { encrypted } = await $fetch<{ encrypted: string }>(
|
|
50
|
+
`/api/encrypt-acm-url${rawUrl ? `?url=${encodeURIComponent(rawUrl)}` : ""}`,
|
|
51
|
+
);
|
|
52
|
+
return encrypted;
|
|
53
|
+
}
|
|
54
|
+
|
|
30
55
|
return {
|
|
31
56
|
getBySiteId,
|
|
32
57
|
getById,
|
|
33
58
|
save,
|
|
59
|
+
getEncryptedAcmUrl,
|
|
34
60
|
};
|
|
35
61
|
}
|
package/composables/useWebUsb.ts
CHANGED
|
@@ -345,16 +345,19 @@ export default function useWebUsb() {
|
|
|
345
345
|
70,
|
|
346
346
|
);
|
|
347
347
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
348
|
+
// The pass used to print five copies of the same QR - four 140px ones at
|
|
349
|
+
// the corners around a 250px centre - so a strip could be cut apart. It now
|
|
350
|
+
// prints a single large QR filling that same band (y 90 to 440, above the
|
|
351
|
+
// company name at y 470), which scans far more reliably on a thermal print.
|
|
352
|
+
// Generated at the size it is drawn at: the old corner copies were
|
|
353
|
+
// downscaled from the 250px canvas, which softened their modules.
|
|
354
|
+
const qrSize = 350;
|
|
355
|
+
const qrCanvas = await QRCode.toCanvas(qrUrlImage, {
|
|
356
|
+
width: qrSize,
|
|
357
|
+
margin: 1,
|
|
358
|
+
});
|
|
352
359
|
|
|
353
|
-
ctx.drawImage(qrCanvas,
|
|
354
|
-
ctx.drawImage(qrCanvas, canvas.width - qrSmall - margin, 90, qrSmall, qrSmall);
|
|
355
|
-
ctx.drawImage(qrCanvas, (canvas.width - qrCenter) / 2, 110, qrCenter, qrCenter);
|
|
356
|
-
ctx.drawImage(qrCanvas, margin, 300, qrSmall, qrSmall);
|
|
357
|
-
ctx.drawImage(qrCanvas, canvas.width - qrSmall - margin, 300, qrSmall, qrSmall);
|
|
360
|
+
ctx.drawImage(qrCanvas, (canvas.width - qrSize) / 2, 90, qrSize, qrSize);
|
|
358
361
|
|
|
359
362
|
ctx.font = "25px Arial";
|
|
360
363
|
ctx.fillText(companyName || "", canvas.width / 2, 470);
|
|
@@ -401,8 +404,8 @@ export default function useWebUsb() {
|
|
|
401
404
|
/**
|
|
402
405
|
* The self-service onboarding QR: one large QR code, a "SCAN QR CODE"-style
|
|
403
406
|
* subtext, and a dark site-name banner along the bottom - a single-purpose
|
|
404
|
-
* gate sign, not the
|
|
405
|
-
*
|
|
407
|
+
* gate sign, not the visitor-pass receipt `createReceiptLayout` produces
|
|
408
|
+
* (that one pairs its QR with company, date, access and instruction lines).
|
|
406
409
|
*/
|
|
407
410
|
async function createOnboardingQrLayout(
|
|
408
411
|
qrUrlImage: string,
|
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.32.
|
|
5
|
+
"version": "4.32.1-staging.365",
|
|
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.",
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
:org="orgId"
|
|
6
6
|
message="Enable HID as a service for this site before managing physical HID cards."
|
|
7
7
|
>
|
|
8
|
-
<HidUserEnrollment :site="siteId" card-management />
|
|
8
|
+
<HidUserEnrollment :site="siteId" :org="orgId" card-management />
|
|
9
9
|
</HidEnabledGate>
|
|
10
10
|
</v-container>
|
|
11
11
|
</template>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-container fluid>
|
|
3
|
+
<HidEnabledGate
|
|
4
|
+
:site="siteId"
|
|
5
|
+
:org="orgId"
|
|
6
|
+
message="Enable HID as a service for this site before generating a QR code."
|
|
7
|
+
>
|
|
8
|
+
<HidProfileQrCode :site="siteId" />
|
|
9
|
+
</HidEnabledGate>
|
|
10
|
+
</v-container>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script setup lang="ts">
|
|
14
|
+
definePageMeta({
|
|
15
|
+
layout: "default",
|
|
16
|
+
middleware: ["01-auth", "02-org"],
|
|
17
|
+
memberOnly: true,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const route = useRoute();
|
|
21
|
+
const siteId = computed(() => String(route.params.site ?? ""));
|
|
22
|
+
const orgId = computed(() => String(route.params.org ?? ""));
|
|
23
|
+
</script>
|
package/types/document.d.ts
CHANGED
|
@@ -3,4 +3,18 @@ declare type TDocument = {
|
|
|
3
3
|
name: string;
|
|
4
4
|
attachment: string;
|
|
5
5
|
type: string;
|
|
6
|
+
/**
|
|
7
|
+
* Set at upload or renewal, absent when the document never expires.
|
|
8
|
+
*
|
|
9
|
+
* An ISO instant on the way out of the API and a `YYYY-MM-DD` string on the
|
|
10
|
+
* way back in, which is what `InputDatePicker` binds to - hence the loose
|
|
11
|
+
* type rather than `string`.
|
|
12
|
+
*/
|
|
13
|
+
expiryDate?: string | Date | null;
|
|
14
|
+
remarks?: string;
|
|
15
|
+
size?: number;
|
|
16
|
+
parentId?: string | null;
|
|
17
|
+
createdAt?: string | Date;
|
|
18
|
+
updatedAt?: string | Date;
|
|
19
|
+
status?: string;
|
|
6
20
|
};
|
package/types/facility.d.ts
CHANGED
|
@@ -73,6 +73,10 @@ declare type TFacility = {
|
|
|
73
73
|
hourInterval?: number;
|
|
74
74
|
isBookingFeeEnabled: boolean;
|
|
75
75
|
isGuestEnabled: boolean;
|
|
76
|
+
/** Residents may complete this facility's checklist themselves. */
|
|
77
|
+
isResidentChecklistEnabled?: boolean;
|
|
78
|
+
/** Security may complete it. Mutually exclusive with the above. */
|
|
79
|
+
isSecurityChecklistEnabled?: boolean;
|
|
76
80
|
bookingAmount: number | null;
|
|
77
81
|
peakBookingFeeAmount?: number | null;
|
|
78
82
|
bookingFeeGuestAmount?: number | null;
|
package/types/people.d.ts
CHANGED
|
@@ -22,11 +22,38 @@ declare type TPeople = {
|
|
|
22
22
|
email?: string;
|
|
23
23
|
files?: { name: string, id: string }[];
|
|
24
24
|
isOwner?: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Owner / occupant / person-in-charge, as the BUSINESS people form asks it.
|
|
27
|
+
* Absent on everyone else - `isOwner` is still the flag that decides unit
|
|
28
|
+
* ownership, and the server derives it from this when it is sent. See
|
|
29
|
+
* `OccupancyRoles` in core's `person.model.ts`.
|
|
30
|
+
*/
|
|
31
|
+
occupancyRole?: TOccupancyRole;
|
|
32
|
+
// Link to this person's `users` row. Empty for the person types that carry
|
|
33
|
+
// no login, and empty for a resident whose account was never written.
|
|
34
|
+
user?: string;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
declare type TOccupancyRole = "owner" | "occupant" | "person-in-charge";
|
|
38
|
+
|
|
39
|
+
/** One standing and everything the product says about it. See `utils/occupancy-role.ts`. */
|
|
40
|
+
declare type TOccupancyRoleOption = {
|
|
41
|
+
value: TOccupancyRole;
|
|
42
|
+
/** The label a stored role is printed with. */
|
|
43
|
+
title: string;
|
|
44
|
+
/** The row menu's wording. */
|
|
45
|
+
action: string;
|
|
46
|
+
/** The confirmation's heading and its sentence. */
|
|
47
|
+
prompt: string;
|
|
48
|
+
description: string;
|
|
25
49
|
};
|
|
26
50
|
|
|
27
51
|
declare type TPlateNumber = { plateNumber: string, recNo?: string, _id?: string, status: TVehicleStatus, type: TVehicleType, anprCameras?: TVehicleAnprCamera[] };
|
|
28
52
|
|
|
29
53
|
|
|
30
|
-
|
|
54
|
+
// `""` is the FORM's "nothing picked yet" - it is stripped from the payload
|
|
55
|
+
// before it is sent, because absence is what the server reads as "never
|
|
56
|
+
// asked". See `PeopleFormMgmt.vue`.
|
|
57
|
+
declare type TPeoplePayload = Pick<TGuest, "name" | "block" | "level" | "unit" | "unitName" | "contact" | "plateNumber" | "nric" | "contact" | "remarks" | "org" | "site" | "start" | "end" | "type" | "isOwner"> & { status?: string; user?: string; occupancyRole?: TOccupancyRole | "" }
|
|
31
58
|
|
|
32
59
|
declare type TPeopleType = "guest" | "resident" | "tenant"
|