@7365admin1/layer-common 4.35.1-staging.417 → 4.35.1-staging.418
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.
|
@@ -2,8 +2,20 @@
|
|
|
2
2
|
<div class="inventory">
|
|
3
3
|
<PageHeader :title="store ? store.name : 'Inventory'" :subtitle="subtitle">
|
|
4
4
|
<template #actions>
|
|
5
|
+
<!-- Many stores (staff of several organisations at one property): a list, not a row of buttons. -->
|
|
6
|
+
<v-select
|
|
7
|
+
v-if="stores.length > 3"
|
|
8
|
+
v-model="storeId"
|
|
9
|
+
:items="stores"
|
|
10
|
+
:item-title="(s: TInventoryStore) => inventoryStoreLabel(s, stores)"
|
|
11
|
+
item-value="_id"
|
|
12
|
+
label="Store"
|
|
13
|
+
density="compact"
|
|
14
|
+
hide-details
|
|
15
|
+
style="min-width: 300px"
|
|
16
|
+
/>
|
|
5
17
|
<v-btn-toggle
|
|
6
|
-
v-if="stores.length > 1"
|
|
18
|
+
v-else-if="stores.length > 1"
|
|
7
19
|
v-model="storeId"
|
|
8
20
|
mandatory
|
|
9
21
|
density="comfortable"
|
|
@@ -11,7 +23,7 @@
|
|
|
11
23
|
divided
|
|
12
24
|
>
|
|
13
25
|
<v-btn v-for="s in stores" :key="s._id" :value="s._id" class="text-none">
|
|
14
|
-
{{ s
|
|
26
|
+
{{ inventoryStoreLabel(s, stores) }}
|
|
15
27
|
</v-btn>
|
|
16
28
|
</v-btn-toggle>
|
|
17
29
|
</template>
|
|
@@ -102,6 +114,7 @@
|
|
|
102
114
|
import useInventory from "../composables/useInventory";
|
|
103
115
|
import useSite from "../composables/useSite";
|
|
104
116
|
import useUtils from "../composables/useUtils";
|
|
117
|
+
import { inventoryStoreLabel } from "../utils/inventory-store-label";
|
|
105
118
|
|
|
106
119
|
const props = defineProps({
|
|
107
120
|
orgId: { type: String, required: true },
|
|
@@ -144,7 +157,7 @@ const storeSites = computed(() =>
|
|
|
144
157
|
const subtitle = computed(() => {
|
|
145
158
|
if (!store.value) return "";
|
|
146
159
|
if (storeSites.value.length > 1) return `Supplies ${storeSites.value.map((s) => s.name).join(", ")}`;
|
|
147
|
-
return store.value.
|
|
160
|
+
return inventoryStoreLabel(store.value, stores.value);
|
|
148
161
|
});
|
|
149
162
|
|
|
150
163
|
const tabs = computed(() => {
|
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.
|
|
5
|
+
"version": "4.35.1-staging.418",
|
|
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,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The store switcher's button text. "Property store" / "Our store" is enough
|
|
3
|
+
* when each kind appears once; when a person can see several stores of the
|
|
4
|
+
* same kind (e.g. staff of several organisations at one property), each one
|
|
5
|
+
* also names its organisation so the buttons can be told apart.
|
|
6
|
+
*/
|
|
7
|
+
type TStoreLike = { ownerType: string; orgName?: string };
|
|
8
|
+
|
|
9
|
+
export function inventoryStoreLabel(store: TStoreLike, all: TStoreLike[]) {
|
|
10
|
+
const kind = store.ownerType === "property" ? "Property store" : "Our store";
|
|
11
|
+
const sameKind = all.filter((s) => s.ownerType === store.ownerType).length;
|
|
12
|
+
return sameKind > 1 && store.orgName ? `${kind} · ${store.orgName}` : kind;
|
|
13
|
+
}
|