@7365admin1/layer-common 4.25.0 → 4.26.1-staging.354
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 +18 -4
- package/components/AccessCardAddForm.vue +5 -4
- package/components/AccessCardAssignToUnitForm.vue +3 -2
- package/components/AccessCardPreviewDialog.vue +4 -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 +29 -5
- package/components/HidAccessPermissions.vue +424 -0
- package/components/HidIntercomManagement.vue +148 -14
- package/components/HidProfileQrCode.vue +323 -0
- package/components/HidReaderManagement.vue +26 -0
- package/components/HidReaderUserRoster.vue +32 -2
- package/components/HidUserEnrollment.vue +833 -152
- package/components/InvitationClientForm.vue +19 -1
- package/components/Robot/Fleet.vue +182 -2
- package/components/Robot/Form.vue +37 -12
- package/components/Robot/Map3D.vue +803 -40
- package/components/Robot/Plans.vue +63 -0
- package/components/Robot/SpotClean.vue +174 -0
- package/components/RolePermissionFormCreate.vue +163 -19
- package/components/RolePermissionFormPreviewUpdate.vue +230 -19
- package/components/RolePermissionMain.vue +19 -0
- package/components/VisitorManagement.vue +267 -5
- package/composables/useAccessManagement.ts +5 -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/usePeople.ts +19 -0
- package/composables/useRobots.ts +111 -0
- 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/building-map.ts +179 -8
- package/utils/hid-permission-assignments.ts +190 -0
- package/utils/occupancy-role.ts +109 -0
- package/utils/permission-labels.ts +30 -0
- package/utils/robot-display.ts +89 -0
|
@@ -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
|
|
|
@@ -100,6 +100,13 @@
|
|
|
100
100
|
<v-icon start size="16">{{ display(item).icon }}</v-icon>
|
|
101
101
|
{{ display(item).label }}
|
|
102
102
|
</v-chip>
|
|
103
|
+
<!-- The robot's own fault, in its words, under the chip. -->
|
|
104
|
+
<div
|
|
105
|
+
v-if="robotFaultText(states[item._id])"
|
|
106
|
+
class="text-caption text-error mt-1"
|
|
107
|
+
>
|
|
108
|
+
{{ robotFaultText(states[item._id]) }}
|
|
109
|
+
</div>
|
|
103
110
|
</template>
|
|
104
111
|
|
|
105
112
|
<template #item.floor="{ item }">
|
|
@@ -154,6 +161,38 @@
|
|
|
154
161
|
<AppButton size="small" variant="text" @click="openMap(item)">
|
|
155
162
|
View layout
|
|
156
163
|
</AppButton>
|
|
164
|
+
<v-menu location="bottom end">
|
|
165
|
+
<template #activator="{ props: menu }">
|
|
166
|
+
<AppButton
|
|
167
|
+
v-bind="menu"
|
|
168
|
+
variant="icon"
|
|
169
|
+
icon="mdi-dots-vertical"
|
|
170
|
+
:aria-label="`More actions for ${item.name}`"
|
|
171
|
+
/>
|
|
172
|
+
</template>
|
|
173
|
+
<v-list density="compact">
|
|
174
|
+
<v-list-item title="Schedule" prepend-icon="mdi-calendar-clock" @click="openPlans(item)" />
|
|
175
|
+
<!--
|
|
176
|
+
Only for a brand that can take a click on the plan. A brand
|
|
177
|
+
without it gets no control, not one the server refuses.
|
|
178
|
+
-->
|
|
179
|
+
<v-list-item
|
|
180
|
+
v-if="canCommand && brandSpotCleans(states[item._id])"
|
|
181
|
+
title="Spot clean"
|
|
182
|
+
prepend-icon="mdi-target"
|
|
183
|
+
:disabled="!canSpotClean(states[item._id])"
|
|
184
|
+
@click="openSpot(item)"
|
|
185
|
+
/>
|
|
186
|
+
<v-list-item v-if="canEdit" title="Edit" prepend-icon="mdi-pencil-outline" @click="openEdit(item)" />
|
|
187
|
+
<v-list-item
|
|
188
|
+
v-if="canDelete"
|
|
189
|
+
title="Remove"
|
|
190
|
+
prepend-icon="mdi-delete-outline"
|
|
191
|
+
base-color="error"
|
|
192
|
+
@click="openRemove(item)"
|
|
193
|
+
/>
|
|
194
|
+
</v-list>
|
|
195
|
+
</v-menu>
|
|
157
196
|
</div>
|
|
158
197
|
</template>
|
|
159
198
|
|
|
@@ -183,6 +222,9 @@
|
|
|
183
222
|
:key="mapRobot._id"
|
|
184
223
|
:robot-id="mapRobot._id"
|
|
185
224
|
:robot-state="states[mapRobot._id] ?? null"
|
|
225
|
+
:can-edit="canEdit"
|
|
226
|
+
:robot-name="mapRobot.name"
|
|
227
|
+
:robot-brand="mapRobot.brand"
|
|
186
228
|
/>
|
|
187
229
|
</AppCard>
|
|
188
230
|
</v-dialog>
|
|
@@ -245,6 +287,68 @@
|
|
|
245
287
|
@created="onCreated"
|
|
246
288
|
/>
|
|
247
289
|
</v-dialog>
|
|
290
|
+
|
|
291
|
+
<v-dialog v-model="editDialog" width="460" persistent>
|
|
292
|
+
<RobotForm
|
|
293
|
+
v-if="editDialog && actionRobot"
|
|
294
|
+
:key="actionRobot._id"
|
|
295
|
+
:organization="organization"
|
|
296
|
+
:site="site"
|
|
297
|
+
:type="robotType"
|
|
298
|
+
:robot="actionRobot"
|
|
299
|
+
@cancel="editDialog = false"
|
|
300
|
+
@saved="onSaved"
|
|
301
|
+
/>
|
|
302
|
+
</v-dialog>
|
|
303
|
+
|
|
304
|
+
<v-dialog v-model="plansDialog" width="560" scrollable>
|
|
305
|
+
<AppCard class="pa-0">
|
|
306
|
+
<v-toolbar density="comfortable" class="pl-4">
|
|
307
|
+
<span class="font-weight-medium text-h6">Schedule — {{ actionRobot?.name }}</span>
|
|
308
|
+
<v-spacer />
|
|
309
|
+
<AppButton variant="icon" icon="mdi-close" aria-label="Close" @click="plansDialog = false" />
|
|
310
|
+
</v-toolbar>
|
|
311
|
+
<RobotPlans v-if="plansDialog && actionRobot" :key="actionRobot._id" :robot-id="actionRobot._id" />
|
|
312
|
+
</AppCard>
|
|
313
|
+
</v-dialog>
|
|
314
|
+
|
|
315
|
+
<v-dialog v-model="spotDialog" width="720" scrollable>
|
|
316
|
+
<AppCard class="pa-0">
|
|
317
|
+
<v-toolbar density="comfortable" class="pl-4">
|
|
318
|
+
<span class="font-weight-medium text-h6">Spot clean — {{ actionRobot?.name }}</span>
|
|
319
|
+
</v-toolbar>
|
|
320
|
+
<RobotSpotClean
|
|
321
|
+
v-if="spotDialog && actionRobot"
|
|
322
|
+
:key="actionRobot._id"
|
|
323
|
+
:robot-id="actionRobot._id"
|
|
324
|
+
:robot-name="actionRobot.name"
|
|
325
|
+
@close="spotDialog = false"
|
|
326
|
+
@sent="onSpotSent"
|
|
327
|
+
/>
|
|
328
|
+
</AppCard>
|
|
329
|
+
</v-dialog>
|
|
330
|
+
|
|
331
|
+
<ConfirmDialog v-model="removeDialog" :loading="removing">
|
|
332
|
+
<template #title>Remove {{ actionRobot?.name }}?</template>
|
|
333
|
+
<template #description>
|
|
334
|
+
It stops appearing here and can no longer be sent to clean. To use it
|
|
335
|
+
again, add it back with its app key and token.
|
|
336
|
+
</template>
|
|
337
|
+
<template #footer>
|
|
338
|
+
<v-row no-gutters class="w-100">
|
|
339
|
+
<v-col cols="6" class="pr-2">
|
|
340
|
+
<v-btn block variant="outlined" class="text-none" :disabled="removing" @click="removeDialog = false">
|
|
341
|
+
Cancel
|
|
342
|
+
</v-btn>
|
|
343
|
+
</v-col>
|
|
344
|
+
<v-col cols="6" class="pl-2">
|
|
345
|
+
<v-btn block variant="flat" color="error" class="text-none" :loading="removing" @click="confirmRemove">
|
|
346
|
+
Remove
|
|
347
|
+
</v-btn>
|
|
348
|
+
</v-col>
|
|
349
|
+
</v-row>
|
|
350
|
+
</template>
|
|
351
|
+
</ConfirmDialog>
|
|
248
352
|
</template>
|
|
249
353
|
|
|
250
354
|
<script lang="ts" setup>
|
|
@@ -261,11 +365,14 @@
|
|
|
261
365
|
* gets nothing back rather than being trusted.
|
|
262
366
|
*/
|
|
263
367
|
import {
|
|
368
|
+
brandSpotCleans,
|
|
264
369
|
canDispatch,
|
|
265
370
|
canRecall,
|
|
371
|
+
canSpotClean,
|
|
266
372
|
floorLabel,
|
|
267
373
|
robotDisplay,
|
|
268
374
|
robotErrorMessage,
|
|
375
|
+
robotFaultText,
|
|
269
376
|
} from "../../utils/robot-display";
|
|
270
377
|
|
|
271
378
|
const props = withDefaults(
|
|
@@ -278,11 +385,84 @@ const props = withDefaults(
|
|
|
278
385
|
canAdd?: boolean;
|
|
279
386
|
/** Whether this user may dispatch. Reads and writes are separate grants. */
|
|
280
387
|
canCommand?: boolean;
|
|
388
|
+
/** `robot-mgmt:update-robot` - rename a robot or set its serial. */
|
|
389
|
+
canEdit?: boolean;
|
|
390
|
+
/** `robot-mgmt:delete-robot` - remove a robot. */
|
|
391
|
+
canDelete?: boolean;
|
|
281
392
|
}>(),
|
|
282
|
-
{
|
|
393
|
+
{
|
|
394
|
+
robotType: "cleaning",
|
|
395
|
+
title: "Robots",
|
|
396
|
+
canAdd: false,
|
|
397
|
+
canCommand: false,
|
|
398
|
+
canEdit: false,
|
|
399
|
+
canDelete: false,
|
|
400
|
+
},
|
|
283
401
|
);
|
|
284
402
|
|
|
285
|
-
const { getRobots, getRobotState, sendRobotCommand, getRobotMaps, trackRobot } =
|
|
403
|
+
const { getRobots, getRobotState, sendRobotCommand, getRobotMaps, trackRobot, deleteRobot } =
|
|
404
|
+
useRobots();
|
|
405
|
+
|
|
406
|
+
/* ---- the row menu: schedule, spot clean, edit, remove ------------------ */
|
|
407
|
+
|
|
408
|
+
const actionRobot = ref<Record<string, any> | null>(null);
|
|
409
|
+
const plansDialog = ref(false);
|
|
410
|
+
const spotDialog = ref(false);
|
|
411
|
+
const editDialog = ref(false);
|
|
412
|
+
const removeDialog = ref(false);
|
|
413
|
+
const removing = ref(false);
|
|
414
|
+
|
|
415
|
+
function openPlans(robot: Record<string, any>) {
|
|
416
|
+
actionRobot.value = robot;
|
|
417
|
+
plansDialog.value = true;
|
|
418
|
+
}
|
|
419
|
+
function openSpot(robot: Record<string, any>) {
|
|
420
|
+
actionRobot.value = robot;
|
|
421
|
+
spotDialog.value = true;
|
|
422
|
+
}
|
|
423
|
+
function openEdit(robot: Record<string, any>) {
|
|
424
|
+
actionRobot.value = robot;
|
|
425
|
+
editDialog.value = true;
|
|
426
|
+
}
|
|
427
|
+
function openRemove(robot: Record<string, any>) {
|
|
428
|
+
actionRobot.value = robot;
|
|
429
|
+
removeDialog.value = true;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
async function onSpotSent(message: string) {
|
|
433
|
+
spotDialog.value = false;
|
|
434
|
+
showToast(message, "success");
|
|
435
|
+
const robot = actionRobot.value;
|
|
436
|
+
if (!robot) return;
|
|
437
|
+
// Re-read: the API returns no job id, so the robot's own state is the proof.
|
|
438
|
+
try {
|
|
439
|
+
states.value = { ...states.value, [robot._id]: await getRobotState(robot._id) };
|
|
440
|
+
} catch {
|
|
441
|
+
// The command was accepted; a failed re-read only leaves the old chip.
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
function onSaved() {
|
|
446
|
+
editDialog.value = false;
|
|
447
|
+
showToast("Robot saved.", "success");
|
|
448
|
+
load();
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
async function confirmRemove() {
|
|
452
|
+
const robot = actionRobot.value;
|
|
453
|
+
if (!robot) return;
|
|
454
|
+
removing.value = true;
|
|
455
|
+
try {
|
|
456
|
+
await deleteRobot(robot._id);
|
|
457
|
+
removeDialog.value = false;
|
|
458
|
+
showToast(`${robot.name} has been removed.`, "success");
|
|
459
|
+
load();
|
|
460
|
+
} catch (e) {
|
|
461
|
+
showToast(robotErrorMessage(e, "Could not remove the robot."), "error");
|
|
462
|
+
} finally {
|
|
463
|
+
removing.value = false;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
286
466
|
|
|
287
467
|
// The house pattern is a local Snackbar with local state, as
|
|
288
468
|
// `AccessCardPreviewDialog.vue` does - there is no global toast composable.
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-card width="100%">
|
|
3
3
|
<v-toolbar density="comfortable" class="pl-4 py-2">
|
|
4
|
-
<span class="font-weight-medium text-h6">
|
|
4
|
+
<span class="font-weight-medium text-h6">
|
|
5
|
+
{{ editing ? `Edit ${robot?.name ?? "robot"}` : `Add ${typeLabel} robot` }}
|
|
6
|
+
</span>
|
|
5
7
|
</v-toolbar>
|
|
6
8
|
|
|
7
9
|
<v-card-text class="pa-0" style="max-height: 70vh; overflow-y: auto">
|
|
8
10
|
<v-form ref="form" @submit.prevent="submit">
|
|
9
11
|
<v-row no-gutters class="px-6 pt-4">
|
|
10
12
|
<v-col cols="12" class="mb-2">
|
|
11
|
-
<p class="text-body-2 text-medium-emphasis">
|
|
13
|
+
<p v-if="editing" class="text-body-2 text-medium-emphasis">
|
|
14
|
+
Rename the robot or set its serial. To change its brand or its app
|
|
15
|
+
key and token, remove the robot and add it again.
|
|
16
|
+
</p>
|
|
17
|
+
<p v-else class="text-body-2 text-medium-emphasis">
|
|
12
18
|
The app key and token come from your robot supplier. They are used
|
|
13
19
|
to talk to the robot and are never shown again once saved.
|
|
14
20
|
</p>
|
|
@@ -25,7 +31,7 @@
|
|
|
25
31
|
/>
|
|
26
32
|
</v-col>
|
|
27
33
|
|
|
28
|
-
<v-col cols="12">
|
|
34
|
+
<v-col v-if="!editing" cols="12">
|
|
29
35
|
<InputLabel class="font-weight-bold" title="Brand" required />
|
|
30
36
|
<AppSelect
|
|
31
37
|
v-model="brand"
|
|
@@ -42,7 +48,7 @@
|
|
|
42
48
|
</p>
|
|
43
49
|
</v-col>
|
|
44
50
|
|
|
45
|
-
<v-col cols="12">
|
|
51
|
+
<v-col v-if="!editing" cols="12">
|
|
46
52
|
<InputLabel class="font-weight-bold" title="App key" required />
|
|
47
53
|
<v-text-field
|
|
48
54
|
v-model="appKey"
|
|
@@ -53,7 +59,7 @@
|
|
|
53
59
|
/>
|
|
54
60
|
</v-col>
|
|
55
61
|
|
|
56
|
-
<v-col cols="12">
|
|
62
|
+
<v-col v-if="!editing" cols="12">
|
|
57
63
|
<InputLabel class="font-weight-bold" title="App token" required />
|
|
58
64
|
<!--
|
|
59
65
|
Masked like a password because that is what it is: this token signs
|
|
@@ -111,7 +117,7 @@
|
|
|
111
117
|
:loading="saving"
|
|
112
118
|
@click="submit"
|
|
113
119
|
>
|
|
114
|
-
Add robot
|
|
120
|
+
{{ editing ? "Save" : "Add robot" }}
|
|
115
121
|
</v-btn>
|
|
116
122
|
</v-col>
|
|
117
123
|
</v-row>
|
|
@@ -140,23 +146,26 @@ const props = withDefaults(
|
|
|
140
146
|
organization: string;
|
|
141
147
|
site: string;
|
|
142
148
|
type?: "cleaning" | "security";
|
|
149
|
+
/** When given, the form edits this robot instead of adding one. */
|
|
150
|
+
robot?: Record<string, any> | null;
|
|
143
151
|
}>(),
|
|
144
|
-
{ type: "cleaning" },
|
|
152
|
+
{ type: "cleaning", robot: null },
|
|
145
153
|
);
|
|
146
154
|
|
|
147
|
-
const emit = defineEmits<{ cancel: []; created: [] }>();
|
|
155
|
+
const emit = defineEmits<{ cancel: []; created: []; saved: [] }>();
|
|
148
156
|
|
|
149
|
-
const { createRobot, getRobotBrands } = useRobots();
|
|
157
|
+
const { createRobot, updateRobot, getRobotBrands } = useRobots();
|
|
158
|
+
const editing = computed(() => !!props.robot?._id);
|
|
150
159
|
const { requiredRule } = useUtils();
|
|
151
160
|
|
|
152
161
|
const form = ref();
|
|
153
|
-
const name = ref("");
|
|
162
|
+
const name = ref(props.robot?.name ?? "");
|
|
154
163
|
const brand = ref("");
|
|
155
164
|
const brands = ref<Array<Record<string, any>>>([]);
|
|
156
165
|
const loadingBrands = ref(false);
|
|
157
166
|
const appKey = ref("");
|
|
158
167
|
const appToken = ref("");
|
|
159
|
-
const robotSn = ref("");
|
|
168
|
+
const robotSn = ref(props.robot?.robotSn ?? "");
|
|
160
169
|
const reveal = ref(false);
|
|
161
170
|
const saving = ref(false);
|
|
162
171
|
const error = ref("");
|
|
@@ -201,7 +210,9 @@ async function loadBrands() {
|
|
|
201
210
|
}
|
|
202
211
|
}
|
|
203
212
|
|
|
204
|
-
onMounted(
|
|
213
|
+
onMounted(() => {
|
|
214
|
+
if (!editing.value) loadBrands();
|
|
215
|
+
});
|
|
205
216
|
|
|
206
217
|
async function submit() {
|
|
207
218
|
const { valid } = await form.value?.validate?.() ?? { valid: false };
|
|
@@ -209,6 +220,20 @@ async function submit() {
|
|
|
209
220
|
|
|
210
221
|
saving.value = true;
|
|
211
222
|
error.value = "";
|
|
223
|
+
if (editing.value) {
|
|
224
|
+
try {
|
|
225
|
+
await updateRobot(props.robot!._id, {
|
|
226
|
+
name: name.value.trim(),
|
|
227
|
+
robotSn: robotSn.value.trim(),
|
|
228
|
+
});
|
|
229
|
+
emit("saved");
|
|
230
|
+
} catch (e) {
|
|
231
|
+
error.value = robotErrorMessage(e, "Could not save the robot.");
|
|
232
|
+
} finally {
|
|
233
|
+
saving.value = false;
|
|
234
|
+
}
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
212
237
|
try {
|
|
213
238
|
await createRobot({
|
|
214
239
|
name: name.value.trim(),
|