eatopia-ds 0.0.948 → 0.0.949

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/build/index10.js CHANGED
@@ -1,36 +1,37 @@
1
1
  import { j as n } from "./index24.js";
2
- import Ie, { useState as j, useEffect as N, useMemo as M } from "react";
3
- import { StockLeadTime as Se } from "./index18.js";
4
- import { calculateConsumptionForecast as ge, calculateTotalConsumptionForRange as Be } from "./index21.js";
5
- import { AlertIcon as De } from "./index23.js";
6
- const pe = [1, 2, 3, 7, 10, 15, 30, 60, 90], y = (o) => {
7
- const p = o.getFullYear(), k = String(o.getMonth() + 1).padStart(2, "0"), c = String(o.getDate()).padStart(2, "0");
8
- return `${p}-${k}-${c}`;
2
+ import Me, { useState as v, useEffect as U, useMemo as M } from "react";
3
+ import { StockLeadTime as Ee } from "./index18.js";
4
+ import { calculateConsumptionForecast as pe, calculateTotalConsumptionForRange as Pe } from "./index21.js";
5
+ import { AlertIcon as We } from "./index23.js";
6
+ const be = [1, 2, 3, 7, 10, 15, 30, 60, 90], y = (o) => {
7
+ const p = o.getFullYear(), j = String(o.getMonth() + 1).padStart(2, "0"), c = String(o.getDate()).padStart(2, "0");
8
+ return `${p}-${j}-${c}`;
9
9
  }, F = (o) => {
10
10
  const p = o.split("-").map(Number);
11
11
  return p.length !== 3 || p.some(Number.isNaN) ? /* @__PURE__ */ new Date(NaN) : new Date(p[0], p[1] - 1, p[2]);
12
- }, Me = () => {
12
+ }, Re = () => {
13
13
  const o = /* @__PURE__ */ new Date();
14
14
  return o.setDate(o.getDate() + 1), o.setHours(0, 0, 0, 0), y(o);
15
- }, V = () => {
15
+ }, _ = () => {
16
16
  const o = /* @__PURE__ */ new Date();
17
17
  return o.setDate(o.getDate() + 1), o.setHours(0, 0, 0, 0), o;
18
- }, me = (o) => o <= 0 ? 7 : pe.reduce(
19
- (p, k) => Math.abs(k - o) < Math.abs(p - o) ? k : p
18
+ }, xe = (o) => o <= 0 ? 7 : be.reduce(
19
+ (p, j) => Math.abs(j - o) < Math.abs(p - o) ? j : p
20
20
  );
21
- function Ue({
21
+ function Oe({
22
22
  data: o,
23
23
  onSubmit: p,
24
- onCancel: k,
24
+ onCancel: j,
25
25
  timelineData: c,
26
- fornecedoresOptions: Ee,
27
- marcasOptions: Pe,
28
- embalagensOptions: We,
26
+ fornecedoresOptions: Le,
27
+ marcasOptions: ze,
28
+ embalagensOptions: He,
29
29
  dailyConsumptionAverages: x,
30
- showSuggestionBar: xe = !0
30
+ showSuggestionBar: ye = !0,
31
+ showLegendTimeline: he = !1
31
32
  }) {
32
- var K, J, X, Z, ee, te, ne, oe, re, se, ae, ie, le, de, ce;
33
- Ie.useEffect(() => {
33
+ var J, X, Z, ee, te, ne, oe, re, se, ie, ae, le, de, ce, ue, fe;
34
+ Me.useEffect(() => {
34
35
  const e = document.createElement("style");
35
36
  return e.textContent = `
36
37
  .order-form-quantity-input::-webkit-outer-spin-button,
@@ -45,30 +46,30 @@ function Ue({
45
46
  document.head.removeChild(e);
46
47
  };
47
48
  }, []);
48
- const [I, be] = j(!1);
49
- N(() => {
49
+ const [I, ve] = v(!1);
50
+ U(() => {
50
51
  const e = () => {
51
- be(window.innerWidth <= 768);
52
+ ve(window.innerWidth <= 768);
52
53
  };
53
54
  return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
54
55
  }, []);
55
- const U = () => {
56
+ const V = () => {
56
57
  if (!(c != null && c.timeline)) return 0;
57
58
  const { restockSuggestionStart: e, restockSuggestionEnd: s } = c.timeline;
58
59
  if (!e || !s) return 0;
59
60
  const r = new Date(e), l = new Date(s).getTime() - r.getTime(), d = Math.ceil(l / (1e3 * 60 * 60 * 24));
60
61
  return d > 0 ? d : 0;
61
- }, ye = () => {
62
- var a;
63
- const e = V(), s = (a = c == null ? void 0 : c.timeline) == null ? void 0 : a.stockEndDate;
62
+ }, je = () => {
63
+ var i;
64
+ const e = _(), s = (i = c == null ? void 0 : c.timeline) == null ? void 0 : i.stockEndDate;
64
65
  if (!s) return y(e);
65
66
  const r = F(s);
66
67
  return isNaN(r.getTime()) || r < e ? y(e) : y(r);
67
- }, he = () => me(U()), g = (() => {
68
- var a, l, d;
69
- const e = (a = o == null ? void 0 : o.fornecedores) == null ? void 0 : a[0];
68
+ }, ke = () => xe(V()), g = (() => {
69
+ var i, l, d;
70
+ const e = (i = o == null ? void 0 : o.fornecedores) == null ? void 0 : i[0];
70
71
  if (!e) return null;
71
- const s = U();
72
+ const s = V();
72
73
  if (!x || s <= 0) {
73
74
  const u = (l = e.marcas) == null ? void 0 : l[0], f = (d = u == null ? void 0 : u.embalagens) == null ? void 0 : d[0];
74
75
  return u && f ? {
@@ -84,22 +85,22 @@ function Ue({
84
85
  const m = f.quantidade_fornecedor;
85
86
  if (!(m <= 0))
86
87
  for (let b = 1; b <= 100; b++) {
87
- const ue = b * m, H = ge({
88
+ const ge = b * m, H = pe({
88
89
  dailyAverages: x,
89
90
  startDate: /* @__PURE__ */ new Date(),
90
- totalQuantity: ue
91
+ totalQuantity: ge
91
92
  });
92
93
  if (H.totalDays >= s) {
93
- const fe = b * f.valor_unitario * m, L = H.totalDays - s;
94
- (!r || L < r.daysDifference || L === r.daysDifference && fe < r.totalValue) && (r = {
94
+ const me = b * f.valor_unitario * m, N = H.totalDays - s;
95
+ (!r || N < r.daysDifference || N === r.daysDifference && me < r.totalValue) && (r = {
95
96
  marca: u.nome,
96
97
  embalagem: f.label,
97
98
  quantidade: b,
98
99
  valorUnitario: f.valor_unitario,
99
- totalKg: ue,
100
- totalValue: fe,
100
+ totalKg: ge,
101
+ totalValue: me,
101
102
  days: H.totalDays,
102
- daysDifference: L
103
+ daysDifference: N
103
104
  });
104
105
  }
105
106
  }
@@ -110,89 +111,89 @@ function Ue({
110
111
  quantidade: r.quantidade,
111
112
  valorUnitario: r.valorUnitario
112
113
  } : null;
113
- })(), ve = () => {
114
- var a, l, d;
114
+ })(), qe = () => {
115
+ var i, l, d;
115
116
  if (g)
116
117
  return g.valorUnitario;
117
- const e = (a = o == null ? void 0 : o.fornecedores) == null ? void 0 : a[0];
118
+ const e = (i = o == null ? void 0 : o.fornecedores) == null ? void 0 : i[0];
118
119
  if (!e) return 0;
119
120
  const s = (l = e.marcas) == null ? void 0 : l[0];
120
121
  if (!s) return 0;
121
122
  const r = (d = s.embalagens) == null ? void 0 : d[0];
122
123
  return (r == null ? void 0 : r.valor_unitario) ?? 0;
123
- }, [i, _] = j({
124
+ }, E = o.unidade_medida ?? "kg", Ce = ((J = o.ultima_compra) == null ? void 0 : J.unidade) ?? o.unidade_medida ?? "kg", [a, Q] = v({
124
125
  ...o,
125
126
  qtdPedido: (g == null ? void 0 : g.quantidade) ?? (o == null ? void 0 : o.qtdPedido) ?? 0,
126
- valorTotal: (o == null ? void 0 : o.valorTotal) ?? ((g == null ? void 0 : g.quantidade) ?? (o == null ? void 0 : o.qtdPedido) ?? 0) * ve()
127
- }), [je, Q] = j(
128
- ((J = (K = o == null ? void 0 : o.fornecedores) == null ? void 0 : K[0]) == null ? void 0 : J.nome) ?? ""
129
- ), [q, S] = j(
130
- (g == null ? void 0 : g.marca) ?? ((te = (ee = (Z = (X = o == null ? void 0 : o.fornecedores) == null ? void 0 : X[0]) == null ? void 0 : Z.marcas) == null ? void 0 : ee[0]) == null ? void 0 : te.nome) ?? ""
131
- ), [w, B] = j(
132
- (g == null ? void 0 : g.embalagem) ?? ((ie = (ae = (se = (re = (oe = (ne = o == null ? void 0 : o.fornecedores) == null ? void 0 : ne[0]) == null ? void 0 : oe.marcas) == null ? void 0 : re[0]) == null ? void 0 : se.embalagens) == null ? void 0 : ae[0]) == null ? void 0 : ie.label) ?? ""
133
- ), [E, Y] = j(
134
- ye
135
- ), [P, O] = j(he);
136
- N(() => {
127
+ valorTotal: (o == null ? void 0 : o.valorTotal) ?? ((g == null ? void 0 : g.quantidade) ?? (o == null ? void 0 : o.qtdPedido) ?? 0) * qe()
128
+ }), [we, Y] = v(
129
+ ((Z = (X = o == null ? void 0 : o.fornecedores) == null ? void 0 : X[0]) == null ? void 0 : Z.nome) ?? ""
130
+ ), [k, S] = v(
131
+ (g == null ? void 0 : g.marca) ?? ((oe = (ne = (te = (ee = o == null ? void 0 : o.fornecedores) == null ? void 0 : ee[0]) == null ? void 0 : te.marcas) == null ? void 0 : ne[0]) == null ? void 0 : oe.nome) ?? ""
132
+ ), [w, B] = v(
133
+ (g == null ? void 0 : g.embalagem) ?? ((de = (le = (ae = (ie = (se = (re = o == null ? void 0 : o.fornecedores) == null ? void 0 : re[0]) == null ? void 0 : se.marcas) == null ? void 0 : ie[0]) == null ? void 0 : ae.embalagens) == null ? void 0 : le[0]) == null ? void 0 : de.label) ?? ""
134
+ ), [P, O] = v(
135
+ je
136
+ ), [W, A] = v(ke);
137
+ U(() => {
137
138
  var d, u, f;
138
- const e = V(), s = (d = c == null ? void 0 : c.timeline) == null ? void 0 : d.stockEndDate;
139
+ const e = _(), s = (d = c == null ? void 0 : c.timeline) == null ? void 0 : d.stockEndDate;
139
140
  let r;
140
141
  if (s) {
141
142
  const m = F(s);
142
143
  r = isNaN(m.getTime()) || m < e ? y(e) : y(m);
143
144
  } else
144
145
  r = y(e);
145
- let a = 0;
146
+ let i = 0;
146
147
  if ((u = c == null ? void 0 : c.timeline) != null && u.restockSuggestionStart && ((f = c == null ? void 0 : c.timeline) != null && f.restockSuggestionEnd)) {
147
148
  const m = F(c.timeline.restockSuggestionStart), b = F(c.timeline.restockSuggestionEnd);
148
- !isNaN(m.getTime()) && !isNaN(b.getTime()) && (a = Math.ceil((b.getTime() - m.getTime()) / (1e3 * 60 * 60 * 24)) || 0);
149
+ !isNaN(m.getTime()) && !isNaN(b.getTime()) && (i = Math.ceil((b.getTime() - m.getTime()) / (1e3 * 60 * 60 * 24)) || 0);
149
150
  }
150
- const l = me(a);
151
- Y(r), O(l);
152
- }, [c, o]), N(() => {
153
- var s, r, a;
151
+ const l = xe(i);
152
+ O(r), A(l);
153
+ }, [c, o]), U(() => {
154
+ var s, r, i;
154
155
  if (g) return;
155
156
  const e = (s = o == null ? void 0 : o.fornecedores) == null ? void 0 : s[0];
156
157
  if (e) {
157
- Q(e.nome);
158
+ Y(e.nome);
158
159
  const l = (r = e.marcas) == null ? void 0 : r[0];
159
160
  if (l) {
160
161
  S(l.nome);
161
- const d = (a = l.embalagens) == null ? void 0 : a[0];
162
+ const d = (i = l.embalagens) == null ? void 0 : i[0];
162
163
  d && B(d.label);
163
164
  }
164
165
  }
165
166
  }, [o, g]);
166
167
  const D = M(() => {
167
168
  var l, d, u;
168
- const e = (l = i.fornecedores) == null ? void 0 : l[0];
169
+ const e = (l = a.fornecedores) == null ? void 0 : l[0];
169
170
  if (!e) return 0;
170
- const s = (d = e.marcas) == null ? void 0 : d.find((f) => f.nome === q);
171
+ const s = (d = e.marcas) == null ? void 0 : d.find((f) => f.nome === k);
171
172
  if (!s) return 0;
172
173
  const r = (u = s.embalagens) == null ? void 0 : u.find(
173
174
  (f) => f.label === w
174
- ), a = (r == null ? void 0 : r.quantidade_fornecedor) ?? 0;
175
- return i.qtdPedido * a;
175
+ ), i = (r == null ? void 0 : r.quantidade_fornecedor) ?? 0;
176
+ return a.qtdPedido * i;
176
177
  }, [
177
- i.qtdPedido,
178
- i.fornecedores,
179
- q,
178
+ a.qtdPedido,
179
+ a.fornecedores,
180
+ k,
180
181
  w
181
- ]), W = M(() => !x || D <= 0 ? null : ge({
182
+ ]), R = M(() => !x || D <= 0 ? null : pe({
182
183
  dailyAverages: x,
183
184
  startDate: /* @__PURE__ */ new Date(),
184
185
  totalQuantity: D
185
- }), [x, D]), C = (W == null ? void 0 : W.totalDays) ?? 0, h = M(() => {
186
+ }), [x, D]), q = (R == null ? void 0 : R.totalDays) ?? 0, h = M(() => {
186
187
  if (!x) return 0;
187
- const e = V(), s = F(E);
188
+ const e = _(), s = F(P);
188
189
  if (isNaN(s.getTime())) return 0;
189
190
  const r = s < e ? e : s;
190
- return Be(
191
+ return Pe(
191
192
  x,
192
193
  r,
193
- P
194
+ W
194
195
  );
195
- }, [x, E, P]), A = M(() => {
196
+ }, [x, P, W]), $ = M(() => {
196
197
  if (c)
197
198
  return {
198
199
  ...c,
@@ -204,68 +205,68 @@ function Ue({
204
205
  }, [c, x]);
205
206
  if (!o)
206
207
  return null;
207
- const $ = () => {
208
- var r, a, l;
209
- const e = (r = i.fornecedores) == null ? void 0 : r[0];
208
+ const G = () => {
209
+ var r, i, l;
210
+ const e = (r = a.fornecedores) == null ? void 0 : r[0];
210
211
  if (!e) return null;
211
- const s = (a = e.marcas) == null ? void 0 : a.find((d) => d.nome === q);
212
+ const s = (i = e.marcas) == null ? void 0 : i.find((d) => d.nome === k);
212
213
  return s ? ((l = s.embalagens) == null ? void 0 : l.find((d) => d.label === w)) ?? null : null;
213
- }, R = () => {
214
+ }, L = () => {
214
215
  var e;
215
- return ((e = $()) == null ? void 0 : e.valor_unitario) ?? 0;
216
- }, G = (e) => {
217
- const s = Number(e).toFixed(2), [r, a] = s.split(".");
216
+ return ((e = G()) == null ? void 0 : e.valor_unitario) ?? 0;
217
+ }, K = (e) => {
218
+ const s = Number(e).toFixed(2), [r, i] = s.split(".");
218
219
  return `R$ ${r.replace(
219
220
  /\B(?=(\d{3})+(?!\d))/g,
220
221
  "."
221
- )},${a}`;
222
- }, v = () => {
222
+ )},${i}`;
223
+ }, C = () => {
223
224
  var e;
224
- return ((e = $()) == null ? void 0 : e.quantidade_fornecedor) ?? 0;
225
+ return ((e = G()) == null ? void 0 : e.quantidade_fornecedor) ?? 0;
225
226
  }, T = (e) => {
226
- const s = R(), r = e * s;
227
- _((a) => ({
228
- ...a,
227
+ const s = L(), r = e * s;
228
+ Q((i) => ({
229
+ ...i,
229
230
  qtdPedido: e,
230
231
  valorTotal: r
231
232
  }));
232
233
  }, z = (e) => {
233
234
  var d, u, f;
234
235
  B(e);
235
- const s = (d = i.fornecedores) == null ? void 0 : d[0];
236
+ const s = (d = a.fornecedores) == null ? void 0 : d[0];
236
237
  if (!s) return;
237
- const r = (u = s.marcas) == null ? void 0 : u.find((m) => m.nome === q);
238
+ const r = (u = s.marcas) == null ? void 0 : u.find((m) => m.nome === k);
238
239
  if (!r) return;
239
- const a = (f = r.embalagens) == null ? void 0 : f.find((m) => m.label === e);
240
- if (!a) return;
241
- const l = i.qtdPedido * (a.valor_unitario ?? 0);
242
- _((m) => ({
240
+ const i = (f = r.embalagens) == null ? void 0 : f.find((m) => m.label === e);
241
+ if (!i) return;
242
+ const l = a.qtdPedido * (i.valor_unitario ?? 0);
243
+ Q((m) => ({
243
244
  ...m,
244
245
  valorTotal: l
245
246
  }));
246
- }, ke = () => {
247
+ }, Te = () => {
247
248
  var s;
248
- const e = (s = i.fornecedores) == null ? void 0 : s[0];
249
+ const e = (s = a.fornecedores) == null ? void 0 : s[0];
249
250
  return e ? e.marcas || [] : [];
250
- }, qe = () => {
251
- var r, a;
252
- const e = (r = i.fornecedores) == null ? void 0 : r[0];
251
+ }, Fe = () => {
252
+ var r, i;
253
+ const e = (r = a.fornecedores) == null ? void 0 : r[0];
253
254
  if (!e) return [];
254
- const s = (a = e.marcas) == null ? void 0 : a.find((l) => l.nome === q);
255
+ const s = (i = e.marcas) == null ? void 0 : i.find((l) => l.nome === k);
255
256
  return s ? s.embalagens || [] : [];
256
- }, Ce = (e) => {
257
+ }, Ie = (e) => {
257
258
  var l, d;
258
259
  S(e);
259
- const s = (l = i.fornecedores) == null ? void 0 : l[0];
260
+ const s = (l = a.fornecedores) == null ? void 0 : l[0];
260
261
  if (!s) return;
261
262
  const r = (d = s.marcas) == null ? void 0 : d.find((u) => u.nome === e);
262
263
  if (!r || !r.embalagens || r.embalagens.length === 0) return;
263
- const a = r.embalagens[0];
264
- z(a.label);
265
- }, we = (e) => {
264
+ const i = r.embalagens[0];
265
+ z(i.label);
266
+ }, Se = (e) => {
266
267
  var l, d, u;
267
- Q(e);
268
- const s = (l = i.fornecedores) == null ? void 0 : l.find(
268
+ Y(e);
269
+ const s = (l = a.fornecedores) == null ? void 0 : l.find(
269
270
  (f) => f.nome === e
270
271
  );
271
272
  if (!s) return;
@@ -275,12 +276,12 @@ function Ue({
275
276
  return;
276
277
  }
277
278
  S(r.nome);
278
- const a = (u = r.embalagens) == null ? void 0 : u[0];
279
- a ? z(a.label) : B("");
280
- }, Te = (e) => {
281
- e.preventDefault(), p(i);
282
- }, Fe = () => {
283
- const e = v();
279
+ const i = (u = r.embalagens) == null ? void 0 : u[0];
280
+ i ? z(i.label) : B("");
281
+ }, Be = (e) => {
282
+ e.preventDefault(), p(a);
283
+ }, De = () => {
284
+ const e = C();
284
285
  if (e <= 0 || h <= 0) return;
285
286
  const s = Math.ceil(h / e);
286
287
  T(s);
@@ -551,9 +552,9 @@ function Ue({
551
552
  backgroundColor: "#DC2626"
552
553
  }
553
554
  };
554
- return /* @__PURE__ */ n.jsxs("form", { onSubmit: Te, style: t.container, children: [
555
+ return /* @__PURE__ */ n.jsxs("form", { onSubmit: Be, style: t.container, children: [
555
556
  /* @__PURE__ */ n.jsxs("div", { style: t.header, children: [
556
- /* @__PURE__ */ n.jsx("h2", { style: t.itemTitle, children: i.nome }),
557
+ /* @__PURE__ */ n.jsx("h2", { style: t.itemTitle, children: a.nome }),
557
558
  /* @__PURE__ */ n.jsx("div", { style: t.valorUnitario, children: /* @__PURE__ */ n.jsx(
558
559
  "div",
559
560
  {
@@ -565,7 +566,7 @@ function Ue({
565
566
  backgroundColor: "#FF4E00",
566
567
  fontWeight: "600"
567
568
  },
568
- children: G(R())
569
+ children: K(L())
569
570
  }
570
571
  ) })
571
572
  ] }),
@@ -581,13 +582,14 @@ function Ue({
581
582
  children: [
582
583
  /* @__PURE__ */ n.jsxs("div", { style: t.infoRow, children: [
583
584
  /* @__PURE__ */ n.jsxs("div", { style: t.infoText, children: [
584
- /* @__PURE__ */ n.jsx(De, { width: 20, height: 20 }),
585
+ /* @__PURE__ */ n.jsx(We, { width: 20, height: 20 }),
585
586
  "Última compra ",
586
- (le = i.ultima_compra) == null ? void 0 : le.data
587
+ (ce = a.ultima_compra) == null ? void 0 : ce.data
587
588
  ] }),
588
589
  /* @__PURE__ */ n.jsxs("div", { style: t.infoValue, children: [
589
- Number(((de = i.ultima_compra) == null ? void 0 : de.quantidade) ?? 0).toFixed(2),
590
- " KG"
590
+ Number(((ue = a.ultima_compra) == null ? void 0 : ue.quantidade) ?? 0).toFixed(2),
591
+ " ",
592
+ Ce.toUpperCase()
591
593
  ] })
592
594
  ] }),
593
595
  /* @__PURE__ */ n.jsxs("div", { style: t.formGrid, children: [
@@ -596,10 +598,10 @@ function Ue({
596
598
  /* @__PURE__ */ n.jsx(
597
599
  "select",
598
600
  {
599
- value: je,
600
- onChange: (e) => we(e.target.value),
601
+ value: we,
602
+ onChange: (e) => Se(e.target.value),
601
603
  style: t.select,
602
- children: (ce = i.fornecedores) == null ? void 0 : ce.map((e) => /* @__PURE__ */ n.jsx("option", { value: e.nome, children: e.nome }, e.nome))
604
+ children: (fe = a.fornecedores) == null ? void 0 : fe.map((e) => /* @__PURE__ */ n.jsx("option", { value: e.nome, children: e.nome }, e.nome))
603
605
  }
604
606
  )
605
607
  ] }),
@@ -608,10 +610,10 @@ function Ue({
608
610
  /* @__PURE__ */ n.jsx(
609
611
  "select",
610
612
  {
611
- value: q,
612
- onChange: (e) => Ce(e.target.value),
613
+ value: k,
614
+ onChange: (e) => Ie(e.target.value),
613
615
  style: t.select,
614
- children: ke().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.nome, children: e.nome }, e.nome))
616
+ children: Te().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.nome, children: e.nome }, e.nome))
615
617
  }
616
618
  )
617
619
  ] }),
@@ -623,22 +625,23 @@ function Ue({
623
625
  value: w,
624
626
  onChange: (e) => z(e.target.value),
625
627
  style: t.select,
626
- children: qe().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.label, children: e.label }, e.label))
628
+ children: Fe().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.label, children: e.label }, e.label))
627
629
  }
628
630
  )
629
631
  ] })
630
632
  ] }),
631
- A && /* @__PURE__ */ n.jsx("div", { style: { marginTop: "8px", marginBottom: "8px" }, children: /* @__PURE__ */ n.jsx(
632
- Se,
633
+ $ && /* @__PURE__ */ n.jsx("div", { style: { marginTop: "8px", marginBottom: "8px" }, children: /* @__PURE__ */ n.jsx(
634
+ Ee,
633
635
  {
634
- data: A,
636
+ data: $,
635
637
  controls: !0,
636
- showLegend: !1,
638
+ showLegend: he,
637
639
  size: "sm",
638
- showSuggestionBar: xe,
640
+ showSuggestionBar: ye,
641
+ unitLabel: E,
639
642
  onAddSuggestedWeight: (e) => T(e),
640
643
  selectedQty: D,
641
- selectedQtyDays: C
644
+ selectedQtyDays: q
642
645
  }
643
646
  ) }),
644
647
  /* @__PURE__ */ n.jsxs(
@@ -656,9 +659,9 @@ function Ue({
656
659
  "input",
657
660
  {
658
661
  type: "date",
659
- value: E,
660
- min: Me(),
661
- onChange: (e) => Y(e.target.value),
662
+ value: P,
663
+ min: Re(),
664
+ onChange: (e) => O(e.target.value),
662
665
  style: t.dateInput,
663
666
  "aria-label": "Data inicial"
664
667
  }
@@ -669,11 +672,11 @@ function Ue({
669
672
  /* @__PURE__ */ n.jsx(
670
673
  "select",
671
674
  {
672
- value: P,
673
- onChange: (e) => O(Number(e.target.value)),
675
+ value: W,
676
+ onChange: (e) => A(Number(e.target.value)),
674
677
  style: t.select,
675
678
  "aria-label": "Quantos dias?",
676
- children: pe.map((e) => /* @__PURE__ */ n.jsx("option", { value: e, children: e }, e))
679
+ children: be.map((e) => /* @__PURE__ */ n.jsx("option", { value: e, children: e }, e))
677
680
  }
678
681
  )
679
682
  ] }),
@@ -690,23 +693,24 @@ function Ue({
690
693
  children: [
691
694
  /* @__PURE__ */ n.jsxs("div", { style: t.rangeTotal, children: [
692
695
  h.toFixed(2),
693
- " kg"
696
+ " ",
697
+ E
694
698
  ] }),
695
699
  /* @__PURE__ */ n.jsx(
696
700
  "button",
697
701
  {
698
702
  type: "button",
699
- onClick: Fe,
700
- disabled: h <= 0 || v() <= 0,
703
+ onClick: De,
704
+ disabled: h <= 0 || C() <= 0,
701
705
  style: {
702
706
  ...t.addConsumoButton,
703
- ...h <= 0 || v() <= 0 ? t.addConsumoButtonDisabled : {}
707
+ ...h <= 0 || C() <= 0 ? t.addConsumoButtonDisabled : {}
704
708
  },
705
709
  onMouseEnter: (e) => {
706
- h > 0 && v() > 0 && (e.currentTarget.style.backgroundColor = "#d1d5db");
710
+ h > 0 && C() > 0 && (e.currentTarget.style.backgroundColor = "#d1d5db");
707
711
  },
708
712
  onMouseLeave: (e) => {
709
- h > 0 && v() > 0 && (e.currentTarget.style.backgroundColor = "#e5e7eb");
713
+ h > 0 && C() > 0 && (e.currentTarget.style.backgroundColor = "#e5e7eb");
710
714
  },
711
715
  "aria-label": "Definir quantidade pelo consumo previsto",
712
716
  children: "↻"
@@ -727,22 +731,22 @@ function Ue({
727
731
  type: "button",
728
732
  style: {
729
733
  ...t.quantityButton,
730
- ...i.qtdPedido <= 0 ? t.quantityButtonDisabled : {}
734
+ ...a.qtdPedido <= 0 ? t.quantityButtonDisabled : {}
731
735
  },
732
- onClick: () => T(Math.max(0, i.qtdPedido - 1)),
736
+ onClick: () => T(Math.max(0, a.qtdPedido - 1)),
733
737
  onMouseEnter: (e) => {
734
- i.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonHover.background, e.currentTarget.style.transform = t.quantityButtonHover.transform);
738
+ a.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonHover.background, e.currentTarget.style.transform = t.quantityButtonHover.transform);
735
739
  },
736
740
  onMouseLeave: (e) => {
737
741
  e.currentTarget.style.background = t.quantityButton.background, e.currentTarget.style.transform = "";
738
742
  },
739
743
  onMouseDown: (e) => {
740
- i.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonActive.background, e.currentTarget.style.transform = t.quantityButtonActive.transform);
744
+ a.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonActive.background, e.currentTarget.style.transform = t.quantityButtonActive.transform);
741
745
  },
742
746
  onMouseUp: (e) => {
743
- i.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonHover.background, e.currentTarget.style.transform = t.quantityButtonHover.transform);
747
+ a.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonHover.background, e.currentTarget.style.transform = t.quantityButtonHover.transform);
744
748
  },
745
- disabled: i.qtdPedido <= 0,
749
+ disabled: a.qtdPedido <= 0,
746
750
  "aria-label": "Diminuir quantidade",
747
751
  children: /* @__PURE__ */ n.jsx(
748
752
  "svg",
@@ -769,7 +773,7 @@ function Ue({
769
773
  "input",
770
774
  {
771
775
  type: "number",
772
- value: i.qtdPedido,
776
+ value: a.qtdPedido,
773
777
  onChange: (e) => T(
774
778
  Math.max(0, parseInt(e.target.value) || 0)
775
779
  ),
@@ -786,7 +790,7 @@ function Ue({
786
790
  {
787
791
  type: "button",
788
792
  style: t.quantityButton,
789
- onClick: () => T(i.qtdPedido + 1),
793
+ onClick: () => T(a.qtdPedido + 1),
790
794
  onMouseEnter: (e) => {
791
795
  e.currentTarget.style.background = t.quantityButtonHover.background, e.currentTarget.style.transform = t.quantityButtonHover.transform;
792
796
  },
@@ -843,8 +847,9 @@ function Ue({
843
847
  children: [
844
848
  /* @__PURE__ */ n.jsx("span", { style: t.totalLabel, children: "Total:" }),
845
849
  /* @__PURE__ */ n.jsxs("span", { style: t.totalValue, children: [
846
- (i.qtdPedido * v()).toFixed(2),
847
- " kg"
850
+ (a.qtdPedido * C()).toFixed(2),
851
+ " ",
852
+ E
848
853
  ] })
849
854
  ]
850
855
  }
@@ -858,13 +863,11 @@ function Ue({
858
863
  },
859
864
  children: [
860
865
  /* @__PURE__ */ n.jsx("span", { style: t.totalLabel, children: "Valor:" }),
861
- /* @__PURE__ */ n.jsx("span", { style: t.totalValueHighlight, children: G(
862
- i.qtdPedido * v() * R()
863
- ) })
866
+ /* @__PURE__ */ n.jsx("span", { style: t.totalValueHighlight, children: K(a.qtdPedido * L()) })
864
867
  ]
865
868
  }
866
869
  ),
867
- C > 0 && /* @__PURE__ */ n.jsxs(
870
+ q > 0 && /* @__PURE__ */ n.jsxs(
868
871
  "div",
869
872
  {
870
873
  style: {
@@ -874,9 +877,9 @@ function Ue({
874
877
  children: [
875
878
  /* @__PURE__ */ n.jsx("span", { style: t.totalLabel, children: "Duração:" }),
876
879
  /* @__PURE__ */ n.jsxs("span", { style: t.totalValue, children: [
877
- C % 1 === 0 ? C.toString() : C.toFixed(1),
880
+ q % 1 === 0 ? q.toString() : q.toFixed(1),
878
881
  " ",
879
- C === 1 ? "dia" : "dias"
882
+ q === 1 ? "dia" : "dias"
880
883
  ] })
881
884
  ]
882
885
  }
@@ -890,17 +893,17 @@ function Ue({
890
893
  "button",
891
894
  {
892
895
  type: "submit",
893
- disabled: i.qtdPedido <= 0,
896
+ disabled: a.qtdPedido <= 0,
894
897
  style: {
895
898
  ...t.button,
896
899
  ...t.addButton,
897
- ...i.qtdPedido <= 0 ? t.addButtonDisabled : {}
900
+ ...a.qtdPedido <= 0 ? t.addButtonDisabled : {}
898
901
  },
899
902
  onMouseEnter: (e) => {
900
- i.qtdPedido > 0 && (e.currentTarget.style.backgroundColor = t.addButtonHover.backgroundColor);
903
+ a.qtdPedido > 0 && (e.currentTarget.style.backgroundColor = t.addButtonHover.backgroundColor);
901
904
  },
902
905
  onMouseLeave: (e) => {
903
- i.qtdPedido > 0 && (e.currentTarget.style.backgroundColor = t.addButton.backgroundColor);
906
+ a.qtdPedido > 0 && (e.currentTarget.style.backgroundColor = t.addButton.backgroundColor);
904
907
  },
905
908
  children: "Adicionar"
906
909
  }
@@ -910,7 +913,7 @@ function Ue({
910
913
  {
911
914
  type: "button",
912
915
  style: { ...t.button, ...t.cancelButton },
913
- onClick: k,
916
+ onClick: j,
914
917
  onMouseEnter: (e) => {
915
918
  e.currentTarget.style.backgroundColor = t.cancelButtonHover.backgroundColor;
916
919
  },
@@ -927,6 +930,6 @@ function Ue({
927
930
  ] });
928
931
  }
929
932
  export {
930
- Ue as OrderForm
933
+ Oe as OrderForm
931
934
  };
932
935
  //# sourceMappingURL=index10.js.map