@7365admin1/layer-common 4.170.1 → 4.170.2
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/InventoryImportDialog.vue +1 -1
- package/components/InventoryItemDetail.vue +1 -0
- package/components/InventoryItemDialog.vue +45 -11
- package/components/InventoryReportsTab.vue +1 -1
- package/package.json +1 -1
- package/utils/inventory-store-label.ts +13 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.170.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8d069ca: Inventory Add item: the quantity in store now sits right under the item name; Packing is now "Pack size (info only)". Saving a new item with 0 in store and a bare-number pack size asks "Did you mean N in stock?". Pack size label everywhere; item detail says when no stock has been recorded yet.
|
|
8
|
+
|
|
3
9
|
## 4.170.1
|
|
4
10
|
|
|
5
11
|
### Patch Changes
|
|
@@ -3873,11 +3879,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
|
|
|
3873
3879
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
3874
3880
|
own rule from two endpoints the console already calls, unprojected:
|
|
3875
3881
|
|
|
3876
|
-
|
|
3877
|
-
|
|
3882
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
3883
|
+
GET /api/roles/id/:role that membership's role document
|
|
3878
3884
|
|
|
3879
|
-
|
|
3880
|
-
|
|
3885
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
3886
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
3881
3887
|
|
|
3882
3888
|
`role.default` is the marker because it is the only property of a platform
|
|
3883
3889
|
staff role no API caller can set - `role.controller.ts` validates create and
|
|
@@ -35,7 +35,7 @@ const COPY = {
|
|
|
35
35
|
items: {
|
|
36
36
|
title: "Import Items from Excel",
|
|
37
37
|
noun: "items",
|
|
38
|
-
fill: "One row per item. Unit,
|
|
38
|
+
fill: "One row per item. Unit, Pack size, Category and Supplier have dropdowns with this store's values (a new supplier can still be typed in). Pack size is info only — put how many you have in Quantity In Store Now; it and the columns after it are the opening stock (date, supplier, PO no.), recorded like a delivery.",
|
|
39
39
|
duplicate: "Items already in the store are skipped and never changed, so uploading twice never doubles stock.",
|
|
40
40
|
file: "inventory-items",
|
|
41
41
|
done: (n: number) => `${n} item(s) added.`,
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<v-img v-if="item.photo" :src="getFileUrl(item.photo)" width="120" height="120" cover class="rounded flex-grow-0" />
|
|
12
12
|
<div class="flex-grow-1">
|
|
13
13
|
<div class="text-h5 mb-1" :class="item.lowStock ? 'text-error' : ''">{{ qtyUnit(item.onHand, item.unit) }} in store</div>
|
|
14
|
+
<div v-if="!item.onHand && !history.length && !loading" class="text-body-2 text-medium-emphasis mb-1">No stock recorded yet — use Receive Stock to add some.</div>
|
|
14
15
|
<div v-if="item.reserved" class="text-body-2 mb-1">{{ availableText(item) }} (the rest is set aside for requests waiting for approval)</div>
|
|
15
16
|
<div v-if="item.lowStockAlert" class="text-body-2 text-error mb-1">{{ lowStockAlertText(item.lowStockAlert, standardFormatDate) }}</div>
|
|
16
17
|
<div class="text-body-2 text-medium-emphasis">
|
|
@@ -10,14 +10,20 @@
|
|
|
10
10
|
<v-form ref="form" validate-on="blur invalid-input">
|
|
11
11
|
<InputLabel title="Item name" required class="mb-1" />
|
|
12
12
|
<v-text-field v-model="f.name" :rules="[requiredRule]" density="comfortable" placeholder="e.g. Philips T8 2ft 9W LED Tube" />
|
|
13
|
+
<!-- The stock quantity sits right under the name so it is never mistaken for Pack size (owner 2026-11-05). -->
|
|
14
|
+
<div v-if="!item" class="text-subtitle-2 mt-2 mb-1">How many do you have now?</div>
|
|
13
15
|
<v-row dense>
|
|
14
16
|
<v-col cols="12" sm="4">
|
|
15
17
|
<InputLabel title="Unit" required class="mb-1" />
|
|
16
18
|
<v-combobox v-model="f.unit" :items="units" :rules="[requiredRule]" density="comfortable" hint="How you count it (pcs, box, can)" persistent-hint />
|
|
17
19
|
</v-col>
|
|
20
|
+
<v-col v-if="!item" cols="12" sm="4">
|
|
21
|
+
<InputLabel title="Quantity in store now" class="mb-1" />
|
|
22
|
+
<v-text-field v-model.number="f.openingQty" type="number" min="0" density="comfortable" :rules="[wholeRule]" :suffix="f.unit || ''" hint="0 if you have none yet" persistent-hint />
|
|
23
|
+
</v-col>
|
|
18
24
|
<v-col cols="12" sm="4">
|
|
19
|
-
<InputLabel title="
|
|
20
|
-
<v-text-field v-model="f.packing" density="comfortable" placeholder="e.g. 25 pcs / box" maxlength="60" hint="How the supplier packs it
|
|
25
|
+
<InputLabel title="Pack size (info only)" class="mb-1" />
|
|
26
|
+
<v-text-field v-model="f.packing" density="comfortable" placeholder="e.g. 25 pcs / box — this is NOT the stock quantity" maxlength="60" hint="How the supplier packs it" persistent-hint />
|
|
21
27
|
</v-col>
|
|
22
28
|
<v-col cols="12" sm="4">
|
|
23
29
|
<InputLabel title="Item code" class="mb-1" />
|
|
@@ -53,21 +59,17 @@
|
|
|
53
59
|
</template>
|
|
54
60
|
<!-- Stock already on the shelf, recorded like a delivery (one "Opening stock" entry in the item's history). -->
|
|
55
61
|
<template v-if="!item">
|
|
56
|
-
<div class="text-subtitle-2 mt-4">
|
|
62
|
+
<div class="text-subtitle-2 mt-4">Stock in store now — details (optional)</div>
|
|
57
63
|
<div class="text-caption text-medium-emphasis mb-2">
|
|
58
|
-
|
|
59
|
-
Supplier and PO no. are optional — old stock may have none.
|
|
64
|
+
The quantity in store now is recorded like a delivery and shows in the item's history and the Purchases report as "Opening stock".
|
|
65
|
+
Supplier and PO no. are optional — old stock may have none.
|
|
60
66
|
</div>
|
|
61
67
|
<v-row dense>
|
|
62
|
-
<v-col cols="12" sm="
|
|
63
|
-
<InputLabel title="Quantity" class="mb-1" />
|
|
64
|
-
<v-text-field v-model.number="f.openingQty" type="number" min="0" density="comfortable" :rules="[wholeRule]" :suffix="f.unit || ''" hint="How many are in the store now" persistent-hint />
|
|
65
|
-
</v-col>
|
|
66
|
-
<v-col cols="12" sm="4">
|
|
68
|
+
<v-col cols="12" sm="6">
|
|
67
69
|
<InputLabel title="Date received (as at)" class="mb-1" />
|
|
68
70
|
<v-text-field v-model="f.openingDate" type="date" :max="today" density="comfortable" :disabled="!f.openingQty" hint="Blank = today" persistent-hint />
|
|
69
71
|
</v-col>
|
|
70
|
-
<v-col cols="12" sm="
|
|
72
|
+
<v-col cols="12" sm="6">
|
|
71
73
|
<InputLabel title="Received by" class="mb-1" />
|
|
72
74
|
<v-text-field v-model="f.openingReceivedBy" density="comfortable" maxlength="120" :disabled="!f.openingQty" placeholder="You" hint="Blank = you" persistent-hint />
|
|
73
75
|
</v-col>
|
|
@@ -97,6 +99,13 @@
|
|
|
97
99
|
/>
|
|
98
100
|
</v-form>
|
|
99
101
|
</v-card-text>
|
|
102
|
+
<v-alert v-if="packGuess" type="warning" variant="tonal" density="compact" class="mx-4 mb-2">
|
|
103
|
+
Quantity in store is 0. Did you mean {{ packGuess }} in stock?
|
|
104
|
+
<div class="d-flex flex-wrap ga-2 mt-2">
|
|
105
|
+
<v-btn class="text-none" color="primary" variant="flat" size="small" @click="usePackGuess">Use {{ packGuess }} as quantity</v-btn>
|
|
106
|
+
<v-btn class="text-none" variant="outlined" size="small" @click="keepZero">Keep 0</v-btn>
|
|
107
|
+
</div>
|
|
108
|
+
</v-alert>
|
|
100
109
|
<div class="screen-modal__footer">
|
|
101
110
|
<v-btn class="screen-btn-ghost" variant="outlined" :disabled="saving" @click="show = false">Cancel</v-btn>
|
|
102
111
|
<v-btn class="screen-btn-primary" variant="flat" :loading="saving" @click="save">{{ item ? "Save" : "Add item" }}</v-btn>
|
|
@@ -108,6 +117,7 @@
|
|
|
108
117
|
<script setup lang="ts">
|
|
109
118
|
import useInventory, { pickedDate } from "../composables/useInventory";
|
|
110
119
|
import useUtils from "../composables/useUtils";
|
|
120
|
+
import { packSizeLooksLikeQty } from "../utils/inventory-store-label";
|
|
111
121
|
import { normaliseUsedBy, nextUsedBy, USED_BY_ALL, USED_BY_ALL_LABEL, USED_BY_HINT, USED_BY_OPTIONS } from "../utils/inventory-used-by";
|
|
112
122
|
|
|
113
123
|
const usedByItems = [{ value: USED_BY_ALL, title: USED_BY_ALL_LABEL }, ...USED_BY_OPTIONS];
|
|
@@ -150,6 +160,24 @@ const today = new Date().toLocaleDateString("en-CA");
|
|
|
150
160
|
const f = reactive(blank());
|
|
151
161
|
const photo = ref<string[]>([]);
|
|
152
162
|
const inUse = ref(true);
|
|
163
|
+
/** A bare-number pack size on a new item with 0 in store: asked once before saving. */
|
|
164
|
+
const packGuess = ref<number | null>(null);
|
|
165
|
+
const zeroConfirmed = ref(false);
|
|
166
|
+
watch(() => [f.openingQty, f.packing], () => {
|
|
167
|
+
packGuess.value = null;
|
|
168
|
+
zeroConfirmed.value = false;
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
function usePackGuess() {
|
|
172
|
+
f.openingQty = packGuess.value!;
|
|
173
|
+
f.packing = "";
|
|
174
|
+
save();
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function keepZero() {
|
|
178
|
+
zeroConfirmed.value = true;
|
|
179
|
+
save();
|
|
180
|
+
}
|
|
153
181
|
|
|
154
182
|
watch(show, (open) => {
|
|
155
183
|
if (!open) return;
|
|
@@ -157,11 +185,17 @@ watch(show, (open) => {
|
|
|
157
185
|
Object.assign(f, blank(), i ? { name: i.name, unit: i.unit, packing: i.packing ?? "", code: i.code, category: i.category, reorderLevel: i.reorderLevel, unitCost: i.unitCost ?? 0, description: i.description, usedBy: normaliseUsedBy(i.usedBy) } : {});
|
|
158
186
|
photo.value = i?.photo ? [i.photo] : [];
|
|
159
187
|
inUse.value = i ? i.status === "active" : true;
|
|
188
|
+
packGuess.value = null;
|
|
189
|
+
zeroConfirmed.value = false;
|
|
160
190
|
});
|
|
161
191
|
|
|
162
192
|
async function save() {
|
|
163
193
|
const { valid } = await form.value.validate();
|
|
164
194
|
if (!valid) return;
|
|
195
|
+
if (!props.item && !zeroConfirmed.value) {
|
|
196
|
+
packGuess.value = packSizeLooksLikeQty(f.packing, f.openingQty);
|
|
197
|
+
if (packGuess.value) return;
|
|
198
|
+
}
|
|
165
199
|
saving.value = true;
|
|
166
200
|
const body = {
|
|
167
201
|
name: f.name,
|
|
@@ -422,7 +422,7 @@ const headers: Record<string, any[]> = {
|
|
|
422
422
|
movement: [
|
|
423
423
|
{ title: "Item", key: "name" },
|
|
424
424
|
{ title: "Unit", key: "unit" },
|
|
425
|
-
{ title: "
|
|
425
|
+
{ title: "Pack size", key: "packing" },
|
|
426
426
|
{ title: "Start", key: "opening" },
|
|
427
427
|
{ title: "Received", key: "received" },
|
|
428
428
|
{ title: "Purchase cost", key: "receivedCost" },
|
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.170.
|
|
5
|
+
"version": "4.170.2",
|
|
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.",
|
|
@@ -62,13 +62,24 @@ export function inventorySiteOptions(
|
|
|
62
62
|
|
|
63
63
|
type TItemLike = { code?: string; category?: string; packing?: string };
|
|
64
64
|
|
|
65
|
-
/** "Code 001 · Bulb ·
|
|
65
|
+
/** "Code 001 · Bulb · Pack size: 25" - each figure says what it is, never a bare number. */
|
|
66
66
|
export function inventoryItemMeta(item: TItemLike) {
|
|
67
|
-
return [item.code && `Code ${item.code}`, item.category, item.packing && `
|
|
67
|
+
return [item.code && `Code ${item.code}`, item.category, item.packing && `Pack size: ${item.packing}`]
|
|
68
68
|
.filter(Boolean)
|
|
69
69
|
.join(" · ");
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
+
/**
|
|
73
|
+
* A pack size typed as a bare number ("50") on a new item with 0 in store is usually the stock
|
|
74
|
+
* quantity in the wrong box (owner 2026-11-05: "available is 0 but there's 50 packing").
|
|
75
|
+
* Returns that number so the form can ask; null when the pack size reads like a pack size.
|
|
76
|
+
*/
|
|
77
|
+
export function packSizeLooksLikeQty(packing: unknown, qty: unknown): number | null {
|
|
78
|
+
if (Number(qty || 0) !== 0) return null;
|
|
79
|
+
const m = /^\s*(\d+)\s*$/.exec(String(packing ?? ""));
|
|
80
|
+
return m && Number(m[1]) > 0 ? Number(m[1]) : null;
|
|
81
|
+
}
|
|
82
|
+
|
|
72
83
|
/**
|
|
73
84
|
* "How inventory works" (owner 2026-11-05): the three ways clients run stock, in the words the screens use.
|
|
74
85
|
* The mobile apps carry the same sentences; change both together.
|