@burdenoff/microfe-healthybowl 2026.1117.1 → 2026.1119.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/healthybowl/hooks/useOpenOnAction.d.ts +18 -0
- package/dist/healthybowl/hooks/useOpenOnAction.js +20 -0
- package/dist/healthybowl/index.d.ts +2 -0
- package/dist/healthybowl/index.js +2 -1
- package/dist/healthybowl/newActionPaths.d.ts +8 -0
- package/dist/healthybowl/newActionPaths.js +12 -0
- package/dist/healthybowl/offline/OfflineStatusPill.js +1 -1
- package/dist/healthybowl/offline/observationMeta.js +4 -4
- package/dist/healthybowl/offline/offlineRoutes.js +2 -2
- package/dist/healthybowl/pages/HomePage.js +4 -4
- package/dist/healthybowl/pages/compliance/SubstanceRulesPage.js +1 -1
- package/dist/healthybowl/pages/contacts/ContactFormModal.js +1 -1
- package/dist/healthybowl/pages/contacts/ContactsPage.js +116 -113
- package/dist/healthybowl/pages/contacts/CsvImportModal.js +1 -1
- package/dist/healthybowl/pages/contacts/RecordOrderModal.js +1 -1
- package/dist/healthybowl/pages/contacts/RecordPurchaseModal.js +1 -1
- package/dist/healthybowl/pages/contracts/contract-forms/CreateContractModal.js +1 -1
- package/dist/healthybowl/pages/contracts/contract-forms/DeliveryActionModal.js +1 -1
- package/dist/healthybowl/pages/contracts/contract-forms/InviteFarmModal.js +1 -1
- package/dist/healthybowl/pages/contracts/contract-forms/RecordDeliveryModal.js +2 -2
- package/dist/healthybowl/pages/crops/CropFieldsPage.js +64 -61
- package/dist/healthybowl/pages/crops/CropHarvestPage.js +284 -281
- package/dist/healthybowl/pages/crops/CropPlanningPage.js +1 -1
- package/dist/healthybowl/pages/crops/CropsPage.js +239 -236
- package/dist/healthybowl/pages/distribution/CsaPlanFormModal.js +1 -1
- package/dist/healthybowl/pages/distribution/EnrollMemberModal.js +1 -1
- package/dist/healthybowl/pages/distribution/WholesaleOrderFormModal.js +1 -1
- package/dist/healthybowl/pages/distribution/WholesalePriceTiersModal.js +1 -1
- package/dist/healthybowl/pages/field-capture/CaptureObservationForm.js +1 -1
- package/dist/healthybowl/pages/field-capture/ConflictReviewPage.js +2 -2
- package/dist/healthybowl/pages/field-capture/NeedsReviewPanel.js +1 -1
- package/dist/healthybowl/pages/field-capture/PendingSyncPage.js +2 -2
- package/dist/healthybowl/pages/field-capture/SyncHistoryPage.js +1 -1
- package/dist/healthybowl/pages/field-capture/SyncQueuePanel.js +1 -1
- package/dist/healthybowl/pages/fields/FieldMapPage.js +1 -1
- package/dist/healthybowl/pages/financial/FinancierAccessPage.js +1 -1
- package/dist/healthybowl/pages/financial/TransactionsPage.js +301 -298
- package/dist/healthybowl/pages/government-schemes/ApplicationTrackingPage.js +2 -2
- package/dist/healthybowl/pages/learn/LearnCatalogPage.js +1 -1
- package/dist/healthybowl/pages/learn/LearnCourseDetailPage.js +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDepthFormModal.js +1 -1
- package/dist/healthybowl/pages/livestock/AnimalDepthPage.js +1 -1
- package/dist/healthybowl/pages/livestock/AnimalRegistryPage.js +373 -370
- package/dist/healthybowl/pages/livestock/GrazingPage.js +2 -2
- package/dist/healthybowl/pages/livestock/HerdDepthPage.js +2 -2
- package/dist/healthybowl/pages/livestock/LivestockDashboardPage.js +1 -1
- package/dist/healthybowl/pages/livestock/MedicationLibraryPage.js +1 -1
- package/dist/healthybowl/pages/livestock/PedigreeTree.js +2 -2
- package/dist/healthybowl/pages/livestock/ProductionTrackingPage.js +279 -276
- package/dist/healthybowl/pages/livestock/RecordWeightModal.js +1 -1
- package/dist/healthybowl/pages/livestock/WithdrawalAlertsPage.js +1 -1
- package/dist/healthybowl/pages/livestock/WithdrawalCalendarPage.js +3 -3
- package/dist/healthybowl/pages/livestock/grazing/EndGrazingMoveModal.js +1 -1
- package/dist/healthybowl/pages/livestock/grazing/RecordGrazingMoveModal.js +3 -3
- package/dist/healthybowl/pages/livestock/grazing/SetPaddockRestModal.js +1 -1
- package/dist/healthybowl/pages/livestock/withdrawal/AnimalWithdrawalCard.js +2 -2
- package/dist/healthybowl/pages/livestock/withdrawal/LogTreatmentModal.js +2 -2
- package/dist/healthybowl/pages/market/MarketPricesPage.js +2 -2
- package/dist/healthybowl/pages/market/market-prices/AddWatchModal.js +1 -1
- package/dist/healthybowl/pages/market/market-prices/PriceAlertRuleModal.js +1 -1
- package/dist/healthybowl/pages/marketplace/MarketplacePage.js +1 -1
- package/dist/healthybowl/pages/marketplace/ShipmentTrackingPanel.js +1 -1
- package/dist/healthybowl/pages/pest-management/AiPestDetectionPage.js +11 -11
- package/dist/healthybowl/pages/products/ProductFormFields.js +1 -1
- package/dist/healthybowl/pages/products/ProductsOverviewPage.js +1 -1
- package/dist/healthybowl/pages/soil/FieldSensorsPage.js +1 -1
- package/dist/healthybowl/pages/soil/field-sensors/RegisterProbeModal.js +1 -1
- package/dist/healthybowl/pages/soil/field-sensors/ThresholdsModal.js +1 -1
- package/dist/healthybowl/pages/storage/PlaceLotModal.js +1 -1
- package/dist/healthybowl/pages/storage/RecordMovementModal.js +3 -3
- package/dist/healthybowl/pages/storage/StorageLocationFormModal.js +1 -1
- package/dist/healthybowl/pages/storage/StorageLotDetailPage.js +1 -1
- package/dist/healthybowl/pages/storage/StoragePage.js +1 -1
- package/dist/healthybowl/pages/tasks/TasksPage.js +99 -96
- package/dist/healthybowl/pages/terrace/CompostBatchModal.js +1 -1
- package/dist/healthybowl/pages/terrace/GardenFormModal.js +1 -1
- package/dist/healthybowl/pages/terrace/GardenInputModal.js +1 -1
- package/dist/healthybowl/pages/terrace/GardenOnboarding.js +2 -2
- package/dist/healthybowl/pages/terrace/GrowSpaceFormModal.js +1 -1
- package/dist/healthybowl/pages/terrace/JournalEntryModal.js +4 -4
- package/dist/healthybowl/pages/terrace/LogHarvestModal.js +1 -1
- package/dist/healthybowl/pages/terrace/PlantingFormModal.js +1 -1
- package/dist/healthybowl/pages/traceability/BatchTrackingPage.js +2 -2
- package/dist/healthybowl/pages/weather/FrostRiskCalendarPage.js +17 -17
- package/dist/healthybowl/pages/weather/WeatherAlertHistoryPage.js +3 -3
- package/dist/healthybowl/pages/weather/WeatherAnomalyReportPage.js +3 -3
- package/dist/healthybowl/pages/weather/WeatherOverviewPage.js +12 -12
- package/dist/healthybowl/public/PublicSeedLotDetails.js +2 -2
- package/dist/healthybowl/public/PublicTraceJourney.js +1 -1
- package/dist/index.js +3 -2
- package/package.json +1 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* useOpenOnAction — lets another surface (the app's "+ New" menu) deep-link into a page's
|
|
3
|
+
* existing Add dialog with `?action=new` (BOFF-15554).
|
|
4
|
+
*
|
|
5
|
+
* Behaviour:
|
|
6
|
+
* - `?action=<action>` present and `enabled` → call `open()` ONCE, then remove the param with a
|
|
7
|
+
* history REPLACE (no extra entry; every other query param is kept).
|
|
8
|
+
* - any other value, or no param → nothing happens, exactly as before.
|
|
9
|
+
* - `enabled === false` (the user cannot create: the page's Add button is hidden/disabled, or the
|
|
10
|
+
* gate is still resolving) → nothing opens and the param is left alone, so it fires once the
|
|
11
|
+
* gate settles in the user's favour and never for a user who cannot create.
|
|
12
|
+
* - navigating to `?action=new` again while the page is already mounted opens it again.
|
|
13
|
+
*
|
|
14
|
+
* @module healthybowl
|
|
15
|
+
*/
|
|
16
|
+
/** Query parameter the "+ New" menu sets. */
|
|
17
|
+
export declare const NEW_ACTION_PARAM = "action";
|
|
18
|
+
export declare function useOpenOnAction(action: string, open: () => void, enabled?: boolean): void;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { useEffect as e, useRef as t } from "react";
|
|
2
|
+
import { useSearchParams as n } from "react-router";
|
|
3
|
+
// src/healthybowl/hooks/useOpenOnAction.ts
|
|
4
|
+
var r = "action";
|
|
5
|
+
function i(i, a, o = !0) {
|
|
6
|
+
let [s, c] = n(), l = t(a);
|
|
7
|
+
l.current = a;
|
|
8
|
+
let u = t(!1), d = s.get(r) === i;
|
|
9
|
+
e(() => {
|
|
10
|
+
d ? o && !u.current && (u.current = !0, l.current(), c((e) => {
|
|
11
|
+
let t = new URLSearchParams(e);
|
|
12
|
+
return t.delete(r), t;
|
|
13
|
+
}, { replace: !0 })) : u.current = !1;
|
|
14
|
+
}, [
|
|
15
|
+
d,
|
|
16
|
+
o,
|
|
17
|
+
c
|
|
18
|
+
]);
|
|
19
|
+
}
|
|
20
|
+
export { r as NEW_ACTION_PARAM, i as useOpenOnAction };
|
|
@@ -15,3 +15,5 @@ export type { OfflinePurgeTarget as HealthyBowlOfflinePurgeTarget } from './offl
|
|
|
15
15
|
export { useHealthyBowlStore } from './store/healthybowlStore';
|
|
16
16
|
export { AIAssistantPanel } from '../components/assistant';
|
|
17
17
|
export type { AIAssistantPanelProps } from '../components/assistant';
|
|
18
|
+
export { HB_NEW_ACTION_PATHS } from './newActionPaths';
|
|
19
|
+
export type { HbNewActionPath } from './newActionPaths';
|
|
@@ -7,4 +7,5 @@ import { PublicSeedLotPage as o } from "./public/PublicSeedLotPage.js";
|
|
|
7
7
|
import { useHealthyBowl as s } from "./context/HealthyBowlContext.js";
|
|
8
8
|
import { useHealthyBowlStore as c } from "./store/healthybowlStore.js";
|
|
9
9
|
import "../components/assistant/index.js";
|
|
10
|
-
|
|
10
|
+
import { HB_NEW_ACTION_PATHS as l } from "./newActionPaths.js";
|
|
11
|
+
export { l as HB_NEW_ACTION_PATHS, n as HEALTHYBOWL_RYBBIT_EVENT_ALLOWLIST, e as HealthyBowlRoot, o as PublicSeedLotPage, t as PublicTracePage, r as lockHealthyBowlOfflineData, i as purgeHealthyBowlOfflineData, a as unlockHealthyBowlOfflineData, s as useHealthyBowl, c as useHealthyBowlStore };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pages that open their existing Add dialog from `?action=new` (BOFF-15554), for the app's
|
|
3
|
+
* "+ New" menu. Absolute paths under the default `/healthybowl` mount; build the link as
|
|
4
|
+
* `${path}?action=new`. Keep in step with the `useOpenOnAction('new', …)` call sites.
|
|
5
|
+
* @module healthybowl
|
|
6
|
+
*/
|
|
7
|
+
export declare const HB_NEW_ACTION_PATHS: readonly ["/healthybowl/crops/harvest", "/healthybowl/livestock/production", "/healthybowl/financial/transactions", "/healthybowl/tasks", "/healthybowl/crops", "/healthybowl/livestock/animals", "/healthybowl/crops/fields", "/healthybowl/contacts"];
|
|
8
|
+
export type HbNewActionPath = (typeof HB_NEW_ACTION_PATHS)[number];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// src/healthybowl/newActionPaths.ts
|
|
2
|
+
var e = [
|
|
3
|
+
"/healthybowl/crops/harvest",
|
|
4
|
+
"/healthybowl/livestock/production",
|
|
5
|
+
"/healthybowl/financial/transactions",
|
|
6
|
+
"/healthybowl/tasks",
|
|
7
|
+
"/healthybowl/crops",
|
|
8
|
+
"/healthybowl/livestock/animals",
|
|
9
|
+
"/healthybowl/crops/fields",
|
|
10
|
+
"/healthybowl/contacts"
|
|
11
|
+
];
|
|
12
|
+
export { e as HB_NEW_ACTION_PATHS };
|
|
@@ -10,7 +10,7 @@ import { jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
|
10
10
|
var p = ({ inline: p, compact: m, className: h }) => {
|
|
11
11
|
let { buildPath: g } = n(), { t: _ } = i(), { online: v, syncing: y, queuedCount: b, conflictCount: x, needsReviewCount: S, lastSyncedAt: C, storageBlocked: w, syncNow: T } = e(), E = !v, D = b > 0, O = "ok";
|
|
12
12
|
E ? O = "offline" : (w || D || x > 0 || S > 0) && (O = "warning");
|
|
13
|
-
let k = O === "offline" || O === "warning" ? "bg-status-warning-
|
|
13
|
+
let k = O === "offline" || O === "warning" ? "bg-status-warning-bg-subtle text-status-warning-text border-status-warning-border" : "bg-status-success-bg-subtle text-status-success-text border-status-success-border", A = w ? a : E ? l : x > 0 || S > 0 ? a : D ? c : o, j;
|
|
14
14
|
j = w ? _("healthybowl.offline.pill.storageBlocked", "Close other HealthyBowl tabs · offline storage is finishing an update") : E ? D ? `Offline — ${b} record${b > 1 ? "s" : ""} queued` : "Offline — working locally" : y ? "Online — syncing…" : x > 0 ? `Online — ${x} conflict${x > 1 ? "s" : ""} to review` : D ? `Online — ${b} record${b > 1 ? "s" : ""} queued` : S > 0 ? S === 1 ? _("healthybowl.offline.pill.needsReviewOne", "Online — 1 record to review") : _("healthybowl.offline.pill.needsReviewMany", "Online — {{count}} records to review", { count: S }) : C ? `Online — all synced · last synced ${t(C)}` : "Online — all synced";
|
|
15
15
|
let M = /* @__PURE__ */ f("button", {
|
|
16
16
|
type: "button",
|
|
@@ -6,25 +6,25 @@ var s = {
|
|
|
6
6
|
label: "Pest Sighting",
|
|
7
7
|
short: "Pest",
|
|
8
8
|
icon: e,
|
|
9
|
-
chip: "bg-status-warning-
|
|
9
|
+
chip: "bg-status-warning-bg-subtle text-status-warning-text"
|
|
10
10
|
},
|
|
11
11
|
CROP_HEALTH: {
|
|
12
12
|
label: "Crop Health",
|
|
13
13
|
short: "Crop",
|
|
14
14
|
icon: i,
|
|
15
|
-
chip: "bg-status-success-
|
|
15
|
+
chip: "bg-status-success-bg-subtle text-status-success-text"
|
|
16
16
|
},
|
|
17
17
|
SOIL: {
|
|
18
18
|
label: "Soil Note",
|
|
19
19
|
short: "Soil",
|
|
20
20
|
icon: t,
|
|
21
|
-
chip: "bg-status-info-
|
|
21
|
+
chip: "bg-status-info-bg-subtle text-status-info-text"
|
|
22
22
|
},
|
|
23
23
|
HARVEST: {
|
|
24
24
|
label: "Harvest Count",
|
|
25
25
|
short: "Harvest",
|
|
26
26
|
icon: a,
|
|
27
|
-
chip: "bg-status-success-
|
|
27
|
+
chip: "bg-status-success-bg-subtle text-status-success-text"
|
|
28
28
|
},
|
|
29
29
|
LIVESTOCK: {
|
|
30
30
|
label: "Livestock Health",
|
|
@@ -14,10 +14,10 @@ function p(t) {
|
|
|
14
14
|
title: t,
|
|
15
15
|
description: "This screen has not been downloaded to this device yet.",
|
|
16
16
|
children: /* @__PURE__ */ s("div", {
|
|
17
|
-
className: "flex flex-col items-center justify-center rounded-2xl border border-status-warning-border bg-status-warning-
|
|
17
|
+
className: "flex flex-col items-center justify-center rounded-2xl border border-status-warning-border bg-status-warning-bg-subtle px-6 py-16 text-center",
|
|
18
18
|
children: [
|
|
19
19
|
/* @__PURE__ */ o("div", {
|
|
20
|
-
className: "mb-5 flex h-20 w-20 items-center justify-center rounded-full bg-
|
|
20
|
+
className: "mb-5 flex h-20 w-20 items-center justify-center rounded-full bg-bg-surface",
|
|
21
21
|
children: /* @__PURE__ */ o(i, { className: "h-10 w-10 text-status-warning-text" })
|
|
22
22
|
}),
|
|
23
23
|
/* @__PURE__ */ s("h2", {
|
|
@@ -24,9 +24,9 @@ var A = {
|
|
|
24
24
|
danger: "text-status-error-text"
|
|
25
25
|
}, j = {
|
|
26
26
|
neutral: "bg-[var(--color-accent-soft)] text-text-primary",
|
|
27
|
-
success: "bg-status-success-bg text-status-success-text",
|
|
28
|
-
warning: "bg-status-warning-bg text-status-warning-text",
|
|
29
|
-
danger: "bg-status-error-bg text-status-error-text"
|
|
27
|
+
success: "bg-status-success-bg-subtle text-status-success-text",
|
|
28
|
+
warning: "bg-status-warning-bg-subtle text-status-warning-text",
|
|
29
|
+
danger: "bg-status-error-bg-subtle text-status-error-text"
|
|
30
30
|
}, M = {
|
|
31
31
|
critical: 0,
|
|
32
32
|
warning: 1,
|
|
@@ -295,7 +295,7 @@ var A = {
|
|
|
295
295
|
className: "space-y-6",
|
|
296
296
|
children: [
|
|
297
297
|
/* @__PURE__ */ O("div", {
|
|
298
|
-
className: c("inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-sm font-medium", Z === 0 ? "bg-status-success-bg text-status-success-text" : "bg-status-warning-bg text-status-warning-text"),
|
|
298
|
+
className: c("inline-flex items-center gap-1.5 rounded-full px-3 py-1 text-sm font-medium", Z === 0 ? "bg-status-success-bg-subtle text-status-success-text" : "bg-status-warning-bg-subtle text-status-warning-text"),
|
|
299
299
|
children: [D(Z === 0 ? h : p, { className: "size-4" }), Se]
|
|
300
300
|
}),
|
|
301
301
|
!N?.id && /* @__PURE__ */ O(ue, {
|
|
@@ -75,7 +75,7 @@ var A = "mb-1 block text-sm font-medium text-text-primary", j = () => {
|
|
|
75
75
|
}),
|
|
76
76
|
children: [
|
|
77
77
|
ue ? /* @__PURE__ */ x("div", {
|
|
78
|
-
className: "mb-4 flex items-start gap-2 rounded-lg border border-status-warning-border bg-status-warning-bg px-4 py-3 text-sm text-status-warning-text",
|
|
78
|
+
className: "mb-4 flex items-start gap-2 rounded-lg border border-status-warning-border bg-status-warning-bg-subtle px-4 py-3 text-sm text-status-warning-text",
|
|
79
79
|
children: [/* @__PURE__ */ b(ie, { className: "mt-0.5 h-4 w-4 shrink-0" }), /* @__PURE__ */ b("span", { children: j("healthybowl.compliance.substanceRules.noLimits", "No rule in this workspace carries a numeric limit, so a residue test can never be found to exceed one. The built-in list covers outright bans only — add a limit rule for any substance your buyer or certifier caps rather than forbids.") })]
|
|
80
80
|
}) : null,
|
|
81
81
|
I.length === 0 ? /* @__PURE__ */ b(ee, {
|
|
@@ -60,7 +60,7 @@ var u = "mb-1 block text-sm font-medium text-text-primary", d = ({ open: d, onCl
|
|
|
60
60
|
className: "space-y-4",
|
|
61
61
|
children: [
|
|
62
62
|
F ? /* @__PURE__ */ a("div", {
|
|
63
|
-
className: "rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text",
|
|
63
|
+
className: "rounded-md border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
64
64
|
children: F
|
|
65
65
|
}) : null,
|
|
66
66
|
/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("label", {
|
|
@@ -6,66 +6,69 @@ import { DataTable as r } from "../../components/DataTable.js";
|
|
|
6
6
|
import { StatusBadge as i } from "../../components/StatusBadge.js";
|
|
7
7
|
import { EmptyState as a } from "../../components/EmptyState.js";
|
|
8
8
|
import { ErrorState as o } from "../../components/ErrorState.js";
|
|
9
|
-
import { useConfirm as
|
|
10
|
-
import { PageLoader as
|
|
11
|
-
import { useBasePath as
|
|
9
|
+
import { useConfirm as ee } from "../../components/ConfirmDialog.js";
|
|
10
|
+
import { PageLoader as s } from "../../components/PageLoader.js";
|
|
11
|
+
import { useBasePath as c } from "../../hooks/useBasePath.js";
|
|
12
|
+
import { useOpenOnAction as l } from "../../hooks/useOpenOnAction.js";
|
|
12
13
|
import { cn as u } from "../../utils/helpers.js";
|
|
13
14
|
import { useHealthyBowlContacts as d } from "../../hooks/useHealthyBowlContacts.js";
|
|
14
15
|
import { ContactFormModal as f } from "./ContactFormModal.js";
|
|
15
16
|
import { CsvImportModal as p } from "./CsvImportModal.js";
|
|
16
|
-
import { CONTACT_TYPE_TABS as
|
|
17
|
-
import { useMemo as
|
|
18
|
-
import { useI18n as
|
|
19
|
-
import { Contact as
|
|
20
|
-
import { useNavigate as
|
|
21
|
-
import { Fragment as
|
|
22
|
-
import { Button as
|
|
17
|
+
import { CONTACT_TYPE_TABS as te, contactStatusVariant as m, contactTypeLabel as h, contactTypeVariant as g } from "./labels.js";
|
|
18
|
+
import { useMemo as _, useState as v } from "react";
|
|
19
|
+
import { useI18n as y } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
|
|
20
|
+
import { Contact as b, Pencil as ne, Plus as x, Search as S, Trash2 as C, Upload as w, Users as T } from "lucide-react";
|
|
21
|
+
import { useNavigate as E } from "react-router";
|
|
22
|
+
import { Fragment as D, jsx as O, jsxs as k } from "react/jsx-runtime";
|
|
23
|
+
import { Button as A, Input as j } from "@burdenoff/fe-libs/ui";
|
|
23
24
|
// src/healthybowl/pages/contacts/ContactsPage.tsx
|
|
24
|
-
var
|
|
25
|
-
let { t:
|
|
25
|
+
var M = () => {
|
|
26
|
+
let { t: M } = y(), N = E(), { buildPath: P } = c(), { toast: F } = t(), I = ee(), [L, R] = v(null), [z, B] = v(""), [V, H] = v(!1), [U, W] = v(!1), [G, K] = v(null), [q, J] = v(null), { contacts: Y, loading: X, errors: Z, refetchContacts: re, createContact: ie, updateContact: ae, deleteContact: oe, importContacts: se } = d({
|
|
26
27
|
list: !0,
|
|
27
|
-
type:
|
|
28
|
-
search:
|
|
29
|
-
}),
|
|
30
|
-
K(null),
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
type: L,
|
|
29
|
+
search: z.trim() || null
|
|
30
|
+
}), Q = () => {
|
|
31
|
+
K(null), H(!0);
|
|
32
|
+
};
|
|
33
|
+
l("new", Q);
|
|
34
|
+
let ce = (e) => {
|
|
35
|
+
K(e), H(!0);
|
|
36
|
+
}, le = async (e) => {
|
|
37
|
+
G ? (await ae(e), F({
|
|
38
|
+
title: M("healthybowl.contacts.toast.updated", "Contact updated"),
|
|
36
39
|
description: String(e.name ?? G.name),
|
|
37
40
|
variant: "success"
|
|
38
|
-
})) : (await
|
|
39
|
-
title:
|
|
41
|
+
})) : (await ie(e), F({
|
|
42
|
+
title: M("healthybowl.contacts.toast.created", "Contact added"),
|
|
40
43
|
description: String(e.name ?? ""),
|
|
41
44
|
variant: "success"
|
|
42
45
|
}));
|
|
43
|
-
},
|
|
44
|
-
let t = await
|
|
45
|
-
return t &&
|
|
46
|
-
title:
|
|
47
|
-
description:
|
|
46
|
+
}, $ = async (e) => {
|
|
47
|
+
let t = await se(e);
|
|
48
|
+
return t && F({
|
|
49
|
+
title: M("healthybowl.contacts.toast.imported", "Import complete"),
|
|
50
|
+
description: M("healthybowl.contacts.toast.importedDesc", "{{imported}} added, {{updated}} updated, {{skipped}} skipped", {
|
|
48
51
|
imported: t.imported,
|
|
49
52
|
updated: t.updated,
|
|
50
53
|
skipped: t.skipped
|
|
51
54
|
}),
|
|
52
55
|
variant: "success"
|
|
53
56
|
}), t;
|
|
54
|
-
},
|
|
55
|
-
if (await
|
|
56
|
-
title:
|
|
57
|
-
message:
|
|
57
|
+
}, ue = async (e) => {
|
|
58
|
+
if (await I({
|
|
59
|
+
title: M("healthybowl.contacts.confirm.deleteTitle", "Delete contact?"),
|
|
60
|
+
message: M("healthybowl.contacts.confirm.delete", "Delete \"{{name}}\"? This cannot be undone.", { name: e.name })
|
|
58
61
|
})) {
|
|
59
62
|
J(e.id);
|
|
60
63
|
try {
|
|
61
|
-
await
|
|
62
|
-
title:
|
|
64
|
+
await oe(e.id), F({
|
|
65
|
+
title: M("healthybowl.contacts.toast.deleted", "Contact deleted"),
|
|
63
66
|
description: e.name,
|
|
64
67
|
variant: "success"
|
|
65
68
|
});
|
|
66
69
|
} catch (e) {
|
|
67
|
-
|
|
68
|
-
title:
|
|
70
|
+
F({
|
|
71
|
+
title: M("healthybowl.contacts.toast.deleteFailed", "Could not delete contact"),
|
|
69
72
|
description: e instanceof Error ? e.message : String(e),
|
|
70
73
|
variant: "error"
|
|
71
74
|
});
|
|
@@ -73,47 +76,47 @@ var N = () => {
|
|
|
73
76
|
J(null);
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
|
-
},
|
|
79
|
+
}, de = _(() => Y.filter((e) => e.type === "BUYER").length, [Y]), fe = _(() => Y.filter((e) => e.type === "SUPPLIER").length, [Y]), pe = [
|
|
77
80
|
{
|
|
78
81
|
key: "name",
|
|
79
|
-
header:
|
|
80
|
-
render: (e) => /* @__PURE__ */
|
|
82
|
+
header: M("healthybowl.contacts.table.name", "Name"),
|
|
83
|
+
render: (e) => /* @__PURE__ */ k("div", { children: [/* @__PURE__ */ O("div", {
|
|
81
84
|
className: "font-medium text-text-primary",
|
|
82
85
|
children: e.name
|
|
83
|
-
}), /* @__PURE__ */
|
|
86
|
+
}), /* @__PURE__ */ O("div", {
|
|
84
87
|
className: "text-xs text-text-secondary",
|
|
85
|
-
children:
|
|
88
|
+
children: h(e.type)
|
|
86
89
|
})] })
|
|
87
90
|
},
|
|
88
91
|
{
|
|
89
92
|
key: "type",
|
|
90
|
-
header:
|
|
91
|
-
render: (e) => /* @__PURE__ */
|
|
92
|
-
variant:
|
|
93
|
-
label:
|
|
93
|
+
header: M("healthybowl.contacts.table.type", "Type"),
|
|
94
|
+
render: (e) => /* @__PURE__ */ O(i, {
|
|
95
|
+
variant: g(e.type),
|
|
96
|
+
label: h(e.type)
|
|
94
97
|
})
|
|
95
98
|
},
|
|
96
99
|
{
|
|
97
100
|
key: "lastActivity",
|
|
98
|
-
header:
|
|
99
|
-
render: (e) => /* @__PURE__ */
|
|
101
|
+
header: M("healthybowl.contacts.table.lastActivity", "Last Order / Purchase"),
|
|
102
|
+
render: (e) => /* @__PURE__ */ O("span", {
|
|
100
103
|
className: "tabular-nums text-text-secondary",
|
|
101
104
|
children: e.type === "SUPPLIER" ? e.lastPurchaseDate ?? "—" : e.lastOrderDate ?? "—"
|
|
102
105
|
})
|
|
103
106
|
},
|
|
104
107
|
{
|
|
105
108
|
key: "phone",
|
|
106
|
-
header:
|
|
107
|
-
render: (e) => /* @__PURE__ */
|
|
109
|
+
header: M("healthybowl.contacts.table.phone", "Phone"),
|
|
110
|
+
render: (e) => /* @__PURE__ */ O("span", {
|
|
108
111
|
className: "text-text-secondary",
|
|
109
112
|
children: e.phone ?? "—"
|
|
110
113
|
})
|
|
111
114
|
},
|
|
112
115
|
{
|
|
113
116
|
key: "status",
|
|
114
|
-
header:
|
|
115
|
-
render: (e) => /* @__PURE__ */
|
|
116
|
-
variant:
|
|
117
|
+
header: M("healthybowl.contacts.table.status", "Status"),
|
|
118
|
+
render: (e) => /* @__PURE__ */ O(i, {
|
|
119
|
+
variant: m(e.status),
|
|
117
120
|
label: e.status.toLowerCase(),
|
|
118
121
|
dot: !0
|
|
119
122
|
})
|
|
@@ -121,118 +124,118 @@ var N = () => {
|
|
|
121
124
|
{
|
|
122
125
|
key: "actions",
|
|
123
126
|
header: "",
|
|
124
|
-
render: (e) => /* @__PURE__ */
|
|
127
|
+
render: (e) => /* @__PURE__ */ k("div", {
|
|
125
128
|
className: "flex items-center justify-end gap-1",
|
|
126
|
-
children: [/* @__PURE__ */
|
|
129
|
+
children: [/* @__PURE__ */ O(A, {
|
|
127
130
|
variant: "ghost",
|
|
128
131
|
size: "icon-sm",
|
|
129
132
|
disabled: q === e.id,
|
|
130
133
|
onClick: (t) => {
|
|
131
|
-
t.stopPropagation(),
|
|
134
|
+
t.stopPropagation(), ce(e);
|
|
132
135
|
},
|
|
133
|
-
"aria-label":
|
|
134
|
-
children: /* @__PURE__ */
|
|
135
|
-
}), /* @__PURE__ */
|
|
136
|
+
"aria-label": M("healthybowl.contacts.actions.edit", "Edit contact"),
|
|
137
|
+
children: /* @__PURE__ */ O(ne, { className: "h-4 w-4" })
|
|
138
|
+
}), /* @__PURE__ */ O(A, {
|
|
136
139
|
variant: "ghost",
|
|
137
140
|
size: "icon-sm",
|
|
138
141
|
disabled: q === e.id,
|
|
139
142
|
onClick: (t) => {
|
|
140
|
-
t.stopPropagation(),
|
|
143
|
+
t.stopPropagation(), ue(e);
|
|
141
144
|
},
|
|
142
|
-
"aria-label":
|
|
145
|
+
"aria-label": M("healthybowl.contacts.actions.delete", "Delete contact"),
|
|
143
146
|
className: "text-text-secondary hover:text-status-error-text",
|
|
144
|
-
children: /* @__PURE__ */
|
|
147
|
+
children: /* @__PURE__ */ O(C, { className: "h-4 w-4" })
|
|
145
148
|
})]
|
|
146
149
|
})
|
|
147
150
|
}
|
|
148
151
|
];
|
|
149
|
-
return X.list && Y.length === 0 ? /* @__PURE__ */
|
|
150
|
-
title:
|
|
151
|
-
titleAccent:
|
|
152
|
-
description:
|
|
153
|
-
actions: /* @__PURE__ */
|
|
152
|
+
return X.list && Y.length === 0 ? /* @__PURE__ */ O(s, {}) : /* @__PURE__ */ k(e, {
|
|
153
|
+
title: M("healthybowl.contacts.title", "Contacts"),
|
|
154
|
+
titleAccent: M("healthybowl.contacts.titleAccent", "Contacts"),
|
|
155
|
+
description: M("healthybowl.contacts.description", "Your buyers and suppliers — contact details, notes, and order history."),
|
|
156
|
+
actions: /* @__PURE__ */ k("div", {
|
|
154
157
|
className: "flex items-center gap-2",
|
|
155
|
-
children: [/* @__PURE__ */ A
|
|
158
|
+
children: [/* @__PURE__ */ k(A, {
|
|
156
159
|
variant: "outline",
|
|
157
160
|
onClick: () => W(!0),
|
|
158
|
-
children: [/* @__PURE__ */
|
|
159
|
-
}), /* @__PURE__ */ A
|
|
160
|
-
onClick:
|
|
161
|
-
children: [/* @__PURE__ */
|
|
161
|
+
children: [/* @__PURE__ */ O(w, { className: "h-4 w-4" }), M("healthybowl.contacts.actions.import", "Import CSV")]
|
|
162
|
+
}), /* @__PURE__ */ k(A, {
|
|
163
|
+
onClick: Q,
|
|
164
|
+
children: [/* @__PURE__ */ O(x, { className: "h-4 w-4" }), M("healthybowl.contacts.actions.new", "Add Contact")]
|
|
162
165
|
})]
|
|
163
166
|
}),
|
|
164
167
|
children: [
|
|
165
|
-
Z.list && Y.length === 0 ? /* @__PURE__ */
|
|
168
|
+
Z.list && Y.length === 0 ? /* @__PURE__ */ O(o, {
|
|
166
169
|
description: Z.list.message,
|
|
167
|
-
onRetry: () => void
|
|
168
|
-
}) : /* @__PURE__ */
|
|
169
|
-
/* @__PURE__ */
|
|
170
|
+
onRetry: () => void re()
|
|
171
|
+
}) : /* @__PURE__ */ k(D, { children: [
|
|
172
|
+
/* @__PURE__ */ k("div", {
|
|
170
173
|
className: "mt-4 grid grid-cols-1 gap-3 sm:grid-cols-3",
|
|
171
174
|
children: [
|
|
172
|
-
/* @__PURE__ */
|
|
173
|
-
label:
|
|
175
|
+
/* @__PURE__ */ O(n, {
|
|
176
|
+
label: M("healthybowl.contacts.stats.total", "Contacts"),
|
|
174
177
|
value: Y.length,
|
|
175
|
-
icon: /* @__PURE__ */
|
|
178
|
+
icon: /* @__PURE__ */ O(T, { className: "h-5 w-5" }),
|
|
176
179
|
hero: !0
|
|
177
180
|
}),
|
|
178
|
-
/* @__PURE__ */
|
|
179
|
-
label:
|
|
180
|
-
value: ue
|
|
181
|
-
}),
|
|
182
|
-
/* @__PURE__ */ k(n, {
|
|
183
|
-
label: N("healthybowl.contacts.stats.suppliers", "Suppliers"),
|
|
181
|
+
/* @__PURE__ */ O(n, {
|
|
182
|
+
label: M("healthybowl.contacts.stats.buyers", "Buyers"),
|
|
184
183
|
value: de
|
|
184
|
+
}),
|
|
185
|
+
/* @__PURE__ */ O(n, {
|
|
186
|
+
label: M("healthybowl.contacts.stats.suppliers", "Suppliers"),
|
|
187
|
+
value: fe
|
|
185
188
|
})
|
|
186
189
|
]
|
|
187
190
|
}),
|
|
188
|
-
/* @__PURE__ */
|
|
191
|
+
/* @__PURE__ */ k("div", {
|
|
189
192
|
className: "mt-4 flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between",
|
|
190
|
-
children: [/* @__PURE__ */
|
|
193
|
+
children: [/* @__PURE__ */ O("div", {
|
|
191
194
|
className: "flex flex-wrap gap-1",
|
|
192
|
-
children:
|
|
195
|
+
children: te.map((e) => /* @__PURE__ */ O("button", {
|
|
193
196
|
type: "button",
|
|
194
|
-
onClick: () =>
|
|
195
|
-
className: u("rounded-full px-3 py-1.5 text-sm font-medium transition-colors",
|
|
196
|
-
children:
|
|
197
|
+
onClick: () => R(e.value),
|
|
198
|
+
className: u("rounded-full px-3 py-1.5 text-sm font-medium transition-colors", L === e.value ? "bg-accent-teal text-white" : "bg-bg-sunken text-text-secondary hover:text-text-primary"),
|
|
199
|
+
children: M(`healthybowl.contacts.tabs.${e.key.toLowerCase()}`, e.label)
|
|
197
200
|
}, e.key))
|
|
198
|
-
}), /* @__PURE__ */
|
|
201
|
+
}), /* @__PURE__ */ k("div", {
|
|
199
202
|
className: "relative sm:w-64",
|
|
200
|
-
children: [/* @__PURE__ */
|
|
201
|
-
value:
|
|
202
|
-
onChange: (e) =>
|
|
203
|
-
placeholder:
|
|
203
|
+
children: [/* @__PURE__ */ O(S, { className: "pointer-events-none absolute start-2.5 top-1/2 h-4 w-4 -translate-y-1/2 text-text-tertiary" }), /* @__PURE__ */ O(j, {
|
|
204
|
+
value: z,
|
|
205
|
+
onChange: (e) => B(e.target.value),
|
|
206
|
+
placeholder: M("healthybowl.contacts.search", "Search name, phone, email"),
|
|
204
207
|
className: "ps-8"
|
|
205
208
|
})]
|
|
206
209
|
})]
|
|
207
210
|
}),
|
|
208
|
-
Y.length === 0 ? /* @__PURE__ */
|
|
209
|
-
icon: /* @__PURE__ */
|
|
210
|
-
title:
|
|
211
|
-
description:
|
|
212
|
-
action: /* @__PURE__ */ A
|
|
213
|
-
onClick:
|
|
214
|
-
children: [/* @__PURE__ */
|
|
211
|
+
Y.length === 0 ? /* @__PURE__ */ O(a, {
|
|
212
|
+
icon: /* @__PURE__ */ O(b, { className: "h-8 w-8 text-text-secondary" }),
|
|
213
|
+
title: M("healthybowl.contacts.empty.title", "No contacts yet"),
|
|
214
|
+
description: M("healthybowl.contacts.empty.description", "Add a buyer or supplier, or import your existing contacts from a CSV."),
|
|
215
|
+
action: /* @__PURE__ */ k(A, {
|
|
216
|
+
onClick: Q,
|
|
217
|
+
children: [/* @__PURE__ */ O(x, { className: "h-4 w-4" }), M("healthybowl.contacts.actions.new", "Add Contact")]
|
|
215
218
|
})
|
|
216
|
-
}) : /* @__PURE__ */
|
|
217
|
-
columns:
|
|
219
|
+
}) : /* @__PURE__ */ O(r, {
|
|
220
|
+
columns: pe,
|
|
218
221
|
data: Y,
|
|
219
222
|
keyField: "id",
|
|
220
223
|
pageSize: 12,
|
|
221
|
-
onRowClick: (e) => P(
|
|
224
|
+
onRowClick: (e) => N(P(`contacts/${e.id}`))
|
|
222
225
|
})
|
|
223
226
|
] }),
|
|
224
|
-
/* @__PURE__ */
|
|
225
|
-
open:
|
|
226
|
-
onClose: () =>
|
|
227
|
+
/* @__PURE__ */ O(f, {
|
|
228
|
+
open: V,
|
|
229
|
+
onClose: () => H(!1),
|
|
227
230
|
contact: G,
|
|
228
|
-
onSubmit:
|
|
231
|
+
onSubmit: le
|
|
229
232
|
}),
|
|
230
|
-
/* @__PURE__ */
|
|
231
|
-
open:
|
|
233
|
+
/* @__PURE__ */ O(p, {
|
|
234
|
+
open: U,
|
|
232
235
|
onClose: () => W(!1),
|
|
233
|
-
onImport:
|
|
236
|
+
onImport: $
|
|
234
237
|
})
|
|
235
238
|
]
|
|
236
239
|
});
|
|
237
240
|
};
|
|
238
|
-
export {
|
|
241
|
+
export { M as ContactsPage };
|
|
@@ -104,7 +104,7 @@ var f = "name,type,phone,email,address,gstin,notes,status\nBigBasket Organic,Buy
|
|
|
104
104
|
className: "font-mono text-xs"
|
|
105
105
|
})] }),
|
|
106
106
|
T ? /* @__PURE__ */ c("div", {
|
|
107
|
-
className: "rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text",
|
|
107
|
+
className: "rounded-md border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
108
108
|
children: T
|
|
109
109
|
}) : null,
|
|
110
110
|
C ? /* @__PURE__ */ l("div", {
|
|
@@ -56,7 +56,7 @@ var m = [
|
|
|
56
56
|
className: "space-y-3",
|
|
57
57
|
children: [
|
|
58
58
|
L ? /* @__PURE__ */ a("div", {
|
|
59
|
-
className: "rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text",
|
|
59
|
+
className: "rounded-md border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
60
60
|
children: L
|
|
61
61
|
}) : null,
|
|
62
62
|
/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("label", {
|
|
@@ -67,7 +67,7 @@ var m = [
|
|
|
67
67
|
className: "space-y-3",
|
|
68
68
|
children: [
|
|
69
69
|
V ? /* @__PURE__ */ a("div", {
|
|
70
|
-
className: "rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text",
|
|
70
|
+
className: "rounded-md border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
71
71
|
children: V
|
|
72
72
|
}) : null,
|
|
73
73
|
/* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("label", {
|
|
@@ -206,7 +206,7 @@ function m({ open: m, onClose: h, onSubmit: g }) {
|
|
|
206
206
|
]
|
|
207
207
|
}),
|
|
208
208
|
B ? /* @__PURE__ */ c("div", {
|
|
209
|
-
className: "rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text",
|
|
209
|
+
className: "rounded-md border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
210
210
|
children: B
|
|
211
211
|
}) : null
|
|
212
212
|
]
|
|
@@ -184,7 +184,7 @@ function b({ error: e, settling: t }) {
|
|
|
184
184
|
let { t: n } = f();
|
|
185
185
|
return /* @__PURE__ */ h("div", {
|
|
186
186
|
role: "alert",
|
|
187
|
-
className: "rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text",
|
|
187
|
+
className: "rounded-md border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
188
188
|
children: [e.conflict && t ? /* @__PURE__ */ m("p", {
|
|
189
189
|
className: "font-semibold",
|
|
190
190
|
children: n("healthybowl.contracts.settle.conflictTitle", "The server refused this settlement")
|
|
@@ -90,7 +90,7 @@ function d({ open: d, onClose: f, contractCrop: p, onSubmit: m }) {
|
|
|
90
90
|
})] })]
|
|
91
91
|
}),
|
|
92
92
|
w ? /* @__PURE__ */ a("div", {
|
|
93
|
-
className: "rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text",
|
|
93
|
+
className: "rounded-md border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
94
94
|
children: w
|
|
95
95
|
}) : null
|
|
96
96
|
]
|
|
@@ -52,7 +52,7 @@ function f({ open: f, onClose: p, contractId: m, assignments: h, onSubmit: g })
|
|
|
52
52
|
className: "space-y-4",
|
|
53
53
|
children: [
|
|
54
54
|
v.length === 0 ? /* @__PURE__ */ a("div", {
|
|
55
|
-
className: "rounded-md border border-status-warning-border bg-status-warning-bg px-3 py-2 text-sm text-status-warning-text",
|
|
55
|
+
className: "rounded-md border border-status-warning-border bg-status-warning-bg-subtle px-3 py-2 text-sm text-status-warning-text",
|
|
56
56
|
children: _("healthybowl.contracts.delivery.noFarms", "No farm has accepted this contract yet. Invite a farm and have it accept before recording deliveries.")
|
|
57
57
|
}) : /* @__PURE__ */ o("div", { children: [/* @__PURE__ */ a("label", {
|
|
58
58
|
className: l,
|
|
@@ -105,7 +105,7 @@ function f({ open: f, onClose: p, contractId: m, assignments: h, onSubmit: g })
|
|
|
105
105
|
})] })]
|
|
106
106
|
}),
|
|
107
107
|
k ? /* @__PURE__ */ a("div", {
|
|
108
|
-
className: "rounded-md border border-status-error-border bg-status-error-bg px-3 py-2 text-sm text-status-error-text",
|
|
108
|
+
className: "rounded-md border border-status-error-border bg-status-error-bg-subtle px-3 py-2 text-sm text-status-error-text",
|
|
109
109
|
children: k
|
|
110
110
|
}) : null
|
|
111
111
|
]
|