@7365admin1/layer-common 4.35.1-staging.384 → 4.35.1-staging.386

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.
@@ -28,7 +28,17 @@
28
28
  <v-expansion-panel-text>
29
29
  <v-row no-gutters class="d-flex justify-center py-10">
30
30
  <v-form class="w-100">
31
- <v-row>
31
+ <!--
32
+ Owner decision 2026-09-25: a site's details are its owning
33
+ client's. A provider that serves the site sees them read-only;
34
+ the server refuses the save too. Blocks and guard posts below
35
+ stay editable - they are the provider's operational settings.
36
+ -->
37
+ <v-alert v-if="siteDetailsLocked" type="info" variant="tonal" density="compact" class="mb-4"
38
+ data-test="site-info-owner-only">
39
+ {{ siteOwnerNote }}
40
+ </v-alert>
41
+ <v-row :inert="siteDetailsLocked" :class="{ 'opacity-60': siteDetailsLocked }">
32
42
  <!-- Cover Photo + Preview -->
33
43
  <v-col cols="12" lg="5" class="pt-0">
34
44
  <InputLabel title="Cover Photo (displayed in resident app)" class="d-block mb-2" />
@@ -58,10 +68,12 @@
58
68
  </v-col>
59
69
 
60
70
  <!-- Submit -->
61
- <v-col cols="12" class="pt-0 d-flex justify-end">
71
+ <v-col v-if="!siteDetailsLocked" cols="12" class="pt-0 d-flex justify-end">
62
72
  <v-btn color="primary-button" class="text-none" size="large" variant="flat" text="Save"
63
73
  :loading="savingSiteInfo" @click="saveSiteInfo" />
64
74
  </v-col>
75
+ </v-row>
76
+ <v-row>
65
77
 
66
78
  <!-- Divider -->
67
79
  <v-col cols="12" class="my-2">
@@ -290,6 +302,13 @@ const orgId = computed(
290
302
  () => props.orgId || String((siteData.value as TSite | null)?.orgId ?? "")
291
303
  );
292
304
 
305
+ // The site read says whether this caller may change the site's details (core
306
+ // 3.103). Absent on an older API = unknown, so nothing is locked here.
307
+ const siteDetailsLocked = computed(
308
+ () => (siteData.value as any)?.detailsEditable === false
309
+ );
310
+ const siteOwnerNote = computed(() => siteOwnerOnlyNote((siteData.value as any)?.ownerOrgName));
311
+
293
312
  watch(
294
313
  siteData,
295
314
  (val: TSite) => {
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.35.1-staging.384",
5
+ "version": "4.35.1-staging.386",
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.",
@@ -0,0 +1,9 @@
1
+ /**
2
+ * What a service provider is told on a site it serves but does not own
3
+ * (owner decision 2026-09-25: only the owning client changes a site's
4
+ * details). Same words as the server's refusal.
5
+ */
6
+ export function siteOwnerOnlyNote(ownerName?: string | null): string {
7
+ const name = String(ownerName ?? "").trim() || "another organisation";
8
+ return `This site belongs to ${name}. Only they can change its details.`;
9
+ }
@@ -36,14 +36,25 @@ type TNatureOption = { title?: string; value?: string };
36
36
  * else the label from the nature-of-business list, else the raw stored code
37
37
  * ("security_agency") as a last resort. `useLocal` can hand back a plain
38
38
  * array or a ref-like `{ value }` wrapper - read whichever shape was passed.
39
+ *
40
+ * `nature` is NOT always free text: both `_getServiceProviders` and the
41
+ * `customer.sites`-derived `getServiceProvidersForSite` aggregations in
42
+ * @7365admin1/core set it to `organization.nature`, the SAME raw code `type`
43
+ * carries ("security_agency") - not a human-typed description. Treating it as
44
+ * free text made the raw code win over the label lookup for every row, since
45
+ * `nature` is truthy whenever it is set at all. Only trust it as an override
46
+ * when it is NOT itself one of the known codes.
39
47
  */
40
48
  export function spTypeLabel(type: string, nature: string | undefined, source: unknown): string {
41
- if (nature && String(nature).trim()) return String(nature);
42
49
  const list = (Array.isArray(source) ? source : (source as any)?.value) as
43
50
  | TNatureOption[]
44
51
  | undefined;
45
- const hit = list?.find((x) => x.value === type);
46
- return hit?.title ?? type ?? "-";
52
+ const codeMatch = (value?: string) => list?.find((x) => x.value === value);
53
+
54
+ if (nature && String(nature).trim() && !codeMatch(nature)) return String(nature);
55
+
56
+ const hit = codeMatch(type) ?? codeMatch(nature);
57
+ return hit?.title ?? type ?? nature ?? "-";
47
58
  }
48
59
 
49
60
  export function spDay(value?: string | null): string {