@7365admin1/layer-common 4.17.1-staging.334 → 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.
@@ -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 not used or returned yet.</div>
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 }} in hand</div>
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") => api<TInventoryHolding[]>(`/stores/${store}/holdings`, { query: { holder } }),
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.334",
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.",
@@ -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
  };