@7365admin1/layer-common 3.1.4-staging.46 → 3.1.4-staging.48
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/components/AccessCardPreviewDialog.vue +2 -2
- package/components/AccessCardQrTagging.vue +8 -1
- package/components/AccessManagement.vue +12 -4
- package/components/Input/ListGroupSelection.vue +8 -1
- package/components/Nfc/NFCPatrolRouteMain.vue +52 -7
- package/components/RolePermissionFormCreate.vue +9 -1
- package/package.json +1 -1
|
@@ -309,7 +309,7 @@
|
|
|
309
309
|
Close
|
|
310
310
|
</v-btn>
|
|
311
311
|
</v-col>
|
|
312
|
-
<v-col cols="6" class="pa-0"
|
|
312
|
+
<v-col cols="6" class="pa-0">
|
|
313
313
|
<v-menu>
|
|
314
314
|
<template #activator="{ props }">
|
|
315
315
|
<v-btn
|
|
@@ -336,7 +336,7 @@
|
|
|
336
336
|
<v-list-item
|
|
337
337
|
:disabled="!isSelectedCardAssignedPhysical"
|
|
338
338
|
@click="emit('replace')"
|
|
339
|
-
v-if="canReplaceAccessCard && isSelectedCardAssignedPhysical"
|
|
339
|
+
v-if="(canUpdate || canReplaceAccessCard) && isSelectedCardAssignedPhysical"
|
|
340
340
|
>
|
|
341
341
|
<v-list-item-title class="text-subtitle-2">
|
|
342
342
|
Replace Card
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
</v-row>
|
|
50
50
|
</v-col>
|
|
51
51
|
|
|
52
|
-
<v-col cols="12">
|
|
52
|
+
<v-col cols="12" v-if="canViewAllQrTagging">
|
|
53
53
|
<v-card
|
|
54
54
|
width="100%"
|
|
55
55
|
variant="outlined"
|
|
@@ -196,6 +196,13 @@ definePageMeta({
|
|
|
196
196
|
memberOnly: true,
|
|
197
197
|
});
|
|
198
198
|
|
|
199
|
+
const props = defineProps({
|
|
200
|
+
canViewAllQrTagging: {
|
|
201
|
+
type: Boolean,
|
|
202
|
+
default: true,
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
|
|
199
206
|
const tableHeaders = [
|
|
200
207
|
{ title: "", key: "selectGenerate", sortable: false, width: "50px" },
|
|
201
208
|
{ title: "Card", key: "cardNo", sortable: false },
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
variant="tonal"
|
|
20
20
|
size="large"
|
|
21
21
|
@click="assignDialog = true"
|
|
22
|
-
v-if="
|
|
22
|
+
v-if="canUpdateAccessCard && canAssignAccessCard"
|
|
23
23
|
>
|
|
24
24
|
Assign to Unit
|
|
25
25
|
</v-btn>
|
|
@@ -38,11 +38,11 @@
|
|
|
38
38
|
</v-row>
|
|
39
39
|
</v-col>
|
|
40
40
|
<!-- Available Card Stats -->
|
|
41
|
-
<v-col cols="12" class="mb-2">
|
|
41
|
+
<v-col cols="12" class="mb-2" v-if="canViewAllCards">
|
|
42
42
|
<AccessCardAvailableStats ref="statsRef" :site-id="siteId" />
|
|
43
43
|
</v-col>
|
|
44
44
|
|
|
45
|
-
<v-col cols="12">
|
|
45
|
+
<v-col cols="12" v-if="canViewAllCards">
|
|
46
46
|
<v-card
|
|
47
47
|
width="100%"
|
|
48
48
|
variant="outlined"
|
|
@@ -107,7 +107,7 @@
|
|
|
107
107
|
v-model="previewDialog"
|
|
108
108
|
:unit="selectedCard"
|
|
109
109
|
v-model:selected-card-in-unit="selectedCardInUnit"
|
|
110
|
-
:can-update="
|
|
110
|
+
:can-update="canUpdateAccessCard"
|
|
111
111
|
:can-replace-access-card="canReplaceAccessCard"
|
|
112
112
|
:can-delete-access-card="canDeleteAccessCard"
|
|
113
113
|
:is-selected-card-assigned-physical="isSelectedCardAssignedPhysical"
|
|
@@ -203,6 +203,10 @@ const props = defineProps({
|
|
|
203
203
|
type: Boolean,
|
|
204
204
|
default: true,
|
|
205
205
|
},
|
|
206
|
+
canUpdateAccessCard: {
|
|
207
|
+
type: Boolean,
|
|
208
|
+
default: true,
|
|
209
|
+
},
|
|
206
210
|
canDeleteAccessCard: {
|
|
207
211
|
type: Boolean,
|
|
208
212
|
default: true,
|
|
@@ -215,6 +219,10 @@ const props = defineProps({
|
|
|
215
219
|
type: Boolean,
|
|
216
220
|
default: true,
|
|
217
221
|
},
|
|
222
|
+
canViewAllCards: {
|
|
223
|
+
type: Boolean,
|
|
224
|
+
default: true,
|
|
225
|
+
},
|
|
218
226
|
});
|
|
219
227
|
|
|
220
228
|
// const { headerSearch } = useLocal();
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
<template v-slot:activator="{ props }">
|
|
20
20
|
<v-list-item v-bind="props" density="compact">
|
|
21
21
|
<span class="text-capitalize">
|
|
22
|
-
{{ String(permissionKey)
|
|
22
|
+
{{ formatResourceLabel(String(permissionKey)) }}
|
|
23
23
|
</span>
|
|
24
24
|
|
|
25
25
|
<template #prepend>
|
|
@@ -89,6 +89,13 @@ const props = defineProps({
|
|
|
89
89
|
},
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
+
const resourceLabels: Record<string, string> = {
|
|
93
|
+
"access-card-mgmt": "Access Mgmt",
|
|
94
|
+
};
|
|
95
|
+
function formatResourceLabel(key: string): string {
|
|
96
|
+
return resourceLabels[key] ?? key.replace(/-/g, " ");
|
|
97
|
+
}
|
|
98
|
+
|
|
92
99
|
const selectedActionCount = (resource: string) => {
|
|
93
100
|
return selected.value.filter((permission) => permission.startsWith(resource))
|
|
94
101
|
.length;
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
<v-row no-gutters class="mb-4" align="center">
|
|
5
5
|
<v-col cols="12" md="6">
|
|
6
6
|
<v-btn
|
|
7
|
+
v-if="props.canCreateNfcPatrol"
|
|
7
8
|
rounded="pill"
|
|
8
9
|
variant="outlined"
|
|
9
10
|
|
|
@@ -82,7 +83,12 @@
|
|
|
82
83
|
</v-col>
|
|
83
84
|
|
|
84
85
|
<!-- Add Dialog -->
|
|
85
|
-
<v-dialog
|
|
86
|
+
<v-dialog
|
|
87
|
+
v-if="props.canCreateNfcPatrol"
|
|
88
|
+
v-model="dialogAdd"
|
|
89
|
+
persistent
|
|
90
|
+
max-width="900"
|
|
91
|
+
>
|
|
86
92
|
<NFCPatrolRouteForm
|
|
87
93
|
title="Add Route"
|
|
88
94
|
:site="props.site"
|
|
@@ -94,7 +100,12 @@
|
|
|
94
100
|
</v-dialog>
|
|
95
101
|
|
|
96
102
|
<!-- Edit Dialog -->
|
|
97
|
-
<v-dialog
|
|
103
|
+
<v-dialog
|
|
104
|
+
v-if="props.canUpdateNfcPatrol"
|
|
105
|
+
v-model="dialogEdit"
|
|
106
|
+
persistent
|
|
107
|
+
max-width="900"
|
|
108
|
+
>
|
|
98
109
|
<NFCPatrolRouteForm
|
|
99
110
|
title="Edit Route"
|
|
100
111
|
:site="props.site"
|
|
@@ -190,7 +201,10 @@
|
|
|
190
201
|
|
|
191
202
|
<v-toolbar class="pa-0" density="compact">
|
|
192
203
|
<v-row no-gutters>
|
|
193
|
-
<v-col
|
|
204
|
+
<v-col
|
|
205
|
+
:cols="props.canUpdateNfcPatrol || props.canDeleteNfcPatrol ? 6 : 12"
|
|
206
|
+
class="pa-0"
|
|
207
|
+
>
|
|
194
208
|
<v-btn
|
|
195
209
|
block
|
|
196
210
|
variant="text"
|
|
@@ -203,7 +217,11 @@
|
|
|
203
217
|
</v-btn>
|
|
204
218
|
</v-col>
|
|
205
219
|
|
|
206
|
-
<v-col
|
|
220
|
+
<v-col
|
|
221
|
+
v-if="props.canUpdateNfcPatrol || props.canDeleteNfcPatrol"
|
|
222
|
+
cols="6"
|
|
223
|
+
class="pa-0"
|
|
224
|
+
>
|
|
207
225
|
<v-menu>
|
|
208
226
|
<template #activator="{ props }">
|
|
209
227
|
<v-btn
|
|
@@ -220,13 +238,17 @@
|
|
|
220
238
|
</template>
|
|
221
239
|
|
|
222
240
|
<v-list class="pa-0">
|
|
223
|
-
<v-list-item @click="openDialogEdit()">
|
|
241
|
+
<v-list-item v-if="props.canUpdateNfcPatrol" @click="openDialogEdit()">
|
|
224
242
|
<v-list-item-title class="text-subtitle-2">
|
|
225
243
|
Edit Route
|
|
226
244
|
</v-list-item-title>
|
|
227
245
|
</v-list-item>
|
|
228
246
|
|
|
229
|
-
<v-list-item
|
|
247
|
+
<v-list-item
|
|
248
|
+
v-if="props.canDeleteNfcPatrol"
|
|
249
|
+
@click="openDialogDelete()"
|
|
250
|
+
class="text-red"
|
|
251
|
+
>
|
|
230
252
|
<v-list-item-title class="text-subtitle-2">
|
|
231
253
|
Delete Route
|
|
232
254
|
</v-list-item-title>
|
|
@@ -240,7 +262,12 @@
|
|
|
240
262
|
</v-dialog>
|
|
241
263
|
|
|
242
264
|
<!-- Delete Dialog -->
|
|
243
|
-
<v-dialog
|
|
265
|
+
<v-dialog
|
|
266
|
+
v-if="props.canDeleteNfcPatrol"
|
|
267
|
+
v-model="dialogDelete"
|
|
268
|
+
persistent
|
|
269
|
+
width="540"
|
|
270
|
+
>
|
|
244
271
|
<v-card width="100%">
|
|
245
272
|
<v-card-text
|
|
246
273
|
style="max-height: 100vh; overflow-y: auto"
|
|
@@ -304,6 +331,18 @@ const props = defineProps({
|
|
|
304
331
|
type: String,
|
|
305
332
|
required: true,
|
|
306
333
|
},
|
|
334
|
+
canCreateNfcPatrol: {
|
|
335
|
+
type: Boolean,
|
|
336
|
+
default: false,
|
|
337
|
+
},
|
|
338
|
+
canUpdateNfcPatrol: {
|
|
339
|
+
type: Boolean,
|
|
340
|
+
default: false,
|
|
341
|
+
},
|
|
342
|
+
canDeleteNfcPatrol: {
|
|
343
|
+
type: Boolean,
|
|
344
|
+
default: false,
|
|
345
|
+
},
|
|
307
346
|
headers: {
|
|
308
347
|
type: Array as PropType<Array<any>>,
|
|
309
348
|
default: () => [
|
|
@@ -406,6 +445,8 @@ const messageSnackbar = ref(false);
|
|
|
406
445
|
const messageColor = ref("");
|
|
407
446
|
|
|
408
447
|
async function openDialogEdit() {
|
|
448
|
+
if (!props.canUpdateNfcPatrol) return;
|
|
449
|
+
|
|
409
450
|
try {
|
|
410
451
|
// Fetch the full route details from the API
|
|
411
452
|
const response = await getRouteById(selectedRoute.value._id);
|
|
@@ -431,6 +472,8 @@ async function openDialogEdit() {
|
|
|
431
472
|
}
|
|
432
473
|
|
|
433
474
|
function openDialogDelete() {
|
|
475
|
+
if (!props.canDeleteNfcPatrol) return;
|
|
476
|
+
|
|
434
477
|
dialogDelete.value = true;
|
|
435
478
|
|
|
436
479
|
if (dialogPreview.value) dialogPreview.value = false;
|
|
@@ -502,6 +545,8 @@ function handleRowClick(_: any, data: any) {
|
|
|
502
545
|
}
|
|
503
546
|
|
|
504
547
|
async function submitDelete() {
|
|
548
|
+
if (!props.canDeleteNfcPatrol) return;
|
|
549
|
+
|
|
505
550
|
try {
|
|
506
551
|
await deleteRouteById(selectedRoute.value._id ?? "");
|
|
507
552
|
await getRoutesRefresh();
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
<span
|
|
78
78
|
class="text-capitalize text-subtitle-2 font-weight-medium"
|
|
79
79
|
>
|
|
80
|
-
{{ String(resourceKey)
|
|
80
|
+
{{ formatResourceLabel(String(resourceKey)) }}
|
|
81
81
|
</span>
|
|
82
82
|
</v-list-item-title>
|
|
83
83
|
<template #append>
|
|
@@ -231,6 +231,14 @@ const permState = shallowRef({
|
|
|
231
231
|
enabled: [] as string[],
|
|
232
232
|
})
|
|
233
233
|
|
|
234
|
+
const resourceLabels: Record<string, string> = {
|
|
235
|
+
"access-card-mgmt": "Access Mgmt",
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
function formatResourceLabel(key: string): string {
|
|
239
|
+
return resourceLabels[key] ?? key.replace(/-/g, " ");
|
|
240
|
+
}
|
|
241
|
+
|
|
234
242
|
function isCategoryEnabled(resource: string) {
|
|
235
243
|
return permState.value.enabled.includes(resource)
|
|
236
244
|
}
|