@7365admin1/layer-common 4.168.2 → 4.168.4
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 +50 -4
- package/components/InventoryItemDetail.vue +37 -3
- package/components/InventoryLinesDialog.vue +6 -1
- package/components/InventoryMain.vue +54 -3
- package/components/InventoryReportsTab.vue +9 -1
- package/components/InventorySettingsTab.vue +14 -2
- package/components/WorkOrder/MaterialsDialog.vue +756 -0
- package/components/WorkOrder/MaterialsGroups.vue +128 -0
- package/composables/useCommonPermission.ts +15 -1
- package/composables/useInventory.ts +10 -1
- package/composables/useInventoryPermission.ts +8 -1
- package/composables/useSecurityPermission.ts +6 -0
- package/package.json +1 -1
- package/types/inventory.d.ts +11 -0
- package/types/work-order-material.d.ts +15 -0
- package/utils/inventory-store-label.ts +36 -0
- package/utils/work-order-link.ts +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,51 @@
|
|
|
1
1
|
# @iservice365/layer-common
|
|
2
2
|
|
|
3
|
+
## 4.168.4
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 806ba6f: Inventory History: link a work order's materials to the work order
|
|
8
|
+
|
|
9
|
+
A "Used" row from a work order's submit now shows the work order number after
|
|
10
|
+
"Used" (e.g. "Used · #ME0209"), linking to that app's Work Order Details, and
|
|
11
|
+
the store's balance, since those materials come straight off the shelf. A
|
|
12
|
+
deleted work order shows its saved number as plain text. Other rows are
|
|
13
|
+
unchanged.
|
|
14
|
+
|
|
15
|
+
- 6b270ce: Inventory: work order numbers link everywhere, to the feedback when tied
|
|
16
|
+
|
|
17
|
+
The Usage report's "Work order / ref" column now links each work order's
|
|
18
|
+
materials to it, like Inventory History. A work order tied to a feedback
|
|
19
|
+
links straight to that Feedback Details (`workOrderFeedback`); others to
|
|
20
|
+
Work Order Details. One helper, `utils/work-order-link.ts`, for both.
|
|
21
|
+
|
|
22
|
+
- dc1e7b4: Work order materials: shared picker and materials list
|
|
23
|
+
|
|
24
|
+
`WorkOrderMaterialsDialog` picks parts from the site's inventory for a work
|
|
25
|
+
order (search opens a multiple-select list, quantity up to the stock, totals;
|
|
26
|
+
out-of-stock items cannot be picked; quantities are lowered when the stock has
|
|
27
|
+
changed). `WorkOrderMaterialsGroups` lists materials per work order with a
|
|
28
|
+
total each and a Grand Total. New global type `TWorkOrderMaterial`. For the
|
|
29
|
+
service apps' Work Order and Feedback Details; the picks go with the submit,
|
|
30
|
+
which takes them from stock (API-core).
|
|
31
|
+
|
|
32
|
+
New work order permission "add-work-order-materials" (Add Work Order
|
|
33
|
+
Materials) for the service apps' role editors - the shared trade list and
|
|
34
|
+
Security's - and so the org app's Roles & Permissions. Property Management's
|
|
35
|
+
list does not offer it.
|
|
36
|
+
|
|
37
|
+
Store Settings gets "Use for work order materials" (off until a store's manager
|
|
38
|
+
turns it on). The picker lists items only from stores with it on that the
|
|
39
|
+
person may use, through the new `useInventory().getWorkOrderItems` (API-core
|
|
40
|
+
`GET /inventory/work-order-items`, no Inventory right needed); with none, it
|
|
41
|
+
says how to set one up.
|
|
42
|
+
|
|
43
|
+
## 4.168.3
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- be88f25: Inventory: "How inventory works" explainer (three set-ups), a note when a person sees both their own store and the main store, clearer site-choice hints for one-store-per-property, and a service provider can set up its own store beside the main store.
|
|
48
|
+
|
|
3
49
|
## 4.168.2
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
|
@@ -3807,11 +3853,11 @@ Monthly report: a month that had patrols opens the list of that month's patrol r
|
|
|
3807
3853
|
`utils/console-tier.ts` + `composables/useConsoleTier.ts` mirror the server's
|
|
3808
3854
|
own rule from two endpoints the console already calls, unprojected:
|
|
3809
3855
|
|
|
3810
|
-
|
|
3811
|
-
|
|
3856
|
+
GET /api/members/user/:user/app/admin the Seven365 staff membership
|
|
3857
|
+
GET /api/roles/id/:role that membership's role document
|
|
3812
3858
|
|
|
3813
|
-
|
|
3814
|
-
|
|
3859
|
+
owner = member.type === "admin" && role.type === "admin" && role.default === true
|
|
3860
|
+
staff = member.type === "admin" && role.type === "admin"
|
|
3815
3861
|
|
|
3816
3862
|
`role.default` is the marker because it is the only property of a platform
|
|
3817
3863
|
staff role no API caller can set - `role.controller.ts` validates create and
|
|
@@ -65,11 +65,22 @@
|
|
|
65
65
|
<tbody>
|
|
66
66
|
<tr v-for="t in history" :key="t._id">
|
|
67
67
|
<td class="text-no-wrap">{{ formatDate(t.date) }}</td>
|
|
68
|
-
<td>
|
|
68
|
+
<td>
|
|
69
|
+
{{ typeLabels[t.type] }}
|
|
70
|
+
<template v-if="t.workOrder">
|
|
71
|
+
·
|
|
72
|
+
<NuxtLink v-if="workOrderRoute(t)" :to="workOrderRoute(t)!" class="history-wo-link" @click="show = false">
|
|
73
|
+
{{ t.workOrderNumber || t.reference }}
|
|
74
|
+
</NuxtLink>
|
|
75
|
+
<span v-else>{{ t.workOrderNumber || t.reference }}</span>
|
|
76
|
+
</template>
|
|
77
|
+
</td>
|
|
69
78
|
<td class="text-right" :class="t.storeChange > 0 ? 'text-success' : t.storeChange < 0 ? 'text-error' : ''">
|
|
70
79
|
{{ t.storeChange > 0 ? "+" : "" }}{{ t.storeChange || (t.type === "use" ? "" : 0) }}
|
|
71
80
|
</td>
|
|
72
|
-
|
|
81
|
+
<!-- Usage from a person's stock leaves the store as it was (no balance); a work order's
|
|
82
|
+
materials come off the shelf, so the store's balance shows. -->
|
|
83
|
+
<td class="text-right">{{ t.type === "use" && !t.storeChange ? "" : t.storeBalance }}</td>
|
|
73
84
|
<td class="text-caption">{{ describe(t) }}</td>
|
|
74
85
|
<td class="text-caption">{{ (t as any).createdByLabel || t.createdByName }}</td>
|
|
75
86
|
</tr>
|
|
@@ -94,6 +105,7 @@ import { inventoryItemMeta } from "../utils/inventory-store-label";
|
|
|
94
105
|
import { inventoryControls } from "../utils/inventory-presets";
|
|
95
106
|
import { receiptRefText } from "../utils/inventory-receiving";
|
|
96
107
|
import { availableText, inventoryStepsLive, lowStockAlertText, qtyUnit, unitWord, writeOffLabel } from "../utils/inventory-ack";
|
|
108
|
+
import { workOrderLinkTarget } from "../utils/work-order-link";
|
|
97
109
|
|
|
98
110
|
const show = defineModel<boolean>({ default: false });
|
|
99
111
|
const props = defineProps({
|
|
@@ -122,6 +134,16 @@ const stepsLive = computed(() => inventoryStepsLive(props.store));
|
|
|
122
134
|
|
|
123
135
|
const formatDate = (d: string) => standardFormatDate(d);
|
|
124
136
|
|
|
137
|
+
/**
|
|
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.
|
|
142
|
+
*/
|
|
143
|
+
const route = useRoute();
|
|
144
|
+
const router = useRouter();
|
|
145
|
+
const workOrderRoute = (t: TInventoryTransaction) => workOrderLinkTarget(t, route, router);
|
|
146
|
+
|
|
125
147
|
function describe(t: TInventoryTransaction) {
|
|
126
148
|
const parts: string[] = [];
|
|
127
149
|
if (t.type === "receive") parts.push(t.supplier || "", receiptRefText(t));
|
|
@@ -134,7 +156,8 @@ function describe(t: TInventoryTransaction) {
|
|
|
134
156
|
parts.push(
|
|
135
157
|
`${who} used ${t.qty}`,
|
|
136
158
|
t.location?.type === "tenant_unit" ? `${t.location.unitName} ${t.location.tenantName || ""}` : t.location?.area || "",
|
|
137
|
-
|
|
159
|
+
// A work order's number is shown (as a link) after "Used" instead.
|
|
160
|
+
t.workOrder ? "" : t.reference || "",
|
|
138
161
|
);
|
|
139
162
|
if (t.type === "adjust") parts.push(t.remarks || "");
|
|
140
163
|
if (t.type === "write_off") parts.push(`${t.qty} ${writeOffLabel(t.writeOffReason).toLowerCase()}`, (t.holderChange ?? 0) < 0 ? `by ${who}` : "from the shelf", t.remarks || "");
|
|
@@ -182,3 +205,14 @@ watch(show, (open) => {
|
|
|
182
205
|
load(1);
|
|
183
206
|
});
|
|
184
207
|
</script>
|
|
208
|
+
|
|
209
|
+
<style scoped>
|
|
210
|
+
.history-wo-link {
|
|
211
|
+
color: var(--accent);
|
|
212
|
+
font-weight: 600;
|
|
213
|
+
text-decoration: none;
|
|
214
|
+
}
|
|
215
|
+
.history-wo-link:hover {
|
|
216
|
+
text-decoration: underline;
|
|
217
|
+
}
|
|
218
|
+
</style>
|
|
@@ -45,7 +45,11 @@
|
|
|
45
45
|
<v-text-field v-if="mode !== 'issue'" :model-value="holderName" density="comfortable" readonly />
|
|
46
46
|
</template>
|
|
47
47
|
|
|
48
|
-
<div class="text-subtitle-2 mb-2">
|
|
48
|
+
<div class="text-subtitle-2 mb-2">
|
|
49
|
+
Items
|
|
50
|
+
<!-- Same count as the mobile request sheet: what this request holds so far. -->
|
|
51
|
+
<span v-if="mode === 'request' && chosenCount > 0" class="text-primary">· {{ chosenCount === 1 ? "1 item in this request" : `${chosenCount} items in this request` }}</span>
|
|
52
|
+
</div>
|
|
49
53
|
<div v-for="(line, i) in rows" :key="i" class="d-flex flex-wrap ga-2 align-start mb-1">
|
|
50
54
|
<!-- An item not in the stock list (client 2026-11): a delivery adds it, a request asks for it. -->
|
|
51
55
|
<template v-if="line.newItem">
|
|
@@ -320,6 +324,7 @@ function addNew(line: TRow) {
|
|
|
320
324
|
line.item = "";
|
|
321
325
|
}
|
|
322
326
|
const rows = ref<TRow[]>([blank()]);
|
|
327
|
+
const chosenCount = computed(() => rows.value.filter((r) => r.item || r.newItem?.name?.trim()).length);
|
|
323
328
|
const supplier = ref("");
|
|
324
329
|
const reference = ref("");
|
|
325
330
|
const remarks = ref("");
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
<div class="inventory">
|
|
3
3
|
<PageHeader :title="store ? store.name : 'Inventory'" :subtitle="subtitle">
|
|
4
4
|
<template #actions>
|
|
5
|
+
<v-btn variant="text" size="small" class="text-none" prepend-icon="mdi-help-circle-outline" @click="showHowItWorks = true">
|
|
6
|
+
{{ HOW.title }}
|
|
7
|
+
</v-btn>
|
|
5
8
|
<!-- Many stores (staff of several organisations at one property): a list, not a row of buttons. -->
|
|
6
9
|
<v-select
|
|
7
10
|
v-if="stores.length > 3"
|
|
@@ -50,6 +53,25 @@
|
|
|
50
53
|
</div>
|
|
51
54
|
</v-alert>
|
|
52
55
|
|
|
56
|
+
<!-- Owner 2026-11-05: the three set-ups, in plain words, one tap away on every inventory screen. -->
|
|
57
|
+
<v-dialog v-model="showHowItWorks" max-width="640">
|
|
58
|
+
<v-card>
|
|
59
|
+
<v-card-title class="text-h6">{{ HOW.title }}</v-card-title>
|
|
60
|
+
<v-card-text>
|
|
61
|
+
<p class="text-body-2 mb-4">{{ HOW.intro }}</p>
|
|
62
|
+
<div v-for="s in HOW.setups" :key="s.title" class="mb-3">
|
|
63
|
+
<div class="font-weight-medium">{{ s.title }}</div>
|
|
64
|
+
<div class="text-body-2">{{ s.text }}</div>
|
|
65
|
+
</div>
|
|
66
|
+
<p class="text-caption mt-2">{{ HOW.where }}</p>
|
|
67
|
+
</v-card-text>
|
|
68
|
+
<v-card-actions>
|
|
69
|
+
<v-spacer />
|
|
70
|
+
<v-btn class="text-none" variant="text" @click="showHowItWorks = false">Close</v-btn>
|
|
71
|
+
</v-card-actions>
|
|
72
|
+
</v-card>
|
|
73
|
+
</v-dialog>
|
|
74
|
+
|
|
53
75
|
<v-progress-linear v-if="loading" indeterminate color="primary" class="mb-4" />
|
|
54
76
|
|
|
55
77
|
<AppCard v-else-if="loadError" class="pa-6">
|
|
@@ -59,7 +81,8 @@
|
|
|
59
81
|
</AppCard>
|
|
60
82
|
|
|
61
83
|
<!-- No store yet: one clear next step, or one clear explanation. -->
|
|
62
|
-
|
|
84
|
+
<!-- Also open when a provider sets up its own store beside the main store (scenario 3). -->
|
|
85
|
+
<AppCard v-else-if="!store || showSetup" class="pa-6">
|
|
63
86
|
<template v-if="!showSetup">
|
|
64
87
|
<div class="text-h6 mb-2">Inventory is not set up for this property yet</div>
|
|
65
88
|
<p class="text-body-2 mb-4">
|
|
@@ -67,6 +90,8 @@
|
|
|
67
90
|
</p>
|
|
68
91
|
<p class="text-body-2 mb-4">
|
|
69
92
|
One store can supply several properties (for example a company's central store): choose them all when you set it up, or later under Settings.
|
|
93
|
+
If each property keeps its own separate stock, set up a store at each property instead.
|
|
94
|
+
<a href="#" class="text-primary" @click.prevent="showHowItWorks = true">How inventory works</a>
|
|
70
95
|
</p>
|
|
71
96
|
<v-btn class="text-none screen-btn-primary" variant="flat" @click="showSetup = true">Set up inventory</v-btn>
|
|
72
97
|
<p class="text-caption mt-3">
|
|
@@ -88,7 +113,7 @@
|
|
|
88
113
|
chips
|
|
89
114
|
density="comfortable"
|
|
90
115
|
:rules="[(v: string[]) => v.length > 0 || 'Choose at least one property']"
|
|
91
|
-
hint="Choose more than one if one store supplies them all
|
|
116
|
+
hint="Choose more than one only if one store supplies them all (e.g. a company's central store). If a property keeps its own separate stock, leave it out and set up its own store there."
|
|
92
117
|
persistent-hint
|
|
93
118
|
class="mb-4"
|
|
94
119
|
/>
|
|
@@ -105,6 +130,10 @@
|
|
|
105
130
|
<v-alert v-if="requestOnly" type="info" variant="tonal" density="compact" class="mb-4" icon="mdi-cart-arrow-down">
|
|
106
131
|
<div class="font-weight-medium">Request items from the main store</div>
|
|
107
132
|
<div class="text-body-2">Pick the items you need and press Request Stock. You are told when the store keeper approves it.</div>
|
|
133
|
+
<div v-if="canSetUpOwnStore" class="d-flex align-center flex-wrap ga-2 mt-2">
|
|
134
|
+
<span class="text-body-2">Your company can also keep its own store here for stock it buys itself.</span>
|
|
135
|
+
<v-btn size="small" variant="outlined" class="text-none" @click="openOwnStoreSetup">Set up our own store</v-btn>
|
|
136
|
+
</div>
|
|
108
137
|
</v-alert>
|
|
109
138
|
<v-alert
|
|
110
139
|
v-else-if="store.access.canApprove && pendingCount > 0 && tab !== 'requests'"
|
|
@@ -124,6 +153,9 @@
|
|
|
124
153
|
<v-btn size="small" variant="flat" color="warning" class="text-none" @click="tab = 'mine'">Open My Stock</v-btn>
|
|
125
154
|
</div>
|
|
126
155
|
</v-alert>
|
|
156
|
+
<v-alert v-if="twoStoresText" type="info" variant="tonal" density="compact" class="mb-4" icon="mdi-store-outline">
|
|
157
|
+
{{ twoStoresText }}
|
|
158
|
+
</v-alert>
|
|
127
159
|
<v-tabs v-model="tab" color="primary" class="mb-4" show-arrows>
|
|
128
160
|
<v-tab v-for="t in tabs" :key="t.value" :value="t.value" class="text-none">
|
|
129
161
|
{{ t.label }}
|
|
@@ -166,7 +198,16 @@ import useWorkerTerm from "../composables/useWorkerTerm";
|
|
|
166
198
|
import useSite from "../composables/useSite";
|
|
167
199
|
import useCustomerSite from "../composables/useCustomerSite";
|
|
168
200
|
import useUtils from "../composables/useUtils";
|
|
169
|
-
import {
|
|
201
|
+
import {
|
|
202
|
+
INVENTORY_HOW_IT_WORKS as HOW,
|
|
203
|
+
inventoryManagedBy,
|
|
204
|
+
inventorySiteOptions,
|
|
205
|
+
inventoryStoreLabel,
|
|
206
|
+
inventorySuppliesText,
|
|
207
|
+
inventorySupplySites,
|
|
208
|
+
inventoryTwoStoresText,
|
|
209
|
+
} from "../utils/inventory-store-label";
|
|
210
|
+
import useInventoryPermission from "../composables/useInventoryPermission";
|
|
170
211
|
import { inventoryControls } from "../utils/inventory-presets";
|
|
171
212
|
import { inventoryStepsLive } from "../utils/inventory-ack";
|
|
172
213
|
import useLocalAuth from "../composables/useLocalAuth";
|
|
@@ -198,6 +239,16 @@ const pendingCount = ref(0);
|
|
|
198
239
|
const orgSites = ref<{ _id: string; name: string }[]>([]);
|
|
199
240
|
|
|
200
241
|
const showSetup = ref(false);
|
|
242
|
+
const showHowItWorks = ref(false);
|
|
243
|
+
const { canManageInventory } = useInventoryPermission();
|
|
244
|
+
const twoStoresText = computed(() => inventoryTwoStoresText(stores.value));
|
|
245
|
+
// Scenario 3: a provider at a property with a main store may add its own store; offered only when it has none here.
|
|
246
|
+
const canSetUpOwnStore = computed(() => canManageInventory.value && !stores.value.some((s) => s.owner === true));
|
|
247
|
+
function openOwnStoreSetup() {
|
|
248
|
+
// Never "Main Store": that is the property manager's store in every label.
|
|
249
|
+
Object.assign(setup, { name: "Our Store", sites: [props.siteId] });
|
|
250
|
+
showSetup.value = true;
|
|
251
|
+
}
|
|
201
252
|
const setupForm = ref();
|
|
202
253
|
const setup = reactive({ name: "Main Store", sites: [props.siteId] as string[] });
|
|
203
254
|
|
|
@@ -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 });
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
chips
|
|
16
16
|
density="comfortable"
|
|
17
17
|
:rules="[(v: string[]) => v.length > 0 || 'Choose at least one property']"
|
|
18
|
-
hint="Choose more than one if this store supplies them all
|
|
18
|
+
hint="Choose more than one only if this store supplies them all (e.g. a company's central store). A property that keeps its own separate stock needs its own store instead."
|
|
19
19
|
persistent-hint
|
|
20
20
|
class="mb-4"
|
|
21
21
|
/>
|
|
@@ -41,6 +41,13 @@
|
|
|
41
41
|
/>
|
|
42
42
|
</template>
|
|
43
43
|
|
|
44
|
+
<v-divider class="my-4" />
|
|
45
|
+
<div class="text-subtitle-1 mb-1">Work orders</div>
|
|
46
|
+
<v-switch v-model="workOrderMaterials" color="primary" hide-details label="Use for work order materials" />
|
|
47
|
+
<p class="text-body-2 text-medium-emphasis mt-1 mb-2">
|
|
48
|
+
Technicians at the properties this store supplies can pick parts from it on a work order. They're taken from stock when the work order is submitted.
|
|
49
|
+
</p>
|
|
50
|
+
|
|
44
51
|
<v-divider class="my-4" />
|
|
45
52
|
<div class="text-subtitle-1 mb-1">Service365 app</div>
|
|
46
53
|
<p class="text-body-2 text-medium-emphasis mb-2">
|
|
@@ -79,6 +86,8 @@ const sites = ref<string[]>([]);
|
|
|
79
86
|
const showInResidentApp = ref(false);
|
|
80
87
|
const showCostInResidentApp = ref(false);
|
|
81
88
|
const reminderDays = ref<number>(1);
|
|
89
|
+
/** "Use for work order materials" (2026-11); missing = off. */
|
|
90
|
+
const workOrderMaterials = ref(false);
|
|
82
91
|
const stepsLive = computed(() => inventoryStepsLive(props.store));
|
|
83
92
|
|
|
84
93
|
const siteItems = computed(() => inventorySiteOptions(props.orgSites, props.store));
|
|
@@ -89,6 +98,7 @@ function reset() {
|
|
|
89
98
|
showInResidentApp.value = props.store.showInResidentApp;
|
|
90
99
|
showCostInResidentApp.value = props.store.showCostInResidentApp;
|
|
91
100
|
reminderDays.value = props.store.lowStockReminderDays ?? 1;
|
|
101
|
+
workOrderMaterials.value = !!props.store.workOrderMaterials;
|
|
92
102
|
}
|
|
93
103
|
|
|
94
104
|
async function save() {
|
|
@@ -103,6 +113,8 @@ async function save() {
|
|
|
103
113
|
showCostInResidentApp: showInResidentApp.value && showCostInResidentApp.value,
|
|
104
114
|
// Only to an API that has reminders (an older one refuses the unknown field).
|
|
105
115
|
...(stepsLive.value ? { lowStockReminderDays: Number(reminderDays.value) } : {}),
|
|
116
|
+
// Only when changed: an API without the setting refuses the unknown field.
|
|
117
|
+
...(workOrderMaterials.value !== !!props.store.workOrderMaterials ? { workOrderMaterials: workOrderMaterials.value } : {}),
|
|
106
118
|
});
|
|
107
119
|
notify("Settings saved.");
|
|
108
120
|
emit("saved");
|
|
@@ -113,5 +125,5 @@ async function save() {
|
|
|
113
125
|
}
|
|
114
126
|
}
|
|
115
127
|
|
|
116
|
-
watch(() => [props.store, props.store.lowStockReminderDays], reset, { immediate: true });
|
|
128
|
+
watch(() => [props.store, props.store.lowStockReminderDays, props.store.workOrderMaterials], reset, { immediate: true });
|
|
117
129
|
</script>
|