@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
|
@@ -388,9 +388,27 @@ watch(
|
|
|
388
388
|
const roles = ref<any[]>([])
|
|
389
389
|
const { getRoles } = useRole()
|
|
390
390
|
|
|
391
|
+
/*
|
|
392
|
+
* `type` is the ROLE type, not the service the client subscribes to, and the
|
|
393
|
+
* only caller (`ClientMain.vue` "Invite Client") passes no `app` prop -- so
|
|
394
|
+
* this sent `type: ""` and the endpoint applied no type filter at all. The
|
|
395
|
+
* dropdown therefore listed every org-less role of every type, which includes
|
|
396
|
+
* the platform's OWN staff roles (`type: "admin"` -- the two rows the console's
|
|
397
|
+
* `/super-admin/role-permissions` screen edits). Offering a Seven365 console
|
|
398
|
+
* staff role on a CLIENT invitation is the defect.
|
|
399
|
+
*
|
|
400
|
+
* A client admin's role is `type: "organization"`, which is what the client
|
|
401
|
+
* roles screen (`org/[organization]/roles-permissions.vue`) already lists. This
|
|
402
|
+
* narrows to exactly that. It is a narrowing of this one picker only: no role
|
|
403
|
+
* changes, no permission changes, and the org-less `organization` roles that
|
|
404
|
+
* were already being picked are all still offered.
|
|
405
|
+
*
|
|
406
|
+
* Keying off the selected service instead would empty the dropdown -- no
|
|
407
|
+
* org-less role carries a service type -- so `props.app` is not the filter.
|
|
408
|
+
*/
|
|
391
409
|
const { data: roleData, refresh: refreshRoles } = await useLazyAsyncData(
|
|
392
410
|
"roles",
|
|
393
|
-
() => getRoles({ org: org.value?._id, type:
|
|
411
|
+
() => getRoles({ org: org.value?._id, type: "organization", limit: 50 }),
|
|
394
412
|
{ watch: [() => props.app] }
|
|
395
413
|
)
|
|
396
414
|
|
|
@@ -134,6 +134,7 @@ import {
|
|
|
134
134
|
timeAgo,
|
|
135
135
|
type TInboxItem,
|
|
136
136
|
} from "../utils/notification-inbox";
|
|
137
|
+
import { notificationTarget } from "../utils/notification-target";
|
|
137
138
|
|
|
138
139
|
/**
|
|
139
140
|
* The top-bar notification feed for the web, in every signed-in app.
|
|
@@ -165,6 +166,8 @@ defineProps({
|
|
|
165
166
|
|
|
166
167
|
const { getAll, getUnreadCount, markAsRead, markAllAsRead } = useNotification();
|
|
167
168
|
const { currentUser } = useLocalAuth();
|
|
169
|
+
const route = useRoute();
|
|
170
|
+
const router = useRouter();
|
|
168
171
|
|
|
169
172
|
const open = ref(false);
|
|
170
173
|
const loading = ref(false);
|
|
@@ -269,16 +272,49 @@ function announce(fresh: TInboxItem[]) {
|
|
|
269
272
|
}
|
|
270
273
|
}
|
|
271
274
|
|
|
275
|
+
/**
|
|
276
|
+
* Clicking a row does two separate things, and the second one is why the row is
|
|
277
|
+
* a button at all: mark it read, and go to what it is about.
|
|
278
|
+
*
|
|
279
|
+
* They are kept apart deliberately. Marking read is best-effort and reverts on
|
|
280
|
+
* failure; navigation must not wait on that round trip, and must still happen
|
|
281
|
+
* for a row that was ALREADY read — a person re-opening the bell to find the
|
|
282
|
+
* order they were told about is the ordinary case, and the old early-return on
|
|
283
|
+
* `hasRead` would have sent them nowhere.
|
|
284
|
+
*/
|
|
272
285
|
async function openNotification(item: Record<string, any>) {
|
|
286
|
+
markRead(item);
|
|
287
|
+
await goToSubject(item);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function markRead(item: Record<string, any>) {
|
|
273
291
|
if (item.hasRead) return;
|
|
274
292
|
// Marked locally first: waiting on a round trip to move the dot reads as a dead control.
|
|
275
293
|
item.hasRead = true;
|
|
276
294
|
unread.value = Math.max(0, unread.value - 1);
|
|
277
|
-
|
|
278
|
-
await markAsRead(String(item._id), userId.value);
|
|
279
|
-
} catch {
|
|
295
|
+
markAsRead(String(item._id), userId.value).catch(() => {
|
|
280
296
|
item.hasRead = false;
|
|
281
297
|
unread.value += 1;
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
/**
|
|
302
|
+
* `hasRoute` is the whole reason an org-app route name may live in the shared
|
|
303
|
+
* layer: the ten apps that have no order queue simply do not match it, and the
|
|
304
|
+
* click there stays what it always was.
|
|
305
|
+
*/
|
|
306
|
+
async function goToSubject(item: Record<string, any>) {
|
|
307
|
+
const target = notificationTarget(item as any, {
|
|
308
|
+
organization: String(route.params?.organization ?? ""),
|
|
309
|
+
});
|
|
310
|
+
if (!target) return;
|
|
311
|
+
if (typeof router.hasRoute !== "function" || !router.hasRoute(target.name)) return;
|
|
312
|
+
|
|
313
|
+
open.value = false;
|
|
314
|
+
try {
|
|
315
|
+
await router.push(target);
|
|
316
|
+
} catch {
|
|
317
|
+
// A cancelled or duplicate navigation is not worth an error in the top bar.
|
|
282
318
|
}
|
|
283
319
|
}
|
|
284
320
|
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<!--
|
|
3
|
+
ACTIVITY LOG (README §7): When · Who · Action · Target - commands, robots
|
|
4
|
+
added / edited / removed (demo robots too), building-map saves and lift
|
|
5
|
+
requests, newest first, server paged. Read from the audit trail (read
|
|
6
|
+
only); the first page refreshes every 10 s while visible, so a command
|
|
7
|
+
sent from another screen appears at the top on its own.
|
|
8
|
+
-->
|
|
9
|
+
<div class="hero-head">
|
|
10
|
+
<div>
|
|
11
|
+
<button v-if="backToNetwork" type="button" class="hero-back hero-back--sm" @click="emit('network')">‹ Network</button>
|
|
12
|
+
<div class="hero-kicker hero-kicker--accent">{{ kicker }}</div>
|
|
13
|
+
<h2 class="hero-title">Activity log</h2>
|
|
14
|
+
</div>
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
<div v-if="error && !rows.length" class="hero-notice" role="alert">{{ error }}</div>
|
|
18
|
+
<div v-else-if="error" class="hero-notice" role="status">Reconnecting… the log shows its last reading.</div>
|
|
19
|
+
<RobotTable
|
|
20
|
+
v-if="!(error && !rows.length)"
|
|
21
|
+
:headers="headers"
|
|
22
|
+
:items="rows"
|
|
23
|
+
:items-length="total"
|
|
24
|
+
:page="page"
|
|
25
|
+
:items-per-page="limit"
|
|
26
|
+
:loading="loading"
|
|
27
|
+
noun="entries"
|
|
28
|
+
empty-title="No activity yet"
|
|
29
|
+
empty-hint="Commands, robots added or removed, building map saves and lift requests appear here as they happen."
|
|
30
|
+
compact
|
|
31
|
+
paged-foot
|
|
32
|
+
item-value="id"
|
|
33
|
+
@update:page="load"
|
|
34
|
+
>
|
|
35
|
+
<template #item.when="{ item }"><span class="hero-log__when">{{ item.when }}</span></template>
|
|
36
|
+
<template #item.who="{ item }"><span class="hero-log__who">{{ item.who }}</span></template>
|
|
37
|
+
<template #item.target="{ item }"><span class="hero-log__target">{{ item.target }}</span></template>
|
|
38
|
+
</RobotTable>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { computed, onBeforeUnmount, ref, watch } from "vue";
|
|
43
|
+
import RobotTable from "./Table.vue";
|
|
44
|
+
import { activityRow, listMeta } from "../../utils/robot-display";
|
|
45
|
+
|
|
46
|
+
const props = withDefaults(
|
|
47
|
+
defineProps<{
|
|
48
|
+
/** The site whose robots' activity to show; ignored with `network`. */
|
|
49
|
+
site?: string;
|
|
50
|
+
/** Seven365 Super Admin: every client's robots (`/robots/network/activity`). */
|
|
51
|
+
network?: boolean;
|
|
52
|
+
/** One robot only. */
|
|
53
|
+
robot?: string;
|
|
54
|
+
siteName?: string;
|
|
55
|
+
clientName?: string;
|
|
56
|
+
backToNetwork?: boolean;
|
|
57
|
+
limit?: number;
|
|
58
|
+
pollMs?: number;
|
|
59
|
+
}>(),
|
|
60
|
+
{ site: "", network: false, robot: "", siteName: "", clientName: "", backToNetwork: false, limit: 25, pollMs: 10000 },
|
|
61
|
+
);
|
|
62
|
+
const emit = defineEmits<{ network: [] }>();
|
|
63
|
+
|
|
64
|
+
const { getSiteActivity, getNetworkActivity } = useRobots();
|
|
65
|
+
const raw = ref<any[]>([]);
|
|
66
|
+
const total = ref(0);
|
|
67
|
+
const page = ref(1);
|
|
68
|
+
const loading = ref(true);
|
|
69
|
+
const error = ref("");
|
|
70
|
+
const now = ref(Date.now());
|
|
71
|
+
|
|
72
|
+
const rows = computed(() => raw.value.map((e) => activityRow(e, now.value)));
|
|
73
|
+
const kicker = computed(() => (props.network ? "Whole network" : [props.clientName, props.siteName].filter(Boolean).join(" · ")));
|
|
74
|
+
const headers = [
|
|
75
|
+
{ title: "When", key: "when", sortable: false },
|
|
76
|
+
{ title: "Who", key: "who", sortable: false },
|
|
77
|
+
{ title: "Action", key: "action", sortable: false },
|
|
78
|
+
{ title: "Target", key: "target", sortable: false },
|
|
79
|
+
];
|
|
80
|
+
|
|
81
|
+
async function load(next = page.value) {
|
|
82
|
+
page.value = next;
|
|
83
|
+
try {
|
|
84
|
+
const res = props.network
|
|
85
|
+
? await getNetworkActivity({ page: next, limit: props.limit })
|
|
86
|
+
: await getSiteActivity(props.site, { page: next, limit: props.limit, robot: props.robot });
|
|
87
|
+
raw.value = res?.items ?? [];
|
|
88
|
+
total.value = listMeta(res, props.limit).total;
|
|
89
|
+
error.value = "";
|
|
90
|
+
} catch (e) {
|
|
91
|
+
error.value = (e as any)?.data?.message || "Can't reach the activity log right now. Reconnecting…";
|
|
92
|
+
} finally {
|
|
93
|
+
loading.value = false;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
// Newest first: only the first page refreshes - an older page stays where the reader left it.
|
|
98
|
+
const timer = setInterval(() => {
|
|
99
|
+
now.value = Date.now();
|
|
100
|
+
if (typeof document !== "undefined" && document.visibilityState === "hidden") return;
|
|
101
|
+
if (page.value === 1) load(1);
|
|
102
|
+
}, props.pollMs);
|
|
103
|
+
onBeforeUnmount(() => clearInterval(timer));
|
|
104
|
+
|
|
105
|
+
watch(
|
|
106
|
+
[() => props.site, () => props.network, () => props.robot],
|
|
107
|
+
() => {
|
|
108
|
+
loading.value = true;
|
|
109
|
+
load(1);
|
|
110
|
+
},
|
|
111
|
+
{ immediate: true },
|
|
112
|
+
);
|
|
113
|
+
</script>
|
|
@@ -97,24 +97,25 @@
|
|
|
97
97
|
</div>
|
|
98
98
|
</div>
|
|
99
99
|
|
|
100
|
-
<v-dialog v-model="editOpen" width="
|
|
100
|
+
<v-dialog v-model="editOpen" width="520" persistent>
|
|
101
101
|
<RobotForm
|
|
102
102
|
v-if="editOpen && record"
|
|
103
103
|
:key="record._id"
|
|
104
104
|
:organization="String(record.client?._id ?? '')"
|
|
105
105
|
:site="String(record.site?._id ?? '')"
|
|
106
106
|
:type="robotType"
|
|
107
|
-
:
|
|
107
|
+
:types="types.length ? types : [robotType]"
|
|
108
|
+
:robot="{ ...record, brandName: brand }"
|
|
108
109
|
@cancel="editOpen = false"
|
|
109
110
|
@saved="onSaved"
|
|
110
111
|
/>
|
|
111
112
|
</v-dialog>
|
|
112
113
|
|
|
113
|
-
<v-dialog v-model="removeOpen" width="
|
|
114
|
+
<v-dialog v-model="removeOpen" width="440">
|
|
114
115
|
<div class="hero-dialog" role="alertdialog" aria-labelledby="hero-remove-title">
|
|
115
116
|
<div id="hero-remove-title" class="hero-dialog__title">Remove {{ record?.name }}?</div>
|
|
116
117
|
<div class="hero-dialog__body">
|
|
117
|
-
|
|
118
|
+
The robot is removed from {{ record?.site?.name || "this site" }} and stops reporting. Its activity history is kept. This cannot be undone from here.
|
|
118
119
|
</div>
|
|
119
120
|
<div class="hero-dialog__actions">
|
|
120
121
|
<v-btn variant="outlined" :disabled="removing" @click="removeOpen = false">Keep robot</v-btn>
|
|
@@ -174,9 +175,11 @@ const props = withDefaults(
|
|
|
174
175
|
canEdit?: boolean;
|
|
175
176
|
canCommand?: boolean;
|
|
176
177
|
canDelete?: boolean;
|
|
178
|
+
/** The robot types this app presents - the edit dialog shows Type only with both. */
|
|
179
|
+
types?: Array<"cleaning" | "security">;
|
|
177
180
|
tickMs?: number;
|
|
178
181
|
}>(),
|
|
179
|
-
{ backLabel: "", canEdit: false, canCommand: false, canDelete: false, tickMs: 1200 },
|
|
182
|
+
{ backLabel: "", canEdit: false, canCommand: false, canDelete: false, types: () => [], tickMs: 1200 },
|
|
180
183
|
);
|
|
181
184
|
const emit = defineEmits<{
|
|
182
185
|
back: [];
|