@burdenoff/microfe-healthybowl 2026.814.1 → 2026.814.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.
@@ -1 +1 @@
1
- {"version":3,"file":"HBEntityTags.js","names":[],"sources":["../../../src/healthybowl/components/HBEntityTags.tsx"],"sourcesContent":["import { useCallback, useRef, useState, type FC } from 'react';\nimport { gql } from '@apollo/client';\nimport { useApolloClient } from '@apollo/client/react';\nimport { TagBadge, TagsWidget, type TagItem } from '@burdenoff/fe-libs/tag';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\nimport { cn } from '../utils/helpers';\n\n/**\n * Reuse-first tags. HealthyBowl owns the tag *set* (persisted on each entity's\n * `tagsV2` via `setHealthyBowlEntityTags`); the shared fe-libs `TagsWidget`\n * supplies the search/create/vocabulary UX and the wspace-tags-svc + AGE graph\n * sync. We never stand up a parallel tag store. See PLATFORM_REUSE_AUDIT §1.\n *\n * Controlled like the fe-libs example: local state drives the badges, each\n * change is persisted, and a page reload re-hydrates from the entity's own\n * `entityTags`. The mutation isn't in the offline-pulled schema as a typed hook\n * everywhere it's used, so we send a raw gql document (a later schema:pull +\n * codegen can swap in the generated hook).\n */\nconst SET_ENTITY_TAGS = gql`\n mutation SetHBEntityTags($input: SetHealthyBowlEntityTagsInput!) {\n setHealthyBowlEntityTags(input: $input) {\n id\n key\n label\n color\n vocabularyKey\n }\n }\n`;\n\nexport type HBTaggableType = 'CROP' | 'MARKETPLACE_PRODUCT' | 'COMMUNITY_POST';\n\n/** Minimal tag shape accepted from a query's `entityTags` (a superset of this is fine). */\nexport interface HBTagLike {\n id: string;\n key: string;\n label: string;\n color?: string | null;\n vocabularyKey?: string | null;\n}\n\ninterface HBEntityTagsProps {\n entityType: HBTaggableType;\n entityId: string;\n tags: readonly HBTagLike[];\n /** Render read-only badges (no add/remove) — for cards/lists where editing is out of place. */\n readOnly?: boolean;\n className?: string;\n}\n\nfunction toTagItem(t: HBTagLike): TagItem {\n return { id: t.id, key: t.key, label: t.label, color: t.color ?? null, vocabularyKey: t.vocabularyKey ?? null };\n}\n\nexport const HBEntityTags: FC<HBEntityTagsProps> = ({ entityType, entityId, tags, readOnly, className }) => {\n const client = useApolloClient();\n const { workspaceId } = useHealthyBowl();\n const [current, setCurrent] = useState<TagItem[]>(() => tags.map(toTagItem));\n\n // Re-sync from props when the entity's persisted tags change (parent refetch,\n // navigation, another editor). Keyed on the tag-id set so a fresh array reference\n // on every render doesn't loop. `currentRef` mirrors the set so the add/remove\n // handlers read the latest value without a stale closure on rapid successive edits.\n const currentRef = useRef(current);\n const tagsKey = tags.map((t) => t.id).join('|');\n const syncedKey = useRef(tagsKey);\n if (tagsKey !== syncedKey.current) {\n syncedKey.current = tagsKey;\n const synced = tags.map(toTagItem);\n currentRef.current = synced;\n setCurrent(synced);\n }\n\n const apply = useCallback(\n async (next: TagItem[]) => {\n const prev = currentRef.current;\n currentRef.current = next;\n setCurrent(next); // optimistic\n try {\n await client.mutate({\n mutation: SET_ENTITY_TAGS,\n variables: {\n input: {\n entityType,\n entityId,\n tags: next.map((t) => ({\n id: t.id,\n key: t.key,\n label: t.label,\n color: t.color ?? null,\n vocabularyKey: t.vocabularyKey ?? t.vocabulary?.key ?? null,\n })),\n context: { workspaceId },\n },\n },\n });\n } catch {\n // Persist failed — revert so the UI never shows tags that aren't actually\n // saved. The badge reverting is the user-visible signal the change didn't stick.\n currentRef.current = prev;\n setCurrent(prev);\n }\n },\n [client, entityType, entityId, workspaceId]\n );\n\n const handleAdd = useCallback((tag: TagItem) => void apply([...currentRef.current, tag]), [apply]);\n const handleRemove = useCallback(\n (tagId: string) => void apply(currentRef.current.filter((t) => t.id !== tagId)),\n [apply]\n );\n\n if (readOnly) {\n if (!current.length) return null;\n return (\n <div className={cn('flex flex-wrap items-center gap-1.5', className)}>\n {current.map((t) => (\n <TagBadge key={t.id} id={t.id} label={t.label} color={t.color ?? undefined} size=\"sm\" />\n ))}\n </div>\n );\n }\n\n return (\n <TagsWidget\n entityType={`HEALTHYBOWL_${entityType}`}\n entityId={entityId}\n workspaceId={workspaceId}\n tags={current}\n onAdd={handleAdd}\n onRemove={handleRemove}\n className={className}\n />\n );\n};\n"],"mappings":";;;;;;;;AAmBA,IAAM,IAAkB,CAAG;;;;;;;;;;;AAgC3B,SAAS,EAAU,GAAuB;AACxC,QAAO;EAAE,IAAI,EAAE;EAAI,KAAK,EAAE;EAAK,OAAO,EAAE;EAAO,OAAO,EAAE,SAAS;EAAM,eAAe,EAAE,iBAAiB;EAAM;;AAGjH,IAAa,KAAuC,EAAE,eAAY,aAAU,SAAM,aAAU,mBAAgB;CAC1G,IAAM,IAAS,GAAiB,EAC1B,EAAE,mBAAgB,GAAgB,EAClC,CAAC,GAAS,KAAc,QAA0B,EAAK,IAAI,EAAU,CAAC,EAMtE,IAAa,EAAO,EAAQ,EAC5B,IAAU,EAAK,KAAK,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,EACzC,IAAY,EAAO,EAAQ;AACjC,KAAI,MAAY,EAAU,SAAS;AACjC,IAAU,UAAU;EACpB,IAAM,IAAS,EAAK,IAAI,EAAU;AAElC,EADA,EAAW,UAAU,GACrB,EAAW,EAAO;;CAGpB,IAAM,IAAQ,EACZ,OAAO,MAAoB;EACzB,IAAM,IAAO,EAAW;AAExB,EADA,EAAW,UAAU,GACrB,EAAW,EAAK;AAChB,MAAI;AACF,SAAM,EAAO,OAAO;IAClB,UAAU;IACV,WAAW,EACT,OAAO;KACL;KACA;KACA,MAAM,EAAK,KAAK,OAAO;MACrB,IAAI,EAAE;MACN,KAAK,EAAE;MACP,OAAO,EAAE;MACT,OAAO,EAAE,SAAS;MAClB,eAAe,EAAE,iBAAiB,EAAE,YAAY,OAAO;MACxD,EAAE;KACH,SAAS,EAAE,gBAAa;KACzB,EACF;IACF,CAAC;UACI;AAIN,GADA,EAAW,UAAU,GACrB,EAAW,EAAK;;IAGpB;EAAC;EAAQ;EAAY;EAAU;EAAY,CAC5C,EAEK,IAAY,GAAa,MAAiB,KAAK,EAAM,CAAC,GAAG,EAAW,SAAS,EAAI,CAAC,EAAE,CAAC,EAAM,CAAC,EAC5F,IAAe,GAClB,MAAkB,KAAK,EAAM,EAAW,QAAQ,QAAQ,MAAM,EAAE,OAAO,EAAM,CAAC,EAC/E,CAAC,EAAM,CACR;AAaD,QAXI,IACG,EAAQ,SAEX,kBAAC,OAAD;EAAK,WAAW,EAAG,uCAAuC,EAAU;YACjE,EAAQ,KAAK,MACZ,kBAAC,GAAD;GAAqB,IAAI,EAAE;GAAI,OAAO,EAAE;GAAO,OAAO,EAAE,SAAS,KAAA;GAAW,MAAK;GAAO,EAAzE,EAAE,GAAuE,CACxF;EACE,CAAA,GANoB,OAW5B,kBAAC,GAAD;EACE,YAAY,eAAe;EACjB;EACG;EACb,MAAM;EACN,OAAO;EACP,UAAU;EACC;EACX,CAAA"}
1
+ {"version":3,"file":"HBEntityTags.js","names":[],"sources":["../../../src/healthybowl/components/HBEntityTags.tsx"],"sourcesContent":["import { useCallback, useRef, useState, type FC } from 'react';\nimport { gql } from '@apollo/client';\nimport { useApolloClient } from '@apollo/client/react';\nimport { TagBadge, TagsWidget, type TagItem } from '@burdenoff/fe-libs/tag';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\nimport { cn } from '../utils/helpers';\n\n/**\n * Reuse-first tags. HealthyBowl owns the tag *set* (persisted on each entity's\n * `tagsV2` via `setHealthyBowlEntityTags`); the shared fe-libs `TagsWidget`\n * supplies the search/create/vocabulary UX and the wspace-tags-svc + AGE graph\n * sync. We never stand up a parallel tag store. See PLATFORM_REUSE_AUDIT §1.\n *\n * Controlled like the fe-libs example: local state drives the badges, each\n * change is persisted, and a page reload re-hydrates from the entity's own\n * `entityTags`. The mutation isn't in the offline-pulled schema as a typed hook\n * everywhere it's used, so we send a raw gql document (a later schema:pull +\n * codegen can swap in the generated hook).\n */\nconst SET_ENTITY_TAGS = gql`\n mutation SetHBEntityTags($input: SetHealthyBowlEntityTagsInput!) {\n setHealthyBowlEntityTags(input: $input) {\n id\n key\n label\n color\n vocabularyKey\n }\n }\n`;\n\nexport type HBTaggableType = 'CROP' | 'MARKETPLACE_PRODUCT' | 'COMMUNITY_POST' | 'SUPPLIER';\n\n/** Minimal tag shape accepted from a query's `entityTags` (a superset of this is fine). */\nexport interface HBTagLike {\n id: string;\n key: string;\n label: string;\n color?: string | null;\n vocabularyKey?: string | null;\n}\n\ninterface HBEntityTagsProps {\n entityType: HBTaggableType;\n entityId: string;\n tags: readonly HBTagLike[];\n /** Render read-only badges (no add/remove) — for cards/lists where editing is out of place. */\n readOnly?: boolean;\n className?: string;\n}\n\nfunction toTagItem(t: HBTagLike): TagItem {\n return { id: t.id, key: t.key, label: t.label, color: t.color ?? null, vocabularyKey: t.vocabularyKey ?? null };\n}\n\nexport const HBEntityTags: FC<HBEntityTagsProps> = ({ entityType, entityId, tags, readOnly, className }) => {\n const client = useApolloClient();\n const { workspaceId } = useHealthyBowl();\n const [current, setCurrent] = useState<TagItem[]>(() => tags.map(toTagItem));\n\n // Re-sync from props when the entity's persisted tags change (parent refetch,\n // navigation, another editor). Keyed on the tag-id set so a fresh array reference\n // on every render doesn't loop. `currentRef` mirrors the set so the add/remove\n // handlers read the latest value without a stale closure on rapid successive edits.\n const currentRef = useRef(current);\n const tagsKey = tags.map((t) => t.id).join('|');\n const syncedKey = useRef(tagsKey);\n if (tagsKey !== syncedKey.current) {\n syncedKey.current = tagsKey;\n const synced = tags.map(toTagItem);\n currentRef.current = synced;\n setCurrent(synced);\n }\n\n const apply = useCallback(\n async (next: TagItem[]) => {\n const prev = currentRef.current;\n currentRef.current = next;\n setCurrent(next); // optimistic\n try {\n await client.mutate({\n mutation: SET_ENTITY_TAGS,\n variables: {\n input: {\n entityType,\n entityId,\n tags: next.map((t) => ({\n id: t.id,\n key: t.key,\n label: t.label,\n color: t.color ?? null,\n vocabularyKey: t.vocabularyKey ?? t.vocabulary?.key ?? null,\n })),\n context: { workspaceId },\n },\n },\n });\n } catch {\n // Persist failed — revert so the UI never shows tags that aren't actually\n // saved. The badge reverting is the user-visible signal the change didn't stick.\n currentRef.current = prev;\n setCurrent(prev);\n }\n },\n [client, entityType, entityId, workspaceId]\n );\n\n const handleAdd = useCallback((tag: TagItem) => void apply([...currentRef.current, tag]), [apply]);\n const handleRemove = useCallback(\n (tagId: string) => void apply(currentRef.current.filter((t) => t.id !== tagId)),\n [apply]\n );\n\n if (readOnly) {\n if (!current.length) return null;\n return (\n <div className={cn('flex flex-wrap items-center gap-1.5', className)}>\n {current.map((t) => (\n <TagBadge key={t.id} id={t.id} label={t.label} color={t.color ?? undefined} size=\"sm\" />\n ))}\n </div>\n );\n }\n\n return (\n <TagsWidget\n entityType={`HEALTHYBOWL_${entityType}`}\n entityId={entityId}\n workspaceId={workspaceId}\n tags={current}\n onAdd={handleAdd}\n onRemove={handleRemove}\n className={className}\n />\n );\n};\n"],"mappings":";;;;;;;;AAmBA,IAAM,IAAkB,CAAG;;;;;;;;;;;AAgC3B,SAAS,EAAU,GAAuB;AACxC,QAAO;EAAE,IAAI,EAAE;EAAI,KAAK,EAAE;EAAK,OAAO,EAAE;EAAO,OAAO,EAAE,SAAS;EAAM,eAAe,EAAE,iBAAiB;EAAM;;AAGjH,IAAa,KAAuC,EAAE,eAAY,aAAU,SAAM,aAAU,mBAAgB;CAC1G,IAAM,IAAS,GAAiB,EAC1B,EAAE,mBAAgB,GAAgB,EAClC,CAAC,GAAS,KAAc,QAA0B,EAAK,IAAI,EAAU,CAAC,EAMtE,IAAa,EAAO,EAAQ,EAC5B,IAAU,EAAK,KAAK,MAAM,EAAE,GAAG,CAAC,KAAK,IAAI,EACzC,IAAY,EAAO,EAAQ;AACjC,KAAI,MAAY,EAAU,SAAS;AACjC,IAAU,UAAU;EACpB,IAAM,IAAS,EAAK,IAAI,EAAU;AAElC,EADA,EAAW,UAAU,GACrB,EAAW,EAAO;;CAGpB,IAAM,IAAQ,EACZ,OAAO,MAAoB;EACzB,IAAM,IAAO,EAAW;AAExB,EADA,EAAW,UAAU,GACrB,EAAW,EAAK;AAChB,MAAI;AACF,SAAM,EAAO,OAAO;IAClB,UAAU;IACV,WAAW,EACT,OAAO;KACL;KACA;KACA,MAAM,EAAK,KAAK,OAAO;MACrB,IAAI,EAAE;MACN,KAAK,EAAE;MACP,OAAO,EAAE;MACT,OAAO,EAAE,SAAS;MAClB,eAAe,EAAE,iBAAiB,EAAE,YAAY,OAAO;MACxD,EAAE;KACH,SAAS,EAAE,gBAAa;KACzB,EACF;IACF,CAAC;UACI;AAIN,GADA,EAAW,UAAU,GACrB,EAAW,EAAK;;IAGpB;EAAC;EAAQ;EAAY;EAAU;EAAY,CAC5C,EAEK,IAAY,GAAa,MAAiB,KAAK,EAAM,CAAC,GAAG,EAAW,SAAS,EAAI,CAAC,EAAE,CAAC,EAAM,CAAC,EAC5F,IAAe,GAClB,MAAkB,KAAK,EAAM,EAAW,QAAQ,QAAQ,MAAM,EAAE,OAAO,EAAM,CAAC,EAC/E,CAAC,EAAM,CACR;AAaD,QAXI,IACG,EAAQ,SAEX,kBAAC,OAAD;EAAK,WAAW,EAAG,uCAAuC,EAAU;YACjE,EAAQ,KAAK,MACZ,kBAAC,GAAD;GAAqB,IAAI,EAAE;GAAI,OAAO,EAAE;GAAO,OAAO,EAAE,SAAS,KAAA;GAAW,MAAK;GAAO,EAAzE,EAAE,GAAuE,CACxF;EACE,CAAA,GANoB,OAW5B,kBAAC,GAAD;EACE,YAAY,eAAe;EACjB;EACG;EACb,MAAM;EACN,OAAO;EACP,UAAU;EACC;EACX,CAAA"}
@@ -3,7 +3,7 @@ import { useCallback as t } from "react";
3
3
  import { gql as n } from "@apollo/client";
4
4
  import { useMutation as r, useQuery as i } from "@apollo/client/react";
5
5
  //#region src/healthybowl/hooks/useSuppliers.ts
6
- var a = "\n id\n name\n contactPerson\n type\n location\n email\n phone\n address\n certification\n notes\n comProfileId\n", o = n`
6
+ var a = "\n id\n name\n contactPerson\n type\n location\n email\n phone\n address\n certification\n notes\n entityTags {\n id\n key\n label\n color\n vocabularyKey\n }\n comProfileId\n", o = n`
7
7
  query HealthyBowlSuppliers($context: ContextInput!) {
8
8
  healthyBowlSuppliers(context: $context) {
9
9
  ${a}
@@ -1 +1 @@
1
- {"version":3,"file":"useSuppliers.js","names":[],"sources":["../../../src/healthybowl/hooks/useSuppliers.ts"],"sourcesContent":["/**\n * Suppliers data hook (Nursery / Seed provenance + Suppliers, roadmap #5).\n *\n * The offline codegen doesn't type the Supplier operations, so — mirroring the\n * raw-gql pattern used for the Master Plant List (`usePlantCatalog`) and the\n * Field-Map Bed/MapFeature ops — these are hand-written `gql` documents executed\n * directly against the live gateway. Every op carries the workspace `context`.\n * @module healthybowl\n */\nimport { useCallback } from 'react';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\n/** A supplier of seeds, seedlings, fertilizer, or equipment. */\nexport interface Supplier {\n id: string;\n name: string;\n contactPerson?: string | null;\n /** Free-form supplier type, e.g. Seed / Seedling / Fertilizer / Equipment. */\n type?: string | null;\n location?: string | null;\n email?: string | null;\n phone?: string | null;\n address?: string | null;\n /** Certification held by the supplier, e.g. \"NPOP Certified\". */\n certification?: string | null;\n notes?: string | null;\n /** Optional link to a ComradeCircle ComProfile (loose reference, no FK). */\n comProfileId?: string | null;\n}\n\n/** Editable fields for create/update (context is attached from the hook). */\nexport interface SupplierInput {\n name: string;\n contactPerson?: string | null;\n type?: string | null;\n location?: string | null;\n email?: string | null;\n phone?: string | null;\n address?: string | null;\n certification?: string | null;\n notes?: string | null;\n comProfileId?: string | null;\n}\n\n/** A single supplier row for bulk CSV import (no context; supplied on the parent op). */\nexport interface ImportSupplierRow {\n name: string;\n contactPerson?: string | null;\n type?: string | null;\n location?: string | null;\n email?: string | null;\n phone?: string | null;\n address?: string | null;\n certification?: string | null;\n notes?: string | null;\n comProfileId?: string | null;\n}\n\nconst SUPPLIER_FIELDS = `\n id\n name\n contactPerson\n type\n location\n email\n phone\n address\n certification\n notes\n comProfileId\n`;\n\nconst SUPPLIERS_QUERY = gql`\n query HealthyBowlSuppliers($context: ContextInput!) {\n healthyBowlSuppliers(context: $context) {\n ${SUPPLIER_FIELDS}\n }\n }\n`;\n\nconst CREATE_SUPPLIER = gql`\n mutation CreateHealthyBowlSupplier($input: CreateHealthyBowlSupplierInput!) {\n createHealthyBowlSupplier(input: $input) {\n ${SUPPLIER_FIELDS}\n }\n }\n`;\n\nconst UPDATE_SUPPLIER = gql`\n mutation UpdateHealthyBowlSupplier($input: UpdateHealthyBowlSupplierInput!) {\n updateHealthyBowlSupplier(input: $input) {\n ${SUPPLIER_FIELDS}\n }\n }\n`;\n\nconst DELETE_SUPPLIER = gql`\n mutation DeleteHealthyBowlSupplier($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlSupplier(id: $id, context: $context)\n }\n`;\n\nconst IMPORT_SUPPLIERS = gql`\n mutation ImportHealthyBowlSuppliers($rows: [ImportHealthyBowlSupplierRow!]!, $context: ContextInput!) {\n importHealthyBowlSuppliers(rows: $rows, context: $context) {\n ${SUPPLIER_FIELDS}\n }\n }\n`;\n\ninterface SuppliersQueryData {\n healthyBowlSuppliers: Supplier[];\n}\n\n/**\n * Loads the supplier list for the active workspace and exposes create / update /\n * delete / bulk-import helpers. Mutations refetch the list so the caller's view\n * stays in sync without hand-managing the cache.\n */\nexport function useSuppliers() {\n const { workspaceId } = useHealthyBowl();\n const context = { workspaceId };\n\n const { data, loading, error, refetch } = useQuery<SuppliersQueryData>(SUPPLIERS_QUERY, {\n variables: { context },\n skip: !workspaceId,\n fetchPolicy: 'cache-and-network',\n notifyOnNetworkStatusChange: true,\n });\n\n const [createMutation] = useMutation(CREATE_SUPPLIER);\n const [updateMutation] = useMutation(UPDATE_SUPPLIER);\n const [deleteMutation] = useMutation(DELETE_SUPPLIER);\n const [importMutation] = useMutation(IMPORT_SUPPLIERS);\n\n const createSupplier = useCallback(\n async (input: SupplierInput) => {\n await createMutation({ variables: { input: { ...input, context } } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [createMutation, refetch, workspaceId]\n );\n\n const updateSupplier = useCallback(\n async (id: string, input: SupplierInput) => {\n await updateMutation({ variables: { input: { id, ...input, context } } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [updateMutation, refetch, workspaceId]\n );\n\n const deleteSupplier = useCallback(\n async (id: string) => {\n await deleteMutation({ variables: { id, context } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [deleteMutation, refetch, workspaceId]\n );\n\n const importSuppliers = useCallback(\n async (rows: ImportSupplierRow[]) => {\n await importMutation({ variables: { rows, context } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [importMutation, refetch, workspaceId]\n );\n\n return {\n suppliers: data?.healthyBowlSuppliers ?? [],\n loading,\n error,\n refetch,\n createSupplier,\n updateSupplier,\n deleteSupplier,\n importSuppliers,\n };\n}\n"],"mappings":";;;;;AA4DA,IAAM,IAAkB,gIAclB,IAAkB,CAAG;;;QAGnB,EAAgB;;;GAKlB,IAAkB,CAAG;;;QAGnB,EAAgB;;;GAKlB,IAAkB,CAAG;;;QAGnB,EAAgB;;;GAKlB,IAAkB,CAAG;;;;GAMrB,IAAmB,CAAG;;;QAGpB,EAAgB;;;;AAcxB,SAAgB,IAAe;CAC7B,IAAM,EAAE,mBAAgB,GAAgB,EAClC,IAAU,EAAE,gBAAa,EAEzB,EAAE,SAAM,YAAS,UAAO,eAAY,EAA6B,GAAiB;EACtF,WAAW,EAAE,YAAS;EACtB,MAAM,CAAC;EACP,aAAa;EACb,6BAA6B;EAC9B,CAAC,EAEI,CAAC,KAAkB,EAAY,EAAgB,EAC/C,CAAC,KAAkB,EAAY,EAAgB,EAC/C,CAAC,KAAkB,EAAY,EAAgB,EAC/C,CAAC,KAAkB,EAAY,EAAiB,EAEhD,IAAiB,EACrB,OAAO,MAAyB;AAE9B,EADA,MAAM,EAAe,EAAE,WAAW,EAAE,OAAO;GAAE,GAAG;GAAO;GAAS,EAAE,EAAE,CAAC,EACrE,MAAM,GAAS;IAGjB;EAAC;EAAgB;EAAS;EAAY,CACvC,EAEK,IAAiB,EACrB,OAAO,GAAY,MAAyB;AAE1C,EADA,MAAM,EAAe,EAAE,WAAW,EAAE,OAAO;GAAE;GAAI,GAAG;GAAO;GAAS,EAAE,EAAE,CAAC,EACzE,MAAM,GAAS;IAGjB;EAAC;EAAgB;EAAS;EAAY,CACvC,EAEK,IAAiB,EACrB,OAAO,MAAe;AAEpB,EADA,MAAM,EAAe,EAAE,WAAW;GAAE;GAAI;GAAS,EAAE,CAAC,EACpD,MAAM,GAAS;IAGjB;EAAC;EAAgB;EAAS;EAAY,CACvC,EAEK,IAAkB,EACtB,OAAO,MAA8B;AAEnC,EADA,MAAM,EAAe,EAAE,WAAW;GAAE;GAAM;GAAS,EAAE,CAAC,EACtD,MAAM,GAAS;IAGjB;EAAC;EAAgB;EAAS;EAAY,CACvC;AAED,QAAO;EACL,WAAW,GAAM,wBAAwB,EAAE;EAC3C;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
1
+ {"version":3,"file":"useSuppliers.js","names":[],"sources":["../../../src/healthybowl/hooks/useSuppliers.ts"],"sourcesContent":["/**\n * Suppliers data hook (Nursery / Seed provenance + Suppliers, roadmap #5).\n *\n * The offline codegen doesn't type the Supplier operations, so — mirroring the\n * raw-gql pattern used for the Master Plant List (`usePlantCatalog`) and the\n * Field-Map Bed/MapFeature ops — these are hand-written `gql` documents executed\n * directly against the live gateway. Every op carries the workspace `context`.\n * @module healthybowl\n */\nimport { useCallback } from 'react';\nimport type { HBTagLike } from '../components/HBEntityTags';\nimport { gql } from '@apollo/client';\nimport { useMutation, useQuery } from '@apollo/client/react';\nimport { useHealthyBowl } from '../context/HealthyBowlContext';\n\n/** A supplier of seeds, seedlings, fertilizer, or equipment. */\nexport interface Supplier {\n id: string;\n name: string;\n contactPerson?: string | null;\n /** Free-form supplier type, e.g. Seed / Seedling / Fertilizer / Equipment. */\n type?: string | null;\n location?: string | null;\n email?: string | null;\n phone?: string | null;\n address?: string | null;\n /** Certification held by the supplier, e.g. \"NPOP Certified\". */\n certification?: string | null;\n notes?: string | null;\n /** Universal entity-owned tags, the same set Crop and MarketplaceProduct carry. */\n entityTags?: HBTagLike[] | null;\n /** Optional link to a ComradeCircle ComProfile (loose reference, no FK). */\n comProfileId?: string | null;\n}\n\n/** Editable fields for create/update (context is attached from the hook). */\nexport interface SupplierInput {\n name: string;\n contactPerson?: string | null;\n type?: string | null;\n location?: string | null;\n email?: string | null;\n phone?: string | null;\n address?: string | null;\n certification?: string | null;\n notes?: string | null;\n comProfileId?: string | null;\n}\n\n/** A single supplier row for bulk CSV import (no context; supplied on the parent op). */\nexport interface ImportSupplierRow {\n name: string;\n contactPerson?: string | null;\n type?: string | null;\n location?: string | null;\n email?: string | null;\n phone?: string | null;\n address?: string | null;\n certification?: string | null;\n notes?: string | null;\n comProfileId?: string | null;\n}\n\nconst SUPPLIER_FIELDS = `\n id\n name\n contactPerson\n type\n location\n email\n phone\n address\n certification\n notes\n entityTags {\n id\n key\n label\n color\n vocabularyKey\n }\n comProfileId\n`;\n\nconst SUPPLIERS_QUERY = gql`\n query HealthyBowlSuppliers($context: ContextInput!) {\n healthyBowlSuppliers(context: $context) {\n ${SUPPLIER_FIELDS}\n }\n }\n`;\n\nconst CREATE_SUPPLIER = gql`\n mutation CreateHealthyBowlSupplier($input: CreateHealthyBowlSupplierInput!) {\n createHealthyBowlSupplier(input: $input) {\n ${SUPPLIER_FIELDS}\n }\n }\n`;\n\nconst UPDATE_SUPPLIER = gql`\n mutation UpdateHealthyBowlSupplier($input: UpdateHealthyBowlSupplierInput!) {\n updateHealthyBowlSupplier(input: $input) {\n ${SUPPLIER_FIELDS}\n }\n }\n`;\n\nconst DELETE_SUPPLIER = gql`\n mutation DeleteHealthyBowlSupplier($id: ID!, $context: ContextInput!) {\n deleteHealthyBowlSupplier(id: $id, context: $context)\n }\n`;\n\nconst IMPORT_SUPPLIERS = gql`\n mutation ImportHealthyBowlSuppliers($rows: [ImportHealthyBowlSupplierRow!]!, $context: ContextInput!) {\n importHealthyBowlSuppliers(rows: $rows, context: $context) {\n ${SUPPLIER_FIELDS}\n }\n }\n`;\n\ninterface SuppliersQueryData {\n healthyBowlSuppliers: Supplier[];\n}\n\n/**\n * Loads the supplier list for the active workspace and exposes create / update /\n * delete / bulk-import helpers. Mutations refetch the list so the caller's view\n * stays in sync without hand-managing the cache.\n */\nexport function useSuppliers() {\n const { workspaceId } = useHealthyBowl();\n const context = { workspaceId };\n\n const { data, loading, error, refetch } = useQuery<SuppliersQueryData>(SUPPLIERS_QUERY, {\n variables: { context },\n skip: !workspaceId,\n fetchPolicy: 'cache-and-network',\n notifyOnNetworkStatusChange: true,\n });\n\n const [createMutation] = useMutation(CREATE_SUPPLIER);\n const [updateMutation] = useMutation(UPDATE_SUPPLIER);\n const [deleteMutation] = useMutation(DELETE_SUPPLIER);\n const [importMutation] = useMutation(IMPORT_SUPPLIERS);\n\n const createSupplier = useCallback(\n async (input: SupplierInput) => {\n await createMutation({ variables: { input: { ...input, context } } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [createMutation, refetch, workspaceId]\n );\n\n const updateSupplier = useCallback(\n async (id: string, input: SupplierInput) => {\n await updateMutation({ variables: { input: { id, ...input, context } } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [updateMutation, refetch, workspaceId]\n );\n\n const deleteSupplier = useCallback(\n async (id: string) => {\n await deleteMutation({ variables: { id, context } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [deleteMutation, refetch, workspaceId]\n );\n\n const importSuppliers = useCallback(\n async (rows: ImportSupplierRow[]) => {\n await importMutation({ variables: { rows, context } });\n await refetch();\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [importMutation, refetch, workspaceId]\n );\n\n return {\n suppliers: data?.healthyBowlSuppliers ?? [],\n loading,\n error,\n refetch,\n createSupplier,\n updateSupplier,\n deleteSupplier,\n importSuppliers,\n };\n}\n"],"mappings":";;;;;AA+DA,IAAM,IAAkB,+MAqBlB,IAAkB,CAAG;;;QAGnB,EAAgB;;;GAKlB,IAAkB,CAAG;;;QAGnB,EAAgB;;;GAKlB,IAAkB,CAAG;;;QAGnB,EAAgB;;;GAKlB,IAAkB,CAAG;;;;GAMrB,IAAmB,CAAG;;;QAGpB,EAAgB;;;;AAcxB,SAAgB,IAAe;CAC7B,IAAM,EAAE,mBAAgB,GAAgB,EAClC,IAAU,EAAE,gBAAa,EAEzB,EAAE,SAAM,YAAS,UAAO,eAAY,EAA6B,GAAiB;EACtF,WAAW,EAAE,YAAS;EACtB,MAAM,CAAC;EACP,aAAa;EACb,6BAA6B;EAC9B,CAAC,EAEI,CAAC,KAAkB,EAAY,EAAgB,EAC/C,CAAC,KAAkB,EAAY,EAAgB,EAC/C,CAAC,KAAkB,EAAY,EAAgB,EAC/C,CAAC,KAAkB,EAAY,EAAiB,EAEhD,IAAiB,EACrB,OAAO,MAAyB;AAE9B,EADA,MAAM,EAAe,EAAE,WAAW,EAAE,OAAO;GAAE,GAAG;GAAO;GAAS,EAAE,EAAE,CAAC,EACrE,MAAM,GAAS;IAGjB;EAAC;EAAgB;EAAS;EAAY,CACvC,EAEK,IAAiB,EACrB,OAAO,GAAY,MAAyB;AAE1C,EADA,MAAM,EAAe,EAAE,WAAW,EAAE,OAAO;GAAE;GAAI,GAAG;GAAO;GAAS,EAAE,EAAE,CAAC,EACzE,MAAM,GAAS;IAGjB;EAAC;EAAgB;EAAS;EAAY,CACvC,EAEK,IAAiB,EACrB,OAAO,MAAe;AAEpB,EADA,MAAM,EAAe,EAAE,WAAW;GAAE;GAAI;GAAS,EAAE,CAAC,EACpD,MAAM,GAAS;IAGjB;EAAC;EAAgB;EAAS;EAAY,CACvC,EAEK,IAAkB,EACtB,OAAO,MAA8B;AAEnC,EADA,MAAM,EAAe,EAAE,WAAW;GAAE;GAAM;GAAS,EAAE,CAAC,EACtD,MAAM,GAAS;IAGjB;EAAC;EAAgB;EAAS;EAAY,CACvC;AAED,QAAO;EACL,WAAW,GAAM,wBAAwB,EAAE;EAC3C;EACA;EACA;EACA;EACA;EACA;EACA;EACD"}
@@ -12,9 +12,9 @@ import { useHealthyBowlData as ee } from "../../hooks/useHealthyBowlData.js";
12
12
  import { LivestockGrowthCard as u } from "./LivestockGrowthCard.js";
13
13
  import { LivestockFeedCard as d } from "./LivestockFeedCard.js";
14
14
  import { HerdStatsCard as f } from "./HerdStatsCard.js";
15
- import { FertilityCard as te } from "./FertilityCard.js";
16
- import { useI18n as p } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
17
- import { AlertCircle as m, ArrowRight as h, Baby as ne, Calendar as g, ChevronRight as _, Clock as v, DollarSign as y, Egg as b, Heart as x, LineChart as S, Milk as C, Package as re, PawPrint as ie, Plus as w, TrendingUp as T, Users as E } from "lucide-react";
15
+ import { FertilityCard as p } from "./FertilityCard.js";
16
+ import { useI18n as m } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
17
+ import { AlertCircle as h, ArrowRight as te, Baby as g, Calendar as _, ChevronRight as ne, Clock as v, DollarSign as y, Egg as b, Heart as x, LineChart as S, Milk as C, Package as re, PawPrint as ie, Plus as w, TrendingUp as T, Users as E } from "lucide-react";
18
18
  import { useNavigate as D } from "react-router";
19
19
  import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
20
20
  import { Button as j } from "@burdenoff/fe-libs/ui";
@@ -36,7 +36,7 @@ var M = (e) => {
36
36
  meat: 350,
37
37
  manure: 5
38
38
  }, P = () => {
39
- let { animals: P, healthRecords: F, vaccinations: I, productionRecords: L, feedRecords: R, recordsForRemovedAnimals: z, loading: B, errors: V } = ee(), H = D(), { buildPath: U } = n(), { t: W } = p(), G = P.length, K = P.filter((e) => e.healthStatus === "healthy").length, q = P.filter((e) => e.healthStatus === "sick").length, J = P.filter((e) => e.healthStatus === "under_treatment").length, Y = P.filter((e) => e.healthStatus === "quarantine").length, ae = P.filter((e) => e.healthStatus === "pregnant").length, oe = P.reduce((e, t) => (e[t.type] = (e[t.type] || 0) + 1, e), {}), se = L.filter((e) => e.type === "milk").reduce((e, t) => e + t.quantity, 0), ce = L.filter((e) => e.type === "eggs").reduce((e, t) => e + t.quantity, 0), X = L.reduce((e, t) => e + t.quantity * (N[t.type] ?? 0), 0), Z = R.reduce((e, t) => e + t.cost, 0), le = X > 0 ? ((X - Z) / X * 100).toFixed(1) : "0.0", Q = F.filter((e) => e.status === "active" || e.status === "monitoring").slice(0, 3), $ = I.filter((e) => e.status === "scheduled").slice(0, 3);
39
+ let { animals: P, healthRecords: F, vaccinations: I, productionRecords: L, feedRecords: R, recordsForRemovedAnimals: z, loading: B, errors: V } = ee(), H = D(), { buildPath: U } = n(), { t: W } = m(), G = P.length, K = P.filter((e) => e.healthStatus === "healthy").length, q = P.filter((e) => e.healthStatus === "sick").length, J = P.filter((e) => e.healthStatus === "under_treatment").length, Y = P.filter((e) => e.healthStatus === "quarantine").length, ae = P.filter((e) => e.healthStatus === "pregnant").length, oe = P.reduce((e, t) => (e[t.type] = (e[t.type] || 0) + 1, e), {}), se = L.filter((e) => e.type === "milk").reduce((e, t) => e + t.quantity, 0), ce = L.filter((e) => e.type === "eggs").reduce((e, t) => e + t.quantity, 0), X = L.reduce((e, t) => e + t.quantity * (N[t.type] ?? 0), 0), Z = R.reduce((e, t) => e + t.cost, 0), le = X > 0 ? ((X - Z) / X * 100).toFixed(1) : "0.0", Q = F.filter((e) => e.status === "active" || e.status === "monitoring").slice(0, 3), $ = I.filter((e) => e.status === "scheduled").slice(0, 3);
40
40
  return /* @__PURE__ */ k(r, {
41
41
  title: W("healthybowl.livestock.dashboard.title", "Livestock Management"),
42
42
  description: W("healthybowl.livestock.dashboard.description", "Monitor and manage your livestock operations"),
@@ -109,7 +109,7 @@ var M = (e) => {
109
109
  z > 0 && /* @__PURE__ */ A("div", {
110
110
  role: "status",
111
111
  className: "flex items-start gap-3 rounded-lg border border-status-info-border bg-status-info-bg px-4 py-3 text-sm text-status-info-text",
112
- children: [/* @__PURE__ */ k(m, { className: "mt-0.5 h-4 w-4 shrink-0" }), /* @__PURE__ */ k("span", { children: W("healthybowl.livestock.dashboard.removedAnimals", "{{count}} health, vaccination, breeding, feed and production records belong to animals you removed from the herd. They are kept, but they are not counted above.", { count: z }) })]
112
+ children: [/* @__PURE__ */ k(h, { className: "mt-0.5 h-4 w-4 shrink-0" }), /* @__PURE__ */ k("span", { children: z === 1 ? W("healthybowl.livestock.dashboard.removedAnimalsOne", "One health, vaccination, breeding, feed or production record belongs to an animal you removed from the herd. It is kept, but it is not counted above.") : W("healthybowl.livestock.dashboard.removedAnimals", "{{count}} health, vaccination, breeding, feed and production records belong to animals you removed from the herd. They are kept, but they are not counted above.", { count: z }) })]
113
113
  }),
114
114
  /* @__PURE__ */ A("div", {
115
115
  className: "grid grid-cols-1 gap-6 lg:grid-cols-2",
@@ -164,7 +164,7 @@ var M = (e) => {
164
164
  children: [
165
165
  W("healthybowl.livestock.dashboard.distribution.viewAll", "View All Animals"),
166
166
  " ",
167
- /* @__PURE__ */ k(h, { className: "h-4 w-4" })
167
+ /* @__PURE__ */ k(te, { className: "h-4 w-4" })
168
168
  ]
169
169
  })
170
170
  })]
@@ -241,7 +241,7 @@ var M = (e) => {
241
241
  /* @__PURE__ */ k(u, {}),
242
242
  /* @__PURE__ */ k(d, {}),
243
243
  /* @__PURE__ */ k(f, {}),
244
- /* @__PURE__ */ k(te, {}),
244
+ /* @__PURE__ */ k(p, {}),
245
245
  /* @__PURE__ */ A("div", {
246
246
  className: "grid grid-cols-1 gap-6 lg:grid-cols-3",
247
247
  children: [/* @__PURE__ */ A("div", {
@@ -278,7 +278,7 @@ var M = (e) => {
278
278
  label: W("healthybowl.livestock.dashboard.healthStatus.sick", "Sick"),
279
279
  value: q,
280
280
  variant: "error",
281
- icon: m
281
+ icon: h
282
282
  },
283
283
  {
284
284
  id: "treatment",
@@ -292,14 +292,14 @@ var M = (e) => {
292
292
  label: W("healthybowl.livestock.dashboard.healthStatus.quarantine", "Quarantine"),
293
293
  value: Y,
294
294
  variant: "error",
295
- icon: m
295
+ icon: h
296
296
  },
297
297
  {
298
298
  id: "pregnant",
299
299
  label: W("healthybowl.livestock.dashboard.healthStatus.pregnant", "Pregnant"),
300
300
  value: ae,
301
301
  variant: "info",
302
- icon: ne
302
+ icon: g
303
303
  }
304
304
  ].map((e) => /* @__PURE__ */ A("div", {
305
305
  className: "rounded-lg bg-bg-sunken/50 p-3 text-center",
@@ -338,7 +338,7 @@ var M = (e) => {
338
338
  className: "text-xs text-text-secondary",
339
339
  children: e.diagnosis
340
340
  })] })]
341
- }), /* @__PURE__ */ k(_, { className: "h-4 w-4 text-text-secondary" })]
341
+ }), /* @__PURE__ */ k(ne, { className: "h-4 w-4 text-text-secondary" })]
342
342
  }, e.id))
343
343
  })]
344
344
  })
@@ -366,7 +366,7 @@ var M = (e) => {
366
366
  {
367
367
  id: "vaccination",
368
368
  label: W("healthybowl.livestock.dashboard.quickActions.scheduleVaccination", "Schedule Vaccination"),
369
- icon: g,
369
+ icon: _,
370
370
  path: U("livestock/vaccinations")
371
371
  },
372
372
  {
@@ -420,7 +420,7 @@ var M = (e) => {
420
420
  className: "flex items-center justify-between rounded-md border border-border-subtle p-3 hover:bg-bg-sunken/30",
421
421
  children: [/* @__PURE__ */ A("div", {
422
422
  className: "flex items-center gap-3",
423
- children: [/* @__PURE__ */ k(g, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("p", {
423
+ children: [/* @__PURE__ */ k(_, { className: "h-4 w-4 text-text-secondary" }), /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("p", {
424
424
  className: "text-sm font-medium text-text-primary",
425
425
  children: e.animalName
426
426
  }), /* @__PURE__ */ k("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 LineChart,\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 { LivestockFeedCard } from './LivestockFeedCard';\nimport { HerdStatsCard } from './HerdStatsCard';\nimport { FertilityCard } from './FertilityCard';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { formatDate, formatCurrency, HB_DEFAULT_CURRENCY } 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 {\n animals,\n healthRecords,\n vaccinations,\n productionRecords,\n feedRecords,\n recordsForRemovedAnimals,\n loading,\n 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 <div className=\"flex items-center gap-2\">\n <Button variant=\"outline\" onClick={() => navigate(buildPath('livestock/analytics'))}>\n <LineChart className=\"h-4 w-4\" />\n {t('healthybowl.livestock.dashboard.actions.analytics', 'View Analytics')}\n </Button>\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 </div>\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, HB_DEFAULT_CURRENCY)}\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 {/*\n Every list on this page is scoped to animals still in the herd, so removing\n an animal quietly takes its records out of these totals too. Without this\n line the farmer sees the numbers fall and has nothing to attribute it to —\n which reads as lost data rather than as the removal they performed.\n Only rendered when there is something to explain; a \"0 records\" line would\n be noise on every farm that has never deleted an animal.\n */}\n {recordsForRemovedAnimals > 0 && (\n <div\n role=\"status\"\n className=\"flex items-start gap-3 rounded-lg border border-status-info-border bg-status-info-bg px-4 py-3 text-sm text-status-info-text\"\n >\n <AlertCircle className=\"mt-0.5 h-4 w-4 shrink-0\" />\n <span>\n {t(\n 'healthybowl.livestock.dashboard.removedAnimals',\n '{{count}} health, vaccination, breeding, feed and production records belong to animals you removed from the herd. They are kept, but they are not counted above.',\n { count: recordsForRemovedAnimals }\n )}\n </span>\n </div>\n )}\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-end\">\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-end\">\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 {/* Feed (BOFF-5971) — spend over time + what a kilo of gain costs */}\n <LivestockFeedCard />\n\n {/* Herd statistics (BOFF-5971, slice 3) — composition, turnover, production per head.\n Sits after growth and feed because it describes the herd those two measure. */}\n <HerdStatsCard />\n\n {/* Fertility (BOFF-6008, slice 4) — is the herd actually breeding? Last of the four\n because it is the only one that also looks forward (who is due), so it reads as the\n hand-off from \"what happened\" to \"what to do this week\". */}\n <FertilityCard />\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-end\">\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\">\n {formatCurrency(monthlyRevenue, HB_DEFAULT_CURRENCY)}\n </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\">\n {formatCurrency(monthlyExpenses, HB_DEFAULT_CURRENCY)}\n </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, HB_DEFAULT_CURRENCY)}\n </p>\n </div>\n </div>\n </div>\n </>\n )}\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,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,EACJ,YACA,kBACA,iBACA,sBACA,gBACA,6BACA,YACA,cACE,IAAoB,EAElB,IAAW,GAAa,EACxB,EAAE,iBAAc,GAAa,EAC7B,EAAE,SAAM,GAAS,EAEjB,IAAe,EAAQ,QACvB,IAAU,EAAQ,QAAQ,MAAM,EAAE,iBAAiB,UAAU,CAAC,QAC9D,IAAO,EAAQ,QAAQ,MAAM,EAAE,iBAAiB,OAAO,CAAC,QACxD,IAAiB,EAAQ,QAAQ,MAAM,EAAE,iBAAiB,kBAAkB,CAAC,QAC7E,IAAa,EAAQ,QAAQ,MAAM,EAAE,iBAAiB,aAAa,CAAC,QACpE,KAAW,EAAQ,QAAQ,MAAM,EAAE,iBAAiB,WAAW,CAAC,QAEhE,KAAa,EAAQ,QAAgC,GAAK,OAC9D,EAAI,EAAE,SAAS,EAAI,EAAE,SAAS,KAAK,GAC5B,IACN,EAAE,CAAC,EAGA,KAAiB,EAAkB,QAAQ,MAAM,EAAE,SAAS,OAAO,CAAC,QAAQ,GAAK,MAAM,IAAM,EAAE,UAAU,EAAE,EAC3G,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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;mBACV,EAAe,GAAA,MAAoC;SAClD,CAAA,CACA;;OACN,kBAAC,OAAD;QAAK,WAAU;kBAAf,CACE,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAE,uDAAuD,YAAY;SACpE,CAAA,EACJ,kBAAC,KAAD;SAAG,WAAU;mBACV,EAAe,GAAA,MAAqC;SACnD,CAAA,CACA;;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,GAAA,MAAqC;SACpE,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 LineChart,\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 { LivestockFeedCard } from './LivestockFeedCard';\nimport { HerdStatsCard } from './HerdStatsCard';\nimport { FertilityCard } from './FertilityCard';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { formatDate, formatCurrency, HB_DEFAULT_CURRENCY } 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 {\n animals,\n healthRecords,\n vaccinations,\n productionRecords,\n feedRecords,\n recordsForRemovedAnimals,\n loading,\n 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 <div className=\"flex items-center gap-2\">\n <Button variant=\"outline\" onClick={() => navigate(buildPath('livestock/analytics'))}>\n <LineChart className=\"h-4 w-4\" />\n {t('healthybowl.livestock.dashboard.actions.analytics', 'View Analytics')}\n </Button>\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 </div>\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, HB_DEFAULT_CURRENCY)}\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 {/*\n Every list on this page is scoped to animals still in the herd, so removing\n an animal quietly takes its records out of these totals too. Without this\n line the farmer sees the numbers fall and has nothing to attribute it to —\n which reads as lost data rather than as the removal they performed.\n Only rendered when there is something to explain; a \"0 records\" line would\n be noise on every farm that has never deleted an animal.\n */}\n {recordsForRemovedAnimals > 0 && (\n <div\n role=\"status\"\n className=\"flex items-start gap-3 rounded-lg border border-status-info-border bg-status-info-bg px-4 py-3 text-sm text-status-info-text\"\n >\n <AlertCircle className=\"mt-0.5 h-4 w-4 shrink-0\" />\n <span>\n {recordsForRemovedAnimals === 1\n ? t(\n 'healthybowl.livestock.dashboard.removedAnimalsOne',\n 'One health, vaccination, breeding, feed or production record belongs to an animal you removed from the herd. It is kept, but it is not counted above.'\n )\n : t(\n 'healthybowl.livestock.dashboard.removedAnimals',\n '{{count}} health, vaccination, breeding, feed and production records belong to animals you removed from the herd. They are kept, but they are not counted above.',\n { count: recordsForRemovedAnimals }\n )}\n </span>\n </div>\n )}\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-end\">\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-end\">\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 {/* Feed (BOFF-5971) — spend over time + what a kilo of gain costs */}\n <LivestockFeedCard />\n\n {/* Herd statistics (BOFF-5971, slice 3) — composition, turnover, production per head.\n Sits after growth and feed because it describes the herd those two measure. */}\n <HerdStatsCard />\n\n {/* Fertility (BOFF-6008, slice 4) — is the herd actually breeding? Last of the four\n because it is the only one that also looks forward (who is due), so it reads as the\n hand-off from \"what happened\" to \"what to do this week\". */}\n <FertilityCard />\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-end\">\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\">\n {formatCurrency(monthlyRevenue, HB_DEFAULT_CURRENCY)}\n </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\">\n {formatCurrency(monthlyExpenses, HB_DEFAULT_CURRENCY)}\n </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, HB_DEFAULT_CURRENCY)}\n </p>\n </div>\n </div>\n </div>\n </>\n )}\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,IAAM,KAAiB,MAAiB;AACtC,SAA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