eatopia-ds 0.0.948 → 0.0.950

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}`;
9
- }, F = (o) => {
10
- const p = o.split("-").map(Number);
11
- return p.length !== 3 || p.some(Number.isNaN) ? /* @__PURE__ */ new Date(NaN) : new Date(p[0], p[1] - 1, p[2]);
12
- }, Me = () => {
2
+ import Ee, { useState as j, useEffect as U, useMemo as E } from "react";
3
+ import { StockLeadTime as Me } from "./index18.js";
4
+ import { calculateConsumptionForecast as me, 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], v = (o) => {
7
+ const m = o.getFullYear(), k = String(o.getMonth() + 1).padStart(2, "0"), d = String(o.getDate()).padStart(2, "0");
8
+ return `${m}-${k}-${d}`;
9
+ }, S = (o) => {
10
+ const m = o.split("-").map(Number);
11
+ return m.length !== 3 || m.some(Number.isNaN) ? /* @__PURE__ */ new Date(NaN) : new Date(m[0], m[1] - 1, m[2]);
12
+ }, Re = () => {
13
13
  const o = /* @__PURE__ */ new Date();
14
- return o.setDate(o.getDate() + 1), o.setHours(0, 0, 0, 0), y(o);
15
- }, V = () => {
14
+ return o.setDate(o.getDate() + 1), o.setHours(0, 0, 0, 0), v(o);
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
+ (m, k) => Math.abs(k - o) < Math.abs(m - o) ? k : m
20
20
  );
21
- function Ue({
21
+ function Oe({
22
22
  data: o,
23
- onSubmit: p,
23
+ onSubmit: m,
24
24
  onCancel: k,
25
- timelineData: c,
26
- fornecedoresOptions: Ee,
27
- marcasOptions: Pe,
28
- embalagensOptions: We,
25
+ timelineData: d,
26
+ fornecedoresOptions: ze,
27
+ marcasOptions: Le,
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, ce, de, ue, fe;
34
+ Ee.useEffect(() => {
34
35
  const e = document.createElement("style");
35
36
  return e.textContent = `
36
37
  .order-form-quantity-input::-webkit-outer-spin-button,
@@ -45,32 +46,32 @@ function Ue({
45
46
  document.head.removeChild(e);
46
47
  };
47
48
  }, []);
48
- const [I, be] = j(!1);
49
- N(() => {
49
+ const [q, ve] = j(!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
- if (!(c != null && c.timeline)) return 0;
57
- const { restockSuggestionStart: e, restockSuggestionEnd: s } = c.timeline;
56
+ const V = () => {
57
+ if (!(d != null && d.timeline)) return 0;
58
+ const { restockSuggestionStart: e, restockSuggestionEnd: s } = d.timeline;
58
59
  if (!e || !s) return 0;
59
- const r = new Date(e), l = new Date(s).getTime() - r.getTime(), d = Math.ceil(l / (1e3 * 60 * 60 * 24));
60
- 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;
64
- if (!s) return y(e);
65
- const r = F(s);
66
- 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];
60
+ const r = new Date(e), l = new Date(s).getTime() - r.getTime(), c = Math.ceil(l / (1e3 * 60 * 60 * 24));
61
+ return c > 0 ? c : 0;
62
+ }, je = () => {
63
+ var i;
64
+ const e = _(), s = (i = d == null ? void 0 : d.timeline) == null ? void 0 : i.stockEndDate;
65
+ if (!s) return v(e);
66
+ const r = S(s);
67
+ return isNaN(r.getTime()) || r < e ? v(e) : v(r);
68
+ }, ke = () => xe(V()), g = (() => {
69
+ var i, l, c;
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
- const u = (l = e.marcas) == null ? void 0 : l[0], f = (d = u == null ? void 0 : u.embalagens) == null ? void 0 : d[0];
74
+ const u = (l = e.marcas) == null ? void 0 : l[0], f = (c = u == null ? void 0 : u.embalagens) == null ? void 0 : c[0];
74
75
  return u && f ? {
75
76
  marca: u.nome,
76
77
  embalagem: f.label,
@@ -81,25 +82,25 @@ function Ue({
81
82
  let r = null;
82
83
  for (const u of e.marcas || [])
83
84
  for (const f of u.embalagens || []) {
84
- const m = f.quantidade_fornecedor;
85
- if (!(m <= 0))
86
- for (let b = 1; b <= 100; b++) {
87
- const ue = b * m, H = ge({
85
+ const p = f.quantidade_fornecedor;
86
+ if (!(p <= 0))
87
+ for (let h = 1; h <= 100; h++) {
88
+ const ge = h * p, H = me({
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 pe = h * f.valor_unitario * p, N = H.totalDays - s;
95
+ (!r || N < r.daysDifference || N === r.daysDifference && pe < r.totalValue) && (r = {
95
96
  marca: u.nome,
96
97
  embalagem: f.label,
97
- quantidade: b,
98
+ quantidade: h,
98
99
  valorUnitario: f.valor_unitario,
99
- totalKg: ue,
100
- totalValue: fe,
100
+ totalKg: ge,
101
+ totalValue: pe,
101
102
  days: H.totalDays,
102
- daysDifference: L
103
+ daysDifference: N
103
104
  });
104
105
  }
105
106
  }
@@ -110,179 +111,179 @@ 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, c;
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
- const r = (d = s.embalagens) == null ? void 0 : d[0];
122
+ const r = (c = s.embalagens) == null ? void 0 : c[0];
122
123
  return (r == null ? void 0 : r.valor_unitario) ?? 0;
123
- }, [i, _] = j({
124
+ }, M = o.unidade_medida ?? "kg", Ce = ((J = o.ultima_compra) == null ? void 0 : J.unidade) ?? o.unidade_medida ?? "kg", [a, Q] = j({
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(() => {
137
- var d, u, f;
138
- const e = V(), s = (d = c == null ? void 0 : c.timeline) == null ? void 0 : d.stockEndDate;
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] = j(
129
+ ((Z = (X = o == null ? void 0 : o.fornecedores) == null ? void 0 : X[0]) == null ? void 0 : Z.nome) ?? ""
130
+ ), [C, I] = j(
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
+ ), [F, B] = j(
133
+ (g == null ? void 0 : g.embalagem) ?? ((ce = (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 : ce.label) ?? ""
134
+ ), [P, O] = j(
135
+ je
136
+ ), [W, A] = j(ke);
137
+ U(() => {
138
+ var c, u, f;
139
+ const e = _(), s = (c = d == null ? void 0 : d.timeline) == null ? void 0 : c.stockEndDate;
139
140
  let r;
140
141
  if (s) {
141
- const m = F(s);
142
- r = isNaN(m.getTime()) || m < e ? y(e) : y(m);
142
+ const p = S(s);
143
+ r = isNaN(p.getTime()) || p < e ? v(e) : v(p);
143
144
  } else
144
- r = y(e);
145
- let a = 0;
146
- if ((u = c == null ? void 0 : c.timeline) != null && u.restockSuggestionStart && ((f = c == null ? void 0 : c.timeline) != null && f.restockSuggestionEnd)) {
147
- 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);
145
+ r = v(e);
146
+ let i = 0;
147
+ if ((u = d == null ? void 0 : d.timeline) != null && u.restockSuggestionStart && ((f = d == null ? void 0 : d.timeline) != null && f.restockSuggestionEnd)) {
148
+ const p = S(d.timeline.restockSuggestionStart), h = S(d.timeline.restockSuggestionEnd);
149
+ !isNaN(p.getTime()) && !isNaN(h.getTime()) && (i = Math.ceil((h.getTime() - p.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
+ }, [d, 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
- S(l.nome);
161
- const d = (a = l.embalagens) == null ? void 0 : a[0];
162
- d && B(d.label);
161
+ I(l.nome);
162
+ const c = (i = l.embalagens) == null ? void 0 : i[0];
163
+ c && B(c.label);
163
164
  }
164
165
  }
165
166
  }, [o, g]);
166
- const D = M(() => {
167
- var l, d, u;
168
- const e = (l = i.fornecedores) == null ? void 0 : l[0];
167
+ const D = E(() => {
168
+ var l, c, u;
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 = (c = e.marcas) == null ? void 0 : c.find((f) => f.nome === C);
171
172
  if (!s) return 0;
172
173
  const r = (u = s.embalagens) == null ? void 0 : u.find(
173
- (f) => f.label === w
174
- ), a = (r == null ? void 0 : r.quantidade_fornecedor) ?? 0;
175
- return i.qtdPedido * a;
174
+ (f) => f.label === F
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,
180
- w
181
- ]), W = M(() => !x || D <= 0 ? null : ge({
178
+ a.qtdPedido,
179
+ a.fornecedores,
180
+ C,
181
+ F
182
+ ]), R = E(() => !x || D <= 0 ? null : me({
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]), w = (R == null ? void 0 : R.totalDays) ?? 0, b = E(() => {
186
187
  if (!x) return 0;
187
- const e = V(), s = F(E);
188
+ const e = _(), s = S(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
- if (c)
196
+ }, [x, P, W]), $ = E(() => {
197
+ if (d)
197
198
  return {
198
- ...c,
199
+ ...d,
199
200
  timeline: {
200
- ...c.timeline,
201
+ ...d.timeline,
201
202
  dailyConsumptionAverage: x
202
203
  }
203
204
  };
204
- }, [c, x]);
205
+ }, [d, 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
- return s ? ((l = s.embalagens) == null ? void 0 : l.find((d) => d.label === w)) ?? null : null;
213
- }, R = () => {
212
+ const s = (i = e.marcas) == null ? void 0 : i.find((c) => c.nome === C);
213
+ return s ? ((l = s.embalagens) == null ? void 0 : l.find((c) => c.label === F)) ?? null : null;
214
+ }, z = () => {
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
+ }, y = () => {
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 = z(), r = e * s;
228
+ Q((i) => ({
229
+ ...i,
229
230
  qtdPedido: e,
230
231
  valorTotal: r
231
232
  }));
232
- }, z = (e) => {
233
- var d, u, f;
233
+ }, L = (e) => {
234
+ var c, u, f;
234
235
  B(e);
235
- const s = (d = i.fornecedores) == null ? void 0 : d[0];
236
+ const s = (c = a.fornecedores) == null ? void 0 : c[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((p) => p.nome === C);
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) => ({
243
- ...m,
240
+ const i = (f = r.embalagens) == null ? void 0 : f.find((p) => p.label === e);
241
+ if (!i) return;
242
+ const l = a.qtdPedido * (i.valor_unitario ?? 0);
243
+ Q((p) => ({
244
+ ...p,
244
245
  valorTotal: l
245
246
  }));
246
- }, ke = () => {
247
+ }, Fe = () => {
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
+ }, Te = () => {
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 === C);
255
256
  return s ? s.embalagens || [] : [];
256
- }, Ce = (e) => {
257
- var l, d;
258
- S(e);
259
- const s = (l = i.fornecedores) == null ? void 0 : l[0];
257
+ }, Se = (e) => {
258
+ var l, c;
259
+ I(e);
260
+ const s = (l = a.fornecedores) == null ? void 0 : l[0];
260
261
  if (!s) return;
261
- const r = (d = s.marcas) == null ? void 0 : d.find((u) => u.nome === e);
262
+ const r = (c = s.marcas) == null ? void 0 : c.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) => {
266
- var l, d, u;
267
- Q(e);
268
- const s = (l = i.fornecedores) == null ? void 0 : l.find(
264
+ const i = r.embalagens[0];
265
+ L(i.label);
266
+ }, Ie = (e) => {
267
+ var l, c, u;
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;
272
- const r = (d = s.marcas) == null ? void 0 : d[0];
273
+ const r = (c = s.marcas) == null ? void 0 : c[0];
273
274
  if (!r) {
274
- S(""), B("");
275
+ I(""), B("");
275
276
  return;
276
277
  }
277
- 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();
284
- if (e <= 0 || h <= 0) return;
285
- const s = Math.ceil(h / e);
278
+ I(r.nome);
279
+ const i = (u = r.embalagens) == null ? void 0 : u[0];
280
+ i ? L(i.label) : B("");
281
+ }, Be = (e) => {
282
+ e.preventDefault(), m(a);
283
+ }, De = () => {
284
+ const e = y();
285
+ if (e <= 0 || b <= 0) return;
286
+ const s = Math.ceil(b / e);
286
287
  T(s);
287
288
  }, t = {
288
289
  container: {
@@ -360,62 +361,36 @@ function Ue({
360
361
  fontFamily: "Inter, sans-serif"
361
362
  },
362
363
  select: {
363
- height: "36px",
364
- padding: "6px 10px",
365
- border: "1px solid #d1d5db",
366
- borderRadius: "6px",
364
+ height: "42px",
365
+ padding: "0 14px",
366
+ border: "1.5px solid #e2e8f0",
367
+ borderRadius: "10px",
367
368
  fontSize: "14px",
368
- backgroundColor: "white",
369
- color: "#374151",
369
+ fontWeight: "500",
370
+ backgroundColor: "#f8fafc",
371
+ color: "#0f172a",
370
372
  cursor: "pointer",
371
373
  outline: "none",
372
374
  fontFamily: "Inter, sans-serif",
373
375
  boxSizing: "border-box",
374
- lineHeight: "1"
376
+ lineHeight: "1",
377
+ transition: "border-color 0.15s, box-shadow 0.15s"
375
378
  },
376
379
  dateInput: {
377
- height: "36px",
378
- padding: "6px 10px",
379
- border: "1px solid #d1d5db",
380
- borderRadius: "6px",
380
+ height: "42px",
381
+ padding: "0 14px",
382
+ border: "1.5px solid #e2e8f0",
383
+ borderRadius: "10px",
381
384
  fontSize: "14px",
382
- backgroundColor: "white",
383
- color: "#374151",
385
+ fontWeight: "500",
386
+ backgroundColor: "#f8fafc",
387
+ color: "#0f172a",
384
388
  outline: "none",
385
389
  fontFamily: "Inter, sans-serif",
386
390
  boxSizing: "border-box",
387
- lineHeight: "1"
388
- },
389
- rangeTotal: {
390
- fontSize: "20px",
391
- fontWeight: "700",
392
- color: "#111827",
393
- fontFamily: "Inter, sans-serif",
394
- display: "flex",
395
- alignItems: "center"
396
- },
397
- addConsumoButton: {
398
- display: "flex",
399
- alignItems: "center",
400
- justifyContent: "center",
401
- width: "28px",
402
- height: "28px",
403
- minWidth: "28px",
404
- borderRadius: "6px",
405
- border: "1px solid #9ca3af",
406
- backgroundColor: "#e5e7eb",
407
- color: "#374151",
408
- fontSize: "16px",
409
- fontWeight: "600",
410
- cursor: "pointer",
411
- transition: "all 0.2s",
412
- fontFamily: "Inter, sans-serif"
413
- },
414
- addConsumoButtonDisabled: {
415
- opacity: 0.5,
416
- cursor: "not-allowed",
417
- backgroundColor: "#d1d5db",
418
- borderColor: "#9ca3af"
391
+ lineHeight: "1",
392
+ transition: "border-color 0.15s, box-shadow 0.15s",
393
+ width: "100%"
419
394
  },
420
395
  // Estilos da seção de pedido (estilo calculadora)
421
396
  orderSectionContainer: {
@@ -551,9 +526,9 @@ function Ue({
551
526
  backgroundColor: "#DC2626"
552
527
  }
553
528
  };
554
- return /* @__PURE__ */ n.jsxs("form", { onSubmit: Te, style: t.container, children: [
529
+ return /* @__PURE__ */ n.jsxs("form", { onSubmit: Be, style: t.container, children: [
555
530
  /* @__PURE__ */ n.jsxs("div", { style: t.header, children: [
556
- /* @__PURE__ */ n.jsx("h2", { style: t.itemTitle, children: i.nome }),
531
+ /* @__PURE__ */ n.jsx("h2", { style: t.itemTitle, children: a.nome }),
557
532
  /* @__PURE__ */ n.jsx("div", { style: t.valorUnitario, children: /* @__PURE__ */ n.jsx(
558
533
  "div",
559
534
  {
@@ -565,7 +540,7 @@ function Ue({
565
540
  backgroundColor: "#FF4E00",
566
541
  fontWeight: "600"
567
542
  },
568
- children: G(R())
543
+ children: K(z())
569
544
  }
570
545
  ) })
571
546
  ] }),
@@ -581,13 +556,14 @@ function Ue({
581
556
  children: [
582
557
  /* @__PURE__ */ n.jsxs("div", { style: t.infoRow, children: [
583
558
  /* @__PURE__ */ n.jsxs("div", { style: t.infoText, children: [
584
- /* @__PURE__ */ n.jsx(De, { width: 20, height: 20 }),
559
+ /* @__PURE__ */ n.jsx(We, { width: 20, height: 20 }),
585
560
  "Última compra ",
586
- (le = i.ultima_compra) == null ? void 0 : le.data
561
+ (de = a.ultima_compra) == null ? void 0 : de.data
587
562
  ] }),
588
563
  /* @__PURE__ */ n.jsxs("div", { style: t.infoValue, children: [
589
- Number(((de = i.ultima_compra) == null ? void 0 : de.quantidade) ?? 0).toFixed(2),
590
- " KG"
564
+ Number(((ue = a.ultima_compra) == null ? void 0 : ue.quantidade) ?? 0).toFixed(2),
565
+ " ",
566
+ Ce.toUpperCase()
591
567
  ] })
592
568
  ] }),
593
569
  /* @__PURE__ */ n.jsxs("div", { style: t.formGrid, children: [
@@ -596,10 +572,10 @@ function Ue({
596
572
  /* @__PURE__ */ n.jsx(
597
573
  "select",
598
574
  {
599
- value: je,
600
- onChange: (e) => we(e.target.value),
575
+ value: we,
576
+ onChange: (e) => Ie(e.target.value),
601
577
  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))
578
+ children: (fe = a.fornecedores) == null ? void 0 : fe.map((e) => /* @__PURE__ */ n.jsx("option", { value: e.nome, children: e.nome }, e.nome))
603
579
  }
604
580
  )
605
581
  ] }),
@@ -608,10 +584,10 @@ function Ue({
608
584
  /* @__PURE__ */ n.jsx(
609
585
  "select",
610
586
  {
611
- value: q,
612
- onChange: (e) => Ce(e.target.value),
587
+ value: C,
588
+ onChange: (e) => Se(e.target.value),
613
589
  style: t.select,
614
- children: ke().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.nome, children: e.nome }, e.nome))
590
+ children: Fe().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.nome, children: e.nome }, e.nome))
615
591
  }
616
592
  )
617
593
  ] }),
@@ -620,32 +596,35 @@ function Ue({
620
596
  /* @__PURE__ */ n.jsx(
621
597
  "select",
622
598
  {
623
- value: w,
624
- onChange: (e) => z(e.target.value),
599
+ value: F,
600
+ onChange: (e) => L(e.target.value),
625
601
  style: t.select,
626
- children: qe().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.label, children: e.label }, e.label))
602
+ children: Te().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.label, children: e.label }, e.label))
627
603
  }
628
604
  )
629
605
  ] })
630
606
  ] }),
631
- A && /* @__PURE__ */ n.jsx("div", { style: { marginTop: "8px", marginBottom: "8px" }, children: /* @__PURE__ */ n.jsx(
632
- Se,
607
+ $ && /* @__PURE__ */ n.jsx("div", { style: { marginTop: "8px", marginBottom: "8px" }, children: /* @__PURE__ */ n.jsx(
608
+ Me,
633
609
  {
634
- data: A,
610
+ data: $,
635
611
  controls: !0,
636
- showLegend: !1,
612
+ showLegend: he,
637
613
  size: "sm",
638
- showSuggestionBar: xe,
614
+ showSuggestionBar: ye,
615
+ unitLabel: M,
639
616
  onAddSuggestedWeight: (e) => T(e),
640
617
  selectedQty: D,
641
- selectedQtyDays: C
618
+ selectedQtyDays: w
642
619
  }
643
620
  ) }),
644
621
  /* @__PURE__ */ n.jsxs(
645
622
  "div",
646
623
  {
647
624
  style: {
648
- ...t.formGrid,
625
+ display: "grid",
626
+ gridTemplateColumns: q ? "1fr 1fr" : "1fr 1fr 1fr",
627
+ gap: "16px",
649
628
  marginTop: "8px",
650
629
  alignItems: "flex-start"
651
630
  },
@@ -656,9 +635,9 @@ function Ue({
656
635
  "input",
657
636
  {
658
637
  type: "date",
659
- value: E,
660
- min: Me(),
661
- onChange: (e) => Y(e.target.value),
638
+ value: P,
639
+ min: Re(),
640
+ onChange: (e) => O(e.target.value),
662
641
  style: t.dateInput,
663
642
  "aria-label": "Data inicial"
664
643
  }
@@ -669,53 +648,103 @@ function Ue({
669
648
  /* @__PURE__ */ n.jsx(
670
649
  "select",
671
650
  {
672
- value: P,
673
- onChange: (e) => O(Number(e.target.value)),
651
+ value: W,
652
+ onChange: (e) => A(Number(e.target.value)),
674
653
  style: t.select,
675
654
  "aria-label": "Quantos dias?",
676
- children: pe.map((e) => /* @__PURE__ */ n.jsx("option", { value: e, children: e }, e))
655
+ children: be.map((e) => /* @__PURE__ */ n.jsx("option", { value: e, children: e }, e))
677
656
  }
678
657
  )
679
658
  ] }),
680
- /* @__PURE__ */ n.jsxs("div", { style: t.formField, children: [
681
- /* @__PURE__ */ n.jsx("label", { style: t.label, children: "Consumo previsto" }),
682
- /* @__PURE__ */ n.jsxs(
683
- "div",
684
- {
685
- style: {
686
- display: "flex",
687
- alignItems: "center",
688
- gap: "8px"
689
- },
690
- children: [
691
- /* @__PURE__ */ n.jsxs("div", { style: t.rangeTotal, children: [
692
- h.toFixed(2),
693
- " kg"
694
- ] }),
695
- /* @__PURE__ */ n.jsx(
696
- "button",
697
- {
698
- type: "button",
699
- onClick: Fe,
700
- disabled: h <= 0 || v() <= 0,
701
- style: {
702
- ...t.addConsumoButton,
703
- ...h <= 0 || v() <= 0 ? t.addConsumoButtonDisabled : {}
704
- },
705
- onMouseEnter: (e) => {
706
- h > 0 && v() > 0 && (e.currentTarget.style.backgroundColor = "#d1d5db");
707
- },
708
- onMouseLeave: (e) => {
709
- h > 0 && v() > 0 && (e.currentTarget.style.backgroundColor = "#e5e7eb");
710
- },
711
- "aria-label": "Definir quantidade pelo consumo previsto",
712
- children: "↻"
713
- }
714
- )
715
- ]
716
- }
717
- )
718
- ] })
659
+ /* @__PURE__ */ n.jsxs(
660
+ "div",
661
+ {
662
+ style: {
663
+ ...t.formField,
664
+ ...q ? { gridColumn: "1 / -1" } : {}
665
+ },
666
+ children: [
667
+ /* @__PURE__ */ n.jsx("label", { style: t.label, children: "Consumo previsto" }),
668
+ /* @__PURE__ */ n.jsxs(
669
+ "div",
670
+ {
671
+ style: {
672
+ display: "flex",
673
+ alignItems: "center",
674
+ justifyContent: "space-between",
675
+ padding: "8px 14px",
676
+ backgroundColor: "#f8fafc",
677
+ border: "1.5px solid #e2e8f0",
678
+ borderRadius: "10px",
679
+ height: "42px"
680
+ },
681
+ children: [
682
+ /* @__PURE__ */ n.jsxs(
683
+ "span",
684
+ {
685
+ style: {
686
+ fontSize: "18px",
687
+ fontWeight: "700",
688
+ color: "#0f172a",
689
+ fontFamily: "Inter, sans-serif",
690
+ letterSpacing: "-0.3px"
691
+ },
692
+ children: [
693
+ b.toFixed(2),
694
+ " ",
695
+ /* @__PURE__ */ n.jsx(
696
+ "span",
697
+ {
698
+ style: {
699
+ fontSize: "13px",
700
+ fontWeight: "500",
701
+ color: "#64748b"
702
+ },
703
+ children: M
704
+ }
705
+ )
706
+ ]
707
+ }
708
+ ),
709
+ /* @__PURE__ */ n.jsx(
710
+ "button",
711
+ {
712
+ type: "button",
713
+ onClick: De,
714
+ disabled: b <= 0 || y() <= 0,
715
+ style: {
716
+ display: "flex",
717
+ alignItems: "center",
718
+ justifyContent: "center",
719
+ width: "30px",
720
+ height: "30px",
721
+ minWidth: "30px",
722
+ borderRadius: "8px",
723
+ border: "none",
724
+ backgroundColor: b > 0 && y() > 0 ? "#FF4E00" : "#e5e7eb",
725
+ color: b > 0 && y() > 0 ? "white" : "#9ca3af",
726
+ fontSize: "16px",
727
+ cursor: b > 0 && y() > 0 ? "pointer" : "not-allowed",
728
+ opacity: b <= 0 || y() <= 0 ? 0.5 : 1,
729
+ transition: "all 0.2s",
730
+ fontFamily: "Inter, sans-serif"
731
+ },
732
+ onMouseEnter: (e) => {
733
+ b > 0 && y() > 0 && (e.currentTarget.style.backgroundColor = "#e04400");
734
+ },
735
+ onMouseLeave: (e) => {
736
+ b > 0 && y() > 0 && (e.currentTarget.style.backgroundColor = "#FF4E00");
737
+ },
738
+ "aria-label": "Definir quantidade pelo consumo previsto",
739
+ children: "↻"
740
+ }
741
+ )
742
+ ]
743
+ }
744
+ )
745
+ ]
746
+ }
747
+ )
719
748
  ]
720
749
  }
721
750
  ),
@@ -727,22 +756,22 @@ function Ue({
727
756
  type: "button",
728
757
  style: {
729
758
  ...t.quantityButton,
730
- ...i.qtdPedido <= 0 ? t.quantityButtonDisabled : {}
759
+ ...a.qtdPedido <= 0 ? t.quantityButtonDisabled : {}
731
760
  },
732
- onClick: () => T(Math.max(0, i.qtdPedido - 1)),
761
+ onClick: () => T(Math.max(0, a.qtdPedido - 1)),
733
762
  onMouseEnter: (e) => {
734
- i.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonHover.background, e.currentTarget.style.transform = t.quantityButtonHover.transform);
763
+ a.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonHover.background, e.currentTarget.style.transform = t.quantityButtonHover.transform);
735
764
  },
736
765
  onMouseLeave: (e) => {
737
766
  e.currentTarget.style.background = t.quantityButton.background, e.currentTarget.style.transform = "";
738
767
  },
739
768
  onMouseDown: (e) => {
740
- i.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonActive.background, e.currentTarget.style.transform = t.quantityButtonActive.transform);
769
+ a.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonActive.background, e.currentTarget.style.transform = t.quantityButtonActive.transform);
741
770
  },
742
771
  onMouseUp: (e) => {
743
- i.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonHover.background, e.currentTarget.style.transform = t.quantityButtonHover.transform);
772
+ a.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonHover.background, e.currentTarget.style.transform = t.quantityButtonHover.transform);
744
773
  },
745
- disabled: i.qtdPedido <= 0,
774
+ disabled: a.qtdPedido <= 0,
746
775
  "aria-label": "Diminuir quantidade",
747
776
  children: /* @__PURE__ */ n.jsx(
748
777
  "svg",
@@ -769,7 +798,7 @@ function Ue({
769
798
  "input",
770
799
  {
771
800
  type: "number",
772
- value: i.qtdPedido,
801
+ value: a.qtdPedido,
773
802
  onChange: (e) => T(
774
803
  Math.max(0, parseInt(e.target.value) || 0)
775
804
  ),
@@ -779,14 +808,14 @@ function Ue({
779
808
  "aria-label": "Quantidade"
780
809
  }
781
810
  ),
782
- /* @__PURE__ */ n.jsx("span", { style: t.quantityLabel, children: w || "unidades" })
811
+ /* @__PURE__ */ n.jsx("span", { style: t.quantityLabel, children: F || "unidades" })
783
812
  ] }),
784
813
  /* @__PURE__ */ n.jsx(
785
814
  "button",
786
815
  {
787
816
  type: "button",
788
817
  style: t.quantityButton,
789
- onClick: () => T(i.qtdPedido + 1),
818
+ onClick: () => T(a.qtdPedido + 1),
790
819
  onMouseEnter: (e) => {
791
820
  e.currentTarget.style.background = t.quantityButtonHover.background, e.currentTarget.style.transform = t.quantityButtonHover.transform;
792
821
  },
@@ -826,7 +855,7 @@ function Ue({
826
855
  {
827
856
  style: {
828
857
  ...t.totalsRow,
829
- ...I ? {
858
+ ...q ? {
830
859
  flexDirection: "column",
831
860
  gap: "12px",
832
861
  alignItems: "stretch"
@@ -838,13 +867,14 @@ function Ue({
838
867
  {
839
868
  style: {
840
869
  ...t.totalItem,
841
- ...I ? { justifyContent: "space-between", width: "100%" } : {}
870
+ ...q ? { justifyContent: "space-between", width: "100%" } : {}
842
871
  },
843
872
  children: [
844
873
  /* @__PURE__ */ n.jsx("span", { style: t.totalLabel, children: "Total:" }),
845
874
  /* @__PURE__ */ n.jsxs("span", { style: t.totalValue, children: [
846
- (i.qtdPedido * v()).toFixed(2),
847
- " kg"
875
+ (a.qtdPedido * y()).toFixed(2),
876
+ " ",
877
+ M
848
878
  ] })
849
879
  ]
850
880
  }
@@ -854,29 +884,27 @@ function Ue({
854
884
  {
855
885
  style: {
856
886
  ...t.totalItem,
857
- ...I ? { justifyContent: "space-between", width: "100%" } : {}
887
+ ...q ? { justifyContent: "space-between", width: "100%" } : {}
858
888
  },
859
889
  children: [
860
890
  /* @__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
- ) })
891
+ /* @__PURE__ */ n.jsx("span", { style: t.totalValueHighlight, children: K(a.qtdPedido * z()) })
864
892
  ]
865
893
  }
866
894
  ),
867
- C > 0 && /* @__PURE__ */ n.jsxs(
895
+ w > 0 && /* @__PURE__ */ n.jsxs(
868
896
  "div",
869
897
  {
870
898
  style: {
871
899
  ...t.totalItem,
872
- ...I ? { justifyContent: "space-between", width: "100%" } : {}
900
+ ...q ? { justifyContent: "space-between", width: "100%" } : {}
873
901
  },
874
902
  children: [
875
903
  /* @__PURE__ */ n.jsx("span", { style: t.totalLabel, children: "Duração:" }),
876
904
  /* @__PURE__ */ n.jsxs("span", { style: t.totalValue, children: [
877
- C % 1 === 0 ? C.toString() : C.toFixed(1),
905
+ w % 1 === 0 ? w.toString() : w.toFixed(1),
878
906
  " ",
879
- C === 1 ? "dia" : "dias"
907
+ w === 1 ? "dia" : "dias"
880
908
  ] })
881
909
  ]
882
910
  }
@@ -890,17 +918,17 @@ function Ue({
890
918
  "button",
891
919
  {
892
920
  type: "submit",
893
- disabled: i.qtdPedido <= 0,
921
+ disabled: a.qtdPedido <= 0,
894
922
  style: {
895
923
  ...t.button,
896
924
  ...t.addButton,
897
- ...i.qtdPedido <= 0 ? t.addButtonDisabled : {}
925
+ ...a.qtdPedido <= 0 ? t.addButtonDisabled : {}
898
926
  },
899
927
  onMouseEnter: (e) => {
900
- i.qtdPedido > 0 && (e.currentTarget.style.backgroundColor = t.addButtonHover.backgroundColor);
928
+ a.qtdPedido > 0 && (e.currentTarget.style.backgroundColor = t.addButtonHover.backgroundColor);
901
929
  },
902
930
  onMouseLeave: (e) => {
903
- i.qtdPedido > 0 && (e.currentTarget.style.backgroundColor = t.addButton.backgroundColor);
931
+ a.qtdPedido > 0 && (e.currentTarget.style.backgroundColor = t.addButton.backgroundColor);
904
932
  },
905
933
  children: "Adicionar"
906
934
  }
@@ -927,6 +955,6 @@ function Ue({
927
955
  ] });
928
956
  }
929
957
  export {
930
- Ue as OrderForm
958
+ Oe as OrderForm
931
959
  };
932
960
  //# sourceMappingURL=index10.js.map