@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.
- package/dist/components/assistant/AssistantChatArea.js +7 -9
- package/dist/components/assistant/AssistantChatArea.js.map +1 -1
- package/dist/healthybowl/HealthyBowlRoot.js +56 -57
- package/dist/healthybowl/HealthyBowlRoot.js.map +1 -1
- package/dist/healthybowl/HealthyBowlRoutes.js +36 -48
- package/dist/healthybowl/HealthyBowlRoutes.js.map +1 -1
- package/dist/healthybowl/components/CreateFarmTaskButton.js.map +1 -1
- package/dist/healthybowl/components/PageLayout.js +10 -11
- package/dist/healthybowl/components/PageLayout.js.map +1 -1
- package/dist/healthybowl/context/HealthyBowlContext.js +7 -7
- package/dist/healthybowl/context/HealthyBowlContext.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlCompliance.js +141 -157
- package/dist/healthybowl/hooks/useHealthyBowlCompliance.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlData.js +0 -18
- package/dist/healthybowl/hooks/useHealthyBowlData.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlDistribution.js +37 -52
- package/dist/healthybowl/hooks/useHealthyBowlDistribution.js.map +1 -1
- package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js +78 -135
- package/dist/healthybowl/hooks/useHealthyBowlLivestockDepth.js.map +1 -1
- package/dist/healthybowl/hooks/useIrrigationAutomation.js +1 -1
- package/dist/healthybowl/hooks/useIrrigationAutomation.js.map +1 -1
- package/dist/healthybowl/hooks/useSuccessionPlanning.js +1 -1
- package/dist/healthybowl/hooks/useSuccessionPlanning.js.map +1 -1
- package/dist/healthybowl/hooks/useWeatherIntelligence.js +1 -1
- package/dist/healthybowl/hooks/useWeatherIntelligence.js.map +1 -1
- package/dist/healthybowl/offline/OfflineStatusPill.js +21 -40
- package/dist/healthybowl/offline/OfflineStatusPill.js.map +1 -1
- package/dist/healthybowl/offline/OfflineSyncProvider.js +130 -153
- package/dist/healthybowl/offline/OfflineSyncProvider.js.map +1 -1
- package/dist/healthybowl/offline/graphql.js.map +1 -1
- package/dist/healthybowl/offline/store.js +1 -1
- package/dist/healthybowl/offline/syncEngine.js +1 -2
- package/dist/healthybowl/offline/syncEngine.js.map +1 -1
- package/dist/healthybowl/offline/types.js.map +1 -1
- package/dist/healthybowl/pages/GettingStartedPage.js +0 -1
- package/dist/healthybowl/pages/GettingStartedPage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/InsightsPage.js +2 -2
- package/dist/healthybowl/pages/analytics/InsightsPage.js.map +1 -1
- package/dist/healthybowl/pages/analytics/ReportsPage.js +99 -136
- package/dist/healthybowl/pages/analytics/ReportsPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js +162 -204
- package/dist/healthybowl/pages/compliance/ComplianceOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js +178 -196
- package/dist/healthybowl/pages/compliance/IcsGroupDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js +141 -142
- package/dist/healthybowl/pages/compliance/IcsGrowerDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropFieldsPage.js +0 -2
- package/dist/healthybowl/pages/crops/CropFieldsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropHarvestPage.js +272 -316
- package/dist/healthybowl/pages/crops/CropHarvestPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/CropPlanningPage.js +0 -6
- package/dist/healthybowl/pages/crops/CropPlanningPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js +846 -871
- package/dist/healthybowl/pages/crops/FieldDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js +334 -376
- package/dist/healthybowl/pages/crops/HarvestDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js +188 -415
- package/dist/healthybowl/pages/distribution/CsaPlanDetailPage.js.map +1 -1
- package/dist/healthybowl/pages/distribution/labels.js +2 -10
- package/dist/healthybowl/pages/distribution/labels.js.map +1 -1
- package/dist/healthybowl/pages/farm/FarmProfilePage.js +0 -1
- package/dist/healthybowl/pages/farm/FarmProfilePage.js.map +1 -1
- package/dist/healthybowl/pages/field-capture/CaptureObservationForm.js +8 -8
- package/dist/healthybowl/pages/fields/FieldMapPage.js +0 -2
- package/dist/healthybowl/pages/fields/FieldMapPage.js.map +1 -1
- package/dist/healthybowl/pages/financial/FinancialReportsPage.js +107 -92
- package/dist/healthybowl/pages/financial/FinancialReportsPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +188 -228
- package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js.map +1 -1
- package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js +191 -261
- package/dist/healthybowl/pages/government-schemes/SchemeDetailsPage.js.map +1 -1
- package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js +14 -14
- package/dist/healthybowl/pages/inputs-insurance/InputsInsuranceOverviewPage.js.map +1 -1
- package/dist/healthybowl/pages/irrigation/IrrigationPage.js +307 -338
- package/dist/healthybowl/pages/irrigation/IrrigationPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js +102 -126
- package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js.map +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDepthPage.js +215 -257
- package/dist/healthybowl/pages/livestock/AnimalDepthPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/GrazingPage.js +0 -1
- package/dist/healthybowl/pages/livestock/GrazingPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/HerdDepthPage.js +0 -4
- package/dist/healthybowl/pages/livestock/HerdDepthPage.js.map +1 -1
- package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js +9 -8
- package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js.map +1 -1
- package/dist/healthybowl/pages/network/ExpertsPage.js +419 -520
- package/dist/healthybowl/pages/network/ExpertsPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +130 -129
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js.map +1 -1
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js +237 -285
- package/dist/healthybowl/pages/weather/WeatherSettingsPage.js.map +1 -1
- package/dist/healthybowl/utils/plantingCapacity.js +10 -10
- package/dist/healthybowl/utils/plantingCapacity.js.map +1 -1
- package/dist/node_modules/fast-equals/dist/es/index.js +86 -74
- package/dist/node_modules/fast-equals/dist/es/index.js.map +1 -1
- package/dist/services/assistantApi.js +30 -59
- package/dist/services/assistantApi.js.map +1 -1
- package/dist/utils/pageContext.js +1 -15
- package/dist/utils/pageContext.js.map +1 -1
- package/package.json +1 -1
- package/dist/healthybowl/hooks/useAgronomyDecisions.js +0 -79
- package/dist/healthybowl/hooks/useAgronomyDecisions.js.map +0 -1
- package/dist/healthybowl/hooks/useAnalyticsReports.js +0 -173
- package/dist/healthybowl/hooks/useAnalyticsReports.js.map +0 -1
- package/dist/healthybowl/hooks/useComplianceExports.js +0 -74
- package/dist/healthybowl/hooks/useComplianceExports.js.map +0 -1
- package/dist/healthybowl/hooks/useConsultationPayments.js +0 -59
- package/dist/healthybowl/hooks/useConsultationPayments.js.map +0 -1
- package/dist/healthybowl/hooks/usePlantingEstimate.js +0 -88
- package/dist/healthybowl/hooks/usePlantingEstimate.js.map +0 -1
- package/dist/healthybowl/offline/HeaderOfflinePill.js +0 -28
- package/dist/healthybowl/offline/HeaderOfflinePill.js.map +0 -1
- package/dist/healthybowl/offline/captureCache.js +0 -30
- package/dist/healthybowl/offline/captureCache.js.map +0 -1
- package/dist/healthybowl/offline/headerSlot.js +0 -24
- package/dist/healthybowl/offline/headerSlot.js.map +0 -1
- package/dist/healthybowl/pages/ai/AiDecisionsPage.js +0 -287
- package/dist/healthybowl/pages/ai/AiDecisionsPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/ResidueTestsPage.js +0 -291
- package/dist/healthybowl/pages/compliance/ResidueTestsPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js +0 -300
- package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js.map +0 -1
- package/dist/healthybowl/pages/compliance/substanceRuleForm.js +0 -135
- package/dist/healthybowl/pages/compliance/substanceRuleForm.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js +0 -49
- package/dist/healthybowl/pages/government-schemes/schemeApplicationTransitions.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js +0 -48
- package/dist/healthybowl/pages/government-schemes/schemeDocumentSlots.js.map +0 -1
- package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js +0 -54
- package/dist/healthybowl/pages/government-schemes/useSchemeApplicationTransition.js.map +0 -1
- package/dist/healthybowl/pages/livestock/PedigreeTree.js +0 -154
- package/dist/healthybowl/pages/livestock/PedigreeTree.js.map +0 -1
- package/dist/healthybowl/pages/livestock/eidTagInput.js +0 -39
- package/dist/healthybowl/pages/livestock/eidTagInput.js.map +0 -1
- package/dist/healthybowl/pages/livestock/pedigreeLayout.js +0 -68
- package/dist/healthybowl/pages/livestock/pedigreeLayout.js.map +0 -1
- package/dist/healthybowl/pages/weather/alertDelivery.js +0 -105
- package/dist/healthybowl/pages/weather/alertDelivery.js.map +0 -1
- package/dist/healthybowl/utils/icsInspection.js +0 -18
- package/dist/healthybowl/utils/icsInspection.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CsaPlanDetailPage.js","names":[],"sources":["../../../../src/healthybowl/pages/distribution/CsaPlanDetailPage.tsx"],"sourcesContent":["/**\n * CSA plan detail (BOFF-2884).\n * Plan header + real membership list. Per-member pause/resume/renew/cancel actions.\n * Renewing advances the membership one cycle (creates the next delivery + billing\n * cycle) and reports the new cycle number. No fabricated data.\n */\nimport { useState } from 'react';\nimport { useParams } from 'react-router';\nimport { useQuery } from '@apollo/client/react';\nimport {\n CalendarClock,\n CreditCard,\n PauseCircle,\n PlayCircle,\n RefreshCw,\n RotateCcw,\n UserPlus,\n XCircle,\n} from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n PageLayout,\n StatCard,\n DataTable,\n StatusBadge,\n EmptyState,\n ErrorState,\n PageLoader,\n Breadcrumbs,\n useConfirm,\n} from '../../components';\nimport type { Column } from '../../components';\nimport { useToast } from '../../hooks/useToast';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { formatCurrency, formatDateOnly } from '../../utils/helpers';\nimport {\n useHealthyBowlDistribution,\n GET_CSA_PLAN,\n GET_CSA_MEMBERSHIPS,\n GET_CSA_DELIVERIES,\n type CsaDelivery,\n type CsaDeliveriesData,\n type CsaMembership,\n type CsaPlanData,\n type CsaMembershipsData,\n} from '../../hooks/useHealthyBowlDistribution';\nimport { useHealthyBowlCsaPickup } from '../../hooks/useHealthyBowlCsaPickup';\nimport { loadRazorpayCheckout, useOrderPayments } from '../../hooks/useOrderPayments';\nimport { DistributionNav } from './DistributionNav';\nimport { EnrollMemberModal } from './EnrollMemberModal';\nimport {\n billingStatusVariant,\n dayName,\n membershipStatusVariant,\n paymentStatusVariant,\n planStatusVariant,\n} from './labels';\n\nconst CSA_CYCLES_PAGE_SIZE = 50;\n\nexport function memberPickupSelectorName(collectionPointLabel: string, memberName: string): string {\n return `${collectionPointLabel}: ${memberName}`;\n}\n\nexport const CsaPlanDetailPage = () => {\n const { t } = useI18n();\n const { planId } = useParams<{ planId: string }>();\n const { buildPath } = useBasePath();\n const { toast } = useToast();\n const confirm = useConfirm();\n\n const { context, enrollMember, updateMembership, cancelMembership, renewMembership, retryBilling } =\n useHealthyBowlDistribution({});\n const { checkoutOrder, syncOrderPayment } = useOrderPayments();\n\n // BOFF-6021 — the collection points a member can be pointed at, and the assignment mutation.\n const { locations: pickupLocations, assignPickupLocation } = useHealthyBowlCsaPickup({ locations: true });\n\n const planQuery = useQuery<CsaPlanData, { context: { workspaceId: string }; id: string }>(GET_CSA_PLAN, {\n variables: { context, id: planId ?? '' },\n skip: !planId,\n fetchPolicy: 'cache-and-network',\n });\n\n const membersQuery = useQuery<\n CsaMembershipsData,\n { context: { workspaceId: string }; csaPlanId: string; status: string | null; limit: number; offset: number }\n >(GET_CSA_MEMBERSHIPS, {\n variables: { context, csaPlanId: planId ?? '', status: null, limit: 100, offset: 0 },\n skip: !planId,\n fetchPolicy: 'cache-and-network',\n });\n\n const [enrollOpen, setEnrollOpen] = useState(false);\n const [busyId, setBusyId] = useState<string | null>(null);\n const [selectedMemberId, setSelectedMemberId] = useState<string | null>(null);\n const [payingDeliveryId, setPayingDeliveryId] = useState<string | null>(null);\n const [cyclesExhausted, setCyclesExhausted] = useState(false);\n const [loadingMoreCycles, setLoadingMoreCycles] = useState(false);\n\n const cyclesQuery = useQuery<\n CsaDeliveriesData,\n { context: { workspaceId: string }; csaMembershipId: string | null; limit: number; offset: number }\n >(GET_CSA_DELIVERIES, {\n variables: { context, csaMembershipId: selectedMemberId, limit: CSA_CYCLES_PAGE_SIZE, offset: 0 },\n skip: !selectedMemberId,\n fetchPolicy: 'cache-and-network',\n });\n\n const plan = planQuery.data?.getHealthyBowlCsaPlan ?? null;\n const members = membersQuery.data?.getHealthyBowlCsaMemberships ?? [];\n const cycles = cyclesQuery.data?.getHealthyBowlCsaDeliveries ?? [];\n\n const loadMoreCycles = async (): Promise<void> => {\n if (!selectedMemberId || cyclesExhausted || loadingMoreCycles) return;\n setLoadingMoreCycles(true);\n try {\n const more = await cyclesQuery.fetchMore({\n variables: {\n context,\n csaMembershipId: selectedMemberId,\n limit: CSA_CYCLES_PAGE_SIZE,\n offset: cycles.length,\n },\n updateQuery: (previous, { fetchMoreResult }) => ({\n getHealthyBowlCsaDeliveries: [\n ...(previous.getHealthyBowlCsaDeliveries ?? []),\n ...(fetchMoreResult.getHealthyBowlCsaDeliveries ?? []),\n ],\n }),\n });\n if ((more.data?.getHealthyBowlCsaDeliveries ?? []).length < CSA_CYCLES_PAGE_SIZE) {\n setCyclesExhausted(true);\n }\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.cycles.loadMoreFailed', 'Could not load more cycles'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setLoadingMoreCycles(false);\n }\n };\n\n const refresh = async () => {\n await Promise.all([\n planQuery.refetch().catch(() => undefined),\n membersQuery.refetch().catch(() => undefined),\n ...(selectedMemberId ? [cyclesQuery.refetch().catch(() => undefined)] : []),\n ]);\n };\n\n /**\n * Enroll a member, honouring the plan's capacity (BOFF-6088).\n *\n * Checked reactively — off the mutation's own refusal — rather than pre-emptively off\n * `plan.atCapacity`: the cached plan can be a beat stale (another farmer enrolling concurrently),\n * and the server's count is the one that actually gates the write. On a capacity refusal the\n * farmer gets the same deliberate-override confirm as the pickup-location gate (BOFF-6021); on\n * decline, or on any other error, the original error is rethrown so the modal stays open showing\n * it.\n */\n const handleEnroll = async (input: Record<string, unknown>) => {\n try {\n await enrollMember({ ...input, csaPlanId: planId });\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n if (!/is at capacity/i.test(message)) throw err;\n const ok = await confirm({\n title: t('healthybowl.distribution.detail.confirmPlanOverCapacity.title', 'This plan is full'),\n message: t(\n 'healthybowl.distribution.detail.confirmPlanOverCapacity.message',\n '{{error}} Enroll {{member}} anyway? The plan will show as over capacity.',\n { error: message, member: String(input.memberName ?? '') }\n ),\n okButtonTitle: t('healthybowl.distribution.detail.confirmPlanOverCapacity.confirm', 'Enroll anyway'),\n });\n if (!ok) throw err;\n await enrollMember({ ...input, csaPlanId: planId, allowOverCapacity: true });\n }\n await refresh();\n toast({\n title: t('healthybowl.distribution.detail.toast.enrolled', 'Member enrolled'),\n description: String(input.memberName ?? ''),\n variant: 'success',\n });\n };\n\n /**\n * Point a membership at a collection point, or back at home delivery (BOFF-6021).\n *\n * An over-capacity assignment is refused by default and has to be a deliberate act — an\n * over-subscribed stand is a real operational problem, so it takes a confirmation rather than\n * happening silently.\n */\n const handleAssignPickup = async (member: CsaMembership, pickupLocationId: string | null) => {\n const target = pickupLocations.find((l) => l.id === pickupLocationId);\n let allowOverCapacity = false;\n if (target?.atCapacity) {\n const ok = await confirm({\n title: t('healthybowl.distribution.detail.confirmOverCapacity.title', 'This collection point is full'),\n message: t(\n 'healthybowl.distribution.detail.confirmOverCapacity.message',\n '{{name}} has no places left. Assigning {{member}} anyway over-subscribes it — the shortfall will show on the collection points list.',\n { name: target.name, member: member.memberName }\n ),\n okButtonTitle: t('healthybowl.distribution.detail.confirmOverCapacity.confirm', 'Assign anyway'),\n });\n if (!ok) return;\n allowOverCapacity = true;\n }\n\n setBusyId(member.id);\n try {\n await assignPickupLocation(member.id, pickupLocationId, allowOverCapacity);\n await refresh();\n toast({\n title: pickupLocationId\n ? t('healthybowl.distribution.detail.toast.pickupAssigned', '{{member}} now collects from {{name}}.', {\n member: member.memberName,\n name: target?.name ?? '',\n })\n : t('healthybowl.distribution.detail.toast.pickupCleared', '{{member}} moved back to home delivery.', {\n member: member.memberName,\n }),\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.toast.pickupFailed', 'Could not change the collection point'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setBusyId((cur) => (cur === member.id ? null : cur));\n }\n };\n\n const handleTogglePause = async (member: CsaMembership) => {\n const next = member.status === 'PAUSED' ? 'ACTIVE' : 'PAUSED';\n setBusyId(member.id);\n try {\n await updateMembership({ id: member.id, status: next });\n await refresh();\n toast({\n title:\n next === 'ACTIVE'\n ? t('healthybowl.distribution.detail.toast.resumed', 'Membership resumed')\n : t('healthybowl.distribution.detail.toast.paused', 'Membership paused'),\n description: member.memberName,\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.toast.updateFailed', 'Update failed'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setBusyId(null);\n }\n };\n\n const handleRenew = async (member: CsaMembership) => {\n setBusyId(member.id);\n try {\n const updated = await renewMembership(member.id);\n await refresh();\n toast({\n title: t('healthybowl.distribution.detail.toast.renewed', 'Membership renewed'),\n description: updated\n ? t('healthybowl.distribution.detail.toast.renewedCycle', '{{name}} advanced to cycle {{cycle}}.', {\n name: member.memberName,\n cycle: updated.cycleCount,\n })\n : member.memberName,\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.toast.renewFailed', 'Renewal failed'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setBusyId(null);\n }\n };\n\n const handleCancel = async (member: CsaMembership) => {\n if (\n !(await confirm({\n title: t('healthybowl.distribution.detail.confirm.cancelTitle', 'Cancel membership?'),\n message: t(\n 'healthybowl.distribution.detail.confirm.cancel',\n 'Cancel {{name}}’s membership? This stops future deliveries and billing.',\n { name: member.memberName }\n ),\n }))\n )\n return;\n setBusyId(member.id);\n try {\n await cancelMembership(member.id);\n await refresh();\n toast({\n title: t('healthybowl.distribution.detail.toast.cancelled', 'Membership cancelled'),\n description: member.memberName,\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.toast.cancelFailed', 'Could not cancel'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setBusyId(null);\n }\n };\n\n const handleRetryBilling = async (delivery: CsaDelivery): Promise<void> => {\n setBusyId(delivery.id);\n try {\n await retryBilling(delivery.id);\n await refresh();\n toast({\n title: t('healthybowl.distribution.detail.cycles.retrySucceeded', 'Billing retry queued'),\n description: t(\n 'healthybowl.distribution.detail.cycles.retrySucceededDescription',\n 'The cycle was reconnected to its existing billing record. It was not charged again.'\n ),\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.cycles.retryFailed', 'Could not retry billing'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setBusyId(null);\n }\n };\n\n /**\n * Pay only a billing-synchronised cycle with a linked Order.\n *\n * The server rejects PENDING/FAILED cycles too. Keeping the guard here makes the UI explain the\n * state rather than opening a widget that must fail, and — critically — it never creates or marks\n * a payment itself: billing owns payment verification, syncOrderPayment only mirrors it back.\n */\n const handlePayCycle = async (delivery: CsaDelivery): Promise<void> => {\n if (!delivery.orderId || delivery.billingSyncStatus !== 'SYNCED') return;\n setPayingDeliveryId(delivery.id);\n let widgetOpened = false;\n try {\n const checkout = await checkoutOrder(delivery.orderId);\n if (checkout.provider !== 'RAZORPAY' || !checkout.providerOrderId || !checkout.razorpayKeyId) {\n throw new Error(\n t(\n 'healthybowl.distribution.detail.cycles.unsupportedProvider',\n 'Billing did not return a Razorpay payment session for this cycle.'\n )\n );\n }\n\n const Razorpay = await loadRazorpayCheckout();\n // Razorpay may invoke handler then ondismiss for one payment. Sync exactly once; billing's\n // signature-verified payment record remains the only authority on whether it was paid.\n let syncRequested = false;\n const syncOnce = () => {\n if (syncRequested) return;\n syncRequested = true;\n void (async () => {\n try {\n await syncOrderPayment(delivery.orderId as string);\n await refresh();\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.cycles.syncFailed', 'Could not refresh payment status'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setPayingDeliveryId(null);\n }\n })();\n };\n\n const widget = new Razorpay({\n key: checkout.razorpayKeyId,\n order_id: checkout.providerOrderId,\n amount: Math.round(checkout.total * 100),\n currency: checkout.currency,\n name: 'HealthyBowl',\n description: t('healthybowl.distribution.detail.cycles.paymentDescription', 'CSA box payment'),\n handler: syncOnce,\n modal: { ondismiss: syncOnce },\n });\n widget.open();\n widgetOpened = true;\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.cycles.payFailed', 'Could not start payment'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n if (!widgetOpened) setPayingDeliveryId(null);\n }\n };\n\n const columns: Column<CsaMembership>[] = [\n {\n key: 'member',\n header: t('healthybowl.distribution.detail.table.member', 'Member'),\n render: (m) => (\n <div>\n <div className=\"font-medium text-text-primary\">{m.memberName}</div>\n <div className=\"text-xs text-text-secondary\">{m.memberEmail ?? m.memberPhone ?? '—'}</div>\n </div>\n ),\n },\n {\n key: 'status',\n header: t('healthybowl.distribution.detail.table.status', 'Status'),\n render: (m) => <StatusBadge variant={membershipStatusVariant(m.status)} label={m.status} dot />,\n },\n {\n // BOFF-6021 — a member could not be pointed at a collection point from anywhere in the\n // product, so the whole BOFF-5978 pickup model was unreachable. Selecting a stand re-points\n // this member's SCHEDULED boxes too; boxes already packed or gone keep where they went.\n key: 'fulfilment',\n header: t('healthybowl.distribution.detail.table.fulfilment', 'Collection'),\n render: (m) => (\n <select\n aria-label={memberPickupSelectorName(\n t('healthybowl.distribution.detail.collectionPointForMember', 'Collection point'),\n m.memberName\n )}\n value={m.pickupLocationId ?? ''}\n disabled={busyId === m.id}\n onChange={(e) => void handleAssignPickup(m, e.target.value || null)}\n className=\"rounded-md border border-border-subtle bg-bg-surface px-2 py-1 text-xs text-text-primary disabled:opacity-60\"\n >\n <option value=\"\">{t('healthybowl.distribution.detail.homeDelivery', 'Home delivery')}</option>\n {pickupLocations\n .filter((l) => l.status === 'ACTIVE')\n .map((l) => (\n <option key={l.id} value={l.id}>\n {l.name}\n {l.atCapacity ? ` ${t('healthybowl.distribution.detail.full', '(full)')}` : ''}\n </option>\n ))}\n </select>\n ),\n },\n {\n key: 'nextDelivery',\n header: t('healthybowl.distribution.detail.table.nextDelivery', 'Next delivery'),\n render: (m) => (m.nextDeliveryDate ? formatDateOnly(m.nextDeliveryDate) : '—'),\n },\n {\n key: 'cycles',\n header: t('healthybowl.distribution.detail.table.cycles', 'Cycles'),\n render: (m) => (\n <Button\n variant={selectedMemberId === m.id ? 'secondary' : 'ghost'}\n size=\"sm\"\n onClick={() => {\n setSelectedMemberId(m.id);\n setCyclesExhausted(false);\n }}\n data-testid={`hb-csa-cycles-${m.id}`}\n >\n <CalendarClock className=\"me-1 h-3.5 w-3.5\" />\n {m.cycleCount}\n </Button>\n ),\n },\n {\n key: 'billing',\n header: t('healthybowl.distribution.detail.table.billing', 'Billing'),\n render: (m) => <StatusBadge variant={billingStatusVariant(m.billingSyncStatus)} label={m.billingSyncStatus} />,\n },\n {\n key: 'actions',\n header: '',\n render: (m) => {\n if (m.status === 'CANCELLED') {\n return (\n <span className=\"text-xs text-text-secondary\">\n {t('healthybowl.distribution.detail.table.ended', 'Ended')}\n </span>\n );\n }\n return (\n <div className=\"flex items-center justify-end gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={busyId === m.id}\n onClick={(e) => {\n e.stopPropagation();\n void handleTogglePause(m);\n }}\n aria-label={\n m.status === 'PAUSED'\n ? t('healthybowl.distribution.detail.actions.resume', 'Resume')\n : t('healthybowl.distribution.detail.actions.pause', 'Pause')\n }\n title={\n m.status === 'PAUSED'\n ? t('healthybowl.distribution.detail.actions.resume', 'Resume')\n : t('healthybowl.distribution.detail.actions.pause', 'Pause')\n }\n >\n {m.status === 'PAUSED' ? <PlayCircle className=\"h-4 w-4\" /> : <PauseCircle className=\"h-4 w-4\" />}\n </Button>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={busyId === m.id}\n onClick={(e) => {\n e.stopPropagation();\n void handleRenew(m);\n }}\n aria-label={t('healthybowl.distribution.detail.actions.renew', 'Renew (next cycle)')}\n title={t('healthybowl.distribution.detail.actions.renew', 'Renew (next cycle)')}\n >\n <RefreshCw className=\"h-4 w-4\" />\n </Button>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={busyId === m.id}\n onClick={(e) => {\n e.stopPropagation();\n void handleCancel(m);\n }}\n aria-label={t('healthybowl.distribution.detail.actions.cancel', 'Cancel')}\n title={t('healthybowl.distribution.detail.actions.cancel', 'Cancel')}\n className=\"text-text-secondary hover:text-status-error-text\"\n >\n <XCircle className=\"h-4 w-4\" />\n </Button>\n </div>\n );\n },\n },\n ];\n\n if (planQuery.loading && !plan) {\n return <PageLoader />;\n }\n\n if (planQuery.error && !plan) {\n return (\n <PageLayout title={t('healthybowl.distribution.detail.title', 'CSA plan')}>\n <DistributionNav />\n <ErrorState description={planQuery.error.message} onRetry={() => void planQuery.refetch()} />\n </PageLayout>\n );\n }\n\n if (!plan) {\n return (\n <PageLayout title={t('healthybowl.distribution.detail.title', 'CSA plan')}>\n <DistributionNav />\n <EmptyState\n title={t('healthybowl.distribution.detail.notFound.title', 'Plan not found')}\n description={t('healthybowl.distribution.detail.notFound.description', 'This CSA plan no longer exists.')}\n />\n </PageLayout>\n );\n }\n\n const activeCount = members.filter((m) => m.status === 'ACTIVE').length;\n const pausedCount = members.filter((m) => m.status === 'PAUSED').length;\n\n /**\n * Headroom, told honestly (BOFF-6088) — mirrors PickupLocationsPage's `renderHeadroom`. Null is\n * uncapped (unknown), not full; a negative remaining count is a real over-subscription (an\n * allowOverCapacity enrolment) and is shown as such, not clamped to zero.\n */\n const capacityLabel =\n plan.capacityRemaining === null\n ? plan.capacityReason === 'CAPACITY_ZERO'\n ? t('healthybowl.distribution.detail.stats.noPlaces', 'No places')\n : t('healthybowl.distribution.detail.stats.noLimit', 'No limit')\n : plan.capacityRemaining < 0\n ? t('healthybowl.distribution.detail.stats.overCapacity', '{{n}} over capacity', {\n n: Math.abs(plan.capacityRemaining),\n })\n : t('healthybowl.distribution.detail.stats.left', '{{n}} left', { n: plan.capacityRemaining });\n\n return (\n <PageLayout\n title={plan.name}\n description={plan.description ?? undefined}\n actions={\n <Button onClick={() => setEnrollOpen(true)}>\n <UserPlus className=\"h-4 w-4\" />\n {t('healthybowl.distribution.detail.actions.enroll', 'Enroll member')}\n </Button>\n }\n >\n <Breadcrumbs\n items={[\n { label: t('healthybowl.distribution.nav.csa', 'CSA Boxes'), href: buildPath('distribution/csa') },\n { label: plan.name },\n ]}\n />\n\n <div className=\"flex flex-wrap items-center gap-2\">\n <StatusBadge variant={planStatusVariant(plan.status)} label={plan.status} dot />\n <StatusBadge variant=\"info\" label={`${plan.boxSize} · ${plan.frequency}`} />\n <span className=\"inline-flex items-center gap-1.5 rounded-full border border-border-subtle bg-bg-sunken/60 px-3 py-1 text-xs text-text-secondary\">\n <CalendarClock className=\"h-3.5 w-3.5\" />\n {t('healthybowl.distribution.detail.deliveryDay', 'Delivers {{day}}', {\n day: dayName(plan.deliveryDayOfWeek),\n })}\n </span>\n <StatusBadge\n variant={billingStatusVariant(plan.billingSyncStatus)}\n label={`Billing: ${plan.billingSyncStatus}`}\n />\n </div>\n\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n label={t('healthybowl.distribution.detail.stats.price', 'Price per box')}\n value={formatCurrency(plan.price, plan.currency || 'INR')}\n hero\n />\n <StatCard label={t('healthybowl.distribution.detail.stats.active', 'Active members')} value={activeCount} />\n <StatCard label={t('healthybowl.distribution.detail.stats.paused', 'Paused')} value={pausedCount} />\n <StatCard label={t('healthybowl.distribution.detail.stats.capacity', 'Capacity')} value={capacityLabel} />\n </div>\n\n {plan.contents.length > 0 && (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h3 className=\"mb-2 text-sm font-semibold text-text-primary\">\n {t('healthybowl.distribution.detail.contents', 'Box contents')}\n </h3>\n <div className=\"flex flex-wrap gap-2\">\n {plan.contents.map((item, index) => (\n <span\n key={`${item.productName}-${index}`}\n className=\"inline-flex items-center gap-1 rounded-full border border-border-subtle bg-bg-sunken/60 px-3 py-1 text-xs text-text-secondary\"\n >\n {item.productName}\n <span className=\"text-text-primary\">\n {item.quantity} {item.unit}\n </span>\n </span>\n ))}\n </div>\n </div>\n )}\n\n <div>\n <h2 className=\"mb-3 text-lg font-semibold text-text-primary\">\n {t('healthybowl.distribution.detail.membersTitle', 'Members')}\n </h2>\n {membersQuery.loading && members.length === 0 ? (\n <PageLoader />\n ) : membersQuery.error && members.length === 0 ? (\n <ErrorState description={membersQuery.error.message} onRetry={() => void membersQuery.refetch()} />\n ) : members.length === 0 ? (\n <EmptyState\n icon={<UserPlus className=\"h-8 w-8 text-text-secondary\" />}\n title={t('healthybowl.distribution.detail.empty.title', 'No members yet')}\n description={t(\n 'healthybowl.distribution.detail.empty.description',\n 'Enroll members to start scheduling their recurring boxes.'\n )}\n action={\n <Button onClick={() => setEnrollOpen(true)}>\n <UserPlus className=\"h-4 w-4\" />\n {t('healthybowl.distribution.detail.actions.enroll', 'Enroll member')}\n </Button>\n }\n />\n ) : (\n <DataTable columns={columns} data={members} keyField=\"id\" pageSize={10} />\n )}\n </div>\n\n {selectedMemberId ? (\n <section\n aria-labelledby=\"csa-cycles-title\"\n data-testid=\"hb-csa-cycles-panel\"\n className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\"\n >\n <div className=\"mb-3 flex flex-wrap items-center justify-between gap-2\">\n <div>\n <h2 id=\"csa-cycles-title\" className=\"text-lg font-semibold text-text-primary\">\n {t('healthybowl.distribution.detail.cycles.title', 'Cycles')}\n </h2>\n <p className=\"text-sm text-text-secondary\">\n {t('healthybowl.distribution.detail.cycles.member', 'Payment history for {{member}}', {\n member: members.find((member) => member.id === selectedMemberId)?.memberName ?? '',\n })}\n </p>\n </div>\n <Button variant=\"ghost\" size=\"sm\" onClick={() => setSelectedMemberId(null)}>\n {t('healthybowl.distribution.detail.cycles.close', 'Close')}\n </Button>\n </div>\n\n {cyclesQuery.loading ? (\n <PageLoader />\n ) : cyclesQuery.error ? (\n <ErrorState description={cyclesQuery.error.message} onRetry={() => void cyclesQuery.refetch()} />\n ) : cycles.length === 0 ? (\n <EmptyState\n title={t('healthybowl.distribution.detail.cycles.empty.title', 'No cycles yet')}\n description={t(\n 'healthybowl.distribution.detail.cycles.empty.description',\n 'Cycles appear here when this member is enrolled or renewed.'\n )}\n />\n ) : (\n <>\n <div className=\"overflow-x-auto\">\n <table className=\"w-full text-start text-sm\">\n <thead className=\"border-b border-border-subtle text-text-secondary\">\n <tr>\n <th className=\"py-2 pe-3 font-medium\">\n {t('healthybowl.distribution.detail.cycles.cycle', 'Cycle')}\n </th>\n <th className=\"py-2 pe-3 font-medium\">\n {t('healthybowl.distribution.detail.cycles.date', 'Scheduled')}\n </th>\n <th className=\"py-2 pe-3 font-medium\">\n {t('healthybowl.distribution.detail.cycles.billing', 'Billing')}\n </th>\n <th className=\"py-2 pe-3 font-medium\">\n {t('healthybowl.distribution.detail.cycles.payment', 'Payment')}\n </th>\n <th className=\"py-2 font-medium\">\n {t('healthybowl.distribution.detail.cycles.actions', 'Actions')}\n </th>\n </tr>\n </thead>\n <tbody>\n {cycles.map((delivery) => {\n const isPaid = delivery.paymentStatus?.toLowerCase() === 'paid';\n const canPay = delivery.billingSyncStatus === 'SYNCED' && !!delivery.orderId && !isPaid;\n return (\n <tr key={delivery.id} className=\"border-b border-border-subtle last:border-0\">\n <td className=\"py-3 pe-3 text-text-primary\">#{delivery.cycleNumber}</td>\n <td className=\"py-3 pe-3 text-text-secondary\">{formatDateOnly(delivery.scheduledDate)}</td>\n <td className=\"py-3 pe-3\">\n <StatusBadge\n variant={billingStatusVariant(delivery.billingSyncStatus)}\n label={delivery.billingSyncStatus}\n />\n </td>\n <td className=\"py-3 pe-3\">\n <div className=\"flex flex-col gap-1\">\n <StatusBadge\n variant={paymentStatusVariant(delivery.paymentStatus)}\n label={\n delivery.paymentStatus ??\n t('healthybowl.distribution.detail.cycles.notStarted', 'Not started')\n }\n />\n {delivery.paymentReference ? (\n <span className=\"text-xs text-text-tertiary\">{delivery.paymentReference}</span>\n ) : null}\n {delivery.paidAt ? (\n <span className=\"text-xs text-text-tertiary\">{formatDateOnly(delivery.paidAt)}</span>\n ) : null}\n </div>\n </td>\n <td className=\"py-3\">\n <div className=\"flex flex-wrap gap-2\">\n {delivery.billingSyncStatus === 'FAILED' ? (\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={busyId === delivery.id}\n onClick={() => void handleRetryBilling(delivery)}\n >\n <RotateCcw className=\"me-1 h-3.5 w-3.5\" />\n {t('healthybowl.distribution.detail.cycles.retry', 'Retry billing')}\n </Button>\n ) : null}\n {canPay ? (\n <Button\n size=\"sm\"\n disabled={payingDeliveryId === delivery.id}\n onClick={() => void handlePayCycle(delivery)}\n >\n <CreditCard className=\"me-1 h-3.5 w-3.5\" />\n {t('healthybowl.distribution.detail.cycles.pay', 'Pay')}\n </Button>\n ) : null}\n </div>\n </td>\n </tr>\n );\n })}\n </tbody>\n </table>\n </div>\n {!cyclesExhausted && cycles.length >= CSA_CYCLES_PAGE_SIZE ? (\n <div className=\"mt-3 flex justify-center\">\n <Button\n variant=\"outline\"\n size=\"sm\"\n disabled={loadingMoreCycles}\n onClick={() => void loadMoreCycles()}\n >\n {loadingMoreCycles\n ? t('healthybowl.distribution.detail.cycles.loadingMore', 'Loading cycles…')\n : t('healthybowl.distribution.detail.cycles.loadMore', 'Load more cycles')}\n </Button>\n </div>\n ) : null}\n </>\n )}\n </section>\n ) : null}\n\n <EnrollMemberModal\n open={enrollOpen}\n onClose={() => setEnrollOpen(false)}\n planName={plan.name}\n onSubmit={handleEnroll}\n />\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AA2DA,IAAM,IAAuB;AAE7B,SAAgB,GAAyB,GAA8B,GAA4B;CACjG,OAAO,GAAG,EAAqB,IAAI;AACrC;AAEA,IAAa,UAA0B;CACrC,IAAM,EAAE,SAAM,GAAQ,GAChB,EAAE,cAAW,GAA8B,GAC3C,EAAE,iBAAc,EAAY,GAC5B,EAAE,aAAU,GAAS,GACrB,IAAU,GAAW,GAErB,EAAE,YAAS,iBAAc,qBAAkB,qBAAkB,oBAAiB,qBAClF,GAA2B,CAAC,CAAC,GACzB,EAAE,mBAAe,yBAAqB,EAAiB,GAGvD,EAAE,WAAW,GAAiB,6BAAyB,GAAwB,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;;AAEhB"}
|
|
1
|
+
{"version":3,"file":"CsaPlanDetailPage.js","names":[],"sources":["../../../../src/healthybowl/pages/distribution/CsaPlanDetailPage.tsx"],"sourcesContent":["/**\n * CSA plan detail (BOFF-2884).\n * Plan header + real membership list. Per-member pause/resume/renew/cancel actions.\n * Renewing advances the membership one cycle (creates the next delivery + billing\n * cycle) and reports the new cycle number. No fabricated data.\n */\nimport { useState } from 'react';\nimport { useParams } from 'react-router';\nimport { useQuery } from '@apollo/client/react';\nimport { CalendarClock, PauseCircle, PlayCircle, RefreshCw, UserPlus, XCircle } from 'lucide-react';\nimport { Button } from '@burdenoff/fe-libs/ui';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n PageLayout,\n StatCard,\n DataTable,\n StatusBadge,\n EmptyState,\n ErrorState,\n PageLoader,\n Breadcrumbs,\n useConfirm,\n} from '../../components';\nimport type { Column } from '../../components';\nimport { useToast } from '../../hooks/useToast';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { formatCurrency, formatDateOnly } from '../../utils/helpers';\nimport {\n useHealthyBowlDistribution,\n GET_CSA_PLAN,\n GET_CSA_MEMBERSHIPS,\n type CsaMembership,\n type CsaPlanData,\n type CsaMembershipsData,\n} from '../../hooks/useHealthyBowlDistribution';\nimport { useHealthyBowlCsaPickup } from '../../hooks/useHealthyBowlCsaPickup';\nimport { DistributionNav } from './DistributionNav';\nimport { EnrollMemberModal } from './EnrollMemberModal';\nimport { billingStatusVariant, dayName, membershipStatusVariant, planStatusVariant } from './labels';\n\nexport function memberPickupSelectorName(collectionPointLabel: string, memberName: string): string {\n return `${collectionPointLabel}: ${memberName}`;\n}\n\nexport const CsaPlanDetailPage = () => {\n const { t } = useI18n();\n const { planId } = useParams<{ planId: string }>();\n const { buildPath } = useBasePath();\n const { toast } = useToast();\n const confirm = useConfirm();\n\n const { context, enrollMember, updateMembership, cancelMembership, renewMembership } = useHealthyBowlDistribution({});\n\n // BOFF-6021 — the collection points a member can be pointed at, and the assignment mutation.\n const { locations: pickupLocations, assignPickupLocation } = useHealthyBowlCsaPickup({ locations: true });\n\n const planQuery = useQuery<CsaPlanData, { context: { workspaceId: string }; id: string }>(GET_CSA_PLAN, {\n variables: { context, id: planId ?? '' },\n skip: !planId,\n fetchPolicy: 'cache-and-network',\n });\n\n const membersQuery = useQuery<\n CsaMembershipsData,\n { context: { workspaceId: string }; csaPlanId: string; status: string | null; limit: number; offset: number }\n >(GET_CSA_MEMBERSHIPS, {\n variables: { context, csaPlanId: planId ?? '', status: null, limit: 100, offset: 0 },\n skip: !planId,\n fetchPolicy: 'cache-and-network',\n });\n\n const [enrollOpen, setEnrollOpen] = useState(false);\n const [busyId, setBusyId] = useState<string | null>(null);\n\n const plan = planQuery.data?.getHealthyBowlCsaPlan ?? null;\n const members = membersQuery.data?.getHealthyBowlCsaMemberships ?? [];\n\n const refresh = async () => {\n await Promise.all([planQuery.refetch().catch(() => undefined), membersQuery.refetch().catch(() => undefined)]);\n };\n\n /**\n * Enroll a member, honouring the plan's capacity (BOFF-6088).\n *\n * Checked reactively — off the mutation's own refusal — rather than pre-emptively off\n * `plan.atCapacity`: the cached plan can be a beat stale (another farmer enrolling concurrently),\n * and the server's count is the one that actually gates the write. On a capacity refusal the\n * farmer gets the same deliberate-override confirm as the pickup-location gate (BOFF-6021); on\n * decline, or on any other error, the original error is rethrown so the modal stays open showing\n * it.\n */\n const handleEnroll = async (input: Record<string, unknown>) => {\n try {\n await enrollMember({ ...input, csaPlanId: planId });\n } catch (err) {\n const message = err instanceof Error ? err.message : String(err);\n if (!/is at capacity/i.test(message)) throw err;\n const ok = await confirm({\n title: t('healthybowl.distribution.detail.confirmPlanOverCapacity.title', 'This plan is full'),\n message: t(\n 'healthybowl.distribution.detail.confirmPlanOverCapacity.message',\n '{{error}} Enroll {{member}} anyway? The plan will show as over capacity.',\n { error: message, member: String(input.memberName ?? '') }\n ),\n okButtonTitle: t('healthybowl.distribution.detail.confirmPlanOverCapacity.confirm', 'Enroll anyway'),\n });\n if (!ok) throw err;\n await enrollMember({ ...input, csaPlanId: planId, allowOverCapacity: true });\n }\n await refresh();\n toast({\n title: t('healthybowl.distribution.detail.toast.enrolled', 'Member enrolled'),\n description: String(input.memberName ?? ''),\n variant: 'success',\n });\n };\n\n /**\n * Point a membership at a collection point, or back at home delivery (BOFF-6021).\n *\n * An over-capacity assignment is refused by default and has to be a deliberate act — an\n * over-subscribed stand is a real operational problem, so it takes a confirmation rather than\n * happening silently.\n */\n const handleAssignPickup = async (member: CsaMembership, pickupLocationId: string | null) => {\n const target = pickupLocations.find((l) => l.id === pickupLocationId);\n let allowOverCapacity = false;\n if (target?.atCapacity) {\n const ok = await confirm({\n title: t('healthybowl.distribution.detail.confirmOverCapacity.title', 'This collection point is full'),\n message: t(\n 'healthybowl.distribution.detail.confirmOverCapacity.message',\n '{{name}} has no places left. Assigning {{member}} anyway over-subscribes it — the shortfall will show on the collection points list.',\n { name: target.name, member: member.memberName }\n ),\n okButtonTitle: t('healthybowl.distribution.detail.confirmOverCapacity.confirm', 'Assign anyway'),\n });\n if (!ok) return;\n allowOverCapacity = true;\n }\n\n setBusyId(member.id);\n try {\n await assignPickupLocation(member.id, pickupLocationId, allowOverCapacity);\n await refresh();\n toast({\n title: pickupLocationId\n ? t('healthybowl.distribution.detail.toast.pickupAssigned', '{{member}} now collects from {{name}}.', {\n member: member.memberName,\n name: target?.name ?? '',\n })\n : t('healthybowl.distribution.detail.toast.pickupCleared', '{{member}} moved back to home delivery.', {\n member: member.memberName,\n }),\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.toast.pickupFailed', 'Could not change the collection point'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setBusyId((cur) => (cur === member.id ? null : cur));\n }\n };\n\n const handleTogglePause = async (member: CsaMembership) => {\n const next = member.status === 'PAUSED' ? 'ACTIVE' : 'PAUSED';\n setBusyId(member.id);\n try {\n await updateMembership({ id: member.id, status: next });\n await refresh();\n toast({\n title:\n next === 'ACTIVE'\n ? t('healthybowl.distribution.detail.toast.resumed', 'Membership resumed')\n : t('healthybowl.distribution.detail.toast.paused', 'Membership paused'),\n description: member.memberName,\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.toast.updateFailed', 'Update failed'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setBusyId(null);\n }\n };\n\n const handleRenew = async (member: CsaMembership) => {\n setBusyId(member.id);\n try {\n const updated = await renewMembership(member.id);\n await refresh();\n toast({\n title: t('healthybowl.distribution.detail.toast.renewed', 'Membership renewed'),\n description: updated\n ? t('healthybowl.distribution.detail.toast.renewedCycle', '{{name}} advanced to cycle {{cycle}}.', {\n name: member.memberName,\n cycle: updated.cycleCount,\n })\n : member.memberName,\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.toast.renewFailed', 'Renewal failed'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setBusyId(null);\n }\n };\n\n const handleCancel = async (member: CsaMembership) => {\n if (\n !(await confirm({\n title: t('healthybowl.distribution.detail.confirm.cancelTitle', 'Cancel membership?'),\n message: t(\n 'healthybowl.distribution.detail.confirm.cancel',\n 'Cancel {{name}}’s membership? This stops future deliveries and billing.',\n { name: member.memberName }\n ),\n }))\n )\n return;\n setBusyId(member.id);\n try {\n await cancelMembership(member.id);\n await refresh();\n toast({\n title: t('healthybowl.distribution.detail.toast.cancelled', 'Membership cancelled'),\n description: member.memberName,\n variant: 'success',\n });\n } catch (err) {\n toast({\n title: t('healthybowl.distribution.detail.toast.cancelFailed', 'Could not cancel'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setBusyId(null);\n }\n };\n\n const columns: Column<CsaMembership>[] = [\n {\n key: 'member',\n header: t('healthybowl.distribution.detail.table.member', 'Member'),\n render: (m) => (\n <div>\n <div className=\"font-medium text-text-primary\">{m.memberName}</div>\n <div className=\"text-xs text-text-secondary\">{m.memberEmail ?? m.memberPhone ?? '—'}</div>\n </div>\n ),\n },\n {\n key: 'status',\n header: t('healthybowl.distribution.detail.table.status', 'Status'),\n render: (m) => <StatusBadge variant={membershipStatusVariant(m.status)} label={m.status} dot />,\n },\n {\n // BOFF-6021 — a member could not be pointed at a collection point from anywhere in the\n // product, so the whole BOFF-5978 pickup model was unreachable. Selecting a stand re-points\n // this member's SCHEDULED boxes too; boxes already packed or gone keep where they went.\n key: 'fulfilment',\n header: t('healthybowl.distribution.detail.table.fulfilment', 'Collection'),\n render: (m) => (\n <select\n aria-label={memberPickupSelectorName(\n t('healthybowl.distribution.detail.collectionPointForMember', 'Collection point'),\n m.memberName\n )}\n value={m.pickupLocationId ?? ''}\n disabled={busyId === m.id}\n onChange={(e) => void handleAssignPickup(m, e.target.value || null)}\n className=\"rounded-md border border-border-subtle bg-bg-surface px-2 py-1 text-xs text-text-primary disabled:opacity-60\"\n >\n <option value=\"\">{t('healthybowl.distribution.detail.homeDelivery', 'Home delivery')}</option>\n {pickupLocations\n .filter((l) => l.status === 'ACTIVE')\n .map((l) => (\n <option key={l.id} value={l.id}>\n {l.name}\n {l.atCapacity ? ` ${t('healthybowl.distribution.detail.full', '(full)')}` : ''}\n </option>\n ))}\n </select>\n ),\n },\n {\n key: 'nextDelivery',\n header: t('healthybowl.distribution.detail.table.nextDelivery', 'Next delivery'),\n render: (m) => (m.nextDeliveryDate ? formatDateOnly(m.nextDeliveryDate) : '—'),\n },\n {\n key: 'cycles',\n header: t('healthybowl.distribution.detail.table.cycles', 'Cycles'),\n render: (m) => <span className=\"tabular-nums\">{m.cycleCount}</span>,\n },\n {\n key: 'billing',\n header: t('healthybowl.distribution.detail.table.billing', 'Billing'),\n render: (m) => <StatusBadge variant={billingStatusVariant(m.billingSyncStatus)} label={m.billingSyncStatus} />,\n },\n {\n key: 'actions',\n header: '',\n render: (m) => {\n if (m.status === 'CANCELLED') {\n return (\n <span className=\"text-xs text-text-secondary\">\n {t('healthybowl.distribution.detail.table.ended', 'Ended')}\n </span>\n );\n }\n return (\n <div className=\"flex items-center justify-end gap-1\">\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={busyId === m.id}\n onClick={(e) => {\n e.stopPropagation();\n void handleTogglePause(m);\n }}\n aria-label={\n m.status === 'PAUSED'\n ? t('healthybowl.distribution.detail.actions.resume', 'Resume')\n : t('healthybowl.distribution.detail.actions.pause', 'Pause')\n }\n title={\n m.status === 'PAUSED'\n ? t('healthybowl.distribution.detail.actions.resume', 'Resume')\n : t('healthybowl.distribution.detail.actions.pause', 'Pause')\n }\n >\n {m.status === 'PAUSED' ? <PlayCircle className=\"h-4 w-4\" /> : <PauseCircle className=\"h-4 w-4\" />}\n </Button>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={busyId === m.id}\n onClick={(e) => {\n e.stopPropagation();\n void handleRenew(m);\n }}\n aria-label={t('healthybowl.distribution.detail.actions.renew', 'Renew (next cycle)')}\n title={t('healthybowl.distribution.detail.actions.renew', 'Renew (next cycle)')}\n >\n <RefreshCw className=\"h-4 w-4\" />\n </Button>\n <Button\n variant=\"ghost\"\n size=\"icon-sm\"\n disabled={busyId === m.id}\n onClick={(e) => {\n e.stopPropagation();\n void handleCancel(m);\n }}\n aria-label={t('healthybowl.distribution.detail.actions.cancel', 'Cancel')}\n title={t('healthybowl.distribution.detail.actions.cancel', 'Cancel')}\n className=\"text-text-secondary hover:text-status-error-text\"\n >\n <XCircle className=\"h-4 w-4\" />\n </Button>\n </div>\n );\n },\n },\n ];\n\n if (planQuery.loading && !plan) {\n return <PageLoader />;\n }\n\n if (planQuery.error && !plan) {\n return (\n <PageLayout title={t('healthybowl.distribution.detail.title', 'CSA plan')}>\n <DistributionNav />\n <ErrorState description={planQuery.error.message} onRetry={() => void planQuery.refetch()} />\n </PageLayout>\n );\n }\n\n if (!plan) {\n return (\n <PageLayout title={t('healthybowl.distribution.detail.title', 'CSA plan')}>\n <DistributionNav />\n <EmptyState\n title={t('healthybowl.distribution.detail.notFound.title', 'Plan not found')}\n description={t('healthybowl.distribution.detail.notFound.description', 'This CSA plan no longer exists.')}\n />\n </PageLayout>\n );\n }\n\n const activeCount = members.filter((m) => m.status === 'ACTIVE').length;\n const pausedCount = members.filter((m) => m.status === 'PAUSED').length;\n\n /**\n * Headroom, told honestly (BOFF-6088) — mirrors PickupLocationsPage's `renderHeadroom`. Null is\n * uncapped (unknown), not full; a negative remaining count is a real over-subscription (an\n * allowOverCapacity enrolment) and is shown as such, not clamped to zero.\n */\n const capacityLabel =\n plan.capacityRemaining === null\n ? plan.capacityReason === 'CAPACITY_ZERO'\n ? t('healthybowl.distribution.detail.stats.noPlaces', 'No places')\n : t('healthybowl.distribution.detail.stats.noLimit', 'No limit')\n : plan.capacityRemaining < 0\n ? t('healthybowl.distribution.detail.stats.overCapacity', '{{n}} over capacity', {\n n: Math.abs(plan.capacityRemaining),\n })\n : t('healthybowl.distribution.detail.stats.left', '{{n}} left', { n: plan.capacityRemaining });\n\n return (\n <PageLayout\n title={plan.name}\n description={plan.description ?? undefined}\n actions={\n <Button onClick={() => setEnrollOpen(true)}>\n <UserPlus className=\"h-4 w-4\" />\n {t('healthybowl.distribution.detail.actions.enroll', 'Enroll member')}\n </Button>\n }\n >\n <Breadcrumbs\n items={[\n { label: t('healthybowl.distribution.nav.csa', 'CSA Boxes'), href: buildPath('distribution/csa') },\n { label: plan.name },\n ]}\n />\n\n <div className=\"flex flex-wrap items-center gap-2\">\n <StatusBadge variant={planStatusVariant(plan.status)} label={plan.status} dot />\n <StatusBadge variant=\"info\" label={`${plan.boxSize} · ${plan.frequency}`} />\n <span className=\"inline-flex items-center gap-1.5 rounded-full border border-border-subtle bg-bg-sunken/60 px-3 py-1 text-xs text-text-secondary\">\n <CalendarClock className=\"h-3.5 w-3.5\" />\n {t('healthybowl.distribution.detail.deliveryDay', 'Delivers {{day}}', {\n day: dayName(plan.deliveryDayOfWeek),\n })}\n </span>\n <StatusBadge\n variant={billingStatusVariant(plan.billingSyncStatus)}\n label={`Billing: ${plan.billingSyncStatus}`}\n />\n </div>\n\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-4\">\n <StatCard\n label={t('healthybowl.distribution.detail.stats.price', 'Price per box')}\n value={formatCurrency(plan.price, plan.currency || 'INR')}\n hero\n />\n <StatCard label={t('healthybowl.distribution.detail.stats.active', 'Active members')} value={activeCount} />\n <StatCard label={t('healthybowl.distribution.detail.stats.paused', 'Paused')} value={pausedCount} />\n <StatCard label={t('healthybowl.distribution.detail.stats.capacity', 'Capacity')} value={capacityLabel} />\n </div>\n\n {plan.contents.length > 0 && (\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-4\">\n <h3 className=\"mb-2 text-sm font-semibold text-text-primary\">\n {t('healthybowl.distribution.detail.contents', 'Box contents')}\n </h3>\n <div className=\"flex flex-wrap gap-2\">\n {plan.contents.map((item, index) => (\n <span\n key={`${item.productName}-${index}`}\n className=\"inline-flex items-center gap-1 rounded-full border border-border-subtle bg-bg-sunken/60 px-3 py-1 text-xs text-text-secondary\"\n >\n {item.productName}\n <span className=\"text-text-primary\">\n {item.quantity} {item.unit}\n </span>\n </span>\n ))}\n </div>\n </div>\n )}\n\n <div>\n <h2 className=\"mb-3 text-lg font-semibold text-text-primary\">\n {t('healthybowl.distribution.detail.membersTitle', 'Members')}\n </h2>\n {membersQuery.loading && members.length === 0 ? (\n <PageLoader />\n ) : membersQuery.error && members.length === 0 ? (\n <ErrorState description={membersQuery.error.message} onRetry={() => void membersQuery.refetch()} />\n ) : members.length === 0 ? (\n <EmptyState\n icon={<UserPlus className=\"h-8 w-8 text-text-secondary\" />}\n title={t('healthybowl.distribution.detail.empty.title', 'No members yet')}\n description={t(\n 'healthybowl.distribution.detail.empty.description',\n 'Enroll members to start scheduling their recurring boxes.'\n )}\n action={\n <Button onClick={() => setEnrollOpen(true)}>\n <UserPlus className=\"h-4 w-4\" />\n {t('healthybowl.distribution.detail.actions.enroll', 'Enroll member')}\n </Button>\n }\n />\n ) : (\n <DataTable columns={columns} data={members} keyField=\"id\" pageSize={10} />\n )}\n </div>\n\n <EnrollMemberModal\n open={enrollOpen}\n onClose={() => setEnrollOpen(false)}\n planName={plan.name}\n onSubmit={handleEnroll}\n />\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAwCA,SAAgB,EAAyB,GAA8B,GAA4B;CACjG,OAAO,GAAG,EAAqB,IAAI;AACrC;AAEA,IAAa,UAA0B;CACrC,IAAM,EAAE,SAAM,GAAQ,GAChB,EAAE,cAAW,GAA8B,GAC3C,EAAE,iBAAc,EAAY,GAC5B,EAAE,aAAU,GAAS,GACrB,IAAU,EAAW,GAErB,EAAE,YAAS,iBAAc,qBAAkB,qBAAkB,uBAAoB,EAA2B,CAAC,CAAC,GAG9G,EAAE,WAAW,GAAiB,4BAAyB,EAAwB,EAAE,WAAW,GAAK,CAAC,GAElG,IAAY,EAAwE,GAAc;EACtG,WAAW;GAAE;GAAS,IAAI,KAAU;EAAG;EACvC,MAAM,CAAC;EACP,aAAa;CACf,CAAC,GAEK,IAAe,EAGnB,IAAqB;EACrB,WAAW;GAAE;GAAS,WAAW,KAAU;GAAI,QAAQ;GAAM,OAAO;GAAK,QAAQ;EAAE;EACnF,MAAM,CAAC;EACP,aAAa;CACf,CAAC,GAEK,CAAC,GAAY,KAAiB,EAAS,EAAK,GAC5C,CAAC,GAAQ,KAAa,EAAwB,IAAI,GAElD,IAAO,EAAU,MAAM,yBAAyB,MAChD,IAAU,EAAa,MAAM,gCAAgC,CAAC,GAE9D,IAAU,YAAY;EAC1B,MAAM,QAAQ,IAAI,CAAC,EAAU,QAAQ,EAAE,YAAY,KAAA,CAAS,GAAG,EAAa,QAAQ,EAAE,YAAY,KAAA,CAAS,CAAC,CAAC;CAC/G,GAYM,KAAe,OAAO,MAAmC;EAC7D,IAAI;GACF,MAAM,EAAa;IAAE,GAAG;I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EACS;;AAEhB"}
|
|
@@ -92,14 +92,6 @@ var e = [
|
|
|
92
92
|
default: return "muted";
|
|
93
93
|
}
|
|
94
94
|
}, u = (e) => {
|
|
95
|
-
switch (e?.toLowerCase()) {
|
|
96
|
-
case "paid": return "success";
|
|
97
|
-
case "pending":
|
|
98
|
-
case "processing": return "warning";
|
|
99
|
-
case "failed": return "error";
|
|
100
|
-
default: return "muted";
|
|
101
|
-
}
|
|
102
|
-
}, d = (e) => {
|
|
103
95
|
switch (e) {
|
|
104
96
|
case "delivered": return "success";
|
|
105
97
|
case "shipped": return "info";
|
|
@@ -108,7 +100,7 @@ var e = [
|
|
|
108
100
|
default: return "muted";
|
|
109
101
|
}
|
|
110
102
|
};
|
|
111
|
-
function
|
|
103
|
+
function d(e = /* @__PURE__ */ new Date()) {
|
|
112
104
|
let t = new Date(e.getFullYear(), e.getMonth(), e.getDate()), n = (t.getDay() + 6) % 7, r = new Date(t);
|
|
113
105
|
r.setDate(t.getDate() - n);
|
|
114
106
|
let i = new Date(r);
|
|
@@ -120,6 +112,6 @@ function f(e = /* @__PURE__ */ new Date()) {
|
|
|
120
112
|
};
|
|
121
113
|
}
|
|
122
114
|
//#endregion
|
|
123
|
-
export { n as CHANNEL_TABS, e as DAY_NAMES, l as billingStatusVariant, r as channelLabel,
|
|
115
|
+
export { n as CHANNEL_TABS, e as DAY_NAMES, l as billingStatusVariant, r as channelLabel, d as currentIsoWeek, t as dayName, a as membershipStatusVariant, u as orderStatusVariant, i as planStatusVariant, s as routeStatusVariant, c as stopStatusVariant, o as wholesaleStatusVariant };
|
|
124
116
|
|
|
125
117
|
//# sourceMappingURL=labels.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"labels.js","names":[],"sources":["../../../../src/healthybowl/pages/distribution/labels.ts"],"sourcesContent":["/**\n * Shared label + status-variant helpers for the Distribution views (BOFF-2884).\n * Keeps the enum→display vocabulary in one place so every page maps the backend's\n * String-typed status fields onto the same `StatusBadge` variants.\n */\nimport type { DeliveryAddress } from '../../hooks/useHealthyBowlDistribution';\n\ntype BadgeVariant = 'success' | 'warning' | 'error' | 'info' | 'default' | 'muted';\n\n/** 0 = Sunday … 6 = Saturday (matches the backend's deliveryDayOfWeek). */\nexport const DAY_NAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] as const;\n\nexport const dayName = (dow: number): string => DAY_NAMES[((dow % 7) + 7) % 7] ?? '—';\n\n/** Channel tabs: label + the backend `channel` filter value (null = all). */\nexport const CHANNEL_TABS: Array<{ key: string; label: string; value: string | null }> = [\n { key: 'ALL', label: 'All', value: null },\n { key: 'CSA', label: 'CSA', value: 'CSA_SUBSCRIPTION' },\n { key: 'WHOLESALE', label: 'Wholesale', value: 'WHOLESALE' },\n { key: 'FARMERS_MARKET', label: 'Farmers Market', value: 'FARMERS_MARKET' },\n { key: 'DIRECT', label: 'Direct', value: 'DIRECT' },\n // BOFF-6023 — a co-op selling a pooled lot on behalf of its member farms.\n { key: 'AGGREGATION', label: 'Aggregation', value: 'AGGREGATION' },\n];\n\nexport const channelLabel = (channel: string): string => {\n switch (channel) {\n case 'CSA_SUBSCRIPTION':\n return 'CSA';\n case 'WHOLESALE':\n return 'Wholesale';\n case 'FARMERS_MARKET':\n return 'Farmers Market';\n case 'DIRECT':\n return 'Direct';\n case 'AGGREGATION':\n return 'Aggregation';\n default:\n return channel;\n }\n};\n\nexport const planStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'ACTIVE':\n return 'success';\n case 'PAUSED':\n return 'warning';\n case 'ARCHIVED':\n return 'muted';\n default:\n return 'muted';\n }\n};\n\nexport const membershipStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'ACTIVE':\n return 'success';\n case 'PAUSED':\n return 'warning';\n case 'CANCELLED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\nexport const deliveryStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'DELIVERED':\n return 'success';\n case 'DISPATCHED':\n return 'info';\n case 'PACKED':\n return 'warning';\n case 'SKIPPED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\nexport const wholesaleStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'FULFILLED':\n return 'success';\n case 'PACKING':\n return 'info';\n case 'CONFIRMED':\n return 'warning';\n case 'CANCELLED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\nexport const routeStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'COMPLETED':\n return 'success';\n case 'IN_PROGRESS':\n return 'info';\n case 'PLANNED':\n return 'warning';\n case 'CANCELLED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\nexport const stopStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'DELIVERED':\n return 'success';\n case 'ARRIVED':\n return 'info';\n case 'FAILED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\nexport const billingStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'SYNCED':\n return 'success';\n case 'PENDING':\n return 'warning';\n case 'FAILED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\
|
|
1
|
+
{"version":3,"file":"labels.js","names":[],"sources":["../../../../src/healthybowl/pages/distribution/labels.ts"],"sourcesContent":["/**\n * Shared label + status-variant helpers for the Distribution views (BOFF-2884).\n * Keeps the enum→display vocabulary in one place so every page maps the backend's\n * String-typed status fields onto the same `StatusBadge` variants.\n */\nimport type { DeliveryAddress } from '../../hooks/useHealthyBowlDistribution';\n\ntype BadgeVariant = 'success' | 'warning' | 'error' | 'info' | 'default' | 'muted';\n\n/** 0 = Sunday … 6 = Saturday (matches the backend's deliveryDayOfWeek). */\nexport const DAY_NAMES = ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'] as const;\n\nexport const dayName = (dow: number): string => DAY_NAMES[((dow % 7) + 7) % 7] ?? '—';\n\n/** Channel tabs: label + the backend `channel` filter value (null = all). */\nexport const CHANNEL_TABS: Array<{ key: string; label: string; value: string | null }> = [\n { key: 'ALL', label: 'All', value: null },\n { key: 'CSA', label: 'CSA', value: 'CSA_SUBSCRIPTION' },\n { key: 'WHOLESALE', label: 'Wholesale', value: 'WHOLESALE' },\n { key: 'FARMERS_MARKET', label: 'Farmers Market', value: 'FARMERS_MARKET' },\n { key: 'DIRECT', label: 'Direct', value: 'DIRECT' },\n // BOFF-6023 — a co-op selling a pooled lot on behalf of its member farms.\n { key: 'AGGREGATION', label: 'Aggregation', value: 'AGGREGATION' },\n];\n\nexport const channelLabel = (channel: string): string => {\n switch (channel) {\n case 'CSA_SUBSCRIPTION':\n return 'CSA';\n case 'WHOLESALE':\n return 'Wholesale';\n case 'FARMERS_MARKET':\n return 'Farmers Market';\n case 'DIRECT':\n return 'Direct';\n case 'AGGREGATION':\n return 'Aggregation';\n default:\n return channel;\n }\n};\n\nexport const planStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'ACTIVE':\n return 'success';\n case 'PAUSED':\n return 'warning';\n case 'ARCHIVED':\n return 'muted';\n default:\n return 'muted';\n }\n};\n\nexport const membershipStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'ACTIVE':\n return 'success';\n case 'PAUSED':\n return 'warning';\n case 'CANCELLED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\nexport const deliveryStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'DELIVERED':\n return 'success';\n case 'DISPATCHED':\n return 'info';\n case 'PACKED':\n return 'warning';\n case 'SKIPPED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\nexport const wholesaleStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'FULFILLED':\n return 'success';\n case 'PACKING':\n return 'info';\n case 'CONFIRMED':\n return 'warning';\n case 'CANCELLED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\nexport const routeStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'COMPLETED':\n return 'success';\n case 'IN_PROGRESS':\n return 'info';\n case 'PLANNED':\n return 'warning';\n case 'CANCELLED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\nexport const stopStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'DELIVERED':\n return 'success';\n case 'ARRIVED':\n return 'info';\n case 'FAILED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\nexport const billingStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'SYNCED':\n return 'success';\n case 'PENDING':\n return 'warning';\n case 'FAILED':\n return 'error';\n default:\n return 'muted';\n }\n};\n\n/** Human label for the ISO order status coming off channel orders (lowercase). */\nexport const orderStatusVariant = (status: string): BadgeVariant => {\n switch (status) {\n case 'delivered':\n return 'success';\n case 'shipped':\n return 'info';\n case 'confirmed':\n return 'warning';\n case 'cancelled':\n return 'error';\n default:\n return 'muted';\n }\n};\n\n/** Format the JSON delivery address into a single readable line. */\nexport function formatAddress(address: DeliveryAddress): string {\n if (!address) return '';\n if (typeof address === 'string') return address;\n const parts: string[] = [];\n for (const key of ['line1', 'line2', 'street', 'area', 'city', 'district', 'state', 'pincode', 'postalCode']) {\n const value = address[key];\n if (typeof value === 'string' && value.trim()) parts.push(value.trim());\n }\n if (parts.length > 0) return parts.join(', ');\n // Fallback: show the raw string values of the object so nothing is fabricated.\n const values = Object.values(address).filter((v): v is string => typeof v === 'string' && v.trim() !== '');\n return values.join(', ');\n}\n\n/** ISO week Mon–Sun range covering `ref` (default: today), as YYYY-MM-DD strings. */\nexport function currentIsoWeek(ref: Date = new Date()): { fromDate: string; toDate: string } {\n const d = new Date(ref.getFullYear(), ref.getMonth(), ref.getDate());\n const day = d.getDay(); // 0 = Sun … 6 = Sat\n const diffToMonday = (day + 6) % 7; // days since Monday\n const monday = new Date(d);\n monday.setDate(d.getDate() - diffToMonday);\n const sunday = new Date(monday);\n sunday.setDate(monday.getDate() + 6);\n const iso = (x: Date): string => {\n const y = x.getFullYear();\n const m = String(x.getMonth() + 1).padStart(2, '0');\n const dd = String(x.getDate()).padStart(2, '0');\n return `${y}-${m}-${dd}`;\n };\n return { fromDate: iso(monday), toDate: iso(sunday) };\n}\n"],"mappings":";AAUA,IAAa,IAAY;CAAC;CAAU;CAAU;CAAW;CAAa;CAAY;CAAU;AAAU,GAEzF,KAAW,MAAwB,GAAY,IAAM,IAAK,KAAK,MAAM,KAGrE,IAA4E;CACvF;EAAE,KAAK;EAAO,OAAO;EAAO,OAAO;CAAK;CACxC;EAAE,KAAK;EAAO,OAAO;EAAO,OAAO;CAAmB;CACtD;EAAE,KAAK;EAAa,OAAO;EAAa,OAAO;CAAY;CAC3D;EAAE,KAAK;EAAkB,OAAO;EAAkB,OAAO;CAAiB;CAC1E;EAAE,KAAK;EAAU,OAAO;EAAU,OAAO;CAAS;CAElD;EAAE,KAAK;EAAe,OAAO;EAAe,OAAO;CAAc;AACnE,GAEa,KAAgB,MAA4B;CACvD,QAAQ,GAAR;EACE,KAAK,oBACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,kBACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,KAAK,eACH,OAAO;EACT,SACE,OAAO;CACX;AACF,GAEa,KAAqB,MAAiC;CACjE,QAAQ,GAAR;EACE,KAAK,UACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,KAAK,YACH,OAAO;EACT,SACE,OAAO;CACX;AACF,GAEa,KAA2B,MAAiC;CACvE,QAAQ,GAAR;EACE,KAAK,UACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,SACE,OAAO;CACX;AACF,GAiBa,KAA0B,MAAiC;CACtE,QAAQ,GAAR;EACE,KAAK,aACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,SACE,OAAO;CACX;AACF,GAEa,KAAsB,MAAiC;CAClE,QAAQ,GAAR;EACE,KAAK,aACH,OAAO;EACT,KAAK,eACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,SACE,OAAO;CACX;AACF,GAEa,KAAqB,MAAiC;CACjE,QAAQ,GAAR;EACE,KAAK,aACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,SACE,OAAO;CACX;AACF,GAEa,KAAwB,MAAiC;CACpE,QAAQ,GAAR;EACE,KAAK,UACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,UACH,OAAO;EACT,SACE,OAAO;CACX;AACF,GAGa,KAAsB,MAAiC;CAClE,QAAQ,GAAR;EACE,KAAK,aACH,OAAO;EACT,KAAK,WACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,KAAK,aACH,OAAO;EACT,SACE,OAAO;CACX;AACF;AAkBA,SAAgB,EAAe,oBAAY,IAAI,KAAK,GAAyC;CAC3F,IAAM,IAAI,IAAI,KAAK,EAAI,YAAY,GAAG,EAAI,SAAS,GAAG,EAAI,QAAQ,CAAC,GAE7D,KADM,EAAE,OACQ,IAAM,KAAK,GAC3B,IAAS,IAAI,KAAK,CAAC;CACzB,EAAO,QAAQ,EAAE,QAAQ,IAAI,CAAY;CACzC,IAAM,IAAS,IAAI,KAAK,CAAM;CAC9B,EAAO,QAAQ,EAAO,QAAQ,IAAI,CAAC;CACnC,IAAM,KAAO,MAIJ,GAHG,EAAE,YAGF,EAAE,GAFF,OAAO,EAAE,SAAS,IAAI,CAAC,EAAE,SAAS,GAAG,GAEhC,EAAE,GADN,OAAO,EAAE,QAAQ,CAAC,EAAE,SAAS,GAAG,GACvB;CAEtB,OAAO;EAAE,UAAU,EAAI,CAAM;EAAG,QAAQ,EAAI,CAAM;CAAE;AACtD"}
|
|
@@ -37,7 +37,6 @@ var v = ({ icon: e, label: t, value: n }) => /* @__PURE__ */ m("div", {
|
|
|
37
37
|
k(b.name ?? ""), j(b.location ?? ""), q(typeof b.latitude == "number" ? String(b.latitude) : ""), Y(typeof b.longitude == "number" ? String(b.longitude) : ""), N(String(b.totalArea ?? "")), F(b.areaUnit === "hectares" ? "hectares" : "acres"), L(b.owner ?? ""), z(!!b.organicCertified), V(b.certificationBody ?? ""), U(b.certificationDate ?? ""), G(b.imageIds ?? []), T(!0);
|
|
38
38
|
};
|
|
39
39
|
return be && !Q ? /* @__PURE__ */ p(t, {
|
|
40
|
-
testId: "farm-profile-page",
|
|
41
40
|
title: y("healthybowl.farm.profile.title", "My Farm"),
|
|
42
41
|
description: y("healthybowl.farm.profile.subtitle", "Your farm profile and organic certification"),
|
|
43
42
|
children: /* @__PURE__ */ p(te, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FarmProfilePage.js","names":[],"sources":["../../../../src/healthybowl/pages/farm/FarmProfilePage.tsx"],"sourcesContent":["import { type FC, type ReactNode, useState } from 'react';\nimport { useNavigate } from 'react-router';\nimport { MapPin, Ruler, User, ShieldCheck, Edit, Tractor, Award, Calendar, LocateFixed } from 'lucide-react';\nimport {\n PageLayout,\n StatusBadge,\n EmptyState,\n ErrorState,\n Modal,\n LoadingSkeleton,\n HBEntityImages,\n} from '../../components';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { useToast } from '../../hooks/useToast';\nimport { ToastContainer } from '../../components/Toast';\nimport { formatDate } from '../../utils/helpers';\nimport { captureGps, formatGps } from '../../offline/geolocation';\nimport { readFarmCoordinateDraft } from '../../utils/farmCoordinates';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n GlassCard,\n Button,\n Select,\n SelectTrigger,\n SelectValue,\n SelectContent,\n SelectItem,\n} from '@burdenoff/fe-libs/ui';\n\nconst DetailRow: FC<{ icon: ReactNode; label: string; value: string }> = ({ icon, label, value }) => (\n <div className=\"flex items-start gap-3\">\n <span className=\"mt-0.5 text-text-secondary\">{icon}</span>\n <div>\n <p className=\"text-xs text-text-secondary\">{label}</p>\n <p className=\"text-sm font-semibold text-text-primary\">{value}</p>\n </div>\n </div>\n);\n\n// \"My Farm\" — view + edit the workspace's farm profile. The app is single-farm\n// (the dashboard exposes one `farm`), so this is a profile page, not a list.\n// Persists via the real updateFarm mutation (already deployed). Farm CREATION\n// lives in the onboarding flow, so a missing farm routes to Getting Started\n// rather than duplicating a create form here.\nexport const FarmProfilePage: FC = () => {\n const { t } = useI18n();\n const { farm, updateFarm, loading, error, errors } = useHealthyBowlData();\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { toasts, toast, dismiss } = useToast();\n\n const [showEdit, setShowEdit] = useState(false);\n const [submitting, setSubmitting] = useState(false);\n\n const [name, setName] = useState('');\n const [location, setLocation] = useState('');\n const [totalArea, setTotalArea] = useState('');\n const [areaUnit, setAreaUnit] = useState<'acres' | 'hectares'>('acres');\n const [owner, setOwner] = useState('');\n const [organicCertified, setOrganicCertified] = useState(false);\n const [certificationBody, setCertificationBody] = useState('');\n const [certificationDate, setCertificationDate] = useState('');\n const [imageIds, setImageIds] = useState<string[]>([]);\n const [latitude, setLatitude] = useState('');\n const [longitude, setLongitude] = useState('');\n const [locating, setLocating] = useState(false);\n\n const hasFarm = Boolean(farm.id);\n const hasCoordinates = typeof farm.latitude === 'number' && typeof farm.longitude === 'number';\n\n const openEdit = () => {\n setName(farm.name ?? '');\n setLocation(farm.location ?? '');\n setLatitude(typeof farm.latitude === 'number' ? String(farm.latitude) : '');\n setLongitude(typeof farm.longitude === 'number' ? String(farm.longitude) : '');\n setTotalArea(String(farm.totalArea ?? ''));\n setAreaUnit(farm.areaUnit === 'hectares' ? 'hectares' : 'acres');\n setOwner(farm.owner ?? '');\n setOrganicCertified(Boolean(farm.organicCertified));\n setCertificationBody(farm.certificationBody ?? '');\n setCertificationDate(farm.certificationDate ?? '');\n setImageIds(farm.imageIds ?? []);\n setShowEdit(true);\n };\n\n /**\n * Ask the device for a fix. `captureGps` resolves null on denial/timeout/unsupported and\n * discards the underlying error, so we can only say \"we could not read it\" — the fields stay\n * editable so a coordinate can always be typed by hand.\n */\n const handleUseMyLocation = async () => {\n setLocating(true);\n try {\n const fix = await captureGps({ highAccuracy: true });\n if (!fix) {\n toast({\n title: t('healthybowl.farm.profile.toast.locationUnavailable.title', 'Could not read your location'),\n description: t(\n 'healthybowl.farm.profile.toast.locationUnavailable.description',\n 'Your browser blocked or timed out the location request. You can type the coordinates in by hand.'\n ),\n variant: 'warning',\n });\n return;\n }\n setLatitude(fix.latitude.toFixed(6));\n setLongitude(fix.longitude.toFixed(6));\n toast({\n title: t('healthybowl.farm.profile.toast.locationCaptured.title', 'Location captured'),\n description: formatGps(fix.latitude, fix.longitude),\n variant: 'success',\n });\n } finally {\n setLocating(false);\n }\n };\n\n const handleUpdate = async () => {\n if (!name.trim() || !location.trim() || !owner.trim() || !(Number(totalArea) > 0)) {\n toast({\n title: t('healthybowl.farm.profile.toast.missingFields.title', 'Missing required fields'),\n description: t(\n 'healthybowl.farm.profile.toast.missingFields.description',\n 'Name, location and owner are required, and area must be greater than 0.'\n ),\n variant: 'warning',\n });\n return;\n }\n // Coordinates are all-or-nothing: the pair is meaningless half-filled, and the server\n // refuses a partial or out-of-range pair rather than silently dropping it (BOFF-6122).\n const coords = readFarmCoordinateDraft({ latitude, longitude });\n if (coords.kind === 'unpaired') {\n toast({\n title: t('healthybowl.farm.profile.toast.coordsPaired.title', 'Enter both coordinates'),\n description: t(\n 'healthybowl.farm.profile.toast.coordsPaired.description',\n 'Latitude and longitude go together — fill in both, or clear both.'\n ),\n variant: 'warning',\n });\n return;\n }\n if (coords.kind === 'outOfRange') {\n toast({\n title: t('healthybowl.farm.profile.toast.coordsRange.title', 'Coordinates out of range'),\n description: t(\n 'healthybowl.farm.profile.toast.coordsRange.description',\n 'Latitude must be between -90 and 90, and longitude between -180 and 180.'\n ),\n variant: 'warning',\n });\n return;\n }\n setSubmitting(true);\n try {\n await updateFarm({\n id: farm.id,\n name: name.trim(),\n location: location.trim(),\n totalArea: Number(totalArea),\n areaUnit,\n owner: owner.trim(),\n organicCertified,\n certificationBody: organicCertified ? certificationBody.trim() || undefined : undefined,\n certificationDate: organicCertified ? certificationDate || undefined : undefined,\n imageIds,\n // Omitted when empty. The server then leaves any stored pin alone unless `location`\n // actually changed, in which case it clears it so the next weather read re-geocodes.\n ...(coords.kind === 'valid' ? { latitude: coords.latitude, longitude: coords.longitude } : {}),\n });\n toast({\n title: t('healthybowl.farm.profile.toast.updated.title', 'Farm updated'),\n description: t('healthybowl.farm.profile.toast.updated.description', '{{name}} has been saved.', {\n name: name.trim(),\n }),\n variant: 'success',\n });\n setShowEdit(false);\n } catch (err) {\n toast({\n title: t('healthybowl.farm.profile.toast.updateFailed.title', 'Update failed'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setSubmitting(false);\n }\n };\n\n if (loading && !hasFarm) {\n return (\n <PageLayout\n testId=\"farm-profile-page\"\n title={t('healthybowl.farm.profile.title', 'My Farm')}\n description={t('healthybowl.farm.profile.subtitle', 'Your farm profile and organic certification')}\n >\n <LoadingSkeleton variant=\"card\" count={2} />\n </PageLayout>\n );\n }\n\n if (error && !hasFarm) {\n return (\n <PageLayout\n title={t('healthybowl.farm.profile.title', 'My Farm')}\n description={t('healthybowl.farm.profile.subtitle', 'Your farm profile and organic certification')}\n >\n <EmptyState\n icon={<Tractor className=\"h-12 w-12\" />}\n title={t('healthybowl.farm.profile.loadError.title', 'Unable to load your farm')}\n description={error.message}\n />\n </PageLayout>\n );\n }\n\n if (!hasFarm) {\n return (\n <PageLayout\n title={t('healthybowl.farm.profile.title', 'My Farm')}\n description={t('healthybowl.farm.profile.subtitle', 'Your farm profile and organic certification')}\n >\n {errors.crops ? (\n <ErrorState />\n ) : (\n <EmptyState\n illustration=\"onboarding\"\n title={t('healthybowl.farm.profile.emptyState.title', 'No farm set up yet')}\n description={t(\n 'healthybowl.farm.profile.emptyState.description',\n 'Set up your farm to start tracking crops, livestock, finances and certifications.'\n )}\n action={\n <Button onClick={() => navigate(buildPath('getting-started'))}>\n {t('healthybowl.farm.profile.emptyState.action', 'Set up your farm')}\n </Button>\n }\n />\n )}\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title={farm.name}\n description={t('healthybowl.farm.profile.header.description', '{{location}} · {{area}} {{unit}}', {\n location: farm.location,\n area: farm.totalArea,\n unit: farm.areaUnit,\n })}\n actions={\n <Button variant=\"outline\" onClick={openEdit}>\n <Edit className=\"h-4 w-4\" /> {t('healthybowl.farm.profile.actions.edit', 'Edit Farm')}\n </Button>\n }\n purpose=\"Your farm's identity — name, location, size and certification status. This is the foundation everything else builds on; keep it accurate so your fields, crops, livestock and records all line up correctly.\"\n nextSteps={[\n {\n id: 'edit',\n label: t('healthybowl.farm.profile.nextSteps.edit.label', 'Complete your farm details'),\n description: t(\n 'healthybowl.farm.profile.nextSteps.edit.desc',\n 'Fill in location, size and certification so the rest of HealthyBowl is accurate.'\n ),\n onClick: openEdit,\n },\n {\n id: 'fields',\n label: t('healthybowl.farm.profile.nextSteps.fields.label', 'Add your fields'),\n description: t(\n 'healthybowl.farm.profile.nextSteps.fields.desc',\n 'Map the plots you farm so you can track crops and soil per field.'\n ),\n href: buildPath('crops/fields'),\n },\n {\n id: 'crops',\n label: t('healthybowl.farm.profile.nextSteps.crops.label', 'Register your crops'),\n description: t(\n 'healthybowl.farm.profile.nextSteps.crops.desc',\n 'Start tracking what you’re growing across your fields.'\n ),\n href: buildPath('crops'),\n },\n ]}\n nextStepsKey=\"healthybowl-farm-profile\"\n >\n <div className=\"flex flex-wrap items-center gap-3\">\n {farm.organicCertified ? (\n <StatusBadge label={t('healthybowl.farm.profile.badge.certified', 'Organic Certified')} variant=\"success\" />\n ) : (\n <StatusBadge label={t('healthybowl.farm.profile.badge.notCertified', 'Not Certified')} variant=\"muted\" />\n )}\n </div>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-2\">\n {/* Farm details */}\n <GlassCard treatment=\"glass\" glow className=\"border-border-seam p-6\">\n <h3 className=\"mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary\">\n <Tractor className=\"h-4 w-4 text-primary\" /> {t('healthybowl.farm.profile.details.heading', 'Farm Details')}\n </h3>\n <div className=\"space-y-4\">\n <DetailRow\n icon={<MapPin className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.details.location', 'Location')}\n value={farm.location}\n />\n {hasCoordinates && (\n <DetailRow\n icon={<LocateFixed className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.details.coordinates', 'Coordinates')}\n value={formatGps(farm.latitude as number, farm.longitude as number)}\n />\n )}\n <DetailRow\n icon={<Ruler className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.details.totalArea', 'Total Area')}\n value={t('healthybowl.farm.profile.details.areaValue', '{{area}} {{unit}}', {\n area: farm.totalArea,\n unit: farm.areaUnit,\n })}\n />\n <DetailRow\n icon={<User className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.details.owner', 'Owner')}\n value={farm.owner}\n />\n {(farm.imageIds ?? []).length > 0 && (\n <div>\n <p className=\"mb-2 text-xs text-text-secondary\">\n {t('healthybowl.farm.profile.details.photos', 'Photos')}\n </p>\n <HBEntityImages entity=\"Farm\" imageIds={farm.imageIds ?? []} onChange={() => {}} readOnly />\n </div>\n )}\n </div>\n </GlassCard>\n\n {/* Certification */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-6\">\n <h3 className=\"mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary\">\n <ShieldCheck className=\"h-4 w-4 text-primary\" />{' '}\n {t('healthybowl.farm.profile.certification.heading', 'Organic Certification')}\n </h3>\n {farm.organicCertified ? (\n <div className=\"space-y-4\">\n <DetailRow\n icon={<Award className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.certification.body', 'Certification Body')}\n value={farm.certificationBody || '—'}\n />\n <DetailRow\n icon={<Calendar className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.certification.certifiedOn', 'Certified On')}\n value={farm.certificationDate ? formatDate(farm.certificationDate) : '—'}\n />\n </div>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {t(\n 'healthybowl.farm.profile.certification.notCertifiedMessage',\n 'This farm is not marked as organic certified. Edit the farm to add certification details.'\n )}\n </p>\n )}\n </div>\n </div>\n\n {/* Edit Farm Modal */}\n <Modal\n open={showEdit}\n onClose={() => setShowEdit(false)}\n title={t('healthybowl.farm.profile.modal.title', 'Edit Farm')}\n description={t('healthybowl.farm.profile.modal.description', 'Update details for {{name}}', {\n name: farm.name,\n })}\n size=\"lg\"\n footer={\n <>\n <Button variant=\"outline\" onClick={() => setShowEdit(false)} className=\"text-text-secondary\">\n {t('healthybowl.common.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleUpdate} disabled={submitting}>\n {submitting\n ? t('healthybowl.farm.profile.modal.saving', 'Saving...')\n : t('healthybowl.farm.profile.modal.save', 'Save Changes')}\n </Button>\n </>\n }\n >\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"farm-name\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.name.label', 'Farm Name *')}\n </label>\n <input\n id=\"farm-name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n className=\"mt-1 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 />\n </div>\n <div>\n <label htmlFor=\"location\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.location.label', 'Location *')}\n </label>\n <input\n id=\"location\"\n type=\"text\"\n value={location}\n onChange={(e) => {\n setLocation(e.target.value);\n // Moving the farm invalidates the old pin (spec 01). Clearing the inputs here\n // keeps the form honest about what will be saved.\n setLatitude('');\n setLongitude('');\n }}\n className=\"mt-1 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 />\n </div>\n <div>\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.coordinates.label', 'Coordinates')}\n </span>\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={handleUseMyLocation} disabled={locating}>\n <LocateFixed className=\"h-4 w-4\" />\n {locating\n ? t('healthybowl.farm.profile.form.coordinates.locating', 'Locating…')\n : t('healthybowl.farm.profile.form.coordinates.useMyLocation', 'Use my location')}\n </Button>\n </div>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t(\n 'healthybowl.farm.profile.form.coordinates.help',\n 'Optional. Pins the exact spot used for weather instead of guessing from the location name.'\n )}\n </p>\n <div className=\"mt-2 grid grid-cols-2 gap-3\">\n <div>\n <label htmlFor=\"latitude\" className=\"text-xs text-text-secondary\">\n {t('healthybowl.farm.profile.form.latitude.label', 'Latitude')}\n </label>\n <input\n id=\"latitude\"\n type=\"number\"\n step=\"any\"\n value={latitude}\n onChange={(e) => setLatitude(e.target.value)}\n className=\"mt-1 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 />\n </div>\n <div>\n <label htmlFor=\"longitude\" className=\"text-xs text-text-secondary\">\n {t('healthybowl.farm.profile.form.longitude.label', 'Longitude')}\n </label>\n <input\n id=\"longitude\"\n type=\"number\"\n step=\"any\"\n value={longitude}\n onChange={(e) => setLongitude(e.target.value)}\n className=\"mt-1 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 />\n </div>\n </div>\n </div>\n <div>\n <label htmlFor=\"totalArea\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.totalArea.label', 'Total Area *')}\n </label>\n <input\n id=\"totalArea\"\n type=\"number\"\n min={0}\n value={totalArea}\n onChange={(e) => setTotalArea(e.target.value)}\n className=\"mt-1 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 />\n </div>\n <div>\n <label htmlFor=\"areaUnit\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.areaUnit.label', 'Area Unit')}\n </label>\n <Select value={areaUnit} onValueChange={(value) => setAreaUnit(value as 'acres' | 'hectares')}>\n <SelectTrigger id=\"areaUnit\" className=\"mt-1 w-full\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"acres\">{t('healthybowl.farm.profile.form.areaUnit.acres', 'Acres')}</SelectItem>\n <SelectItem value=\"hectares\">\n {t('healthybowl.farm.profile.form.areaUnit.hectares', 'Hectares')}\n </SelectItem>\n </SelectContent>\n </Select>\n </div>\n <div className=\"sm:col-span-2\">\n <label htmlFor=\"owner\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.owner.label', 'Owner *')}\n </label>\n <input\n id=\"owner\"\n type=\"text\"\n value={owner}\n onChange={(e) => setOwner(e.target.value)}\n className=\"mt-1 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 />\n </div>\n <div className=\"sm:col-span-2\">\n <label className=\"flex cursor-pointer items-center gap-2 text-sm font-medium text-text-primary\">\n <input\n type=\"checkbox\"\n checked={organicCertified}\n onChange={(e) => setOrganicCertified(e.target.checked)}\n className=\"h-4 w-4 rounded border-border-subtle text-primary focus:ring-[var(--color-focus-ring)]\"\n />\n {t('healthybowl.farm.profile.form.organicCertified.label', 'Organic Certified')}\n </label>\n </div>\n {organicCertified ? (\n <>\n <div>\n <label htmlFor=\"certificationBody\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.certificationBody.label', 'Certification Body')}\n </label>\n <input\n id=\"certificationBody\"\n type=\"text\"\n value={certificationBody}\n onChange={(e) => setCertificationBody(e.target.value)}\n placeholder={t(\n 'healthybowl.farm.profile.form.certificationBody.placeholder',\n 'e.g., India Organic (NPOP)'\n )}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"certificationDate\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.certificationDate.label', 'Certification Date')}\n </label>\n <input\n id=\"certificationDate\"\n type=\"date\"\n value={certificationDate}\n onChange={(e) => setCertificationDate(e.target.value)}\n className=\"mt-1 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 />\n </div>\n </>\n ) : null}\n <div className=\"sm:col-span-2\">\n <label className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.photos.label', 'Photos')}\n </label>\n <div className=\"mt-1\">\n <HBEntityImages entity=\"Farm\" imageIds={imageIds} onChange={setImageIds} />\n </div>\n </div>\n </div>\n </Modal>\n\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAM,KAAoE,EAAE,SAAM,UAAO,eACvF,kBAAC,OAAD;CAAK,WAAU;WAAf,CACE,kBAAC,QAAD;EAAM,WAAU;YAA8B;CAAW,CAAA,GACzD,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;EAAG,WAAU;YAA+B;CAAS,CAAA,GACrD,kBAAC,KAAD;EAAG,WAAU;YAA2C;CAAS,CAAA,CAC9D,EAAA,CAAA,CACF;IAQM,UAA4B;CACvC,IAAM,EAAE,SAAM,GAAQ,GAChB,EAAE,SAAM,gBAAY,aAAS,UAAO,eAAW,GAAmB,GAClE,KAAW,GAAY,GACvB,EAAE,iBAAc,EAAY,GAC5B,EAAE,YAAQ,UAAO,gBAAY,GAAS,GAEtC,CAAC,GAAU,KAAe,EAAS,EAA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ACA,CAAA;GAEP,kBAAC,GAAD;IAAwB;IAAQ,WAAW;GAAU,CAAA;EAC3C;MA3VV,kBAAC,GAAD;EACE,OAAO,EAAE,kCAAkC,SAAS;EACpD,aAAa,EAAE,qCAAqC,6CAA6C;YAEhG,GAAO,QACN,kBAAC,IAAD,CAAa,CAAA,IAEb,kBAAC,GAAD;GACE,cAAa;GACb,OAAO,EAAE,6CAA6C,oBAAoB;GAC1E,aAAa,EACX,mDACA,mFACF;GACA,QACE,kBAAC,GAAD;IAAQ,eAAe,GAAS,EAAU,iBAAiB,CAAC;cACzD,EAAE,8CAA8C,kBAAkB;GAC7D,CAAA;EAEX,CAAA;CAEO,CAAA;AAwUlB"}
|
|
1
|
+
{"version":3,"file":"FarmProfilePage.js","names":[],"sources":["../../../../src/healthybowl/pages/farm/FarmProfilePage.tsx"],"sourcesContent":["import { type FC, type ReactNode, useState } from 'react';\nimport { useNavigate } from 'react-router';\nimport { MapPin, Ruler, User, ShieldCheck, Edit, Tractor, Award, Calendar, LocateFixed } from 'lucide-react';\nimport {\n PageLayout,\n StatusBadge,\n EmptyState,\n ErrorState,\n Modal,\n LoadingSkeleton,\n HBEntityImages,\n} from '../../components';\nimport { useHealthyBowlData } from '../../hooks/useHealthyBowlData';\nimport { useBasePath } from '../../hooks/useBasePath';\nimport { useToast } from '../../hooks/useToast';\nimport { ToastContainer } from '../../components/Toast';\nimport { formatDate } from '../../utils/helpers';\nimport { captureGps, formatGps } from '../../offline/geolocation';\nimport { readFarmCoordinateDraft } from '../../utils/farmCoordinates';\nimport { useI18n } from '@burdenoff/fe-libs/shared/providers/shell/I18nProvider';\nimport {\n GlassCard,\n Button,\n Select,\n SelectTrigger,\n SelectValue,\n SelectContent,\n SelectItem,\n} from '@burdenoff/fe-libs/ui';\n\nconst DetailRow: FC<{ icon: ReactNode; label: string; value: string }> = ({ icon, label, value }) => (\n <div className=\"flex items-start gap-3\">\n <span className=\"mt-0.5 text-text-secondary\">{icon}</span>\n <div>\n <p className=\"text-xs text-text-secondary\">{label}</p>\n <p className=\"text-sm font-semibold text-text-primary\">{value}</p>\n </div>\n </div>\n);\n\n// \"My Farm\" — view + edit the workspace's farm profile. The app is single-farm\n// (the dashboard exposes one `farm`), so this is a profile page, not a list.\n// Persists via the real updateFarm mutation (already deployed). Farm CREATION\n// lives in the onboarding flow, so a missing farm routes to Getting Started\n// rather than duplicating a create form here.\nexport const FarmProfilePage: FC = () => {\n const { t } = useI18n();\n const { farm, updateFarm, loading, error, errors } = useHealthyBowlData();\n const navigate = useNavigate();\n const { buildPath } = useBasePath();\n const { toasts, toast, dismiss } = useToast();\n\n const [showEdit, setShowEdit] = useState(false);\n const [submitting, setSubmitting] = useState(false);\n\n const [name, setName] = useState('');\n const [location, setLocation] = useState('');\n const [totalArea, setTotalArea] = useState('');\n const [areaUnit, setAreaUnit] = useState<'acres' | 'hectares'>('acres');\n const [owner, setOwner] = useState('');\n const [organicCertified, setOrganicCertified] = useState(false);\n const [certificationBody, setCertificationBody] = useState('');\n const [certificationDate, setCertificationDate] = useState('');\n const [imageIds, setImageIds] = useState<string[]>([]);\n const [latitude, setLatitude] = useState('');\n const [longitude, setLongitude] = useState('');\n const [locating, setLocating] = useState(false);\n\n const hasFarm = Boolean(farm.id);\n const hasCoordinates = typeof farm.latitude === 'number' && typeof farm.longitude === 'number';\n\n const openEdit = () => {\n setName(farm.name ?? '');\n setLocation(farm.location ?? '');\n setLatitude(typeof farm.latitude === 'number' ? String(farm.latitude) : '');\n setLongitude(typeof farm.longitude === 'number' ? String(farm.longitude) : '');\n setTotalArea(String(farm.totalArea ?? ''));\n setAreaUnit(farm.areaUnit === 'hectares' ? 'hectares' : 'acres');\n setOwner(farm.owner ?? '');\n setOrganicCertified(Boolean(farm.organicCertified));\n setCertificationBody(farm.certificationBody ?? '');\n setCertificationDate(farm.certificationDate ?? '');\n setImageIds(farm.imageIds ?? []);\n setShowEdit(true);\n };\n\n /**\n * Ask the device for a fix. `captureGps` resolves null on denial/timeout/unsupported and\n * discards the underlying error, so we can only say \"we could not read it\" — the fields stay\n * editable so a coordinate can always be typed by hand.\n */\n const handleUseMyLocation = async () => {\n setLocating(true);\n try {\n const fix = await captureGps({ highAccuracy: true });\n if (!fix) {\n toast({\n title: t('healthybowl.farm.profile.toast.locationUnavailable.title', 'Could not read your location'),\n description: t(\n 'healthybowl.farm.profile.toast.locationUnavailable.description',\n 'Your browser blocked or timed out the location request. You can type the coordinates in by hand.'\n ),\n variant: 'warning',\n });\n return;\n }\n setLatitude(fix.latitude.toFixed(6));\n setLongitude(fix.longitude.toFixed(6));\n toast({\n title: t('healthybowl.farm.profile.toast.locationCaptured.title', 'Location captured'),\n description: formatGps(fix.latitude, fix.longitude),\n variant: 'success',\n });\n } finally {\n setLocating(false);\n }\n };\n\n const handleUpdate = async () => {\n if (!name.trim() || !location.trim() || !owner.trim() || !(Number(totalArea) > 0)) {\n toast({\n title: t('healthybowl.farm.profile.toast.missingFields.title', 'Missing required fields'),\n description: t(\n 'healthybowl.farm.profile.toast.missingFields.description',\n 'Name, location and owner are required, and area must be greater than 0.'\n ),\n variant: 'warning',\n });\n return;\n }\n // Coordinates are all-or-nothing: the pair is meaningless half-filled, and the server\n // refuses a partial or out-of-range pair rather than silently dropping it (BOFF-6122).\n const coords = readFarmCoordinateDraft({ latitude, longitude });\n if (coords.kind === 'unpaired') {\n toast({\n title: t('healthybowl.farm.profile.toast.coordsPaired.title', 'Enter both coordinates'),\n description: t(\n 'healthybowl.farm.profile.toast.coordsPaired.description',\n 'Latitude and longitude go together — fill in both, or clear both.'\n ),\n variant: 'warning',\n });\n return;\n }\n if (coords.kind === 'outOfRange') {\n toast({\n title: t('healthybowl.farm.profile.toast.coordsRange.title', 'Coordinates out of range'),\n description: t(\n 'healthybowl.farm.profile.toast.coordsRange.description',\n 'Latitude must be between -90 and 90, and longitude between -180 and 180.'\n ),\n variant: 'warning',\n });\n return;\n }\n setSubmitting(true);\n try {\n await updateFarm({\n id: farm.id,\n name: name.trim(),\n location: location.trim(),\n totalArea: Number(totalArea),\n areaUnit,\n owner: owner.trim(),\n organicCertified,\n certificationBody: organicCertified ? certificationBody.trim() || undefined : undefined,\n certificationDate: organicCertified ? certificationDate || undefined : undefined,\n imageIds,\n // Omitted when empty. The server then leaves any stored pin alone unless `location`\n // actually changed, in which case it clears it so the next weather read re-geocodes.\n ...(coords.kind === 'valid' ? { latitude: coords.latitude, longitude: coords.longitude } : {}),\n });\n toast({\n title: t('healthybowl.farm.profile.toast.updated.title', 'Farm updated'),\n description: t('healthybowl.farm.profile.toast.updated.description', '{{name}} has been saved.', {\n name: name.trim(),\n }),\n variant: 'success',\n });\n setShowEdit(false);\n } catch (err) {\n toast({\n title: t('healthybowl.farm.profile.toast.updateFailed.title', 'Update failed'),\n description: err instanceof Error ? err.message : String(err),\n variant: 'error',\n });\n } finally {\n setSubmitting(false);\n }\n };\n\n if (loading && !hasFarm) {\n return (\n <PageLayout\n title={t('healthybowl.farm.profile.title', 'My Farm')}\n description={t('healthybowl.farm.profile.subtitle', 'Your farm profile and organic certification')}\n >\n <LoadingSkeleton variant=\"card\" count={2} />\n </PageLayout>\n );\n }\n\n if (error && !hasFarm) {\n return (\n <PageLayout\n title={t('healthybowl.farm.profile.title', 'My Farm')}\n description={t('healthybowl.farm.profile.subtitle', 'Your farm profile and organic certification')}\n >\n <EmptyState\n icon={<Tractor className=\"h-12 w-12\" />}\n title={t('healthybowl.farm.profile.loadError.title', 'Unable to load your farm')}\n description={error.message}\n />\n </PageLayout>\n );\n }\n\n if (!hasFarm) {\n return (\n <PageLayout\n title={t('healthybowl.farm.profile.title', 'My Farm')}\n description={t('healthybowl.farm.profile.subtitle', 'Your farm profile and organic certification')}\n >\n {errors.crops ? (\n <ErrorState />\n ) : (\n <EmptyState\n illustration=\"onboarding\"\n title={t('healthybowl.farm.profile.emptyState.title', 'No farm set up yet')}\n description={t(\n 'healthybowl.farm.profile.emptyState.description',\n 'Set up your farm to start tracking crops, livestock, finances and certifications.'\n )}\n action={\n <Button onClick={() => navigate(buildPath('getting-started'))}>\n {t('healthybowl.farm.profile.emptyState.action', 'Set up your farm')}\n </Button>\n }\n />\n )}\n </PageLayout>\n );\n }\n\n return (\n <PageLayout\n title={farm.name}\n description={t('healthybowl.farm.profile.header.description', '{{location}} · {{area}} {{unit}}', {\n location: farm.location,\n area: farm.totalArea,\n unit: farm.areaUnit,\n })}\n actions={\n <Button variant=\"outline\" onClick={openEdit}>\n <Edit className=\"h-4 w-4\" /> {t('healthybowl.farm.profile.actions.edit', 'Edit Farm')}\n </Button>\n }\n purpose=\"Your farm's identity — name, location, size and certification status. This is the foundation everything else builds on; keep it accurate so your fields, crops, livestock and records all line up correctly.\"\n nextSteps={[\n {\n id: 'edit',\n label: t('healthybowl.farm.profile.nextSteps.edit.label', 'Complete your farm details'),\n description: t(\n 'healthybowl.farm.profile.nextSteps.edit.desc',\n 'Fill in location, size and certification so the rest of HealthyBowl is accurate.'\n ),\n onClick: openEdit,\n },\n {\n id: 'fields',\n label: t('healthybowl.farm.profile.nextSteps.fields.label', 'Add your fields'),\n description: t(\n 'healthybowl.farm.profile.nextSteps.fields.desc',\n 'Map the plots you farm so you can track crops and soil per field.'\n ),\n href: buildPath('crops/fields'),\n },\n {\n id: 'crops',\n label: t('healthybowl.farm.profile.nextSteps.crops.label', 'Register your crops'),\n description: t(\n 'healthybowl.farm.profile.nextSteps.crops.desc',\n 'Start tracking what you’re growing across your fields.'\n ),\n href: buildPath('crops'),\n },\n ]}\n nextStepsKey=\"healthybowl-farm-profile\"\n >\n <div className=\"flex flex-wrap items-center gap-3\">\n {farm.organicCertified ? (\n <StatusBadge label={t('healthybowl.farm.profile.badge.certified', 'Organic Certified')} variant=\"success\" />\n ) : (\n <StatusBadge label={t('healthybowl.farm.profile.badge.notCertified', 'Not Certified')} variant=\"muted\" />\n )}\n </div>\n\n <div className=\"grid grid-cols-1 gap-6 lg:grid-cols-2\">\n {/* Farm details */}\n <GlassCard treatment=\"glass\" glow className=\"border-border-seam p-6\">\n <h3 className=\"mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary\">\n <Tractor className=\"h-4 w-4 text-primary\" /> {t('healthybowl.farm.profile.details.heading', 'Farm Details')}\n </h3>\n <div className=\"space-y-4\">\n <DetailRow\n icon={<MapPin className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.details.location', 'Location')}\n value={farm.location}\n />\n {hasCoordinates && (\n <DetailRow\n icon={<LocateFixed className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.details.coordinates', 'Coordinates')}\n value={formatGps(farm.latitude as number, farm.longitude as number)}\n />\n )}\n <DetailRow\n icon={<Ruler className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.details.totalArea', 'Total Area')}\n value={t('healthybowl.farm.profile.details.areaValue', '{{area}} {{unit}}', {\n area: farm.totalArea,\n unit: farm.areaUnit,\n })}\n />\n <DetailRow\n icon={<User className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.details.owner', 'Owner')}\n value={farm.owner}\n />\n {(farm.imageIds ?? []).length > 0 && (\n <div>\n <p className=\"mb-2 text-xs text-text-secondary\">\n {t('healthybowl.farm.profile.details.photos', 'Photos')}\n </p>\n <HBEntityImages entity=\"Farm\" imageIds={farm.imageIds ?? []} onChange={() => {}} readOnly />\n </div>\n )}\n </div>\n </GlassCard>\n\n {/* Certification */}\n <div className=\"rounded-lg border border-border-subtle bg-bg-surface p-6\">\n <h3 className=\"mb-4 flex items-center gap-2 text-sm font-semibold text-text-primary\">\n <ShieldCheck className=\"h-4 w-4 text-primary\" />{' '}\n {t('healthybowl.farm.profile.certification.heading', 'Organic Certification')}\n </h3>\n {farm.organicCertified ? (\n <div className=\"space-y-4\">\n <DetailRow\n icon={<Award className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.certification.body', 'Certification Body')}\n value={farm.certificationBody || '—'}\n />\n <DetailRow\n icon={<Calendar className=\"h-4 w-4\" />}\n label={t('healthybowl.farm.profile.certification.certifiedOn', 'Certified On')}\n value={farm.certificationDate ? formatDate(farm.certificationDate) : '—'}\n />\n </div>\n ) : (\n <p className=\"text-sm text-text-secondary\">\n {t(\n 'healthybowl.farm.profile.certification.notCertifiedMessage',\n 'This farm is not marked as organic certified. Edit the farm to add certification details.'\n )}\n </p>\n )}\n </div>\n </div>\n\n {/* Edit Farm Modal */}\n <Modal\n open={showEdit}\n onClose={() => setShowEdit(false)}\n title={t('healthybowl.farm.profile.modal.title', 'Edit Farm')}\n description={t('healthybowl.farm.profile.modal.description', 'Update details for {{name}}', {\n name: farm.name,\n })}\n size=\"lg\"\n footer={\n <>\n <Button variant=\"outline\" onClick={() => setShowEdit(false)} className=\"text-text-secondary\">\n {t('healthybowl.common.cancel', 'Cancel')}\n </Button>\n <Button onClick={handleUpdate} disabled={submitting}>\n {submitting\n ? t('healthybowl.farm.profile.modal.saving', 'Saving...')\n : t('healthybowl.farm.profile.modal.save', 'Save Changes')}\n </Button>\n </>\n }\n >\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2\">\n <div>\n <label htmlFor=\"farm-name\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.name.label', 'Farm Name *')}\n </label>\n <input\n id=\"farm-name\"\n type=\"text\"\n value={name}\n onChange={(e) => setName(e.target.value)}\n className=\"mt-1 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 />\n </div>\n <div>\n <label htmlFor=\"location\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.location.label', 'Location *')}\n </label>\n <input\n id=\"location\"\n type=\"text\"\n value={location}\n onChange={(e) => {\n setLocation(e.target.value);\n // Moving the farm invalidates the old pin (spec 01). Clearing the inputs here\n // keeps the form honest about what will be saved.\n setLatitude('');\n setLongitude('');\n }}\n className=\"mt-1 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 />\n </div>\n <div>\n <div className=\"flex items-center justify-between gap-3\">\n <span className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.coordinates.label', 'Coordinates')}\n </span>\n <Button type=\"button\" variant=\"outline\" size=\"sm\" onClick={handleUseMyLocation} disabled={locating}>\n <LocateFixed className=\"h-4 w-4\" />\n {locating\n ? t('healthybowl.farm.profile.form.coordinates.locating', 'Locating…')\n : t('healthybowl.farm.profile.form.coordinates.useMyLocation', 'Use my location')}\n </Button>\n </div>\n <p className=\"mt-1 text-xs text-text-secondary\">\n {t(\n 'healthybowl.farm.profile.form.coordinates.help',\n 'Optional. Pins the exact spot used for weather instead of guessing from the location name.'\n )}\n </p>\n <div className=\"mt-2 grid grid-cols-2 gap-3\">\n <div>\n <label htmlFor=\"latitude\" className=\"text-xs text-text-secondary\">\n {t('healthybowl.farm.profile.form.latitude.label', 'Latitude')}\n </label>\n <input\n id=\"latitude\"\n type=\"number\"\n step=\"any\"\n value={latitude}\n onChange={(e) => setLatitude(e.target.value)}\n className=\"mt-1 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 />\n </div>\n <div>\n <label htmlFor=\"longitude\" className=\"text-xs text-text-secondary\">\n {t('healthybowl.farm.profile.form.longitude.label', 'Longitude')}\n </label>\n <input\n id=\"longitude\"\n type=\"number\"\n step=\"any\"\n value={longitude}\n onChange={(e) => setLongitude(e.target.value)}\n className=\"mt-1 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 />\n </div>\n </div>\n </div>\n <div>\n <label htmlFor=\"totalArea\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.totalArea.label', 'Total Area *')}\n </label>\n <input\n id=\"totalArea\"\n type=\"number\"\n min={0}\n value={totalArea}\n onChange={(e) => setTotalArea(e.target.value)}\n className=\"mt-1 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 />\n </div>\n <div>\n <label htmlFor=\"areaUnit\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.areaUnit.label', 'Area Unit')}\n </label>\n <Select value={areaUnit} onValueChange={(value) => setAreaUnit(value as 'acres' | 'hectares')}>\n <SelectTrigger id=\"areaUnit\" className=\"mt-1 w-full\">\n <SelectValue />\n </SelectTrigger>\n <SelectContent>\n <SelectItem value=\"acres\">{t('healthybowl.farm.profile.form.areaUnit.acres', 'Acres')}</SelectItem>\n <SelectItem value=\"hectares\">\n {t('healthybowl.farm.profile.form.areaUnit.hectares', 'Hectares')}\n </SelectItem>\n </SelectContent>\n </Select>\n </div>\n <div className=\"sm:col-span-2\">\n <label htmlFor=\"owner\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.owner.label', 'Owner *')}\n </label>\n <input\n id=\"owner\"\n type=\"text\"\n value={owner}\n onChange={(e) => setOwner(e.target.value)}\n className=\"mt-1 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 />\n </div>\n <div className=\"sm:col-span-2\">\n <label className=\"flex cursor-pointer items-center gap-2 text-sm font-medium text-text-primary\">\n <input\n type=\"checkbox\"\n checked={organicCertified}\n onChange={(e) => setOrganicCertified(e.target.checked)}\n className=\"h-4 w-4 rounded border-border-subtle text-primary focus:ring-[var(--color-focus-ring)]\"\n />\n {t('healthybowl.farm.profile.form.organicCertified.label', 'Organic Certified')}\n </label>\n </div>\n {organicCertified ? (\n <>\n <div>\n <label htmlFor=\"certificationBody\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.certificationBody.label', 'Certification Body')}\n </label>\n <input\n id=\"certificationBody\"\n type=\"text\"\n value={certificationBody}\n onChange={(e) => setCertificationBody(e.target.value)}\n placeholder={t(\n 'healthybowl.farm.profile.form.certificationBody.placeholder',\n 'e.g., India Organic (NPOP)'\n )}\n className=\"mt-1 w-full rounded-md border border-border-subtle bg-bg-surface px-3 py-2 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]\"\n />\n </div>\n <div>\n <label htmlFor=\"certificationDate\" className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.certificationDate.label', 'Certification Date')}\n </label>\n <input\n id=\"certificationDate\"\n type=\"date\"\n value={certificationDate}\n onChange={(e) => setCertificationDate(e.target.value)}\n className=\"mt-1 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 />\n </div>\n </>\n ) : null}\n <div className=\"sm:col-span-2\">\n <label className=\"text-sm font-medium text-text-primary\">\n {t('healthybowl.farm.profile.form.photos.label', 'Photos')}\n </label>\n <div className=\"mt-1\">\n <HBEntityImages entity=\"Farm\" imageIds={imageIds} onChange={setImageIds} />\n </div>\n </div>\n </div>\n </Modal>\n\n <ToastContainer toasts={toasts} onDismiss={dismiss} />\n </PageLayout>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AA8BA,IAAM,KAAoE,EAAE,SAAM,UAAO,eACvF,kBAAC,OAAD;CAAK,WAAU;WAAf,CACE,kBAAC,QAAD;EAAM,WAAU;YAA8B;CAAW,CAAA,GACzD,kBAAC,OAAD,EAAA,UAAA,CACE,kBAAC,KAAD;EAAG,WAAU;YAA+B;CAAS,CAAA,GACrD,kBAAC,KAAD;EAAG,WAAU;YAA2C;CAAS,CAAA,CAC9D,EAAA,CAAA,CACF;IAQM,UAA4B;CACvC,IAAM,EAAE,SAAM,GAAQ,GAChB,EAAE,SAAM,gBAAY,aAAS,UAAO,eAAW,GAAmB,GAClE,KAAW,GAAY,GACv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,kBAAC,GAAD;SAAgB,QAAO;SAAiB;SAAU,UAAU;QAAc,CAAA;OACvE,CAAA,CACF;;KACF;;GACA,CAAA;GAEP,kBAAC,GAAD;IAAwB;IAAQ,WAAW;GAAU,CAAA;EAC3C;MA3VV,kBAAC,GAAD;EACE,OAAO,EAAE,kCAAkC,SAAS;EACpD,aAAa,EAAE,qCAAqC,6CAA6C;YAEhG,GAAO,QACN,kBAAC,IAAD,CAAa,CAAA,IAEb,kBAAC,GAAD;GACE,cAAa;GACb,OAAO,EAAE,6CAA6C,oBAAoB;GAC1E,aAAa,EACX,mDACA,mFACF;GACA,QACE,kBAAC,GAAD;IAAQ,eAAe,GAAS,EAAU,iBAAiB,CAAC;cACzD,EAAE,8CAA8C,kBAAkB;GAC7D,CAAA;EAEX,CAAA;CAEO,CAAA;AAwUlB"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn as e } from "../../utils/helpers.js";
|
|
2
2
|
import { useOfflineSync as t } from "../../offline/OfflineSyncProvider.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { captureGps as n, formatGps as r } from "../../offline/geolocation.js";
|
|
4
|
+
import { OBSERVATION_TYPES as i, typeMeta as a } from "../../offline/observationMeta.js";
|
|
5
5
|
import { useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
6
6
|
import { Camera as d, Loader2 as f, MapPin as ee, WifiOff as te, X as p } from "lucide-react";
|
|
7
7
|
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
@@ -11,7 +11,7 @@ var C = () => {
|
|
|
11
11
|
let { fields: C, settings: w, capture: T, online: E } = t(), D = l(null), [O, k] = u("PEST"), [A, j] = u(""), [M, N] = u(""), [P, F] = u(""), [I, L] = u(""), [R, z] = u("kg"), [B, V] = u(""), [H, U] = u([]), [W, ne] = u(null), [re, G] = u(!1), [K, q] = u(!1), [ie, J] = u(!1), Y = c(() => C.find((e) => e.id === A), [C, A]), X = l(H);
|
|
12
12
|
X.current = H;
|
|
13
13
|
let Z = o(async () => {
|
|
14
|
-
w.autoStampGps && (G(!0), ne(await
|
|
14
|
+
w.autoStampGps && (G(!0), ne(await n({ highAccuracy: w.highAccuracyGps })), G(!1));
|
|
15
15
|
}, [w.autoStampGps, w.highAccuracyGps]);
|
|
16
16
|
s(() => {
|
|
17
17
|
Z();
|
|
@@ -101,13 +101,13 @@ var C = () => {
|
|
|
101
101
|
}),
|
|
102
102
|
/* @__PURE__ */ m("div", {
|
|
103
103
|
className: "flex flex-wrap gap-2",
|
|
104
|
-
children:
|
|
105
|
-
let n =
|
|
104
|
+
children: i.map((t) => {
|
|
105
|
+
let n = a(t), r = t === O, i = n.icon;
|
|
106
106
|
return /* @__PURE__ */ h("button", {
|
|
107
107
|
type: "button",
|
|
108
108
|
onClick: () => k(t),
|
|
109
|
-
className: e("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium transition",
|
|
110
|
-
children: [/* @__PURE__ */ m(
|
|
109
|
+
className: e("inline-flex items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium transition", r ? "border-transparent bg-action-primary-bg text-action-primary-text shadow-sm" : "border-border-subtle bg-bg-surface text-text-secondary hover:bg-bg-sunken"),
|
|
110
|
+
children: [/* @__PURE__ */ m(i, { className: "h-3.5 w-3.5" }), n.short]
|
|
111
111
|
}, t);
|
|
112
112
|
})
|
|
113
113
|
}),
|
|
@@ -235,7 +235,7 @@ var C = () => {
|
|
|
235
235
|
className: "flex items-center gap-1.5",
|
|
236
236
|
children: [/* @__PURE__ */ m(f, { className: "h-3.5 w-3.5 animate-spin" }), " Getting location…"]
|
|
237
237
|
}) : W ? /* @__PURE__ */ h("span", { children: [
|
|
238
|
-
|
|
238
|
+
r(W.latitude, W.longitude),
|
|
239
239
|
" ",
|
|
240
240
|
/* @__PURE__ */ h("span", {
|
|
241
241
|
className: "text-text-tertiary",
|
|
@@ -1964,7 +1964,6 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
1964
1964
|
})]
|
|
1965
1965
|
})
|
|
1966
1966
|
] }) : /* @__PURE__ */ y("p", {
|
|
1967
|
-
"data-testid": "bed-geometry-notice",
|
|
1968
1967
|
className: "mt-2 rounded-md border border-border-subtle bg-bg-sunken/60 p-3 text-xs text-text-secondary",
|
|
1969
1968
|
children: e(ye.key, ye.defaultValue, { type: Jr })
|
|
1970
1969
|
}),
|
|
@@ -2203,7 +2202,6 @@ var ht = "https://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/Map
|
|
|
2203
2202
|
})
|
|
2204
2203
|
});
|
|
2205
2204
|
})() : /* @__PURE__ */ y("p", {
|
|
2206
|
-
"data-testid": "bed-geometry-notice-bed-layout",
|
|
2207
2205
|
className: "rounded-md border border-border-subtle bg-bg-sunken/60 px-3 py-2 text-xs text-text-secondary",
|
|
2208
2206
|
children: e(ye.key, ye.defaultValue, { type: Jr })
|
|
2209
2207
|
})]
|