@burdenoff/microfe-healthybowl 2026.904.21 → 2026.904.22

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.
Files changed (140) hide show
  1. package/dist/components/assistant/AssistantChatArea.js +7 -9
  2. package/dist/components/assistant/AssistantChatArea.js.map +1 -1
  3. package/dist/healthybowl/HealthyBowlRoot.js +56 -57
  4. package/dist/healthybowl/HealthyBowlRoot.js.map +1 -1
  5. package/dist/healthybowl/HealthyBowlRoutes.js +36 -48
  6. package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
  7. package/dist/healthybowl/components/CreateFarmTaskButton.js.map +1 -1
  8. package/dist/healthybowl/components/PageLayout.js +10 -11
  9. package/dist/healthybowl/components/PageLayout.js.map +1 -1
  10. package/dist/healthybowl/context/HealthyBowlContext.js +7 -7
  11. package/dist/healthybowl/context/HealthyBowlContext.js.map +1 -1
  12. package/dist/healthybowl/hooks/useHealthyBowlCompliance.js +141 -157
  13. package/dist/healthybowl/hooks/useHealthyBowlCompliance.js.map +1 -1
  14. package/dist/healthybowl/hooks/useHealthyBowlData.js +0 -18
  15. package/dist/healthybowl/hooks/useHealthyBowlData.js.map +1 -1
  16. package/dist/healthybowl/hooks/useHealthyBowlDistribution.js +37 -52
  17. package/dist/healthybowl/hooks/useHealthyBowlDistribution.js.map +1 -1
  18. package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js +78 -135
  19. package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js.map +1 -1
  20. package/dist/healthybowl/hooks/useIrrigationAutomation.js +1 -1
  21. package/dist/healthybowl/hooks/useIrrigationAutomation.js.map +1 -1
  22. package/dist/healthybowl/hooks/useSuccessionPlanning.js +1 -1
  23. package/dist/healthybowl/hooks/useSuccessionPlanning.js.map +1 -1
  24. package/dist/healthybowl/hooks/useWeatherIntelligence.js +1 -1
  25. package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -1
  26. package/dist/healthybowl/offline/OfflineStatusPill.js +21 -40
  27. package/dist/healthybowl/offline/OfflineStatusPill.js.map +1 -1
  28. package/dist/healthybowl/offline/OfflineSyncProvider.js +130 -153
  29. package/dist/healthybowl/offline/OfflineSyncProvider.js.map +1 -1
  30. package/dist/healthybowl/offline/graphql.js.map +1 -1
  31. package/dist/healthybowl/offline/store.js +1 -1
  32. package/dist/healthybowl/offline/syncEngine.js +1 -2
  33. package/dist/healthybowl/offline/syncEngine.js.map +1 -1
  34. package/dist/healthybowl/offline/types.js.map +1 -1
  35. package/dist/healthybowl/pages/GettingStartedPage.js +0 -1
  36. package/dist/healthybowl/pages/GettingStartedPage.js.map +1 -1
  37. package/dist/healthybowl/pages/analytics/InsightsPage.js +2 -2
  38. package/dist/healthybowl/pages/analytics/InsightsPage.js.map +1 -1
  39. package/dist/healthybowl/pages/analytics/ReportsPage.js +99 -136
  40. package/dist/healthybowl/pages/analytics/ReportsPage.js.map +1 -1
  41. package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js +162 -204
  42. package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js.map +1 -1
  43. package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js +178 -196
  44. package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js.map +1 -1
  45. package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js +141 -142
  46. package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js.map +1 -1
  47. package/dist/healthybowl/pages/crops/CropFieldsPage.js +0 -2
  48. package/dist/healthybowl/pages/crops/CropFieldsPage.js.map +1 -1
  49. package/dist/healthybowl/pages/crops/CropHarvestPage.js +272 -316
  50. package/dist/healthybowl/pages/crops/CropHarvestPage.js.map +1 -1
  51. package/dist/healthybowl/pages/crops/CropPlanningPage.js +0 -6
  52. package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
  53. package/dist/healthybowl/pages/crops/FieldDetailsPage.js +846 -871
  54. package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
  55. package/dist/healthybowl/pages/crops/HarvestDetailsPage.js +334 -376
  56. package/dist/healthybowl/pages/crops/HarvestDetailsPage.js.map +1 -1
  57. package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js +188 -415
  58. package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js.map +1 -1
  59. package/dist/healthybowl/pages/distribution/labels.js +2 -10
  60. package/dist/healthybowl/pages/distribution/labels.js.map +1 -1
  61. package/dist/healthybowl/pages/farm/FarmProfilePage.js +0 -1
  62. package/dist/healthybowl/pages/farm/FarmProfilePage.js.map +1 -1
  63. package/dist/healthybowl/pages/field-capture/CaptureObservationForm.js +8 -8
  64. package/dist/healthybowl/pages/fields/FieldMapPage.js +0 -2
  65. package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
  66. package/dist/healthybowl/pages/financial/FinancialReportsPage.js +107 -92
  67. package/dist/healthybowl/pages/financial/FinancialReportsPage.js.map +1 -1
  68. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +188 -228
  69. package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js.map +1 -1
  70. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js +191 -261
  71. package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js.map +1 -1
  72. package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js +14 -14
  73. package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js.map +1 -1
  74. package/dist/healthybowl/pages/irrigation/IrrigationPage.js +307 -338
  75. package/dist/healthybowl/pages/irrigation/IrrigationPage.js.map +1 -1
  76. package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js +102 -126
  77. package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js.map +1 -1
  78. package/dist/healthybowl/pages/livestock/AnimalDepthPage.js +215 -257
  79. package/dist/healthybowl/pages/livestock/AnimalDepthPage.js.map +1 -1
  80. package/dist/healthybowl/pages/livestock/GrazingPage.js +0 -1
  81. package/dist/healthybowl/pages/livestock/GrazingPage.js.map +1 -1
  82. package/dist/healthybowl/pages/livestock/HerdDepthPage.js +0 -4
  83. package/dist/healthybowl/pages/livestock/HerdDepthPage.js.map +1 -1
  84. package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js +9 -8
  85. package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js.map +1 -1
  86. package/dist/healthybowl/pages/network/ExpertsPage.js +419 -520
  87. package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
  88. package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +130 -129
  89. package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -1
  90. package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +237 -285
  91. package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -1
  92. package/dist/healthybowl/utils/plantingCapacity.js +10 -10
  93. package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
  94. package/dist/node_modules/fast-equals/dist/es/index.js +86 -74
  95. package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
  96. package/dist/services/assistantApi.js +30 -59
  97. package/dist/services/assistantApi.js.map +1 -1
  98. package/dist/utils/pageContext.js +1 -15
  99. package/dist/utils/pageContext.js.map +1 -1
  100. package/package.json +1 -1
  101. package/dist/healthybowl/hooks/useAgronomyDecisions.js +0 -79
  102. package/dist/healthybowl/hooks/useAgronomyDecisions.js.map +0 -1
  103. package/dist/healthybowl/hooks/useAnalyticsReports.js +0 -173
  104. package/dist/healthybowl/hooks/useAnalyticsReports.js.map +0 -1
  105. package/dist/healthybowl/hooks/useComplianceExports.js +0 -74
  106. package/dist/healthybowl/hooks/useComplianceExports.js.map +0 -1
  107. package/dist/healthybowl/hooks/useConsultationPayments.js +0 -59
  108. package/dist/healthybowl/hooks/useConsultationPayments.js.map +0 -1
  109. package/dist/healthybowl/hooks/usePlantingEstimate.js +0 -88
  110. package/dist/healthybowl/hooks/usePlantingEstimate.js.map +0 -1
  111. package/dist/healthybowl/offline/HeaderOfflinePill.js +0 -28
  112. package/dist/healthybowl/offline/HeaderOfflinePill.js.map +0 -1
  113. package/dist/healthybowl/offline/captureCache.js +0 -30
  114. package/dist/healthybowl/offline/captureCache.js.map +0 -1
  115. package/dist/healthybowl/offline/headerSlot.js +0 -24
  116. package/dist/healthybowl/offline/headerSlot.js.map +0 -1
  117. package/dist/healthybowl/pages/ai/AiDecisionsPage.js +0 -287
  118. package/dist/healthybowl/pages/ai/AiDecisionsPage.js.map +0 -1
  119. package/dist/healthybowl/pages/compliance/ResidueTestsPage.js +0 -291
  120. package/dist/healthybowl/pages/compliance/ResidueTestsPage.js.map +0 -1
  121. package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js +0 -300
  122. package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js.map +0 -1
  123. package/dist/healthybowl/pages/compliance/substanceRuleForm.js +0 -135
  124. package/dist/healthybowl/pages/compliance/substanceRuleForm.js.map +0 -1
  125. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js +0 -49
  126. package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js.map +0 -1
  127. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js +0 -48
  128. package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js.map +0 -1
  129. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js +0 -54
  130. package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js.map +0 -1
  131. package/dist/healthybowl/pages/livestock/PedigreeTree.js +0 -154
  132. package/dist/healthybowl/pages/livestock/PedigreeTree.js.map +0 -1
  133. package/dist/healthybowl/pages/livestock/eidTagInput.js +0 -39
  134. package/dist/healthybowl/pages/livestock/eidTagInput.js.map +0 -1
  135. package/dist/healthybowl/pages/livestock/pedigreeLayout.js +0 -68
  136. package/dist/healthybowl/pages/livestock/pedigreeLayout.js.map +0 -1
  137. package/dist/healthybowl/pages/weather/alertDelivery.js +0 -105
  138. package/dist/healthybowl/pages/weather/alertDelivery.js.map +0 -1
  139. package/dist/healthybowl/utils/icsInspection.js +0 -18
  140. package/dist/healthybowl/utils/icsInspection.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"RecordGrazingMoveModal.js","names":[],"sources":["../../../../../src/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.tsx"],"sourcesContent":["/**\n * Record a grazing move — a mob entering a paddock (BOFF-5970).\n *\n * This is the write the whole sub-domain exists for. The legacy model wrote a paddock name and a\n * single `rotationDate` onto the animal, so recording the next move overwrote the last one and the\n * history was gone; here a move is an EVENT with an entry timestamp, and duration is derived from\n * that timestamp on every read rather than stored.\n *\n * Deliberate choices:\n * - **`datetime-local`, not `date`.** Duration and the rest clock are both derived from the two\n * timestamps. A date-only input silently pins every move to midnight, which turns a mob that\n * went out this morning into one that has been out most of a day.\n * - **The mob is either a group or an explicit list, chosen explicitly.** The API accepts both\n * together (a group minus two animals held back), but offering that as a default invites the\n * half-filled form where a stray checkbox silently overrides the whole group roster.\n * - **`closeOpenEvents` defaults on and says why.** A mob cannot be in two paddocks at once, and\n * an overlap double-counts it in every stocking rate on the page. It is exposed rather than\n * hard-coded because a farm back-filling last season's moves legitimately needs it off.\n * - **The exit is validated against the entry here** as well as server-side, because \"must not\n * precede the entry\" is a sentence the user can act on in the form, not after a round trip.\n * - **The animal list is the herd-depth read, and its search is the SERVER's.** It used to be the\n * dashboard bundle's `animals`, which the service caps at the 200 OLDEST rows (`createdAt asc`).\n * On any herd past 200 head the newest animals could not be put in a mob and the picker stated\n * they did not exist — silent, and worse the bigger the farm. `healthyBowlHerdDepth` now filters\n * tag / name / EID in the QUERY (BOFF-6012), so every animal in the herd is reachable by typing\n * its tag; what the cap bounds is how many MATCHES come back, and when it actually bites the\n * picker says so instead of leaving it to be discovered.\n * - **The reset effect fires on OPEN, never on data arriving.** Its dependencies decide whether a\n * half-filled form survives; groups and animals resolve after the modal can already be open, so\n * depending on them wiped everything the farmer had typed. The initial mob mode is therefore\n * read from a ref at open time instead of from a dependency.\n * - **Error state precedes empty state inside the modal too.** A groups query that failed is not a\n * workspace without groups, and telling a farmer their groups do not exist is worse than telling\n * them the list did not load.\n */\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport {\n Button,\n Input,\n Textarea,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Modal } from '../../../components';\nimport { paddockStateOption } from '../../../utils/grazing';\nimport type { RecordGrazingMoveInput } from '../../../hooks/useHealthyBowlGrazing';\n\nexport interface MovePaddockOption {\n paddockId: string;\n name: string;\n state: string;\n}\n\nexport interface MoveGroupOption {\n id: string;\n name: string;\n animalCount: number;\n}\n\nexport interface MoveAnimalOption {\n id: string;\n tagNumber: string;\n name: string;\n}\n\n/** The shape of the load failures this modal has to tell apart from an empty workspace. */\nexport interface MoveLoadState {\n loading: boolean;\n error: { message: string } | null;\n}\n\n/**\n * Row cap on the herd-depth read, mirroring `MAX_LIST` in `HealthyBowlLivestockDepthProvider`.\n * Stated in the UI — conditionally, only when the server reports it actually bit — rather than\n * enforced here: the client cannot lift a server cap, but it can refuse to pretend the animals past\n * it do not exist.\n */\nexport const ANIMAL_PICKER_LIMIT = 2000;\n\ninterface RecordGrazingMoveModalProps {\n open: boolean;\n onClose: () => void;\n paddocks: MovePaddockOption[];\n groups: MoveGroupOption[];\n animals: MoveAnimalOption[];\n /** Load state of the groups query — an empty list means nothing until this says it loaded. */\n groupsState?: MoveLoadState;\n /** Load state of the animal (herd-depth) query. */\n animalsState?: MoveLoadState;\n /** True when the server capped the match list — fed from `healthyBowlHerdDepth.truncated`. */\n animalsTruncated?: boolean;\n /** Animal search text. Owned by the page because the query filters on it server-side. */\n animalSearch: string;\n onAnimalSearchChange: (value: string) => void;\n /** Preselected paddock, when the move was started from a specific row. */\n defaultPaddockId?: string | null;\n onSubmit: (input: RecordGrazingMoveInput) => Promise<void>;\n}\n\nconst IDLE_LOAD_STATE: MoveLoadState = { loading: false, error: null };\n\nconst fieldLabel = 'mb-1 block text-sm font-medium text-text-primary';\nconst dateInput =\n 'w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\n\ntype MobMode = 'GROUP' | 'ANIMALS';\n\n/** `2026-08-05T14:30` in the browser's own zone — what a `datetime-local` input expects. */\nfunction localNow(): string {\n const now = new Date();\n const offsetMs = now.getTimezoneOffset() * 60_000;\n return new Date(now.getTime() - offsetMs).toISOString().slice(0, 16);\n}\n\n/** `datetime-local` text → ISO instant. Returns null for an empty or unparseable value. */\nfunction toIsoInstant(local: string): string | null {\n if (!local) return null;\n const parsed = new Date(local);\n return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString();\n}\n\nexport const RecordGrazingMoveModal = ({\n open,\n onClose,\n paddocks,\n groups,\n animals,\n groupsState = IDLE_LOAD_STATE,\n animalsState = IDLE_LOAD_STATE,\n animalsTruncated = false,\n animalSearch,\n onAnimalSearchChange,\n defaultPaddockId = null,\n onSubmit,\n}: RecordGrazingMoveModalProps) => {\n const { t } = useI18n();\n const [paddockId, setPaddockId] = useState('');\n const [mobMode, setMobMode] = useState<MobMode>('GROUP');\n const [groupId, setGroupId] = useState('');\n const [animalIds, setAnimalIds] = useState<string[]>([]);\n const [enteredAt, setEnteredAt] = useState(localNow());\n const [alreadyEnded, setAlreadyEnded] = useState(false);\n const [exitedAt, setExitedAt] = useState('');\n const [closeOpenEvents, setCloseOpenEvents] = useState(true);\n const [notes, setNotes] = useState('');\n const [submitting, setSubmitting] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n /**\n * The initial mob mode is a decision taken ONCE, when the modal opens — so it is read through a\n * ref rather than from the dependency array. `groups` arrives after the first render, and having\n * it in the deps meant the reset ran again mid-edit and discarded the whole form. While the query\n * is still in flight the mode stays GROUP, because \"no groups\" is not yet known to be true.\n */\n const groupsAtOpen = useRef<{ count: number; loading: boolean }>({ count: 0, loading: false });\n groupsAtOpen.current = { count: groups.length, loading: groupsState.loading };\n\n useEffect(() => {\n if (!open) return;\n const { count, loading } = groupsAtOpen.current;\n setPaddockId(defaultPaddockId ?? '');\n setMobMode(count > 0 || loading ? 'GROUP' : 'ANIMALS');\n setGroupId('');\n setAnimalIds([]);\n setEnteredAt(localNow());\n setAlreadyEnded(false);\n setExitedAt('');\n setCloseOpenEvents(true);\n setNotes('');\n setError(null);\n }, [open, defaultPaddockId]);\n\n /**\n * The search is the SERVER's — `healthyBowlHerdDepth` filters on tag, name and EID. This second\n * pass only keeps the list steady while a debounced query is in flight; it never narrows past\n * what the server already returned, so an animal the server matched on its EID does not vanish\n * because the EID is not rendered in the row.\n */\n const filteredAnimals = useMemo(() => {\n const needle = animalSearch.trim().toLowerCase();\n if (!needle) return animals;\n const local = animals.filter((a) => `${a.tagNumber} ${a.name}`.toLowerCase().includes(needle));\n return local.length > 0 ? local : animals;\n }, [animals, animalSearch]);\n\n const mobChosen = mobMode === 'GROUP' ? groupId !== '' : animalIds.length > 0;\n const canSubmit = paddockId !== '' && mobChosen && !submitting;\n\n const toggleAnimal = (id: string) => {\n setAnimalIds((prev) => (prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id]));\n };\n\n const handleSubmit = async () => {\n if (!canSubmit) return;\n const enteredIso = toIsoInstant(enteredAt);\n if (!enteredIso) {\n setError(t('healthybowl.livestock.grazing.move.error.entered', 'Enter a valid date and time for the move in.'));\n return;\n }\n const exitedIso = alreadyEnded ? toIsoInstant(exitedAt) : null;\n if (alreadyEnded && !exitedIso) {\n setError(t('healthybowl.livestock.grazing.move.error.exited', 'Enter a valid date and time for the move out.'));\n return;\n }\n if (exitedIso && exitedIso < enteredIso) {\n setError(\n t(\n 'healthybowl.livestock.grazing.move.error.order',\n 'The move out cannot be earlier than the move in — that would be a negative grazing duration.'\n )\n );\n return;\n }\n\n setSubmitting(true);\n setError(null);\n try {\n await onSubmit({\n paddockId,\n groupId: mobMode === 'GROUP' ? groupId : null,\n animalIds: mobMode === 'ANIMALS' ? animalIds : null,\n enteredAt: enteredIso,\n exitedAt: exitedIso,\n notes: notes.trim() || null,\n closeOpenEvents,\n });\n onClose();\n } catch (err) {\n setError(err instanceof Error ? err.message : String(err));\n } finally {\n setSubmitting(false);\n }\n };\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n size=\"lg\"\n title={t('healthybowl.livestock.grazing.move.title', 'Record a grazing move')}\n description={t(\n 'healthybowl.livestock.grazing.move.description',\n 'Which mob went onto which paddock, and when. The time out is recorded separately when they leave.'\n )}\n footer={\n <>\n <Button variant=\"outline\" onClick={onClose} disabled={submitting}>\n {t('common.cancel', 'Cancel')}\n </Button>\n <Button onClick={() => void handleSubmit()} disabled={!canSubmit}>\n {t('healthybowl.livestock.grazing.move.save', 'Record move')}\n </Button>\n </>\n }\n >\n <div className=\"space-y-3\">\n {error ? (\n <div className=\"rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text\">\n {error}\n </div>\n ) : null}\n\n <div>\n <label className={fieldLabel}>{t('healthybowl.livestock.grazing.move.paddock', 'Paddock')}</label>\n {paddocks.length === 0 ? (\n <p className=\"text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.grazing.move.noPaddocks',\n 'No paddocks yet. Add a field with grow location \"Pasture\" and it will appear here.'\n )}\n </p>\n ) : (\n <Select value={paddockId} onValueChange={setPaddockId}>\n <SelectTrigger>\n <SelectValue\n placeholder={t('healthybowl.livestock.grazing.move.paddockPlaceholder', 'Pick a paddock')}\n />\n </SelectTrigger>\n <SelectContent>\n {paddocks.map((p) => {\n const option = paddockStateOption(p.state);\n return (\n <SelectItem key={p.paddockId} value={p.paddockId}>\n {p.name} — {t(option.label.key, option.label.defaultValue)}\n </SelectItem>\n );\n })}\n </SelectContent>\n </Select>\n )}\n </div>\n\n <div>\n <span className={fieldLabel}>{t('healthybowl.livestock.grazing.move.mob', 'Which mob is moving')}</span>\n <div className=\"mb-2 inline-flex rounded-lg border border-border-subtle p-0.5\">\n {(['GROUP', 'ANIMALS'] as const).map((mode) => (\n <button\n key={mode}\n type=\"button\"\n onClick={() => setMobMode(mode)}\n aria-pressed={mobMode === mode}\n className={`min-h-[32px] rounded-md px-3 py-1 text-xs transition-colors ${\n mobMode === mode\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'text-text-secondary hover:bg-bg-sunken/50'\n }`}\n >\n {mode === 'GROUP'\n ? t('healthybowl.livestock.grazing.move.mob.group', 'An animal group')\n : t('healthybowl.livestock.grazing.move.mob.animals', 'Pick animals')}\n </button>\n ))}\n </div>\n\n {mobMode === 'GROUP' ? (\n /* Error, then loading, then empty. \"This workspace has no groups\" is a claim about the\n farm and must never stand in for \"the groups query failed\". */\n groupsState.error ? (\n <div className=\"rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-xs text-status-error-text\">\n {t(\n 'healthybowl.livestock.grazing.move.groupsFailed',\n 'The animal groups could not be loaded, so this list is not a statement about your farm: {{message}}',\n { message: groupsState.error.message }\n )}\n </div>\n ) : groupsState.loading && groups.length === 0 ? (\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.grazing.move.groupsLoading', 'Loading animal groups…')}\n </p>\n ) : groups.length === 0 ? (\n <p className=\"text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.grazing.move.noGroups',\n 'No animal groups yet — pick animals directly, or create a group on the herd records page.'\n )}\n </p>\n ) : (\n <>\n <Select value={groupId} onValueChange={setGroupId}>\n <SelectTrigger>\n <SelectValue\n placeholder={t('healthybowl.livestock.grazing.move.groupPlaceholder', 'Pick a group')}\n />\n </SelectTrigger>\n <SelectContent>\n {groups.map((g) => (\n <SelectItem key={g.id} value={g.id}>\n {g.name} ({g.animalCount})\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.grazing.move.groupSnapshot',\n \"The group's members are snapshotted onto the move, so later membership changes cannot rewrite this history.\"\n )}\n </p>\n </>\n )\n ) : (\n <div className=\"rounded-md border border-border-subtle\">\n <div className=\"border-b border-border-subtle p-2\">\n <Input\n value={animalSearch}\n onChange={(e) => onAnimalSearchChange(e.target.value)}\n placeholder={t('healthybowl.livestock.grazing.move.animalSearch', 'Search by tag, name or EID')}\n />\n </div>\n <div className=\"max-h-48 overflow-y-auto p-2\">\n {/* Error, then loading, then empty — same order as everywhere else on the page. */}\n {animalsState.error ? (\n <p className=\"rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-xs text-status-error-text\">\n {t(\n 'healthybowl.livestock.grazing.move.animalsFailed',\n 'The herd could not be loaded, so this list is not a statement about your farm: {{message}}',\n { message: animalsState.error.message }\n )}\n </p>\n ) : animalsState.loading && filteredAnimals.length === 0 ? (\n <p className=\"py-2 text-center text-xs text-text-secondary\">\n {t('healthybowl.livestock.grazing.move.animalsLoading', 'Loading the herd…')}\n </p>\n ) : filteredAnimals.length === 0 ? (\n <p className=\"py-2 text-center text-xs text-text-secondary\">\n {animalSearch.trim()\n ? t('healthybowl.livestock.grazing.move.noAnimals', 'No animals match.')\n : t(\n 'healthybowl.livestock.grazing.move.noAnimalsAtAll',\n 'No animals registered yet — add one on the herd records page.'\n )}\n </p>\n ) : (\n filteredAnimals.map((a) => (\n <label\n key={a.id}\n className=\"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-text-primary hover:bg-bg-sunken/50\"\n >\n <input\n type=\"checkbox\"\n checked={animalIds.includes(a.id)}\n onChange={() => toggleAnimal(a.id)}\n className=\"h-4 w-4\"\n />\n <span className=\"font-medium\">{a.tagNumber}</span>\n <span className=\"text-text-secondary\">{a.name}</span>\n </label>\n ))\n )}\n </div>\n <div className=\"border-t border-border-subtle px-2 py-1.5 text-xs text-text-secondary\">\n {t('healthybowl.livestock.grazing.move.selectedCount', '{{n}} selected', {\n n: String(animalIds.length),\n })}\n </div>\n {/* The cap is stated, not discovered — but only when it actually bites. The search\n runs over the whole herd (BOFF-6012); what the cap bounds is how many matches come\n back, so a picker that always claimed a limit was reporting a wall that was not\n there. */}\n {animalsTruncated && (\n <div className=\"border-t border-border-subtle px-2 py-1.5 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.grazing.move.animalCap',\n 'Showing the first {{n}} matches — narrow your search.',\n { n: new Intl.NumberFormat('en-US').format(ANIMAL_PICKER_LIMIT) }\n )}\n </div>\n )}\n </div>\n )}\n </div>\n\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <div>\n <label className={fieldLabel}>{t('healthybowl.livestock.grazing.move.enteredAt', 'Moved in')}</label>\n <input\n type=\"datetime-local\"\n className={dateInput}\n value={enteredAt}\n onChange={(e) => setEnteredAt(e.target.value)}\n />\n </div>\n <div>\n <label className={fieldLabel}>\n {t('healthybowl.livestock.grazing.move.exitedAt', 'Moved out (optional)')}\n </label>\n <label className=\"mb-1 flex cursor-pointer items-center gap-2 text-xs text-text-secondary\">\n <input\n type=\"checkbox\"\n checked={alreadyEnded}\n onChange={(e) => setAlreadyEnded(e.target.checked)}\n className=\"h-4 w-4\"\n />\n {t('healthybowl.livestock.grazing.move.alreadyEnded', 'This move has already ended')}\n </label>\n {alreadyEnded && (\n <input\n type=\"datetime-local\"\n className={dateInput}\n value={exitedAt}\n onChange={(e) => setExitedAt(e.target.value)}\n />\n )}\n </div>\n </div>\n\n <label className=\"flex cursor-pointer items-start gap-2 rounded-md bg-bg-sunken/50 px-3 py-2 text-xs text-text-secondary\">\n <input\n type=\"checkbox\"\n checked={closeOpenEvents}\n onChange={(e) => setCloseOpenEvents(e.target.checked)}\n className=\"mt-0.5 h-4 w-4\"\n />\n <span>\n <span className=\"font-medium text-text-primary\">\n {t('healthybowl.livestock.grazing.move.closeOpen', 'Close any move still open for this mob or paddock')}\n </span>\n <br />\n {t(\n 'healthybowl.livestock.grazing.move.closeOpenHint',\n 'A mob cannot be in two paddocks at once — an overlap would double-count it in every stocking rate. Turn this off only when back-filling past moves.'\n )}\n </span>\n </label>\n\n <div>\n <label className={fieldLabel}>{t('healthybowl.livestock.grazing.move.notes', 'Notes')}</label>\n <Textarea value={notes} onChange={(e) => setNotes(e.target.value)} rows={2} />\n </div>\n </div>\n </Modal>\n );\n};\n"],"mappings":";;;;;;;AAwGA,IAAM,IAAiC;CAAE,SAAS;CAAO,OAAO;AAAK,GAE/D,IAAa,oDACb,IACJ;AAKF,SAAS,IAAmB;CAC1B,IAAM,oBAAM,IAAI,KAAK,GACf,IAAW,EAAI,kBAAkB,IAAI;CAC3C,OAAO,IAAI,KAAK,EAAI,QAAQ,IAAI,CAAQ,EAAE,YAAY,EAAE,MAAM,GAAG,EAAE;AACrE;AAGA,SAAS,EAAa,GAA8B;CAClD,IAAI,CAAC,GAAO,OAAO;CACnB,IAAM,IAAS,IAAI,KAAK,CAAK;CAC7B,OAAO,OAAO,MAAM,EAAO,QAAQ,CAAC,IAAI,OAAO,EAAO,YAAY;AACpE;AAEA,IAAa,KAA0B,EACrC,SACA,YACA,aACA,WACA,YACA,iBAAc,GACd,kBAAe,GACf,uBAAmB,IACnB,iBACA,0BACA,sBAAmB,MACnB,mBACiC;CACjC,IAAM,EAAE,SAAM,EAAQ,GAChB,CAAC,GAAW,KAAgB,EAAS,EAAE,GACvC,CAAC,GAAS,KAAc,EAAkB,OAAO,GACjD,CAAC,GAAS,KAAc,EAAS,EAAE,GACnC,CAAC,GAAW,KAAgB,EAAmB,CAAC,CAAC,GACjD,CAAC,GAAW,KAAgB,EAAS,EAAS,CAAC,GAC/C,CAAC,GAAc,KAAmB,EAAS,EAAK,GAChD,CAAC,GAAU,KAAe,EAAS,EAAE,GACrC,CAAC,GAAiB,KAAsB,EAAS,EAAI,GACrD,CAAC,GAAO,KAAY,EAAS,EAAE,GAC/B,CAAC,GAAY,KAAiB,EAAS,EAAK,GAC5C,CAAC,GAAO,KAAY,EAAwB,IAAI,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,WAAW,MAAM,EAAS,EAAE,OAAO,KAAK;KAAG,MAAM;IAAI,CAAA,CAC1E,EAAA,CAAA;GACF;;CACA,CAAA;AAEX"}
1
+ {"version":3,"file":"RecordGrazingMoveModal.js","names":[],"sources":["../../../../../src/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.tsx"],"sourcesContent":["/**\n * Record a grazing move — a mob entering a paddock (BOFF-5970).\n *\n * This is the write the whole sub-domain exists for. The legacy model wrote a paddock name and a\n * single `rotationDate` onto the animal, so recording the next move overwrote the last one and the\n * history was gone; here a move is an EVENT with an entry timestamp, and duration is derived from\n * that timestamp on every read rather than stored.\n *\n * Deliberate choices:\n * - **`datetime-local`, not `date`.** Duration and the rest clock are both derived from the two\n * timestamps. A date-only input silently pins every move to midnight, which turns a mob that\n * went out this morning into one that has been out most of a day.\n * - **The mob is either a group or an explicit list, chosen explicitly.** The API accepts both\n * together (a group minus two animals held back), but offering that as a default invites the\n * half-filled form where a stray checkbox silently overrides the whole group roster.\n * - **`closeOpenEvents` defaults on and says why.** A mob cannot be in two paddocks at once, and\n * an overlap double-counts it in every stocking rate on the page. It is exposed rather than\n * hard-coded because a farm back-filling last season's moves legitimately needs it off.\n * - **The exit is validated against the entry here** as well as server-side, because \"must not\n * precede the entry\" is a sentence the user can act on in the form, not after a round trip.\n * - **The animal list is the herd-depth read, and its search is the SERVER's.** It used to be the\n * dashboard bundle's `animals`, which the service caps at the 200 OLDEST rows (`createdAt asc`).\n * On any herd past 200 head the newest animals could not be put in a mob and the picker stated\n * they did not exist — silent, and worse the bigger the farm. The herd-depth query reads by tag\n * number and filters server-side, and where a cap still bites it is written on screen rather\n * than left to be discovered.\n * - **The reset effect fires on OPEN, never on data arriving.** Its dependencies decide whether a\n * half-filled form survives; groups and animals resolve after the modal can already be open, so\n * depending on them wiped everything the farmer had typed. The initial mob mode is therefore\n * read from a ref at open time instead of from a dependency.\n * - **Error state precedes empty state inside the modal too.** A groups query that failed is not a\n * workspace without groups, and telling a farmer their groups do not exist is worse than telling\n * them the list did not load.\n */\n\nimport { useEffect, useMemo, useRef, useState } from 'react';\nimport {\n Button,\n Input,\n Textarea,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n} from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport { Modal } from '../../../components';\nimport { paddockStateOption } from '../../../utils/grazing';\nimport type { RecordGrazingMoveInput } from '../../../hooks/useHealthyBowlGrazing';\n\nexport interface MovePaddockOption {\n paddockId: string;\n name: string;\n state: string;\n}\n\nexport interface MoveGroupOption {\n id: string;\n name: string;\n animalCount: number;\n}\n\nexport interface MoveAnimalOption {\n id: string;\n tagNumber: string;\n name: string;\n}\n\n/** The shape of the load failures this modal has to tell apart from an empty workspace. */\nexport interface MoveLoadState {\n loading: boolean;\n error: { message: string } | null;\n}\n\n/**\n * Row cap on the herd-depth read, mirroring `MAX_LIST` in `HealthyBowlLivestockDepthProvider`.\n * Stated in the UI rather than enforced here — the client cannot lift a server cap, but it can\n * refuse to pretend the animals past it do not exist.\n */\nexport const ANIMAL_PICKER_LIMIT = 2000;\n\ninterface RecordGrazingMoveModalProps {\n open: boolean;\n onClose: () => void;\n paddocks: MovePaddockOption[];\n groups: MoveGroupOption[];\n animals: MoveAnimalOption[];\n /** Load state of the groups query — an empty list means nothing until this says it loaded. */\n groupsState?: MoveLoadState;\n /** Load state of the animal (herd-depth) query. */\n animalsState?: MoveLoadState;\n /** Animal search text. Owned by the page because the query filters on it server-side. */\n animalSearch: string;\n onAnimalSearchChange: (value: string) => void;\n /** Preselected paddock, when the move was started from a specific row. */\n defaultPaddockId?: string | null;\n onSubmit: (input: RecordGrazingMoveInput) => Promise<void>;\n}\n\nconst IDLE_LOAD_STATE: MoveLoadState = { loading: false, error: null };\n\nconst fieldLabel = 'mb-1 block text-sm font-medium text-text-primary';\nconst dateInput =\n 'w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]';\n\ntype MobMode = 'GROUP' | 'ANIMALS';\n\n/** `2026-08-05T14:30` in the browser's own zone — what a `datetime-local` input expects. */\nfunction localNow(): string {\n const now = new Date();\n const offsetMs = now.getTimezoneOffset() * 60_000;\n return new Date(now.getTime() - offsetMs).toISOString().slice(0, 16);\n}\n\n/** `datetime-local` text → ISO instant. Returns null for an empty or unparseable value. */\nfunction toIsoInstant(local: string): string | null {\n if (!local) return null;\n const parsed = new Date(local);\n return Number.isNaN(parsed.getTime()) ? null : parsed.toISOString();\n}\n\nexport const RecordGrazingMoveModal = ({\n open,\n onClose,\n paddocks,\n groups,\n animals,\n groupsState = IDLE_LOAD_STATE,\n animalsState = IDLE_LOAD_STATE,\n animalSearch,\n onAnimalSearchChange,\n defaultPaddockId = null,\n onSubmit,\n}: RecordGrazingMoveModalProps) => {\n const { t } = useI18n();\n const [paddockId, setPaddockId] = useState('');\n const [mobMode, setMobMode] = useState<MobMode>('GROUP');\n const [groupId, setGroupId] = useState('');\n const [animalIds, setAnimalIds] = useState<string[]>([]);\n const [enteredAt, setEnteredAt] = useState(localNow());\n const [alreadyEnded, setAlreadyEnded] = useState(false);\n const [exitedAt, setExitedAt] = useState('');\n const [closeOpenEvents, setCloseOpenEvents] = useState(true);\n const [notes, setNotes] = useState('');\n const [submitting, setSubmitting] = useState(false);\n const [error, setError] = useState<string | null>(null);\n\n /**\n * The initial mob mode is a decision taken ONCE, when the modal opens — so it is read through a\n * ref rather than from the dependency array. `groups` arrives after the first render, and having\n * it in the deps meant the reset ran again mid-edit and discarded the whole form. While the query\n * is still in flight the mode stays GROUP, because \"no groups\" is not yet known to be true.\n */\n const groupsAtOpen = useRef<{ count: number; loading: boolean }>({ count: 0, loading: false });\n groupsAtOpen.current = { count: groups.length, loading: groupsState.loading };\n\n useEffect(() => {\n if (!open) return;\n const { count, loading } = groupsAtOpen.current;\n setPaddockId(defaultPaddockId ?? '');\n setMobMode(count > 0 || loading ? 'GROUP' : 'ANIMALS');\n setGroupId('');\n setAnimalIds([]);\n setEnteredAt(localNow());\n setAlreadyEnded(false);\n setExitedAt('');\n setCloseOpenEvents(true);\n setNotes('');\n setError(null);\n }, [open, defaultPaddockId]);\n\n /**\n * The search is the SERVER's — `healthyBowlHerdDepth` filters on tag, name and EID. This second\n * pass only keeps the list steady while a debounced query is in flight; it never narrows past\n * what the server already returned, so an animal the server matched on its EID does not vanish\n * because the EID is not rendered in the row.\n */\n const filteredAnimals = useMemo(() => {\n const needle = animalSearch.trim().toLowerCase();\n if (!needle) return animals;\n const local = animals.filter((a) => `${a.tagNumber} ${a.name}`.toLowerCase().includes(needle));\n return local.length > 0 ? local : animals;\n }, [animals, animalSearch]);\n\n const mobChosen = mobMode === 'GROUP' ? groupId !== '' : animalIds.length > 0;\n const canSubmit = paddockId !== '' && mobChosen && !submitting;\n\n const toggleAnimal = (id: string) => {\n setAnimalIds((prev) => (prev.includes(id) ? prev.filter((x) => x !== id) : [...prev, id]));\n };\n\n const handleSubmit = async () => {\n if (!canSubmit) return;\n const enteredIso = toIsoInstant(enteredAt);\n if (!enteredIso) {\n setError(t('healthybowl.livestock.grazing.move.error.entered', 'Enter a valid date and time for the move in.'));\n return;\n }\n const exitedIso = alreadyEnded ? toIsoInstant(exitedAt) : null;\n if (alreadyEnded && !exitedIso) {\n setError(t('healthybowl.livestock.grazing.move.error.exited', 'Enter a valid date and time for the move out.'));\n return;\n }\n if (exitedIso && exitedIso < enteredIso) {\n setError(\n t(\n 'healthybowl.livestock.grazing.move.error.order',\n 'The move out cannot be earlier than the move in — that would be a negative grazing duration.'\n )\n );\n return;\n }\n\n setSubmitting(true);\n setError(null);\n try {\n await onSubmit({\n paddockId,\n groupId: mobMode === 'GROUP' ? groupId : null,\n animalIds: mobMode === 'ANIMALS' ? animalIds : null,\n enteredAt: enteredIso,\n exitedAt: exitedIso,\n notes: notes.trim() || null,\n closeOpenEvents,\n });\n onClose();\n } catch (err) {\n setError(err instanceof Error ? err.message : String(err));\n } finally {\n setSubmitting(false);\n }\n };\n\n return (\n <Modal\n open={open}\n onClose={onClose}\n size=\"lg\"\n title={t('healthybowl.livestock.grazing.move.title', 'Record a grazing move')}\n description={t(\n 'healthybowl.livestock.grazing.move.description',\n 'Which mob went onto which paddock, and when. The time out is recorded separately when they leave.'\n )}\n footer={\n <>\n <Button variant=\"outline\" onClick={onClose} disabled={submitting}>\n {t('common.cancel', 'Cancel')}\n </Button>\n <Button onClick={() => void handleSubmit()} disabled={!canSubmit}>\n {t('healthybowl.livestock.grazing.move.save', 'Record move')}\n </Button>\n </>\n }\n >\n <div className=\"space-y-3\">\n {error ? (\n <div className=\"rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text\">\n {error}\n </div>\n ) : null}\n\n <div>\n <label className={fieldLabel}>{t('healthybowl.livestock.grazing.move.paddock', 'Paddock')}</label>\n {paddocks.length === 0 ? (\n <p className=\"text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.grazing.move.noPaddocks',\n 'No paddocks yet. Add a field with grow location \"Pasture\" and it will appear here.'\n )}\n </p>\n ) : (\n <Select value={paddockId} onValueChange={setPaddockId}>\n <SelectTrigger>\n <SelectValue\n placeholder={t('healthybowl.livestock.grazing.move.paddockPlaceholder', 'Pick a paddock')}\n />\n </SelectTrigger>\n <SelectContent>\n {paddocks.map((p) => {\n const option = paddockStateOption(p.state);\n return (\n <SelectItem key={p.paddockId} value={p.paddockId}>\n {p.name} — {t(option.label.key, option.label.defaultValue)}\n </SelectItem>\n );\n })}\n </SelectContent>\n </Select>\n )}\n </div>\n\n <div>\n <span className={fieldLabel}>{t('healthybowl.livestock.grazing.move.mob', 'Which mob is moving')}</span>\n <div className=\"mb-2 inline-flex rounded-lg border border-border-subtle p-0.5\">\n {(['GROUP', 'ANIMALS'] as const).map((mode) => (\n <button\n key={mode}\n type=\"button\"\n onClick={() => setMobMode(mode)}\n aria-pressed={mobMode === mode}\n className={`min-h-[32px] rounded-md px-3 py-1 text-xs transition-colors ${\n mobMode === mode\n ? 'bg-action-primary-bg text-action-primary-text'\n : 'text-text-secondary hover:bg-bg-sunken/50'\n }`}\n >\n {mode === 'GROUP'\n ? t('healthybowl.livestock.grazing.move.mob.group', 'An animal group')\n : t('healthybowl.livestock.grazing.move.mob.animals', 'Pick animals')}\n </button>\n ))}\n </div>\n\n {mobMode === 'GROUP' ? (\n /* Error, then loading, then empty. \"This workspace has no groups\" is a claim about the\n farm and must never stand in for \"the groups query failed\". */\n groupsState.error ? (\n <div className=\"rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-xs text-status-error-text\">\n {t(\n 'healthybowl.livestock.grazing.move.groupsFailed',\n 'The animal groups could not be loaded, so this list is not a statement about your farm: {{message}}',\n { message: groupsState.error.message }\n )}\n </div>\n ) : groupsState.loading && groups.length === 0 ? (\n <p className=\"text-xs text-text-secondary\">\n {t('healthybowl.livestock.grazing.move.groupsLoading', 'Loading animal groups…')}\n </p>\n ) : groups.length === 0 ? (\n <p className=\"text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.grazing.move.noGroups',\n 'No animal groups yet — pick animals directly, or create a group on the herd records page.'\n )}\n </p>\n ) : (\n <>\n <Select value={groupId} onValueChange={setGroupId}>\n <SelectTrigger>\n <SelectValue\n placeholder={t('healthybowl.livestock.grazing.move.groupPlaceholder', 'Pick a group')}\n />\n </SelectTrigger>\n <SelectContent>\n {groups.map((g) => (\n <SelectItem key={g.id} value={g.id}>\n {g.name} ({g.animalCount})\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.grazing.move.groupSnapshot',\n \"The group's members are snapshotted onto the move, so later membership changes cannot rewrite this history.\"\n )}\n </p>\n </>\n )\n ) : (\n <div className=\"rounded-md border border-border-subtle\">\n <div className=\"border-b border-border-subtle p-2\">\n <Input\n value={animalSearch}\n onChange={(e) => onAnimalSearchChange(e.target.value)}\n placeholder={t('healthybowl.livestock.grazing.move.animalSearch', 'Search by tag, name or EID')}\n />\n </div>\n <div className=\"max-h-48 overflow-y-auto p-2\">\n {/* Error, then loading, then empty — same order as everywhere else on the page. */}\n {animalsState.error ? (\n <p className=\"rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-xs text-status-error-text\">\n {t(\n 'healthybowl.livestock.grazing.move.animalsFailed',\n 'The herd could not be loaded, so this list is not a statement about your farm: {{message}}',\n { message: animalsState.error.message }\n )}\n </p>\n ) : animalsState.loading && filteredAnimals.length === 0 ? (\n <p className=\"py-2 text-center text-xs text-text-secondary\">\n {t('healthybowl.livestock.grazing.move.animalsLoading', 'Loading the herd…')}\n </p>\n ) : filteredAnimals.length === 0 ? (\n <p className=\"py-2 text-center text-xs text-text-secondary\">\n {animalSearch.trim()\n ? t('healthybowl.livestock.grazing.move.noAnimals', 'No animals match.')\n : t(\n 'healthybowl.livestock.grazing.move.noAnimalsAtAll',\n 'No animals registered yet — add one on the herd records page.'\n )}\n </p>\n ) : (\n filteredAnimals.map((a) => (\n <label\n key={a.id}\n className=\"flex cursor-pointer items-center gap-2 rounded-md px-2 py-1.5 text-sm text-text-primary hover:bg-bg-sunken/50\"\n >\n <input\n type=\"checkbox\"\n checked={animalIds.includes(a.id)}\n onChange={() => toggleAnimal(a.id)}\n className=\"h-4 w-4\"\n />\n <span className=\"font-medium\">{a.tagNumber}</span>\n <span className=\"text-text-secondary\">{a.name}</span>\n </label>\n ))\n )}\n </div>\n <div className=\"border-t border-border-subtle px-2 py-1.5 text-xs text-text-secondary\">\n {t('healthybowl.livestock.grazing.move.selectedCount', '{{n}} selected', {\n n: String(animalIds.length),\n })}\n </div>\n {/* The cap is stated, not discovered. The read is bounded server-side, and a picker\n that silently omits the animals past the bound tells a large farm they do not\n exist — the one failure that gets worse the bigger the herd. */}\n <div className=\"border-t border-border-subtle px-2 py-1.5 text-xs text-text-secondary\">\n {t(\n 'healthybowl.livestock.grazing.move.animalCap',\n 'Searching filters the whole herd on the server, across the first {{n}} animals by tag number. A herd larger than that is not fully reachable here — move it as a group instead.',\n { n: new Intl.NumberFormat('en-US').format(ANIMAL_PICKER_LIMIT) }\n )}\n </div>\n </div>\n )}\n </div>\n\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2\">\n <div>\n <label className={fieldLabel}>{t('healthybowl.livestock.grazing.move.enteredAt', 'Moved in')}</label>\n <input\n type=\"datetime-local\"\n className={dateInput}\n value={enteredAt}\n onChange={(e) => setEnteredAt(e.target.value)}\n />\n </div>\n <div>\n <label className={fieldLabel}>\n {t('healthybowl.livestock.grazing.move.exitedAt', 'Moved out (optional)')}\n </label>\n <label className=\"mb-1 flex cursor-pointer items-center gap-2 text-xs text-text-secondary\">\n <input\n type=\"checkbox\"\n checked={alreadyEnded}\n onChange={(e) => setAlreadyEnded(e.target.checked)}\n className=\"h-4 w-4\"\n />\n {t('healthybowl.livestock.grazing.move.alreadyEnded', 'This move has already ended')}\n </label>\n {alreadyEnded && (\n <input\n type=\"datetime-local\"\n className={dateInput}\n value={exitedAt}\n onChange={(e) => setExitedAt(e.target.value)}\n />\n )}\n </div>\n </div>\n\n <label className=\"flex cursor-pointer items-start gap-2 rounded-md bg-bg-sunken/50 px-3 py-2 text-xs text-text-secondary\">\n <input\n type=\"checkbox\"\n checked={closeOpenEvents}\n onChange={(e) => setCloseOpenEvents(e.target.checked)}\n className=\"mt-0.5 h-4 w-4\"\n />\n <span>\n <span className=\"font-medium text-text-primary\">\n {t('healthybowl.livestock.grazing.move.closeOpen', 'Close any move still open for this mob or paddock')}\n </span>\n <br />\n {t(\n 'healthybowl.livestock.grazing.move.closeOpenHint',\n 'A mob cannot be in two paddocks at once — an overlap would double-count it in every stocking rate. Turn this off only when back-filling past moves.'\n )}\n </span>\n </label>\n\n <div>\n <label className={fieldLabel}>{t('healthybowl.livestock.grazing.move.notes', 'Notes')}</label>\n <Textarea value={notes} onChange={(e) => setNotes(e.target.value)} rows={2} />\n </div>\n </div>\n </Modal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