@7365admin1/layer-common 3.1.4-staging.53 → 3.2.0

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.
@@ -12,8 +12,7 @@
12
12
  <v-col cols="12" md="4" class="d-flex justify-md-end">
13
13
  <v-switch
14
14
  v-model="hidEnabled"
15
- class="hid-service-switch"
16
- color="success"
15
+ color="primary"
17
16
  hide-details
18
17
  inset
19
18
  :loading="isSaving"
@@ -149,21 +148,3 @@ function goToHidReaders() {
149
148
  });
150
149
  }
151
150
  </script>
152
-
153
- <style scoped>
154
- .hid-service-switch :deep(.v-switch__track) {
155
- background-color: #8b9297;
156
- opacity: 1;
157
- }
158
-
159
- .hid-service-switch :deep(.v-selection-control--dirty .v-switch__track) {
160
- background-color: #2eaf55 !important;
161
- color: #2eaf55 !important;
162
- opacity: 1;
163
- }
164
-
165
- .hid-service-switch :deep(.v-switch__thumb) {
166
- background-color: #fff !important;
167
- color: #fff !important;
168
- }
169
- </style>
@@ -381,7 +381,6 @@ async function loadUsers() {
381
381
  const identities = identityResponse?.items ?? identityResponse?.data?.items ?? identityResponse?.data?.identities ?? [];
382
382
  const adminRoleIds = getAdministratorRoleUserIds(roleResponse);
383
383
  const readerUsers = normalizeHidUsers(readerResponse).filter((user) => {
384
- if (Number(user.userTypeId) === 1) return false;
385
384
  if (!isAdministratorIdentity()) return true;
386
385
  const hidUserId = toHidNumericId(user.hidUserId);
387
386
  return Boolean(hidUserId && adminRoleIds.has(hidUserId));
@@ -883,7 +882,6 @@ function normalizeHidUsers(response: Record<string, any>) {
883
882
  hidUserId: String(user.id || ""),
884
883
  rawHidUserId: user.id,
885
884
  registration: user.registration,
886
- userTypeId: user.user_type_id,
887
885
  cardNo: user.card_value || user.cardNo || "",
888
886
  name: user.name,
889
887
  metadata: {
@@ -4,7 +4,6 @@
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"
8
7
  rounded="pill"
9
8
  variant="outlined"
10
9
 
@@ -83,12 +82,7 @@
83
82
  </v-col>
84
83
 
85
84
  <!-- Add Dialog -->
86
- <v-dialog
87
- v-if="props.canCreateNfcPatrol"
88
- v-model="dialogAdd"
89
- persistent
90
- max-width="900"
91
- >
85
+ <v-dialog v-model="dialogAdd" persistent max-width="900">
92
86
  <NFCPatrolRouteForm
93
87
  title="Add Route"
94
88
  :site="props.site"
@@ -100,12 +94,7 @@
100
94
  </v-dialog>
101
95
 
102
96
  <!-- Edit Dialog -->
103
- <v-dialog
104
- v-if="props.canUpdateNfcPatrol"
105
- v-model="dialogEdit"
106
- persistent
107
- max-width="900"
108
- >
97
+ <v-dialog v-model="dialogEdit" persistent max-width="900">
109
98
  <NFCPatrolRouteForm
110
99
  title="Edit Route"
111
100
  :site="props.site"
@@ -201,10 +190,7 @@
201
190
 
202
191
  <v-toolbar class="pa-0" density="compact">
203
192
  <v-row no-gutters>
204
- <v-col
205
- :cols="props.canUpdateNfcPatrol || props.canDeleteNfcPatrol ? 6 : 12"
206
- class="pa-0"
207
- >
193
+ <v-col cols="6" class="pa-0">
208
194
  <v-btn
209
195
  block
210
196
  variant="text"
@@ -217,11 +203,7 @@
217
203
  </v-btn>
218
204
  </v-col>
219
205
 
220
- <v-col
221
- v-if="props.canUpdateNfcPatrol || props.canDeleteNfcPatrol"
222
- cols="6"
223
- class="pa-0"
224
- >
206
+ <v-col cols="6" class="pa-0">
225
207
  <v-menu>
226
208
  <template #activator="{ props }">
227
209
  <v-btn
@@ -238,17 +220,13 @@
238
220
  </template>
239
221
 
240
222
  <v-list class="pa-0">
241
- <v-list-item v-if="props.canUpdateNfcPatrol" @click="openDialogEdit()">
223
+ <v-list-item @click="openDialogEdit()">
242
224
  <v-list-item-title class="text-subtitle-2">
243
225
  Edit Route
244
226
  </v-list-item-title>
245
227
  </v-list-item>
246
228
 
247
- <v-list-item
248
- v-if="props.canDeleteNfcPatrol"
249
- @click="openDialogDelete()"
250
- class="text-red"
251
- >
229
+ <v-list-item @click="openDialogDelete()" class="text-red">
252
230
  <v-list-item-title class="text-subtitle-2">
253
231
  Delete Route
254
232
  </v-list-item-title>
@@ -262,12 +240,7 @@
262
240
  </v-dialog>
263
241
 
264
242
  <!-- Delete Dialog -->
265
- <v-dialog
266
- v-if="props.canDeleteNfcPatrol"
267
- v-model="dialogDelete"
268
- persistent
269
- width="540"
270
- >
243
+ <v-dialog v-model="dialogDelete" persistent width="540">
271
244
  <v-card width="100%">
272
245
  <v-card-text
273
246
  style="max-height: 100vh; overflow-y: auto"
@@ -331,18 +304,6 @@ const props = defineProps({
331
304
  type: String,
332
305
  required: true,
333
306
  },
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
- },
346
307
  headers: {
347
308
  type: Array as PropType<Array<any>>,
348
309
  default: () => [
@@ -445,8 +406,6 @@ const messageSnackbar = ref(false);
445
406
  const messageColor = ref("");
446
407
 
447
408
  async function openDialogEdit() {
448
- if (!props.canUpdateNfcPatrol) return;
449
-
450
409
  try {
451
410
  // Fetch the full route details from the API
452
411
  const response = await getRouteById(selectedRoute.value._id);
@@ -472,8 +431,6 @@ async function openDialogEdit() {
472
431
  }
473
432
 
474
433
  function openDialogDelete() {
475
- if (!props.canDeleteNfcPatrol) return;
476
-
477
434
  dialogDelete.value = true;
478
435
 
479
436
  if (dialogPreview.value) dialogPreview.value = false;
@@ -545,8 +502,6 @@ function handleRowClick(_: any, data: any) {
545
502
  }
546
503
 
547
504
  async function submitDelete() {
548
- if (!props.canDeleteNfcPatrol) return;
549
-
550
505
  try {
551
506
  await deleteRouteById(selectedRoute.value._id ?? "");
552
507
  await getRoutesRefresh();
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <v-menu location="bottom end">
3
+ <template #activator="{ props }">
4
+ <v-btn
5
+ v-bind="props"
6
+ icon="mdi-dots-vertical"
7
+ variant="text"
8
+ density="comfortable"
9
+ />
10
+ </template>
11
+
12
+ <v-list density="compact">
13
+ <v-list-item
14
+ prepend-icon="mdi-pencil-outline"
15
+ title="Edit plan"
16
+ @click="$emit('edit')"
17
+ />
18
+
19
+ <v-list-item
20
+ prepend-icon="mdi-close-circle-outline"
21
+ title="Deactivate"
22
+ @click="$emit('deactivate')"
23
+ />
24
+ </v-list>
25
+ </v-menu>
26
+ </template>
27
+
28
+ <script setup lang="ts">
29
+ defineEmits<{
30
+ edit: []
31
+ deactivate: []
32
+ }>()
33
+ </script>
@@ -0,0 +1,26 @@
1
+ <template>
2
+ <v-chip
3
+ :color="isActive ? 'success' : 'grey'"
4
+ size="small"
5
+ variant="tonal"
6
+ class="font-weight-medium"
7
+ >
8
+ {{ isActive ? 'Active' : 'Deactive' }}
9
+ </v-chip>
10
+ </template>
11
+
12
+ <script setup lang="ts">
13
+ import { computed } from 'vue'
14
+
15
+ const props = defineProps<{
16
+ status: string | boolean
17
+ }>()
18
+
19
+ const isActive = computed(() => {
20
+ if (typeof props.status === 'boolean') {
21
+ return props.status
22
+ }
23
+
24
+ return props.status.toLowerCase() === 'active'
25
+ })
26
+ </script>
@@ -33,7 +33,7 @@
33
33
 
34
34
  <qrcode-vue
35
35
  v-if="templateQrCode.CCFrontQREnabled"
36
- :value="getPassNumberValue(card.number)"
36
+ :value="`${prefix}0${+printRangeStart + +card.number - 1}`"
37
37
  :size="templateQrCode.CCFrontQRCodeSize"
38
38
  level="H"
39
39
  :style="{
@@ -53,7 +53,9 @@
53
53
  }"
54
54
  class="position-absolute text-center"
55
55
  >
56
- Pass Number: {{ getPassNumberValue(card.number) }}
56
+ Pass Number: {{ prefix }}0{{
57
+ +printRangeStart + +card.number - 1
58
+ }}
57
59
  </div>
58
60
  </v-card>
59
61
 
@@ -72,7 +74,7 @@
72
74
 
73
75
  <qrcode-vue
74
76
  v-if="templateQrCode.CCBackQREnabled"
75
- :value="getPassNumberValue(card.number)"
77
+ :value="`${prefix}0${+printRangeStart + +card.number - 1}`"
76
78
  :size="templateQrCode.CCBackQRCodeSize"
77
79
  level="H"
78
80
  :style="{
@@ -91,7 +93,9 @@
91
93
  }"
92
94
  class="position-absolute text-center"
93
95
  >
94
- Pass Number: {{ getPassNumberValue(card.number) }}
96
+ Pass Number: {{ prefix }}0{{
97
+ +printRangeStart + +card.number - 1
98
+ }}
95
99
  </div>
96
100
  </v-card>
97
101
  </v-col>
@@ -109,22 +113,11 @@ const props = defineProps({
109
113
  paginatedCardData: Array,
110
114
  templateQrCode: Object,
111
115
  prefix: String,
112
- printRangeStart: [String, Number],
116
+ printRangeStart: Number,
117
+ });
118
+ onMounted(() => {
119
+ console.log("templateQrCode 11", props.templateQrCode.CCOrientation);
113
120
  });
114
-
115
- const getPassNumberValue = (position) => {
116
- const rawStartValue = `${props.printRangeStart ?? ""}`.trim();
117
- const startMatch = rawStartValue.match(/(\d+)$/);
118
- const startValue = startMatch?.[1] ?? "0";
119
- const startNumber = Number(startValue);
120
- const sequenceNumber = startNumber + Number(position) - 1;
121
- const cleanPrefix = `${props.prefix ?? ""}`.replace(/\d+$/, "");
122
- const width = startValue.length;
123
- const formattedSequence =
124
- width > 0 ? `${sequenceNumber}`.padStart(width, "0") : `${sequenceNumber}`;
125
-
126
- return `${cleanPrefix}${formattedSequence}`;
127
- };
128
121
  </script>
129
122
 
130
123
  <style scoped>