@7365admin1/layer-common 4.61.0 → 4.61.1
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.
- package/CHANGELOG.md +10 -4
- package/components/InventoryMain.vue +16 -3
- package/package.json +1 -1
- package/utils/inventory-store-label.ts +13 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.61.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 598f6c1: Inventory store switcher: when a person can see several stores of the same kind, each is named with its organisation ("Property store · Margaret Ville"); more than three stores are chosen from a list instead of a row of identical buttons.
|
|
8
|
+
|
|
3
9
|
## 4.61.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -1667,11 +1673,11 @@
|
|
|
1667
1673
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
1668
1674
|
own rule from two endpoints the console already calls, unprojected:
|
|
1669
1675
|
|
|
1670
|
-
|
|
1671
|
-
|
|
1676
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
1677
|
+
GET /api/roles/id/:role that membership's role document
|
|
1672
1678
|
|
|
1673
|
-
|
|
1674
|
-
|
|
1679
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
1680
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
1675
1681
|
|
|
1676
1682
|
`role.default` is the marker because it is the only property of a platform
|
|
1677
1683
|
staff role no API caller can set - `role.controller.ts` validates create and
|
|
@@ -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.61.
|
|
5
|
+
"version": "4.61.1",
|
|
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
|
+
}
|