eatopia-ds 0.0.949 → 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 +237 -212
- package/build/index10.js.map +1 -1
- package/build/index11.js +1 -1
- package/build/index11.js.map +1 -1
- package/build/index18.js +25 -21
- package/build/index18.js.map +1 -1
- package/build/index31.js +2 -2
- package/build/index32.js +1 -1
- package/build/index34.js +2 -2
- package/build/index35.js +1 -1
- package/build/index46.js.map +1 -1
- package/build/index47.js +66 -52
- package/build/index47.js.map +1 -1
- package/build/index48.js +26 -22
- package/build/index48.js.map +1 -1
- package/build/index49.js.map +1 -1
- package/build/index50.js +52 -66
- package/build/index50.js.map +1 -1
- package/build/index51.js +22 -26
- package/build/index51.js.map +1 -1
- package/package.json +1 -1
package/build/index10.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
1
|
import { j as n } from "./index24.js";
|
|
2
|
-
import
|
|
3
|
-
import { StockLeadTime as
|
|
4
|
-
import { calculateConsumptionForecast as
|
|
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
5
|
import { AlertIcon as We } from "./index23.js";
|
|
6
|
-
const be = [1, 2, 3, 7, 10, 15, 30, 60, 90],
|
|
7
|
-
const
|
|
8
|
-
return `${
|
|
9
|
-
},
|
|
10
|
-
const
|
|
11
|
-
return
|
|
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
12
|
}, Re = () => {
|
|
13
13
|
const o = /* @__PURE__ */ new Date();
|
|
14
|
-
return o.setDate(o.getDate() + 1), o.setHours(0, 0, 0, 0),
|
|
14
|
+
return o.setDate(o.getDate() + 1), o.setHours(0, 0, 0, 0), v(o);
|
|
15
15
|
}, _ = () => {
|
|
16
16
|
const o = /* @__PURE__ */ new Date();
|
|
17
17
|
return o.setDate(o.getDate() + 1), o.setHours(0, 0, 0, 0), o;
|
|
18
18
|
}, xe = (o) => o <= 0 ? 7 : be.reduce(
|
|
19
|
-
(
|
|
19
|
+
(m, k) => Math.abs(k - o) < Math.abs(m - o) ? k : m
|
|
20
20
|
);
|
|
21
21
|
function Oe({
|
|
22
22
|
data: o,
|
|
23
|
-
onSubmit:
|
|
24
|
-
onCancel:
|
|
25
|
-
timelineData:
|
|
26
|
-
fornecedoresOptions:
|
|
27
|
-
marcasOptions:
|
|
23
|
+
onSubmit: m,
|
|
24
|
+
onCancel: k,
|
|
25
|
+
timelineData: d,
|
|
26
|
+
fornecedoresOptions: ze,
|
|
27
|
+
marcasOptions: Le,
|
|
28
28
|
embalagensOptions: He,
|
|
29
29
|
dailyConsumptionAverages: x,
|
|
30
30
|
showSuggestionBar: ye = !0,
|
|
31
31
|
showLegendTimeline: he = !1
|
|
32
32
|
}) {
|
|
33
|
-
var J, X, Z, ee, te, ne, oe, re, se, ie, ae, le,
|
|
34
|
-
|
|
33
|
+
var J, X, Z, ee, te, ne, oe, re, se, ie, ae, le, ce, de, ue, fe;
|
|
34
|
+
Ee.useEffect(() => {
|
|
35
35
|
const e = document.createElement("style");
|
|
36
36
|
return e.textContent = `
|
|
37
37
|
.order-form-quantity-input::-webkit-outer-spin-button,
|
|
@@ -46,7 +46,7 @@ function Oe({
|
|
|
46
46
|
document.head.removeChild(e);
|
|
47
47
|
};
|
|
48
48
|
}, []);
|
|
49
|
-
const [
|
|
49
|
+
const [q, ve] = j(!1);
|
|
50
50
|
U(() => {
|
|
51
51
|
const e = () => {
|
|
52
52
|
ve(window.innerWidth <= 768);
|
|
@@ -54,24 +54,24 @@ function Oe({
|
|
|
54
54
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
55
55
|
}, []);
|
|
56
56
|
const V = () => {
|
|
57
|
-
if (!(
|
|
58
|
-
const { restockSuggestionStart: e, restockSuggestionEnd: s } =
|
|
57
|
+
if (!(d != null && d.timeline)) return 0;
|
|
58
|
+
const { restockSuggestionStart: e, restockSuggestionEnd: s } = d.timeline;
|
|
59
59
|
if (!e || !s) return 0;
|
|
60
|
-
const r = new Date(e), l = new Date(s).getTime() - r.getTime(),
|
|
61
|
-
return
|
|
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
62
|
}, je = () => {
|
|
63
63
|
var i;
|
|
64
|
-
const e = _(), s = (i =
|
|
65
|
-
if (!s) return
|
|
66
|
-
const r =
|
|
67
|
-
return isNaN(r.getTime()) || r < e ?
|
|
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
68
|
}, ke = () => xe(V()), g = (() => {
|
|
69
|
-
var i, l,
|
|
69
|
+
var i, l, c;
|
|
70
70
|
const e = (i = o == null ? void 0 : o.fornecedores) == null ? void 0 : i[0];
|
|
71
71
|
if (!e) return null;
|
|
72
72
|
const s = V();
|
|
73
73
|
if (!x || s <= 0) {
|
|
74
|
-
const u = (l = e.marcas) == null ? void 0 : l[0], f = (
|
|
74
|
+
const u = (l = e.marcas) == null ? void 0 : l[0], f = (c = u == null ? void 0 : u.embalagens) == null ? void 0 : c[0];
|
|
75
75
|
return u && f ? {
|
|
76
76
|
marca: u.nome,
|
|
77
77
|
embalagem: f.label,
|
|
@@ -82,23 +82,23 @@ function Oe({
|
|
|
82
82
|
let r = null;
|
|
83
83
|
for (const u of e.marcas || [])
|
|
84
84
|
for (const f of u.embalagens || []) {
|
|
85
|
-
const
|
|
86
|
-
if (!(
|
|
87
|
-
for (let
|
|
88
|
-
const 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({
|
|
89
89
|
dailyAverages: x,
|
|
90
90
|
startDate: /* @__PURE__ */ new Date(),
|
|
91
91
|
totalQuantity: ge
|
|
92
92
|
});
|
|
93
93
|
if (H.totalDays >= s) {
|
|
94
|
-
const
|
|
95
|
-
(!r || N < r.daysDifference || N === r.daysDifference &&
|
|
94
|
+
const pe = h * f.valor_unitario * p, N = H.totalDays - s;
|
|
95
|
+
(!r || N < r.daysDifference || N === r.daysDifference && pe < r.totalValue) && (r = {
|
|
96
96
|
marca: u.nome,
|
|
97
97
|
embalagem: f.label,
|
|
98
|
-
quantidade:
|
|
98
|
+
quantidade: h,
|
|
99
99
|
valorUnitario: f.valor_unitario,
|
|
100
100
|
totalKg: ge,
|
|
101
|
-
totalValue:
|
|
101
|
+
totalValue: pe,
|
|
102
102
|
days: H.totalDays,
|
|
103
103
|
daysDifference: N
|
|
104
104
|
});
|
|
@@ -112,45 +112,45 @@ function Oe({
|
|
|
112
112
|
valorUnitario: r.valorUnitario
|
|
113
113
|
} : null;
|
|
114
114
|
})(), qe = () => {
|
|
115
|
-
var i, l,
|
|
115
|
+
var i, l, c;
|
|
116
116
|
if (g)
|
|
117
117
|
return g.valorUnitario;
|
|
118
118
|
const e = (i = o == null ? void 0 : o.fornecedores) == null ? void 0 : i[0];
|
|
119
119
|
if (!e) return 0;
|
|
120
120
|
const s = (l = e.marcas) == null ? void 0 : l[0];
|
|
121
121
|
if (!s) return 0;
|
|
122
|
-
const r = (
|
|
122
|
+
const r = (c = s.embalagens) == null ? void 0 : c[0];
|
|
123
123
|
return (r == null ? void 0 : r.valor_unitario) ?? 0;
|
|
124
|
-
},
|
|
124
|
+
}, M = o.unidade_medida ?? "kg", Ce = ((J = o.ultima_compra) == null ? void 0 : J.unidade) ?? o.unidade_medida ?? "kg", [a, Q] = j({
|
|
125
125
|
...o,
|
|
126
126
|
qtdPedido: (g == null ? void 0 : g.quantidade) ?? (o == null ? void 0 : o.qtdPedido) ?? 0,
|
|
127
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] =
|
|
128
|
+
}), [we, Y] = j(
|
|
129
129
|
((Z = (X = o == null ? void 0 : o.fornecedores) == null ? void 0 : X[0]) == null ? void 0 : Z.nome) ?? ""
|
|
130
|
-
), [
|
|
130
|
+
), [C, I] = j(
|
|
131
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
|
-
), [
|
|
133
|
-
(g == null ? void 0 : g.embalagem) ?? ((
|
|
134
|
-
), [P, O] =
|
|
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
135
|
je
|
|
136
|
-
), [W, A] =
|
|
136
|
+
), [W, A] = j(ke);
|
|
137
137
|
U(() => {
|
|
138
|
-
var
|
|
139
|
-
const e = _(), s = (
|
|
138
|
+
var c, u, f;
|
|
139
|
+
const e = _(), s = (c = d == null ? void 0 : d.timeline) == null ? void 0 : c.stockEndDate;
|
|
140
140
|
let r;
|
|
141
141
|
if (s) {
|
|
142
|
-
const
|
|
143
|
-
r = isNaN(
|
|
142
|
+
const p = S(s);
|
|
143
|
+
r = isNaN(p.getTime()) || p < e ? v(e) : v(p);
|
|
144
144
|
} else
|
|
145
|
-
r =
|
|
145
|
+
r = v(e);
|
|
146
146
|
let i = 0;
|
|
147
|
-
if ((u =
|
|
148
|
-
const
|
|
149
|
-
!isNaN(
|
|
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);
|
|
150
150
|
}
|
|
151
151
|
const l = xe(i);
|
|
152
152
|
O(r), A(l);
|
|
153
|
-
}, [
|
|
153
|
+
}, [d, o]), U(() => {
|
|
154
154
|
var s, r, i;
|
|
155
155
|
if (g) return;
|
|
156
156
|
const e = (s = o == null ? void 0 : o.fornecedores) == null ? void 0 : s[0];
|
|
@@ -158,34 +158,34 @@ function Oe({
|
|
|
158
158
|
Y(e.nome);
|
|
159
159
|
const l = (r = e.marcas) == null ? void 0 : r[0];
|
|
160
160
|
if (l) {
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
161
|
+
I(l.nome);
|
|
162
|
+
const c = (i = l.embalagens) == null ? void 0 : i[0];
|
|
163
|
+
c && B(c.label);
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
}, [o, g]);
|
|
167
|
-
const D =
|
|
168
|
-
var l,
|
|
167
|
+
const D = E(() => {
|
|
168
|
+
var l, c, u;
|
|
169
169
|
const e = (l = a.fornecedores) == null ? void 0 : l[0];
|
|
170
170
|
if (!e) return 0;
|
|
171
|
-
const s = (
|
|
171
|
+
const s = (c = e.marcas) == null ? void 0 : c.find((f) => f.nome === C);
|
|
172
172
|
if (!s) return 0;
|
|
173
173
|
const r = (u = s.embalagens) == null ? void 0 : u.find(
|
|
174
|
-
(f) => f.label ===
|
|
174
|
+
(f) => f.label === F
|
|
175
175
|
), i = (r == null ? void 0 : r.quantidade_fornecedor) ?? 0;
|
|
176
176
|
return a.qtdPedido * i;
|
|
177
177
|
}, [
|
|
178
178
|
a.qtdPedido,
|
|
179
179
|
a.fornecedores,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
]), R =
|
|
180
|
+
C,
|
|
181
|
+
F
|
|
182
|
+
]), R = E(() => !x || D <= 0 ? null : me({
|
|
183
183
|
dailyAverages: x,
|
|
184
184
|
startDate: /* @__PURE__ */ new Date(),
|
|
185
185
|
totalQuantity: D
|
|
186
|
-
}), [x, D]),
|
|
186
|
+
}), [x, D]), w = (R == null ? void 0 : R.totalDays) ?? 0, b = E(() => {
|
|
187
187
|
if (!x) return 0;
|
|
188
|
-
const e = _(), s =
|
|
188
|
+
const e = _(), s = S(P);
|
|
189
189
|
if (isNaN(s.getTime())) return 0;
|
|
190
190
|
const r = s < e ? e : s;
|
|
191
191
|
return Pe(
|
|
@@ -193,25 +193,25 @@ function Oe({
|
|
|
193
193
|
r,
|
|
194
194
|
W
|
|
195
195
|
);
|
|
196
|
-
}, [x, P, W]), $ =
|
|
197
|
-
if (
|
|
196
|
+
}, [x, P, W]), $ = E(() => {
|
|
197
|
+
if (d)
|
|
198
198
|
return {
|
|
199
|
-
...
|
|
199
|
+
...d,
|
|
200
200
|
timeline: {
|
|
201
|
-
...
|
|
201
|
+
...d.timeline,
|
|
202
202
|
dailyConsumptionAverage: x
|
|
203
203
|
}
|
|
204
204
|
};
|
|
205
|
-
}, [
|
|
205
|
+
}, [d, x]);
|
|
206
206
|
if (!o)
|
|
207
207
|
return null;
|
|
208
208
|
const G = () => {
|
|
209
209
|
var r, i, l;
|
|
210
210
|
const e = (r = a.fornecedores) == null ? void 0 : r[0];
|
|
211
211
|
if (!e) return null;
|
|
212
|
-
const s = (i = e.marcas) == null ? void 0 : i.find((
|
|
213
|
-
return s ? ((l = s.embalagens) == null ? void 0 : l.find((
|
|
214
|
-
},
|
|
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 = () => {
|
|
215
215
|
var e;
|
|
216
216
|
return ((e = G()) == null ? void 0 : e.valor_unitario) ?? 0;
|
|
217
217
|
}, K = (e) => {
|
|
@@ -220,70 +220,70 @@ function Oe({
|
|
|
220
220
|
/\B(?=(\d{3})+(?!\d))/g,
|
|
221
221
|
"."
|
|
222
222
|
)},${i}`;
|
|
223
|
-
},
|
|
223
|
+
}, y = () => {
|
|
224
224
|
var e;
|
|
225
225
|
return ((e = G()) == null ? void 0 : e.quantidade_fornecedor) ?? 0;
|
|
226
226
|
}, T = (e) => {
|
|
227
|
-
const s =
|
|
227
|
+
const s = z(), r = e * s;
|
|
228
228
|
Q((i) => ({
|
|
229
229
|
...i,
|
|
230
230
|
qtdPedido: e,
|
|
231
231
|
valorTotal: r
|
|
232
232
|
}));
|
|
233
|
-
},
|
|
234
|
-
var
|
|
233
|
+
}, L = (e) => {
|
|
234
|
+
var c, u, f;
|
|
235
235
|
B(e);
|
|
236
|
-
const s = (
|
|
236
|
+
const s = (c = a.fornecedores) == null ? void 0 : c[0];
|
|
237
237
|
if (!s) return;
|
|
238
|
-
const r = (u = s.marcas) == null ? void 0 : u.find((
|
|
238
|
+
const r = (u = s.marcas) == null ? void 0 : u.find((p) => p.nome === C);
|
|
239
239
|
if (!r) return;
|
|
240
|
-
const i = (f = r.embalagens) == null ? void 0 : f.find((
|
|
240
|
+
const i = (f = r.embalagens) == null ? void 0 : f.find((p) => p.label === e);
|
|
241
241
|
if (!i) return;
|
|
242
242
|
const l = a.qtdPedido * (i.valor_unitario ?? 0);
|
|
243
|
-
Q((
|
|
244
|
-
...
|
|
243
|
+
Q((p) => ({
|
|
244
|
+
...p,
|
|
245
245
|
valorTotal: l
|
|
246
246
|
}));
|
|
247
|
-
},
|
|
247
|
+
}, Fe = () => {
|
|
248
248
|
var s;
|
|
249
249
|
const e = (s = a.fornecedores) == null ? void 0 : s[0];
|
|
250
250
|
return e ? e.marcas || [] : [];
|
|
251
|
-
},
|
|
251
|
+
}, Te = () => {
|
|
252
252
|
var r, i;
|
|
253
253
|
const e = (r = a.fornecedores) == null ? void 0 : r[0];
|
|
254
254
|
if (!e) return [];
|
|
255
|
-
const s = (i = e.marcas) == null ? void 0 : i.find((l) => l.nome ===
|
|
255
|
+
const s = (i = e.marcas) == null ? void 0 : i.find((l) => l.nome === C);
|
|
256
256
|
return s ? s.embalagens || [] : [];
|
|
257
|
-
},
|
|
258
|
-
var l,
|
|
259
|
-
|
|
257
|
+
}, Se = (e) => {
|
|
258
|
+
var l, c;
|
|
259
|
+
I(e);
|
|
260
260
|
const s = (l = a.fornecedores) == null ? void 0 : l[0];
|
|
261
261
|
if (!s) return;
|
|
262
|
-
const r = (
|
|
262
|
+
const r = (c = s.marcas) == null ? void 0 : c.find((u) => u.nome === e);
|
|
263
263
|
if (!r || !r.embalagens || r.embalagens.length === 0) return;
|
|
264
264
|
const i = r.embalagens[0];
|
|
265
|
-
|
|
266
|
-
},
|
|
267
|
-
var l,
|
|
265
|
+
L(i.label);
|
|
266
|
+
}, Ie = (e) => {
|
|
267
|
+
var l, c, u;
|
|
268
268
|
Y(e);
|
|
269
269
|
const s = (l = a.fornecedores) == null ? void 0 : l.find(
|
|
270
270
|
(f) => f.nome === e
|
|
271
271
|
);
|
|
272
272
|
if (!s) return;
|
|
273
|
-
const r = (
|
|
273
|
+
const r = (c = s.marcas) == null ? void 0 : c[0];
|
|
274
274
|
if (!r) {
|
|
275
|
-
|
|
275
|
+
I(""), B("");
|
|
276
276
|
return;
|
|
277
277
|
}
|
|
278
|
-
|
|
278
|
+
I(r.nome);
|
|
279
279
|
const i = (u = r.embalagens) == null ? void 0 : u[0];
|
|
280
|
-
i ?
|
|
280
|
+
i ? L(i.label) : B("");
|
|
281
281
|
}, Be = (e) => {
|
|
282
|
-
e.preventDefault(),
|
|
282
|
+
e.preventDefault(), m(a);
|
|
283
283
|
}, De = () => {
|
|
284
|
-
const e =
|
|
285
|
-
if (e <= 0 ||
|
|
286
|
-
const s = Math.ceil(
|
|
284
|
+
const e = y();
|
|
285
|
+
if (e <= 0 || b <= 0) return;
|
|
286
|
+
const s = Math.ceil(b / e);
|
|
287
287
|
T(s);
|
|
288
288
|
}, t = {
|
|
289
289
|
container: {
|
|
@@ -361,62 +361,36 @@ function Oe({
|
|
|
361
361
|
fontFamily: "Inter, sans-serif"
|
|
362
362
|
},
|
|
363
363
|
select: {
|
|
364
|
-
height: "
|
|
365
|
-
padding: "
|
|
366
|
-
border: "
|
|
367
|
-
borderRadius: "
|
|
364
|
+
height: "42px",
|
|
365
|
+
padding: "0 14px",
|
|
366
|
+
border: "1.5px solid #e2e8f0",
|
|
367
|
+
borderRadius: "10px",
|
|
368
368
|
fontSize: "14px",
|
|
369
|
-
|
|
370
|
-
|
|
369
|
+
fontWeight: "500",
|
|
370
|
+
backgroundColor: "#f8fafc",
|
|
371
|
+
color: "#0f172a",
|
|
371
372
|
cursor: "pointer",
|
|
372
373
|
outline: "none",
|
|
373
374
|
fontFamily: "Inter, sans-serif",
|
|
374
375
|
boxSizing: "border-box",
|
|
375
|
-
lineHeight: "1"
|
|
376
|
+
lineHeight: "1",
|
|
377
|
+
transition: "border-color 0.15s, box-shadow 0.15s"
|
|
376
378
|
},
|
|
377
379
|
dateInput: {
|
|
378
|
-
height: "
|
|
379
|
-
padding: "
|
|
380
|
-
border: "
|
|
381
|
-
borderRadius: "
|
|
380
|
+
height: "42px",
|
|
381
|
+
padding: "0 14px",
|
|
382
|
+
border: "1.5px solid #e2e8f0",
|
|
383
|
+
borderRadius: "10px",
|
|
382
384
|
fontSize: "14px",
|
|
383
|
-
|
|
384
|
-
|
|
385
|
+
fontWeight: "500",
|
|
386
|
+
backgroundColor: "#f8fafc",
|
|
387
|
+
color: "#0f172a",
|
|
385
388
|
outline: "none",
|
|
386
389
|
fontFamily: "Inter, sans-serif",
|
|
387
390
|
boxSizing: "border-box",
|
|
388
|
-
lineHeight: "1"
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
fontSize: "20px",
|
|
392
|
-
fontWeight: "700",
|
|
393
|
-
color: "#111827",
|
|
394
|
-
fontFamily: "Inter, sans-serif",
|
|
395
|
-
display: "flex",
|
|
396
|
-
alignItems: "center"
|
|
397
|
-
},
|
|
398
|
-
addConsumoButton: {
|
|
399
|
-
display: "flex",
|
|
400
|
-
alignItems: "center",
|
|
401
|
-
justifyContent: "center",
|
|
402
|
-
width: "28px",
|
|
403
|
-
height: "28px",
|
|
404
|
-
minWidth: "28px",
|
|
405
|
-
borderRadius: "6px",
|
|
406
|
-
border: "1px solid #9ca3af",
|
|
407
|
-
backgroundColor: "#e5e7eb",
|
|
408
|
-
color: "#374151",
|
|
409
|
-
fontSize: "16px",
|
|
410
|
-
fontWeight: "600",
|
|
411
|
-
cursor: "pointer",
|
|
412
|
-
transition: "all 0.2s",
|
|
413
|
-
fontFamily: "Inter, sans-serif"
|
|
414
|
-
},
|
|
415
|
-
addConsumoButtonDisabled: {
|
|
416
|
-
opacity: 0.5,
|
|
417
|
-
cursor: "not-allowed",
|
|
418
|
-
backgroundColor: "#d1d5db",
|
|
419
|
-
borderColor: "#9ca3af"
|
|
391
|
+
lineHeight: "1",
|
|
392
|
+
transition: "border-color 0.15s, box-shadow 0.15s",
|
|
393
|
+
width: "100%"
|
|
420
394
|
},
|
|
421
395
|
// Estilos da seção de pedido (estilo calculadora)
|
|
422
396
|
orderSectionContainer: {
|
|
@@ -566,7 +540,7 @@ function Oe({
|
|
|
566
540
|
backgroundColor: "#FF4E00",
|
|
567
541
|
fontWeight: "600"
|
|
568
542
|
},
|
|
569
|
-
children: K(
|
|
543
|
+
children: K(z())
|
|
570
544
|
}
|
|
571
545
|
) })
|
|
572
546
|
] }),
|
|
@@ -584,7 +558,7 @@ function Oe({
|
|
|
584
558
|
/* @__PURE__ */ n.jsxs("div", { style: t.infoText, children: [
|
|
585
559
|
/* @__PURE__ */ n.jsx(We, { width: 20, height: 20 }),
|
|
586
560
|
"Última compra ",
|
|
587
|
-
(
|
|
561
|
+
(de = a.ultima_compra) == null ? void 0 : de.data
|
|
588
562
|
] }),
|
|
589
563
|
/* @__PURE__ */ n.jsxs("div", { style: t.infoValue, children: [
|
|
590
564
|
Number(((ue = a.ultima_compra) == null ? void 0 : ue.quantidade) ?? 0).toFixed(2),
|
|
@@ -599,7 +573,7 @@ function Oe({
|
|
|
599
573
|
"select",
|
|
600
574
|
{
|
|
601
575
|
value: we,
|
|
602
|
-
onChange: (e) =>
|
|
576
|
+
onChange: (e) => Ie(e.target.value),
|
|
603
577
|
style: t.select,
|
|
604
578
|
children: (fe = a.fornecedores) == null ? void 0 : fe.map((e) => /* @__PURE__ */ n.jsx("option", { value: e.nome, children: e.nome }, e.nome))
|
|
605
579
|
}
|
|
@@ -610,10 +584,10 @@ function Oe({
|
|
|
610
584
|
/* @__PURE__ */ n.jsx(
|
|
611
585
|
"select",
|
|
612
586
|
{
|
|
613
|
-
value:
|
|
614
|
-
onChange: (e) =>
|
|
587
|
+
value: C,
|
|
588
|
+
onChange: (e) => Se(e.target.value),
|
|
615
589
|
style: t.select,
|
|
616
|
-
children:
|
|
590
|
+
children: Fe().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.nome, children: e.nome }, e.nome))
|
|
617
591
|
}
|
|
618
592
|
)
|
|
619
593
|
] }),
|
|
@@ -622,33 +596,35 @@ function Oe({
|
|
|
622
596
|
/* @__PURE__ */ n.jsx(
|
|
623
597
|
"select",
|
|
624
598
|
{
|
|
625
|
-
value:
|
|
626
|
-
onChange: (e) =>
|
|
599
|
+
value: F,
|
|
600
|
+
onChange: (e) => L(e.target.value),
|
|
627
601
|
style: t.select,
|
|
628
|
-
children:
|
|
602
|
+
children: Te().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.label, children: e.label }, e.label))
|
|
629
603
|
}
|
|
630
604
|
)
|
|
631
605
|
] })
|
|
632
606
|
] }),
|
|
633
607
|
$ && /* @__PURE__ */ n.jsx("div", { style: { marginTop: "8px", marginBottom: "8px" }, children: /* @__PURE__ */ n.jsx(
|
|
634
|
-
|
|
608
|
+
Me,
|
|
635
609
|
{
|
|
636
610
|
data: $,
|
|
637
611
|
controls: !0,
|
|
638
612
|
showLegend: he,
|
|
639
613
|
size: "sm",
|
|
640
614
|
showSuggestionBar: ye,
|
|
641
|
-
unitLabel:
|
|
615
|
+
unitLabel: M,
|
|
642
616
|
onAddSuggestedWeight: (e) => T(e),
|
|
643
617
|
selectedQty: D,
|
|
644
|
-
selectedQtyDays:
|
|
618
|
+
selectedQtyDays: w
|
|
645
619
|
}
|
|
646
620
|
) }),
|
|
647
621
|
/* @__PURE__ */ n.jsxs(
|
|
648
622
|
"div",
|
|
649
623
|
{
|
|
650
624
|
style: {
|
|
651
|
-
|
|
625
|
+
display: "grid",
|
|
626
|
+
gridTemplateColumns: q ? "1fr 1fr" : "1fr 1fr 1fr",
|
|
627
|
+
gap: "16px",
|
|
652
628
|
marginTop: "8px",
|
|
653
629
|
alignItems: "flex-start"
|
|
654
630
|
},
|
|
@@ -680,46 +656,95 @@ function Oe({
|
|
|
680
656
|
}
|
|
681
657
|
)
|
|
682
658
|
] }),
|
|
683
|
-
/* @__PURE__ */ n.jsxs(
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
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
|
+
)
|
|
723
748
|
]
|
|
724
749
|
}
|
|
725
750
|
),
|
|
@@ -783,7 +808,7 @@ function Oe({
|
|
|
783
808
|
"aria-label": "Quantidade"
|
|
784
809
|
}
|
|
785
810
|
),
|
|
786
|
-
/* @__PURE__ */ n.jsx("span", { style: t.quantityLabel, children:
|
|
811
|
+
/* @__PURE__ */ n.jsx("span", { style: t.quantityLabel, children: F || "unidades" })
|
|
787
812
|
] }),
|
|
788
813
|
/* @__PURE__ */ n.jsx(
|
|
789
814
|
"button",
|
|
@@ -830,7 +855,7 @@ function Oe({
|
|
|
830
855
|
{
|
|
831
856
|
style: {
|
|
832
857
|
...t.totalsRow,
|
|
833
|
-
...
|
|
858
|
+
...q ? {
|
|
834
859
|
flexDirection: "column",
|
|
835
860
|
gap: "12px",
|
|
836
861
|
alignItems: "stretch"
|
|
@@ -842,14 +867,14 @@ function Oe({
|
|
|
842
867
|
{
|
|
843
868
|
style: {
|
|
844
869
|
...t.totalItem,
|
|
845
|
-
...
|
|
870
|
+
...q ? { justifyContent: "space-between", width: "100%" } : {}
|
|
846
871
|
},
|
|
847
872
|
children: [
|
|
848
873
|
/* @__PURE__ */ n.jsx("span", { style: t.totalLabel, children: "Total:" }),
|
|
849
874
|
/* @__PURE__ */ n.jsxs("span", { style: t.totalValue, children: [
|
|
850
|
-
(a.qtdPedido *
|
|
875
|
+
(a.qtdPedido * y()).toFixed(2),
|
|
851
876
|
" ",
|
|
852
|
-
|
|
877
|
+
M
|
|
853
878
|
] })
|
|
854
879
|
]
|
|
855
880
|
}
|
|
@@ -859,27 +884,27 @@ function Oe({
|
|
|
859
884
|
{
|
|
860
885
|
style: {
|
|
861
886
|
...t.totalItem,
|
|
862
|
-
...
|
|
887
|
+
...q ? { justifyContent: "space-between", width: "100%" } : {}
|
|
863
888
|
},
|
|
864
889
|
children: [
|
|
865
890
|
/* @__PURE__ */ n.jsx("span", { style: t.totalLabel, children: "Valor:" }),
|
|
866
|
-
/* @__PURE__ */ n.jsx("span", { style: t.totalValueHighlight, children: K(a.qtdPedido *
|
|
891
|
+
/* @__PURE__ */ n.jsx("span", { style: t.totalValueHighlight, children: K(a.qtdPedido * z()) })
|
|
867
892
|
]
|
|
868
893
|
}
|
|
869
894
|
),
|
|
870
|
-
|
|
895
|
+
w > 0 && /* @__PURE__ */ n.jsxs(
|
|
871
896
|
"div",
|
|
872
897
|
{
|
|
873
898
|
style: {
|
|
874
899
|
...t.totalItem,
|
|
875
|
-
...
|
|
900
|
+
...q ? { justifyContent: "space-between", width: "100%" } : {}
|
|
876
901
|
},
|
|
877
902
|
children: [
|
|
878
903
|
/* @__PURE__ */ n.jsx("span", { style: t.totalLabel, children: "Duração:" }),
|
|
879
904
|
/* @__PURE__ */ n.jsxs("span", { style: t.totalValue, children: [
|
|
880
|
-
|
|
905
|
+
w % 1 === 0 ? w.toString() : w.toFixed(1),
|
|
881
906
|
" ",
|
|
882
|
-
|
|
907
|
+
w === 1 ? "dia" : "dias"
|
|
883
908
|
] })
|
|
884
909
|
]
|
|
885
910
|
}
|
|
@@ -913,7 +938,7 @@ function Oe({
|
|
|
913
938
|
{
|
|
914
939
|
type: "button",
|
|
915
940
|
style: { ...t.button, ...t.cancelButton },
|
|
916
|
-
onClick:
|
|
941
|
+
onClick: k,
|
|
917
942
|
onMouseEnter: (e) => {
|
|
918
943
|
e.currentTarget.style.backgroundColor = t.cancelButtonHover.backgroundColor;
|
|
919
944
|
},
|