@7365admin1/layer-common 4.31.0 → 4.32.1-staging.364
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/robot-hero.css +227 -1
- 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/BuildingMap.vue +403 -0
- package/components/Robot/LiftQueue.vue +247 -0
- package/components/Robot/MapEditor.vue +233 -0
- package/components/Robot/PatrolRoutes.vue +3 -3
- package/components/Robot/SiteScreen.vue +36 -1
- 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 +66 -0
- 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 +2 -2
- 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-building.ts +521 -0
- package/utils/robot-display.ts +29 -6
- package/utils/vehicle-actions.ts +12 -4
|
@@ -7,8 +7,8 @@ export default function useCleaningPermission() {
|
|
|
7
7
|
const {
|
|
8
8
|
rolePermissions,
|
|
9
9
|
memberPermissions,
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
tradeFeedbackPermissions,
|
|
11
|
+
tradeWorkOrderPermissions,
|
|
12
12
|
invitationPermissions,
|
|
13
13
|
bulletinBoardPermissions,
|
|
14
14
|
|
|
@@ -17,8 +17,8 @@ export default function useCleaningPermission() {
|
|
|
17
17
|
const permissions: TPermissions = {
|
|
18
18
|
inventory: inventoryPermissions,
|
|
19
19
|
members: memberPermissions,
|
|
20
|
-
feedbacks:
|
|
21
|
-
work_order:
|
|
20
|
+
feedbacks: tradeFeedbackPermissions,
|
|
21
|
+
work_order: tradeWorkOrderPermissions,
|
|
22
22
|
roles: rolePermissions,
|
|
23
23
|
invitations: invitationPermissions,
|
|
24
24
|
"bulletin-board": bulletinBoardPermissions,
|
|
@@ -120,6 +120,20 @@ export function useCommonPermissions() {
|
|
|
120
120
|
},
|
|
121
121
|
};
|
|
122
122
|
|
|
123
|
+
/*
|
|
124
|
+
* The same rights WITHOUT "delete-work-order", for every trade other than
|
|
125
|
+
* Property Management. Deleting a work order is for Property Management and
|
|
126
|
+
* the work order's creator only (Harris, 2026-09-23), so the service
|
|
127
|
+
* providers' role editors no longer offer the box. Property keeps
|
|
128
|
+
* `workOrderPermissions` as it is.
|
|
129
|
+
*/
|
|
130
|
+
const { "delete-work-order": _propertyOnly, ...tradeWorkOrderPermissions } =
|
|
131
|
+
workOrderPermissions;
|
|
132
|
+
|
|
133
|
+
/** Feedback the same way: "delete-feedback" is Property Management's only. */
|
|
134
|
+
const { "delete-feedback": _propertyOnlyFeedback, ...tradeFeedbackPermissions } =
|
|
135
|
+
feedbackPermissions;
|
|
136
|
+
|
|
123
137
|
const visitorManagementPermissions: Record<string, TPermission> = {
|
|
124
138
|
"add-visitor": {
|
|
125
139
|
check: true,
|
|
@@ -323,7 +337,9 @@ export function useCommonPermissions() {
|
|
|
323
337
|
memberPermissions,
|
|
324
338
|
rolePermissions,
|
|
325
339
|
feedbackPermissions,
|
|
340
|
+
tradeFeedbackPermissions,
|
|
326
341
|
workOrderPermissions,
|
|
342
|
+
tradeWorkOrderPermissions,
|
|
327
343
|
visitorManagementPermissions,
|
|
328
344
|
buildingManagementPermissions,
|
|
329
345
|
buildingUnitManagementPermissions,
|
|
@@ -6,6 +6,7 @@ export default function useDocument() {
|
|
|
6
6
|
type = "all",
|
|
7
7
|
site = "",
|
|
8
8
|
parentId = "",
|
|
9
|
+
expiry = "all",
|
|
9
10
|
}: {
|
|
10
11
|
page?: number;
|
|
11
12
|
search?: string;
|
|
@@ -13,6 +14,11 @@ export default function useDocument() {
|
|
|
13
14
|
type?: string;
|
|
14
15
|
site?: string;
|
|
15
16
|
parentId?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Which tab is asking: "active" for Documents, "expired" for
|
|
19
|
+
* Document (Expired). Defaults to "all" so existing callers are unaffected.
|
|
20
|
+
*/
|
|
21
|
+
expiry?: string;
|
|
16
22
|
} = {}) {
|
|
17
23
|
const query: Record<string, any> = {
|
|
18
24
|
page,
|
|
@@ -21,6 +27,7 @@ export default function useDocument() {
|
|
|
21
27
|
type,
|
|
22
28
|
site,
|
|
23
29
|
parentId,
|
|
30
|
+
expiry,
|
|
24
31
|
};
|
|
25
32
|
|
|
26
33
|
return useNuxtApp().$api<Record<string, any>>(`/api/documents`, {
|
|
@@ -76,6 +76,8 @@ export default function usetFacility() {
|
|
|
76
76
|
hourInterval?: number;
|
|
77
77
|
isBookingFeeEnabled: boolean;
|
|
78
78
|
isGuestEnabled: boolean;
|
|
79
|
+
isResidentChecklistEnabled: boolean;
|
|
80
|
+
isSecurityChecklistEnabled: boolean;
|
|
79
81
|
bookingAmount: number | null;
|
|
80
82
|
peakBookingFeeAmount?: number | null;
|
|
81
83
|
bookingFeeGuestAmount?: number | null;
|
|
@@ -173,6 +175,8 @@ export default function usetFacility() {
|
|
|
173
175
|
hourInterval = 1,
|
|
174
176
|
isBookingFeeEnabled = false,
|
|
175
177
|
isGuestEnabled = false,
|
|
178
|
+
isResidentChecklistEnabled = false,
|
|
179
|
+
isSecurityChecklistEnabled = false,
|
|
176
180
|
bookingAmount = 0,
|
|
177
181
|
peakBookingFeeAmount = 0,
|
|
178
182
|
bookingFeeGuestAmount = 0,
|
|
@@ -236,6 +240,13 @@ export default function usetFacility() {
|
|
|
236
240
|
this.hourInterval = hourInterval;
|
|
237
241
|
this.isBookingFeeEnabled = isBookingFeeEnabled;
|
|
238
242
|
this.isGuestEnabled = isGuestEnabled;
|
|
243
|
+
// Exactly one owner, always. `isResidentChecklistEnabled` is the flag
|
|
244
|
+
// the apps gate on, so it decides, and security is its complement —
|
|
245
|
+
// stored rather than computed so each app can read its own flag without
|
|
246
|
+
// knowing the rule. A facility predating both fields lands on security,
|
|
247
|
+
// which is how every one of them already behaved.
|
|
248
|
+
this.isResidentChecklistEnabled = isResidentChecklistEnabled === true;
|
|
249
|
+
this.isSecurityChecklistEnabled = !this.isResidentChecklistEnabled;
|
|
239
250
|
this.bookingAmount = bookingAmount;
|
|
240
251
|
this.peakBookingFeeAmount = peakBookingFeeAmount;
|
|
241
252
|
this.bookingFeeGuestAmount = bookingFeeGuestAmount;
|
|
@@ -28,6 +28,22 @@ export type HidReaderPayload = {
|
|
|
28
28
|
lastCallbackType?: string;
|
|
29
29
|
};
|
|
30
30
|
|
|
31
|
+
export type HidProfileQr = {
|
|
32
|
+
readerId: string;
|
|
33
|
+
userId: string;
|
|
34
|
+
memberId: string;
|
|
35
|
+
hidUserId: string;
|
|
36
|
+
registration: string;
|
|
37
|
+
readerName: string;
|
|
38
|
+
portalName: string;
|
|
39
|
+
qrEnabled: boolean;
|
|
40
|
+
issued: boolean;
|
|
41
|
+
qrValue: string;
|
|
42
|
+
issuedAt: string;
|
|
43
|
+
/** null when the permission lookup itself failed, so "unknown" stays distinct from "no". */
|
|
44
|
+
assigned: boolean | null;
|
|
45
|
+
};
|
|
46
|
+
|
|
31
47
|
type HidIdentityPayload = {
|
|
32
48
|
site?: string;
|
|
33
49
|
hidUserId?: string | number;
|
|
@@ -139,6 +155,18 @@ export type HidSipAccountData = {
|
|
|
139
155
|
provisionedAt: string;
|
|
140
156
|
};
|
|
141
157
|
|
|
158
|
+
/** One row of the site's SIP account list - who owns the extension, never its password. */
|
|
159
|
+
export type HidSipAccountListItem = {
|
|
160
|
+
_id: string;
|
|
161
|
+
userId: string;
|
|
162
|
+
name: string;
|
|
163
|
+
email: string;
|
|
164
|
+
extension: string;
|
|
165
|
+
username: string;
|
|
166
|
+
status: string;
|
|
167
|
+
provisionedAt: string;
|
|
168
|
+
};
|
|
169
|
+
|
|
142
170
|
/**
|
|
143
171
|
* True only for the specific validation error an API that predates core #1878
|
|
144
172
|
* returns when the discover body carries `site`. Deliberately narrow: after
|
|
@@ -166,6 +194,36 @@ export default function useHidAmico() {
|
|
|
166
194
|
});
|
|
167
195
|
}
|
|
168
196
|
|
|
197
|
+
/**
|
|
198
|
+
* The signed-in member's own QR code on one reader.
|
|
199
|
+
*
|
|
200
|
+
* No user id in the path: the server takes the caller from the session, so
|
|
201
|
+
* these cannot be pointed at somebody else. `assigned` in the response says
|
|
202
|
+
* whether the HID permissions screen actually admits this member to the
|
|
203
|
+
* reader - issuing a code does not grant access, and the screen has to be
|
|
204
|
+
* able to say so.
|
|
205
|
+
*/
|
|
206
|
+
function getProfileQr(readerId: string) {
|
|
207
|
+
return useNuxtApp().$api<{ data: HidProfileQr }>(
|
|
208
|
+
`${basePath}/readers/${readerId}/profile-qr`,
|
|
209
|
+
{ method: "GET" },
|
|
210
|
+
);
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
function issueProfileQr(readerId: string) {
|
|
214
|
+
return useNuxtApp().$api<{ data: HidProfileQr }>(
|
|
215
|
+
`${basePath}/readers/${readerId}/profile-qr`,
|
|
216
|
+
{ method: "POST" },
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
function deleteProfileQr(readerId: string) {
|
|
221
|
+
return useNuxtApp().$api<{ data: HidProfileQr }>(
|
|
222
|
+
`${basePath}/readers/${readerId}/profile-qr`,
|
|
223
|
+
{ method: "DELETE" },
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
|
|
169
227
|
function createReader(payload: HidReaderPayload) {
|
|
170
228
|
return useNuxtApp().$api<HidApiRecord>(`${basePath}/readers`, {
|
|
171
229
|
method: "POST",
|
|
@@ -414,6 +472,27 @@ export default function useHidAmico() {
|
|
|
414
472
|
);
|
|
415
473
|
}
|
|
416
474
|
|
|
475
|
+
function getUserPasswordStatus(readerId: string, hidUserId: string | number) {
|
|
476
|
+
return useNuxtApp().$api<HidApiRecord>(
|
|
477
|
+
`${basePath}/readers/${readerId}/users/${hidUserId}/password`,
|
|
478
|
+
{ method: "GET" },
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
function setUserPassword(readerId: string, hidUserId: string | number, password: string) {
|
|
483
|
+
return useNuxtApp().$api<HidApiRecord>(
|
|
484
|
+
`${basePath}/readers/${readerId}/users/${hidUserId}/password`,
|
|
485
|
+
{ method: "PUT", body: { password } },
|
|
486
|
+
);
|
|
487
|
+
}
|
|
488
|
+
|
|
489
|
+
function deleteUserPassword(readerId: string, hidUserId: string | number) {
|
|
490
|
+
return useNuxtApp().$api<HidApiRecord>(
|
|
491
|
+
`${basePath}/readers/${readerId}/users/${hidUserId}/password`,
|
|
492
|
+
{ method: "DELETE" },
|
|
493
|
+
);
|
|
494
|
+
}
|
|
495
|
+
|
|
417
496
|
function deleteUserPin(readerId: string, hidUserId: string | number) {
|
|
418
497
|
return useNuxtApp().$api<{ data: { pinEnrolled: boolean } }>(
|
|
419
498
|
`${basePath}/readers/${readerId}/users/${hidUserId}/pin`,
|
|
@@ -474,6 +553,36 @@ export default function useHidAmico() {
|
|
|
474
553
|
);
|
|
475
554
|
}
|
|
476
555
|
|
|
556
|
+
function getSipAccounts(siteId: string, orgId: string) {
|
|
557
|
+
return useNuxtApp().$api<{ data: HidSipAccountListItem[] }>(
|
|
558
|
+
`${basePath}/sites/${siteId}/intercom/sip-accounts`,
|
|
559
|
+
{ method: "GET", query: { orgId } },
|
|
560
|
+
);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* Wake the resident's phone for a call the web phone has just placed.
|
|
565
|
+
*
|
|
566
|
+
* The SIP INVITE is the call and travels over the WebSocket, not through the
|
|
567
|
+
* API; this only rings the resident's mobile so somebody is there to answer
|
|
568
|
+
* it. It is therefore fired after the INVITE and never awaited in a way that
|
|
569
|
+
* could fail the call — see `startWebCall` in `HidIntercomManagement.vue`.
|
|
570
|
+
*
|
|
571
|
+
* `notified: false` with a reason is a normal response, not an error: staff
|
|
572
|
+
* extensions and external SIP addresses have no resident behind them.
|
|
573
|
+
*/
|
|
574
|
+
function notifyIntercomCall(
|
|
575
|
+
siteId: string,
|
|
576
|
+
payload: { orgId: string; destination: string; callId: string; readerId?: string },
|
|
577
|
+
) {
|
|
578
|
+
return useNuxtApp().$api<{
|
|
579
|
+
data: { notified: boolean; delivered?: number; reason?: string };
|
|
580
|
+
}>(
|
|
581
|
+
`${basePath}/sites/${siteId}/intercom/notify-call`,
|
|
582
|
+
{ method: "POST", body: payload },
|
|
583
|
+
);
|
|
584
|
+
}
|
|
585
|
+
|
|
477
586
|
function getPermissionCandidates(
|
|
478
587
|
siteId: string,
|
|
479
588
|
query: {
|
|
@@ -505,6 +614,9 @@ export default function useHidAmico() {
|
|
|
505
614
|
|
|
506
615
|
return {
|
|
507
616
|
getReaders,
|
|
617
|
+
getProfileQr,
|
|
618
|
+
issueProfileQr,
|
|
619
|
+
deleteProfileQr,
|
|
508
620
|
discoverReader,
|
|
509
621
|
createReader,
|
|
510
622
|
updateReader,
|
|
@@ -530,6 +642,9 @@ export default function useHidAmico() {
|
|
|
530
642
|
getUserPinStatus,
|
|
531
643
|
setUserPin,
|
|
532
644
|
deleteUserPin,
|
|
645
|
+
getUserPasswordStatus,
|
|
646
|
+
setUserPassword,
|
|
647
|
+
deleteUserPassword,
|
|
533
648
|
getIdentities,
|
|
534
649
|
getReaderUsers,
|
|
535
650
|
getReaderAccessLogs,
|
|
@@ -540,6 +655,8 @@ export default function useHidAmico() {
|
|
|
540
655
|
makeIntercomCall,
|
|
541
656
|
finalizeIntercomCall,
|
|
542
657
|
ensureSipAccount,
|
|
658
|
+
getSipAccounts,
|
|
659
|
+
notifyIntercomCall,
|
|
543
660
|
getSitePermissions,
|
|
544
661
|
getPermissionCandidates,
|
|
545
662
|
updateSitePermissions,
|
|
@@ -46,9 +46,33 @@ export default function useHidNavigation() {
|
|
|
46
46
|
},
|
|
47
47
|
},
|
|
48
48
|
{
|
|
49
|
+
// "HID Reader Users" now points at `access-mgmt/administrator`, not at
|
|
50
|
+
// `access-mgmt/hid-users`.
|
|
51
|
+
//
|
|
52
|
+
// Both routes mount a roster of the reader's users, but only this one
|
|
53
|
+
// can act on them. `administrator` renders HidUserEnrollment WITHOUT
|
|
54
|
+
// `card-management`, and that prop is what gates the Enroll action:
|
|
55
|
+
// <template v-if="!props.cardManagement" #actions>
|
|
56
|
+
// `hid-users` renders HidReaderUserRoster, which is read-only apart
|
|
57
|
+
// from PIN management. So the menu entry with this name used to lead
|
|
58
|
+
// to the screen that cannot enrol, while the screen that can was
|
|
59
|
+
// reachable only by typing the URL.
|
|
60
|
+
//
|
|
61
|
+
// `hid-users` is left in place and simply unlisted - the same state
|
|
62
|
+
// `administrator` was in - so any existing link to it still resolves.
|
|
49
63
|
title: "HID Reader Users",
|
|
50
64
|
route: {
|
|
51
|
-
name: "org-site-access-mgmt-
|
|
65
|
+
name: "org-site-access-mgmt-administrator",
|
|
66
|
+
params: { org, site },
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
// The signed-in member's own pass, not somebody else's. Every other
|
|
71
|
+
// entry in this group acts on a resident or a visitor; this one has
|
|
72
|
+
// no subject but the caller.
|
|
73
|
+
title: "HID QR Code",
|
|
74
|
+
route: {
|
|
75
|
+
name: "org-site-access-mgmt-hid-qr-code",
|
|
52
76
|
params: { org, site },
|
|
53
77
|
},
|
|
54
78
|
},
|
|
@@ -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
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { computed, ref, watch, type Ref } from "vue";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One site's building for the HERO building map and lift queue: the robots
|
|
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 on any
|
|
7
|
+
* of those robots (maps are stored per robot; the building is one).
|
|
8
|
+
*
|
|
9
|
+
* ponytail: the first 50 robots at the site and one map read per robot; a
|
|
10
|
+
* site-level map endpoint when a site holds more robots than that.
|
|
11
|
+
*/
|
|
12
|
+
export default function useRobotBuilding(
|
|
13
|
+
organization: Ref<string>,
|
|
14
|
+
site: Ref<string>,
|
|
15
|
+
type: Ref<"cleaning" | "security">,
|
|
16
|
+
) {
|
|
17
|
+
const { getSiteFleet, getSiteSummary, listBuildingMaps, getBuildingMap } = useRobots();
|
|
18
|
+
|
|
19
|
+
/** Every robot at the site this app may see, both types where the app shows both. */
|
|
20
|
+
const all = ref<Array<Record<string, any>>>([]);
|
|
21
|
+
const map = ref<Record<string, any> | null>(null);
|
|
22
|
+
const names = ref({ siteName: "", clientName: "" });
|
|
23
|
+
const loading = ref(true);
|
|
24
|
+
const error = ref("");
|
|
25
|
+
|
|
26
|
+
/** The robots of the type on screen (scope isolation: the other type is never drawn). */
|
|
27
|
+
const rows = computed(() => all.value.filter((r) => r.type === type.value));
|
|
28
|
+
|
|
29
|
+
async function loadMap(robots: Array<Record<string, any>>) {
|
|
30
|
+
const latest = await Promise.allSettled(robots.map((r) => listBuildingMaps(String(r._id), { limit: 1 })));
|
|
31
|
+
const summaries = latest
|
|
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;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let run = 0;
|
|
38
|
+
async function load() {
|
|
39
|
+
const mine = ++run;
|
|
40
|
+
loading.value = true;
|
|
41
|
+
error.value = "";
|
|
42
|
+
try {
|
|
43
|
+
const [fleet, summary] = await Promise.all([
|
|
44
|
+
getSiteFleet(organization.value, site.value, { page: 1, limit: 50 }),
|
|
45
|
+
getSiteSummary(organization.value, site.value).catch(() => null),
|
|
46
|
+
]);
|
|
47
|
+
if (mine !== run) return;
|
|
48
|
+
all.value = fleet?.items ?? [];
|
|
49
|
+
names.value = { siteName: summary?.site?.name ?? "", clientName: summary?.client?.name ?? "" };
|
|
50
|
+
const found = await loadMap(all.value);
|
|
51
|
+
if (mine !== run) return;
|
|
52
|
+
map.value = found;
|
|
53
|
+
} catch (e: any) {
|
|
54
|
+
if (mine !== run) return;
|
|
55
|
+
all.value = [];
|
|
56
|
+
map.value = null;
|
|
57
|
+
error.value = e?.data?.message || "Could not load this building.";
|
|
58
|
+
} finally {
|
|
59
|
+
if (mine === run) loading.value = false;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
watch([organization, site], load, { immediate: true });
|
|
64
|
+
|
|
65
|
+
return { all, rows, map, names, loading, error, reload: load };
|
|
66
|
+
}
|
|
@@ -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
|
}
|