@7365admin1/layer-common 4.21.1 → 4.21.4-staging.339
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 +45 -4
- package/components/AnprCameraBadge.vue +142 -0
- package/components/CameraWall.vue +3 -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 +193 -43
- 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/PlateNumberDisplay.vue +91 -1
- package/components/VehicleForm.vue +246 -2
- package/components/VehicleManagement.vue +302 -51
- package/components/VisitorManagement.vue +357 -5
- package/composables/useAccessManagement.ts +5 -0
- package/composables/useDocument.ts +7 -0
- package/composables/useFacility.ts +11 -0
- package/composables/useHidAmico.ts +97 -0
- package/composables/useHidNavigation.ts +25 -1
- package/composables/usePeople.ts +19 -0
- package/composables/useVehicle.ts +83 -1
- 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 +5 -2
- package/types/vehicle.d.ts +57 -2
- package/utils/camera-wall.ts +15 -3
- package/utils/hid-permission-assignments.ts +190 -0
- package/utils/materialSymbols.ts +3 -0
- package/utils/vehicle-actions.ts +45 -17
|
@@ -20,11 +20,25 @@
|
|
|
20
20
|
show-header @row-click="handleRowClick"
|
|
21
21
|
@update:page="handleUpdatePage">
|
|
22
22
|
|
|
23
|
+
<!-- Residents / Season Passes / Block Listed, on the toolbar row the way
|
|
24
|
+
the other screens draw their tabs. Each tab shows every status. -->
|
|
25
|
+
<template #tabs>
|
|
26
|
+
<button v-for="tab in vehicleTabs" :key="tab.value" type="button" role="tab" class="app-tab"
|
|
27
|
+
:class="{ 'app-tab--active': activeTab === tab.value }" :aria-selected="activeTab === tab.value"
|
|
28
|
+
@click="activeTab = tab.value">
|
|
29
|
+
{{ tab.name }}
|
|
30
|
+
</button>
|
|
31
|
+
</template>
|
|
32
|
+
|
|
23
33
|
<!-- Search joins the toolbar row rather than stacking a second one. -->
|
|
24
34
|
<template #prepend-additional>
|
|
25
35
|
<AppField v-model="searchInput" search compact placeholder="Search" klass="app-toolbar__search" />
|
|
26
36
|
</template>
|
|
27
37
|
|
|
38
|
+
<template #item.category="{ value }">
|
|
39
|
+
{{ formatValues("category", value) }}
|
|
40
|
+
</template>
|
|
41
|
+
|
|
28
42
|
<template #item.block="{ value }">
|
|
29
43
|
{{ value ? `Blk ${value}` : "" }}
|
|
30
44
|
</template>
|
|
@@ -34,7 +48,8 @@
|
|
|
34
48
|
</template>
|
|
35
49
|
|
|
36
50
|
<template #item.plates="{ value, item }">
|
|
37
|
-
<PlateNumberDisplay :plate-numbers="value" :default-value="item.plateNumber"
|
|
51
|
+
<PlateNumberDisplay :plate-numbers="value" :default-value="item.plateNumber" show-cameras
|
|
52
|
+
:show-expiry="activeTab === 'season-passes'" />
|
|
38
53
|
</template>
|
|
39
54
|
|
|
40
55
|
<!--
|
|
@@ -137,12 +152,43 @@
|
|
|
137
152
|
the colour word keeps the width and lets the edge fall back to
|
|
138
153
|
`--v-border-color`, which is the design's `--border` in each theme. -->
|
|
139
154
|
<v-card flat outlined class="pa-2" border="sm" :loading="loadingPlateNumberDetails">
|
|
140
|
-
<v-data-table :items="selectedVehicleObject[key]" :headers="
|
|
155
|
+
<v-data-table :items="selectedVehicleObject[key]" :headers="plateHeadersView" hide-default-footer>
|
|
156
|
+
<!-- A season pass's dates, large enough to read at a
|
|
157
|
+
glance: green while valid, red once expired. -->
|
|
158
|
+
<template #item.passDates="{ item: pass }">
|
|
159
|
+
<div class="pass-dates">
|
|
160
|
+
<div class="pass-dates__line">
|
|
161
|
+
<span class="pass-date">{{ formatPassDate((pass as any).start) }}</span>
|
|
162
|
+
</div>
|
|
163
|
+
<div class="pass-dates__line">
|
|
164
|
+
<span v-if="(pass as any).end" class="pass-date pass-date--end"
|
|
165
|
+
:class="isPassExpired((pass as any).end) ? 'pass-date--expired' : 'pass-date--valid'">
|
|
166
|
+
<v-icon :icon="isPassExpired((pass as any).end) ? 'mdi-alert-circle' : 'mdi-calendar-check'" size="18" />
|
|
167
|
+
{{ formatPassDate((pass as any).end) }}
|
|
168
|
+
<span class="pass-date__tag">{{ isPassExpired((pass as any).end) ? "Expired" : "Valid" }}</span>
|
|
169
|
+
</span>
|
|
170
|
+
<span v-else class="pass-date">-</span>
|
|
171
|
+
</div>
|
|
172
|
+
</div>
|
|
173
|
+
</template>
|
|
141
174
|
<template #item.status="{ value }">
|
|
142
175
|
<v-chip :color="formatVehicleStatus(value).color" size="x-small" dark>
|
|
143
176
|
{{ formatVehicleStatus(value).label }}
|
|
144
177
|
</v-chip>
|
|
145
178
|
</template>
|
|
179
|
+
<template #item.plateNumber="{ value, item: plateNumberItem }">
|
|
180
|
+
<span class="d-inline-flex align-center ga-2">
|
|
181
|
+
{{ value }}
|
|
182
|
+
<AnprCameraBadge :cameras="(plateNumberItem as any).anprCameras ?? []" :plate-number="value" />
|
|
183
|
+
</span>
|
|
184
|
+
</template>
|
|
185
|
+
<template #item.type="{ value }">
|
|
186
|
+
{{ formatValues("type", value) }}
|
|
187
|
+
</template>
|
|
188
|
+
<template #item.history="{ item: plateNumberItem }">
|
|
189
|
+
<v-btn icon="mdi-history" flat size="x-small" aria-label="History"
|
|
190
|
+
v-tooltip:top="'History'" @click="openHistory(plateNumberItem as TPlateNumber)" />
|
|
191
|
+
</template>
|
|
146
192
|
<template #item.action="{ item: plateNumberItem }">
|
|
147
193
|
<v-menu v-if="vehiclePlateActions(plateNumberItem, vehiclePermissions).length">
|
|
148
194
|
<template #activator="{ props: menuProps }">
|
|
@@ -158,8 +204,9 @@
|
|
|
158
204
|
</v-menu>
|
|
159
205
|
</template>
|
|
160
206
|
</v-data-table>
|
|
161
|
-
|
|
162
|
-
|
|
207
|
+
<!-- More plates are added to a resident only. -->
|
|
208
|
+
<v-btn v-if="activeTab === 'residents'" text="Add Vehicle Number" class="mt-6 text-capitalize"
|
|
209
|
+
prepend-icon="mdi-plus" @click="addNewPlateNumbers" color="primary" />
|
|
163
210
|
</v-card>
|
|
164
211
|
</v-col>
|
|
165
212
|
|
|
@@ -205,10 +252,49 @@
|
|
|
205
252
|
:prompt-title="`Are you sure want to restore this vehicle - ${selectedPlateNumberObject?.plateNumber}?`"
|
|
206
253
|
@proceed="submitRestore" @close="closeActionDialog('restoreVehicle')" />
|
|
207
254
|
</v-dialog>
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
255
|
+
<!-- Block / Unblock say what happens on the cameras, because that is the
|
|
256
|
+
part the operator cannot see from here. -->
|
|
257
|
+
<v-dialog v-model="dialog.blockVehicle" persistent width="540">
|
|
258
|
+
<DialogReusablePrompt :loading="blockingVehicle" :message="actionError"
|
|
259
|
+
:prompt-title="`Block vehicle ${selectedPlateNumberObject?.plateNumber}? It is added to every ANPR camera's blocklist and taken off the allowed list. Its status becomes Blocked and its category Block Listed.`"
|
|
260
|
+
@proceed="submitBlock" @close="closeActionDialog('blockVehicle')" />
|
|
261
|
+
</v-dialog>
|
|
262
|
+
<v-dialog v-model="dialog.unblockVehicle" persistent width="540">
|
|
263
|
+
<DialogReusablePrompt :loading="unblockingVehicle" :message="actionError"
|
|
264
|
+
:prompt-title="`Unblock vehicle ${selectedPlateNumberObject?.plateNumber}? It is taken off every ANPR camera's blocklist. It is NOT whitelisted - the record stays with status Unblocked.`"
|
|
265
|
+
@proceed="submitUnblock" @close="closeActionDialog('unblockVehicle')" />
|
|
266
|
+
</v-dialog>
|
|
267
|
+
|
|
268
|
+
<!-- The last 20 changes to one plate, newest first. -->
|
|
269
|
+
<v-dialog v-model="dialog.history" width="720">
|
|
270
|
+
<v-card>
|
|
271
|
+
<v-card-title class="d-flex align-center">
|
|
272
|
+
<span>History - {{ historyPlate?.plateNumber }}</span>
|
|
273
|
+
<v-spacer />
|
|
274
|
+
<v-btn icon="mdi-close" flat size="small" aria-label="Close" @click="dialog.history = false" />
|
|
275
|
+
</v-card-title>
|
|
276
|
+
<v-card-text>
|
|
277
|
+
<v-alert v-if="historyError" type="error" variant="tonal" density="compact" class="mb-3">
|
|
278
|
+
{{ historyError }}
|
|
279
|
+
</v-alert>
|
|
280
|
+
<v-data-table :items="historyItems" :headers="historyHeaders" :loading="loadingHistory"
|
|
281
|
+
density="compact" hide-default-footer :items-per-page="-1"
|
|
282
|
+
no-data-text="No changes recorded yet.">
|
|
283
|
+
<template #item.updatedAt="{ value }">
|
|
284
|
+
{{ value ? formatDate(value) : "" }}
|
|
285
|
+
</template>
|
|
286
|
+
<template #item.action="{ value }">
|
|
287
|
+
{{ historyActionLabel(value) }}
|
|
288
|
+
</template>
|
|
289
|
+
<template #item.updatedByName="{ item: entry }">
|
|
290
|
+
{{ entry.updatedByName || (entry.updatedBy ? "Unknown user" : "System") }}
|
|
291
|
+
</template>
|
|
292
|
+
<template #item.fields="{ value }">
|
|
293
|
+
{{ formatHistoryFields(value) }}
|
|
294
|
+
</template>
|
|
295
|
+
</v-data-table>
|
|
296
|
+
</v-card-text>
|
|
297
|
+
</v-card>
|
|
212
298
|
</v-dialog>
|
|
213
299
|
<Snackbar v-model="messageSnackbar" :text="message" :color="messageColor" />
|
|
214
300
|
</v-row>
|
|
@@ -260,13 +346,66 @@ const plateHeaders = [
|
|
|
260
346
|
{ title: "Plate Number", value: "plateNumber" },
|
|
261
347
|
{ title: "Type", value: "type" },
|
|
262
348
|
{ title: "Status", value: "status" },
|
|
263
|
-
{ title: "", value: "
|
|
349
|
+
{ title: "", value: "history", sortable: false },
|
|
350
|
+
{ title: "", value: "action", sortable: false },
|
|
264
351
|
]
|
|
265
352
|
|
|
353
|
+
/** The Season Passes tab also shows each pass's start and expiry. */
|
|
354
|
+
const plateHeadersView = computed(() =>
|
|
355
|
+
activeTab.value === "season-passes"
|
|
356
|
+
? [
|
|
357
|
+
plateHeaders[0],
|
|
358
|
+
{ title: "Start / Expiry", value: "passDates", sortable: false },
|
|
359
|
+
...plateHeaders.slice(2),
|
|
360
|
+
]
|
|
361
|
+
: plateHeaders
|
|
362
|
+
)
|
|
363
|
+
|
|
364
|
+
/** Same as the form's date fields: 09/21/2036 07:35 PM. */
|
|
365
|
+
function formatPassDate(value: unknown): string {
|
|
366
|
+
if (!value) return "-"
|
|
367
|
+
const date = new Date(value as any)
|
|
368
|
+
if (Number.isNaN(date.getTime())) return "-"
|
|
369
|
+
const pad = (n: number) => String(n).padStart(2, "0")
|
|
370
|
+
const hours = date.getHours()
|
|
371
|
+
return (
|
|
372
|
+
`${pad(date.getMonth() + 1)}/${pad(date.getDate())}/${date.getFullYear()} ` +
|
|
373
|
+
`${pad(hours % 12 || 12)}:${pad(date.getMinutes())} ${hours < 12 ? "AM" : "PM"}`
|
|
374
|
+
)
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
function isPassExpired(value: unknown): boolean {
|
|
378
|
+
const date = new Date(value as any)
|
|
379
|
+
return !Number.isNaN(date.getTime()) && date.getTime() <= Date.now()
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
const historyHeaders = [
|
|
383
|
+
{ title: "Date", value: "updatedAt" },
|
|
384
|
+
{ title: "Updated By", value: "updatedByName" },
|
|
385
|
+
{ title: "Action", value: "action" },
|
|
386
|
+
{ title: "Fields Updated", value: "fields", sortable: false },
|
|
387
|
+
]
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* The three tabs. The server decides what each holds (`view`):
|
|
391
|
+
* - Residents: whitelist vehicles, category resident
|
|
392
|
+
* - Season Passes: category season_pass (and older passes saved as resident
|
|
393
|
+
* with a season pass type)
|
|
394
|
+
* - Block Listed: every blocklist vehicle - visitor, contractor, or a
|
|
395
|
+
* resident / season pass that was blocked
|
|
396
|
+
*/
|
|
397
|
+
type TVehicleTab = "residents" | "season-passes" | "block-listed";
|
|
398
|
+
const vehicleTabs: { name: string; value: TVehicleTab }[] = [
|
|
399
|
+
{ name: "Residents", value: "residents" },
|
|
400
|
+
{ name: "Season Passes", value: "season-passes" },
|
|
401
|
+
{ name: "Block Listed", value: "block-listed" },
|
|
402
|
+
]
|
|
403
|
+
const activeTab = ref<TVehicleTab>("residents");
|
|
404
|
+
|
|
266
405
|
|
|
267
406
|
|
|
268
407
|
const { formatCamelCaseToWords, formatDate, debounce, maskNRIC } = useUtils();
|
|
269
|
-
const { getVehicles, deleteVehicle, formatVehicleStatus, approveVehicle,
|
|
408
|
+
const { getVehicles, deleteVehicle, formatVehicleStatus, approveVehicle, blockVehicle, unblockVehicle, getSpecificVehicleById } = useVehicle();
|
|
270
409
|
|
|
271
410
|
const items = ref<Array<Record<string, any>>>([]);
|
|
272
411
|
const page = ref(1);
|
|
@@ -282,11 +421,16 @@ const loadingPlateNumberDetails = ref(false);
|
|
|
282
421
|
const deletingVehicle = ref(false);
|
|
283
422
|
const approvingVehicle = ref(false);
|
|
284
423
|
const restoringVehicle = ref(false);
|
|
285
|
-
const
|
|
424
|
+
const blockingVehicle = ref(false);
|
|
425
|
+
const unblockingVehicle = ref(false);
|
|
426
|
+
const loadingHistory = ref(false);
|
|
427
|
+
const historyError = ref("");
|
|
428
|
+
const historyPlate = ref<TPlateNumber | null>(null);
|
|
429
|
+
const historyItems = ref<TVehicleHistoryEntry[]>([]);
|
|
286
430
|
|
|
287
431
|
const selectedVehicleId = ref<string | null>(null)
|
|
288
432
|
const vehicleType = ref<TVehicleType | 'seasonpass' | null>(null);
|
|
289
|
-
|
|
433
|
+
|
|
290
434
|
|
|
291
435
|
const selectedPlateNumberObject = ref<TPlateNumber | null>(null);
|
|
292
436
|
const selectedPlateNumberId = ref<string | null>(null); // individual plate number
|
|
@@ -302,7 +446,7 @@ const deleteError = ref("");
|
|
|
302
446
|
// and whose refusals were being thrown at a snackbar that times out.
|
|
303
447
|
const actionError = ref("");
|
|
304
448
|
|
|
305
|
-
function closeActionDialog(key: "approveVehicle" | "restoreVehicle" | "
|
|
449
|
+
function closeActionDialog(key: "approveVehicle" | "restoreVehicle" | "blockVehicle" | "unblockVehicle") {
|
|
306
450
|
dialog[key] = false;
|
|
307
451
|
actionError.value = "";
|
|
308
452
|
}
|
|
@@ -321,15 +465,24 @@ const dialog = reactive({
|
|
|
321
465
|
showMoreActions: false,
|
|
322
466
|
approveVehicle: false,
|
|
323
467
|
restoreVehicle: false,
|
|
324
|
-
|
|
468
|
+
blockVehicle: false,
|
|
469
|
+
unblockVehicle: false,
|
|
470
|
+
history: false,
|
|
325
471
|
bulkVehicle: false
|
|
326
472
|
});
|
|
327
473
|
|
|
328
474
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
475
|
+
|
|
476
|
+
const VEHICLE_CATEGORY_LABELS: Record<string, string> = {
|
|
477
|
+
resident: "Resident",
|
|
478
|
+
season_pass: "Season Pass",
|
|
479
|
+
visitor: "Visitor",
|
|
480
|
+
contractor: "Contractor",
|
|
481
|
+
delivery: "Delivery",
|
|
482
|
+
"pick-up": "Pick-up",
|
|
483
|
+
"drop-off": "Drop-off",
|
|
484
|
+
"Block Listed": "Block Listed",
|
|
485
|
+
}
|
|
333
486
|
|
|
334
487
|
const formattedFields: Partial<Record<keyof TVehicle, string>> = {
|
|
335
488
|
name: "Name",
|
|
@@ -359,8 +512,9 @@ function formatValues(key: string, value: any) {
|
|
|
359
512
|
return formatDate(value)
|
|
360
513
|
case "end":
|
|
361
514
|
return formatDate(value)
|
|
362
|
-
case "type":
|
|
363
515
|
case "category":
|
|
516
|
+
return VEHICLE_CATEGORY_LABELS[String(value)] ?? String(value);
|
|
517
|
+
case "type":
|
|
364
518
|
return String(value).charAt(0).toUpperCase() + String(value).slice(1).toLowerCase();
|
|
365
519
|
}
|
|
366
520
|
|
|
@@ -376,7 +530,6 @@ const handleCloseAll = () => {
|
|
|
376
530
|
dialog.createVehicle = false;
|
|
377
531
|
dialog.updateVehicle = false;
|
|
378
532
|
dialog.showSelection = false;
|
|
379
|
-
dialog.updateVehicleType = false;
|
|
380
533
|
mode.value = "add";
|
|
381
534
|
vehicleType.value = null;
|
|
382
535
|
}
|
|
@@ -420,7 +573,7 @@ const { data: getVehiclesReq, refresh: getVehiclesRefresh, pending: getVehiclesP
|
|
|
420
573
|
getVehicles({
|
|
421
574
|
page: page.value,
|
|
422
575
|
search: searchInput.value,
|
|
423
|
-
|
|
576
|
+
view: activeTab.value,
|
|
424
577
|
site: props.site,
|
|
425
578
|
}),
|
|
426
579
|
{
|
|
@@ -494,10 +647,57 @@ function handleRestoreVehicle(item: TPlateNumber) {
|
|
|
494
647
|
dialog.restoreVehicle = true;
|
|
495
648
|
}
|
|
496
649
|
|
|
497
|
-
function
|
|
650
|
+
function handleBlockVehicle(item: TPlateNumber) {
|
|
498
651
|
selectedPlateNumberObject.value = item || null;
|
|
499
652
|
actionError.value = "";
|
|
500
|
-
dialog.
|
|
653
|
+
dialog.blockVehicle = true;
|
|
654
|
+
}
|
|
655
|
+
|
|
656
|
+
function handleUnblockVehicle(item: TPlateNumber) {
|
|
657
|
+
selectedPlateNumberObject.value = item || null;
|
|
658
|
+
actionError.value = "";
|
|
659
|
+
dialog.unblockVehicle = true;
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
const HISTORY_ACTIONS: Record<string, string> = {
|
|
663
|
+
created: "Created",
|
|
664
|
+
updated: "Updated",
|
|
665
|
+
approved: "Approved",
|
|
666
|
+
restored: "Restored",
|
|
667
|
+
blocked: "Blocked",
|
|
668
|
+
unblocked: "Unblocked",
|
|
669
|
+
deleted: "Deleted",
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
function historyActionLabel(action: string) {
|
|
673
|
+
if (!action) return "";
|
|
674
|
+
return HISTORY_ACTIONS[action] ?? action.charAt(0).toUpperCase() + action.slice(1);
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
function formatHistoryFields(fields: string[] | undefined) {
|
|
678
|
+
if (!Array.isArray(fields) || !fields.length) return "-";
|
|
679
|
+
return fields.map((f) => formatCamelCaseToWords(f)).join(", ");
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
/** Fetches the plate's own record: the list does not carry `history`. */
|
|
683
|
+
async function openHistory(item: TPlateNumber) {
|
|
684
|
+
historyPlate.value = item || null;
|
|
685
|
+
historyItems.value = [];
|
|
686
|
+
historyError.value = "";
|
|
687
|
+
dialog.history = true;
|
|
688
|
+
if (!item?._id) return;
|
|
689
|
+
|
|
690
|
+
try {
|
|
691
|
+
loadingHistory.value = true;
|
|
692
|
+
const res: any = await getSpecificVehicleById(item._id);
|
|
693
|
+
const entries: TVehicleHistoryEntry[] = Array.isArray(res?.history) ? res.history : [];
|
|
694
|
+
// Stored oldest first; read newest first.
|
|
695
|
+
historyItems.value = [...entries].reverse();
|
|
696
|
+
} catch (error: any) {
|
|
697
|
+
historyError.value = errorConverter(error);
|
|
698
|
+
} finally {
|
|
699
|
+
loadingHistory.value = false;
|
|
700
|
+
}
|
|
501
701
|
}
|
|
502
702
|
|
|
503
703
|
/**
|
|
@@ -522,8 +722,10 @@ function runVehicleAction(key: VehicleActionKey, plate: TPlateNumber) {
|
|
|
522
722
|
return handleApproveVehicle(plate);
|
|
523
723
|
case "restore":
|
|
524
724
|
return handleRestoreVehicle(plate);
|
|
525
|
-
case "
|
|
526
|
-
return
|
|
725
|
+
case "block":
|
|
726
|
+
return handleBlockVehicle(plate);
|
|
727
|
+
case "unblock":
|
|
728
|
+
return handleUnblockVehicle(plate);
|
|
527
729
|
case "delete":
|
|
528
730
|
return handleDeleteVehicleAction(plate);
|
|
529
731
|
}
|
|
@@ -648,49 +850,46 @@ async function submitRestore() {
|
|
|
648
850
|
}
|
|
649
851
|
|
|
650
852
|
|
|
651
|
-
async function
|
|
652
|
-
|
|
653
|
-
|
|
853
|
+
async function submitBlock() {
|
|
654
854
|
const vehicleId = selectedPlateNumberObject.value?._id;
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
if (!type) {
|
|
660
|
-
showMessage("Invalid vehicle type.", "error");
|
|
855
|
+
if (!vehicleId) {
|
|
856
|
+
showMessage("Invalid vehicle selected for blocking.", "error");
|
|
661
857
|
return;
|
|
662
858
|
}
|
|
663
859
|
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
860
|
+
try {
|
|
861
|
+
blockingVehicle.value = true;
|
|
862
|
+
actionError.value = "";
|
|
863
|
+
const res = await blockVehicle({ site: props.site, id: vehicleId as string });
|
|
864
|
+
closeActionDialog("blockVehicle");
|
|
865
|
+
showMessage(res.message, "success");
|
|
866
|
+
await getVehiclesRefresh();
|
|
867
|
+
} catch (error: any) {
|
|
868
|
+
actionError.value = errorConverter(error);
|
|
869
|
+
} finally {
|
|
870
|
+
blockingVehicle.value = false;
|
|
675
871
|
}
|
|
872
|
+
}
|
|
676
873
|
|
|
677
874
|
|
|
875
|
+
async function submitUnblock() {
|
|
876
|
+
const vehicleId = selectedPlateNumberObject.value?._id;
|
|
678
877
|
if (!vehicleId) {
|
|
679
|
-
showMessage("Invalid vehicle
|
|
878
|
+
showMessage("Invalid vehicle selected for unblocking.", "error");
|
|
680
879
|
return;
|
|
681
880
|
}
|
|
682
881
|
|
|
683
882
|
try {
|
|
684
|
-
|
|
883
|
+
unblockingVehicle.value = true;
|
|
685
884
|
actionError.value = "";
|
|
686
|
-
const res = await
|
|
687
|
-
closeActionDialog("
|
|
885
|
+
const res = await unblockVehicle({ site: props.site, id: vehicleId as string });
|
|
886
|
+
closeActionDialog("unblockVehicle");
|
|
688
887
|
showMessage(res.message, "success");
|
|
689
888
|
await getVehiclesRefresh();
|
|
690
889
|
} catch (error: any) {
|
|
691
890
|
actionError.value = errorConverter(error);
|
|
692
891
|
} finally {
|
|
693
|
-
|
|
892
|
+
unblockingVehicle.value = false;
|
|
694
893
|
}
|
|
695
894
|
}
|
|
696
895
|
|
|
@@ -720,10 +919,62 @@ async function submitApprove() {
|
|
|
720
919
|
}
|
|
721
920
|
|
|
722
921
|
const debouncedSearch = debounce(getVehiclesRefresh, 500);
|
|
723
|
-
watch(
|
|
922
|
+
watch(searchInput, () => {
|
|
724
923
|
page.value = 1;
|
|
725
924
|
debouncedSearch()
|
|
726
925
|
})
|
|
727
926
|
|
|
927
|
+
// A new tab starts from its first page and loads straight away.
|
|
928
|
+
watch(activeTab, () => {
|
|
929
|
+
page.value = 1;
|
|
930
|
+
getVehiclesRefresh();
|
|
931
|
+
})
|
|
932
|
+
|
|
728
933
|
|
|
729
934
|
</script>
|
|
935
|
+
|
|
936
|
+
<style scoped>
|
|
937
|
+
.pass-dates {
|
|
938
|
+
display: flex;
|
|
939
|
+
flex-direction: column;
|
|
940
|
+
gap: 6px;
|
|
941
|
+
padding: 8px 0;
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
.pass-dates__line {
|
|
945
|
+
display: flex;
|
|
946
|
+
align-items: center;
|
|
947
|
+
gap: 10px;
|
|
948
|
+
}
|
|
949
|
+
|
|
950
|
+
.pass-date {
|
|
951
|
+
font-size: 16px;
|
|
952
|
+
font-weight: 600;
|
|
953
|
+
white-space: nowrap;
|
|
954
|
+
}
|
|
955
|
+
|
|
956
|
+
.pass-date--end {
|
|
957
|
+
display: inline-flex;
|
|
958
|
+
align-items: center;
|
|
959
|
+
gap: 6px;
|
|
960
|
+
padding: 4px 10px;
|
|
961
|
+
border-radius: 999px;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
.pass-date--valid {
|
|
965
|
+
color: rgb(var(--v-theme-success));
|
|
966
|
+
background: rgba(var(--v-theme-success), 0.12);
|
|
967
|
+
}
|
|
968
|
+
|
|
969
|
+
.pass-date--expired {
|
|
970
|
+
color: rgb(var(--v-theme-error));
|
|
971
|
+
background: rgba(var(--v-theme-error), 0.12);
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
.pass-date__tag {
|
|
975
|
+
font-size: 12px;
|
|
976
|
+
font-weight: 700;
|
|
977
|
+
text-transform: uppercase;
|
|
978
|
+
letter-spacing: 0.04em;
|
|
979
|
+
}
|
|
980
|
+
</style>
|