@7365admin1/layer-common 3.0.8 → 3.0.10
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 +12 -0
- package/components/DashboardMain.vue +1864 -803
- package/components/EntryPassInformation.vue +60 -0
- package/components/HidAccessLogDashboard.vue +1691 -0
- package/components/HidEnabledGate.vue +51 -0
- package/components/HidIdentityMapping.vue +975 -0
- package/components/HidQrCodeConfiguration.vue +618 -0
- package/components/HidReaderForm.vue +246 -0
- package/components/HidReaderManagement.vue +1233 -0
- package/components/HidServiceSettingsPanel.vue +150 -0
- package/components/HidUserEnrollment.vue +1274 -0
- package/components/Layout/NavigationDrawer.vue +31 -1
- package/components/MemberInformation.vue +1 -1
- package/components/NavigationItem.vue +11 -4
- package/components/SiteSettings.vue +24 -1
- package/components/VisitorForm.vue +195 -4
- package/components/VisitorFormSelection.vue +12 -2
- package/composables/useDashboard.ts +31 -4
- package/composables/useHidAmico.ts +152 -0
- package/composables/useHidNavigation.ts +106 -0
- package/composables/useMember.ts +8 -3
- package/composables/useOptionalServices.ts +118 -0
- package/composables/useSiteSettings.ts +1 -1
- package/composables/useUser.ts +1 -2
- package/nuxt.config.ts +1 -1
- package/package.json +2 -1
- package/pages/[org]/[site]/access-mgmt/access-logs/index.vue +21 -0
- package/pages/[org]/[site]/access-mgmt/administrator/index.vue +21 -0
- package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +21 -0
- package/pages/[org]/[site]/access-mgmt/hid-users/index.vue +21 -0
- package/pages/[org]/[site]/access-mgmt/identity-mapping/index.vue +21 -0
- package/types/local.d.ts +2 -1
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<v-row align="center" class="py-2">
|
|
3
|
+
<v-col cols="12" md="8">
|
|
4
|
+
<div class="text-subtitle-1 font-weight-bold">
|
|
5
|
+
Enable HID biometric reader for this site
|
|
6
|
+
</div>
|
|
7
|
+
<div class="text-body-2 text-medium-emphasis mt-1">
|
|
8
|
+
When enabled, admins can register HID Amico devices and manage reader sync from Access Management.
|
|
9
|
+
</div>
|
|
10
|
+
</v-col>
|
|
11
|
+
|
|
12
|
+
<v-col cols="12" md="4" class="d-flex justify-md-end">
|
|
13
|
+
<v-switch
|
|
14
|
+
v-model="hidEnabled"
|
|
15
|
+
color="primary"
|
|
16
|
+
hide-details
|
|
17
|
+
inset
|
|
18
|
+
:loading="isSaving"
|
|
19
|
+
@update:model-value="saveHidService"
|
|
20
|
+
>
|
|
21
|
+
<template #label>
|
|
22
|
+
<span class="text-body-2">
|
|
23
|
+
{{ hidEnabled ? "Enabled" : "Disabled" }}
|
|
24
|
+
</span>
|
|
25
|
+
</template>
|
|
26
|
+
</v-switch>
|
|
27
|
+
</v-col>
|
|
28
|
+
|
|
29
|
+
<v-col cols="12" class="d-flex justify-end ga-2">
|
|
30
|
+
<v-btn
|
|
31
|
+
class="text-none"
|
|
32
|
+
color="primary"
|
|
33
|
+
variant="flat"
|
|
34
|
+
prepend-icon="mdi-card-account-details-star"
|
|
35
|
+
:disabled="!hidEnabled"
|
|
36
|
+
@click="goToHidReaders"
|
|
37
|
+
>
|
|
38
|
+
Manage HID Readers
|
|
39
|
+
</v-btn>
|
|
40
|
+
</v-col>
|
|
41
|
+
|
|
42
|
+
<Snackbar v-model="messageSnackbar" :text="message" :color="messageColor" />
|
|
43
|
+
</v-row>
|
|
44
|
+
</template>
|
|
45
|
+
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
const props = defineProps<{
|
|
48
|
+
site: string;
|
|
49
|
+
org: string;
|
|
50
|
+
siteData?: Record<string, any> | null;
|
|
51
|
+
}>();
|
|
52
|
+
|
|
53
|
+
const emit = defineEmits<{
|
|
54
|
+
refresh: [];
|
|
55
|
+
}>();
|
|
56
|
+
|
|
57
|
+
const { updateSitebyId } = useSiteSettings();
|
|
58
|
+
const { getHidServiceEnabled, setHidServiceOverride, hidServiceKeys } = useOptionalServices();
|
|
59
|
+
|
|
60
|
+
const hidEnabled = ref(false);
|
|
61
|
+
const isSaving = ref(false);
|
|
62
|
+
const message = ref("");
|
|
63
|
+
const messageColor = ref("");
|
|
64
|
+
const messageSnackbar = ref(false);
|
|
65
|
+
|
|
66
|
+
watch(
|
|
67
|
+
() => props.siteData,
|
|
68
|
+
(siteData) => {
|
|
69
|
+
hidEnabled.value = getHidServiceEnabled(props.site, siteData);
|
|
70
|
+
},
|
|
71
|
+
{ immediate: true },
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
function showMessage(text: string, color: string) {
|
|
75
|
+
message.value = text;
|
|
76
|
+
messageColor.value = color;
|
|
77
|
+
messageSnackbar.value = true;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function normalizeServiceKey(value: unknown) {
|
|
81
|
+
return String(value ?? "")
|
|
82
|
+
.trim()
|
|
83
|
+
.toLowerCase()
|
|
84
|
+
.replace(/[\s-]+/g, "_");
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function buildHidServices(enabled: boolean) {
|
|
88
|
+
const currentServices = Array.isArray(props.siteData?.metadata?.services)
|
|
89
|
+
? [...props.siteData.metadata.services]
|
|
90
|
+
: [];
|
|
91
|
+
|
|
92
|
+
const service = {
|
|
93
|
+
key: "hid_amico",
|
|
94
|
+
name: "HID Face Reader",
|
|
95
|
+
enabled,
|
|
96
|
+
status: enabled ? "active" : "inactive",
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
const index = currentServices.findIndex((item: any) =>
|
|
100
|
+
hidServiceKeys.includes(normalizeServiceKey(item?.key ?? item?.code ?? item?.name)),
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
if (index >= 0) {
|
|
104
|
+
currentServices[index] = {
|
|
105
|
+
...currentServices[index],
|
|
106
|
+
...service,
|
|
107
|
+
};
|
|
108
|
+
} else {
|
|
109
|
+
currentServices.push(service);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return currentServices;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async function saveHidService(value: boolean) {
|
|
116
|
+
const previousValue = !value;
|
|
117
|
+
isSaving.value = true;
|
|
118
|
+
|
|
119
|
+
try {
|
|
120
|
+
const currentMetadata = {
|
|
121
|
+
...(props.siteData?.metadata ?? {}),
|
|
122
|
+
services: buildHidServices(value),
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
await updateSitebyId(props.site, {
|
|
126
|
+
metadata: currentMetadata,
|
|
127
|
+
});
|
|
128
|
+
setHidServiceOverride(props.site, value);
|
|
129
|
+
hidEnabled.value = value;
|
|
130
|
+
emit("refresh");
|
|
131
|
+
await refreshNuxtData(`layout-selected-site-details-${useRuntimeConfig().public.APP}`);
|
|
132
|
+
showMessage(`HID Face Reader ${value ? "enabled" : "disabled"} successfully`, "success");
|
|
133
|
+
} catch (error: any) {
|
|
134
|
+
hidEnabled.value = previousValue;
|
|
135
|
+
showMessage(errorConverter(error), "error");
|
|
136
|
+
} finally {
|
|
137
|
+
isSaving.value = false;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
function goToHidReaders() {
|
|
142
|
+
navigateTo({
|
|
143
|
+
name: "org-site-access-mgmt-hid-readers",
|
|
144
|
+
params: {
|
|
145
|
+
org: props.org,
|
|
146
|
+
site: props.site,
|
|
147
|
+
},
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
</script>
|