@7365admin1/layer-common 4.97.1-staging.656 → 4.97.1-staging.657
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.
|
@@ -105,6 +105,7 @@ import { inventoryItemMeta } from "../utils/inventory-store-label";
|
|
|
105
105
|
import { inventoryControls } from "../utils/inventory-presets";
|
|
106
106
|
import { receiptRefText } from "../utils/inventory-receiving";
|
|
107
107
|
import { availableText, inventoryStepsLive, lowStockAlertText, qtyUnit, unitWord, writeOffLabel } from "../utils/inventory-ack";
|
|
108
|
+
import { workOrderLinkTarget } from "../utils/work-order-link";
|
|
108
109
|
|
|
109
110
|
const show = defineModel<boolean>({ default: false });
|
|
110
111
|
const props = defineProps({
|
|
@@ -134,17 +135,14 @@ const stepsLive = computed(() => inventoryStepsLive(props.store));
|
|
|
134
135
|
const formatDate = (d: string) => standardFormatDate(d);
|
|
135
136
|
|
|
136
137
|
/**
|
|
137
|
-
* The work order a "Used" row came from
|
|
138
|
-
* (same organisation and site as the page). None
|
|
139
|
-
* exists or the app has no
|
|
138
|
+
* The work order a "Used" row came from: its feedback's details when it is tied
|
|
139
|
+
* to one, else Work Order Details (same organisation and site as the page). None
|
|
140
|
+
* when the work order no longer exists or the app has no such page: the number
|
|
141
|
+
* then shows as text.
|
|
140
142
|
*/
|
|
141
143
|
const route = useRoute();
|
|
142
144
|
const router = useRouter();
|
|
143
|
-
|
|
144
|
-
if (!t.workOrder || t.workOrderExists === false) return null;
|
|
145
|
-
if (!router.hasRoute("org-site-work-orders-id") || !route.params.org || !route.params.site) return null;
|
|
146
|
-
return { name: "org-site-work-orders-id", params: { org: route.params.org, site: route.params.site, id: t.workOrder } };
|
|
147
|
-
}
|
|
145
|
+
const workOrderRoute = (t: TInventoryTransaction) => workOrderLinkTarget(t, route, router);
|
|
148
146
|
|
|
149
147
|
function describe(t: TInventoryTransaction) {
|
|
150
148
|
const parts: string[] = [];
|
|
@@ -205,7 +205,11 @@
|
|
|
205
205
|
<template #item.receivingType="{ item }">{{ item.kind === "Opening stock" ? "Opening stock" : receivingLabel(item.receivingType) }}</template>
|
|
206
206
|
<template #item.reference="{ item }">
|
|
207
207
|
<a v-if="report === 'purchases' && item.reference" href="#" class="text-primary" title="See ordered vs received for this PO" @click.prevent="openPo(item.reference)">{{ item.reference }}</a>
|
|
208
|
-
|
|
208
|
+
<!-- a work order's materials (2026-11): the number links to the work order, or to its feedback when tied -->
|
|
209
|
+
<NuxtLink v-else-if="workOrderLinkTarget(item, route, router)" :to="workOrderLinkTarget(item, route, router)!" class="text-primary">
|
|
210
|
+
{{ item.workOrderNumber || item.reference }}
|
|
211
|
+
</NuxtLink>
|
|
212
|
+
<span v-else>{{ item.workOrderNumber || item.reference || "—" }}</span>
|
|
209
213
|
</template>
|
|
210
214
|
<template #item.doNumber="{ item }">
|
|
211
215
|
<span v-if="item.doNumber">{{ item.doNumber }}<span v-if="item.doDate" class="d-block text-caption text-medium-emphasis">{{ standardFormatDate(item.doDate) }}</span></span>
|
|
@@ -265,6 +269,7 @@ import { inventoryControls } from "../utils/inventory-presets";
|
|
|
265
269
|
import { USED_BY_FILTERS } from "../utils/inventory-used-by";
|
|
266
270
|
import { USAGE_FLAG_WORDS, USAGE_STATUS_CHOICES, usagePathText, usageQuery, usageTotals } from "../utils/inventory-usage";
|
|
267
271
|
import { receivingLabel } from "../utils/inventory-receiving";
|
|
272
|
+
import { workOrderLinkTarget } from "../utils/work-order-link";
|
|
268
273
|
import { inventoryStepsLive, qtyUnit, reconciliationCheckText, reconciliationPersonText, writeOffReasonText } from "../utils/inventory-ack";
|
|
269
274
|
|
|
270
275
|
const props = defineProps({
|
|
@@ -275,6 +280,9 @@ const ctl = computed(() => inventoryControls(props.store.access));
|
|
|
275
280
|
|
|
276
281
|
const api = useInventory();
|
|
277
282
|
const { standardFormatDate, standardFormatDateTime } = useUtils();
|
|
283
|
+
// Work order numbers link to the work order, or its feedback (workOrderLinkTarget).
|
|
284
|
+
const route = useRoute();
|
|
285
|
+
const router = useRouter();
|
|
278
286
|
const notify = inject<(text: string, color?: string) => void>("inventoryNotify", () => {});
|
|
279
287
|
|
|
280
288
|
const worker = useWorkerTerm({ providers: true });
|
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.97.1-staging.
|
|
5
|
+
"version": "4.97.1-staging.657",
|
|
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
|
@@ -143,6 +143,8 @@ declare type TInventoryTransaction = {
|
|
|
143
143
|
workOrder?: string;
|
|
144
144
|
workOrderNumber?: string;
|
|
145
145
|
workOrderExists?: boolean;
|
|
146
|
+
/** The feedback the work order is tied to (2026-11): its link goes there. */
|
|
147
|
+
workOrderFeedback?: string | null;
|
|
146
148
|
supplier?: string;
|
|
147
149
|
/** Receiving (2026-10): missing on older rows = PO. */
|
|
148
150
|
receivingType?: "PO" | "DO" | "CASH";
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { RouteLocationNormalizedLoaded, Router } from "vue-router";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Where a work order number in Inventory (History, reports) links to (2026-11): the
|
|
5
|
+
* feedback's details when the work order is tied to a feedback (its work is done there), else
|
|
6
|
+
* the work order's details - in this app, at the page's organisation and site. Null (shown as
|
|
7
|
+
* text) when there is no work order, it no longer exists, or the app has no such page.
|
|
8
|
+
*/
|
|
9
|
+
export function workOrderLinkTarget(
|
|
10
|
+
row: { workOrder?: unknown; workOrderExists?: boolean; workOrderFeedback?: string | null },
|
|
11
|
+
route: RouteLocationNormalizedLoaded,
|
|
12
|
+
router: Router,
|
|
13
|
+
) {
|
|
14
|
+
if (!row.workOrder || row.workOrderExists === false) return null;
|
|
15
|
+
const { org, site } = route.params;
|
|
16
|
+
if (!org || !site) return null;
|
|
17
|
+
if (row.workOrderFeedback && router.hasRoute("org-site-feedbacks-id")) {
|
|
18
|
+
return { name: "org-site-feedbacks-id", params: { org, site, id: String(row.workOrderFeedback) } };
|
|
19
|
+
}
|
|
20
|
+
if (router.hasRoute("org-site-work-orders-id")) {
|
|
21
|
+
return { name: "org-site-work-orders-id", params: { org, site, id: String(row.workOrder) } };
|
|
22
|
+
}
|
|
23
|
+
return null;
|
|
24
|
+
}
|