@7365admin1/layer-common 4.97.1-staging.679 → 4.97.1-staging.680

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.
@@ -80,6 +80,12 @@
80
80
  <v-btn class="text-none screen-btn-primary" variant="flat" @click="loadStores">Try again</v-btn>
81
81
  </AppCard>
82
82
 
83
+ <!-- The MA reading a provider's stock: nothing to set up here, so say so plainly. -->
84
+ <AppCard v-else-if="ownerService && !store" class="pa-6" data-test="provider-inventory-empty">
85
+ <div class="text-h6 mb-2">No stock list from this provider yet</div>
86
+ <p class="text-body-2">This provider has not set up its own store at this property, or your role cannot view inventory.</p>
87
+ </AppCard>
88
+
83
89
  <!-- No store yet: one clear next step, or one clear explanation. -->
84
90
  <!-- Also open when a provider sets up its own store beside the main store (scenario 3). -->
85
91
  <AppCard v-else-if="!store || showSetup" class="pa-6">
@@ -196,6 +202,7 @@ import {
196
202
  inventoryManagedBy,
197
203
  inventorySiteOptions,
198
204
  inventoryStoreLabel,
205
+ inventoryStoresFor,
199
206
  inventorySuppliesText,
200
207
  inventorySupplySites,
201
208
  inventoryTwoStoresText,
@@ -208,6 +215,12 @@ import useLocalAuth from "../composables/useLocalAuth";
208
215
  const props = defineProps({
209
216
  orgId: { type: String, required: true },
210
217
  siteId: { type: String, required: true },
218
+ /**
219
+ * The managing agent reading one provider's stock at its site (owner 13 Nov 2026): that
220
+ * provider's service key ("cleaning", "mne", "pest", "pool", "landscape"). Shows only that
221
+ * provider's store(s), view only - the API grants the MA nothing but the stock list there.
222
+ */
223
+ ownerService: { type: String, default: "" },
211
224
  });
212
225
 
213
226
  const movedFromEquipment = useRoute().query.moved === "equipment";
@@ -241,7 +254,7 @@ provide(
241
254
  computed(() => stores.value.find((s) => s.owner === true && !s.main) ?? null),
242
255
  );
243
256
  // Scenario 3: a provider at a property with a main store may add its own store; offered only when it has none here.
244
- const canSetUpOwnStore = computed(() => canManageInventory.value && !stores.value.some((s) => s.owner === true));
257
+ const canSetUpOwnStore = computed(() => !props.ownerService && canManageInventory.value && !stores.value.some((s) => s.owner === true));
245
258
  function openOwnStoreSetup() {
246
259
  // Never "Main Store": that is the property manager's store in every label.
247
260
  Object.assign(setup, { name: "Our Store", sites: [props.siteId] });
@@ -267,7 +280,7 @@ const storeSites = computed(() =>
267
280
  );
268
281
 
269
282
  // Another organisation's (main) store: the person requests from it and manages nothing there.
270
- const requestOnly = computed(() => Boolean(store.value && store.value.owner === false));
283
+ const requestOnly = computed(() => Boolean(!props.ownerService && store.value && store.value.owner === false));
271
284
  const managedBy = computed(() => (store.value ? inventoryManagedBy(store.value) : ""));
272
285
 
273
286
  const subtitle = computed(() => {
@@ -315,7 +328,7 @@ async function loadStores() {
315
328
  loading.value = true;
316
329
  loadError.value = "";
317
330
  try {
318
- stores.value = (await getStores(props.siteId)) ?? [];
331
+ stores.value = inventoryStoresFor((await getStores(props.siteId)) ?? [], props.ownerService);
319
332
  const fromLink = stores.value.find((s) => s._id === linked.storeId);
320
333
  linked.storeId = "";
321
334
  if (fromLink) storeId.value = fromLink._id;
@@ -5,11 +5,16 @@
5
5
  :org-id="orgId"
6
6
  :site="site"
7
7
  :service-type="serviceType"
8
- :text="embedded ? '' : FEATURE_SUBTITLE"
8
+ :text="embedded ? '' : readOnly ? READ_ONLY_SUBTITLE : FEATURE_SUBTITLE"
9
+ :read-only="readOnly"
9
10
  :how-title="embedded ? '' : 'How extra checks work'"
10
11
  how-key="extra-visits"
11
12
  >
12
13
  <ol class="sg-steps">
14
+ <li v-if="readOnly">
15
+ You can view this provider's extra checks here. Only the
16
+ provider can add, change, pause or delete them.
17
+ </li>
13
18
  <li>
14
19
  Every night the app makes the <strong>Daily Checklist</strong>
15
20
  for every area on this site. You do not need to do anything for
@@ -69,7 +74,8 @@
69
74
  <template #no-data>
70
75
  <div class="st-empty">
71
76
  <strong>No extra checks yet.</strong>
72
- <span>
77
+ <span v-if="readOnly">This provider has not added any extra checks at this site.</span>
78
+ <span v-else>
73
79
  Your Daily Checklist already covers the normal rounds. Add an
74
80
  extra check when an area needs one more check at a set time -
75
81
  for example "Lunch toilet check, Lobby Toilets, 2:00 pm every
@@ -511,8 +517,14 @@ const props = defineProps({
511
517
  canViewScheduleTaskDetails: { type: Boolean, default: false },
512
518
  /** Inside the Task Calendar page: its one help box replaces this page's own. */
513
519
  embedded: { type: Boolean, default: false },
520
+ /** The managing agent viewing a provider's extra checks (owner 13 Nov 2026): view-only wording. Pass every can-create/update/delete false. */
521
+ readOnly: { type: Boolean, default: false },
522
+ /** Where "open checklist" goes, relative to /[org]/[site]/, for an app whose Daily Checklist lives elsewhere (PM: services/<slug>/checklist). */
523
+ scheduleRoute: { type: String, default: "" },
514
524
  });
515
525
 
526
+ const READ_ONLY_SUBTITLE = "The provider's own checks at a set time, on top of the daily rounds. View only.";
527
+
516
528
  const { formatDate, debounce } = useUtils();
517
529
  const {
518
530
  getScheduleTasks,
@@ -530,7 +542,7 @@ const canViewScheduleTaskDetails = computed(
530
542
  () => props.canViewScheduleTaskDetails
531
543
  );
532
544
 
533
- const checklistRoute = scheduleNameFor(props.serviceType).route;
545
+ const checklistRoute = props.scheduleRoute || scheduleNameFor(props.serviceType).route;
534
546
 
535
547
  /** Opens the Daily Checklist filtered to the day this extra check was last added. */
536
548
  function openChecklist(row: Record<string, any>) {
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.679",
5
+ "version": "4.97.1-staging.680",
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.",
@@ -4,7 +4,7 @@
4
4
  * same kind (e.g. staff of several organisations at one property), each one
5
5
  * also names its organisation so the buttons can be told apart.
6
6
  */
7
- type TStoreLike = { ownerType: string; orgName?: string; main?: boolean; owner?: boolean; ownerServiceLabel?: string };
7
+ type TStoreLike = { ownerType: string; orgName?: string; main?: boolean; owner?: boolean; ownerService?: string | null; ownerServiceLabel?: string };
8
8
 
9
9
  /** "This store supplies: Winsland House I and Winsland House II" for a store that supplies several sites. */
10
10
  export function inventorySuppliesText(names: string[]) {
@@ -133,3 +133,16 @@ export function inventorySitePickerItems(
133
133
  return by ? { ...o, props: { disabled: true, subtitle: `Already supplied by ${by}` } } : { ...o };
134
134
  });
135
135
  }
136
+
137
+ /**
138
+ * Which of the site's stores a screen shows. The managing agent may VIEW each
139
+ * provider's store at its site (API-core, owner 13 Nov 2026); those appear
140
+ * only on the provider's own Inventory page under Services (`ownerService` =
141
+ * the provider's service key, e.g. "cleaning", "mne"), never in the MA's own
142
+ * Inventory. Without `ownerService` the list is what it was before: the main
143
+ * store and the person's own company stores.
144
+ */
145
+ export function inventoryStoresFor<T extends TStoreLike>(stores: T[], ownerService = ""): T[] {
146
+ if (ownerService) return stores.filter((s) => !s.main && s.owner === false && s.ownerService === ownerService);
147
+ return stores.filter((s) => s.main || s.owner !== false);
148
+ }