@7365admin1/layer-common 4.97.1-staging.708 → 4.97.1-staging.710
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.
|
@@ -673,7 +673,7 @@ const qrError = ref("");
|
|
|
673
673
|
const qrLinkHint = computed(() => (qrCodeToLink.value ? stickerCodeHint(qrCodeToLink.value) : ""));
|
|
674
674
|
// the combobox keeps a typed-but-not-committed code in its search text
|
|
675
675
|
const qrSearch = ref("");
|
|
676
|
-
// the pick-list's stickers ("TLR002 -
|
|
676
|
+
// the pick-list's stickers ("TLR002" - the long code only for an unnumbered sticker), by sticker number with the next one first
|
|
677
677
|
const qrPicks = ref<BlankPick[]>([]);
|
|
678
678
|
const qrCodes = computed(() => qrPicks.value.map(blankPickLabel));
|
|
679
679
|
const qrSummary = ref<BlankSummary | null>(null);
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<span class="d-inline-flex align-center ga-1 text-caption" data-test="vehicle-sticker-code">
|
|
3
3
|
<span v-if="label" class="text-medium-emphasis">{{ label }}</span>
|
|
4
|
-
|
|
4
|
+
<!-- the long code is hidden (owner 2026-11-17: too long; the sticker number beside it is what people use) - copy still gives it -->
|
|
5
5
|
<v-btn :icon="copied ? 'mdi-check' : 'mdi-content-copy'" flat size="x-small" density="compact"
|
|
6
|
-
aria-label="Copy sticker code" @click.stop="copy" />
|
|
6
|
+
aria-label="Copy sticker code" title="Copy sticker code" @click.stop="copy" />
|
|
7
7
|
</span>
|
|
8
8
|
</template>
|
|
9
9
|
|
|
10
10
|
<script setup lang="ts">
|
|
11
|
-
//
|
|
11
|
+
// Copy button for a sticker's long code (the code itself is not shown). Shown only when the server sent it.
|
|
12
12
|
const props = defineProps<{ code: string; label?: string }>();
|
|
13
13
|
const copied = ref(false);
|
|
14
14
|
async function copy() {
|
|
@@ -21,7 +21,3 @@ async function copy() {
|
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
</script>
|
|
24
|
-
|
|
25
|
-
<style scoped>
|
|
26
|
-
.vehicle-sticker-code { font-size: 0.75rem; letter-spacing: 0.02em; }
|
|
27
|
-
</style>
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@7365admin1/layer-common",
|
|
3
3
|
"license": "MIT",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"version": "4.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.710",
|
|
6
6
|
"author": "7365admin1",
|
|
7
7
|
"main": "./nuxt.config.ts",
|
|
8
8
|
"//files": "What a consumer extending this layer actually loads. Without this npm ships the whole working tree - the changesets, the CI workflows, the render harness in tools/ and any scratch directory that happened to exist at publish time. Nuxt resolves a layer by directory, so every runtime directory below has to stay listed; adding a new top-level runtime directory means adding it here too.",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { routeDenied } from "../utils/module-routes.ts";
|
|
3
|
+
import { withMaOwnerMonitorViews } from "../utils/org-modules.ts";
|
|
3
4
|
import useStaffView, { STAFF_VIEW_ROLE, staffViewCovers } from "../composables/useStaffView.ts";
|
|
4
5
|
|
|
5
6
|
const hexSchema = z
|
|
@@ -244,7 +245,12 @@ export default defineNuxtPlugin(() => {
|
|
|
244
245
|
// The client's module list is asked for this org and site and does not
|
|
245
246
|
// need the role, so it goes out while the role is being read.
|
|
246
247
|
startDenied(userId, id.value ?? "", site);
|
|
247
|
-
|
|
248
|
+
const role = member.role ? await bounded(getRoleById(member.role)) : null;
|
|
249
|
+
// An MA owner's role also reads with the providers' monitoring views
|
|
250
|
+
// (owner 2026-11-17). Only a role that could be the owner grant needs the org.
|
|
251
|
+
const maybeOwner = role?.default === true && role?.type === "property_management_agency";
|
|
252
|
+
const org = maybeOwner && id.value ? await bounded(getById(id.value)).catch(() => null) : null;
|
|
253
|
+
userAppRole.value = withMaOwnerMonitorViews(role, org) ?? null;
|
|
248
254
|
} catch (error) {
|
|
249
255
|
// Anything that is not a 404 is transient. Stay unresolved so the next
|
|
250
256
|
// navigation tries again rather than denying for the rest of the session.
|
package/utils/org-modules.ts
CHANGED
|
@@ -256,6 +256,35 @@ function isKey(value: unknown): value is string {
|
|
|
256
256
|
* its own nature holding an enumerated list, and only roles of that nature are
|
|
257
257
|
* capped. Anything else - every client invited before this - returns `null`.
|
|
258
258
|
*/
|
|
259
|
+
/**
|
|
260
|
+
* The VIEW rights a managing agent's OWNER holds on the providers' records it
|
|
261
|
+
* monitors (owner decision 2026-11-17), even when Super Admin chose the owner's
|
|
262
|
+
* permissions on Invite Client before these existed. Same strings as core
|
|
263
|
+
* `MA_OWNER_MONITOR_VIEWS` and API-core `site-authz.util`. View only.
|
|
264
|
+
*/
|
|
265
|
+
export const MA_OWNER_MONITOR_VIEWS: readonly string[] = Object.freeze([
|
|
266
|
+
"daily-occurrence-books:see-all-daily-occurrence",
|
|
267
|
+
"daily-occurrence-books:see-daily-occurrence-details",
|
|
268
|
+
"daily-occurrence-entries:see-daily-occurrence-entries-details",
|
|
269
|
+
"virtual-patrol:see-all-virtual-patrol-logs",
|
|
270
|
+
"attendance-mgmt:see-all-attendance",
|
|
271
|
+
"cleaning-schedule-mgmt:see-all-schedules",
|
|
272
|
+
]);
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* The signed-in person's role as the gates read it: an MA owner grant role
|
|
276
|
+
* (`ownerGrant`) also holds `MA_OWNER_MONITOR_VIEWS`. Any other role is returned
|
|
277
|
+
* unchanged. Read-only - the stored role is never written.
|
|
278
|
+
*/
|
|
279
|
+
export function withMaOwnerMonitorViews<R extends { permissions?: unknown }>(
|
|
280
|
+
role: R | null | undefined,
|
|
281
|
+
org: Parameters<typeof ownerGrant>[0],
|
|
282
|
+
): R | null | undefined {
|
|
283
|
+
const grant = ownerGrant(org, role as any, "property_management_agency");
|
|
284
|
+
if (!grant || !role) return role;
|
|
285
|
+
return { ...role, permissions: [...new Set([...(role.permissions as string[]), ...MA_OWNER_MONITOR_VIEWS])] };
|
|
286
|
+
}
|
|
287
|
+
|
|
259
288
|
export function ownerGrant(
|
|
260
289
|
org: { _id?: unknown; nature?: unknown; invitedRole?: unknown } | null | undefined,
|
|
261
290
|
grantRole: { _id?: unknown; org?: unknown; type?: unknown; default?: unknown; permissions?: unknown } | null | undefined,
|
|
@@ -271,7 +300,10 @@ export function ownerGrant(
|
|
|
271
300
|
Array.isArray(permissions) &&
|
|
272
301
|
permissions.length > 0 &&
|
|
273
302
|
!permissions.includes("*");
|
|
274
|
-
|
|
303
|
+
if (!chosen) return null;
|
|
304
|
+
const list = (permissions as unknown[]).map(String);
|
|
305
|
+
// An MA owner also holds the providers' monitoring views, so its staff may be given them.
|
|
306
|
+
return type === "property_management_agency" ? [...new Set([...list, ...MA_OWNER_MONITOR_VIEWS])] : list;
|
|
275
307
|
}
|
|
276
308
|
|
|
277
309
|
/**
|
|
@@ -166,10 +166,9 @@ export function blankPickSerial(i: Pick<BlankPick, "serialNo" | "serialLabel">):
|
|
|
166
166
|
return n ? String(i.serialLabel ?? "").trim() || `No. ${n}` : "";
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
-
/** "TLR002
|
|
169
|
+
/** "TLR002" - the long code only for a sticker with no number (owner 2026-11-17: the code is too long to read). */
|
|
170
170
|
export function blankPickLabel(i: BlankPick): string {
|
|
171
|
-
|
|
172
|
-
return sn ? `${sn} - ${i.code}` : i.code;
|
|
171
|
+
return blankPickSerial(i) || i.code;
|
|
173
172
|
}
|
|
174
173
|
|
|
175
174
|
/** Ascending by sticker number; stickers with no number last, in the order they came. */
|