@burdenoff/microfe-assethandler 2026.813.2 → 2026.817.1
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/dist/assethandler/hooks/useMaintenancePlans.d.ts +2 -0
- package/dist/assethandler/hooks/useMaintenancePlans.d.ts.map +1 -1
- package/dist/assethandler/hooks/useMaintenancePlans.js +1 -0
- package/dist/assethandler/hooks/useMaintenancePlans.js.map +1 -1
- package/dist/assethandler/ops/MaintenancePlanDialog.js +14 -7
- package/dist/assethandler/ops/MaintenancePlanDialog.js.map +1 -1
- package/dist/assethandler/pages/AssetsAssetCreatePage.d.ts.map +1 -1
- package/dist/assethandler/pages/AssetsAssetCreatePage.js +115 -101
- package/dist/assethandler/pages/AssetsAssetCreatePage.js.map +1 -1
- package/dist/assethandler/pages/AssetsAssetDetailPage.d.ts.map +1 -1
- package/dist/assethandler/pages/AssetsAssetDetailPage.js +121 -102
- package/dist/assethandler/pages/AssetsAssetDetailPage.js.map +1 -1
- package/dist/assethandler/pages/MaintenanceMaintenancePlansPage.d.ts.map +1 -1
- package/dist/assethandler/pages/MaintenanceMaintenancePlansPage.js +119 -114
- package/dist/assethandler/pages/MaintenanceMaintenancePlansPage.js.map +1 -1
- package/dist/assethandler/providers/AssetHandlerProvider.d.ts.map +1 -1
- package/dist/assethandler/providers/AssetHandlerProvider.js +85 -35
- package/dist/assethandler/providers/AssetHandlerProvider.js.map +1 -1
- package/dist/assethandler/store/assethandlerStore.d.ts +3 -0
- package/dist/assethandler/store/assethandlerStore.d.ts.map +1 -1
- package/dist/assethandler/store/assethandlerStore.js +20 -19
- package/dist/assethandler/store/assethandlerStore.js.map +1 -1
- package/dist/assethandler/utils/meter.d.ts +51 -0
- package/dist/assethandler/utils/meter.d.ts.map +1 -0
- package/dist/assethandler/utils/meter.js +51 -0
- package/dist/assethandler/utils/meter.js.map +1 -0
- package/package.json +1 -1
|
@@ -14,15 +14,16 @@ import { NotFoundState as oe } from "../components/NotFoundState.js";
|
|
|
14
14
|
import { StatTile as s } from "../components/StatTile.js";
|
|
15
15
|
import { ChartCard as c } from "../components/ChartCard.js";
|
|
16
16
|
import "../components/index.js";
|
|
17
|
+
import { METER_UNIT_OPTIONS as se, NOT_METERED as ce, meterReadingLabel as le } from "../utils/meter.js";
|
|
17
18
|
import { useState as l } from "react";
|
|
18
|
-
import { Archive as
|
|
19
|
-
import { useParams as
|
|
20
|
-
import { gql as
|
|
21
|
-
import { useMutation as
|
|
22
|
-
import { Fragment as
|
|
23
|
-
import { Badge as
|
|
19
|
+
import { Archive as u, ArrowLeft as ue, Building2 as de, Calendar as d, DollarSign as fe, Hash as pe, Layers as me, MapPin as he, Pencil as ge, ShieldCheck as _e, Tag as ve, Trash2 as ye, TrendingDown as be, Truck as xe, User as Se, Wrench as f } from "lucide-react";
|
|
20
|
+
import { useParams as Ce } from "react-router";
|
|
21
|
+
import { gql as p } from "@apollo/client";
|
|
22
|
+
import { useMutation as m, useQuery as we } from "@apollo/client/react";
|
|
23
|
+
import { Fragment as Te, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
24
|
+
import { Badge as Ee, Button as _, Card as De, CardContent as Oe, CardDescription as ke, CardHeader as Ae, CardTitle as je, EmphasisPanel as Me, GlassCard as Ne, GradientText as Pe, Input as v, Label as y, PagePurpose as Fe, ResponsiveDialog as b, ResponsiveDialogContent as x, ResponsiveDialogDescription as S, ResponsiveDialogFooter as C, ResponsiveDialogHeader as w, ResponsiveDialogTitle as T, Select as E, SelectContent as D, SelectItem as O, SelectTrigger as k, SelectValue as A, Tabs as Ie, TabsContent as j, TabsList as Le, TabsTrigger as M, Textarea as Re } from "@burdenoff/fe-libs/ui";
|
|
24
25
|
//#region src/assethandler/pages/AssetsAssetDetailPage.tsx
|
|
25
|
-
var
|
|
26
|
+
var ze = p`
|
|
26
27
|
query AssetHandlerAsset($id: ID!) {
|
|
27
28
|
asset(id: $id) {
|
|
28
29
|
id
|
|
@@ -45,6 +46,7 @@ var Ie = f`
|
|
|
45
46
|
depreciationMethod
|
|
46
47
|
unitsOfProductionCapacity
|
|
47
48
|
unitsProduced
|
|
49
|
+
meterUnit
|
|
48
50
|
department
|
|
49
51
|
warrantyExpiry
|
|
50
52
|
supplier
|
|
@@ -56,49 +58,49 @@ var Ie = f`
|
|
|
56
58
|
totalCostOfOwnership
|
|
57
59
|
}
|
|
58
60
|
}
|
|
59
|
-
`,
|
|
61
|
+
`, Be = p`
|
|
60
62
|
mutation AssetHandlerUpdateAsset($id: ID!, $input: UpdateAssetInput!) {
|
|
61
63
|
updateAsset(id: $id, input: $input) {
|
|
62
64
|
id
|
|
63
65
|
}
|
|
64
66
|
}
|
|
65
|
-
`,
|
|
67
|
+
`, Ve = p`
|
|
66
68
|
mutation AssetHandlerDisposeAsset($id: ID!, $input: DisposeAssetInput!) {
|
|
67
69
|
disposeAsset(id: $id, input: $input) {
|
|
68
70
|
id
|
|
69
71
|
status
|
|
70
72
|
}
|
|
71
73
|
}
|
|
72
|
-
`,
|
|
74
|
+
`, He = p`
|
|
73
75
|
mutation AssetHandlerDeleteAsset($id: ID!) {
|
|
74
76
|
deleteAsset(id: $id)
|
|
75
77
|
}
|
|
76
|
-
`,
|
|
78
|
+
`, Ue = {
|
|
77
79
|
excellent: "text-status-success-text bg-status-success-bg-subtle",
|
|
78
80
|
good: "text-status-info-text bg-status-info-bg-subtle",
|
|
79
81
|
fair: "text-status-warning-text bg-status-warning-bg-subtle",
|
|
80
82
|
poor: "text-status-warning-text bg-status-warning-bg-subtle",
|
|
81
83
|
damaged: "text-status-error-text bg-status-error-bg-subtle"
|
|
82
84
|
};
|
|
83
|
-
function
|
|
85
|
+
function We(e) {
|
|
84
86
|
let t = Date.now();
|
|
85
87
|
return e.map((e) => e.scheduledDate).filter((e) => e != null && new Date(e).getTime() >= t).sort((e, t) => new Date(e).getTime() - new Date(t).getTime())[0];
|
|
86
88
|
}
|
|
87
|
-
var
|
|
89
|
+
var Ge = {
|
|
88
90
|
STRAIGHT_LINE: "Straight line",
|
|
89
91
|
REDUCING_BALANCE: "Reducing balance (200%)",
|
|
90
92
|
DECLINING_BALANCE: "Declining balance (150%)",
|
|
91
93
|
SUM_OF_YEARS_DIGITS: "Sum of years' digits",
|
|
92
94
|
UNITS_OF_PRODUCTION: "Units of production",
|
|
93
95
|
NONE: "None"
|
|
94
|
-
},
|
|
96
|
+
}, Ke = {
|
|
95
97
|
active: "bg-status-success-bg-subtle text-status-success-text",
|
|
96
98
|
maintenance: "bg-status-warning-bg-subtle text-status-warning-text",
|
|
97
99
|
inactive: "bg-bg-sunken text-text-secondary",
|
|
98
100
|
retired: "bg-bg-sunken text-text-secondary",
|
|
99
101
|
disposed: "bg-status-error-bg-subtle text-status-error-text"
|
|
100
102
|
};
|
|
101
|
-
function
|
|
103
|
+
function qe(e) {
|
|
102
104
|
let t = e.purchaseValue, n = e.usefulLifeMonths;
|
|
103
105
|
if (!t || t <= 0 || !n || n <= 0) return [];
|
|
104
106
|
let r = Math.max(0, Math.min(e.salvageValue ?? 0, t)), i = (e.method ?? "straight_line").toLowerCase(), a = Math.max(1, Math.round(n / 12));
|
|
@@ -134,7 +136,7 @@ function We(e) {
|
|
|
134
136
|
}
|
|
135
137
|
return o;
|
|
136
138
|
}
|
|
137
|
-
function
|
|
139
|
+
function Je(e) {
|
|
138
140
|
return {
|
|
139
141
|
name: e.name,
|
|
140
142
|
description: e.description ?? "",
|
|
@@ -151,77 +153,78 @@ function Ge(e) {
|
|
|
151
153
|
usefulLifeMonths: e.usefulLifeMonths == null ? "" : String(e.usefulLifeMonths),
|
|
152
154
|
depreciationMethod: (e.depreciationMethod ?? "STRAIGHT_LINE").toUpperCase(),
|
|
153
155
|
unitsOfProductionCapacity: e.unitsOfProductionCapacity == null ? "" : String(e.unitsOfProductionCapacity),
|
|
154
|
-
unitsProduced: e.unitsProduced == null ? "" : String(e.unitsProduced)
|
|
156
|
+
unitsProduced: e.unitsProduced == null ? "" : String(e.unitsProduced),
|
|
157
|
+
meterUnit: e.meterUnit ?? ""
|
|
155
158
|
};
|
|
156
159
|
}
|
|
157
|
-
function
|
|
158
|
-
let
|
|
159
|
-
variables: { id:
|
|
160
|
-
skip: !
|
|
160
|
+
function Ye() {
|
|
161
|
+
let p = i(), { labels: Ye } = n(), { format: F, compact: I } = r(), { assetId: Xe } = Ce(), { maintenanceRecords: Ze } = e(), L = a(), { data: Qe, loading: $e, refetch: et } = we(ze, {
|
|
162
|
+
variables: { id: Xe ?? "" },
|
|
163
|
+
skip: !Xe,
|
|
161
164
|
fetchPolicy: "cache-and-network"
|
|
162
|
-
}), [
|
|
165
|
+
}), [tt, R] = l(!1), [nt, z] = l(!1), [rt, B] = l(!1), [V, it] = l(null), [H, U] = l({
|
|
163
166
|
disposalDate: "",
|
|
164
167
|
method: "",
|
|
165
168
|
notes: ""
|
|
166
|
-
}), [
|
|
169
|
+
}), [at, { loading: W }] = m(Be, {
|
|
167
170
|
refetchQueries: ["AssetHandlerBootstrap"],
|
|
168
171
|
onCompleted: () => {
|
|
169
|
-
o.success("Asset updated", "Your changes have been saved."), R(!1),
|
|
172
|
+
o.success("Asset updated", "Your changes have been saved."), R(!1), et();
|
|
170
173
|
},
|
|
171
174
|
onError: (e) => o.error("Could not update asset", e.message)
|
|
172
|
-
}), [
|
|
175
|
+
}), [ot, { loading: G }] = m(Ve, {
|
|
173
176
|
refetchQueries: ["AssetHandlerBootstrap"],
|
|
174
177
|
onCompleted: () => {
|
|
175
|
-
o.success("Asset disposed", "The asset has been marked as disposed."), z(!1),
|
|
178
|
+
o.success("Asset disposed", "The asset has been marked as disposed."), z(!1), et();
|
|
176
179
|
},
|
|
177
180
|
onError: (e) => o.error("Could not dispose asset", e.message)
|
|
178
|
-
}), [
|
|
181
|
+
}), [st, { loading: K }] = m(He, {
|
|
179
182
|
refetchQueries: ["AssetHandlerBootstrap"],
|
|
180
183
|
onCompleted: () => {
|
|
181
|
-
o.success("Asset deleted", "The asset has been removed from the inventory."),
|
|
184
|
+
o.success("Asset deleted", "The asset has been removed from the inventory."), p("/assets/asset-list");
|
|
182
185
|
},
|
|
183
186
|
onError: (e) => o.error("Could not delete asset", e.message)
|
|
184
187
|
});
|
|
185
|
-
if (
|
|
188
|
+
if ($e && !Qe) return /* @__PURE__ */ h("div", {
|
|
186
189
|
className: "space-y-3 p-6",
|
|
187
190
|
children: Array.from({ length: 6 }).map((e, t) => /* @__PURE__ */ h("div", { className: "h-10 rounded-md bg-bg-sunken motion-safe:animate-vc-shimmer" }, t))
|
|
188
191
|
});
|
|
189
|
-
let q =
|
|
192
|
+
let q = Qe?.asset;
|
|
190
193
|
if (!q) return /* @__PURE__ */ h(oe, {
|
|
191
194
|
entityLabel: L("assethandler.asset.detail.notFound.entity", "{{asset}}"),
|
|
192
195
|
description: L("assethandler.asset.detail.notFound.description", "This {{assetLower}} may have been disposed or removed. Return to the inventory to find it."),
|
|
193
196
|
backLabel: L("assethandler.asset.detail.notFound.back", "Back to inventory"),
|
|
194
|
-
onBack: () =>
|
|
197
|
+
onBack: () => p("/assets/asset-list")
|
|
195
198
|
});
|
|
196
199
|
let J = {
|
|
197
200
|
...q,
|
|
198
201
|
status: q.status.toLowerCase(),
|
|
199
202
|
condition: q.condition.toLowerCase(),
|
|
200
203
|
category: q.category.toLowerCase()
|
|
201
|
-
}, Y =
|
|
204
|
+
}, Y = Ze.filter((e) => e.assetId === J.id), X = Y.filter((e) => e.status !== "completed" && e.status !== "cancelled"), ct = We(X), lt = J.status === "disposed", Z = qe({
|
|
202
205
|
purchaseValue: J.purchaseValue,
|
|
203
206
|
salvageValue: J.salvageValue,
|
|
204
207
|
usefulLifeMonths: J.usefulLifeMonths,
|
|
205
208
|
method: J.depreciationMethod,
|
|
206
209
|
unitsOfProductionCapacity: J.unitsOfProductionCapacity,
|
|
207
210
|
unitsProduced: J.unitsProduced
|
|
208
|
-
}),
|
|
211
|
+
}), ut = Z.map((e) => e.bookValue), dt = Y.filter((e) => (e.actualCost ?? e.estimatedCost) != null).map((e) => ({
|
|
209
212
|
label: e.scheduledDate ? new Date(e.scheduledDate).toLocaleDateString(void 0, {
|
|
210
213
|
month: "short",
|
|
211
214
|
year: "2-digit"
|
|
212
215
|
}) : e.title.slice(0, 12),
|
|
213
216
|
cost: e.actualCost ?? e.estimatedCost ?? 0
|
|
214
|
-
})),
|
|
217
|
+
})), ft = Y.reduce((e, t) => e + (t.actualCost ?? t.estimatedCost ?? 0), 0), Q = J.purchaseValue != null && ft > 0 ? [{
|
|
215
218
|
name: "Purchase",
|
|
216
219
|
value: J.purchaseValue,
|
|
217
220
|
color: "var(--color-accent-primary)"
|
|
218
221
|
}, {
|
|
219
222
|
name: "Maintenance",
|
|
220
|
-
value:
|
|
223
|
+
value: ft,
|
|
221
224
|
color: "var(--color-status-info-bg)"
|
|
222
|
-
}] : [],
|
|
223
|
-
|
|
224
|
-
},
|
|
225
|
+
}] : [], pt = () => {
|
|
226
|
+
it(Je(q)), R(!0);
|
|
227
|
+
}, mt = (e) => {
|
|
225
228
|
if (e.preventDefault(), !V) return;
|
|
226
229
|
if (!V.name.trim()) {
|
|
227
230
|
o.warning("Name required", "An asset must have a name.");
|
|
@@ -233,7 +236,7 @@ function Ke() {
|
|
|
233
236
|
let n = Number(t);
|
|
234
237
|
return Number.isNaN(n) ? null : n;
|
|
235
238
|
};
|
|
236
|
-
|
|
239
|
+
at({ variables: {
|
|
237
240
|
id: J.id,
|
|
238
241
|
input: {
|
|
239
242
|
name: V.name.trim(),
|
|
@@ -251,11 +254,12 @@ function Ke() {
|
|
|
251
254
|
usefulLifeMonths: t(V.usefulLifeMonths),
|
|
252
255
|
depreciationMethod: V.depreciationMethod,
|
|
253
256
|
unitsOfProductionCapacity: t(V.unitsOfProductionCapacity),
|
|
254
|
-
unitsProduced: t(V.unitsProduced)
|
|
257
|
+
unitsProduced: t(V.unitsProduced),
|
|
258
|
+
meterUnit: V.meterUnit || null
|
|
255
259
|
}
|
|
256
260
|
} });
|
|
257
|
-
},
|
|
258
|
-
e.preventDefault(),
|
|
261
|
+
}, ht = (e) => {
|
|
262
|
+
e.preventDefault(), ot({ variables: {
|
|
259
263
|
id: J.id,
|
|
260
264
|
input: {
|
|
261
265
|
disposalDate: H.disposalDate ? new Date(H.disposalDate).toISOString() : (/* @__PURE__ */ new Date()).toISOString(),
|
|
@@ -263,7 +267,7 @@ function Ke() {
|
|
|
263
267
|
notes: H.notes.trim() || null
|
|
264
268
|
}
|
|
265
269
|
} });
|
|
266
|
-
}, $ = (e, t) =>
|
|
270
|
+
}, $ = (e, t) => it((n) => n && {
|
|
267
271
|
...n,
|
|
268
272
|
[e]: t
|
|
269
273
|
});
|
|
@@ -278,27 +282,27 @@ function Ke() {
|
|
|
278
282
|
variant: "ghost",
|
|
279
283
|
size: "icon",
|
|
280
284
|
"aria-label": "Go back",
|
|
281
|
-
onClick: () =>
|
|
282
|
-
children: /* @__PURE__ */ h(
|
|
285
|
+
onClick: () => p("/assets/asset-list"),
|
|
286
|
+
children: /* @__PURE__ */ h(ue, { className: "h-4 w-4" })
|
|
283
287
|
}), /* @__PURE__ */ g("div", { children: [/* @__PURE__ */ g("div", {
|
|
284
288
|
className: "flex items-center gap-3",
|
|
285
289
|
children: [
|
|
286
290
|
/* @__PURE__ */ h("h1", {
|
|
287
291
|
className: "text-2xl font-bold",
|
|
288
|
-
children: /* @__PURE__ */ h(
|
|
292
|
+
children: /* @__PURE__ */ h(Pe, { children: J.name })
|
|
289
293
|
}),
|
|
290
294
|
/* @__PURE__ */ h("span", {
|
|
291
|
-
className: `rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${
|
|
295
|
+
className: `rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${Ke[J.status] ?? "bg-bg-sunken text-text-secondary"}`,
|
|
292
296
|
children: J.status.replace(/_/g, " ")
|
|
293
297
|
}),
|
|
294
298
|
/* @__PURE__ */ h("span", {
|
|
295
|
-
className: `rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${
|
|
299
|
+
className: `rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${Ue[J.condition] ?? ""}`,
|
|
296
300
|
children: J.condition
|
|
297
301
|
})
|
|
298
302
|
]
|
|
299
303
|
}), /* @__PURE__ */ g("p", {
|
|
300
304
|
className: "text-sm text-text-secondary mt-1",
|
|
301
|
-
children: [J.assetNumber, J.serialNumber ? /* @__PURE__ */ g(
|
|
305
|
+
children: [J.assetNumber, J.serialNumber ? /* @__PURE__ */ g(Te, { children: [" · SN: ", J.serialNumber] }) : null]
|
|
302
306
|
})] })]
|
|
303
307
|
}), /* @__PURE__ */ g("div", {
|
|
304
308
|
className: "flex items-center gap-2",
|
|
@@ -306,31 +310,31 @@ function Ke() {
|
|
|
306
310
|
/* @__PURE__ */ g(_, {
|
|
307
311
|
size: "sm",
|
|
308
312
|
variant: "outline",
|
|
309
|
-
onClick:
|
|
310
|
-
children: [/* @__PURE__ */ h(
|
|
313
|
+
onClick: pt,
|
|
314
|
+
children: [/* @__PURE__ */ h(ge, { className: "mr-2 h-4 w-4" }), "Edit"]
|
|
311
315
|
}),
|
|
312
|
-
|
|
316
|
+
lt ? null : /* @__PURE__ */ g(_, {
|
|
313
317
|
size: "sm",
|
|
314
318
|
variant: "outline",
|
|
315
319
|
onClick: () => z(!0),
|
|
316
|
-
children: [/* @__PURE__ */ h(
|
|
320
|
+
children: [/* @__PURE__ */ h(u, { className: "mr-2 h-4 w-4" }), "Dispose"]
|
|
317
321
|
}),
|
|
318
322
|
/* @__PURE__ */ g(_, {
|
|
319
323
|
size: "sm",
|
|
320
324
|
variant: "outline",
|
|
321
325
|
className: "text-status-error-text",
|
|
322
326
|
onClick: () => B(!0),
|
|
323
|
-
children: [/* @__PURE__ */ h(
|
|
327
|
+
children: [/* @__PURE__ */ h(ye, { className: "mr-2 h-4 w-4" }), "Delete"]
|
|
324
328
|
})
|
|
325
329
|
]
|
|
326
330
|
})]
|
|
327
331
|
}),
|
|
328
|
-
/* @__PURE__ */ h(
|
|
329
|
-
|
|
332
|
+
/* @__PURE__ */ h(Fe, { children: L("assethandler.asset.detail.purpose", "The complete profile of a single {{assetLower}} — its identity, condition, location, assignment, financials and maintenance history. Use this page as the {{assetLower}}'s home base: edit its details, track its book value, and dispose of it when it reaches end of life.") }),
|
|
333
|
+
lt ? /* @__PURE__ */ g(Me, { children: [
|
|
330
334
|
/* @__PURE__ */ g("div", {
|
|
331
335
|
className: "flex items-center gap-2 text-sm font-medium",
|
|
332
336
|
children: [
|
|
333
|
-
/* @__PURE__ */ h(
|
|
337
|
+
/* @__PURE__ */ h(u, { className: "h-4 w-4" }),
|
|
334
338
|
"This asset was disposed",
|
|
335
339
|
J.disposalDate ? ` on ${new Date(J.disposalDate).toLocaleDateString()}` : ""
|
|
336
340
|
]
|
|
@@ -353,8 +357,8 @@ function Ke() {
|
|
|
353
357
|
value: F(J.currentValue),
|
|
354
358
|
delta: J.purchaseValue == null ? void 0 : `of ${F(J.purchaseValue)}`,
|
|
355
359
|
deltaDirection: "neutral",
|
|
356
|
-
spark:
|
|
357
|
-
icon:
|
|
360
|
+
spark: ut.length > 1 ? ut : void 0,
|
|
361
|
+
icon: fe
|
|
358
362
|
}),
|
|
359
363
|
/* @__PURE__ */ h(s, {
|
|
360
364
|
label: "Maintenance records",
|
|
@@ -362,17 +366,17 @@ function Ke() {
|
|
|
362
366
|
delta: X.length > 0 ? `${X.length} open` : void 0,
|
|
363
367
|
deltaTone: "neutral",
|
|
364
368
|
deltaDirection: "neutral",
|
|
365
|
-
icon:
|
|
369
|
+
icon: f
|
|
366
370
|
}),
|
|
367
371
|
/* @__PURE__ */ h(s, {
|
|
368
372
|
label: "Registered",
|
|
369
373
|
value: J.createdAt ? new Date(J.createdAt).toLocaleDateString() : "—",
|
|
370
|
-
icon:
|
|
374
|
+
icon: d
|
|
371
375
|
}),
|
|
372
376
|
/* @__PURE__ */ h(s, {
|
|
373
377
|
label: "Location",
|
|
374
378
|
value: J.locationName || "—",
|
|
375
|
-
icon:
|
|
379
|
+
icon: he
|
|
376
380
|
})
|
|
377
381
|
]
|
|
378
382
|
}),
|
|
@@ -380,10 +384,10 @@ function Ke() {
|
|
|
380
384
|
className: "grid gap-6 lg:grid-cols-3",
|
|
381
385
|
children: [/* @__PURE__ */ h("div", {
|
|
382
386
|
className: "min-w-0 lg:col-span-2",
|
|
383
|
-
children: /* @__PURE__ */ g(
|
|
387
|
+
children: /* @__PURE__ */ g(Ie, {
|
|
384
388
|
defaultValue: "details",
|
|
385
389
|
children: [
|
|
386
|
-
/* @__PURE__ */ g(
|
|
390
|
+
/* @__PURE__ */ g(Le, {
|
|
387
391
|
className: "max-w-full justify-start overflow-x-auto",
|
|
388
392
|
children: [
|
|
389
393
|
/* @__PURE__ */ h(M, {
|
|
@@ -419,58 +423,58 @@ function Ke() {
|
|
|
419
423
|
/* @__PURE__ */ h(N, {
|
|
420
424
|
label: L("assethandler.asset.detail.field.tag", "{{asset}} Tag"),
|
|
421
425
|
value: J.assetNumber,
|
|
422
|
-
icon:
|
|
426
|
+
icon: pe,
|
|
423
427
|
mono: !0
|
|
424
428
|
}),
|
|
425
429
|
/* @__PURE__ */ h(N, {
|
|
426
430
|
label: "Serial Number",
|
|
427
431
|
value: J.serialNumber || "—",
|
|
428
|
-
icon:
|
|
432
|
+
icon: pe,
|
|
429
433
|
mono: !0
|
|
430
434
|
}),
|
|
431
435
|
/* @__PURE__ */ h(N, {
|
|
432
436
|
label: "Category",
|
|
433
|
-
value: t(J.category,
|
|
434
|
-
icon:
|
|
437
|
+
value: t(J.category, Ye),
|
|
438
|
+
icon: me,
|
|
435
439
|
capitalize: !0
|
|
436
440
|
}),
|
|
437
441
|
/* @__PURE__ */ h(N, {
|
|
438
442
|
label: "Condition",
|
|
439
|
-
icon:
|
|
443
|
+
icon: _e,
|
|
440
444
|
children: /* @__PURE__ */ h("span", {
|
|
441
|
-
className: `inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${
|
|
445
|
+
className: `inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${Ue[J.condition] ?? ""}`,
|
|
442
446
|
children: J.condition
|
|
443
447
|
})
|
|
444
448
|
}),
|
|
445
449
|
/* @__PURE__ */ h(N, {
|
|
446
450
|
label: "Assigned To",
|
|
447
451
|
value: J.assignedTo || "—",
|
|
448
|
-
icon:
|
|
452
|
+
icon: Se
|
|
449
453
|
}),
|
|
450
454
|
/* @__PURE__ */ h(N, {
|
|
451
455
|
label: L("assethandler.asset.detail.nextService", "Next Service"),
|
|
452
|
-
value:
|
|
453
|
-
icon:
|
|
456
|
+
value: ct ? new Date(ct).toLocaleDateString() : "—",
|
|
457
|
+
icon: f
|
|
454
458
|
}),
|
|
455
459
|
/* @__PURE__ */ h(N, {
|
|
456
460
|
label: "Department",
|
|
457
461
|
value: J.department || "—",
|
|
458
|
-
icon:
|
|
462
|
+
icon: de
|
|
459
463
|
}),
|
|
460
464
|
/* @__PURE__ */ h(N, {
|
|
461
465
|
label: "Location",
|
|
462
466
|
value: J.locationName || "—",
|
|
463
|
-
icon:
|
|
467
|
+
icon: he
|
|
464
468
|
}),
|
|
465
469
|
/* @__PURE__ */ h(N, {
|
|
466
470
|
label: "Supplier",
|
|
467
471
|
value: J.supplier || "—",
|
|
468
|
-
icon:
|
|
472
|
+
icon: xe
|
|
469
473
|
}),
|
|
470
474
|
/* @__PURE__ */ h(N, {
|
|
471
475
|
label: "Warranty Expiry",
|
|
472
476
|
value: J.warrantyExpiry ? new Date(J.warrantyExpiry).toLocaleDateString() : "—",
|
|
473
|
-
icon:
|
|
477
|
+
icon: d
|
|
474
478
|
})
|
|
475
479
|
]
|
|
476
480
|
}),
|
|
@@ -511,7 +515,7 @@ function Ke() {
|
|
|
511
515
|
children: [/* @__PURE__ */ h(c, {
|
|
512
516
|
title: "Depreciation & book value",
|
|
513
517
|
subtitle: "Projected book value over the useful life",
|
|
514
|
-
icon:
|
|
518
|
+
icon: be,
|
|
515
519
|
children: Z.length > 0 ? /* @__PURE__ */ h(ne, {
|
|
516
520
|
data: Z,
|
|
517
521
|
xKey: "year",
|
|
@@ -548,7 +552,7 @@ function Ke() {
|
|
|
548
552
|
}),
|
|
549
553
|
/* @__PURE__ */ h(P, {
|
|
550
554
|
label: "Depreciation Method",
|
|
551
|
-
value: J.depreciationMethod ?
|
|
555
|
+
value: J.depreciationMethod ? Ge[J.depreciationMethod.toUpperCase()] ?? J.depreciationMethod : "—"
|
|
552
556
|
}),
|
|
553
557
|
/* @__PURE__ */ h(P, {
|
|
554
558
|
label: "Supplier",
|
|
@@ -566,7 +570,7 @@ function Ke() {
|
|
|
566
570
|
Q.length > 0 ? /* @__PURE__ */ h(c, {
|
|
567
571
|
title: "Total cost of ownership",
|
|
568
572
|
subtitle: "What drives lifetime cost",
|
|
569
|
-
icon:
|
|
573
|
+
icon: fe,
|
|
570
574
|
children: /* @__PURE__ */ h(ie, {
|
|
571
575
|
data: Q,
|
|
572
576
|
centerLabel: "TCO",
|
|
@@ -580,12 +584,12 @@ function Ke() {
|
|
|
580
584
|
/* @__PURE__ */ g(j, {
|
|
581
585
|
value: "maintenance",
|
|
582
586
|
className: "mt-4 space-y-4",
|
|
583
|
-
children: [
|
|
587
|
+
children: [dt.length > 0 ? /* @__PURE__ */ h(c, {
|
|
584
588
|
title: "Maintenance cost history",
|
|
585
589
|
subtitle: "Recorded cost per maintenance event",
|
|
586
|
-
icon:
|
|
590
|
+
icon: f,
|
|
587
591
|
children: /* @__PURE__ */ h(re, {
|
|
588
|
-
data:
|
|
592
|
+
data: dt,
|
|
589
593
|
xKey: "label",
|
|
590
594
|
height: 220,
|
|
591
595
|
valueFormat: I,
|
|
@@ -594,10 +598,10 @@ function Ke() {
|
|
|
594
598
|
label: "Cost"
|
|
595
599
|
}]
|
|
596
600
|
})
|
|
597
|
-
}) : null, /* @__PURE__ */ g(
|
|
601
|
+
}) : null, /* @__PURE__ */ g(De, { children: [/* @__PURE__ */ g(Ae, { children: [/* @__PURE__ */ g(je, {
|
|
598
602
|
className: "flex items-center gap-2",
|
|
599
|
-
children: [/* @__PURE__ */ h(
|
|
600
|
-
}), /* @__PURE__ */ g(
|
|
603
|
+
children: [/* @__PURE__ */ h(f, { className: "h-4 w-4" }), "Maintenance History"]
|
|
604
|
+
}), /* @__PURE__ */ g(ke, { children: [Y.length, " records found"] })] }), /* @__PURE__ */ h(Oe, { children: Y.length === 0 ? /* @__PURE__ */ h("p", {
|
|
601
605
|
className: "py-8 text-center text-text-secondary",
|
|
602
606
|
children: "No maintenance records for this asset."
|
|
603
607
|
}) : /* @__PURE__ */ h("div", {
|
|
@@ -609,7 +613,7 @@ function Ke() {
|
|
|
609
613
|
children: [
|
|
610
614
|
/* @__PURE__ */ g("div", {
|
|
611
615
|
className: "flex items-center gap-2",
|
|
612
|
-
children: [/* @__PURE__ */ h(
|
|
616
|
+
children: [/* @__PURE__ */ h(Ee, {
|
|
613
617
|
variant: "outline",
|
|
614
618
|
className: "capitalize",
|
|
615
619
|
children: e.type
|
|
@@ -651,14 +655,14 @@ function Ke() {
|
|
|
651
655
|
})
|
|
652
656
|
}), /* @__PURE__ */ g("aside", {
|
|
653
657
|
className: "space-y-6",
|
|
654
|
-
children: [/* @__PURE__ */ h(
|
|
658
|
+
children: [/* @__PURE__ */ h(Ne, {
|
|
655
659
|
treatment: "glass",
|
|
656
660
|
className: "border-border-seam",
|
|
657
661
|
children: /* @__PURE__ */ g("div", {
|
|
658
662
|
className: "space-y-3 p-5",
|
|
659
663
|
children: [/* @__PURE__ */ g("h3", {
|
|
660
664
|
className: "flex items-center gap-2 text-sm font-semibold",
|
|
661
|
-
children: [/* @__PURE__ */ h(
|
|
665
|
+
children: [/* @__PURE__ */ h(ve, { className: "h-4 w-4 text-text-secondary" }), "Tags"]
|
|
662
666
|
}), J.tags.length === 0 ? /* @__PURE__ */ h("p", {
|
|
663
667
|
className: "text-xs text-text-secondary",
|
|
664
668
|
children: "No tags yet"
|
|
@@ -674,13 +678,13 @@ function Ke() {
|
|
|
674
678
|
})]
|
|
675
679
|
}),
|
|
676
680
|
/* @__PURE__ */ h(b, {
|
|
677
|
-
open:
|
|
681
|
+
open: tt,
|
|
678
682
|
onOpenChange: R,
|
|
679
683
|
children: /* @__PURE__ */ g(x, {
|
|
680
684
|
className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl",
|
|
681
685
|
children: [/* @__PURE__ */ g(w, { children: [/* @__PURE__ */ h(T, { children: "Edit asset" }), /* @__PURE__ */ h(S, { children: "Update this asset's details and financials." })] }), V ? /* @__PURE__ */ g("form", {
|
|
682
686
|
className: "space-y-4",
|
|
683
|
-
onSubmit:
|
|
687
|
+
onSubmit: mt,
|
|
684
688
|
children: [
|
|
685
689
|
/* @__PURE__ */ g("div", {
|
|
686
690
|
className: "grid gap-4 md:grid-cols-2",
|
|
@@ -700,7 +704,7 @@ function Ke() {
|
|
|
700
704
|
}),
|
|
701
705
|
/* @__PURE__ */ g("div", {
|
|
702
706
|
className: "space-y-2",
|
|
703
|
-
children: [/* @__PURE__ */ h(y, { children: "Description" }), /* @__PURE__ */ h(
|
|
707
|
+
children: [/* @__PURE__ */ h(y, { children: "Description" }), /* @__PURE__ */ h(Re, {
|
|
704
708
|
value: V.description,
|
|
705
709
|
onChange: (e) => $("description", e.target.value),
|
|
706
710
|
rows: 2
|
|
@@ -871,7 +875,7 @@ function Ke() {
|
|
|
871
875
|
] })]
|
|
872
876
|
})]
|
|
873
877
|
}),
|
|
874
|
-
V.depreciationMethod === "UNITS_OF_PRODUCTION" ? /* @__PURE__ */ g(
|
|
878
|
+
V.depreciationMethod === "UNITS_OF_PRODUCTION" ? /* @__PURE__ */ g("div", {
|
|
875
879
|
className: "space-y-2",
|
|
876
880
|
children: [/* @__PURE__ */ h(y, { children: "Lifetime Capacity (units)" }), /* @__PURE__ */ h(v, {
|
|
877
881
|
type: "number",
|
|
@@ -880,16 +884,31 @@ function Ke() {
|
|
|
880
884
|
value: V.unitsOfProductionCapacity,
|
|
881
885
|
onChange: (e) => $("unitsOfProductionCapacity", e.target.value)
|
|
882
886
|
})]
|
|
883
|
-
})
|
|
887
|
+
}) : null,
|
|
888
|
+
/* @__PURE__ */ g("div", {
|
|
889
|
+
className: "space-y-2",
|
|
890
|
+
children: [/* @__PURE__ */ h(y, { children: "Meter unit" }), /* @__PURE__ */ g(E, {
|
|
891
|
+
value: V.meterUnit || "__NOT_METERED__",
|
|
892
|
+
onValueChange: (e) => $("meterUnit", e === "__NOT_METERED__" ? "" : e),
|
|
893
|
+
children: [/* @__PURE__ */ h(k, { children: /* @__PURE__ */ h(A, { placeholder: "Not metered" }) }), /* @__PURE__ */ g(D, { children: [/* @__PURE__ */ h(O, {
|
|
894
|
+
value: ce,
|
|
895
|
+
children: "Not metered"
|
|
896
|
+
}), se.map((e) => /* @__PURE__ */ h(O, {
|
|
897
|
+
value: e.value,
|
|
898
|
+
children: e.label
|
|
899
|
+
}, e.value))] })]
|
|
900
|
+
})]
|
|
901
|
+
}),
|
|
902
|
+
/* @__PURE__ */ g("div", {
|
|
884
903
|
className: "space-y-2",
|
|
885
|
-
children: [/* @__PURE__ */ h(y, { children:
|
|
904
|
+
children: [/* @__PURE__ */ h(y, { children: le(V.meterUnit) }), /* @__PURE__ */ h(v, {
|
|
886
905
|
type: "number",
|
|
887
906
|
min: "0",
|
|
888
907
|
step: "1",
|
|
889
908
|
value: V.unitsProduced,
|
|
890
909
|
onChange: (e) => $("unitsProduced", e.target.value)
|
|
891
910
|
})]
|
|
892
|
-
})
|
|
911
|
+
})
|
|
893
912
|
]
|
|
894
913
|
}),
|
|
895
914
|
/* @__PURE__ */ g(C, { children: [/* @__PURE__ */ h(_, {
|
|
@@ -908,11 +927,11 @@ function Ke() {
|
|
|
908
927
|
})
|
|
909
928
|
}),
|
|
910
929
|
/* @__PURE__ */ h(b, {
|
|
911
|
-
open:
|
|
930
|
+
open: nt,
|
|
912
931
|
onOpenChange: z,
|
|
913
932
|
children: /* @__PURE__ */ g(x, { children: [/* @__PURE__ */ g(w, { children: [/* @__PURE__ */ h(T, { children: "Dispose asset" }), /* @__PURE__ */ h(S, { children: "Record the disposal of this asset. It will be marked as disposed and removed from active inventory." })] }), /* @__PURE__ */ g("form", {
|
|
914
933
|
className: "space-y-4",
|
|
915
|
-
onSubmit:
|
|
934
|
+
onSubmit: ht,
|
|
916
935
|
children: [
|
|
917
936
|
/* @__PURE__ */ g("div", {
|
|
918
937
|
className: "space-y-2",
|
|
@@ -938,7 +957,7 @@ function Ke() {
|
|
|
938
957
|
}),
|
|
939
958
|
/* @__PURE__ */ g("div", {
|
|
940
959
|
className: "space-y-2",
|
|
941
|
-
children: [/* @__PURE__ */ h(y, { children: "Notes" }), /* @__PURE__ */ h(
|
|
960
|
+
children: [/* @__PURE__ */ h(y, { children: "Notes" }), /* @__PURE__ */ h(Re, {
|
|
942
961
|
placeholder: "Optional details about the disposal",
|
|
943
962
|
value: H.notes,
|
|
944
963
|
onChange: (e) => U((t) => ({
|
|
@@ -963,7 +982,7 @@ function Ke() {
|
|
|
963
982
|
})] })
|
|
964
983
|
}),
|
|
965
984
|
/* @__PURE__ */ h(b, {
|
|
966
|
-
open:
|
|
985
|
+
open: rt,
|
|
967
986
|
onOpenChange: B,
|
|
968
987
|
children: /* @__PURE__ */ g(x, { children: [/* @__PURE__ */ g(w, { children: [/* @__PURE__ */ h(T, { children: "Delete asset" }), /* @__PURE__ */ g(S, { children: [
|
|
969
988
|
"This removes ",
|
|
@@ -979,7 +998,7 @@ function Ke() {
|
|
|
979
998
|
children: "Cancel"
|
|
980
999
|
}), /* @__PURE__ */ h(_, {
|
|
981
1000
|
variant: "destructive",
|
|
982
|
-
onClick: () => void
|
|
1001
|
+
onClick: () => void st({ variables: { id: J.id } }),
|
|
983
1002
|
disabled: K,
|
|
984
1003
|
children: K ? "Deleting…" : "Delete asset"
|
|
985
1004
|
})] })] })
|
|
@@ -1015,6 +1034,6 @@ function P({ label: e, value: t, striped: n }) {
|
|
|
1015
1034
|
});
|
|
1016
1035
|
}
|
|
1017
1036
|
//#endregion
|
|
1018
|
-
export {
|
|
1037
|
+
export { Ye as AssetsAssetDetailPage };
|
|
1019
1038
|
|
|
1020
1039
|
//# sourceMappingURL=AssetsAssetDetailPage.js.map
|