@burdenoff/microfe-assethandler 2026.826.4 → 2026.826.6

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.
@@ -16,15 +16,16 @@ import { ChartCard as c } from "../components/ChartCard.js";
16
16
  import "../components/index.js";
17
17
  import { METER_UNIT_OPTIONS as se, NOT_METERED as ce, meterReadingLabel as le } from "../utils/meter.js";
18
18
  import { printAssetTag as ue } from "../utils/printAssetTag.js";
19
+ import { buildTcoSlices as de } from "../utils/tco.js";
19
20
  import { useState as l } from "react";
20
- import { Archive as de, ArrowLeft as fe, Building2 as pe, Calendar as me, DollarSign as he, Hash as ge, Layers as _e, MapPin as ve, Pencil as ye, Printer as be, ShieldCheck as xe, Tag as Se, Trash2 as Ce, TrendingDown as we, Truck as Te, User as Ee, Wrench as u } from "lucide-react";
21
- import { useParams as De } from "react-router";
21
+ import { Archive as fe, ArrowLeft as pe, Building2 as me, Calendar as he, DollarSign as ge, Hash as _e, Layers as ve, MapPin as ye, Pencil as be, Printer as xe, ShieldCheck as Se, Tag as Ce, Trash2 as we, TrendingDown as Te, Truck as Ee, User as De, Wrench as u } from "lucide-react";
22
+ import { useParams as Oe } from "react-router";
22
23
  import { gql as d } from "@apollo/client";
23
- import { useMutation as f, useQuery as Oe } from "@apollo/client/react";
24
- import { Fragment as ke, jsx as p, jsxs as m } from "react/jsx-runtime";
25
- import { Badge as Ae, Button as h, Card as je, CardContent as Me, CardDescription as Ne, CardHeader as Pe, CardTitle as Fe, EmphasisPanel as Ie, GlassCard as Le, GradientText as Re, Input as g, Label as _, PagePurpose as ze, ResponsiveDialog as v, ResponsiveDialogContent as y, ResponsiveDialogDescription as b, ResponsiveDialogFooter as x, ResponsiveDialogHeader as S, ResponsiveDialogTitle as C, Select as w, SelectContent as T, SelectItem as E, SelectTrigger as D, SelectValue as O, Tabs as Be, TabsContent as k, TabsList as Ve, TabsTrigger as A, Textarea as He } from "@burdenoff/fe-libs/ui";
24
+ import { useMutation as f, useQuery as ke } from "@apollo/client/react";
25
+ import { Fragment as Ae, jsx as p, jsxs as m } from "react/jsx-runtime";
26
+ import { Badge as je, Button as h, Card as Me, CardContent as Ne, CardDescription as Pe, CardHeader as Fe, CardTitle as Ie, EmphasisPanel as Le, GlassCard as Re, GradientText as ze, Input as g, Label as _, PagePurpose as Be, ResponsiveDialog as v, ResponsiveDialogContent as y, ResponsiveDialogDescription as b, ResponsiveDialogFooter as x, ResponsiveDialogHeader as S, ResponsiveDialogTitle as C, Select as w, SelectContent as T, SelectItem as E, SelectTrigger as D, SelectValue as O, Tabs as Ve, TabsContent as k, TabsList as He, TabsTrigger as A, Textarea as Ue } from "@burdenoff/fe-libs/ui";
26
27
  //#region src/assethandler/pages/AssetsAssetDetailPage.tsx
27
- var Ue = d`
28
+ var We = d`
28
29
  query AssetHandlerAsset($id: ID!) {
29
30
  asset(id: $id) {
30
31
  id
@@ -60,49 +61,49 @@ var Ue = d`
60
61
  totalCostOfOwnership
61
62
  }
62
63
  }
63
- `, We = d`
64
+ `, Ge = d`
64
65
  mutation AssetHandlerUpdateAsset($id: ID!, $input: UpdateAssetInput!) {
65
66
  updateAsset(id: $id, input: $input) {
66
67
  id
67
68
  }
68
69
  }
69
- `, Ge = d`
70
+ `, Ke = d`
70
71
  mutation AssetHandlerDisposeAsset($id: ID!, $input: DisposeAssetInput!) {
71
72
  disposeAsset(id: $id, input: $input) {
72
73
  id
73
74
  status
74
75
  }
75
76
  }
76
- `, Ke = d`
77
+ `, qe = d`
77
78
  mutation AssetHandlerDeleteAsset($id: ID!) {
78
79
  deleteAsset(id: $id)
79
80
  }
80
- `, qe = {
81
+ `, Je = {
81
82
  excellent: "text-status-success-text bg-status-success-bg-subtle",
82
83
  good: "text-status-info-text bg-status-info-bg-subtle",
83
84
  fair: "text-status-warning-text bg-status-warning-bg-subtle",
84
85
  poor: "text-status-warning-text bg-status-warning-bg-subtle",
85
86
  damaged: "text-status-error-text bg-status-error-bg-subtle"
86
87
  };
87
- function Je(e) {
88
+ function Ye(e) {
88
89
  let t = Date.now();
89
90
  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];
90
91
  }
91
- var Ye = {
92
+ var Xe = {
92
93
  STRAIGHT_LINE: "Straight line",
93
94
  REDUCING_BALANCE: "Reducing balance (200%)",
94
95
  DECLINING_BALANCE: "Declining balance (150%)",
95
96
  SUM_OF_YEARS_DIGITS: "Sum of years' digits",
96
97
  UNITS_OF_PRODUCTION: "Units of production",
97
98
  NONE: "None"
98
- }, Xe = {
99
+ }, Ze = {
99
100
  active: "bg-status-success-bg-subtle text-status-success-text",
100
101
  maintenance: "bg-status-warning-bg-subtle text-status-warning-text",
101
102
  inactive: "bg-bg-sunken text-text-secondary",
102
103
  retired: "bg-bg-sunken text-text-secondary",
103
104
  disposed: "bg-status-error-bg-subtle text-status-error-text"
104
105
  };
105
- function Ze(e) {
106
+ function Qe(e) {
106
107
  let t = e.purchaseValue, n = e.usefulLifeMonths;
107
108
  if (!t || t <= 0 || !n || n <= 0) return [];
108
109
  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));
@@ -138,7 +139,7 @@ function Ze(e) {
138
139
  }
139
140
  return o;
140
141
  }
141
- function Qe(e) {
142
+ function $e(e) {
142
143
  return {
143
144
  name: e.name,
144
145
  description: e.description ?? "",
@@ -159,73 +160,65 @@ function Qe(e) {
159
160
  meterUnit: e.meterUnit ?? ""
160
161
  };
161
162
  }
162
- function $e() {
163
- let d = i(), { labels: $e } = n(), { format: N, compact: P } = r(), { assetId: et } = De(), { maintenanceRecords: tt } = e(), F = a(), { data: I, loading: nt, refetch: rt } = Oe(Ue, {
163
+ function j() {
164
+ let d = i(), { labels: j } = n(), { format: P, compact: F } = r(), { assetId: et } = Oe(), { maintenanceRecords: tt } = e(), I = a(), { data: nt, loading: rt, refetch: it } = ke(We, {
164
165
  variables: { id: et ?? "" },
165
166
  skip: !et,
166
167
  fetchPolicy: "cache-and-network"
167
- }), [it, L] = l(!1), [at, R] = l(!1), [ot, z] = l(!1), [B, V] = l(null), [H, U] = l({
168
+ }), [at, L] = l(!1), [ot, R] = l(!1), [st, z] = l(!1), [B, ct] = l(null), [V, H] = l({
168
169
  disposalDate: "",
169
170
  method: "",
170
171
  notes: ""
171
- }), [st, { loading: W }] = f(We, {
172
+ }), [lt, { loading: U }] = f(Ge, {
172
173
  refetchQueries: ["AssetHandlerBootstrap"],
173
174
  onCompleted: () => {
174
- o.success("Asset updated", "Your changes have been saved."), L(!1), rt();
175
+ o.success("Asset updated", "Your changes have been saved."), L(!1), it();
175
176
  },
176
177
  onError: (e) => o.error("Could not update asset", e.message)
177
- }), [ct, { loading: G }] = f(Ge, {
178
+ }), [ut, { loading: W }] = f(Ke, {
178
179
  refetchQueries: ["AssetHandlerBootstrap"],
179
180
  onCompleted: () => {
180
- o.success("Asset disposed", "The asset has been marked as disposed."), R(!1), rt();
181
+ o.success("Asset disposed", "The asset has been marked as disposed."), R(!1), it();
181
182
  },
182
183
  onError: (e) => o.error("Could not dispose asset", e.message)
183
- }), [lt, { loading: K }] = f(Ke, {
184
+ }), [dt, { loading: G }] = f(qe, {
184
185
  refetchQueries: ["AssetHandlerBootstrap"],
185
186
  onCompleted: () => {
186
187
  o.success("Asset deleted", "The asset has been removed from the inventory."), d("/assets/asset-list");
187
188
  },
188
189
  onError: (e) => o.error("Could not delete asset", e.message)
189
190
  });
190
- if (nt && !I) return /* @__PURE__ */ p("div", {
191
+ if (rt && !nt) return /* @__PURE__ */ p("div", {
191
192
  className: "space-y-3 p-6",
192
193
  children: Array.from({ length: 6 }).map((e, t) => /* @__PURE__ */ p("div", { className: "h-10 rounded-md bg-bg-sunken motion-safe:animate-vc-shimmer" }, t))
193
194
  });
194
- let q = I?.asset;
195
- if (!q) return /* @__PURE__ */ p(oe, {
196
- entityLabel: F("assethandler.asset.detail.notFound.entity", "{{asset}}"),
197
- description: F("assethandler.asset.detail.notFound.description", "This {{assetLower}} may have been disposed or removed. Return to the inventory to find it."),
198
- backLabel: F("assethandler.asset.detail.notFound.back", "Back to inventory"),
195
+ let K = nt?.asset;
196
+ if (!K) return /* @__PURE__ */ p(oe, {
197
+ entityLabel: I("assethandler.asset.detail.notFound.entity", "{{asset}}"),
198
+ description: I("assethandler.asset.detail.notFound.description", "This {{assetLower}} may have been disposed or removed. Return to the inventory to find it."),
199
+ backLabel: I("assethandler.asset.detail.notFound.back", "Back to inventory"),
199
200
  onBack: () => d("/assets/asset-list")
200
201
  });
201
- let J = {
202
- ...q,
203
- status: q.status.toLowerCase(),
204
- condition: q.condition.toLowerCase(),
205
- category: q.category.toLowerCase()
206
- }, Y = tt.filter((e) => e.assetId === J.id), X = Y.filter((e) => e.status !== "completed" && e.status !== "cancelled"), ut = Je(X), dt = J.status === "disposed", Z = Ze({
207
- purchaseValue: J.purchaseValue,
208
- salvageValue: J.salvageValue,
209
- usefulLifeMonths: J.usefulLifeMonths,
210
- method: J.depreciationMethod,
211
- unitsOfProductionCapacity: J.unitsOfProductionCapacity,
212
- unitsProduced: J.unitsProduced
213
- }), ft = Z.map((e) => e.bookValue), pt = Y.filter((e) => (e.actualCost ?? e.estimatedCost) != null).map((e) => ({
202
+ let q = {
203
+ ...K,
204
+ status: K.status.toLowerCase(),
205
+ condition: K.condition.toLowerCase(),
206
+ category: K.category.toLowerCase()
207
+ }, J = tt.filter((e) => e.assetId === q.id), Y = J.filter((e) => e.status !== "completed" && e.status !== "cancelled"), ft = Ye(Y), pt = q.status === "disposed", X = Qe({
208
+ purchaseValue: q.purchaseValue,
209
+ salvageValue: q.salvageValue,
210
+ usefulLifeMonths: q.usefulLifeMonths,
211
+ method: q.depreciationMethod,
212
+ unitsOfProductionCapacity: q.unitsOfProductionCapacity,
213
+ unitsProduced: q.unitsProduced
214
+ }), mt = X.map((e) => e.bookValue), Z = J.filter((e) => (e.actualCost ?? e.estimatedCost) != null).map((e) => ({
214
215
  label: e.scheduledDate ? new Date(e.scheduledDate).toLocaleDateString(void 0, {
215
216
  month: "short",
216
217
  year: "2-digit"
217
218
  }) : e.title.slice(0, 12),
218
219
  cost: e.actualCost ?? e.estimatedCost ?? 0
219
- })), mt = Y.reduce((e, t) => e + (t.actualCost ?? t.estimatedCost ?? 0), 0), Q = J.purchaseValue != null && mt > 0 ? [{
220
- name: "Purchase",
221
- value: J.purchaseValue,
222
- color: "var(--color-accent-primary)"
223
- }, {
224
- name: "Maintenance",
225
- value: mt,
226
- color: "var(--color-status-info-bg)"
227
- }] : [], ht = () => {
228
- V(Qe(q)), L(!0);
220
+ })), Q = de(q.purchaseValue, q.totalCostOfOwnership), ht = () => {
221
+ ct($e(K)), L(!0);
229
222
  }, gt = (e) => {
230
223
  if (e.preventDefault(), !B) return;
231
224
  if (!B.name.trim()) {
@@ -238,8 +231,8 @@ function $e() {
238
231
  let n = Number(t);
239
232
  return Number.isNaN(n) ? null : n;
240
233
  };
241
- st({ variables: {
242
- id: J.id,
234
+ lt({ variables: {
235
+ id: q.id,
243
236
  input: {
244
237
  name: B.name.trim(),
245
238
  description: B.description.trim() || null,
@@ -261,15 +254,15 @@ function $e() {
261
254
  }
262
255
  } });
263
256
  }, _t = (e) => {
264
- e.preventDefault(), ct({ variables: {
265
- id: J.id,
257
+ e.preventDefault(), ut({ variables: {
258
+ id: q.id,
266
259
  input: {
267
- disposalDate: H.disposalDate ? new Date(H.disposalDate).toISOString() : (/* @__PURE__ */ new Date()).toISOString(),
268
- method: H.method.trim() || null,
269
- notes: H.notes.trim() || null
260
+ disposalDate: V.disposalDate ? new Date(V.disposalDate).toISOString() : (/* @__PURE__ */ new Date()).toISOString(),
261
+ method: V.method.trim() || null,
262
+ notes: V.notes.trim() || null
270
263
  }
271
264
  } });
272
- }, $ = (e, t) => V((n) => n && {
265
+ }, $ = (e, t) => ct((n) => n && {
273
266
  ...n,
274
267
  [e]: t
275
268
  });
@@ -285,26 +278,26 @@ function $e() {
285
278
  size: "icon",
286
279
  "aria-label": "Go back",
287
280
  onClick: () => d("/assets/asset-list"),
288
- children: /* @__PURE__ */ p(fe, { className: "h-4 w-4" })
281
+ children: /* @__PURE__ */ p(pe, { className: "h-4 w-4" })
289
282
  }), /* @__PURE__ */ m("div", { children: [/* @__PURE__ */ m("div", {
290
283
  className: "flex items-center gap-3",
291
284
  children: [
292
285
  /* @__PURE__ */ p("h1", {
293
286
  className: "text-2xl font-bold",
294
- children: /* @__PURE__ */ p(Re, { children: J.name })
287
+ children: /* @__PURE__ */ p(ze, { children: q.name })
295
288
  }),
296
289
  /* @__PURE__ */ p("span", {
297
- className: `rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${Xe[J.status] ?? "bg-bg-sunken text-text-secondary"}`,
298
- children: J.status.replace(/_/g, " ")
290
+ className: `rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${Ze[q.status] ?? "bg-bg-sunken text-text-secondary"}`,
291
+ children: q.status.replace(/_/g, " ")
299
292
  }),
300
293
  /* @__PURE__ */ p("span", {
301
- className: `rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${qe[J.condition] ?? ""}`,
302
- children: J.condition
294
+ className: `rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${Je[q.condition] ?? ""}`,
295
+ children: q.condition
303
296
  })
304
297
  ]
305
298
  }), /* @__PURE__ */ m("p", {
306
299
  className: "text-sm text-text-secondary mt-1",
307
- children: [J.assetNumber, J.serialNumber ? /* @__PURE__ */ m(ke, { children: [" · SN: ", J.serialNumber] }) : null]
300
+ children: [q.assetNumber, q.serialNumber ? /* @__PURE__ */ m(Ae, { children: [" · SN: ", q.serialNumber] }) : null]
308
301
  })] })]
309
302
  }), /* @__PURE__ */ m("div", {
310
303
  className: "flex items-center gap-2",
@@ -313,52 +306,52 @@ function $e() {
313
306
  size: "sm",
314
307
  variant: "outline",
315
308
  onClick: () => void ue({
316
- name: J.name,
317
- tagId: J.tagId,
318
- assetTag: J.assetNumber,
319
- category: J.category
309
+ name: q.name,
310
+ tagId: q.tagId,
311
+ assetTag: q.assetNumber,
312
+ category: q.category
320
313
  }),
321
- children: [/* @__PURE__ */ p(be, { className: "mr-2 h-4 w-4" }), "Print tag"]
314
+ children: [/* @__PURE__ */ p(xe, { className: "mr-2 h-4 w-4" }), "Print tag"]
322
315
  }),
323
316
  /* @__PURE__ */ m(h, {
324
317
  size: "sm",
325
318
  variant: "outline",
326
319
  onClick: ht,
327
- children: [/* @__PURE__ */ p(ye, { className: "mr-2 h-4 w-4" }), "Edit"]
320
+ children: [/* @__PURE__ */ p(be, { className: "mr-2 h-4 w-4" }), "Edit"]
328
321
  }),
329
- dt ? null : /* @__PURE__ */ m(h, {
322
+ pt ? null : /* @__PURE__ */ m(h, {
330
323
  size: "sm",
331
324
  variant: "outline",
332
325
  onClick: () => R(!0),
333
- children: [/* @__PURE__ */ p(de, { className: "mr-2 h-4 w-4" }), "Dispose"]
326
+ children: [/* @__PURE__ */ p(fe, { className: "mr-2 h-4 w-4" }), "Dispose"]
334
327
  }),
335
328
  /* @__PURE__ */ m(h, {
336
329
  size: "sm",
337
330
  variant: "outline",
338
331
  className: "text-status-error-text",
339
332
  onClick: () => z(!0),
340
- children: [/* @__PURE__ */ p(Ce, { className: "mr-2 h-4 w-4" }), "Delete"]
333
+ children: [/* @__PURE__ */ p(we, { className: "mr-2 h-4 w-4" }), "Delete"]
341
334
  })
342
335
  ]
343
336
  })]
344
337
  }),
345
- /* @__PURE__ */ p(ze, { children: F("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.") }),
346
- dt ? /* @__PURE__ */ m(Ie, { children: [
338
+ /* @__PURE__ */ p(Be, { children: I("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.") }),
339
+ pt ? /* @__PURE__ */ m(Le, { children: [
347
340
  /* @__PURE__ */ m("div", {
348
341
  className: "flex items-center gap-2 text-sm font-medium",
349
342
  children: [
350
- /* @__PURE__ */ p(de, { className: "h-4 w-4" }),
343
+ /* @__PURE__ */ p(fe, { className: "h-4 w-4" }),
351
344
  "This asset was disposed",
352
- J.disposalDate ? ` on ${new Date(J.disposalDate).toLocaleDateString()}` : ""
345
+ q.disposalDate ? ` on ${new Date(q.disposalDate).toLocaleDateString()}` : ""
353
346
  ]
354
347
  }),
355
- J.disposalMethod ? /* @__PURE__ */ m("p", {
348
+ q.disposalMethod ? /* @__PURE__ */ m("p", {
356
349
  className: "mt-1 text-sm text-text-secondary",
357
- children: ["Method: ", J.disposalMethod]
350
+ children: ["Method: ", q.disposalMethod]
358
351
  }) : null,
359
- J.disposalNotes ? /* @__PURE__ */ p("p", {
352
+ q.disposalNotes ? /* @__PURE__ */ p("p", {
360
353
  className: "mt-1 text-sm text-text-secondary",
361
- children: J.disposalNotes
354
+ children: q.disposalNotes
362
355
  }) : null
363
356
  ] }) : null,
364
357
  /* @__PURE__ */ m("div", {
@@ -367,29 +360,29 @@ function $e() {
367
360
  /* @__PURE__ */ p(s, {
368
361
  hero: !0,
369
362
  label: "Current value",
370
- value: N(J.currentValue),
371
- delta: J.purchaseValue == null ? void 0 : `of ${N(J.purchaseValue)}`,
363
+ value: P(q.currentValue),
364
+ delta: q.purchaseValue == null ? void 0 : `of ${P(q.purchaseValue)}`,
372
365
  deltaDirection: "neutral",
373
- spark: ft.length > 1 ? ft : void 0,
374
- icon: he
366
+ spark: mt.length > 1 ? mt : void 0,
367
+ icon: ge
375
368
  }),
376
369
  /* @__PURE__ */ p(s, {
377
370
  label: "Maintenance records",
378
- value: Y.length,
379
- delta: X.length > 0 ? `${X.length} open` : void 0,
371
+ value: J.length,
372
+ delta: Y.length > 0 ? `${Y.length} open` : void 0,
380
373
  deltaTone: "neutral",
381
374
  deltaDirection: "neutral",
382
375
  icon: u
383
376
  }),
384
377
  /* @__PURE__ */ p(s, {
385
378
  label: "Registered",
386
- value: J.createdAt ? new Date(J.createdAt).toLocaleDateString() : "—",
387
- icon: me
379
+ value: q.createdAt ? new Date(q.createdAt).toLocaleDateString() : "—",
380
+ icon: he
388
381
  }),
389
382
  /* @__PURE__ */ p(s, {
390
383
  label: "Location",
391
- value: J.locationName || "—",
392
- icon: ve
384
+ value: q.locationName || "—",
385
+ icon: ye
393
386
  })
394
387
  ]
395
388
  }),
@@ -397,10 +390,10 @@ function $e() {
397
390
  className: "grid gap-6 lg:grid-cols-3",
398
391
  children: [/* @__PURE__ */ p("div", {
399
392
  className: "min-w-0 lg:col-span-2",
400
- children: /* @__PURE__ */ m(Be, {
393
+ children: /* @__PURE__ */ m(Ve, {
401
394
  defaultValue: "details",
402
395
  children: [
403
- /* @__PURE__ */ m(Ve, {
396
+ /* @__PURE__ */ m(He, {
404
397
  className: "max-w-full justify-start overflow-x-auto",
405
398
  children: [
406
399
  /* @__PURE__ */ p(A, {
@@ -425,75 +418,75 @@ function $e() {
425
418
  value: "details",
426
419
  className: "mt-4 space-y-4",
427
420
  children: [
428
- J.description ? /* @__PURE__ */ p(j, {
421
+ q.description ? /* @__PURE__ */ p(M, {
429
422
  label: "Description",
430
- value: J.description,
423
+ value: q.description,
431
424
  full: !0
432
425
  }) : null,
433
426
  /* @__PURE__ */ m("div", {
434
427
  className: "grid gap-3 sm:grid-cols-2 xl:grid-cols-3",
435
428
  children: [
436
- /* @__PURE__ */ p(j, {
437
- label: F("assethandler.asset.detail.field.tag", "{{asset}} Tag"),
438
- value: J.assetNumber,
439
- icon: ge,
429
+ /* @__PURE__ */ p(M, {
430
+ label: I("assethandler.asset.detail.field.tag", "{{asset}} Tag"),
431
+ value: q.assetNumber,
432
+ icon: _e,
440
433
  mono: !0
441
434
  }),
442
- /* @__PURE__ */ p(j, {
435
+ /* @__PURE__ */ p(M, {
443
436
  label: "Serial Number",
444
- value: J.serialNumber || "—",
445
- icon: ge,
437
+ value: q.serialNumber || "—",
438
+ icon: _e,
446
439
  mono: !0
447
440
  }),
448
- /* @__PURE__ */ p(j, {
441
+ /* @__PURE__ */ p(M, {
449
442
  label: "Category",
450
- value: t(J.category, $e),
451
- icon: _e,
443
+ value: t(q.category, j),
444
+ icon: ve,
452
445
  capitalize: !0
453
446
  }),
454
- /* @__PURE__ */ p(j, {
447
+ /* @__PURE__ */ p(M, {
455
448
  label: "Condition",
456
- icon: xe,
449
+ icon: Se,
457
450
  children: /* @__PURE__ */ p("span", {
458
- className: `inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${qe[J.condition] ?? ""}`,
459
- children: J.condition
451
+ className: `inline-flex rounded-full px-2.5 py-0.5 text-xs font-medium capitalize ${Je[q.condition] ?? ""}`,
452
+ children: q.condition
460
453
  })
461
454
  }),
462
- /* @__PURE__ */ p(j, {
455
+ /* @__PURE__ */ p(M, {
463
456
  label: "Assigned To",
464
- value: J.assignedTo || "—",
465
- icon: Ee
457
+ value: q.assignedTo || "—",
458
+ icon: De
466
459
  }),
467
- /* @__PURE__ */ p(j, {
468
- label: F("assethandler.asset.detail.nextService", "Next Service"),
469
- value: ut ? new Date(ut).toLocaleDateString() : "—",
460
+ /* @__PURE__ */ p(M, {
461
+ label: I("assethandler.asset.detail.nextService", "Next Service"),
462
+ value: ft ? new Date(ft).toLocaleDateString() : "—",
470
463
  icon: u
471
464
  }),
472
- /* @__PURE__ */ p(j, {
465
+ /* @__PURE__ */ p(M, {
473
466
  label: "Department",
474
- value: J.department || "—",
475
- icon: pe
467
+ value: q.department || "—",
468
+ icon: me
476
469
  }),
477
- /* @__PURE__ */ p(j, {
470
+ /* @__PURE__ */ p(M, {
478
471
  label: "Location",
479
- value: J.locationName || "—",
480
- icon: ve
472
+ value: q.locationName || "—",
473
+ icon: ye
481
474
  }),
482
- /* @__PURE__ */ p(j, {
475
+ /* @__PURE__ */ p(M, {
483
476
  label: "Supplier",
484
- value: J.supplier || "—",
485
- icon: Te
477
+ value: q.supplier || "—",
478
+ icon: Ee
486
479
  }),
487
- /* @__PURE__ */ p(j, {
480
+ /* @__PURE__ */ p(M, {
488
481
  label: "Warranty Expiry",
489
- value: J.warrantyExpiry ? new Date(J.warrantyExpiry).toLocaleDateString() : "—",
490
- icon: me
482
+ value: q.warrantyExpiry ? new Date(q.warrantyExpiry).toLocaleDateString() : "—",
483
+ icon: he
491
484
  })
492
485
  ]
493
486
  }),
494
487
  /* @__PURE__ */ p(ee, {
495
488
  entityType: "assethandler-asset",
496
- entityId: J.id
489
+ entityId: q.id
497
490
  })
498
491
  ]
499
492
  }),
@@ -506,20 +499,20 @@ function $e() {
506
499
  children: [
507
500
  /* @__PURE__ */ p(s, {
508
501
  label: "Purchase Value",
509
- value: N(J.purchaseValue)
502
+ value: P(q.purchaseValue)
510
503
  }),
511
504
  /* @__PURE__ */ p(s, {
512
505
  hero: !0,
513
506
  label: "Current Book Value",
514
- value: N(J.currentValue)
507
+ value: P(q.currentValue)
515
508
  }),
516
509
  /* @__PURE__ */ p(s, {
517
510
  label: "Accum. Depreciation",
518
- value: N(J.accumulatedDepreciation)
511
+ value: P(q.accumulatedDepreciation)
519
512
  }),
520
513
  /* @__PURE__ */ p(s, {
521
514
  label: "Total Cost of Ownership",
522
- value: N(J.totalCostOfOwnership)
515
+ value: P(q.totalCostOfOwnership)
523
516
  })
524
517
  ]
525
518
  }),
@@ -528,12 +521,12 @@ function $e() {
528
521
  children: [/* @__PURE__ */ p(c, {
529
522
  title: "Depreciation & book value",
530
523
  subtitle: "Projected book value over the useful life",
531
- icon: we,
532
- children: Z.length > 0 ? /* @__PURE__ */ p(ne, {
533
- data: Z,
524
+ icon: Te,
525
+ children: X.length > 0 ? /* @__PURE__ */ p(ne, {
526
+ data: X,
534
527
  xKey: "year",
535
528
  height: 260,
536
- valueFormat: P,
529
+ valueFormat: F,
537
530
  xTickFormat: (e) => `${e}y`,
538
531
  series: [{
539
532
  key: "bookValue",
@@ -549,32 +542,32 @@ function $e() {
549
542
  children: /* @__PURE__ */ m("dl", {
550
543
  className: "overflow-hidden rounded-lg border border-border-seam text-sm",
551
544
  children: [
552
- /* @__PURE__ */ p(M, {
545
+ /* @__PURE__ */ p(N, {
553
546
  label: "Purchase Date",
554
- value: J.purchaseDate ? new Date(J.purchaseDate).toLocaleDateString() : "—",
547
+ value: q.purchaseDate ? new Date(q.purchaseDate).toLocaleDateString() : "—",
555
548
  striped: !0
556
549
  }),
557
- /* @__PURE__ */ p(M, {
550
+ /* @__PURE__ */ p(N, {
558
551
  label: "Useful Life",
559
- value: J.usefulLifeMonths ? `${J.usefulLifeMonths} months` : "—"
552
+ value: q.usefulLifeMonths ? `${q.usefulLifeMonths} months` : "—"
560
553
  }),
561
- /* @__PURE__ */ p(M, {
554
+ /* @__PURE__ */ p(N, {
562
555
  label: "Salvage Value",
563
- value: N(J.salvageValue),
556
+ value: P(q.salvageValue),
564
557
  striped: !0
565
558
  }),
566
- /* @__PURE__ */ p(M, {
559
+ /* @__PURE__ */ p(N, {
567
560
  label: "Depreciation Method",
568
- value: J.depreciationMethod ? Ye[J.depreciationMethod.toUpperCase()] ?? J.depreciationMethod : "—"
561
+ value: q.depreciationMethod ? Xe[q.depreciationMethod.toUpperCase()] ?? q.depreciationMethod : "—"
569
562
  }),
570
- /* @__PURE__ */ p(M, {
563
+ /* @__PURE__ */ p(N, {
571
564
  label: "Supplier",
572
- value: J.supplier || "—",
565
+ value: q.supplier || "—",
573
566
  striped: !0
574
567
  }),
575
- /* @__PURE__ */ p(M, {
568
+ /* @__PURE__ */ p(N, {
576
569
  label: "Warranty Expiry",
577
- value: J.warrantyExpiry ? new Date(J.warrantyExpiry).toLocaleDateString() : "—"
570
+ value: q.warrantyExpiry ? new Date(q.warrantyExpiry).toLocaleDateString() : "—"
578
571
  })
579
572
  ]
580
573
  })
@@ -582,13 +575,13 @@ function $e() {
582
575
  }),
583
576
  Q.length > 0 ? /* @__PURE__ */ p(c, {
584
577
  title: "Total cost of ownership",
585
- subtitle: "What drives lifetime cost",
586
- icon: he,
578
+ subtitle: "Purchase value plus recorded service cost; depreciation is shown separately",
579
+ icon: ge,
587
580
  children: /* @__PURE__ */ p(ie, {
588
581
  data: Q,
589
582
  centerLabel: "TCO",
590
583
  centerValue: Q.reduce((e, t) => e + t.value, 0),
591
- valueFormat: P,
584
+ valueFormat: F,
592
585
  height: 220
593
586
  })
594
587
  }) : null
@@ -597,36 +590,36 @@ function $e() {
597
590
  /* @__PURE__ */ m(k, {
598
591
  value: "maintenance",
599
592
  className: "mt-4 space-y-4",
600
- children: [pt.length > 0 ? /* @__PURE__ */ p(c, {
593
+ children: [Z.length > 0 ? /* @__PURE__ */ p(c, {
601
594
  title: "Maintenance cost history",
602
595
  subtitle: "Recorded cost per maintenance event",
603
596
  icon: u,
604
597
  children: /* @__PURE__ */ p(re, {
605
- data: pt,
598
+ data: Z,
606
599
  xKey: "label",
607
600
  height: 220,
608
- valueFormat: P,
601
+ valueFormat: F,
609
602
  series: [{
610
603
  key: "cost",
611
604
  label: "Cost"
612
605
  }]
613
606
  })
614
- }) : null, /* @__PURE__ */ m(je, { children: [/* @__PURE__ */ m(Pe, { children: [/* @__PURE__ */ m(Fe, {
607
+ }) : null, /* @__PURE__ */ m(Me, { children: [/* @__PURE__ */ m(Fe, { children: [/* @__PURE__ */ m(Ie, {
615
608
  className: "flex items-center gap-2",
616
609
  children: [/* @__PURE__ */ p(u, { className: "h-4 w-4" }), "Maintenance History"]
617
- }), /* @__PURE__ */ m(Ne, { children: [Y.length, " records found"] })] }), /* @__PURE__ */ p(Me, { children: Y.length === 0 ? /* @__PURE__ */ p("p", {
610
+ }), /* @__PURE__ */ m(Pe, { children: [J.length, " records found"] })] }), /* @__PURE__ */ p(Ne, { children: J.length === 0 ? /* @__PURE__ */ p("p", {
618
611
  className: "py-8 text-center text-text-secondary",
619
612
  children: "No maintenance records for this asset."
620
613
  }) : /* @__PURE__ */ p("div", {
621
614
  className: "space-y-3",
622
- children: Y.map((e) => /* @__PURE__ */ p("div", {
615
+ children: J.map((e) => /* @__PURE__ */ p("div", {
623
616
  className: "flex items-start gap-4 rounded-lg border p-4",
624
617
  children: /* @__PURE__ */ m("div", {
625
618
  className: "flex-1",
626
619
  children: [
627
620
  /* @__PURE__ */ m("div", {
628
621
  className: "flex items-center gap-2",
629
- children: [/* @__PURE__ */ p(Ae, {
622
+ children: [/* @__PURE__ */ p(je, {
630
623
  variant: "outline",
631
624
  className: "capitalize",
632
625
  children: e.type
@@ -649,7 +642,7 @@ function $e() {
649
642
  "Scheduled:",
650
643
  " ",
651
644
  e.scheduledDate ? new Date(e.scheduledDate).toLocaleDateString() : "—"
652
- ] }), e.actualCost != null || e.estimatedCost != null ? /* @__PURE__ */ m("span", { children: ["Cost: ", N(e.actualCost ?? e.estimatedCost)] }) : null]
645
+ ] }), e.actualCost != null || e.estimatedCost != null ? /* @__PURE__ */ m("span", { children: ["Cost: ", P(e.actualCost ?? e.estimatedCost)] }) : null]
653
646
  })
654
647
  ]
655
648
  })
@@ -661,37 +654,37 @@ function $e() {
661
654
  className: "mt-4",
662
655
  children: /* @__PURE__ */ p(te, {
663
656
  entityType: "assethandler-asset",
664
- entityId: J.id
657
+ entityId: q.id
665
658
  })
666
659
  })
667
660
  ]
668
661
  })
669
662
  }), /* @__PURE__ */ m("aside", {
670
663
  className: "space-y-6",
671
- children: [/* @__PURE__ */ p(Le, {
664
+ children: [/* @__PURE__ */ p(Re, {
672
665
  treatment: "glass",
673
666
  className: "border-border-seam",
674
667
  children: /* @__PURE__ */ m("div", {
675
668
  className: "space-y-3 p-5",
676
669
  children: [/* @__PURE__ */ m("h3", {
677
670
  className: "flex items-center gap-2 text-sm font-semibold",
678
- children: [/* @__PURE__ */ p(Se, { className: "h-4 w-4 text-text-secondary" }), "Tags"]
679
- }), J.tags.length === 0 ? /* @__PURE__ */ p("p", {
671
+ children: [/* @__PURE__ */ p(Ce, { className: "h-4 w-4 text-text-secondary" }), "Tags"]
672
+ }), q.tags.length === 0 ? /* @__PURE__ */ p("p", {
680
673
  className: "text-xs text-text-secondary",
681
674
  children: "No tags yet"
682
675
  }) : /* @__PURE__ */ p("div", {
683
676
  className: "flex flex-wrap gap-1.5",
684
- children: J.tags.map((e) => /* @__PURE__ */ p("span", {
677
+ children: q.tags.map((e) => /* @__PURE__ */ p("span", {
685
678
  className: "rounded-full bg-action-primary-bg/10 px-2.5 py-0.5 text-xs font-medium text-action-primary-bg",
686
679
  children: e
687
680
  }, e))
688
681
  })]
689
682
  })
690
- }), /* @__PURE__ */ p(ae, { resourceId: J.id })]
683
+ }), /* @__PURE__ */ p(ae, { resourceId: q.id })]
691
684
  })]
692
685
  }),
693
686
  /* @__PURE__ */ p(v, {
694
- open: it,
687
+ open: at,
695
688
  onOpenChange: L,
696
689
  children: /* @__PURE__ */ m(y, {
697
690
  className: "max-h-[85vh] overflow-y-auto sm:max-w-2xl",
@@ -717,7 +710,7 @@ function $e() {
717
710
  }),
718
711
  /* @__PURE__ */ m("div", {
719
712
  className: "space-y-2",
720
- children: [/* @__PURE__ */ p(_, { children: "Description" }), /* @__PURE__ */ p(He, {
713
+ children: [/* @__PURE__ */ p(_, { children: "Description" }), /* @__PURE__ */ p(Ue, {
721
714
  value: B.description,
722
715
  onChange: (e) => $("description", e.target.value),
723
716
  rows: 2
@@ -928,19 +921,19 @@ function $e() {
928
921
  type: "button",
929
922
  variant: "outline",
930
923
  onClick: () => L(!1),
931
- disabled: W,
924
+ disabled: U,
932
925
  children: "Cancel"
933
926
  }), /* @__PURE__ */ p(h, {
934
927
  type: "submit",
935
- disabled: W,
936
- children: W ? "Saving…" : "Save changes"
928
+ disabled: U,
929
+ children: U ? "Saving…" : "Save changes"
937
930
  })] })
938
931
  ]
939
932
  }) : null]
940
933
  })
941
934
  }),
942
935
  /* @__PURE__ */ p(v, {
943
- open: at,
936
+ open: ot,
944
937
  onOpenChange: R,
945
938
  children: /* @__PURE__ */ m(y, { children: [/* @__PURE__ */ m(S, { children: [/* @__PURE__ */ p(C, { children: "Dispose asset" }), /* @__PURE__ */ p(b, { children: "Record the disposal of this asset. It will be marked as disposed and removed from active inventory." })] }), /* @__PURE__ */ m("form", {
946
939
  className: "space-y-4",
@@ -950,8 +943,8 @@ function $e() {
950
943
  className: "space-y-2",
951
944
  children: [/* @__PURE__ */ p(_, { children: "Disposal Date" }), /* @__PURE__ */ p(g, {
952
945
  type: "date",
953
- value: H.disposalDate,
954
- onChange: (e) => U((t) => ({
946
+ value: V.disposalDate,
947
+ onChange: (e) => H((t) => ({
955
948
  ...t,
956
949
  disposalDate: e.target.value
957
950
  }))
@@ -961,8 +954,8 @@ function $e() {
961
954
  className: "space-y-2",
962
955
  children: [/* @__PURE__ */ p(_, { children: "Method" }), /* @__PURE__ */ p(g, {
963
956
  placeholder: "e.g., Sold, Recycled, Scrapped",
964
- value: H.method,
965
- onChange: (e) => U((t) => ({
957
+ value: V.method,
958
+ onChange: (e) => H((t) => ({
966
959
  ...t,
967
960
  method: e.target.value
968
961
  }))
@@ -970,10 +963,10 @@ function $e() {
970
963
  }),
971
964
  /* @__PURE__ */ m("div", {
972
965
  className: "space-y-2",
973
- children: [/* @__PURE__ */ p(_, { children: "Notes" }), /* @__PURE__ */ p(He, {
966
+ children: [/* @__PURE__ */ p(_, { children: "Notes" }), /* @__PURE__ */ p(Ue, {
974
967
  placeholder: "Optional details about the disposal",
975
- value: H.notes,
976
- onChange: (e) => U((t) => ({
968
+ value: V.notes,
969
+ onChange: (e) => H((t) => ({
977
970
  ...t,
978
971
  notes: e.target.value
979
972
  })),
@@ -984,42 +977,42 @@ function $e() {
984
977
  type: "button",
985
978
  variant: "outline",
986
979
  onClick: () => R(!1),
987
- disabled: G,
980
+ disabled: W,
988
981
  children: "Cancel"
989
982
  }), /* @__PURE__ */ p(h, {
990
983
  type: "submit",
991
- disabled: G,
992
- children: G ? "Disposing…" : "Confirm disposal"
984
+ disabled: W,
985
+ children: W ? "Disposing…" : "Confirm disposal"
993
986
  })] })
994
987
  ]
995
988
  })] })
996
989
  }),
997
990
  /* @__PURE__ */ p(v, {
998
- open: ot,
991
+ open: st,
999
992
  onOpenChange: z,
1000
993
  children: /* @__PURE__ */ m(y, { children: [/* @__PURE__ */ m(S, { children: [/* @__PURE__ */ p(C, { children: "Delete asset" }), /* @__PURE__ */ m(b, { children: [
1001
994
  "This removes ",
1002
995
  /* @__PURE__ */ p("span", {
1003
996
  className: "font-medium",
1004
- children: J.name
997
+ children: q.name
1005
998
  }),
1006
999
  " from the inventory. This action cannot be undone."
1007
1000
  ] })] }), /* @__PURE__ */ m(x, { children: [/* @__PURE__ */ p(h, {
1008
1001
  variant: "outline",
1009
1002
  onClick: () => z(!1),
1010
- disabled: K,
1003
+ disabled: G,
1011
1004
  children: "Cancel"
1012
1005
  }), /* @__PURE__ */ p(h, {
1013
1006
  variant: "destructive",
1014
- onClick: () => void lt({ variables: { id: J.id } }),
1015
- disabled: K,
1016
- children: K ? "Deleting…" : "Delete asset"
1007
+ onClick: () => void dt({ variables: { id: q.id } }),
1008
+ disabled: G,
1009
+ children: G ? "Deleting…" : "Delete asset"
1017
1010
  })] })] })
1018
1011
  })
1019
1012
  ]
1020
1013
  });
1021
1014
  }
1022
- function j({ label: e, value: t, icon: n, mono: r, capitalize: i, full: a, children: o }) {
1015
+ function M({ label: e, value: t, icon: n, mono: r, capitalize: i, full: a, children: o }) {
1023
1016
  return /* @__PURE__ */ m("div", {
1024
1017
  className: `rounded-lg border border-border-seam bg-bg-surface p-3.5 ${a ? "sm:col-span-2 xl:col-span-3" : ""}`,
1025
1018
  children: [/* @__PURE__ */ m("p", {
@@ -1034,7 +1027,7 @@ function j({ label: e, value: t, icon: n, mono: r, capitalize: i, full: a, child
1034
1027
  })]
1035
1028
  });
1036
1029
  }
1037
- function M({ label: e, value: t, striped: n }) {
1030
+ function N({ label: e, value: t, striped: n }) {
1038
1031
  return /* @__PURE__ */ m("div", {
1039
1032
  className: `flex items-center justify-between gap-4 px-3.5 py-2.5 ${n ? "bg-bg-sunken/40" : ""}`,
1040
1033
  children: [/* @__PURE__ */ p("dt", {
@@ -1047,6 +1040,6 @@ function M({ label: e, value: t, striped: n }) {
1047
1040
  });
1048
1041
  }
1049
1042
  //#endregion
1050
- export { $e as AssetsAssetDetailPage };
1043
+ export { j as AssetsAssetDetailPage };
1051
1044
 
1052
1045
  //# sourceMappingURL=AssetsAssetDetailPage.js.map