@7365admin1/layer-common 4.147.2 → 4.148.1
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 +35 -4
- package/components/AnprCameraBadge.vue +15 -2
- package/components/AreaChecklistHistoryLogs.vue +2 -2
- package/components/CameraForm.vue +73 -17
- package/components/CameraMain.vue +12 -3
- package/components/CleaningScheduleMain.vue +9 -4
- package/components/ManageChecklistMain.vue +22 -8
- package/components/ScheduleAreaMain.vue +20 -6
- package/components/ScheduleGuide.vue +7 -1
- package/components/ScheduleTaskMain.vue +4 -2
- package/components/Snackbar.vue +36 -0
- package/components/TableHygiene.vue +2 -2
- package/components/TableMain.vue +12 -1
- package/components/TaskCalendarMain.vue +200 -0
- package/components/TaskCalendarReadOnly.vue +22 -3
- package/components/VehicleAddSelection.vue +11 -4
- package/components/VehicleManagement.vue +83 -30
- package/components/VisitorDataFromScannedQRCodeForm.vue +6 -1
- package/components/VisitorForm.vue +43 -4
- package/components/VisitorManagement.vue +145 -8
- package/composables/useCleaningSchedules.ts +5 -9
- package/composables/useVisitorCameraChoices.ts +61 -0
- package/package.json +1 -1
- package/types/camera.d.ts +2 -0
- package/utils/anpr-direction.ts +7 -6
- package/utils/breadcrumb.ts +3 -2
- package/utils/schedule-task.ts +45 -0
- package/utils/task-calendar-tabs.ts +56 -0
- package/utils/vehicle-actions.ts +23 -5
- package/utils/visitor-barrier.ts +42 -0
- package/utils/visitor-camera.ts +80 -0
package/components/TableMain.vue
CHANGED
|
@@ -131,7 +131,9 @@
|
|
|
131
131
|
/>
|
|
132
132
|
|
|
133
133
|
<!-- Toolbar -->
|
|
134
|
-
<CardToolbar
|
|
134
|
+
<CardToolbar
|
|
135
|
+
:count="$slots['pagination-prepend'] ? '' : pageRange"
|
|
136
|
+
>
|
|
135
137
|
<!--
|
|
136
138
|
The design draws a screen's tabs ON the toolbar row, not on a
|
|
137
139
|
stacked strip above the table. `CardToolbar` has always had the
|
|
@@ -174,6 +176,15 @@
|
|
|
174
176
|
</template>
|
|
175
177
|
|
|
176
178
|
<template #right>
|
|
179
|
+
<!--
|
|
180
|
+
Before the range and pager, e.g. the visitor list's default-camera
|
|
181
|
+
button. With it filled, the range is drawn here (not by CardToolbar)
|
|
182
|
+
so the button can sit in front of it.
|
|
183
|
+
-->
|
|
184
|
+
<template v-if="$slots['pagination-prepend']">
|
|
185
|
+
<slot name="pagination-prepend" />
|
|
186
|
+
<span v-if="pageRange" class="app-toolbar__count">{{ pageRange }}</span>
|
|
187
|
+
</template>
|
|
177
188
|
<local-pagination
|
|
178
189
|
v-model="internalPage"
|
|
179
190
|
:length="pages"
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
TASK CALENDAR for the five trade apps (owner 24 Oct 2026): one page for every
|
|
3
|
+
scheduled job at the site, in two tabs.
|
|
4
|
+
|
|
5
|
+
"From managing agent" - tasks the managing agent gave this company
|
|
6
|
+
(TaskCalendarReadOnly, view only).
|
|
7
|
+
"My extra checks" - the company's own extra checks
|
|
8
|
+
(ScheduleTaskMain, add / edit / pause / delete).
|
|
9
|
+
|
|
10
|
+
Each tab shows only when the viewer's role already allows it (the same keys
|
|
11
|
+
the two separate menu items used), so nobody gains or loses access. The tab
|
|
12
|
+
is kept in the address (?tab=agent | extra) so a link opens the right one.
|
|
13
|
+
-->
|
|
14
|
+
<template>
|
|
15
|
+
<v-row no-gutters>
|
|
16
|
+
<v-col cols="12">
|
|
17
|
+
<PageHeader title="Task Calendar" />
|
|
18
|
+
|
|
19
|
+
<v-expansion-panels
|
|
20
|
+
v-model="helpPanel"
|
|
21
|
+
class="tc-help mb-4"
|
|
22
|
+
variant="accordion"
|
|
23
|
+
flat
|
|
24
|
+
>
|
|
25
|
+
<v-expansion-panel value="how">
|
|
26
|
+
<v-expansion-panel-title class="tc-help__title">
|
|
27
|
+
<v-icon size="20" class="mr-2">mdi-help-circle-outline</v-icon>
|
|
28
|
+
How the Task Calendar works
|
|
29
|
+
</v-expansion-panel-title>
|
|
30
|
+
<v-expansion-panel-text class="tc-help__body">
|
|
31
|
+
<ul class="tc-help__list">
|
|
32
|
+
<li v-if="showAgent">
|
|
33
|
+
<strong>From managing agent</strong> - jobs the building's
|
|
34
|
+
managing agent gave your company, for example a monthly pump
|
|
35
|
+
service. You can only look at them here. The managing agent
|
|
36
|
+
marks them done.
|
|
37
|
+
</li>
|
|
38
|
+
<li v-if="showExtra">
|
|
39
|
+
<strong>My extra checks</strong> - checks your company adds on
|
|
40
|
+
top of the normal daily rounds, for example "Lunch toilet
|
|
41
|
+
check, Lobby Toilets, 2:00 pm every weekday". The managing
|
|
42
|
+
agent can see them too, but cannot change them.
|
|
43
|
+
</li>
|
|
44
|
+
<li v-if="showExtra">
|
|
45
|
+
At the set time, the extra check appears in staff's
|
|
46
|
+
<strong>Daily Checklist</strong> on their phone and they get a
|
|
47
|
+
notification. They tick each unit there.
|
|
48
|
+
</li>
|
|
49
|
+
</ul>
|
|
50
|
+
<div class="tc-help__h">What the words mean</div>
|
|
51
|
+
<dl class="tc-help__legend">
|
|
52
|
+
<template v-for="h in words" :key="h.word">
|
|
53
|
+
<dt><StatusChip :status="h.word" :label="h.word" :tone="h.tone" /></dt>
|
|
54
|
+
<dd>{{ h.meaning }}</dd>
|
|
55
|
+
</template>
|
|
56
|
+
</dl>
|
|
57
|
+
</v-expansion-panel-text>
|
|
58
|
+
</v-expansion-panel>
|
|
59
|
+
</v-expansion-panels>
|
|
60
|
+
|
|
61
|
+
<div v-if="tabs.length > 1" class="app-tabs mb-4" role="tablist">
|
|
62
|
+
<button
|
|
63
|
+
v-for="t in tabs"
|
|
64
|
+
:key="t.key"
|
|
65
|
+
type="button"
|
|
66
|
+
role="tab"
|
|
67
|
+
class="app-tab"
|
|
68
|
+
:class="{ 'app-tab--active': tab === t.key }"
|
|
69
|
+
:aria-selected="tab === t.key"
|
|
70
|
+
:data-test="`task-calendar-tab-${t.key}`"
|
|
71
|
+
@click="chooseTab(t.key)"
|
|
72
|
+
>
|
|
73
|
+
{{ t.name }}
|
|
74
|
+
</button>
|
|
75
|
+
</div>
|
|
76
|
+
|
|
77
|
+
<TaskCalendarReadOnly
|
|
78
|
+
v-if="tab === 'agent'"
|
|
79
|
+
:site-id="siteId"
|
|
80
|
+
embedded
|
|
81
|
+
/>
|
|
82
|
+
<ScheduleTaskMain
|
|
83
|
+
v-else-if="tab === 'extra'"
|
|
84
|
+
:org-id="orgId"
|
|
85
|
+
:site="siteId"
|
|
86
|
+
:service-type="serviceType"
|
|
87
|
+
:can-view-schedule-tasks="canViewScheduleTasks"
|
|
88
|
+
:can-create-schedule-task="canCreateScheduleTask"
|
|
89
|
+
:can-update-schedule-task="canUpdateScheduleTask"
|
|
90
|
+
:can-delete-schedule-task="canDeleteScheduleTask"
|
|
91
|
+
:can-view-schedule-task-details="canViewScheduleTaskDetails"
|
|
92
|
+
embedded
|
|
93
|
+
/>
|
|
94
|
+
<v-alert v-else type="info" variant="tonal" class="ma-4">
|
|
95
|
+
Your role does not include the Task Calendar.
|
|
96
|
+
</v-alert>
|
|
97
|
+
</v-col>
|
|
98
|
+
</v-row>
|
|
99
|
+
</template>
|
|
100
|
+
|
|
101
|
+
<script setup lang="ts">
|
|
102
|
+
import {
|
|
103
|
+
pickTaskCalendarTab,
|
|
104
|
+
taskCalendarWords,
|
|
105
|
+
type TTaskCalendarTab,
|
|
106
|
+
} from "../utils/task-calendar-tabs";
|
|
107
|
+
|
|
108
|
+
const props = defineProps({
|
|
109
|
+
orgId: { type: String, required: true },
|
|
110
|
+
siteId: { type: String, required: true },
|
|
111
|
+
serviceType: { type: String, default: "" },
|
|
112
|
+
/** Opened from an old Extra Checks link: start on "My extra checks". */
|
|
113
|
+
initialTab: { type: String, default: "" },
|
|
114
|
+
canViewTaskCalendar: { type: Boolean, default: false },
|
|
115
|
+
canViewScheduleTasks: { type: Boolean, default: false },
|
|
116
|
+
canCreateScheduleTask: { type: Boolean, default: false },
|
|
117
|
+
canUpdateScheduleTask: { type: Boolean, default: false },
|
|
118
|
+
canDeleteScheduleTask: { type: Boolean, default: false },
|
|
119
|
+
canViewScheduleTaskDetails: { type: Boolean, default: false },
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const route = useRoute();
|
|
123
|
+
const router = useRouter();
|
|
124
|
+
|
|
125
|
+
const showAgent = computed(() => props.canViewTaskCalendar);
|
|
126
|
+
const showExtra = computed(() => props.canViewScheduleTasks);
|
|
127
|
+
|
|
128
|
+
const words = computed(() =>
|
|
129
|
+
taskCalendarWords({ agent: showAgent.value, extra: showExtra.value }),
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const tabs = computed(() => [
|
|
133
|
+
...(showAgent.value ? [{ key: "agent" as const, name: "From managing agent" }] : []),
|
|
134
|
+
...(showExtra.value ? [{ key: "extra" as const, name: "My extra checks" }] : []),
|
|
135
|
+
]);
|
|
136
|
+
|
|
137
|
+
const tab = computed<TTaskCalendarTab | "">(() =>
|
|
138
|
+
pickTaskCalendarTab(route.query.tab, props.initialTab, {
|
|
139
|
+
agent: showAgent.value,
|
|
140
|
+
extra: showExtra.value,
|
|
141
|
+
}),
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
function chooseTab(key: TTaskCalendarTab) {
|
|
145
|
+
if (key === tab.value) return;
|
|
146
|
+
router.replace({ query: { ...route.query, tab: key } });
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
// Open until the viewer closes it; remembered on this browser only.
|
|
150
|
+
const HELP_STORE = "task-calendar-help";
|
|
151
|
+
const helpPanel = ref<string | undefined>("how");
|
|
152
|
+
onMounted(() => {
|
|
153
|
+
try {
|
|
154
|
+
if (localStorage.getItem(HELP_STORE) === "closed") helpPanel.value = undefined;
|
|
155
|
+
} catch {
|
|
156
|
+
// storage blocked: stay open
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
watch(helpPanel, (v) => {
|
|
160
|
+
try {
|
|
161
|
+
localStorage.setItem(HELP_STORE, v ? "open" : "closed");
|
|
162
|
+
} catch {
|
|
163
|
+
// storage blocked: nothing to remember
|
|
164
|
+
}
|
|
165
|
+
});
|
|
166
|
+
</script>
|
|
167
|
+
|
|
168
|
+
<style scoped>
|
|
169
|
+
.tc-help {
|
|
170
|
+
border: 1px solid var(--border);
|
|
171
|
+
border-radius: 8px;
|
|
172
|
+
}
|
|
173
|
+
.tc-help__title {
|
|
174
|
+
font-weight: 700;
|
|
175
|
+
}
|
|
176
|
+
.tc-help__body {
|
|
177
|
+
font-size: var(--fs-cell);
|
|
178
|
+
color: var(--text);
|
|
179
|
+
}
|
|
180
|
+
.tc-help__list {
|
|
181
|
+
margin: 0 0 12px 18px;
|
|
182
|
+
display: flex;
|
|
183
|
+
flex-direction: column;
|
|
184
|
+
gap: 6px;
|
|
185
|
+
}
|
|
186
|
+
.tc-help__h {
|
|
187
|
+
font-weight: 700;
|
|
188
|
+
margin-bottom: 6px;
|
|
189
|
+
}
|
|
190
|
+
.tc-help__legend {
|
|
191
|
+
display: grid;
|
|
192
|
+
grid-template-columns: max-content 1fr;
|
|
193
|
+
gap: 6px 12px;
|
|
194
|
+
align-items: center;
|
|
195
|
+
margin: 0;
|
|
196
|
+
}
|
|
197
|
+
.tc-help__legend dd {
|
|
198
|
+
margin: 0;
|
|
199
|
+
}
|
|
200
|
+
</style>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<v-row no-gutters>
|
|
3
|
-
<v-col cols="12">
|
|
3
|
+
<v-col v-if="!embedded" cols="12">
|
|
4
4
|
<PageHeader title="Task Calendar"
|
|
5
5
|
subtitle="Tasks the managing agent assigned to your company at this site. View only - the managing agent marks them done." />
|
|
6
6
|
</v-col>
|
|
@@ -16,8 +16,11 @@
|
|
|
16
16
|
</button>
|
|
17
17
|
</template>
|
|
18
18
|
|
|
19
|
-
<template
|
|
20
|
-
<DashboardEmptyState error />
|
|
19
|
+
<template #no-data>
|
|
20
|
+
<DashboardEmptyState v-if="error" error />
|
|
21
|
+
<div v-else class="tc-ro-empty" data-test="task-calendar-agent-empty">
|
|
22
|
+
{{ EMPTY_TEXT[status] || EMPTY_TEXT.planned }}
|
|
23
|
+
</div>
|
|
21
24
|
</template>
|
|
22
25
|
|
|
23
26
|
<template v-slot:item.dateTime="{ item }">{{ dueDate(item.dateTime) }}</template>
|
|
@@ -54,9 +57,17 @@ import { readListPage } from '../utils/list-page';
|
|
|
54
57
|
|
|
55
58
|
const props = defineProps({
|
|
56
59
|
siteId: { type: String, required: true },
|
|
60
|
+
/** Inside the Task Calendar page (TaskCalendarMain), which has the title and help. */
|
|
61
|
+
embedded: { type: Boolean, default: false },
|
|
57
62
|
});
|
|
58
63
|
|
|
59
64
|
const LIMIT = 20;
|
|
65
|
+
// Per tab, in plain words (owner 24 Oct): never a bare "No data available".
|
|
66
|
+
const EMPTY_TEXT: Record<string, string> = {
|
|
67
|
+
planned: "No jobs from the managing agent yet. When they give your company a job at this site, it shows here.",
|
|
68
|
+
overdue: "Nothing overdue. Jobs from the managing agent that pass their due date show here.",
|
|
69
|
+
completed: "No finished jobs yet. Jobs the managing agent marks done show here.",
|
|
70
|
+
};
|
|
60
71
|
const TABS = [
|
|
61
72
|
{ name: "Open", status: "planned" },
|
|
62
73
|
{ name: "Overdue", status: "overdue" },
|
|
@@ -113,3 +124,11 @@ function taskState(task: Record<string, any>) {
|
|
|
113
124
|
return { label: "Upcoming", color: "primary" };
|
|
114
125
|
}
|
|
115
126
|
</script>
|
|
127
|
+
|
|
128
|
+
<style scoped>
|
|
129
|
+
.tc-ro-empty {
|
|
130
|
+
padding: 24px 16px;
|
|
131
|
+
font-size: var(--fs-cell);
|
|
132
|
+
color: var(--text2);
|
|
133
|
+
}
|
|
134
|
+
</style>
|
|
@@ -29,16 +29,23 @@ type TVehicleAddChoice = TVehicleType | "seasonpass" | "whitelist-bulk";
|
|
|
29
29
|
const prop = defineProps({
|
|
30
30
|
// Security catalogue v2: false hides the Blocklist choice. Default = today.
|
|
31
31
|
canManageBlocklist: { type: Boolean, default: true },
|
|
32
|
+
// Add Vehicle: false hides Whitelist, Whitelist (Bulk) and Season Pass, so a
|
|
33
|
+
// role with only Manage Blocklist is offered the Blocklist form alone.
|
|
34
|
+
canAddWhitelist: { type: Boolean, default: true },
|
|
32
35
|
});
|
|
33
36
|
|
|
34
37
|
const emit = defineEmits(['cancel', 'select']);
|
|
35
38
|
|
|
36
39
|
const selection = computed<{label: string, value: TVehicleAddChoice}[]>(() => {
|
|
37
40
|
return [
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
...(prop.canAddWhitelist
|
|
42
|
+
? [
|
|
43
|
+
{ label: "Whitelist", value: "whitelist" as TVehicleAddChoice },
|
|
44
|
+
// Many whitelist vehicles at once, typed or pasted into a sheet.
|
|
45
|
+
{ label: "Whitelist (Bulk)", value: "whitelist-bulk" as TVehicleAddChoice },
|
|
46
|
+
{ label: "Season Pass", value: "seasonpass" as TVehicleAddChoice },
|
|
47
|
+
]
|
|
48
|
+
: []),
|
|
42
49
|
...(prop.canManageBlocklist
|
|
43
50
|
? [{ label: "Blocklist", value: "blocklist" as TVehicleAddChoice }]
|
|
44
51
|
: []),
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<AppButton v-if="qrStickersOn" icon="mdi-qrcode" variant="ghost" @click="openStickerDialog()">
|
|
18
18
|
Print QR stickers
|
|
19
19
|
</AppButton>
|
|
20
|
-
<AppButton v-if="canCreateVehicle" icon="mdi-plus" @click="handleAddVehicleClick">
|
|
20
|
+
<AppButton v-if="canCreateVehicle || canAddBlocklist" icon="mdi-plus" @click="handleAddVehicleClick">
|
|
21
21
|
Add Vehicle
|
|
22
22
|
</AppButton>
|
|
23
23
|
</template>
|
|
@@ -103,26 +103,26 @@
|
|
|
103
103
|
be drawn.
|
|
104
104
|
-->
|
|
105
105
|
<template #item.action="{ item }">
|
|
106
|
-
<v-menu v-if="rowHasVehicleActions(item, vehiclePermissions) || qrStickersOn" location="bottom end">
|
|
106
|
+
<v-menu v-if="rowHasVehicleActions(item, vehiclePermissions) || qrStickersOn || rowPlates(item).some(qrActionsOn)" location="bottom end">
|
|
107
107
|
<template #activator="{ props: menuProps }">
|
|
108
108
|
<AppButton v-bind="menuProps" variant="row" icon="mdi-dots-vertical" aria-label="Vehicle actions"
|
|
109
109
|
@click.stop />
|
|
110
110
|
</template>
|
|
111
111
|
<v-list density="compact">
|
|
112
112
|
<template v-for="plate in rowPlates(item)" :key="plate._id ?? plate.plateNumber">
|
|
113
|
-
<template v-if="vehiclePlateActions(plate, vehiclePermissions).length || qrStickersOn">
|
|
113
|
+
<template v-if="vehiclePlateActions(plate, vehiclePermissions).length || qrStickersOn || qrActionsOn(plate)">
|
|
114
114
|
<v-list-subheader v-if="rowPlates(item).length > 1">
|
|
115
115
|
{{ plate.plateNumber }}
|
|
116
116
|
</v-list-subheader>
|
|
117
117
|
<v-list-item v-if="qrStickersOn && plate.hasQrSticker" title="Print sticker again" prepend-icon="mdi-printer"
|
|
118
118
|
data-test="vehicle-qr-print-again" @click="openStickerDialog([String(plate._id)])" />
|
|
119
|
-
<v-list-item v-if="
|
|
119
|
+
<v-list-item v-if="qrActionsOn(plate)" title="Re-issue sticker (lost or stolen)" prepend-icon="mdi-qrcode-edit"
|
|
120
120
|
@click="askReissue(plate as TPlateNumber)" />
|
|
121
|
-
<v-list-item v-if="
|
|
121
|
+
<v-list-item v-if="qrActionsOn(plate)" title="Undo re-issue" prepend-icon="mdi-undo"
|
|
122
122
|
data-test="vehicle-qr-undo" @click="askUndo(plate as TPlateNumber)" />
|
|
123
|
-
<v-list-item v-if="
|
|
123
|
+
<v-list-item v-if="qrActionsOn(plate)" title="Link QR sticker" prepend-icon="mdi-link-variant"
|
|
124
124
|
@click="askLink(plate as TPlateNumber)" />
|
|
125
|
-
<v-list-item v-if="
|
|
125
|
+
<v-list-item v-if="qrActionsOn(plate)" title="Remove QR sticker" prepend-icon="mdi-link-variant-off"
|
|
126
126
|
@click="askUnlink(plate as TPlateNumber)" />
|
|
127
127
|
<v-list-item v-for="action in vehiclePlateActions(plate, vehiclePermissions)" :key="action.key"
|
|
128
128
|
:title="action.title" :prepend-icon="action.icon" :base-color="action.color"
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
<!-- <Snackbar v-model="messageSnackbar" :text="message" :color="messageColor" /> -->
|
|
138
138
|
|
|
139
139
|
<v-dialog v-model="dialog.showSelection" width="450" persistent>
|
|
140
|
-
<VehicleAddSelection :can-manage-blocklist="canManageBlocklist" @cancel="dialog.showSelection = false" @select="handleSelectVehicleStatus" />
|
|
140
|
+
<VehicleAddSelection :can-manage-blocklist="canManageBlocklist" :can-add-whitelist="canCreateVehicle" @cancel="dialog.showSelection = false" @select="handleSelectVehicleStatus" />
|
|
141
141
|
</v-dialog>
|
|
142
142
|
|
|
143
143
|
<!-- Many whitelist vehicles at once. Wider than the one-vehicle form: it
|
|
@@ -232,7 +232,7 @@
|
|
|
232
232
|
<AnprCameraBadge :cameras="(plateNumberItem as any).anprCameras ?? []" :plate-number="value"
|
|
233
233
|
:plate-id="(plateNumberItem as any)._id ?? ''" :status="(plateNumberItem as any).status ?? ''"
|
|
234
234
|
:type="(plateNumberItem as any).type ?? ''" :end="(plateNumberItem as any).end ?? null"
|
|
235
|
-
:active-counts="activeCameraCounts"
|
|
235
|
+
:active-counts="activeCameraCounts" :can-sync="syncAllowed(plateNumberItem)"
|
|
236
236
|
@synced="handleSynced" />
|
|
237
237
|
</span>
|
|
238
238
|
</template>
|
|
@@ -244,20 +244,20 @@
|
|
|
244
244
|
v-tooltip:top="'History'" @click="openHistory(plateNumberItem as TPlateNumber)" />
|
|
245
245
|
</template>
|
|
246
246
|
<template #item.action="{ item: plateNumberItem }">
|
|
247
|
-
<v-menu v-if="vehiclePlateActions(plateNumberItem, vehiclePermissions).length || qrStickersOn">
|
|
247
|
+
<v-menu v-if="vehiclePlateActions(plateNumberItem, vehiclePermissions).length || qrStickersOn || qrActionsOn(plateNumberItem)">
|
|
248
248
|
<template #activator="{ props: menuProps }">
|
|
249
249
|
<v-btn icon="mdi-dots-vertical" v-bind="menuProps" flat size="x-small" />
|
|
250
250
|
</template>
|
|
251
251
|
<v-list density="compact">
|
|
252
252
|
<v-list-item v-if="qrStickersOn && (plateNumberItem as any).hasQrSticker" title="Print sticker again" prepend-icon="mdi-printer"
|
|
253
253
|
data-test="vehicle-qr-print-again" @click="openStickerDialog([String((plateNumberItem as any)._id)])" />
|
|
254
|
-
<v-list-item v-if="
|
|
254
|
+
<v-list-item v-if="qrActionsOn(plateNumberItem)" title="Re-issue sticker (lost or stolen)" prepend-icon="mdi-qrcode-edit"
|
|
255
255
|
@click="askReissue((plateNumberItem as any) as TPlateNumber)" />
|
|
256
|
-
<v-list-item v-if="
|
|
256
|
+
<v-list-item v-if="qrActionsOn(plateNumberItem)" title="Undo re-issue" prepend-icon="mdi-undo"
|
|
257
257
|
data-test="vehicle-qr-undo" @click="askUndo((plateNumberItem as any) as TPlateNumber)" />
|
|
258
|
-
<v-list-item v-if="
|
|
258
|
+
<v-list-item v-if="qrActionsOn(plateNumberItem)" title="Link QR sticker" prepend-icon="mdi-link-variant"
|
|
259
259
|
@click="askLink(plateNumberItem as TPlateNumber)" />
|
|
260
|
-
<v-list-item v-if="
|
|
260
|
+
<v-list-item v-if="qrActionsOn(plateNumberItem)" title="Remove QR sticker" prepend-icon="mdi-link-variant-off"
|
|
261
261
|
@click="askUnlink(plateNumberItem as TPlateNumber)" />
|
|
262
262
|
<v-list-item
|
|
263
263
|
v-for="action in vehiclePlateActions(plateNumberItem, vehiclePermissions)"
|
|
@@ -296,7 +296,7 @@
|
|
|
296
296
|
when the ANPR revoke could not be confirmed - the dialog stays open on
|
|
297
297
|
that path so the operator can read it and retry.
|
|
298
298
|
-->
|
|
299
|
-
<DialogDeleteConfirmation :loading="deletingVehicle" :message="deleteError" :no-permission="revoked
|
|
299
|
+
<DialogDeleteConfirmation :loading="deletingVehicle" :message="deleteError" :no-permission="revoked[rightFor('delete')]"
|
|
300
300
|
:prompt-title="`Remove vehicle number ${selectedPlateNumberObject?.plateNumber} from this record? This revokes its ANPR access - it will no longer open the barrier. The resident and any other vehicle numbers on this record are not affected.`"
|
|
301
301
|
@delete="submitDelete" @close="closeDeleteDialog" />
|
|
302
302
|
</v-dialog>
|
|
@@ -314,19 +314,19 @@
|
|
|
314
314
|
<!-- Like Delete, Restore says what it does at the barrier: a whitelist
|
|
315
315
|
plate goes back on the allowed list and opens it again. -->
|
|
316
316
|
<v-dialog v-model="dialog.restoreVehicle" persistent width="540">
|
|
317
|
-
<DialogReusablePrompt :loading="restoringVehicle" :message="actionError" message-error :no-permission="revoked
|
|
317
|
+
<DialogReusablePrompt :loading="restoringVehicle" :message="actionError" message-error :no-permission="revoked[restoreRight()]"
|
|
318
318
|
:prompt-title="restorePrompt"
|
|
319
319
|
@proceed="submitRestore" @close="closeActionDialog('restoreVehicle')" />
|
|
320
320
|
</v-dialog>
|
|
321
321
|
<!-- Block / Unblock say what happens on the cameras, because that is the
|
|
322
322
|
part the operator cannot see from here. -->
|
|
323
323
|
<v-dialog v-model="dialog.blockVehicle" persistent width="540">
|
|
324
|
-
<DialogReusablePrompt :loading="blockingVehicle" :message="actionError" message-error :no-permission="revoked
|
|
324
|
+
<DialogReusablePrompt :loading="blockingVehicle" :message="actionError" message-error :no-permission="revoked[rightFor('update', true)]"
|
|
325
325
|
: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.`"
|
|
326
326
|
@proceed="submitBlock" @close="closeActionDialog('blockVehicle')" />
|
|
327
327
|
</v-dialog>
|
|
328
328
|
<v-dialog v-model="dialog.unblockVehicle" persistent width="540">
|
|
329
|
-
<DialogReusablePrompt :loading="unblockingVehicle" :message="actionError" message-error :no-permission="revoked
|
|
329
|
+
<DialogReusablePrompt :loading="unblockingVehicle" :message="actionError" message-error :no-permission="revoked[rightFor('update', true)]"
|
|
330
330
|
: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.`"
|
|
331
331
|
@proceed="submitUnblock" @close="closeActionDialog('unblockVehicle')" />
|
|
332
332
|
</v-dialog>
|
|
@@ -590,6 +590,14 @@ const vehicleTabs = computed<{ name: string; value: TVehicleTab }[]>(() => [
|
|
|
590
590
|
])
|
|
591
591
|
const activeTab = ref<TVehicleTab>("residents");
|
|
592
592
|
|
|
593
|
+
/**
|
|
594
|
+
* Adding to the Block Listed tab follows Manage Blocklist alone (owner,
|
|
595
|
+
* 2026-10-23), not Add Vehicle: a role with only that box still gets the Add
|
|
596
|
+
* Vehicle button, offering the Blocklist form only. Apps that do not pass the
|
|
597
|
+
* flag (undefined) keep today's rule - the button follows Add Vehicle.
|
|
598
|
+
*/
|
|
599
|
+
const canAddBlocklist = computed(() => props.canManageBlocklist === true);
|
|
600
|
+
|
|
593
601
|
|
|
594
602
|
|
|
595
603
|
const { formatCamelCaseToWords, formatDate, debounce, maskNRIC } = useUtils();
|
|
@@ -605,6 +613,28 @@ const qrStickerFilterItems = [
|
|
|
605
613
|
{ title: "Without sticker", value: "without" },
|
|
606
614
|
];
|
|
607
615
|
const qrStickersOn = computed(() => qrEnabled.value && props.canUpdateVehicle);
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Re-issue / Undo / Link / Remove on one plate change that vehicle, so on a
|
|
619
|
+
* Block Listed plate they follow Manage Blocklist (owner, 2026-10-23) when the
|
|
620
|
+
* host passes it; any other plate follows Update Vehicle. Printing stays with
|
|
621
|
+
* `qrStickersOn`.
|
|
622
|
+
*/
|
|
623
|
+
/** Sync on a Block Listed plate follows Manage Blocklist when the host passes it. */
|
|
624
|
+
function syncAllowed(plate: any): boolean {
|
|
625
|
+
if (props.canManageBlocklist !== undefined && plate?.type === "blocklist") {
|
|
626
|
+
return !!vehiclePermissions.value.canManageBlocklist;
|
|
627
|
+
}
|
|
628
|
+
return true;
|
|
629
|
+
}
|
|
630
|
+
|
|
631
|
+
function qrActionsOn(plate: any): boolean {
|
|
632
|
+
if (!qrEnabled.value) return false;
|
|
633
|
+
if (props.canManageBlocklist !== undefined && plate?.type === "blocklist") {
|
|
634
|
+
return !!vehiclePermissions.value.canManageBlocklist;
|
|
635
|
+
}
|
|
636
|
+
return props.canUpdateVehicle;
|
|
637
|
+
}
|
|
608
638
|
const qrVehicleIds = ref<string[]>([]);
|
|
609
639
|
const qrReissuePlate = ref<TPlateNumber | null>(null);
|
|
610
640
|
const qrReissuing = ref(false);
|
|
@@ -635,7 +665,8 @@ const qrCodeToLink = computed(() => String(qrLinkCode.value || qrSearch.value ||
|
|
|
635
665
|
|
|
636
666
|
// Saved blank codes still free to link + the site's printed / linked / available count.
|
|
637
667
|
async function loadQrAvailable(search = "") {
|
|
638
|
-
|
|
668
|
+
// The Link dialog lists the blanks for whoever may link this plate.
|
|
669
|
+
if (!qrStickersOn.value && !(dialog.qrLink && qrActionsOn(qrPlate.value))) return;
|
|
639
670
|
try {
|
|
640
671
|
const res = await getAvailableBlankVehicleQr(props.site, { search, limit: 50 });
|
|
641
672
|
qrSummary.value = res?.summary ?? null;
|
|
@@ -1139,7 +1170,10 @@ const vehiclePermissions = computed(() => ({
|
|
|
1139
1170
|
canUpdateVehicle: props.canUpdateVehicle && !revoked.update,
|
|
1140
1171
|
canDeleteVehicle: props.canDeleteVehicle && !revoked.delete,
|
|
1141
1172
|
canApproveVehicle: props.canApproveVehicle && !revoked.approve,
|
|
1142
|
-
canManageBlocklist:
|
|
1173
|
+
canManageBlocklist:
|
|
1174
|
+
props.canManageBlocklist === undefined
|
|
1175
|
+
? undefined
|
|
1176
|
+
: props.canManageBlocklist && !revoked.blocklist,
|
|
1143
1177
|
}));
|
|
1144
1178
|
|
|
1145
1179
|
/**
|
|
@@ -1153,8 +1187,26 @@ const vehiclePermissions = computed(() => ({
|
|
|
1153
1187
|
* the local override is dropped and the host's answer stands again - so a
|
|
1154
1188
|
* right given back is not kept hidden.
|
|
1155
1189
|
*/
|
|
1156
|
-
const revoked = reactive({ update: false, delete: false, approve: false });
|
|
1190
|
+
const revoked = reactive({ update: false, delete: false, approve: false, blocklist: false });
|
|
1157
1191
|
watch(() => props.canUpdateVehicle, () => { revoked.update = false; });
|
|
1192
|
+
watch(() => props.canManageBlocklist, () => { revoked.blocklist = false; });
|
|
1193
|
+
|
|
1194
|
+
/**
|
|
1195
|
+
* Which right an action on the selected plate stands on. With Manage Blocklist
|
|
1196
|
+
* passed by the host, Block / Unblock - and Edit / Delete on a Block Listed
|
|
1197
|
+
* plate - are that right, so a refusal there takes only those off the menus.
|
|
1198
|
+
*/
|
|
1199
|
+
/** Restore on a Block Listed plate is a blocklist write; any other stays Approve. */
|
|
1200
|
+
function restoreRight(): keyof typeof revoked {
|
|
1201
|
+
if (props.canManageBlocklist === undefined) return "approve";
|
|
1202
|
+
return selectedPlateNumberObject.value?.type === "blocklist" ? "blocklist" : "approve";
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
function rightFor(base: "update" | "delete", blockAction = false): keyof typeof revoked {
|
|
1206
|
+
if (props.canManageBlocklist === undefined) return base;
|
|
1207
|
+
if (blockAction || selectedPlateNumberObject.value?.type === "blocklist") return "blocklist";
|
|
1208
|
+
return base;
|
|
1209
|
+
}
|
|
1158
1210
|
watch(() => props.canDeleteVehicle, () => { revoked.delete = false; });
|
|
1159
1211
|
watch(() => props.canApproveVehicle, () => { revoked.approve = false; });
|
|
1160
1212
|
|
|
@@ -1167,6 +1219,7 @@ const NO_PERMISSION: Record<keyof typeof revoked, string> = {
|
|
|
1167
1219
|
update: "You do not have permission to edit vehicles.",
|
|
1168
1220
|
delete: "You do not have permission to delete vehicles.",
|
|
1169
1221
|
approve: "You do not have permission to approve vehicles.",
|
|
1222
|
+
blocklist: "You do not have permission to manage the block list.",
|
|
1170
1223
|
};
|
|
1171
1224
|
|
|
1172
1225
|
/**
|
|
@@ -1176,7 +1229,7 @@ const NO_PERMISSION: Record<keyof typeof revoked, string> = {
|
|
|
1176
1229
|
*/
|
|
1177
1230
|
/** The add/edit form was refused: an edit refusal takes Edit/Block/Unblock off. */
|
|
1178
1231
|
function handleFormRefused(kind: "create" | "update") {
|
|
1179
|
-
if (kind === "update") revoked
|
|
1232
|
+
if (kind === "update") revoked[rightFor("update")] = true;
|
|
1180
1233
|
}
|
|
1181
1234
|
|
|
1182
1235
|
function refusedAlready(right: keyof typeof revoked, target: typeof actionError) {
|
|
@@ -1266,7 +1319,7 @@ const formatPlateNumbers = (value: any) => {
|
|
|
1266
1319
|
};
|
|
1267
1320
|
|
|
1268
1321
|
async function submitDelete() {
|
|
1269
|
-
if (refusedAlready("delete", deleteError)) return;
|
|
1322
|
+
if (refusedAlready(rightFor("delete"), deleteError)) return;
|
|
1270
1323
|
|
|
1271
1324
|
const plateNumberId = selectedPlateNumberObject.value?._id;
|
|
1272
1325
|
const type = selectedPlateNumberObject.value?.type as TVehicleType;
|
|
@@ -1292,7 +1345,7 @@ async function submitDelete() {
|
|
|
1292
1345
|
// error - so a refused delete showed the operator nothing at all.
|
|
1293
1346
|
deleteError.value = errorConverter(error);
|
|
1294
1347
|
// Refused for want of the right: take Delete off both menus now.
|
|
1295
|
-
revokeOnRefusal(error, "delete");
|
|
1348
|
+
revokeOnRefusal(error, rightFor("delete"));
|
|
1296
1349
|
// The dialog stays open and the row stays in the table - nothing is removed
|
|
1297
1350
|
// optimistically, so what is on screen still matches the database.
|
|
1298
1351
|
} finally {
|
|
@@ -1328,7 +1381,7 @@ const restorePrompt = computed(() => {
|
|
|
1328
1381
|
});
|
|
1329
1382
|
|
|
1330
1383
|
async function submitRestore() {
|
|
1331
|
-
if (refusedAlready(
|
|
1384
|
+
if (refusedAlready(restoreRight(), actionError)) return;
|
|
1332
1385
|
|
|
1333
1386
|
const vehicleId = selectedPlateNumberObject.value?._id;
|
|
1334
1387
|
|
|
@@ -1349,7 +1402,7 @@ async function submitRestore() {
|
|
|
1349
1402
|
} catch (error: any) {
|
|
1350
1403
|
actionError.value = errorConverter(error);
|
|
1351
1404
|
// Restore is the approve endpoint: a refusal is the Approve right gone.
|
|
1352
|
-
revokeOnRefusal(error,
|
|
1405
|
+
revokeOnRefusal(error, restoreRight());
|
|
1353
1406
|
} finally {
|
|
1354
1407
|
restoringVehicle.value = false;
|
|
1355
1408
|
}
|
|
@@ -1357,7 +1410,7 @@ async function submitRestore() {
|
|
|
1357
1410
|
|
|
1358
1411
|
|
|
1359
1412
|
async function submitBlock() {
|
|
1360
|
-
if (refusedAlready("update", actionError)) return;
|
|
1413
|
+
if (refusedAlready(rightFor("update", true), actionError)) return;
|
|
1361
1414
|
const vehicleId = selectedPlateNumberObject.value?._id;
|
|
1362
1415
|
if (!vehicleId) {
|
|
1363
1416
|
showMessage("Invalid vehicle selected for blocking.", "error");
|
|
@@ -1373,7 +1426,7 @@ async function submitBlock() {
|
|
|
1373
1426
|
await getVehiclesRefresh();
|
|
1374
1427
|
} catch (error: any) {
|
|
1375
1428
|
actionError.value = errorConverter(error);
|
|
1376
|
-
revokeOnRefusal(error, "update");
|
|
1429
|
+
revokeOnRefusal(error, rightFor("update", true));
|
|
1377
1430
|
} finally {
|
|
1378
1431
|
blockingVehicle.value = false;
|
|
1379
1432
|
}
|
|
@@ -1381,7 +1434,7 @@ async function submitBlock() {
|
|
|
1381
1434
|
|
|
1382
1435
|
|
|
1383
1436
|
async function submitUnblock() {
|
|
1384
|
-
if (refusedAlready("update", actionError)) return;
|
|
1437
|
+
if (refusedAlready(rightFor("update", true), actionError)) return;
|
|
1385
1438
|
const vehicleId = selectedPlateNumberObject.value?._id;
|
|
1386
1439
|
if (!vehicleId) {
|
|
1387
1440
|
showMessage("Invalid vehicle selected for unblocking.", "error");
|
|
@@ -1397,7 +1450,7 @@ async function submitUnblock() {
|
|
|
1397
1450
|
await getVehiclesRefresh();
|
|
1398
1451
|
} catch (error: any) {
|
|
1399
1452
|
actionError.value = errorConverter(error);
|
|
1400
|
-
revokeOnRefusal(error, "update");
|
|
1453
|
+
revokeOnRefusal(error, rightFor("update", true));
|
|
1401
1454
|
} finally {
|
|
1402
1455
|
unblockingVehicle.value = false;
|
|
1403
1456
|
}
|
|
@@ -202,7 +202,7 @@
|
|
|
202
202
|
<AppButton
|
|
203
203
|
v-if="!visitorInfo.checkIn && !visitorInfo.checkOut"
|
|
204
204
|
:disabled="processing"
|
|
205
|
-
@click="
|
|
205
|
+
@click="checkIn"
|
|
206
206
|
>
|
|
207
207
|
Check In
|
|
208
208
|
</AppButton>
|
|
@@ -240,6 +240,11 @@ const { standardFormatDateTime } = useUtils();
|
|
|
240
240
|
|
|
241
241
|
const visitorInfo = ref<Partial<TVisitor>>({});
|
|
242
242
|
|
|
243
|
+
// The list adds the user's default ANPR gate when it checks the guest in.
|
|
244
|
+
function checkIn() {
|
|
245
|
+
emit("check-in-out", "checkIn", visitorInfo.value);
|
|
246
|
+
}
|
|
247
|
+
|
|
243
248
|
watch(
|
|
244
249
|
() => prop.visitorData,
|
|
245
250
|
(visitorData) => {
|