@burdenoff/microfe-healthybowl 2026.816.1 → 2026.816.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.
|
@@ -24,13 +24,13 @@ import { Fragment as b, jsx as x, jsxs as S } from "react/jsx-runtime";
|
|
|
24
24
|
import { Button as C } from "@burdenoff/fe-libs/ui";
|
|
25
25
|
import { useSaveToFiles as ve } from "@burdenoff/fe-libs/storage";
|
|
26
26
|
//#region src/healthybowl/pages/nursery/NurseryProvenancePage.tsx
|
|
27
|
-
var
|
|
27
|
+
var ye = /* @__PURE__ */ e(d(), 1), w = "h-9 w-full rounded-md border border-border-subtle bg-bg-surface px-3 text-sm text-text-primary placeholder:text-text-secondary focus:outline-none focus:ring-2 focus:ring-[var(--color-focus-ring)]", T = [
|
|
28
28
|
"sown",
|
|
29
29
|
"growing",
|
|
30
30
|
"hardening",
|
|
31
31
|
"ready_to_transplant",
|
|
32
32
|
"transplanted"
|
|
33
|
-
], be = {
|
|
33
|
+
], be = T.filter((e) => e !== "transplanted"), xe = {
|
|
34
34
|
sown: "info",
|
|
35
35
|
growing: "success",
|
|
36
36
|
hardening: "warning",
|
|
@@ -61,42 +61,42 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
61
61
|
let n = Number(t);
|
|
62
62
|
return Number.isFinite(n) ? n : void 0;
|
|
63
63
|
}, k = () => {
|
|
64
|
-
let { t: e } = h(), t = l(), { seedLots: r, batches: d, loading: ae, error: oe, refetch: se, createSeedLot: ce, updateSeedLot: le, deleteSeedLot: ue, setSeedLotPublished: _, createBatch: de,
|
|
64
|
+
let { t: e } = h(), t = l(), { seedLots: r, batches: d, loading: ae, error: oe, refetch: se, createSeedLot: ce, updateSeedLot: le, deleteSeedLot: ue, setSeedLotPublished: _, createBatch: de, updateBatch: ge, deleteBatch: ve, transplantBatch: ye } = re(), { suppliers: k } = ie(), { fields: M, crops: N } = ne(), { toasts: Te, toast: P, dismiss: Ee } = te(), De = p(() => new Map(k.map((e) => [e.id, e])), [k]), F = p(() => new Map(r.map((e) => [e.id, e])), [r]), I = p(() => new Map(M.map((e) => [e.id, e])), [M]), Oe = p(() => {
|
|
65
65
|
let e = /* @__PURE__ */ new Map();
|
|
66
66
|
for (let t of d) {
|
|
67
67
|
let n = e.get(t.seedLotId) ?? [];
|
|
68
68
|
n.push(t), e.set(t.seedLotId, n);
|
|
69
69
|
}
|
|
70
70
|
return e;
|
|
71
|
-
}, [d]), [
|
|
72
|
-
if (
|
|
73
|
-
|
|
71
|
+
}, [d]), [ke, L] = m(!1), [R, z] = m(null), [B, V] = m(E), [Ae, je] = m(!1), H = R ? F.get(R) : void 0, [Me, Ne] = m(!1), Pe = async (t) => {
|
|
72
|
+
if (R) {
|
|
73
|
+
Ne(!0);
|
|
74
74
|
try {
|
|
75
|
-
await _(
|
|
75
|
+
await _(R, t), P({
|
|
76
76
|
title: t ? e("healthybowl.nursery.seedLot.publish.toast.published.title", "Seed lot published") : e("healthybowl.nursery.seedLot.publish.toast.unpublished.title", "Seed lot unpublished"),
|
|
77
77
|
description: t ? e("healthybowl.nursery.seedLot.publish.toast.published.description", "Its provenance page is now public. Reprint the QR so cartons carry the public link.") : e("healthybowl.nursery.seedLot.publish.toast.unpublished.description", "The public page no longer resolves. The link is kept, so republishing revives already-printed QRs."),
|
|
78
78
|
variant: "success"
|
|
79
79
|
});
|
|
80
80
|
} catch (t) {
|
|
81
|
-
|
|
81
|
+
P({
|
|
82
82
|
title: e("healthybowl.nursery.seedLot.publish.toast.error.title", "Could not change publish state"),
|
|
83
83
|
description: t instanceof Error ? t.message : e("healthybowl.nursery.seedLot.publish.toast.error.description", "Please try again."),
|
|
84
84
|
variant: "error"
|
|
85
85
|
});
|
|
86
86
|
} finally {
|
|
87
|
-
|
|
87
|
+
Ne(!1);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
},
|
|
90
|
+
}, U = (e, t) => V((n) => ({
|
|
91
91
|
...n,
|
|
92
92
|
[e]: t
|
|
93
|
-
})),
|
|
94
|
-
|
|
93
|
+
})), Fe = () => {
|
|
94
|
+
V({
|
|
95
95
|
...E,
|
|
96
|
-
supplierId:
|
|
97
|
-
}),
|
|
98
|
-
},
|
|
99
|
-
|
|
96
|
+
supplierId: k[0]?.id ?? ""
|
|
97
|
+
}), z(null), L(!0);
|
|
98
|
+
}, Ie = (e) => {
|
|
99
|
+
V({
|
|
100
100
|
cropVariety: e.cropVariety ?? "",
|
|
101
101
|
supplierId: e.supplierId ?? "",
|
|
102
102
|
lotNumber: e.lotNumber ?? "",
|
|
@@ -107,12 +107,12 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
107
107
|
certExpiry: e.certExpiry ?? "",
|
|
108
108
|
certifiedOrganic: e.certifiedOrganic ?? !1,
|
|
109
109
|
fileIds: e.fileIds ?? []
|
|
110
|
-
}),
|
|
111
|
-
},
|
|
112
|
-
|
|
113
|
-
},
|
|
114
|
-
if (!
|
|
115
|
-
|
|
110
|
+
}), z(e.id), L(!0);
|
|
111
|
+
}, Le = () => {
|
|
112
|
+
V(E), z(null), L(!1);
|
|
113
|
+
}, Re = async () => {
|
|
114
|
+
if (!B.cropVariety.trim() || !B.lotNumber.trim() || !B.supplierId) {
|
|
115
|
+
P({
|
|
116
116
|
title: e("healthybowl.nursery.seedLot.toast.required.title", "Missing required fields"),
|
|
117
117
|
description: e("healthybowl.nursery.seedLot.toast.required.description", "Crop/variety, lot number and supplier are required."),
|
|
118
118
|
variant: "warning"
|
|
@@ -120,68 +120,68 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
120
120
|
return;
|
|
121
121
|
}
|
|
122
122
|
let t = {
|
|
123
|
-
cropVariety:
|
|
124
|
-
supplierId:
|
|
125
|
-
lotNumber:
|
|
126
|
-
quantity: O(
|
|
127
|
-
unit:
|
|
128
|
-
purchaseDate:
|
|
129
|
-
certStandard:
|
|
130
|
-
certExpiry:
|
|
131
|
-
certifiedOrganic:
|
|
132
|
-
fileIds:
|
|
123
|
+
cropVariety: B.cropVariety.trim(),
|
|
124
|
+
supplierId: B.supplierId,
|
|
125
|
+
lotNumber: B.lotNumber.trim(),
|
|
126
|
+
quantity: O(B.quantity),
|
|
127
|
+
unit: B.unit.trim() || void 0,
|
|
128
|
+
purchaseDate: B.purchaseDate || void 0,
|
|
129
|
+
certStandard: B.certStandard.trim() || void 0,
|
|
130
|
+
certExpiry: B.certExpiry || void 0,
|
|
131
|
+
certifiedOrganic: B.certifiedOrganic,
|
|
132
|
+
fileIds: B.fileIds
|
|
133
133
|
};
|
|
134
|
-
|
|
134
|
+
je(!0);
|
|
135
135
|
try {
|
|
136
|
-
|
|
136
|
+
R ? (await le(R, t), P({
|
|
137
137
|
title: e("healthybowl.nursery.seedLot.toast.updated.title", "Seed lot updated"),
|
|
138
138
|
description: e("healthybowl.nursery.seedLot.toast.updated.description", "Lot \"{{lot}}\" has been updated.", { lot: t.lotNumber }),
|
|
139
139
|
variant: "success"
|
|
140
|
-
})) : (await ce(t),
|
|
140
|
+
})) : (await ce(t), P({
|
|
141
141
|
title: e("healthybowl.nursery.seedLot.toast.added.title", "Seed lot recorded"),
|
|
142
142
|
description: e("healthybowl.nursery.seedLot.toast.added.description", "Lot \"{{lot}}\" has been recorded.", { lot: t.lotNumber }),
|
|
143
143
|
variant: "success"
|
|
144
|
-
})),
|
|
144
|
+
})), Le();
|
|
145
145
|
} catch (t) {
|
|
146
|
-
|
|
146
|
+
P({
|
|
147
147
|
title: e("healthybowl.nursery.seedLot.toast.error.title", "Could not save seed lot"),
|
|
148
148
|
description: t instanceof Error ? t.message : e("healthybowl.nursery.toast.genericError", "Something went wrong. Please try again."),
|
|
149
149
|
variant: "error"
|
|
150
150
|
});
|
|
151
151
|
} finally {
|
|
152
|
-
|
|
152
|
+
je(!1);
|
|
153
153
|
}
|
|
154
|
-
},
|
|
154
|
+
}, ze = async (n) => {
|
|
155
155
|
if (await t({ message: e("healthybowl.nursery.seedLot.confirm.delete", "Delete seed lot \"{{lot}}\"? This cannot be undone.", { lot: n.lotNumber }) })) try {
|
|
156
|
-
await ue(n.id),
|
|
156
|
+
await ue(n.id), P({
|
|
157
157
|
title: e("healthybowl.nursery.seedLot.toast.deleted.title", "Seed lot deleted"),
|
|
158
158
|
variant: "success"
|
|
159
159
|
});
|
|
160
160
|
} catch (t) {
|
|
161
|
-
|
|
161
|
+
P({
|
|
162
162
|
title: e("healthybowl.nursery.seedLot.toast.error.title", "Could not save seed lot"),
|
|
163
163
|
description: t instanceof Error ? t.message : void 0,
|
|
164
164
|
variant: "error"
|
|
165
165
|
});
|
|
166
166
|
}
|
|
167
|
-
}, [
|
|
167
|
+
}, [Be, W] = m(!1), [G, Ve] = m(D), [He, Ue] = m(!1), K = (e, t) => Ve((n) => ({
|
|
168
168
|
...n,
|
|
169
169
|
[e]: t
|
|
170
|
-
})),
|
|
171
|
-
|
|
170
|
+
})), We = () => {
|
|
171
|
+
Ve({
|
|
172
172
|
...D,
|
|
173
173
|
seedLotId: r[0]?.id ?? ""
|
|
174
174
|
}), W(!0);
|
|
175
|
-
},
|
|
175
|
+
}, Ge = async () => {
|
|
176
176
|
if (!G.seedLotId || !G.batchCode.trim()) {
|
|
177
|
-
|
|
177
|
+
P({
|
|
178
178
|
title: e("healthybowl.nursery.batch.toast.required.title", "Missing required fields"),
|
|
179
179
|
description: e("healthybowl.nursery.batch.toast.required.description", "Seed lot and batch code are required."),
|
|
180
180
|
variant: "warning"
|
|
181
181
|
});
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
|
-
|
|
184
|
+
Ue(!0);
|
|
185
185
|
try {
|
|
186
186
|
await de({
|
|
187
187
|
seedLotId: G.seedLotId,
|
|
@@ -191,64 +191,90 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
191
191
|
quantity: O(G.quantity),
|
|
192
192
|
germinationPct: O(G.germinationPct),
|
|
193
193
|
status: G.status
|
|
194
|
-
}),
|
|
194
|
+
}), P({
|
|
195
195
|
title: e("healthybowl.nursery.batch.toast.added.title", "Batch started"),
|
|
196
196
|
description: e("healthybowl.nursery.batch.toast.added.description", "Batch \"{{code}}\" has been started.", { code: G.batchCode.trim() }),
|
|
197
197
|
variant: "success"
|
|
198
|
-
}), W(!1),
|
|
198
|
+
}), W(!1), Ve(D);
|
|
199
199
|
} catch (t) {
|
|
200
|
-
|
|
200
|
+
P({
|
|
201
201
|
title: e("healthybowl.nursery.batch.toast.error.title", "Could not save batch"),
|
|
202
202
|
description: t instanceof Error ? t.message : e("healthybowl.nursery.toast.genericError", "Something went wrong. Please try again."),
|
|
203
203
|
variant: "error"
|
|
204
204
|
});
|
|
205
205
|
} finally {
|
|
206
|
-
|
|
206
|
+
Ue(!1);
|
|
207
207
|
}
|
|
208
|
-
},
|
|
208
|
+
}, [Ke, qe] = m(null), Je = async (t, n) => {
|
|
209
|
+
if (n !== t.status) {
|
|
210
|
+
qe(t.id);
|
|
211
|
+
try {
|
|
212
|
+
await ge(t.id, {
|
|
213
|
+
seedLotId: t.seedLotId,
|
|
214
|
+
batchCode: t.batchCode,
|
|
215
|
+
status: n
|
|
216
|
+
}), P({
|
|
217
|
+
title: e("healthybowl.nursery.batch.toast.moved.title", "Batch updated"),
|
|
218
|
+
description: e("healthybowl.nursery.batch.toast.moved.description", "Batch \"{{code}}\" is now {{status}}.", {
|
|
219
|
+
code: t.batchCode,
|
|
220
|
+
status: X(n)
|
|
221
|
+
}),
|
|
222
|
+
variant: "success"
|
|
223
|
+
});
|
|
224
|
+
} catch (t) {
|
|
225
|
+
P({
|
|
226
|
+
title: e("healthybowl.nursery.batch.toast.error.title", "Could not save batch"),
|
|
227
|
+
description: t instanceof Error ? t.message : void 0,
|
|
228
|
+
variant: "error"
|
|
229
|
+
});
|
|
230
|
+
} finally {
|
|
231
|
+
qe(null);
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
}, Ye = async (n) => {
|
|
209
235
|
if (await t({ message: e("healthybowl.nursery.batch.confirm.delete", "Delete batch \"{{code}}\"? This cannot be undone.", { code: n.batchCode }) })) try {
|
|
210
|
-
await
|
|
236
|
+
await ve(n.id), P({
|
|
211
237
|
title: e("healthybowl.nursery.batch.toast.deleted.title", "Batch deleted"),
|
|
212
238
|
variant: "success"
|
|
213
239
|
});
|
|
214
240
|
} catch (t) {
|
|
215
|
-
|
|
241
|
+
P({
|
|
216
242
|
title: e("healthybowl.nursery.batch.toast.error.title", "Could not save batch"),
|
|
217
243
|
description: t instanceof Error ? t.message : void 0,
|
|
218
244
|
variant: "error"
|
|
219
245
|
});
|
|
220
246
|
}
|
|
221
|
-
}, [
|
|
222
|
-
|
|
223
|
-
},
|
|
224
|
-
if (!
|
|
225
|
-
|
|
247
|
+
}, [q, J] = m(null), [Y, Xe] = m(""), [Ze, Qe] = m(""), [$e, et] = m(!1), tt = (e) => {
|
|
248
|
+
J(e), Xe(M[0]?.id ?? ""), Qe(N[0]?.id ?? "");
|
|
249
|
+
}, nt = async () => {
|
|
250
|
+
if (!q || !Y || !Ze) {
|
|
251
|
+
P({
|
|
226
252
|
title: e("healthybowl.nursery.transplant.toast.required.title", "Field and crop required"),
|
|
227
253
|
description: e("healthybowl.nursery.transplant.toast.required.description", "Choose the destination field and crop."),
|
|
228
254
|
variant: "warning"
|
|
229
255
|
});
|
|
230
256
|
return;
|
|
231
257
|
}
|
|
232
|
-
|
|
258
|
+
et(!0);
|
|
233
259
|
try {
|
|
234
|
-
await
|
|
260
|
+
await ye(q.id, Y, Ze), P({
|
|
235
261
|
title: e("healthybowl.nursery.transplant.toast.done.title", "Batch transplanted"),
|
|
236
262
|
description: e("healthybowl.nursery.transplant.toast.done.description", "\"{{code}}\" transplanted to {{field}}.", {
|
|
237
|
-
code:
|
|
238
|
-
field:
|
|
263
|
+
code: q.batchCode,
|
|
264
|
+
field: I.get(Y)?.name ?? "field"
|
|
239
265
|
}),
|
|
240
266
|
variant: "success"
|
|
241
|
-
}),
|
|
267
|
+
}), J(null);
|
|
242
268
|
} catch (t) {
|
|
243
|
-
|
|
269
|
+
P({
|
|
244
270
|
title: e("healthybowl.nursery.transplant.toast.error.title", "Could not transplant batch"),
|
|
245
271
|
description: t instanceof Error ? t.message : e("healthybowl.nursery.toast.genericError", "Something went wrong. Please try again."),
|
|
246
272
|
variant: "error"
|
|
247
273
|
});
|
|
248
274
|
} finally {
|
|
249
|
-
|
|
275
|
+
et(!1);
|
|
250
276
|
}
|
|
251
|
-
},
|
|
277
|
+
}, X = f((t) => e(`healthybowl.nursery.status.${t}`, t.split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ")), [e]), rt = f((t) => De.get(t)?.name ?? e("healthybowl.nursery.unknownSupplier", "Unknown supplier"), [De, e]), it = [
|
|
252
278
|
{
|
|
253
279
|
key: "cropVariety",
|
|
254
280
|
header: e("healthybowl.nursery.seedLot.columns.cropVariety", "Crop / Variety"),
|
|
@@ -270,7 +296,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
270
296
|
header: e("healthybowl.nursery.seedLot.columns.supplier", "Supplier"),
|
|
271
297
|
render: (e) => /* @__PURE__ */ x("span", {
|
|
272
298
|
className: "text-text-secondary",
|
|
273
|
-
children:
|
|
299
|
+
children: rt(e.supplierId)
|
|
274
300
|
})
|
|
275
301
|
},
|
|
276
302
|
{
|
|
@@ -303,7 +329,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
303
329
|
variant: "outline",
|
|
304
330
|
size: "icon-sm",
|
|
305
331
|
onClick: (e) => {
|
|
306
|
-
e.stopPropagation(),
|
|
332
|
+
e.stopPropagation(), Ie(t);
|
|
307
333
|
},
|
|
308
334
|
"aria-label": e("healthybowl.common.edit", "Edit"),
|
|
309
335
|
children: /* @__PURE__ */ x(fe, { className: "h-4 w-4" })
|
|
@@ -311,7 +337,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
311
337
|
variant: "ghost",
|
|
312
338
|
size: "icon-sm",
|
|
313
339
|
onClick: (e) => {
|
|
314
|
-
e.stopPropagation(),
|
|
340
|
+
e.stopPropagation(), ze(t);
|
|
315
341
|
},
|
|
316
342
|
"aria-label": e("healthybowl.common.delete", "Delete"),
|
|
317
343
|
className: "text-status-error-text hover:bg-status-error-bg/10 hover:text-status-error-text",
|
|
@@ -319,10 +345,10 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
319
345
|
})]
|
|
320
346
|
})
|
|
321
347
|
}
|
|
322
|
-
],
|
|
323
|
-
let e = new URLSearchParams(
|
|
324
|
-
e.delete("seedLot"),
|
|
325
|
-
}, [
|
|
348
|
+
], at = r.length > 0 || d.length > 0, [ot, st] = _e(), Z = ot.get("seedLot"), Q = Z ? F.get(Z) ?? null : null, ct = Z ? Oe.get(Z) ?? [] : [], lt = Array.from(new Set(ct.map((e) => e.fieldId ? I.get(e.fieldId)?.name : null).filter(Boolean))), ut = f(() => {
|
|
349
|
+
let e = new URLSearchParams(ot);
|
|
350
|
+
e.delete("seedLot"), st(e, { replace: !0 });
|
|
351
|
+
}, [ot, st]), $ = R ? Oe.get(R) ?? [] : [], dt = Array.from(new Set($.map((e) => e.fieldId ? I.get(e.fieldId)?.name : null).filter(Boolean)));
|
|
326
352
|
return /* @__PURE__ */ S(i, {
|
|
327
353
|
title: e("healthybowl.nursery.title", "Nursery & Seed Provenance"),
|
|
328
354
|
description: e("healthybowl.nursery.description", "Track seed lots from supplier to transplant, with certification provenance"),
|
|
@@ -331,7 +357,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
331
357
|
className: "flex items-center gap-2",
|
|
332
358
|
children: [/* @__PURE__ */ S(C, {
|
|
333
359
|
variant: "outline",
|
|
334
|
-
onClick:
|
|
360
|
+
onClick: We,
|
|
335
361
|
disabled: r.length === 0,
|
|
336
362
|
children: [
|
|
337
363
|
/* @__PURE__ */ x(y, { className: "h-4 w-4" }),
|
|
@@ -339,7 +365,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
339
365
|
e("healthybowl.nursery.actions.startBatch", "Start Batch")
|
|
340
366
|
]
|
|
341
367
|
}), /* @__PURE__ */ S(C, {
|
|
342
|
-
onClick:
|
|
368
|
+
onClick: Fe,
|
|
343
369
|
children: [
|
|
344
370
|
/* @__PURE__ */ x(pe, { className: "h-4 w-4" }),
|
|
345
371
|
" ",
|
|
@@ -348,7 +374,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
348
374
|
})]
|
|
349
375
|
}),
|
|
350
376
|
children: [
|
|
351
|
-
ae &&
|
|
377
|
+
ae && !at ? /* @__PURE__ */ x(ee, {}) : oe && !at ? /* @__PURE__ */ x(s, { onRetry: () => void se() }) : /* @__PURE__ */ S("div", {
|
|
352
378
|
className: "space-y-8",
|
|
353
379
|
children: [/* @__PURE__ */ S("section", {
|
|
354
380
|
className: "space-y-3",
|
|
@@ -374,7 +400,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
374
400
|
children: e("healthybowl.nursery.seedLots.empty.description", "Record a seed lot to capture its supplier and certification provenance.")
|
|
375
401
|
}),
|
|
376
402
|
/* @__PURE__ */ S(C, {
|
|
377
|
-
onClick:
|
|
403
|
+
onClick: Fe,
|
|
378
404
|
className: "mt-1",
|
|
379
405
|
children: [
|
|
380
406
|
/* @__PURE__ */ x(pe, { className: "h-4 w-4" }),
|
|
@@ -384,7 +410,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
384
410
|
})
|
|
385
411
|
]
|
|
386
412
|
}) : /* @__PURE__ */ x(a, {
|
|
387
|
-
columns:
|
|
413
|
+
columns: it,
|
|
388
414
|
data: r,
|
|
389
415
|
keyField: "id"
|
|
390
416
|
})]
|
|
@@ -412,7 +438,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
412
438
|
children: r.length === 0 ? e("healthybowl.nursery.batches.empty.needSeedLot", "Record a seed lot first, then start a batch from it.") : e("healthybowl.nursery.batches.empty.description", "Start a batch from one of your seed lots.")
|
|
413
439
|
}),
|
|
414
440
|
r.length > 0 && /* @__PURE__ */ S(C, {
|
|
415
|
-
onClick:
|
|
441
|
+
onClick: We,
|
|
416
442
|
className: "mt-1",
|
|
417
443
|
children: [
|
|
418
444
|
/* @__PURE__ */ x(y, { className: "h-4 w-4" }),
|
|
@@ -423,15 +449,15 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
423
449
|
]
|
|
424
450
|
}) : /* @__PURE__ */ x("div", {
|
|
425
451
|
className: "grid grid-cols-1 gap-4 sm:grid-cols-2 xl:grid-cols-5",
|
|
426
|
-
children:
|
|
452
|
+
children: T.map((t) => {
|
|
427
453
|
let n = d.filter((e) => e.status === t);
|
|
428
454
|
return /* @__PURE__ */ S("div", {
|
|
429
455
|
className: "flex flex-col gap-2",
|
|
430
456
|
children: [/* @__PURE__ */ S("div", {
|
|
431
457
|
className: "flex items-center justify-between",
|
|
432
458
|
children: [/* @__PURE__ */ x(o, {
|
|
433
|
-
label:
|
|
434
|
-
variant:
|
|
459
|
+
label: X(t),
|
|
460
|
+
variant: xe[t] ?? "default"
|
|
435
461
|
}), /* @__PURE__ */ x("span", {
|
|
436
462
|
className: "text-xs tabular-nums text-text-secondary",
|
|
437
463
|
children: n.length
|
|
@@ -439,7 +465,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
439
465
|
}), /* @__PURE__ */ S("div", {
|
|
440
466
|
className: "flex flex-col gap-2",
|
|
441
467
|
children: [n.map((t) => {
|
|
442
|
-
let n =
|
|
468
|
+
let n = F.get(t.seedLotId);
|
|
443
469
|
return /* @__PURE__ */ S("div", {
|
|
444
470
|
className: "rounded-lg border border-border-seam bg-gloss-card p-3 shadow-pop",
|
|
445
471
|
children: [
|
|
@@ -451,7 +477,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
451
477
|
}), /* @__PURE__ */ x(C, {
|
|
452
478
|
variant: "ghost",
|
|
453
479
|
size: "icon-sm",
|
|
454
|
-
onClick: () => void
|
|
480
|
+
onClick: () => void Ye(t),
|
|
455
481
|
"aria-label": e("healthybowl.common.delete", "Delete"),
|
|
456
482
|
className: "text-status-error-text hover:bg-status-error-bg/10 hover:text-status-error-text",
|
|
457
483
|
children: /* @__PURE__ */ x(he, { className: "h-3.5 w-3.5" })
|
|
@@ -479,18 +505,31 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
479
505
|
}),
|
|
480
506
|
t.status === "transplanted" && t.fieldId ? /* @__PURE__ */ S("p", {
|
|
481
507
|
className: "mt-1 flex items-center gap-1 text-xs text-text-secondary",
|
|
482
|
-
children: [/* @__PURE__ */ x(v, { className: "h-3 w-3" }),
|
|
483
|
-
}) : /* @__PURE__ */ S(
|
|
508
|
+
children: [/* @__PURE__ */ x(v, { className: "h-3 w-3" }), I.get(t.fieldId)?.name ?? e("healthybowl.nursery.batch.field", "Field")]
|
|
509
|
+
}) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ S("select", {
|
|
510
|
+
className: `${w} mt-2 h-8 text-xs`,
|
|
511
|
+
"aria-label": e("healthybowl.nursery.batch.statusLabel", "Status — {{code}}", { code: t.batchCode }),
|
|
512
|
+
value: t.status,
|
|
513
|
+
disabled: Ke === t.id,
|
|
514
|
+
onChange: (e) => void Je(t, e.target.value),
|
|
515
|
+
children: [be.map((e) => /* @__PURE__ */ x("option", {
|
|
516
|
+
value: e,
|
|
517
|
+
children: X(e)
|
|
518
|
+
}, e)), !be.some((e) => e === t.status) && /* @__PURE__ */ x("option", {
|
|
519
|
+
value: t.status,
|
|
520
|
+
children: X(t.status)
|
|
521
|
+
})]
|
|
522
|
+
}), /* @__PURE__ */ S(C, {
|
|
484
523
|
variant: "outline",
|
|
485
524
|
size: "sm",
|
|
486
525
|
className: "mt-2 w-full",
|
|
487
|
-
onClick: () =>
|
|
526
|
+
onClick: () => tt(t),
|
|
488
527
|
children: [
|
|
489
528
|
/* @__PURE__ */ x(v, { className: "h-3.5 w-3.5" }),
|
|
490
529
|
" ",
|
|
491
530
|
e("healthybowl.nursery.actions.transplant", "Transplant")
|
|
492
531
|
]
|
|
493
|
-
})
|
|
532
|
+
})] })
|
|
494
533
|
]
|
|
495
534
|
}, t.id);
|
|
496
535
|
}), n.length === 0 && /* @__PURE__ */ x("div", {
|
|
@@ -504,19 +543,19 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
504
543
|
})]
|
|
505
544
|
}),
|
|
506
545
|
/* @__PURE__ */ x(u, {
|
|
507
|
-
open:
|
|
508
|
-
onClose:
|
|
509
|
-
title:
|
|
546
|
+
open: ke,
|
|
547
|
+
onClose: Le,
|
|
548
|
+
title: R ? e("healthybowl.nursery.seedLot.modal.editTitle", "Edit Seed Lot") : e("healthybowl.nursery.seedLot.modal.title", "Record Seed Lot"),
|
|
510
549
|
description: e("healthybowl.nursery.seedLot.modal.description", "Capture the seed lot with its supplier, certification and attachments."),
|
|
511
550
|
size: "xl",
|
|
512
551
|
footer: /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
|
|
513
552
|
variant: "outline",
|
|
514
|
-
onClick:
|
|
553
|
+
onClick: Le,
|
|
515
554
|
children: e("healthybowl.common.cancel", "Cancel")
|
|
516
555
|
}), /* @__PURE__ */ x(C, {
|
|
517
|
-
onClick:
|
|
518
|
-
disabled:
|
|
519
|
-
children:
|
|
556
|
+
onClick: Re,
|
|
557
|
+
disabled: Ae,
|
|
558
|
+
children: Ae ? e("healthybowl.nursery.seedLot.actions.saving", "Saving...") : R ? e("healthybowl.common.saveChanges", "Save Changes") : e("healthybowl.nursery.actions.recordSeedLot", "Record Seed Lot")
|
|
520
559
|
})] }),
|
|
521
560
|
children: /* @__PURE__ */ S("div", {
|
|
522
561
|
className: "grid grid-cols-1 gap-5 lg:grid-cols-3",
|
|
@@ -532,10 +571,10 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
532
571
|
}), /* @__PURE__ */ x("input", {
|
|
533
572
|
id: "sl-crop",
|
|
534
573
|
type: "text",
|
|
535
|
-
value:
|
|
536
|
-
onChange: (e) =>
|
|
574
|
+
value: B.cropVariety,
|
|
575
|
+
onChange: (e) => U("cropVariety", e.target.value),
|
|
537
576
|
placeholder: e("healthybowl.nursery.seedLot.form.cropVariety.placeholder", "e.g., Tomato — Roma"),
|
|
538
|
-
className:
|
|
577
|
+
className: w
|
|
539
578
|
})] }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
540
579
|
htmlFor: "sl-lot",
|
|
541
580
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
@@ -543,10 +582,10 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
543
582
|
}), /* @__PURE__ */ x("input", {
|
|
544
583
|
id: "sl-lot",
|
|
545
584
|
type: "text",
|
|
546
|
-
value:
|
|
547
|
-
onChange: (e) =>
|
|
585
|
+
value: B.lotNumber,
|
|
586
|
+
onChange: (e) => U("lotNumber", e.target.value),
|
|
548
587
|
placeholder: "LOT-2026-001",
|
|
549
|
-
className:
|
|
588
|
+
className: w
|
|
550
589
|
})] })]
|
|
551
590
|
}),
|
|
552
591
|
/* @__PURE__ */ S("div", { children: [
|
|
@@ -557,18 +596,18 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
557
596
|
}),
|
|
558
597
|
/* @__PURE__ */ S("select", {
|
|
559
598
|
id: "sl-supplier",
|
|
560
|
-
value:
|
|
561
|
-
onChange: (e) =>
|
|
562
|
-
className:
|
|
599
|
+
value: B.supplierId,
|
|
600
|
+
onChange: (e) => U("supplierId", e.target.value),
|
|
601
|
+
className: w,
|
|
563
602
|
children: [/* @__PURE__ */ x("option", {
|
|
564
603
|
value: "",
|
|
565
604
|
children: e("healthybowl.nursery.seedLot.form.supplier.placeholder", "Select a supplier")
|
|
566
|
-
}),
|
|
605
|
+
}), k.map((e) => /* @__PURE__ */ x("option", {
|
|
567
606
|
value: e.id,
|
|
568
607
|
children: e.name
|
|
569
608
|
}, e.id))]
|
|
570
609
|
}),
|
|
571
|
-
|
|
610
|
+
k.length === 0 && /* @__PURE__ */ x("p", {
|
|
572
611
|
className: "mt-1 text-xs text-status-warning-text",
|
|
573
612
|
children: e("healthybowl.nursery.seedLot.form.supplier.none", "Add a supplier first on the Suppliers page.")
|
|
574
613
|
})
|
|
@@ -585,10 +624,10 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
585
624
|
type: "number",
|
|
586
625
|
min: "0",
|
|
587
626
|
step: "any",
|
|
588
|
-
value:
|
|
589
|
-
onChange: (e) =>
|
|
627
|
+
value: B.quantity,
|
|
628
|
+
onChange: (e) => U("quantity", e.target.value),
|
|
590
629
|
placeholder: "10",
|
|
591
|
-
className:
|
|
630
|
+
className: w
|
|
592
631
|
})] }),
|
|
593
632
|
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
594
633
|
htmlFor: "sl-unit",
|
|
@@ -597,10 +636,10 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
597
636
|
}), /* @__PURE__ */ x("input", {
|
|
598
637
|
id: "sl-unit",
|
|
599
638
|
type: "text",
|
|
600
|
-
value:
|
|
601
|
-
onChange: (e) =>
|
|
639
|
+
value: B.unit,
|
|
640
|
+
onChange: (e) => U("unit", e.target.value),
|
|
602
641
|
placeholder: "kg / g / packets",
|
|
603
|
-
className:
|
|
642
|
+
className: w
|
|
604
643
|
})] }),
|
|
605
644
|
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
606
645
|
htmlFor: "sl-purchase",
|
|
@@ -609,9 +648,9 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
609
648
|
}), /* @__PURE__ */ x("input", {
|
|
610
649
|
id: "sl-purchase",
|
|
611
650
|
type: "date",
|
|
612
|
-
value:
|
|
613
|
-
onChange: (e) =>
|
|
614
|
-
className:
|
|
651
|
+
value: B.purchaseDate,
|
|
652
|
+
onChange: (e) => U("purchaseDate", e.target.value),
|
|
653
|
+
className: w
|
|
615
654
|
})] })
|
|
616
655
|
]
|
|
617
656
|
}),
|
|
@@ -624,10 +663,10 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
624
663
|
}), /* @__PURE__ */ x("input", {
|
|
625
664
|
id: "sl-cert",
|
|
626
665
|
type: "text",
|
|
627
|
-
value:
|
|
628
|
-
onChange: (e) =>
|
|
666
|
+
value: B.certStandard,
|
|
667
|
+
onChange: (e) => U("certStandard", e.target.value),
|
|
629
668
|
placeholder: "e.g., NPOP / USDA Organic",
|
|
630
|
-
className:
|
|
669
|
+
className: w
|
|
631
670
|
})] }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
632
671
|
htmlFor: "sl-cert-expiry",
|
|
633
672
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
@@ -635,26 +674,26 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
635
674
|
}), /* @__PURE__ */ x("input", {
|
|
636
675
|
id: "sl-cert-expiry",
|
|
637
676
|
type: "date",
|
|
638
|
-
value:
|
|
639
|
-
onChange: (e) =>
|
|
640
|
-
className:
|
|
677
|
+
value: B.certExpiry,
|
|
678
|
+
onChange: (e) => U("certExpiry", e.target.value),
|
|
679
|
+
className: w
|
|
641
680
|
})] })]
|
|
642
681
|
}),
|
|
643
682
|
/* @__PURE__ */ S("label", {
|
|
644
683
|
className: "flex cursor-pointer items-center gap-2 text-sm font-medium text-text-primary",
|
|
645
684
|
children: [/* @__PURE__ */ x("input", {
|
|
646
685
|
type: "checkbox",
|
|
647
|
-
checked:
|
|
648
|
-
onChange: (e) =>
|
|
686
|
+
checked: B.certifiedOrganic,
|
|
687
|
+
onChange: (e) => U("certifiedOrganic", e.target.checked),
|
|
649
688
|
className: "h-4 w-4 rounded border-border-subtle text-primary focus:ring-[var(--color-focus-ring)]"
|
|
650
689
|
}), e("healthybowl.nursery.seedLot.form.certifiedOrganic.label", "Certified organic")]
|
|
651
690
|
}),
|
|
652
691
|
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
653
692
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
654
693
|
children: e("healthybowl.nursery.seedLot.form.attachments.label", "Attachments")
|
|
655
|
-
}), /* @__PURE__ */ x(
|
|
656
|
-
fileIds:
|
|
657
|
-
onChange: (e) =>
|
|
694
|
+
}), /* @__PURE__ */ x(we, {
|
|
695
|
+
fileIds: B.fileIds,
|
|
696
|
+
onChange: (e) => U("fileIds", e)
|
|
658
697
|
})] })
|
|
659
698
|
]
|
|
660
699
|
}), /* @__PURE__ */ S("div", {
|
|
@@ -669,25 +708,25 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
669
708
|
/* @__PURE__ */ x(A, {
|
|
670
709
|
icon: /* @__PURE__ */ x(v, { className: "h-3.5 w-3.5" }),
|
|
671
710
|
label: e("healthybowl.nursery.seedLot.provenance.supplier", "Supplier"),
|
|
672
|
-
value:
|
|
711
|
+
value: B.supplierId ? rt(B.supplierId) : "—"
|
|
673
712
|
}),
|
|
674
713
|
/* @__PURE__ */ x(j, {}),
|
|
675
714
|
/* @__PURE__ */ x(A, {
|
|
676
715
|
icon: /* @__PURE__ */ x(g, { className: "h-3.5 w-3.5" }),
|
|
677
716
|
label: e("healthybowl.nursery.seedLot.provenance.seedLot", "Seed Lot"),
|
|
678
|
-
value:
|
|
717
|
+
value: B.cropVariety || B.lotNumber ? `${B.cropVariety || "—"}${B.lotNumber ? ` · ${B.lotNumber}` : ""}` : e("healthybowl.nursery.seedLot.provenance.newLot", "New seed lot")
|
|
679
718
|
}),
|
|
680
719
|
/* @__PURE__ */ x(j, {}),
|
|
681
720
|
/* @__PURE__ */ x(A, {
|
|
682
721
|
icon: /* @__PURE__ */ x(y, { className: "h-3.5 w-3.5" }),
|
|
683
722
|
label: e("healthybowl.nursery.seedLot.provenance.batches", "Nursery Batches"),
|
|
684
|
-
value:
|
|
723
|
+
value: $.length > 0 ? $.map((e) => e.batchCode).join(", ") : R ? e("healthybowl.nursery.seedLot.provenance.noBatches", "None yet") : "—"
|
|
685
724
|
}),
|
|
686
725
|
/* @__PURE__ */ x(j, {}),
|
|
687
726
|
/* @__PURE__ */ x(A, {
|
|
688
727
|
icon: /* @__PURE__ */ x(v, { className: "h-3.5 w-3.5" }),
|
|
689
728
|
label: e("healthybowl.nursery.seedLot.provenance.field", "Field"),
|
|
690
|
-
value:
|
|
729
|
+
value: dt.length > 0 ? dt.join(", ") : "—"
|
|
691
730
|
})
|
|
692
731
|
]
|
|
693
732
|
}), /* @__PURE__ */ S("div", {
|
|
@@ -695,14 +734,14 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
695
734
|
children: [/* @__PURE__ */ x("h3", {
|
|
696
735
|
className: "mb-2 text-xs font-semibold uppercase tracking-wider text-text-secondary",
|
|
697
736
|
children: e("healthybowl.nursery.seedLot.traceQr.title", "Trace QR")
|
|
698
|
-
}),
|
|
699
|
-
seedLotId:
|
|
700
|
-
published:
|
|
701
|
-
publicPath:
|
|
702
|
-
}), /* @__PURE__ */ x(
|
|
703
|
-
lot:
|
|
704
|
-
onToggle:
|
|
705
|
-
busy:
|
|
737
|
+
}), R ? /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(Se, {
|
|
738
|
+
seedLotId: R,
|
|
739
|
+
published: H?.published ?? !1,
|
|
740
|
+
publicPath: H?.publicPath
|
|
741
|
+
}), /* @__PURE__ */ x(Ce, {
|
|
742
|
+
lot: H,
|
|
743
|
+
onToggle: Pe,
|
|
744
|
+
busy: Me
|
|
706
745
|
})] }) : /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ S("div", {
|
|
707
746
|
className: "mx-auto flex h-32 w-32 flex-col items-center justify-center gap-1 rounded-lg border border-dashed border-border-subtle bg-bg-surface text-text-secondary",
|
|
708
747
|
children: [/* @__PURE__ */ x(me, { className: "h-10 w-10" }), /* @__PURE__ */ x("span", {
|
|
@@ -718,7 +757,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
718
757
|
})
|
|
719
758
|
}),
|
|
720
759
|
/* @__PURE__ */ x(u, {
|
|
721
|
-
open:
|
|
760
|
+
open: Be,
|
|
722
761
|
onClose: () => W(!1),
|
|
723
762
|
title: e("healthybowl.nursery.batch.modal.title", "Start Nursery Batch"),
|
|
724
763
|
description: e("healthybowl.nursery.batch.modal.description", "Raise a batch from one of your seed lots."),
|
|
@@ -728,9 +767,9 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
728
767
|
onClick: () => W(!1),
|
|
729
768
|
children: e("healthybowl.common.cancel", "Cancel")
|
|
730
769
|
}), /* @__PURE__ */ x(C, {
|
|
731
|
-
onClick:
|
|
732
|
-
disabled:
|
|
733
|
-
children:
|
|
770
|
+
onClick: Ge,
|
|
771
|
+
disabled: He,
|
|
772
|
+
children: He ? e("healthybowl.nursery.seedLot.actions.saving", "Saving...") : e("healthybowl.nursery.actions.startBatch", "Start Batch")
|
|
734
773
|
})] }),
|
|
735
774
|
children: /* @__PURE__ */ S("div", {
|
|
736
775
|
className: "space-y-4",
|
|
@@ -742,8 +781,8 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
742
781
|
}), /* @__PURE__ */ S("select", {
|
|
743
782
|
id: "nb-lot",
|
|
744
783
|
value: G.seedLotId,
|
|
745
|
-
onChange: (e) =>
|
|
746
|
-
className:
|
|
784
|
+
onChange: (e) => K("seedLotId", e.target.value),
|
|
785
|
+
className: w,
|
|
747
786
|
children: [/* @__PURE__ */ x("option", {
|
|
748
787
|
value: "",
|
|
749
788
|
children: e("healthybowl.nursery.batch.form.seedLot.placeholder", "Select a seed lot")
|
|
@@ -766,9 +805,9 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
766
805
|
id: "nb-code",
|
|
767
806
|
type: "text",
|
|
768
807
|
value: G.batchCode,
|
|
769
|
-
onChange: (e) =>
|
|
808
|
+
onChange: (e) => K("batchCode", e.target.value),
|
|
770
809
|
placeholder: "NB-2026-001",
|
|
771
|
-
className:
|
|
810
|
+
className: w
|
|
772
811
|
})] }), /* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
773
812
|
htmlFor: "nb-sow",
|
|
774
813
|
className: "mb-1 block text-sm font-medium text-text-primary",
|
|
@@ -777,8 +816,8 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
777
816
|
id: "nb-sow",
|
|
778
817
|
type: "date",
|
|
779
818
|
value: G.sowDate,
|
|
780
|
-
onChange: (e) =>
|
|
781
|
-
className:
|
|
819
|
+
onChange: (e) => K("sowDate", e.target.value),
|
|
820
|
+
className: w
|
|
782
821
|
})] })]
|
|
783
822
|
}),
|
|
784
823
|
/* @__PURE__ */ S("div", {
|
|
@@ -794,9 +833,9 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
794
833
|
min: "0",
|
|
795
834
|
step: "1",
|
|
796
835
|
value: G.trayCount,
|
|
797
|
-
onChange: (e) =>
|
|
836
|
+
onChange: (e) => K("trayCount", e.target.value),
|
|
798
837
|
placeholder: "12",
|
|
799
|
-
className:
|
|
838
|
+
className: w
|
|
800
839
|
})] }),
|
|
801
840
|
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
802
841
|
htmlFor: "nb-qty",
|
|
@@ -808,9 +847,9 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
808
847
|
min: "0",
|
|
809
848
|
step: "1",
|
|
810
849
|
value: G.quantity,
|
|
811
|
-
onChange: (e) =>
|
|
850
|
+
onChange: (e) => K("quantity", e.target.value),
|
|
812
851
|
placeholder: "600",
|
|
813
|
-
className:
|
|
852
|
+
className: w
|
|
814
853
|
})] }),
|
|
815
854
|
/* @__PURE__ */ S("div", { children: [/* @__PURE__ */ x("label", {
|
|
816
855
|
htmlFor: "nb-germ",
|
|
@@ -823,9 +862,9 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
823
862
|
max: "100",
|
|
824
863
|
step: "1",
|
|
825
864
|
value: G.germinationPct,
|
|
826
|
-
onChange: (e) =>
|
|
865
|
+
onChange: (e) => K("germinationPct", e.target.value),
|
|
827
866
|
placeholder: "85",
|
|
828
|
-
className:
|
|
867
|
+
className: w
|
|
829
868
|
})] })
|
|
830
869
|
]
|
|
831
870
|
}),
|
|
@@ -836,35 +875,35 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
836
875
|
}), /* @__PURE__ */ x("select", {
|
|
837
876
|
id: "nb-status",
|
|
838
877
|
value: G.status,
|
|
839
|
-
onChange: (e) =>
|
|
840
|
-
className:
|
|
841
|
-
children:
|
|
878
|
+
onChange: (e) => K("status", e.target.value),
|
|
879
|
+
className: w,
|
|
880
|
+
children: T.filter((e) => e !== "transplanted").map((e) => /* @__PURE__ */ x("option", {
|
|
842
881
|
value: e,
|
|
843
|
-
children:
|
|
882
|
+
children: X(e)
|
|
844
883
|
}, e))
|
|
845
884
|
})] })
|
|
846
885
|
]
|
|
847
886
|
})
|
|
848
887
|
}),
|
|
849
888
|
/* @__PURE__ */ x(u, {
|
|
850
|
-
open:
|
|
851
|
-
onClose: () =>
|
|
889
|
+
open: q !== null,
|
|
890
|
+
onClose: () => J(null),
|
|
852
891
|
title: e("healthybowl.nursery.transplant.modal.title", "Transplant Batch"),
|
|
853
892
|
description: e("healthybowl.nursery.transplant.modal.description", "Link this batch to the field and crop it is planted into."),
|
|
854
893
|
size: "sm",
|
|
855
894
|
footer: /* @__PURE__ */ S(b, { children: [/* @__PURE__ */ x(C, {
|
|
856
895
|
variant: "outline",
|
|
857
|
-
onClick: () =>
|
|
896
|
+
onClick: () => J(null),
|
|
858
897
|
children: e("healthybowl.common.cancel", "Cancel")
|
|
859
898
|
}), /* @__PURE__ */ x(C, {
|
|
860
|
-
onClick:
|
|
861
|
-
disabled:
|
|
862
|
-
children:
|
|
899
|
+
onClick: nt,
|
|
900
|
+
disabled: $e,
|
|
901
|
+
children: $e ? e("healthybowl.nursery.seedLot.actions.saving", "Saving...") : e("healthybowl.nursery.actions.transplant", "Transplant")
|
|
863
902
|
})] }),
|
|
864
903
|
children: /* @__PURE__ */ S("div", {
|
|
865
904
|
className: "space-y-4",
|
|
866
905
|
children: [
|
|
867
|
-
|
|
906
|
+
q && /* @__PURE__ */ S("p", {
|
|
868
907
|
className: "text-sm text-text-secondary",
|
|
869
908
|
children: [
|
|
870
909
|
e("healthybowl.nursery.transplant.batchLabel", "Batch"),
|
|
@@ -872,7 +911,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
872
911
|
" ",
|
|
873
912
|
/* @__PURE__ */ x("span", {
|
|
874
913
|
className: "font-medium text-text-primary",
|
|
875
|
-
children:
|
|
914
|
+
children: q.batchCode
|
|
876
915
|
})
|
|
877
916
|
]
|
|
878
917
|
}),
|
|
@@ -884,18 +923,18 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
884
923
|
}),
|
|
885
924
|
/* @__PURE__ */ S("select", {
|
|
886
925
|
id: "tp-field",
|
|
887
|
-
value:
|
|
888
|
-
onChange: (e) =>
|
|
889
|
-
className:
|
|
926
|
+
value: Y,
|
|
927
|
+
onChange: (e) => Xe(e.target.value),
|
|
928
|
+
className: w,
|
|
890
929
|
children: [/* @__PURE__ */ x("option", {
|
|
891
930
|
value: "",
|
|
892
931
|
children: e("healthybowl.nursery.transplant.field.placeholder", "Select a field")
|
|
893
|
-
}),
|
|
932
|
+
}), M.map((e) => /* @__PURE__ */ x("option", {
|
|
894
933
|
value: e.id,
|
|
895
934
|
children: e.name
|
|
896
935
|
}, e.id))]
|
|
897
936
|
}),
|
|
898
|
-
|
|
937
|
+
M.length === 0 && /* @__PURE__ */ x("p", {
|
|
899
938
|
className: "mt-1 text-xs text-status-warning-text",
|
|
900
939
|
children: e("healthybowl.nursery.transplant.field.none", "No fields found. Add a field first.")
|
|
901
940
|
})
|
|
@@ -908,18 +947,18 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
908
947
|
}),
|
|
909
948
|
/* @__PURE__ */ S("select", {
|
|
910
949
|
id: "tp-crop",
|
|
911
|
-
value:
|
|
912
|
-
onChange: (e) =>
|
|
913
|
-
className:
|
|
950
|
+
value: Ze,
|
|
951
|
+
onChange: (e) => Qe(e.target.value),
|
|
952
|
+
className: w,
|
|
914
953
|
children: [/* @__PURE__ */ x("option", {
|
|
915
954
|
value: "",
|
|
916
955
|
children: e("healthybowl.nursery.transplant.crop.placeholder", "Select a crop")
|
|
917
|
-
}),
|
|
956
|
+
}), N.map((e) => /* @__PURE__ */ x("option", {
|
|
918
957
|
value: e.id,
|
|
919
958
|
children: e.name
|
|
920
959
|
}, e.id))]
|
|
921
960
|
}),
|
|
922
|
-
|
|
961
|
+
N.length === 0 && /* @__PURE__ */ x("p", {
|
|
923
962
|
className: "mt-1 text-xs text-status-warning-text",
|
|
924
963
|
children: e("healthybowl.nursery.transplant.crop.none", "No crops found. Add a crop first.")
|
|
925
964
|
})
|
|
@@ -928,11 +967,11 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
928
967
|
})
|
|
929
968
|
}),
|
|
930
969
|
/* @__PURE__ */ x(u, {
|
|
931
|
-
open:
|
|
932
|
-
onClose:
|
|
933
|
-
title:
|
|
934
|
-
description:
|
|
935
|
-
children:
|
|
970
|
+
open: Z !== null,
|
|
971
|
+
onClose: ut,
|
|
972
|
+
title: Q ? e("healthybowl.nursery.trace.title", "Trace: {{lot}}", { lot: Q.lotNumber || Q.cropVariety || e("healthybowl.nursery.trace.untitled", "Seed lot") }) : e("healthybowl.nursery.trace.notFound.title", "Seed lot not found"),
|
|
973
|
+
description: Q ? e("healthybowl.nursery.trace.description", "Where this seed came from and where it went.") : void 0,
|
|
974
|
+
children: Q ? /* @__PURE__ */ x("div", {
|
|
936
975
|
className: "space-y-4",
|
|
937
976
|
children: /* @__PURE__ */ S("div", {
|
|
938
977
|
className: "rounded-xl border border-border-seam bg-bg-sunken/40 p-3",
|
|
@@ -940,25 +979,25 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
940
979
|
/* @__PURE__ */ x(A, {
|
|
941
980
|
icon: /* @__PURE__ */ x(v, { className: "h-3.5 w-3.5" }),
|
|
942
981
|
label: e("healthybowl.nursery.seedLot.provenance.supplier", "Supplier"),
|
|
943
|
-
value:
|
|
982
|
+
value: Q.supplierId ? rt(Q.supplierId) : "—"
|
|
944
983
|
}),
|
|
945
984
|
/* @__PURE__ */ x(j, {}),
|
|
946
985
|
/* @__PURE__ */ x(A, {
|
|
947
986
|
icon: /* @__PURE__ */ x(g, { className: "h-3.5 w-3.5" }),
|
|
948
987
|
label: e("healthybowl.nursery.seedLot.provenance.seedLot", "Seed Lot"),
|
|
949
|
-
value: `${
|
|
988
|
+
value: `${Q.cropVariety || "—"}${Q.lotNumber ? ` · ${Q.lotNumber}` : ""}`
|
|
950
989
|
}),
|
|
951
990
|
/* @__PURE__ */ x(j, {}),
|
|
952
991
|
/* @__PURE__ */ x(A, {
|
|
953
992
|
icon: /* @__PURE__ */ x(y, { className: "h-3.5 w-3.5" }),
|
|
954
993
|
label: e("healthybowl.nursery.seedLot.provenance.batches", "Nursery Batches"),
|
|
955
|
-
value:
|
|
994
|
+
value: ct.length > 0 ? ct.map((e) => e.batchCode).join(", ") : e("healthybowl.nursery.seedLot.provenance.noBatches", "None yet")
|
|
956
995
|
}),
|
|
957
996
|
/* @__PURE__ */ x(j, {}),
|
|
958
997
|
/* @__PURE__ */ x(A, {
|
|
959
998
|
icon: /* @__PURE__ */ x(v, { className: "h-3.5 w-3.5" }),
|
|
960
999
|
label: e("healthybowl.nursery.seedLot.provenance.field", "Field"),
|
|
961
|
-
value:
|
|
1000
|
+
value: lt.length > 0 ? lt.join(", ") : "—"
|
|
962
1001
|
})
|
|
963
1002
|
]
|
|
964
1003
|
})
|
|
@@ -968,12 +1007,12 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
968
1007
|
})
|
|
969
1008
|
}),
|
|
970
1009
|
/* @__PURE__ */ x(c, {
|
|
971
|
-
toasts:
|
|
972
|
-
onDismiss:
|
|
1010
|
+
toasts: Te,
|
|
1011
|
+
onDismiss: Ee
|
|
973
1012
|
})
|
|
974
1013
|
]
|
|
975
1014
|
});
|
|
976
|
-
},
|
|
1015
|
+
}, Se = ({ seedLotId: e, published: t, publicPath: n }) => {
|
|
977
1016
|
let { t: i } = h(), [a, o] = m(null), { buildPath: s } = r(), { url: c, isPublic: l } = typeof window > "u" ? {
|
|
978
1017
|
url: "",
|
|
979
1018
|
isPublic: !1
|
|
@@ -986,7 +1025,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
986
1025
|
});
|
|
987
1026
|
return oe(() => {
|
|
988
1027
|
let e = !0;
|
|
989
|
-
if (c) return
|
|
1028
|
+
if (c) return ye.toDataURL(c, {
|
|
990
1029
|
margin: 1,
|
|
991
1030
|
width: 256,
|
|
992
1031
|
errorCorrectionLevel: "M"
|
|
@@ -1005,7 +1044,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
1005
1044
|
"data-testid": "seed-lot-qr-caption",
|
|
1006
1045
|
children: l ? i("healthybowl.nursery.seedLot.traceQr.publicReady", "Anyone can scan this to see this lot’s public provenance — no account needed.") : i("healthybowl.nursery.seedLot.traceQr.internalReady", "Opens for signed-in members of this workspace only. Publish the lot to make it scannable by inspectors and buyers.")
|
|
1007
1046
|
})] });
|
|
1008
|
-
},
|
|
1047
|
+
}, Ce = ({ lot: e, onToggle: t, busy: n }) => {
|
|
1009
1048
|
let { t: r } = h();
|
|
1010
1049
|
if (!e) return null;
|
|
1011
1050
|
let i = e.published ?? !1, a = i && e.publicPath && typeof window < "u" ? `${window.location.origin}${e.publicPath}` : null;
|
|
@@ -1049,7 +1088,7 @@ var w = /* @__PURE__ */ e(d(), 1), T = "h-9 w-full rounded-md border border-bord
|
|
|
1049
1088
|
}), j = () => /* @__PURE__ */ x("div", {
|
|
1050
1089
|
className: "ms-3 flex h-4 items-center text-text-secondary",
|
|
1051
1090
|
children: /* @__PURE__ */ x(ce, { className: "h-3 w-3 rotate-90" })
|
|
1052
|
-
}),
|
|
1091
|
+
}), we = ({ fileIds: e, onChange: n }) => {
|
|
1053
1092
|
let { t: r } = h(), { save: i, isPending: a } = ve(), o = se(null), [s, c] = m(null), [l, ee] = m({});
|
|
1054
1093
|
return /* @__PURE__ */ S("div", {
|
|
1055
1094
|
className: "space-y-2",
|