@burdenoff/microfe-healthybowl 2026.804.1 → 2026.804.2
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/healthybowl/hooks/useHealthyBowlLivestockGrowth.js +93 -0
- package/dist/healthybowl/hooks/useHealthyBowlLivestockGrowth.js.map +1 -0
- package/dist/healthybowl/pages/livestock/LivestockDashboardPage.js +27 -25
- package/dist/healthybowl/pages/livestock/LivestockDashboardPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/LivestockGrowthCard.js +169 -0
- package/dist/healthybowl/pages/livestock/LivestockGrowthCard.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { useHealthyBowl as e } from "../context/HealthyBowlContext.js";
|
|
2
|
+
import { useMemo as t } from "react";
|
|
3
|
+
import { gql as n } from "@apollo/client";
|
|
4
|
+
import { useQuery as r } from "@apollo/client/react";
|
|
5
|
+
//#region src/healthybowl/hooks/useHealthyBowlLivestockGrowth.ts
|
|
6
|
+
var i = "00000000-0000-0000-0000-000000000001", a = n`
|
|
7
|
+
query HealthyBowlLivestockGrowth(
|
|
8
|
+
$context: ContextInput!
|
|
9
|
+
$groupId: ID
|
|
10
|
+
$animalIds: [ID!]
|
|
11
|
+
$from: String
|
|
12
|
+
$to: String
|
|
13
|
+
$granularity: HealthyBowlGrowthGranularity
|
|
14
|
+
) {
|
|
15
|
+
healthyBowlLivestockGrowth(
|
|
16
|
+
context: $context
|
|
17
|
+
groupId: $groupId
|
|
18
|
+
animalIds: $animalIds
|
|
19
|
+
from: $from
|
|
20
|
+
to: $to
|
|
21
|
+
granularity: $granularity
|
|
22
|
+
) {
|
|
23
|
+
series {
|
|
24
|
+
animalId
|
|
25
|
+
tagNumber
|
|
26
|
+
name
|
|
27
|
+
type
|
|
28
|
+
groupId
|
|
29
|
+
groupName
|
|
30
|
+
points {
|
|
31
|
+
at
|
|
32
|
+
weightKg
|
|
33
|
+
}
|
|
34
|
+
adgKgPerDay
|
|
35
|
+
latestWeightKg
|
|
36
|
+
latestWeightAt
|
|
37
|
+
}
|
|
38
|
+
herdAverage {
|
|
39
|
+
at
|
|
40
|
+
avgWeightKg
|
|
41
|
+
animalCount
|
|
42
|
+
sampleSize
|
|
43
|
+
}
|
|
44
|
+
summary {
|
|
45
|
+
animalsWithWeights
|
|
46
|
+
animalsWithoutWeights
|
|
47
|
+
medianAdgKgPerDay
|
|
48
|
+
fastestGrowing {
|
|
49
|
+
animalId
|
|
50
|
+
name
|
|
51
|
+
tagNumber
|
|
52
|
+
adgKgPerDay
|
|
53
|
+
}
|
|
54
|
+
slowestGrowing {
|
|
55
|
+
animalId
|
|
56
|
+
name
|
|
57
|
+
tagNumber
|
|
58
|
+
adgKgPerDay
|
|
59
|
+
}
|
|
60
|
+
windowFrom
|
|
61
|
+
windowTo
|
|
62
|
+
granularity
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
function o(n = {}) {
|
|
68
|
+
let { workspaceId: o } = e(), s = o || i, { data: c, loading: l, error: u, refetch: d } = r(a, {
|
|
69
|
+
variables: {
|
|
70
|
+
context: t(() => ({ workspaceId: s }), [s]),
|
|
71
|
+
groupId: n.groupId ?? null,
|
|
72
|
+
animalIds: n.animalIds ?? null,
|
|
73
|
+
from: n.from ?? null,
|
|
74
|
+
to: n.to ?? null,
|
|
75
|
+
granularity: n.granularity ?? "WEEK"
|
|
76
|
+
},
|
|
77
|
+
fetchPolicy: "cache-and-network",
|
|
78
|
+
skip: n.enabled === !1
|
|
79
|
+
}), f = c?.healthyBowlLivestockGrowth ?? null;
|
|
80
|
+
return {
|
|
81
|
+
growth: f,
|
|
82
|
+
series: f?.series ?? [],
|
|
83
|
+
herdAverage: f?.herdAverage ?? [],
|
|
84
|
+
summary: f?.summary ?? null,
|
|
85
|
+
loading: l,
|
|
86
|
+
error: u,
|
|
87
|
+
refetch: d
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
//#endregion
|
|
91
|
+
export { o as useHealthyBowlLivestockGrowth };
|
|
92
|
+
|
|
93
|
+
//# sourceMappingURL=useHealthyBowlLivestockGrowth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useHealthyBowlLivestockGrowth.js","names":[],"sources":["../../../src/healthybowl/hooks/useHealthyBowlLivestockGrowth.ts"],"sourcesContent":["/**\n * Livestock growth analytics — data hook (BOFF-5971).\n *\n * Feeds the growth chart: one weight curve per animal, a herd-average line, and the ADG leaders.\n * The document is declared inline with `gql` — the same escape hatch `useHealthyBowlLivestockDepth`\n * and `useHealthyBowlWithdrawal` use — because codegen validates against the committed\n * `graphql/wspace.graphql` snapshot, which does not yet carry this query.\n *\n * Types mirror `wspace-healthybowl-svc/src/modules/healthybowl/schema/livestock-depth.gql`.\n *\n * ⚠️ ADG here is computed over the requested window, so it can legitimately differ from the\n * lifetime ADG shown on the deep herd view — same formula, different span. Label it as such\n * wherever both appear on one screen.\n */\n\nimport { useMemo } from 'react';\nimport { gql } from '@apollo/client';\nimport { useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\nconst FALLBACK_WORKSPACE_ID = '00000000-0000-0000-0000-000000000001';\n\n// ── types (mirror livestock-depth.gql) ────────────────────────────────────────\n\nexport type GrowthGranularity = 'DAY' | 'WEEK' | 'MONTH';\n\nexport interface GrowthPoint {\n at: string;\n weightKg: number;\n}\n\nexport interface GrowthSeries {\n animalId: string;\n tagNumber: string;\n name: string;\n type: string;\n groupId: string | null;\n groupName: string | null;\n points: GrowthPoint[];\n adgKgPerDay: number | null;\n latestWeightKg: number | null;\n latestWeightAt: string | null;\n}\n\nexport interface GrowthAveragePoint {\n at: string;\n avgWeightKg: number;\n animalCount: number;\n sampleSize: number;\n}\n\nexport interface GrowthLeader {\n animalId: string;\n name: string;\n tagNumber: string;\n adgKgPerDay: number;\n}\n\nexport interface GrowthSummary {\n animalsWithWeights: number;\n animalsWithoutWeights: number;\n medianAdgKgPerDay: number | null;\n fastestGrowing: GrowthLeader | null;\n slowestGrowing: GrowthLeader | null;\n windowFrom: string | null;\n windowTo: string | null;\n granularity: GrowthGranularity;\n}\n\nexport interface LivestockGrowth {\n series: GrowthSeries[];\n herdAverage: GrowthAveragePoint[];\n summary: GrowthSummary;\n}\n\ninterface HbContext {\n workspaceId: string;\n}\n\nconst GET_LIVESTOCK_GROWTH = gql`\n query HealthyBowlLivestockGrowth(\n $context: ContextInput!\n $groupId: ID\n $animalIds: [ID!]\n $from: String\n $to: String\n $granularity: HealthyBowlGrowthGranularity\n ) {\n healthyBowlLivestockGrowth(\n context: $context\n groupId: $groupId\n animalIds: $animalIds\n from: $from\n to: $to\n granularity: $granularity\n ) {\n series {\n animalId\n tagNumber\n name\n type\n groupId\n groupName\n points {\n at\n weightKg\n }\n adgKgPerDay\n latestWeightKg\n latestWeightAt\n }\n herdAverage {\n at\n avgWeightKg\n animalCount\n sampleSize\n }\n summary {\n animalsWithWeights\n animalsWithoutWeights\n medianAdgKgPerDay\n fastestGrowing {\n animalId\n name\n tagNumber\n adgKgPerDay\n }\n slowestGrowing {\n animalId\n name\n tagNumber\n adgKgPerDay\n }\n windowFrom\n windowTo\n granularity\n }\n }\n }\n`;\n\nexport interface UseLivestockGrowthOptions {\n enabled?: boolean;\n groupId?: string | null;\n animalIds?: string[] | null;\n from?: string | null;\n to?: string | null;\n granularity?: GrowthGranularity;\n}\n\nexport function useHealthyBowlLivestockGrowth(options: UseLivestockGrowthOptions = {}) {\n const { workspaceId } = useHealthyBowl();\n const effectiveWorkspaceId = workspaceId || FALLBACK_WORKSPACE_ID;\n const ctx = useMemo<HbContext>(() => ({ workspaceId: effectiveWorkspaceId }), [effectiveWorkspaceId]);\n\n const { data, loading, error, refetch } = useQuery<\n { healthyBowlLivestockGrowth: LivestockGrowth },\n {\n context: HbContext;\n groupId: string | null;\n animalIds: string[] | null;\n from: string | null;\n to: string | null;\n granularity: GrowthGranularity;\n }\n >(GET_LIVESTOCK_GROWTH, {\n variables: {\n context: ctx,\n groupId: options.groupId ?? null,\n animalIds: options.animalIds ?? null,\n from: options.from ?? null,\n to: options.to ?? null,\n granularity: options.granularity ?? 'WEEK',\n },\n fetchPolicy: 'cache-and-network',\n skip: options.enabled === false,\n });\n\n const growth = data?.healthyBowlLivestockGrowth ?? null;\n\n return {\n growth,\n series: growth?.series ?? [],\n herdAverage: growth?.herdAverage ?? [],\n summary: growth?.summary ?? null,\n loading,\n error,\n refetch,\n };\n}\n"],"mappings":";;;;;AAoBA,IAAM,IAAwB,wCA2DxB,IAAuB,CAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuEhC,SAAgB,EAA8B,IAAqC,EAAE,EAAE;CACrF,IAAM,EAAE,mBAAgB,GAAgB,EAClC,IAAuB,KAAe,GAGtC,EAAE,SAAM,YAAS,UAAO,eAAY,EAUxC,GAAsB;EACtB,WAAW;GACT,SAdQ,SAA0B,EAAE,aAAa,GAAsB,GAAG,CAAC,EAAqB,CAAC;GAejG,SAAS,EAAQ,WAAW;GAC5B,WAAW,EAAQ,aAAa;GAChC,MAAM,EAAQ,QAAQ;GACtB,IAAI,EAAQ,MAAM;GAClB,aAAa,EAAQ,eAAe;GACrC;EACD,aAAa;EACb,MAAM,EAAQ,YAAY;EAC3B,CAAC,EAEI,IAAS,GAAM,8BAA8B;AAEnD,QAAO;EACL;EACA,QAAQ,GAAQ,UAAU,EAAE;EAC5B,aAAa,GAAQ,eAAe,EAAE;EACtC,SAAS,GAAQ,WAAW;EAC5B;EACA;EACA;EACD"}
|
|
@@ -9,8 +9,9 @@ import { ChartCard as c } from "../../components/ChartCard.js";
|
|
|
9
9
|
import { LoadingSkeleton as ee } from "../../components/LoadingSkeleton.js";
|
|
10
10
|
import "../../components/index.js";
|
|
11
11
|
import { useHealthyBowlData as te } from "../../hooks/useHealthyBowlData.js";
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
12
|
+
import { LivestockGrowthCard as l } from "./LivestockGrowthCard.js";
|
|
13
|
+
import { useI18n as u } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
14
|
+
import { AlertCircle as d, ArrowRight as f, Baby as p, Calendar as m, ChevronRight as h, Clock as g, DollarSign as _, Egg as v, Heart as y, Milk as b, Package as ne, PawPrint as re, Plus as x, TrendingUp as S, Users as C } from "lucide-react";
|
|
14
15
|
import { useNavigate as w } from "react-router";
|
|
15
16
|
import { Fragment as T, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
16
17
|
import { Button as O } from "@burdenoff/fe-libs/ui";
|
|
@@ -32,7 +33,7 @@ var k = (e) => {
|
|
|
32
33
|
meat: 350,
|
|
33
34
|
manure: 5
|
|
34
35
|
}, j = () => {
|
|
35
|
-
let { animals: j, healthRecords: M, vaccinations: N, productionRecords: P, feedRecords: F, loading: I, errors: L } = te(), R = w(), { buildPath: z } = n(), { t: B } =
|
|
36
|
+
let { animals: j, healthRecords: M, vaccinations: N, productionRecords: P, feedRecords: F, loading: I, errors: L } = te(), R = w(), { buildPath: z } = n(), { t: B } = u(), V = j.length, H = j.filter((e) => e.healthStatus === "healthy").length, U = j.filter((e) => e.healthStatus === "sick").length, W = j.filter((e) => e.healthStatus === "under_treatment").length, G = j.filter((e) => e.healthStatus === "quarantine").length, K = j.filter((e) => e.healthStatus === "pregnant").length, q = j.reduce((e, t) => (e[t.type] = (e[t.type] || 0) + 1, e), {}), J = P.filter((e) => e.type === "milk").reduce((e, t) => e + t.quantity, 0), Y = P.filter((e) => e.type === "eggs").reduce((e, t) => e + t.quantity, 0), X = P.reduce((e, t) => e + t.quantity * (A[t.type] ?? 0), 0), Z = F.reduce((e, t) => e + t.cost, 0), ie = X > 0 ? ((X - Z) / X * 100).toFixed(1) : "0.0", Q = M.filter((e) => e.status === "active" || e.status === "monitoring").slice(0, 3), $ = N.filter((e) => e.status === "scheduled").slice(0, 3);
|
|
36
37
|
return /* @__PURE__ */ E(r, {
|
|
37
38
|
title: B("healthybowl.livestock.dashboard.title", "Livestock Management"),
|
|
38
39
|
description: B("healthybowl.livestock.dashboard.description", "Monitor and manage your livestock operations"),
|
|
@@ -62,7 +63,7 @@ var k = (e) => {
|
|
|
62
63
|
actions: /* @__PURE__ */ D(O, {
|
|
63
64
|
variant: "default",
|
|
64
65
|
onClick: () => R(z("livestock/animals")),
|
|
65
|
-
children: [/* @__PURE__ */ E(
|
|
66
|
+
children: [/* @__PURE__ */ E(x, { className: "h-4 w-4" }), B("healthybowl.livestock.dashboard.actions.addAnimal", "Add Animal")]
|
|
66
67
|
}),
|
|
67
68
|
children: I && j.length === 0 ? /* @__PURE__ */ E(ee, {
|
|
68
69
|
variant: "card",
|
|
@@ -75,23 +76,23 @@ var k = (e) => {
|
|
|
75
76
|
hero: !0,
|
|
76
77
|
label: B("healthybowl.livestock.dashboard.stats.totalAnimals.label", "Total Animals"),
|
|
77
78
|
value: V,
|
|
78
|
-
icon: /* @__PURE__ */ E(
|
|
79
|
+
icon: /* @__PURE__ */ E(re, { className: "h-4 w-4" })
|
|
79
80
|
}),
|
|
80
81
|
/* @__PURE__ */ E(i, {
|
|
81
82
|
label: B("healthybowl.livestock.dashboard.stats.healthIssues.label", "Health Issues"),
|
|
82
83
|
value: U + W,
|
|
83
|
-
icon: /* @__PURE__ */ E(
|
|
84
|
+
icon: /* @__PURE__ */ E(y, { className: "h-4 w-4" })
|
|
84
85
|
}),
|
|
85
86
|
/* @__PURE__ */ E(i, {
|
|
86
87
|
label: B("healthybowl.livestock.dashboard.stats.productionValue.label", "Est. Production Value"),
|
|
87
88
|
value: e(X),
|
|
88
|
-
icon: /* @__PURE__ */ E(
|
|
89
|
+
icon: /* @__PURE__ */ E(_, { className: "h-4 w-4" })
|
|
89
90
|
}),
|
|
90
91
|
/* @__PURE__ */ E(i, {
|
|
91
92
|
label: B("healthybowl.livestock.dashboard.stats.margin.label", "Est. Margin"),
|
|
92
|
-
value: parseFloat(
|
|
93
|
+
value: parseFloat(ie),
|
|
93
94
|
unit: "%",
|
|
94
|
-
icon: /* @__PURE__ */ E(
|
|
95
|
+
icon: /* @__PURE__ */ E(S, { className: "h-4 w-4" })
|
|
95
96
|
})
|
|
96
97
|
]
|
|
97
98
|
}),
|
|
@@ -148,7 +149,7 @@ var k = (e) => {
|
|
|
148
149
|
children: [
|
|
149
150
|
B("healthybowl.livestock.dashboard.distribution.viewAll", "View All Animals"),
|
|
150
151
|
" ",
|
|
151
|
-
/* @__PURE__ */ E(
|
|
152
|
+
/* @__PURE__ */ E(f, { className: "h-4 w-4" })
|
|
152
153
|
]
|
|
153
154
|
})
|
|
154
155
|
})]
|
|
@@ -164,7 +165,7 @@ var k = (e) => {
|
|
|
164
165
|
className: "flex items-center gap-3",
|
|
165
166
|
children: [/* @__PURE__ */ E("div", {
|
|
166
167
|
className: "rounded-full bg-bg-surface p-3",
|
|
167
|
-
children: /* @__PURE__ */ E(
|
|
168
|
+
children: /* @__PURE__ */ E(b, { className: "h-5 w-5 text-primary" })
|
|
168
169
|
}), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
|
|
169
170
|
className: "text-sm font-medium text-text-primary",
|
|
170
171
|
children: B("healthybowl.livestock.dashboard.production.milk.label", "Milk Production")
|
|
@@ -189,7 +190,7 @@ var k = (e) => {
|
|
|
189
190
|
className: "flex items-center gap-3",
|
|
190
191
|
children: [/* @__PURE__ */ E("div", {
|
|
191
192
|
className: "rounded-full bg-bg-surface p-3",
|
|
192
|
-
children: /* @__PURE__ */ E(
|
|
193
|
+
children: /* @__PURE__ */ E(v, { className: "h-5 w-5 text-primary" })
|
|
193
194
|
}), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
|
|
194
195
|
className: "text-sm font-medium text-text-primary",
|
|
195
196
|
children: B("healthybowl.livestock.dashboard.production.eggs.label", "Egg Collection")
|
|
@@ -215,13 +216,14 @@ var k = (e) => {
|
|
|
215
216
|
children: [
|
|
216
217
|
B("healthybowl.livestock.dashboard.production.record", "Record Production"),
|
|
217
218
|
" ",
|
|
218
|
-
/* @__PURE__ */ E(
|
|
219
|
+
/* @__PURE__ */ E(x, { className: "h-4 w-4" })
|
|
219
220
|
]
|
|
220
221
|
})
|
|
221
222
|
]
|
|
222
223
|
})
|
|
223
224
|
})]
|
|
224
225
|
}),
|
|
226
|
+
/* @__PURE__ */ E(l, {}),
|
|
225
227
|
/* @__PURE__ */ D("div", {
|
|
226
228
|
className: "grid grid-cols-1 gap-6 lg:grid-cols-3",
|
|
227
229
|
children: [/* @__PURE__ */ D("div", {
|
|
@@ -251,35 +253,35 @@ var k = (e) => {
|
|
|
251
253
|
label: B("healthybowl.livestock.dashboard.healthStatus.healthy", "Healthy"),
|
|
252
254
|
value: H,
|
|
253
255
|
variant: "success",
|
|
254
|
-
icon:
|
|
256
|
+
icon: y
|
|
255
257
|
},
|
|
256
258
|
{
|
|
257
259
|
id: "sick",
|
|
258
260
|
label: B("healthybowl.livestock.dashboard.healthStatus.sick", "Sick"),
|
|
259
261
|
value: U,
|
|
260
262
|
variant: "error",
|
|
261
|
-
icon:
|
|
263
|
+
icon: d
|
|
262
264
|
},
|
|
263
265
|
{
|
|
264
266
|
id: "treatment",
|
|
265
267
|
label: B("healthybowl.livestock.dashboard.healthStatus.treatment", "Treatment"),
|
|
266
268
|
value: W,
|
|
267
269
|
variant: "warning",
|
|
268
|
-
icon:
|
|
270
|
+
icon: g
|
|
269
271
|
},
|
|
270
272
|
{
|
|
271
273
|
id: "quarantine",
|
|
272
274
|
label: B("healthybowl.livestock.dashboard.healthStatus.quarantine", "Quarantine"),
|
|
273
275
|
value: G,
|
|
274
276
|
variant: "error",
|
|
275
|
-
icon:
|
|
277
|
+
icon: d
|
|
276
278
|
},
|
|
277
279
|
{
|
|
278
280
|
id: "pregnant",
|
|
279
281
|
label: B("healthybowl.livestock.dashboard.healthStatus.pregnant", "Pregnant"),
|
|
280
282
|
value: K,
|
|
281
283
|
variant: "info",
|
|
282
|
-
icon:
|
|
284
|
+
icon: p
|
|
283
285
|
}
|
|
284
286
|
].map((e) => /* @__PURE__ */ D("div", {
|
|
285
287
|
className: "rounded-lg bg-bg-sunken/50 p-3 text-center",
|
|
@@ -318,7 +320,7 @@ var k = (e) => {
|
|
|
318
320
|
className: "text-xs text-text-secondary",
|
|
319
321
|
children: e.diagnosis
|
|
320
322
|
})] })]
|
|
321
|
-
}), /* @__PURE__ */ E(
|
|
323
|
+
}), /* @__PURE__ */ E(h, { className: "h-4 w-4 text-text-secondary" })]
|
|
322
324
|
}, e.id))
|
|
323
325
|
})]
|
|
324
326
|
})
|
|
@@ -340,31 +342,31 @@ var k = (e) => {
|
|
|
340
342
|
{
|
|
341
343
|
id: "healthCheck",
|
|
342
344
|
label: B("healthybowl.livestock.dashboard.quickActions.recordHealthCheck", "Record Health Check"),
|
|
343
|
-
icon:
|
|
345
|
+
icon: y,
|
|
344
346
|
path: z("livestock/health")
|
|
345
347
|
},
|
|
346
348
|
{
|
|
347
349
|
id: "vaccination",
|
|
348
350
|
label: B("healthybowl.livestock.dashboard.quickActions.scheduleVaccination", "Schedule Vaccination"),
|
|
349
|
-
icon:
|
|
351
|
+
icon: m,
|
|
350
352
|
path: z("livestock/vaccinations")
|
|
351
353
|
},
|
|
352
354
|
{
|
|
353
355
|
id: "feed",
|
|
354
356
|
label: B("healthybowl.livestock.dashboard.quickActions.updateFeedRecords", "Update Feed Records"),
|
|
355
|
-
icon:
|
|
357
|
+
icon: ne,
|
|
356
358
|
path: z("livestock/feed")
|
|
357
359
|
},
|
|
358
360
|
{
|
|
359
361
|
id: "breeding",
|
|
360
362
|
label: B("healthybowl.livestock.dashboard.quickActions.breedingManagement", "Breeding Management"),
|
|
361
|
-
icon:
|
|
363
|
+
icon: C,
|
|
362
364
|
path: z("livestock/breeding")
|
|
363
365
|
},
|
|
364
366
|
{
|
|
365
367
|
id: "production",
|
|
366
368
|
label: B("healthybowl.livestock.dashboard.quickActions.viewProduction", "View Production"),
|
|
367
|
-
icon:
|
|
369
|
+
icon: S,
|
|
368
370
|
path: z("livestock/production")
|
|
369
371
|
}
|
|
370
372
|
].map((e) => /* @__PURE__ */ D(O, {
|
|
@@ -400,7 +402,7 @@ var k = (e) => {
|
|
|
400
402
|
className: "flex items-center justify-between rounded-md border border-border-subtle p-3 hover:bg-bg-sunken/30",
|
|
401
403
|
children: [/* @__PURE__ */ D("div", {
|
|
402
404
|
className: "flex items-center gap-3",
|
|
403
|
-
children: [/* @__PURE__ */ E(
|
|
405
|
+
children: [/* @__PURE__ */ E(m, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E("p", {
|
|
404
406
|
className: "text-sm font-medium text-text-primary",
|
|
405
407
|
children: e.animalName
|
|
406
408
|
}), /* @__PURE__ */ E("p", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LivestockDashboardPage.js","names":[],"sources":["../../../../src/healthybowl/pages/livestock/LivestockDashboardPage.tsx"],"sourcesContent":["import { type FC } from 'react';\nimport { useNavigate } from 'react-router';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport {\n PawPrint,\n Heart,\n Baby,\n DollarSign,\n TrendingUp,\n Milk,\n Egg,\n Calendar,\n ArrowRight,\n AlertCircle,\n Clock,\n ChevronRight,\n Plus,\n Package,\n Users,\n} from 'lucide-react';\nimport {\n PageLayout,\n StatCard,\n StatusBadge,\n ChartCard,\n LoadingSkeleton,\n EmptyState,\n ErrorState,\n} from '../../components';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { formatDate, formatCurrency } from '../../utils/helpers';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Button } from '@burdenoff/fe-libs/ui';\n\nconst getAnimalIcon = (type: string) => {\n switch (type) {\n case 'cattle':\n case 'buffalo':\n return '🐄';\n case 'goat':\n return '🐐';\n case 'sheep':\n return '🐑';\n case 'pig':\n return '🐷';\n case 'poultry':\n return '🐔';\n default:\n return '🐾';\n }\n};\n\n// Per-unit price estimates for production types (used to derive revenue)\nconst UNIT_PRICES: Record<string, number> = {\n milk: 55,\n eggs: 8,\n wool: 400,\n meat: 350,\n manure: 5,\n};\n\nexport const LivestockDashboardPage: FC = () => {\n const { animals, healthRecords, vaccinations, productionRecords, feedRecords, loading, errors } =\n useHealthyBowlData();\n\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { t } = useI18n();\n\n const totalAnimals = animals.length;\n const healthy = animals.filter((a) => a.healthStatus === 'healthy').length;\n const sick = animals.filter((a) => a.healthStatus === 'sick').length;\n const underTreatment = animals.filter((a) => a.healthStatus === 'under_treatment').length;\n const quarantine = animals.filter((a) => a.healthStatus === 'quarantine').length;\n const pregnant = animals.filter((a) => a.healthStatus === 'pregnant').length;\n\n const typeCounts = animals.reduce<Record<string, number>>((acc, a) => {\n acc[a.type] = (acc[a.type] || 0) + 1;\n return acc;\n }, {});\n\n // Total production from all records\n const milkProduction = productionRecords.filter((p) => p.type === 'milk').reduce((sum, p) => sum + p.quantity, 0);\n const eggProduction = productionRecords.filter((p) => p.type === 'eggs').reduce((sum, p) => sum + p.quantity, 0);\n\n // Derive financial figures from actual data\n const monthlyRevenue = productionRecords.reduce((sum, p) => sum + p.quantity * (UNIT_PRICES[p.type] ?? 0), 0);\n const monthlyExpenses = feedRecords.reduce((sum, r) => sum + r.cost, 0);\n const profitMargin =\n monthlyRevenue > 0 ? (((monthlyRevenue - monthlyExpenses) / monthlyRevenue) * 100).toFixed(1) : '0.0';\n\n const recentHealthIssues = healthRecords\n .filter((r) => r.status === 'active' || r.status === 'monitoring')\n .slice(0, 3);\n const upcomingVaccinations = vaccinations.filter((v) => v.status === 'scheduled').slice(0, 3);\n\n return (\n <PageLayout\n title={t('healthybowl.livestock.dashboard.title', 'Livestock Management')}\n description={t('healthybowl.livestock.dashboard.description', 'Monitor and manage your livestock operations')}\n purpose=\"The health of your animal operation at a glance — herd size, health flags and production. Start here each day, then dive into the registry, health, breeding or feed sections as needed.\"\n nextStepsKey=\"healthybowl-livestock-dashboard\"\n nextStepsTitle=\"Run your herd day to day\"\n nextSteps={[\n {\n id: 'registry',\n label: 'Register your animals',\n description: 'Build the herd registry so every record links to an animal.',\n onClick: () => navigate(buildPath('livestock/animals')),\n },\n {\n id: 'health',\n label: 'Log health & vaccinations',\n description: 'Keep treatment and vaccination history in one place.',\n onClick: () => navigate(buildPath('livestock/health')),\n },\n {\n id: 'production',\n label: 'Track production',\n description: 'Record milk, eggs or other yields to watch trends.',\n onClick: () => navigate(buildPath('livestock/production')),\n },\n ]}\n actions={\n <Button variant=\"default\" onClick={() => navigate(buildPath('livestock/animals'))}>\n <Plus className=\"h-4 w-4\" />\n {t('healthybowl.livestock.dashboard.actions.addAnimal', 'Add Animal')}\n </Button>\n }\n >\n {loading && animals.length === 0 ? (\n <LoadingSkeleton variant=\"card\" count={4} />\n ) : (\n <>\n {/* Key Metrics */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n hero\n label={t('healthybowl.livestock.dashboard.stats.totalAnimals.label', 'Total Animals')}\n value={totalAnimals}\n icon={<PawPrint className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.healthIssues.label', 'Health Issues')}\n value={sick + underTreatment}\n icon={<Heart className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.productionValue.label', 'Est. Production Value')}\n value={formatCurrency(monthlyRevenue)}\n icon={<DollarSign className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.margin.label', 'Est. Margin')}\n value={parseFloat(profitMargin)}\n unit=\"%\"\n icon={<TrendingUp className=\"h-4 w-4\" />}\n />\n </div>\n\n {/* Animal Distribution & Total Production */}\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-2\">\n {/* Animal Distribution */}\n <ChartCard\n title={t('healthybowl.livestock.dashboard.distribution.title', 'Animal Distribution')}\n description={t('healthybowl.livestock.dashboard.distribution.description', 'Breakdown by animal type')}\n >\n {totalAnimals === 0 ? (\n errors.livestock ? (\n <ErrorState />\n ) : (\n <EmptyState\n illustration=\"empty-generic\"\n title={t('healthybowl.livestock.dashboard.distribution.empty.title', 'No animals yet')}\n description={t(\n 'healthybowl.livestock.dashboard.distribution.empty.description',\n 'Add an animal to see your livestock distribution by type.'\n )}\n />\n )\n ) : (\n <div className=\"flex flex-col gap-3\">\n {Object.entries(typeCounts).map(([type, count]) => {\n const percentage = totalAnimals > 0 ? Math.round((count / totalAnimals) * 100) : 0;\n return (\n <div key={type} className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-lg\">{getAnimalIcon(type)}</span>\n <span className=\"text-sm font-medium capitalize text-text-primary\">{type}</span>\n </div>\n <span className=\"text-xs text-text-secondary\">\n {count} ({percentage}%)\n </span>\n </div>\n <div className=\"h-2 w-full rounded-full bg-bg-sunken\">\n <div\n className=\"h-2 rounded-full bg-action-primary-bg transition-all\"\n style={{ width: `${percentage}%` }}\n />\n </div>\n </div>\n );\n })}\n </div>\n )}\n <div className=\"mt-4 border-t border-border-subtle pt-4\">\n <Button\n variant=\"outline\"\n onClick={() => navigate(buildPath('livestock/animals'))}\n className=\"w-full justify-center\"\n >\n {t('healthybowl.livestock.dashboard.distribution.viewAll', 'View All Animals')}{' '}\n <ArrowRight className=\"h-4 w-4\" />\n </Button>\n </div>\n </ChartCard>\n\n {/* Total Production */}\n <ChartCard\n title={t('healthybowl.livestock.dashboard.production.title', 'Total Production')}\n description={t(\n 'healthybowl.livestock.dashboard.production.description',\n 'Cumulative production tracking'\n )}\n >\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between rounded-lg bg-bg-sunken/50 p-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"rounded-full bg-bg-surface p-3\">\n <Milk className=\"h-5 w-5 text-primary\" />\n </div>\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.production.milk.label', 'Milk Production')}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.milk.source', 'From dairy animals')}\n </p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xl font-bold text-text-primary\">{milkProduction}</p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.milk.unit', 'liters')}\n </p>\n </div>\n </div>\n\n <div className=\"flex items-center justify-between rounded-lg bg-bg-sunken/50 p-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"rounded-full bg-bg-surface p-3\">\n <Egg className=\"h-5 w-5 text-primary\" />\n </div>\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.production.eggs.label', 'Egg Collection')}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.eggs.source', 'From poultry')}\n </p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xl font-bold text-text-primary\">{eggProduction}</p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.eggs.unit', 'eggs')}\n </p>\n </div>\n </div>\n\n <Button\n variant=\"default\"\n onClick={() => navigate(buildPath('livestock/production'))}\n className=\"w-full justify-center\"\n >\n {t('healthybowl.livestock.dashboard.production.record', 'Record Production')}{' '}\n <Plus className=\"h-4 w-4\" />\n </Button>\n </div>\n </ChartCard>\n </div>\n\n {/* Health Status & Quick Actions */}\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Health Status Overview */}\n <div className=\"lg:col-span-2 rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h3 className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.healthStatus.title', 'Health Status Overview')}\n </h3>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.healthStatus.subtitle', 'Current health distribution')}\n </p>\n </div>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(buildPath('livestock/health'))}\n className=\"text-xs\"\n >\n {t('healthybowl.common.viewAll', 'View All')}\n </Button>\n </div>\n\n <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-5\">\n {[\n {\n id: 'healthy',\n label: t('healthybowl.livestock.dashboard.healthStatus.healthy', 'Healthy'),\n value: healthy,\n variant: 'success' as const,\n icon: Heart,\n },\n {\n id: 'sick',\n label: t('healthybowl.livestock.dashboard.healthStatus.sick', 'Sick'),\n value: sick,\n variant: 'error' as const,\n icon: AlertCircle,\n },\n {\n id: 'treatment',\n label: t('healthybowl.livestock.dashboard.healthStatus.treatment', 'Treatment'),\n value: underTreatment,\n variant: 'warning' as const,\n icon: Clock,\n },\n {\n id: 'quarantine',\n label: t('healthybowl.livestock.dashboard.healthStatus.quarantine', 'Quarantine'),\n value: quarantine,\n variant: 'error' as const,\n icon: AlertCircle,\n },\n {\n id: 'pregnant',\n label: t('healthybowl.livestock.dashboard.healthStatus.pregnant', 'Pregnant'),\n value: pregnant,\n variant: 'info' as const,\n icon: Baby,\n },\n ].map((item) => (\n <div key={item.id} className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <item.icon className=\"mx-auto mb-1 h-4 w-4 text-text-secondary\" />\n <p className=\"text-xl font-bold text-text-primary\">{item.value}</p>\n <p className=\"text-xs text-text-secondary\">{item.label}</p>\n </div>\n ))}\n </div>\n\n {/* Recent Health Issues */}\n {recentHealthIssues.length > 0 && (\n <div className=\"mt-4\">\n <h4 className=\"mb-2 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.healthStatus.recentIssues', 'Recent Health Issues')}\n </h4>\n <div className=\"flex flex-col gap-2\">\n {recentHealthIssues.map((issue) => (\n <div\n key={issue.id}\n className=\"flex cursor-pointer items-center justify-between rounded-md border border-border-subtle p-3 hover:bg-bg-sunken/30\"\n onClick={() => navigate(buildPath('livestock/health'))}\n >\n <div className=\"flex items-center gap-3\">\n <StatusBadge label={issue.status} variant={issue.status === 'active' ? 'warning' : 'info'} />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">{issue.animalName}</p>\n <p className=\"text-xs text-text-secondary\">{issue.diagnosis}</p>\n </div>\n </div>\n <ChevronRight className=\"h-4 w-4 text-text-secondary\" />\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n\n {/* Quick Actions */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <h3 className=\"mb-1 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.quickActions.title', 'Quick Actions')}\n </h3>\n <p className=\"mb-4 text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.quickActions.subtitle', 'Common livestock tasks')}\n </p>\n <div className=\"flex flex-col gap-2\">\n {[\n {\n id: 'healthCheck',\n label: t('healthybowl.livestock.dashboard.quickActions.recordHealthCheck', 'Record Health Check'),\n icon: Heart,\n path: buildPath('livestock/health'),\n },\n {\n id: 'vaccination',\n label: t(\n 'healthybowl.livestock.dashboard.quickActions.scheduleVaccination',\n 'Schedule Vaccination'\n ),\n icon: Calendar,\n path: buildPath('livestock/vaccinations'),\n },\n {\n id: 'feed',\n label: t('healthybowl.livestock.dashboard.quickActions.updateFeedRecords', 'Update Feed Records'),\n icon: Package,\n path: buildPath('livestock/feed'),\n },\n {\n id: 'breeding',\n label: t('healthybowl.livestock.dashboard.quickActions.breedingManagement', 'Breeding Management'),\n icon: Users,\n path: buildPath('livestock/breeding'),\n },\n {\n id: 'production',\n label: t('healthybowl.livestock.dashboard.quickActions.viewProduction', 'View Production'),\n icon: TrendingUp,\n path: buildPath('livestock/production'),\n },\n ].map((action) => (\n <Button\n key={action.id}\n variant=\"outline\"\n onClick={() => navigate(action.path)}\n className=\"justify-start\"\n >\n <action.icon className=\"h-4 w-4 text-text-secondary\" />\n {action.label}\n </Button>\n ))}\n </div>\n </div>\n </div>\n\n {/* Upcoming Vaccinations */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h3 className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.vaccinations.title', 'Upcoming Vaccinations')}\n </h3>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.vaccinations.subtitle', 'Next 7 days · {{count}} scheduled', {\n count: upcomingVaccinations.length,\n })}\n </p>\n </div>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(buildPath('livestock/vaccinations'))}\n className=\"text-xs\"\n >\n {t('healthybowl.common.viewAll', 'View All')}\n </Button>\n </div>\n <div className=\"flex flex-col gap-2\">\n {upcomingVaccinations.map((vac) => (\n <div\n key={vac.id}\n className=\"flex items-center justify-between rounded-md border border-border-subtle p-3 hover:bg-bg-sunken/30\"\n >\n <div className=\"flex items-center gap-3\">\n <Calendar className=\"h-4 w-4 text-text-secondary\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">{vac.animalName}</p>\n <p className=\"text-xs text-text-secondary\">{vac.vaccineName}</p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xs font-medium text-text-primary\">{formatDate(vac.nextDueDate)}</p>\n <StatusBadge label={vac.status} variant=\"info\" />\n </div>\n </div>\n ))}\n {upcomingVaccinations.length === 0 && (\n <p className=\"py-4 text-center text-sm text-text-secondary\">\n {t('healthybowl.livestock.dashboard.vaccinations.empty', 'No upcoming vaccinations')}\n </p>\n )}\n </div>\n </div>\n\n {/* Financial Summary — production value is ESTIMATED (recorded quantities × standard unit\n prices, not booked sales); feed cost is real. Labelled as estimates to avoid implying\n real revenue. */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <h3 className=\"mb-1 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.financials.title', 'Estimated Financials')}\n </h3>\n <p className=\"mb-3 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.dashboard.financials.description',\n 'Production value is estimated from recorded output at standard unit prices; feed cost is actual.'\n )}\n </p>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.productionValue', 'Est. Production Value')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">{formatCurrency(monthlyRevenue)}</p>\n </div>\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.feedCost', 'Feed Cost')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">{formatCurrency(monthlyExpenses)}</p>\n </div>\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.net', 'Est. Net')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">\n {formatCurrency(monthlyRevenue - monthlyExpenses)}\n </p>\n </div>\n </div>\n </div>\n </>\n )}\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAkCA,IAAM,KAAiB,MAAiB;AACtC,SAAQ,GAAR;EACE,KAAK;EACL,KAAK,UACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,QACH,QAAO;EACT,KAAK,MACH,QAAO;EACT,KAAK,UACH,QAAO;EACT,QACE,QAAO;;GAKP,IAAsC;CAC1C,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,QAAQ;CACT,EAEY,UAAmC;CAC9C,IAAM,EAAE,YAAS,kBAAe,iBAAc,sBAAmB,gBAAa,YAAS,cACrF,IAAoB,EAEhB,IAAW,GAAa,EACxB,EAAE,iBAAc,GAAa,EAC7B,EAAE,SAAM,GAAS,EAEjB,IAAe,EAAQ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AAf;KACE,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAE,oDAAoD,uBAAuB;MAC3E,CAAA;KACL,kBAAC,KAAD;MAAG,WAAU;gBACV,EACC,0DACA,mGACD;MACC,CAAA;KACJ,kBAAC,OAAD;MAAK,WAAU;gBAAf;OACE,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,8DAA8D,wBAAwB;SACvF,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBAAuC,EAAe,EAAe;SAAK,CAAA,CACnF;;OACN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,uDAAuD,YAAY;SACpE,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBAAuC,EAAe,EAAgB;SAAK,CAAA,CACpF;;OACN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,kDAAkD,WAAW;SAC9D,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAe,IAAiB,EAAgB;SAC/C,CAAA,CACA;;OACF;;KACF;;GACL,EAAA,CAAA;EAEM,CAAA"}
|
|
1
|
+
{"version":3,"file":"LivestockDashboardPage.js","names":[],"sources":["../../../../src/healthybowl/pages/livestock/LivestockDashboardPage.tsx"],"sourcesContent":["import { type FC } from 'react';\nimport { useNavigate } from 'react-router';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport {\n PawPrint,\n Heart,\n Baby,\n DollarSign,\n TrendingUp,\n Milk,\n Egg,\n Calendar,\n ArrowRight,\n AlertCircle,\n Clock,\n ChevronRight,\n Plus,\n Package,\n Users,\n} from 'lucide-react';\nimport {\n PageLayout,\n StatCard,\n StatusBadge,\n ChartCard,\n LoadingSkeleton,\n EmptyState,\n ErrorState,\n} from '../../components';\nimport { LivestockGrowthCard } from './LivestockGrowthCard';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { formatDate, formatCurrency } from '../../utils/helpers';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Button } from '@burdenoff/fe-libs/ui';\n\nconst getAnimalIcon = (type: string) => {\n switch (type) {\n case 'cattle':\n case 'buffalo':\n return '🐄';\n case 'goat':\n return '🐐';\n case 'sheep':\n return '🐑';\n case 'pig':\n return '🐷';\n case 'poultry':\n return '🐔';\n default:\n return '🐾';\n }\n};\n\n// Per-unit price estimates for production types (used to derive revenue)\nconst UNIT_PRICES: Record<string, number> = {\n milk: 55,\n eggs: 8,\n wool: 400,\n meat: 350,\n manure: 5,\n};\n\nexport const LivestockDashboardPage: FC = () => {\n const { animals, healthRecords, vaccinations, productionRecords, feedRecords, loading, errors } =\n useHealthyBowlData();\n\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { t } = useI18n();\n\n const totalAnimals = animals.length;\n const healthy = animals.filter((a) => a.healthStatus === 'healthy').length;\n const sick = animals.filter((a) => a.healthStatus === 'sick').length;\n const underTreatment = animals.filter((a) => a.healthStatus === 'under_treatment').length;\n const quarantine = animals.filter((a) => a.healthStatus === 'quarantine').length;\n const pregnant = animals.filter((a) => a.healthStatus === 'pregnant').length;\n\n const typeCounts = animals.reduce<Record<string, number>>((acc, a) => {\n acc[a.type] = (acc[a.type] || 0) + 1;\n return acc;\n }, {});\n\n // Total production from all records\n const milkProduction = productionRecords.filter((p) => p.type === 'milk').reduce((sum, p) => sum + p.quantity, 0);\n const eggProduction = productionRecords.filter((p) => p.type === 'eggs').reduce((sum, p) => sum + p.quantity, 0);\n\n // Derive financial figures from actual data\n const monthlyRevenue = productionRecords.reduce((sum, p) => sum + p.quantity * (UNIT_PRICES[p.type] ?? 0), 0);\n const monthlyExpenses = feedRecords.reduce((sum, r) => sum + r.cost, 0);\n const profitMargin =\n monthlyRevenue > 0 ? (((monthlyRevenue - monthlyExpenses) / monthlyRevenue) * 100).toFixed(1) : '0.0';\n\n const recentHealthIssues = healthRecords\n .filter((r) => r.status === 'active' || r.status === 'monitoring')\n .slice(0, 3);\n const upcomingVaccinations = vaccinations.filter((v) => v.status === 'scheduled').slice(0, 3);\n\n return (\n <PageLayout\n title={t('healthybowl.livestock.dashboard.title', 'Livestock Management')}\n description={t('healthybowl.livestock.dashboard.description', 'Monitor and manage your livestock operations')}\n purpose=\"The health of your animal operation at a glance — herd size, health flags and production. Start here each day, then dive into the registry, health, breeding or feed sections as needed.\"\n nextStepsKey=\"healthybowl-livestock-dashboard\"\n nextStepsTitle=\"Run your herd day to day\"\n nextSteps={[\n {\n id: 'registry',\n label: 'Register your animals',\n description: 'Build the herd registry so every record links to an animal.',\n onClick: () => navigate(buildPath('livestock/animals')),\n },\n {\n id: 'health',\n label: 'Log health & vaccinations',\n description: 'Keep treatment and vaccination history in one place.',\n onClick: () => navigate(buildPath('livestock/health')),\n },\n {\n id: 'production',\n label: 'Track production',\n description: 'Record milk, eggs or other yields to watch trends.',\n onClick: () => navigate(buildPath('livestock/production')),\n },\n ]}\n actions={\n <Button variant=\"default\" onClick={() => navigate(buildPath('livestock/animals'))}>\n <Plus className=\"h-4 w-4\" />\n {t('healthybowl.livestock.dashboard.actions.addAnimal', 'Add Animal')}\n </Button>\n }\n >\n {loading && animals.length === 0 ? (\n <LoadingSkeleton variant=\"card\" count={4} />\n ) : (\n <>\n {/* Key Metrics */}\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n hero\n label={t('healthybowl.livestock.dashboard.stats.totalAnimals.label', 'Total Animals')}\n value={totalAnimals}\n icon={<PawPrint className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.healthIssues.label', 'Health Issues')}\n value={sick + underTreatment}\n icon={<Heart className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.productionValue.label', 'Est. Production Value')}\n value={formatCurrency(monthlyRevenue)}\n icon={<DollarSign className=\"h-4 w-4\" />}\n />\n <StatCard\n label={t('healthybowl.livestock.dashboard.stats.margin.label', 'Est. Margin')}\n value={parseFloat(profitMargin)}\n unit=\"%\"\n icon={<TrendingUp className=\"h-4 w-4\" />}\n />\n </div>\n\n {/* Animal Distribution & Total Production */}\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-2\">\n {/* Animal Distribution */}\n <ChartCard\n title={t('healthybowl.livestock.dashboard.distribution.title', 'Animal Distribution')}\n description={t('healthybowl.livestock.dashboard.distribution.description', 'Breakdown by animal type')}\n >\n {totalAnimals === 0 ? (\n errors.livestock ? (\n <ErrorState />\n ) : (\n <EmptyState\n illustration=\"empty-generic\"\n title={t('healthybowl.livestock.dashboard.distribution.empty.title', 'No animals yet')}\n description={t(\n 'healthybowl.livestock.dashboard.distribution.empty.description',\n 'Add an animal to see your livestock distribution by type.'\n )}\n />\n )\n ) : (\n <div className=\"flex flex-col gap-3\">\n {Object.entries(typeCounts).map(([type, count]) => {\n const percentage = totalAnimals > 0 ? Math.round((count / totalAnimals) * 100) : 0;\n return (\n <div key={type} className=\"space-y-1.5\">\n <div className=\"flex items-center justify-between\">\n <div className=\"flex items-center gap-2\">\n <span className=\"text-lg\">{getAnimalIcon(type)}</span>\n <span className=\"text-sm font-medium capitalize text-text-primary\">{type}</span>\n </div>\n <span className=\"text-xs text-text-secondary\">\n {count} ({percentage}%)\n </span>\n </div>\n <div className=\"h-2 w-full rounded-full bg-bg-sunken\">\n <div\n className=\"h-2 rounded-full bg-action-primary-bg transition-all\"\n style={{ width: `${percentage}%` }}\n />\n </div>\n </div>\n );\n })}\n </div>\n )}\n <div className=\"mt-4 border-t border-border-subtle pt-4\">\n <Button\n variant=\"outline\"\n onClick={() => navigate(buildPath('livestock/animals'))}\n className=\"w-full justify-center\"\n >\n {t('healthybowl.livestock.dashboard.distribution.viewAll', 'View All Animals')}{' '}\n <ArrowRight className=\"h-4 w-4\" />\n </Button>\n </div>\n </ChartCard>\n\n {/* Total Production */}\n <ChartCard\n title={t('healthybowl.livestock.dashboard.production.title', 'Total Production')}\n description={t(\n 'healthybowl.livestock.dashboard.production.description',\n 'Cumulative production tracking'\n )}\n >\n <div className=\"flex flex-col gap-4\">\n <div className=\"flex items-center justify-between rounded-lg bg-bg-sunken/50 p-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"rounded-full bg-bg-surface p-3\">\n <Milk className=\"h-5 w-5 text-primary\" />\n </div>\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.production.milk.label', 'Milk Production')}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.milk.source', 'From dairy animals')}\n </p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xl font-bold text-text-primary\">{milkProduction}</p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.milk.unit', 'liters')}\n </p>\n </div>\n </div>\n\n <div className=\"flex items-center justify-between rounded-lg bg-bg-sunken/50 p-4\">\n <div className=\"flex items-center gap-3\">\n <div className=\"rounded-full bg-bg-surface p-3\">\n <Egg className=\"h-5 w-5 text-primary\" />\n </div>\n <div>\n <p className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.production.eggs.label', 'Egg Collection')}\n </p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.eggs.source', 'From poultry')}\n </p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xl font-bold text-text-primary\">{eggProduction}</p>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.production.eggs.unit', 'eggs')}\n </p>\n </div>\n </div>\n\n <Button\n variant=\"default\"\n onClick={() => navigate(buildPath('livestock/production'))}\n className=\"w-full justify-center\"\n >\n {t('healthybowl.livestock.dashboard.production.record', 'Record Production')}{' '}\n <Plus className=\"h-4 w-4\" />\n </Button>\n </div>\n </ChartCard>\n </div>\n\n {/* Growth (BOFF-5971) — herd-average weight curve + ADG leaders */}\n <LivestockGrowthCard />\n\n {/* Health Status & Quick Actions */}\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-3\">\n {/* Health Status Overview */}\n <div className=\"lg:col-span-2 rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h3 className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.healthStatus.title', 'Health Status Overview')}\n </h3>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.healthStatus.subtitle', 'Current health distribution')}\n </p>\n </div>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(buildPath('livestock/health'))}\n className=\"text-xs\"\n >\n {t('healthybowl.common.viewAll', 'View All')}\n </Button>\n </div>\n\n <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3 md:grid-cols-5\">\n {[\n {\n id: 'healthy',\n label: t('healthybowl.livestock.dashboard.healthStatus.healthy', 'Healthy'),\n value: healthy,\n variant: 'success' as const,\n icon: Heart,\n },\n {\n id: 'sick',\n label: t('healthybowl.livestock.dashboard.healthStatus.sick', 'Sick'),\n value: sick,\n variant: 'error' as const,\n icon: AlertCircle,\n },\n {\n id: 'treatment',\n label: t('healthybowl.livestock.dashboard.healthStatus.treatment', 'Treatment'),\n value: underTreatment,\n variant: 'warning' as const,\n icon: Clock,\n },\n {\n id: 'quarantine',\n label: t('healthybowl.livestock.dashboard.healthStatus.quarantine', 'Quarantine'),\n value: quarantine,\n variant: 'error' as const,\n icon: AlertCircle,\n },\n {\n id: 'pregnant',\n label: t('healthybowl.livestock.dashboard.healthStatus.pregnant', 'Pregnant'),\n value: pregnant,\n variant: 'info' as const,\n icon: Baby,\n },\n ].map((item) => (\n <div key={item.id} className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <item.icon className=\"mx-auto mb-1 h-4 w-4 text-text-secondary\" />\n <p className=\"text-xl font-bold text-text-primary\">{item.value}</p>\n <p className=\"text-xs text-text-secondary\">{item.label}</p>\n </div>\n ))}\n </div>\n\n {/* Recent Health Issues */}\n {recentHealthIssues.length > 0 && (\n <div className=\"mt-4\">\n <h4 className=\"mb-2 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.healthStatus.recentIssues', 'Recent Health Issues')}\n </h4>\n <div className=\"flex flex-col gap-2\">\n {recentHealthIssues.map((issue) => (\n <div\n key={issue.id}\n className=\"flex cursor-pointer items-center justify-between rounded-md border border-border-subtle p-3 hover:bg-bg-sunken/30\"\n onClick={() => navigate(buildPath('livestock/health'))}\n >\n <div className=\"flex items-center gap-3\">\n <StatusBadge label={issue.status} variant={issue.status === 'active' ? 'warning' : 'info'} />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">{issue.animalName}</p>\n <p className=\"text-xs text-text-secondary\">{issue.diagnosis}</p>\n </div>\n </div>\n <ChevronRight className=\"h-4 w-4 text-text-secondary\" />\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n\n {/* Quick Actions */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <h3 className=\"mb-1 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.quickActions.title', 'Quick Actions')}\n </h3>\n <p className=\"mb-4 text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.quickActions.subtitle', 'Common livestock tasks')}\n </p>\n <div className=\"flex flex-col gap-2\">\n {[\n {\n id: 'healthCheck',\n label: t('healthybowl.livestock.dashboard.quickActions.recordHealthCheck', 'Record Health Check'),\n icon: Heart,\n path: buildPath('livestock/health'),\n },\n {\n id: 'vaccination',\n label: t(\n 'healthybowl.livestock.dashboard.quickActions.scheduleVaccination',\n 'Schedule Vaccination'\n ),\n icon: Calendar,\n path: buildPath('livestock/vaccinations'),\n },\n {\n id: 'feed',\n label: t('healthybowl.livestock.dashboard.quickActions.updateFeedRecords', 'Update Feed Records'),\n icon: Package,\n path: buildPath('livestock/feed'),\n },\n {\n id: 'breeding',\n label: t('healthybowl.livestock.dashboard.quickActions.breedingManagement', 'Breeding Management'),\n icon: Users,\n path: buildPath('livestock/breeding'),\n },\n {\n id: 'production',\n label: t('healthybowl.livestock.dashboard.quickActions.viewProduction', 'View Production'),\n icon: TrendingUp,\n path: buildPath('livestock/production'),\n },\n ].map((action) => (\n <Button\n key={action.id}\n variant=\"outline\"\n onClick={() => navigate(action.path)}\n className=\"justify-start\"\n >\n <action.icon className=\"h-4 w-4 text-text-secondary\" />\n {action.label}\n </Button>\n ))}\n </div>\n </div>\n </div>\n\n {/* Upcoming Vaccinations */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <div className=\"mb-4 flex items-center justify-between\">\n <div>\n <h3 className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.vaccinations.title', 'Upcoming Vaccinations')}\n </h3>\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.vaccinations.subtitle', 'Next 7 days · {{count}} scheduled', {\n count: upcomingVaccinations.length,\n })}\n </p>\n </div>\n <Button\n variant=\"ghost\"\n size=\"sm\"\n onClick={() => navigate(buildPath('livestock/vaccinations'))}\n className=\"text-xs\"\n >\n {t('healthybowl.common.viewAll', 'View All')}\n </Button>\n </div>\n <div className=\"flex flex-col gap-2\">\n {upcomingVaccinations.map((vac) => (\n <div\n key={vac.id}\n className=\"flex items-center justify-between rounded-md border border-border-subtle p-3 hover:bg-bg-sunken/30\"\n >\n <div className=\"flex items-center gap-3\">\n <Calendar className=\"h-4 w-4 text-text-secondary\" />\n <div>\n <p className=\"text-sm font-medium text-text-primary\">{vac.animalName}</p>\n <p className=\"text-xs text-text-secondary\">{vac.vaccineName}</p>\n </div>\n </div>\n <div className=\"text-right\">\n <p className=\"text-xs font-medium text-text-primary\">{formatDate(vac.nextDueDate)}</p>\n <StatusBadge label={vac.status} variant=\"info\" />\n </div>\n </div>\n ))}\n {upcomingVaccinations.length === 0 && (\n <p className=\"py-4 text-center text-sm text-text-secondary\">\n {t('healthybowl.livestock.dashboard.vaccinations.empty', 'No upcoming vaccinations')}\n </p>\n )}\n </div>\n </div>\n\n {/* Financial Summary — production value is ESTIMATED (recorded quantities × standard unit\n prices, not booked sales); feed cost is real. Labelled as estimates to avoid implying\n real revenue. */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4 shadow-sm\">\n <h3 className=\"mb-1 text-sm font-medium text-text-primary\">\n {t('healthybowl.livestock.dashboard.financials.title', 'Estimated Financials')}\n </h3>\n <p className=\"mb-3 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.dashboard.financials.description',\n 'Production value is estimated from recorded output at standard unit prices; feed cost is actual.'\n )}\n </p>\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-3\">\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.productionValue', 'Est. Production Value')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">{formatCurrency(monthlyRevenue)}</p>\n </div>\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.feedCost', 'Feed Cost')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">{formatCurrency(monthlyExpenses)}</p>\n </div>\n <div className=\"rounded-lg bg-bg-sunken/50 p-3 text-center\">\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.dashboard.financials.net', 'Est. Net')}\n </p>\n <p className=\"text-lg font-bold text-text-primary\">\n {formatCurrency(monthlyRevenue - monthlyExpenses)}\n </p>\n </div>\n </div>\n </div>\n </>\n )}\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAmCA,IAAM,KAAiB,MAAiB;AACtC,SAAQ,GAAR;EACE,KAAK;EACL,KAAK,UACH,QAAO;EACT,KAAK,OACH,QAAO;EACT,KAAK,QACH,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,CAAA,CACF;UACN,kBAAC,OAAD;OAAK,WAAU;iBAAf,CACE,kBAAC,KAAD;QAAG,WAAU;kBAAyC,EAAW,EAAI,YAAY;QAAK,CAAA,EACtF,kBAAC,GAAD;QAAa,OAAO,EAAI;QAAQ,SAAQ;QAAS,CAAA,CAC7C;SACF;QAdC,EAAI,GAcL,CACN,EACD,EAAqB,WAAW,KAC/B,kBAAC,KAAD;MAAG,WAAU;gBACV,EAAE,sDAAsD,2BAA2B;MAClF,CAAA,CAEF;OACF;;GAKN,kBAAC,OAAD;IAAK,WAAU;cAAf;KACE,kBAAC,MAAD;MAAI,WAAU;gBACX,EAAE,oDAAoD,uBAAuB;MAC3E,CAAA;KACL,kBAAC,KAAD;MAAG,WAAU;gBACV,EACC,0DACA,mGACD;MACC,CAAA;KACJ,kBAAC,OAAD;MAAK,WAAU;gBAAf;OACE,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,8DAA8D,wBAAwB;SACvF,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBAAuC,EAAe,EAAe;SAAK,CAAA,CACnF;;OACN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,uDAAuD,YAAY;SACpE,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBAAuC,EAAe,EAAgB;SAAK,CAAA,CACpF;;OACN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,kDAAkD,WAAW;SAC9D,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAe,IAAiB,EAAgB;SAC/C,CAAA,CACA;;OACF;;KACF;;GACL,EAAA,CAAA;EAEM,CAAA"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { formatNumber as e } from "../../utils/helpers.js";
|
|
2
|
+
import { ChartCard as t } from "../../components/ChartCard.js";
|
|
3
|
+
import { Tooltip as n } from "../../../node_modules/recharts/es6/component/Tooltip.js";
|
|
4
|
+
import { ResponsiveContainer as r } from "../../../node_modules/recharts/es6/component/ResponsiveContainer.js";
|
|
5
|
+
import { CartesianGrid as i } from "../../../node_modules/recharts/es6/cartesian/CartesianGrid.js";
|
|
6
|
+
import { Line as a } from "../../../node_modules/recharts/es6/cartesian/Line.js";
|
|
7
|
+
import { XAxis as o } from "../../../node_modules/recharts/es6/cartesian/XAxis.js";
|
|
8
|
+
import { YAxis as s } from "../../../node_modules/recharts/es6/cartesian/YAxis.js";
|
|
9
|
+
import { LineChart as c } from "../../../node_modules/recharts/es6/chart/LineChart.js";
|
|
10
|
+
import { useHealthyBowlLivestockGrowth as l } from "../../hooks/useHealthyBowlLivestockGrowth.js";
|
|
11
|
+
import { useMemo as u, useState as d } from "react";
|
|
12
|
+
import { useI18n as f } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
13
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
14
|
+
//#region src/healthybowl/pages/livestock/LivestockGrowthCard.tsx
|
|
15
|
+
var g = [
|
|
16
|
+
"DAY",
|
|
17
|
+
"WEEK",
|
|
18
|
+
"MONTH"
|
|
19
|
+
], _ = ({ groupId: _ = null, className: v }) => {
|
|
20
|
+
let { t: y } = f(), [b, x] = d("WEEK"), { herdAverage: S, summary: C, loading: w, error: T } = l({
|
|
21
|
+
groupId: _,
|
|
22
|
+
granularity: b
|
|
23
|
+
}), E = u(() => [...S].sort((e, t) => e.at.localeCompare(t.at)).map((e) => ({
|
|
24
|
+
at: e.at,
|
|
25
|
+
herd: e.avgWeightKg,
|
|
26
|
+
animalCount: e.animalCount,
|
|
27
|
+
sampleSize: e.sampleSize
|
|
28
|
+
})), [S]), D = E.length > 0, O = /* @__PURE__ */ m("div", {
|
|
29
|
+
className: "flex items-center gap-1",
|
|
30
|
+
children: g.map((e) => /* @__PURE__ */ m("button", {
|
|
31
|
+
type: "button",
|
|
32
|
+
onClick: () => x(e),
|
|
33
|
+
"aria-pressed": b === e,
|
|
34
|
+
className: `min-h-[32px] rounded-md px-2 py-1 text-xs transition-colors ${b === e ? "bg-action-primary-bg text-action-primary-text" : "text-text-secondary hover:bg-bg-sunken/50"}`,
|
|
35
|
+
children: y(`healthybowl.livestock.growth.granularity.${e.toLowerCase()}`, e.charAt(0) + e.slice(1).toLowerCase())
|
|
36
|
+
}, e))
|
|
37
|
+
});
|
|
38
|
+
return /* @__PURE__ */ m(t, {
|
|
39
|
+
title: y("healthybowl.livestock.growth.title", "Growth"),
|
|
40
|
+
description: y("healthybowl.livestock.growth.description", "Average herd weight over time, and how fast each animal is gaining."),
|
|
41
|
+
actions: O,
|
|
42
|
+
className: v,
|
|
43
|
+
children: T ? /* @__PURE__ */ h("div", {
|
|
44
|
+
className: "py-8 text-center",
|
|
45
|
+
children: [/* @__PURE__ */ m("p", {
|
|
46
|
+
className: "text-sm text-text-primary",
|
|
47
|
+
children: y("healthybowl.livestock.growth.error.title", "Could not load growth data")
|
|
48
|
+
}), /* @__PURE__ */ m("p", {
|
|
49
|
+
className: "mt-1 text-xs text-text-secondary",
|
|
50
|
+
children: T.message
|
|
51
|
+
})]
|
|
52
|
+
}) : w && !D ? /* @__PURE__ */ m("p", {
|
|
53
|
+
className: "py-8 text-center text-xs text-text-secondary",
|
|
54
|
+
children: y("healthybowl.livestock.growth.loading", "Loading growth data…")
|
|
55
|
+
}) : D ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(r, {
|
|
56
|
+
width: "100%",
|
|
57
|
+
height: 280,
|
|
58
|
+
children: /* @__PURE__ */ h(c, {
|
|
59
|
+
data: E,
|
|
60
|
+
margin: {
|
|
61
|
+
top: 5,
|
|
62
|
+
right: 20,
|
|
63
|
+
left: 0,
|
|
64
|
+
bottom: 5
|
|
65
|
+
},
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ m(i, {
|
|
68
|
+
strokeDasharray: "3 3",
|
|
69
|
+
stroke: "var(--color-border)"
|
|
70
|
+
}),
|
|
71
|
+
/* @__PURE__ */ m(o, {
|
|
72
|
+
dataKey: "at",
|
|
73
|
+
tick: { fontSize: 11 },
|
|
74
|
+
stroke: "var(--color-muted-foreground)"
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ m(s, {
|
|
77
|
+
tick: { fontSize: 11 },
|
|
78
|
+
stroke: "var(--color-muted-foreground)",
|
|
79
|
+
label: {
|
|
80
|
+
value: "kg",
|
|
81
|
+
angle: -90,
|
|
82
|
+
position: "insideLeft",
|
|
83
|
+
fontSize: 11
|
|
84
|
+
}
|
|
85
|
+
}),
|
|
86
|
+
/* @__PURE__ */ m(n, {
|
|
87
|
+
contentStyle: {
|
|
88
|
+
backgroundColor: "var(--color-card)",
|
|
89
|
+
border: "1px solid var(--color-border)",
|
|
90
|
+
borderRadius: 8,
|
|
91
|
+
fontSize: 12
|
|
92
|
+
},
|
|
93
|
+
labelStyle: { color: "var(--color-foreground)" },
|
|
94
|
+
formatter: (t, n, r) => {
|
|
95
|
+
let i = typeof t == "number" ? e(t) : t;
|
|
96
|
+
if (n !== "herd") return [`${i} kg`, n];
|
|
97
|
+
let a = r?.payload?.animalCount, o = r?.payload?.sampleSize;
|
|
98
|
+
return [`${i} kg`, y("healthybowl.livestock.growth.tooltip.herd", "Herd average ({{count}} animals, {{samples}} readings)", {
|
|
99
|
+
count: String(a ?? "—"),
|
|
100
|
+
samples: String(o ?? "—")
|
|
101
|
+
})];
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
/* @__PURE__ */ m(a, {
|
|
105
|
+
type: "monotone",
|
|
106
|
+
dataKey: "herd",
|
|
107
|
+
name: "herd",
|
|
108
|
+
stroke: "var(--color-success)",
|
|
109
|
+
strokeWidth: 2.5,
|
|
110
|
+
dot: { r: 2 },
|
|
111
|
+
connectNulls: !0
|
|
112
|
+
})
|
|
113
|
+
]
|
|
114
|
+
})
|
|
115
|
+
}), C && /* @__PURE__ */ h("dl", {
|
|
116
|
+
className: "mt-3 grid grid-cols-2 gap-3 border-t border-border-subtle pt-3 sm:grid-cols-4",
|
|
117
|
+
children: [
|
|
118
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
|
|
119
|
+
className: "text-xs text-text-secondary",
|
|
120
|
+
children: y("healthybowl.livestock.growth.summary.medianAdg", "Median gain")
|
|
121
|
+
}), /* @__PURE__ */ m("dd", {
|
|
122
|
+
className: "text-sm font-medium text-text-primary",
|
|
123
|
+
children: C.medianAdgKgPerDay === null ? "—" : `${C.medianAdgKgPerDay} kg/day`
|
|
124
|
+
})] }),
|
|
125
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
|
|
126
|
+
className: "text-xs text-text-secondary",
|
|
127
|
+
children: y("healthybowl.livestock.growth.summary.fastest", "Fastest")
|
|
128
|
+
}), /* @__PURE__ */ m("dd", {
|
|
129
|
+
className: "text-sm font-medium text-text-primary",
|
|
130
|
+
children: C.fastestGrowing ? `${C.fastestGrowing.name} · ${C.fastestGrowing.adgKgPerDay} kg/day` : "—"
|
|
131
|
+
})] }),
|
|
132
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
|
|
133
|
+
className: "text-xs text-text-secondary",
|
|
134
|
+
children: y("healthybowl.livestock.growth.summary.slowest", "Slowest")
|
|
135
|
+
}), /* @__PURE__ */ m("dd", {
|
|
136
|
+
className: "text-sm font-medium text-text-primary",
|
|
137
|
+
children: C.slowestGrowing ? `${C.slowestGrowing.name} · ${C.slowestGrowing.adgKgPerDay} kg/day` : "—"
|
|
138
|
+
})] }),
|
|
139
|
+
/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("dt", {
|
|
140
|
+
className: "text-xs text-text-secondary",
|
|
141
|
+
children: y("healthybowl.livestock.growth.summary.unweighed", "Not weighed")
|
|
142
|
+
}), /* @__PURE__ */ h("dd", {
|
|
143
|
+
className: "text-sm font-medium text-text-primary",
|
|
144
|
+
children: [C.animalsWithoutWeights, /* @__PURE__ */ h("span", {
|
|
145
|
+
className: "text-xs text-text-secondary",
|
|
146
|
+
children: [
|
|
147
|
+
" ",
|
|
148
|
+
"/ ",
|
|
149
|
+
C.animalsWithWeights + C.animalsWithoutWeights
|
|
150
|
+
]
|
|
151
|
+
})]
|
|
152
|
+
})] })
|
|
153
|
+
]
|
|
154
|
+
})] }) : /* @__PURE__ */ h("div", {
|
|
155
|
+
className: "py-8 text-center",
|
|
156
|
+
children: [/* @__PURE__ */ m("p", {
|
|
157
|
+
className: "text-sm text-text-primary",
|
|
158
|
+
children: y("healthybowl.livestock.growth.empty.title", "No weights recorded yet")
|
|
159
|
+
}), /* @__PURE__ */ m("p", {
|
|
160
|
+
className: "mt-1 text-xs text-text-secondary",
|
|
161
|
+
children: y("healthybowl.livestock.growth.empty.hint", "Record a weight against an animal — two measurements are enough to show a growth rate.")
|
|
162
|
+
})]
|
|
163
|
+
})
|
|
164
|
+
});
|
|
165
|
+
};
|
|
166
|
+
//#endregion
|
|
167
|
+
export { _ as LivestockGrowthCard };
|
|
168
|
+
|
|
169
|
+
//# sourceMappingURL=LivestockGrowthCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LivestockGrowthCard.js","names":[],"sources":["../../../../src/healthybowl/pages/livestock/LivestockGrowthCard.tsx"],"sourcesContent":["/**\n * Livestock growth chart (BOFF-5971).\n *\n * Plots the herd-average weight line from `healthyBowlLivestockGrowth`, with the ADG leaders and\n * the coverage gap beside it.\n *\n * Deliberate choices:\n * - Only the herd-average line is plotted. Per-animal curves were tried and pulled: herd points\n * are keyed by BUCKET START (Monday, for WEEK) while a weight is keyed by its measurement date,\n * so the two only align at DAY granularity — everywhere else the curves land on separate rows.\n * Bucketing the animal points here would duplicate the Monday-start rule that deliberately\n * lives in exactly one place (`livestock-depth/growth.ts`). The overlay returns when the chart\n * moves to a numeric time axis, or when the API carries a bucket key per point.\n * - `animalCount` / `sampleSize` ride in the tooltip. The backend averages each animal to itself\n * before averaging the herd, so a bucket built from one animal is honest but thin — the user\n * should be able to see that rather than read it as a solid trend.\n * - A query error is surfaced as an error, never as the empty state: \"no weights recorded\" is a\n * statement about the farm, and it must not be shown when the truth is \"we could not load\".\n */\n\nimport { useMemo, useState, type FC } from 'react';\nimport { CartesianGrid, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { ChartCard } from '../../components/ChartCard';\nimport { formatNumber } from '../../utils/helpers';\nimport { useHealthyBowlLivestockGrowth, type GrowthGranularity } from '../../hooks/useHealthyBowlLivestockGrowth';\n\nconst GRANULARITIES: GrowthGranularity[] = ['DAY', 'WEEK', 'MONTH'];\n\ninterface LivestockGrowthCardProps {\n groupId?: string | null;\n className?: string;\n}\n\nexport const LivestockGrowthCard: FC<LivestockGrowthCardProps> = ({ groupId = null, className }) => {\n const { t } = useI18n();\n const [granularity, setGranularity] = useState<GrowthGranularity>('WEEK');\n const { herdAverage, summary, loading, error } = useHealthyBowlLivestockGrowth({ groupId, granularity });\n\n const chartData = useMemo(\n () =>\n [...herdAverage]\n .sort((a, b) => a.at.localeCompare(b.at))\n .map((p) => ({\n at: p.at,\n herd: p.avgWeightKg,\n animalCount: p.animalCount,\n sampleSize: p.sampleSize,\n })),\n [herdAverage]\n );\n\n const hasData = chartData.length > 0;\n\n const granularityToggle = (\n <div className=\"flex items-center gap-1\">\n {GRANULARITIES.map((g) => (\n <button\n key={g}\n type=\"button\"\n onClick={() => setGranularity(g)}\n aria-pressed={granularity === g}\n className={`min-h-[32px] rounded-md px-2 py-1 text-xs transition-colors ${\n granularity === g\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'text-text-secondary hover:bg-bg-sunken/50'\n }`}\n >\n {t(`healthybowl.livestock.growth.granularity.${g.toLowerCase()}`, g.charAt(0) + g.slice(1).toLowerCase())}\n </button>\n ))}\n </div>\n );\n\n return (\n <ChartCard\n title={t('healthybowl.livestock.growth.title', 'Growth')}\n description={t(\n 'healthybowl.livestock.growth.description',\n 'Average herd weight over time, and how fast each animal is gaining.'\n )}\n actions={granularityToggle}\n className={className}\n >\n {error ? (\n <div className=\"py-8 text-center\">\n <p className=\"text-sm text-text-primary\">\n {t('healthybowl.livestock.growth.error.title', 'Could not load growth data')}\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">{error.message}</p>\n </div>\n ) : loading && !hasData ? (\n <p className=\"py-8 text-center text-xs text-text-secondary\">\n {t('healthybowl.livestock.growth.loading', 'Loading growth data…')}\n </p>\n ) : !hasData ? (\n <div className=\"py-8 text-center\">\n <p className=\"text-sm text-text-primary\">\n {t('healthybowl.livestock.growth.empty.title', 'No weights recorded yet')}\n </p>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.growth.empty.hint',\n 'Record a weight against an animal — two measurements are enough to show a growth rate.'\n )}\n </p>\n </div>\n ) : (\n <>\n <ResponsiveContainer width=\"100%\" height={280}>\n <LineChart data={chartData} margin={{ top: 5, right: 20, left: 0, bottom: 5 }}>\n <CartesianGrid strokeDasharray=\"3 3\" stroke=\"var(--color-border)\" />\n <XAxis dataKey=\"at\" tick={{ fontSize: 11 }} stroke=\"var(--color-muted-foreground)\" />\n <YAxis\n tick={{ fontSize: 11 }}\n stroke=\"var(--color-muted-foreground)\"\n label={{ value: 'kg', angle: -90, position: 'insideLeft', fontSize: 11 }}\n />\n <Tooltip\n contentStyle={{\n backgroundColor: 'var(--color-card)',\n border: '1px solid var(--color-border)',\n borderRadius: 8,\n fontSize: 12,\n }}\n labelStyle={{ color: 'var(--color-foreground)' }}\n formatter={(value: number | string, name: string, item: { payload?: Record<string, unknown> }) => {\n const kg = typeof value === 'number' ? formatNumber(value) : value;\n if (name !== 'herd') return [`${kg} kg`, name];\n const count = item?.payload?.['animalCount'];\n const samples = item?.payload?.['sampleSize'];\n return [\n `${kg} kg`,\n t(\n 'healthybowl.livestock.growth.tooltip.herd',\n 'Herd average ({{count}} animals, {{samples}} readings)',\n {\n count: String(count ?? '—'),\n samples: String(samples ?? '—'),\n }\n ),\n ];\n }}\n />\n <Line\n type=\"monotone\"\n dataKey=\"herd\"\n name=\"herd\"\n stroke=\"var(--color-success)\"\n strokeWidth={2.5}\n dot={{ r: 2 }}\n connectNulls\n />\n </LineChart>\n </ResponsiveContainer>\n\n {summary && (\n <dl className=\"mt-3 grid grid-cols-2 gap-3 border-t border-border-subtle pt-3 sm:grid-cols-4\">\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.growth.summary.medianAdg', 'Median gain')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {summary.medianAdgKgPerDay === null ? '—' : `${summary.medianAdgKgPerDay} kg/day`}\n </dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.growth.summary.fastest', 'Fastest')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {summary.fastestGrowing\n ? `${summary.fastestGrowing.name} · ${summary.fastestGrowing.adgKgPerDay} kg/day`\n : '—'}\n </dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.growth.summary.slowest', 'Slowest')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {summary.slowestGrowing\n ? `${summary.slowestGrowing.name} · ${summary.slowestGrowing.adgKgPerDay} kg/day`\n : '—'}\n </dd>\n </div>\n <div>\n <dt className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.growth.summary.unweighed', 'Not weighed')}\n </dt>\n <dd className=\"text-sm font-medium text-text-primary\">\n {summary.animalsWithoutWeights}\n <span className=\"text-xs text-text-secondary\">\n {' '}\n / {summary.animalsWithWeights + summary.animalsWithoutWeights}\n </span>\n </dd>\n </div>\n </dl>\n )}\n </>\n )}\n </ChartCard>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;AA2BA,IAAM,IAAqC;CAAC;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