@7365admin1/layer-common 4.17.1-staging.333 → 4.17.1-staging.335
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/components/HidAccessLogDashboard.vue +29 -5
- package/components/InventoryItemDetail.vue +1 -1
- package/components/InventoryItemDialog.vue +7 -2
- package/components/InventoryMyStockTab.vue +4 -4
- package/components/InventoryReportsTab.vue +2 -0
- package/components/InventoryStockTab.vue +1 -1
- package/components/InventoryTechniciansTab.vue +1 -1
- package/components/InventoryUsageDialog.vue +5 -0
- package/composables/useInventory.ts +2 -1
- package/package.json +1 -1
- package/types/inventory.d.ts +5 -0
|
@@ -401,7 +401,10 @@ const exportForm = reactive({
|
|
|
401
401
|
});
|
|
402
402
|
|
|
403
403
|
const statusOptions = ["Authorized", "Not Authorized", "Unknown"];
|
|
404
|
-
const accessMethodFilterOptions = ["Facial", "QR Code", "ID and Password", "PIN", "Card"];
|
|
404
|
+
const accessMethodFilterOptions = ["Facial", "QR Code", "ID and Password", "PIN", "Card", "Intercom"];
|
|
405
|
+
|
|
406
|
+
/** The persisted event the resident app records when it opens a door on a call. */
|
|
407
|
+
const INTERCOM_DOOR_OPEN_EVENT = "intercom_door_open";
|
|
405
408
|
const accessMethodOptions = ["All", ...accessMethodFilterOptions];
|
|
406
409
|
|
|
407
410
|
const readerOptions = computed(() =>
|
|
@@ -606,7 +609,7 @@ async function loadDashboard() {
|
|
|
606
609
|
resetDashboardData();
|
|
607
610
|
try {
|
|
608
611
|
const isVisitorTab = activeTab.value === "visitor";
|
|
609
|
-
const [logResponse, hidAccessLogResponse, visitorResponse, readerUserResponse] = await Promise.all([
|
|
612
|
+
const [logResponse, intercomLogResponse, hidAccessLogResponse, visitorResponse, readerUserResponse] = await Promise.all([
|
|
610
613
|
loadDashboardSource(
|
|
611
614
|
getLogs(selectedReaderId.value, {
|
|
612
615
|
page: page.value,
|
|
@@ -615,6 +618,20 @@ async function loadDashboard() {
|
|
|
615
618
|
null,
|
|
616
619
|
"persisted access logs",
|
|
617
620
|
),
|
|
621
|
+
// Door opens from the resident app during an intercom call. The reader
|
|
622
|
+
// never logs a DTMF door open, so these exist only as persisted events
|
|
623
|
+
// and are fetched by type: the general page above is shared with every
|
|
624
|
+
// other event the reader emits and is dropped whenever the reader has
|
|
625
|
+
// live logs, which it always has.
|
|
626
|
+
loadDashboardSource(
|
|
627
|
+
getLogs(selectedReaderId.value, {
|
|
628
|
+
page: page.value,
|
|
629
|
+
limit,
|
|
630
|
+
type: INTERCOM_DOOR_OPEN_EVENT,
|
|
631
|
+
}),
|
|
632
|
+
null,
|
|
633
|
+
"intercom door-open logs",
|
|
634
|
+
),
|
|
618
635
|
loadDashboardSource(
|
|
619
636
|
getReaderAccessLogs(selectedReaderId.value, {
|
|
620
637
|
page: page.value,
|
|
@@ -681,9 +698,14 @@ async function loadDashboard() {
|
|
|
681
698
|
// identity metadata here: it can contain a stale photo from another user.
|
|
682
699
|
allIdentities.value = readerUsers;
|
|
683
700
|
identities.value = readerUsers;
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
701
|
+
const intercomItems = intercomLogResponse?.items ?? intercomLogResponse?.data?.items ?? intercomLogResponse?.data?.logs ?? [];
|
|
702
|
+
logs.value = [
|
|
703
|
+
...(liveItems.length
|
|
704
|
+
? []
|
|
705
|
+
: logResponse?.items ?? logResponse?.data?.items ?? logResponse?.data?.logs ?? []),
|
|
706
|
+
// Always kept: the reader has no live counterpart for these.
|
|
707
|
+
...intercomItems,
|
|
708
|
+
];
|
|
687
709
|
liveAccessLogs.value = liveItems;
|
|
688
710
|
serverPages.value = Number(hidAccessLogResponse?.pages ?? hidAccessLogResponse?.data?.pages ?? 1);
|
|
689
711
|
serverPageRange.value = String(
|
|
@@ -819,6 +841,8 @@ function getAccessMethod(identity: HidAccessRecord, log?: HidAccessRecord) {
|
|
|
819
841
|
id_password: "ID and Password",
|
|
820
842
|
pin: "PIN",
|
|
821
843
|
card: "Card",
|
|
844
|
+
// Set by the API on intercom_door_open events; no reader field implies it.
|
|
845
|
+
intercom: "Intercom",
|
|
822
846
|
};
|
|
823
847
|
const normalizedMethod = String(payload.normalizedMethod || "");
|
|
824
848
|
if (normalizedMethodLabels[normalizedMethod]) return normalizedMethodLabels[normalizedMethod];
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
<div class="flex-grow-1">
|
|
13
13
|
<div class="text-h5 mb-1" :class="item.lowStock ? 'text-error' : ''">{{ item.onHand }} {{ item.unit }} in store</div>
|
|
14
14
|
<div class="text-body-2 text-medium-emphasis">
|
|
15
|
-
{{ [item.code && `Code ${item.code}`, item.category, item.reorderLevel ? `Alert at ${item.reorderLevel}` : "", item.unitCost !== undefined ? `$${Number(item.unitCost).toFixed(2)} each` : ""].filter(Boolean).join(" · ") }}
|
|
15
|
+
{{ [item.code && `Code ${item.code}`, item.category, item.packing, item.reorderLevel ? `Alert at ${item.reorderLevel}` : "", item.unitCost !== undefined ? `$${Number(item.unitCost).toFixed(2)} each` : ""].filter(Boolean).join(" · ") }}
|
|
16
16
|
</div>
|
|
17
17
|
<div v-if="item.description" class="text-body-2 mt-2">{{ item.description }}</div>
|
|
18
18
|
</div>
|
|
@@ -15,6 +15,10 @@
|
|
|
15
15
|
<InputLabel title="Unit" required class="mb-1" />
|
|
16
16
|
<v-combobox v-model="f.unit" :items="units" :rules="[requiredRule]" density="comfortable" />
|
|
17
17
|
</v-col>
|
|
18
|
+
<v-col cols="12" sm="4">
|
|
19
|
+
<InputLabel title="Packing" class="mb-1" />
|
|
20
|
+
<v-text-field v-model="f.packing" density="comfortable" placeholder="e.g. 25 pcs / box" maxlength="60" />
|
|
21
|
+
</v-col>
|
|
18
22
|
<v-col cols="12" sm="4">
|
|
19
23
|
<InputLabel title="Item code" class="mb-1" />
|
|
20
24
|
<v-text-field v-model="f.code" density="comfortable" />
|
|
@@ -79,7 +83,7 @@ const moneyRule = (v: any) => v === "" || v === null || Number(v) >= 0 || "Enter
|
|
|
79
83
|
|
|
80
84
|
const form = ref();
|
|
81
85
|
const saving = ref(false);
|
|
82
|
-
const blank = () => ({ name: "", unit: "pcs", code: "", category: "", reorderLevel: 0, unitCost: 0, openingQty: 0, description: "" });
|
|
86
|
+
const blank = () => ({ name: "", unit: "pcs", packing: "", code: "", category: "", reorderLevel: 0, unitCost: 0, openingQty: 0, description: "" });
|
|
83
87
|
const f = reactive(blank());
|
|
84
88
|
const photo = ref<string[]>([]);
|
|
85
89
|
const inUse = ref(true);
|
|
@@ -87,7 +91,7 @@ const inUse = ref(true);
|
|
|
87
91
|
watch(show, (open) => {
|
|
88
92
|
if (!open) return;
|
|
89
93
|
const i = props.item;
|
|
90
|
-
Object.assign(f, blank(), i ? { name: i.name, unit: i.unit, code: i.code, category: i.category, reorderLevel: i.reorderLevel, unitCost: i.unitCost ?? 0, description: i.description } : {});
|
|
94
|
+
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 } : {});
|
|
91
95
|
photo.value = i?.photo ? [i.photo] : [];
|
|
92
96
|
inUse.value = i ? i.status === "active" : true;
|
|
93
97
|
});
|
|
@@ -99,6 +103,7 @@ async function save() {
|
|
|
99
103
|
const body = {
|
|
100
104
|
name: f.name,
|
|
101
105
|
unit: f.unit,
|
|
106
|
+
packing: f.packing,
|
|
102
107
|
code: f.code,
|
|
103
108
|
category: f.category,
|
|
104
109
|
reorderLevel: Number(f.reorderLevel || 0),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<div class="d-flex flex-wrap ga-2 align-center mb-3">
|
|
4
|
-
<div class="text-body-2 text-medium-emphasis">Stock you have taken from the store and
|
|
4
|
+
<div class="text-body-2 text-medium-emphasis">Stock you have taken from the store: how many are left, and how many you used this month.</div>
|
|
5
5
|
<v-spacer />
|
|
6
6
|
<v-btn class="text-none screen-btn-primary" variant="flat" prepend-icon="mdi-cart-arrow-down" @click="showRequest = true">Request Stock</v-btn>
|
|
7
7
|
</div>
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
</v-avatar>
|
|
22
22
|
<div class="flex-grow-1">
|
|
23
23
|
<div class="font-weight-medium">{{ h.itemName }}</div>
|
|
24
|
-
<div class="text-body-2">{{ h.qty }} {{ h.unit }}
|
|
24
|
+
<div class="text-body-2">{{ h.qty }} {{ h.unit }} left · {{ h.usedThisMonth ?? 0 }} used this month</div>
|
|
25
25
|
</div>
|
|
26
|
-
<v-btn class="text-none screen-btn-primary" variant="flat" size="small" @click="use(h)">Record usage</v-btn>
|
|
26
|
+
<v-btn v-if="h.qty > 0" class="text-none screen-btn-primary" variant="flat" size="small" @click="use(h)">Record usage</v-btn>
|
|
27
27
|
</AppCard>
|
|
28
28
|
</v-col>
|
|
29
29
|
</v-row>
|
|
@@ -90,7 +90,7 @@ const usage = reactive({ show: false, holding: null as TInventoryHolding | null
|
|
|
90
90
|
async function load() {
|
|
91
91
|
loading.value = true;
|
|
92
92
|
try {
|
|
93
|
-
const [h, t] = await Promise.all([api.getHoldings(props.store._id, "me"), api.getTransactions(props.store._id, { page: 1, limit: 15, holder: currentUser.value?._id })]);
|
|
93
|
+
const [h, t] = await Promise.all([api.getHoldings(props.store._id, "me", true), api.getTransactions(props.store._id, { page: 1, limit: 15, holder: currentUser.value?._id })]);
|
|
94
94
|
holdings.value = h;
|
|
95
95
|
activity.value = t.items.filter((x) => x.holderChange !== undefined);
|
|
96
96
|
} catch {
|
|
@@ -168,6 +168,7 @@ const headers: Record<string, any[]> = {
|
|
|
168
168
|
movement: [
|
|
169
169
|
{ title: "Item", key: "name" },
|
|
170
170
|
{ title: "Unit", key: "unit" },
|
|
171
|
+
{ title: "Packing", key: "packing" },
|
|
171
172
|
{ title: "Start", key: "opening" },
|
|
172
173
|
{ title: "Received", key: "received" },
|
|
173
174
|
{ title: "Purchase cost", key: "receivedCost" },
|
|
@@ -190,6 +191,7 @@ const headers: Record<string, any[]> = {
|
|
|
190
191
|
{ title: "Total", key: "totalCost" },
|
|
191
192
|
{ title: "Technician", key: "technician" },
|
|
192
193
|
{ title: "Reference", key: "reference" },
|
|
194
|
+
{ title: "Reported by", key: "reportedBy" },
|
|
193
195
|
{ title: "Checked by", key: "checkedByName" },
|
|
194
196
|
],
|
|
195
197
|
technicians: [
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
</v-avatar>
|
|
62
62
|
<div>
|
|
63
63
|
<div class="font-weight-medium">{{ item.name }}</div>
|
|
64
|
-
<div class="text-caption text-medium-emphasis">{{ [item.code, item.category].filter(Boolean).join(" · ") }}</div>
|
|
64
|
+
<div class="text-caption text-medium-emphasis">{{ [item.code, item.category, item.packing].filter(Boolean).join(" · ") }}</div>
|
|
65
65
|
</div>
|
|
66
66
|
</div>
|
|
67
67
|
</template>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
<v-btn class="text-none screen-btn-ghost" variant="outlined" size="small" prepend-icon="mdi-keyboard-return" @click="openReturn(g)">Receive return</v-btn>
|
|
17
17
|
</div>
|
|
18
18
|
<div class="d-flex flex-wrap ga-2">
|
|
19
|
-
<v-chip v-for="h in g.items" :key="h._id" variant="tonal">{{ h.itemName }}: {{ h.qty }} {{ h.unit }}</v-chip>
|
|
19
|
+
<v-chip v-for="h in g.items" :key="h._id" variant="tonal">{{ h.itemName }}: {{ h.qty }} {{ h.unit }} left · {{ h.usedThisMonth ?? 0 }} used this month</v-chip>
|
|
20
20
|
</div>
|
|
21
21
|
</AppCard>
|
|
22
22
|
|
|
@@ -83,6 +83,8 @@
|
|
|
83
83
|
|
|
84
84
|
<InputLabel title="Date used" class="mb-1 mt-3" />
|
|
85
85
|
<v-text-field v-model="date" type="date" :max="today" density="comfortable" style="max-width: 200px" />
|
|
86
|
+
<InputLabel title="Fault reported by (optional)" class="mb-1" />
|
|
87
|
+
<v-text-field v-model="reportedBy" density="comfortable" placeholder="e.g. tenant, security guard" maxlength="120" />
|
|
86
88
|
<InputLabel title="Remarks (optional)" class="mb-1" />
|
|
87
89
|
<v-textarea v-model="remarks" rows="2" auto-grow density="comfortable" />
|
|
88
90
|
</v-form>
|
|
@@ -122,6 +124,7 @@ const unit = ref("");
|
|
|
122
124
|
const area = ref("");
|
|
123
125
|
const reference = ref("");
|
|
124
126
|
const remarks = ref("");
|
|
127
|
+
const reportedBy = ref("");
|
|
125
128
|
const date = ref(today);
|
|
126
129
|
const photosBefore = ref<string[]>([]);
|
|
127
130
|
const photosAfter = ref<string[]>([]);
|
|
@@ -169,6 +172,7 @@ async function save() {
|
|
|
169
172
|
photosBefore: photosBefore.value,
|
|
170
173
|
photosAfter: photosAfter.value,
|
|
171
174
|
remarks: remarks.value,
|
|
175
|
+
reportedBy: reportedBy.value,
|
|
172
176
|
});
|
|
173
177
|
notify("Usage saved.");
|
|
174
178
|
show.value = false;
|
|
@@ -195,6 +199,7 @@ watch(show, (open) => {
|
|
|
195
199
|
area.value = "";
|
|
196
200
|
reference.value = "";
|
|
197
201
|
remarks.value = "";
|
|
202
|
+
reportedBy.value = "";
|
|
198
203
|
date.value = today;
|
|
199
204
|
site.value = props.store.sites.includes(props.siteId) ? props.siteId : props.store.sites[0];
|
|
200
205
|
searchUnits("");
|
|
@@ -45,7 +45,8 @@ export default function useInventory() {
|
|
|
45
45
|
rejectRequest: (id: string, remarks: string) => api(`/requests/${id}/reject`, { method: "POST", body: { remarks } }),
|
|
46
46
|
cancelRequest: (id: string) => api(`/requests/${id}/cancel`, { method: "POST" }),
|
|
47
47
|
|
|
48
|
-
getHoldings: (store: string, holder: string = "me"
|
|
48
|
+
getHoldings: (store: string, holder: string = "me", includeUsedUp = false) =>
|
|
49
|
+
api<TInventoryHolding[]>(`/stores/${store}/holdings`, { query: { holder, ...(includeUsedUp ? { includeUsedUp: true } : {}) } }),
|
|
49
50
|
getTransactions: (store: string, query: Record<string, any>) =>
|
|
50
51
|
api<{ items: TInventoryTransaction[]; total: number; page: number; pages: number }>(`/stores/${store}/transactions`, { query }),
|
|
51
52
|
|
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.17.1-staging.
|
|
5
|
+
"version": "4.17.1-staging.335",
|
|
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.",
|
package/types/inventory.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ declare type TInventoryItem = {
|
|
|
24
24
|
code: string;
|
|
25
25
|
category: string;
|
|
26
26
|
unit: string;
|
|
27
|
+
packing?: string;
|
|
27
28
|
description: string;
|
|
28
29
|
photo: string;
|
|
29
30
|
reorderLevel: number;
|
|
@@ -60,6 +61,9 @@ declare type TInventoryHolding = {
|
|
|
60
61
|
holder: string;
|
|
61
62
|
holderName: string;
|
|
62
63
|
qty: number;
|
|
64
|
+
packing?: string;
|
|
65
|
+
/** Used by this holder since the start of the month (Singapore time). */
|
|
66
|
+
usedThisMonth?: number;
|
|
63
67
|
};
|
|
64
68
|
|
|
65
69
|
declare type TInventoryTransaction = {
|
|
@@ -82,6 +86,7 @@ declare type TInventoryTransaction = {
|
|
|
82
86
|
totalCost: number;
|
|
83
87
|
photos?: { before: string[]; after: string[]; other: string[] };
|
|
84
88
|
remarks?: string;
|
|
89
|
+
reportedBy?: string;
|
|
85
90
|
date: string;
|
|
86
91
|
createdByName: string;
|
|
87
92
|
};
|