@7365admin1/layer-common 4.17.0 → 4.17.1-staging.331

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +4 -4
  2. package/components/DocumentForm.vue +407 -112
  3. package/components/DocumentManagement.vue +213 -12
  4. package/components/EntryPass/QrTemplatePreview.vue +21 -25
  5. package/components/EntryPassInformation.vue +119 -24
  6. package/components/Facility/BookingSetup.vue +63 -0
  7. package/components/HidAccessPermissions.vue +424 -0
  8. package/components/HidIntercomManagement.vue +193 -43
  9. package/components/HidProfileQrCode.vue +323 -0
  10. package/components/HidReaderManagement.vue +26 -0
  11. package/components/HidReaderUserRoster.vue +32 -2
  12. package/components/HidUserEnrollment.vue +779 -213
  13. package/components/InventoryImportDialog.vue +117 -0
  14. package/components/InventoryItemDetail.vue +158 -0
  15. package/components/InventoryItemDialog.vue +125 -0
  16. package/components/InventoryLinesDialog.vue +288 -0
  17. package/components/InventoryMain.vue +226 -0
  18. package/components/InventoryMyStockTab.vue +114 -0
  19. package/components/InventoryPhotoInput.vue +70 -0
  20. package/components/InventoryReportsTab.vue +181 -0
  21. package/components/InventoryRequestsTab.vue +218 -0
  22. package/components/InventorySettingsTab.vue +94 -0
  23. package/components/InventoryStockTab.vue +177 -0
  24. package/components/InventoryTechniciansTab.vue +81 -0
  25. package/components/InventoryUsageDialog.vue +203 -0
  26. package/components/InvitationClientForm.vue +19 -1
  27. package/components/Layout/Header.vue +26 -0
  28. package/components/NotificationBell.vue +321 -0
  29. package/components/VisitorManagement.vue +267 -5
  30. package/composables/useAccessManagement.ts +5 -0
  31. package/composables/useCleaningPermission.ts +2 -7
  32. package/composables/useCommonPermission.ts +22 -0
  33. package/composables/useDocument.ts +7 -0
  34. package/composables/useFacility.ts +11 -0
  35. package/composables/useHidAmico.ts +97 -0
  36. package/composables/useHidNavigation.ts +25 -1
  37. package/composables/useInventory.ts +97 -0
  38. package/composables/useInventoryPermission.ts +31 -0
  39. package/composables/useLandscapingPermission.ts +2 -6
  40. package/composables/useMechanicalElectricalPermission.ts +2 -0
  41. package/composables/useNotification.ts +78 -0
  42. package/composables/usePeople.ts +19 -0
  43. package/composables/usePestControlPermission.ts +2 -0
  44. package/composables/usePoolMaintenancePermission.ts +2 -0
  45. package/composables/usePropertyPermission.ts +2 -0
  46. package/composables/useSecurityPermission.ts +10 -7
  47. package/composables/useWebUsb.ts +14 -11
  48. package/constants/permissions.ts +1 -1
  49. package/package.json +1 -1
  50. package/pages/[org]/[site]/access-mgmt/administrator/index.vue +1 -1
  51. package/pages/[org]/[site]/access-mgmt/hid-cards/index.vue +1 -1
  52. package/pages/[org]/[site]/access-mgmt/hid-qr-code/index.vue +23 -0
  53. package/pages/[org]/[site]/access-mgmt/hid-readers/index.vue +1 -1
  54. package/types/document.d.ts +14 -0
  55. package/types/facility.d.ts +4 -0
  56. package/types/inventory.d.ts +89 -0
  57. package/types/people.d.ts +4 -1
  58. package/utils/hid-permission-assignments.ts +190 -0
  59. package/utils/materialSymbols.ts +3 -0
  60. package/utils/module-routes.ts +1 -0
@@ -0,0 +1,177 @@
1
+ <template>
2
+ <div>
3
+ <v-row dense class="mb-2">
4
+ <v-col cols="6" md="3">
5
+ <AppKpiTile icon="mdi-package-variant-closed" label="Items" :value="total" />
6
+ </v-col>
7
+ <v-col cols="6" md="3">
8
+ <AppKpiTile icon="mdi-alert-outline" label="Low stock" :value="lowCount" :down="lowCount > 0" sub="at or below the alert level" />
9
+ </v-col>
10
+ </v-row>
11
+
12
+ <div class="d-flex flex-wrap ga-2 align-center mb-3">
13
+ <v-btn v-if="store.access.canManage" class="text-none screen-btn-primary" variant="flat" prepend-icon="mdi-truck-delivery-outline" @click="open('receive')">
14
+ Receive Stock
15
+ </v-btn>
16
+ <v-btn v-if="store.access.canApprove" class="text-none screen-btn-primary" variant="flat" prepend-icon="mdi-hand-extended-outline" @click="open('issue')">
17
+ Issue Stock
18
+ </v-btn>
19
+ <v-btn v-if="store.access.canRequest && !store.access.canManage" class="text-none screen-btn-primary" variant="flat" prepend-icon="mdi-cart-arrow-down" @click="open('request')">
20
+ Request Stock
21
+ </v-btn>
22
+ <v-menu v-if="store.access.canManage">
23
+ <template #activator="{ props: menu }">
24
+ <v-btn v-bind="menu" class="text-none screen-btn-ghost" variant="outlined" append-icon="mdi-chevron-down">Add Items</v-btn>
25
+ </template>
26
+ <v-list density="compact">
27
+ <v-list-item prepend-icon="mdi-plus" title="Add one item" @click="editItem(null)" />
28
+ <v-list-item prepend-icon="mdi-file-excel-outline" title="Import from Excel" @click="showImport = true" />
29
+ </v-list>
30
+ </v-menu>
31
+ <v-spacer />
32
+ <v-checkbox v-model="lowOnly" label="Low stock only" density="compact" hide-details class="flex-grow-0" />
33
+ <v-text-field
34
+ v-model="search"
35
+ density="compact"
36
+ placeholder="Search item, code or category"
37
+ clearable
38
+ prepend-inner-icon="mdi-magnify"
39
+ hide-details
40
+ style="min-width: 260px; max-width: 320px"
41
+ />
42
+ </div>
43
+
44
+ <TableMain
45
+ :headers="headers"
46
+ :items="items"
47
+ :loading="loading"
48
+ :show-header="true"
49
+ v-model:page="page"
50
+ :pages="pages"
51
+ :page-range="pageRange"
52
+ @refresh="load"
53
+ @row-click="(row: any) => openItem(row.item)"
54
+ >
55
+ <template #item.name="{ item }">
56
+ <div class="d-flex align-center ga-3 py-1">
57
+ <v-avatar rounded size="36" color="grey-lighten-3">
58
+ <v-img v-if="item.photo" :src="getFileUrl(item.photo)" cover />
59
+ <v-icon v-else icon="mdi-package-variant" size="20" />
60
+ </v-avatar>
61
+ <div>
62
+ <div class="font-weight-medium">{{ item.name }}</div>
63
+ <div class="text-caption text-medium-emphasis">{{ [item.code, item.category].filter(Boolean).join(" · ") }}</div>
64
+ </div>
65
+ </div>
66
+ </template>
67
+ <template #item.onHand="{ item }">
68
+ <span :class="item.lowStock ? 'text-error font-weight-bold' : 'font-weight-medium'">{{ item.onHand }}</span>
69
+ <span class="text-medium-emphasis ml-1">{{ item.unit }}</span>
70
+ <v-chip v-if="item.lowStock" size="x-small" color="error" variant="tonal" class="ml-2">Low</v-chip>
71
+ <v-chip v-if="item.status === 'inactive'" size="x-small" variant="tonal" class="ml-2">Not in use</v-chip>
72
+ </template>
73
+ <template #item.reorderLevel="{ value }">{{ value || "—" }}</template>
74
+ <template #item.unitCost="{ value }">{{ value !== undefined ? money(value) : "—" }}</template>
75
+ <template #no-data>
76
+ <div class="py-8 text-center">
77
+ <div class="text-body-1 mb-1">{{ search || lowOnly ? "No items match." : "No items in this store yet." }}</div>
78
+ <div v-if="!search && !lowOnly && store.access.canManage" class="text-body-2 text-medium-emphasis">
79
+ Use <strong>Add Items</strong> to add them one by one or import your Excel list.
80
+ </div>
81
+ </div>
82
+ </template>
83
+ </TableMain>
84
+
85
+ <InventoryLinesDialog v-model="lines.show" :mode="lines.mode" :store="store" :site-id="siteId" :sites="sites" @done="done" />
86
+ <InventoryItemDialog v-model="itemDialog.show" :store="store" :item="itemDialog.item" @done="done" />
87
+ <InventoryImportDialog v-model="showImport" :store="store" @done="done" />
88
+ <InventoryItemDetail v-model="detail.show" :store="store" :item="detail.item" @edit="editItem" @done="done" />
89
+ </div>
90
+ </template>
91
+
92
+ <script setup lang="ts">
93
+ import useInventory from "../composables/useInventory";
94
+ import useFile from "../composables/useFile";
95
+ import useUtils from "../composables/useUtils";
96
+
97
+ const props = defineProps({
98
+ store: { type: Object as PropType<TInventoryStore>, required: true },
99
+ siteId: { type: String, required: true },
100
+ sites: { type: Array as PropType<{ _id: string; name: string }[]>, default: () => [] },
101
+ });
102
+ const emit = defineEmits(["changed"]);
103
+
104
+ const { getItems } = useInventory();
105
+ const { getFileUrl } = useFile();
106
+ const { debounce } = useUtils();
107
+
108
+ const items = ref<TInventoryItem[]>([]);
109
+ const loading = ref(false);
110
+ const page = ref(1);
111
+ const pages = ref(0);
112
+ const total = ref(0);
113
+ const lowCount = ref(0);
114
+ const search = ref("");
115
+ const lowOnly = ref(false);
116
+ const limit = 20;
117
+ const pageRange = computed(() => (total.value ? `${(page.value - 1) * limit + 1}-${Math.min(page.value * limit, total.value)} of ${total.value}` : "0 of 0"));
118
+
119
+ const headers = computed(() => [
120
+ { title: "Item", value: "name" },
121
+ { title: "In store", value: "onHand" },
122
+ { title: "Low stock alert at", value: "reorderLevel" },
123
+ ...(props.store.access.canManage || props.store.access.canApprove ? [{ title: "Unit price", value: "unitCost" }] : []),
124
+ ]);
125
+
126
+ const money = (v: number) => `$${Number(v).toFixed(2)}`;
127
+
128
+ async function load() {
129
+ loading.value = true;
130
+ try {
131
+ const res = await getItems(props.store._id, {
132
+ page: page.value,
133
+ limit,
134
+ search: search.value || "",
135
+ lowStock: lowOnly.value || undefined,
136
+ includeInactive: props.store.access.canManage || undefined,
137
+ });
138
+ items.value = res.items;
139
+ pages.value = res.pages;
140
+ total.value = res.total;
141
+ lowCount.value = res.lowCount;
142
+ } catch {
143
+ items.value = [];
144
+ } finally {
145
+ loading.value = false;
146
+ }
147
+ }
148
+
149
+ const lines = reactive({ show: false, mode: "receive" as "receive" | "issue" | "request" });
150
+ function open(mode: "receive" | "issue" | "request") {
151
+ Object.assign(lines, { show: true, mode });
152
+ }
153
+
154
+ const itemDialog = reactive({ show: false, item: null as TInventoryItem | null });
155
+ function editItem(item: TInventoryItem | null) {
156
+ detail.show = false;
157
+ Object.assign(itemDialog, { show: true, item });
158
+ }
159
+
160
+ const detail = reactive({ show: false, item: null as TInventoryItem | null });
161
+ function openItem(item: TInventoryItem) {
162
+ Object.assign(detail, { show: true, item });
163
+ }
164
+
165
+ const showImport = ref(false);
166
+
167
+ function done() {
168
+ load();
169
+ emit("changed");
170
+ }
171
+
172
+ watch(page, load);
173
+ watch(lowOnly, () => (page.value === 1 ? load() : (page.value = 1)));
174
+ watch(search, debounce(() => (page.value === 1 ? load() : (page.value = 1)), 400));
175
+ watch(() => props.store._id, () => (page.value === 1 ? load() : (page.value = 1)));
176
+ onMounted(load);
177
+ </script>
@@ -0,0 +1,81 @@
1
+ <template>
2
+ <div>
3
+ <div class="d-flex flex-wrap ga-2 align-center mb-3">
4
+ <div class="text-body-2 text-medium-emphasis">Stock currently in each person's hands, taken from this store and not yet used or returned.</div>
5
+ <v-spacer />
6
+ <v-text-field v-model="search" density="compact" placeholder="Search name or item" clearable hide-details append-inner-icon="mdi-magnify" style="max-width: 280px" />
7
+ </div>
8
+
9
+ <v-progress-linear v-if="loading" indeterminate color="primary" />
10
+ <div v-else-if="!groups.length" class="text-center text-medium-emphasis py-10">Nobody is holding stock from this store.</div>
11
+
12
+ <AppCard v-for="g in groups" :key="g.holder" class="pa-4 mb-3">
13
+ <div class="d-flex align-center mb-2">
14
+ <div class="font-weight-medium">{{ g.holderName || "Unnamed" }}</div>
15
+ <v-spacer />
16
+ <v-btn class="text-none screen-btn-ghost" variant="outlined" size="small" prepend-icon="mdi-keyboard-return" @click="openReturn(g)">Receive return</v-btn>
17
+ </div>
18
+ <div class="d-flex flex-wrap ga-2">
19
+ <v-chip v-for="h in g.items" :key="h._id" variant="tonal">{{ h.itemName }}: {{ h.qty }} {{ h.unit }}</v-chip>
20
+ </div>
21
+ </AppCard>
22
+
23
+ <InventoryLinesDialog
24
+ v-model="ret.show"
25
+ mode="return"
26
+ :store="store"
27
+ :holder-id="ret.holder"
28
+ :holder-name="ret.holderName"
29
+ :holdings="ret.items"
30
+ @done="changed"
31
+ />
32
+ </div>
33
+ </template>
34
+
35
+ <script setup lang="ts">
36
+ import useInventory from "../composables/useInventory";
37
+
38
+ const props = defineProps({ store: { type: Object as PropType<TInventoryStore>, required: true } });
39
+ const emit = defineEmits(["changed"]);
40
+
41
+ const { getHoldings } = useInventory();
42
+ const holdings = ref<TInventoryHolding[]>([]);
43
+ const loading = ref(false);
44
+ const search = ref("");
45
+
46
+ const groups = computed(() => {
47
+ const q = (search.value || "").toLowerCase();
48
+ const map = new Map<string, { holder: string; holderName: string; items: TInventoryHolding[] }>();
49
+ for (const h of holdings.value) {
50
+ if (q && !h.holderName.toLowerCase().includes(q) && !h.itemName.toLowerCase().includes(q)) continue;
51
+ const key = String(h.holder);
52
+ if (!map.has(key)) map.set(key, { holder: key, holderName: h.holderName, items: [] });
53
+ map.get(key)!.items.push(h);
54
+ }
55
+ return [...map.values()];
56
+ });
57
+
58
+ async function load() {
59
+ loading.value = true;
60
+ try {
61
+ holdings.value = await getHoldings(props.store._id, "all");
62
+ } catch {
63
+ holdings.value = [];
64
+ } finally {
65
+ loading.value = false;
66
+ }
67
+ }
68
+
69
+ const ret = reactive({ show: false, holder: "", holderName: "", items: [] as TInventoryHolding[] });
70
+ function openReturn(g: { holder: string; holderName: string; items: TInventoryHolding[] }) {
71
+ Object.assign(ret, { show: true, holder: g.holder, holderName: g.holderName, items: g.items });
72
+ }
73
+
74
+ function changed() {
75
+ load();
76
+ emit("changed");
77
+ }
78
+
79
+ watch(() => props.store._id, load);
80
+ onMounted(load);
81
+ </script>
@@ -0,0 +1,203 @@
1
+ <template>
2
+ <v-dialog v-model="show" max-width="620" persistent scrollable>
3
+ <v-card v-if="holding" class="screen-modal">
4
+ <v-card-title class="d-flex align-center">
5
+ Record Usage
6
+ <v-spacer />
7
+ <v-btn icon="mdi-close" variant="text" class="screen-modal__close" aria-label="Close" @click="show = false" />
8
+ </v-card-title>
9
+ <v-card-text class="screen-modal__body">
10
+ <div class="font-weight-medium">{{ holding.itemName }}</div>
11
+ <div class="text-body-2 text-medium-emphasis mb-4">You have {{ holding.qty }} {{ holding.unit }} in hand.</div>
12
+ <v-form ref="form">
13
+ <InputLabel title="How many did you use?" required class="mb-1" />
14
+ <v-text-field
15
+ v-model.number="qty"
16
+ type="number"
17
+ min="1"
18
+ :max="holding.qty"
19
+ :suffix="holding.unit"
20
+ density="comfortable"
21
+ style="max-width: 200px"
22
+ :rules="[(v: any) => (Number.isInteger(Number(v)) && Number(v) >= 1 && Number(v) <= holding!.qty) || `1 to ${holding!.qty}`]"
23
+ />
24
+
25
+ <InputLabel title="Where?" required class="mb-1" />
26
+ <v-btn-toggle v-model="where" mandatory divided variant="outlined" density="comfortable" class="mb-3">
27
+ <v-btn value="tenant_unit" class="text-none" prepend-icon="mdi-door">Tenant unit</v-btn>
28
+ <v-btn value="common_area" class="text-none" prepend-icon="mdi-office-building-outline">Common area</v-btn>
29
+ </v-btn-toggle>
30
+
31
+ <v-select
32
+ v-if="store.sites.length > 1"
33
+ v-model="site"
34
+ :items="siteChoices"
35
+ item-title="name"
36
+ item-value="_id"
37
+ label="Property"
38
+ density="comfortable"
39
+ :rules="[requiredRule]"
40
+ />
41
+
42
+ <v-autocomplete
43
+ v-if="where === 'tenant_unit'"
44
+ v-model="unit"
45
+ :items="units"
46
+ item-title="name"
47
+ item-value="_id"
48
+ label="Unit"
49
+ placeholder="Search unit or tenant name"
50
+ density="comfortable"
51
+ no-filter
52
+ :loading="unitsLoading"
53
+ :rules="[requiredRule]"
54
+ @update:search="searchUnits"
55
+ >
56
+ <template #item="{ props: p, item }">
57
+ <v-list-item v-bind="p" :subtitle="item.raw.tenantName" />
58
+ </template>
59
+ </v-autocomplete>
60
+ <v-combobox
61
+ v-else
62
+ v-model="area"
63
+ :items="areas"
64
+ label="Common area"
65
+ placeholder="e.g. Lift lobby L3"
66
+ density="comfortable"
67
+ :rules="[requiredRule]"
68
+ />
69
+
70
+ <InputLabel title="Work order / reference no. (optional)" class="mb-1" />
71
+ <v-text-field v-model="reference" density="comfortable" placeholder="e.g. EE202507-0002" />
72
+
73
+ <v-row dense>
74
+ <v-col cols="12" sm="6">
75
+ <InputLabel title="Photo before (optional)" class="mb-1" />
76
+ <InventoryPhotoInput v-model="photosBefore" :max="3" />
77
+ </v-col>
78
+ <v-col cols="12" sm="6">
79
+ <InputLabel title="Photo after (optional)" class="mb-1" />
80
+ <InventoryPhotoInput v-model="photosAfter" :max="3" />
81
+ </v-col>
82
+ </v-row>
83
+
84
+ <InputLabel title="Date used" class="mb-1 mt-3" />
85
+ <v-text-field v-model="date" type="date" :max="today" density="comfortable" style="max-width: 200px" />
86
+ <InputLabel title="Remarks (optional)" class="mb-1" />
87
+ <v-textarea v-model="remarks" rows="2" auto-grow density="comfortable" />
88
+ </v-form>
89
+ </v-card-text>
90
+ <div class="screen-modal__footer">
91
+ <v-btn class="screen-btn-ghost" variant="outlined" :disabled="saving" @click="show = false">Cancel</v-btn>
92
+ <v-btn class="screen-btn-primary" variant="flat" :loading="saving" @click="save">Save usage</v-btn>
93
+ </div>
94
+ </v-card>
95
+ </v-dialog>
96
+ </template>
97
+
98
+ <script setup lang="ts">
99
+ import useInventory, { pickedDate } from "../composables/useInventory";
100
+ import useUtils from "../composables/useUtils";
101
+
102
+ const show = defineModel<boolean>({ default: false });
103
+ const props = defineProps({
104
+ store: { type: Object as PropType<TInventoryStore>, required: true },
105
+ siteId: { type: String, required: true },
106
+ holding: { type: Object as PropType<TInventoryHolding | null>, default: null },
107
+ sites: { type: Array as PropType<{ _id: string; name: string }[]>, default: () => [] },
108
+ });
109
+ const emit = defineEmits(["done"]);
110
+
111
+ const api = useInventory();
112
+ const { requiredRule, debounce } = useUtils();
113
+ const notify = inject<(text: string, color?: string) => void>("inventoryNotify", () => {});
114
+
115
+ const form = ref();
116
+ const saving = ref(false);
117
+ const today = new Date().toLocaleDateString("en-CA");
118
+ const qty = ref<number | null>(1);
119
+ const where = ref<"tenant_unit" | "common_area">("tenant_unit");
120
+ const site = ref(props.siteId);
121
+ const unit = ref("");
122
+ const area = ref("");
123
+ const reference = ref("");
124
+ const remarks = ref("");
125
+ const date = ref(today);
126
+ const photosBefore = ref<string[]>([]);
127
+ const photosAfter = ref<string[]>([]);
128
+
129
+ const siteChoices = computed(() =>
130
+ props.sites.length ? props.sites : props.store.sites.map((_id) => ({ _id, name: _id === props.siteId ? "This property" : "Other property" })),
131
+ );
132
+
133
+ const units = ref<{ _id: string; name: string; tenantName: string }[]>([]);
134
+ const unitsLoading = ref(false);
135
+ const searchUnits = debounce(async (q: string) => {
136
+ if (!site.value) return;
137
+ unitsLoading.value = true;
138
+ try {
139
+ units.value = await api.getUnits(props.store._id, site.value, q || "");
140
+ } catch {
141
+ units.value = [];
142
+ } finally {
143
+ unitsLoading.value = false;
144
+ }
145
+ }, 300);
146
+
147
+ const areas = ref<string[]>([]);
148
+ async function loadAreas() {
149
+ try {
150
+ areas.value = await api.getCommonAreas(props.store._id, site.value);
151
+ } catch {
152
+ areas.value = [];
153
+ }
154
+ }
155
+
156
+ async function save() {
157
+ const { valid } = await form.value.validate();
158
+ if (!valid || !props.holding) return;
159
+ saving.value = true;
160
+ try {
161
+ await api.recordUsage(props.store._id, {
162
+ site: site.value,
163
+ item: props.holding.item,
164
+ qty: Number(qty.value),
165
+ locationType: where.value,
166
+ ...(where.value === "tenant_unit" ? { unit: unit.value } : { area: area.value }),
167
+ reference: reference.value,
168
+ date: pickedDate(date.value),
169
+ photosBefore: photosBefore.value,
170
+ photosAfter: photosAfter.value,
171
+ remarks: remarks.value,
172
+ });
173
+ notify("Usage saved.");
174
+ show.value = false;
175
+ emit("done");
176
+ } catch (error: any) {
177
+ notify(error?.data?.message || "Could not save the usage.", "error");
178
+ } finally {
179
+ saving.value = false;
180
+ }
181
+ }
182
+
183
+ watch(site, () => {
184
+ unit.value = "";
185
+ searchUnits("");
186
+ loadAreas();
187
+ });
188
+
189
+ watch(show, (open) => {
190
+ if (!open) return;
191
+ photosBefore.value = [];
192
+ photosAfter.value = [];
193
+ qty.value = 1;
194
+ unit.value = "";
195
+ area.value = "";
196
+ reference.value = "";
197
+ remarks.value = "";
198
+ date.value = today;
199
+ site.value = props.store.sites.includes(props.siteId) ? props.siteId : props.store.sites[0];
200
+ searchUnits("");
201
+ loadAreas();
202
+ });
203
+ </script>
@@ -388,9 +388,27 @@ watch(
388
388
  const roles = ref<any[]>([])
389
389
  const { getRoles } = useRole()
390
390
 
391
+ /*
392
+ * `type` is the ROLE type, not the service the client subscribes to, and the
393
+ * only caller (`ClientMain.vue` "Invite Client") passes no `app` prop -- so
394
+ * this sent `type: ""` and the endpoint applied no type filter at all. The
395
+ * dropdown therefore listed every org-less role of every type, which includes
396
+ * the platform's OWN staff roles (`type: "admin"` -- the two rows the console's
397
+ * `/super-admin/role-permissions` screen edits). Offering a Seven365 console
398
+ * staff role on a CLIENT invitation is the defect.
399
+ *
400
+ * A client admin's role is `type: "organization"`, which is what the client
401
+ * roles screen (`org/[organization]/roles-permissions.vue`) already lists. This
402
+ * narrows to exactly that. It is a narrowing of this one picker only: no role
403
+ * changes, no permission changes, and the org-less `organization` roles that
404
+ * were already being picked are all still offered.
405
+ *
406
+ * Keying off the selected service instead would empty the dropdown -- no
407
+ * org-less role carries a service type -- so `props.app` is not the filter.
408
+ */
391
409
  const { data: roleData, refresh: refreshRoles } = await useLazyAsyncData(
392
410
  "roles",
393
- () => getRoles({ org: org.value?._id, type: props.app, limit: 50 }),
411
+ () => getRoles({ org: org.value?._id, type: "organization", limit: 50 }),
394
412
  { watch: [() => props.app] }
395
413
  )
396
414
 
@@ -41,6 +41,11 @@
41
41
  @click="toggleTheme"
42
42
  />
43
43
 
44
+ <NotificationBell
45
+ v-if="props.showNotifications"
46
+ :site-id="routeSiteId"
47
+ />
48
+
44
49
  <v-menu offset="10px" :close-on-content-click="false">
45
50
  <template #activator="{ props }">
46
51
  <v-btn fab variant="text" icon v-bind="props" class="ms-2 me-1">
@@ -96,6 +101,18 @@ const props = defineProps({
96
101
  type: Boolean,
97
102
  default: false,
98
103
  },
104
+ /**
105
+ * Whether to show the notification bell.
106
+ *
107
+ * Off by default, and opt-in per application rather than always on: this
108
+ * header is mounted by every app in the estate, and only the ones whose
109
+ * modules actually raise notifications should grow a bell that would
110
+ * otherwise sit there permanently empty.
111
+ */
112
+ showNotifications: {
113
+ type: Boolean,
114
+ default: false,
115
+ },
99
116
  });
100
117
 
101
118
  const menu = defineModel("menu", { type: Boolean });
@@ -128,6 +145,15 @@ const { currentUser } = useLocalAuth();
128
145
  */
129
146
  const { site } = useSite();
130
147
 
148
+ /**
149
+ * The site the user is currently inside, straight off the route. Empty outside
150
+ * a site, where the feed falls back to everything addressed to this user.
151
+ */
152
+ const routeSiteId = computed(() => {
153
+ const param = useRoute().params.site;
154
+ return typeof param === "string" ? param : "";
155
+ });
156
+
131
157
  /**
132
158
  * The shared `site` state is only populated by the screens that load a site
133
159
  * document, so on most screens - the dashboard included - the bar had no name