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 +170 -167
- package/build/index10.js.map +1 -1
- package/build/index11.js +23 -21
- package/build/index11.js.map +1 -1
- package/build/index18.js +652 -569
- package/build/index18.js.map +1 -1
- package/package.json +1 -1
package/build/index10.js
CHANGED
|
@@ -1,36 +1,37 @@
|
|
|
1
1
|
import { j as n } from "./index24.js";
|
|
2
|
-
import
|
|
3
|
-
import { StockLeadTime as
|
|
4
|
-
import { calculateConsumptionForecast as
|
|
5
|
-
import { AlertIcon as
|
|
6
|
-
const
|
|
7
|
-
const p = o.getFullYear(),
|
|
8
|
-
return `${p}-${
|
|
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
|
-
},
|
|
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
|
-
},
|
|
15
|
+
}, _ = () => {
|
|
16
16
|
const o = /* @__PURE__ */ new Date();
|
|
17
17
|
return o.setDate(o.getDate() + 1), o.setHours(0, 0, 0, 0), o;
|
|
18
|
-
},
|
|
19
|
-
(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
|
|
21
|
+
function Oe({
|
|
22
22
|
data: o,
|
|
23
23
|
onSubmit: p,
|
|
24
|
-
onCancel:
|
|
24
|
+
onCancel: j,
|
|
25
25
|
timelineData: c,
|
|
26
|
-
fornecedoresOptions:
|
|
27
|
-
marcasOptions:
|
|
28
|
-
embalagensOptions:
|
|
26
|
+
fornecedoresOptions: Le,
|
|
27
|
+
marcasOptions: ze,
|
|
28
|
+
embalagensOptions: He,
|
|
29
29
|
dailyConsumptionAverages: x,
|
|
30
|
-
showSuggestionBar:
|
|
30
|
+
showSuggestionBar: ye = !0,
|
|
31
|
+
showLegendTimeline: he = !1
|
|
31
32
|
}) {
|
|
32
|
-
var
|
|
33
|
-
|
|
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,
|
|
49
|
-
|
|
49
|
+
const [I, ve] = v(!1);
|
|
50
|
+
U(() => {
|
|
50
51
|
const e = () => {
|
|
51
|
-
|
|
52
|
+
ve(window.innerWidth <= 768);
|
|
52
53
|
};
|
|
53
54
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
54
55
|
}, []);
|
|
55
|
-
const
|
|
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
|
-
},
|
|
62
|
-
var
|
|
63
|
-
const e =
|
|
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
|
-
},
|
|
68
|
-
var
|
|
69
|
-
const e = (
|
|
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 =
|
|
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
|
|
88
|
+
const ge = b * m, H = pe({
|
|
88
89
|
dailyAverages: x,
|
|
89
90
|
startDate: /* @__PURE__ */ new Date(),
|
|
90
|
-
totalQuantity:
|
|
91
|
+
totalQuantity: ge
|
|
91
92
|
});
|
|
92
93
|
if (H.totalDays >= s) {
|
|
93
|
-
const
|
|
94
|
-
(!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:
|
|
100
|
-
totalValue:
|
|
100
|
+
totalKg: ge,
|
|
101
|
+
totalValue: me,
|
|
101
102
|
days: H.totalDays,
|
|
102
|
-
daysDifference:
|
|
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
|
-
})(),
|
|
114
|
-
var
|
|
114
|
+
})(), qe = () => {
|
|
115
|
+
var i, l, d;
|
|
115
116
|
if (g)
|
|
116
117
|
return g.valorUnitario;
|
|
117
|
-
const e = (
|
|
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
|
-
}, [
|
|
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) *
|
|
127
|
-
}), [
|
|
128
|
-
((
|
|
129
|
-
), [
|
|
130
|
-
(g == null ? void 0 : g.marca) ?? ((
|
|
131
|
-
), [w, B] =
|
|
132
|
-
(g == null ? void 0 : g.embalagem) ?? ((
|
|
133
|
-
), [
|
|
134
|
-
|
|
135
|
-
), [
|
|
136
|
-
|
|
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 =
|
|
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
|
|
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()) && (
|
|
149
|
+
!isNaN(m.getTime()) && !isNaN(b.getTime()) && (i = Math.ceil((b.getTime() - m.getTime()) / (1e3 * 60 * 60 * 24)) || 0);
|
|
149
150
|
}
|
|
150
|
-
const l =
|
|
151
|
-
|
|
152
|
-
}, [c, o]),
|
|
153
|
-
var s, r,
|
|
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
|
-
|
|
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 = (
|
|
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 =
|
|
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 ===
|
|
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
|
-
),
|
|
175
|
-
return
|
|
175
|
+
), i = (r == null ? void 0 : r.quantidade_fornecedor) ?? 0;
|
|
176
|
+
return a.qtdPedido * i;
|
|
176
177
|
}, [
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
a.qtdPedido,
|
|
179
|
+
a.fornecedores,
|
|
180
|
+
k,
|
|
180
181
|
w
|
|
181
|
-
]),
|
|
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]),
|
|
186
|
+
}), [x, D]), q = (R == null ? void 0 : R.totalDays) ?? 0, h = M(() => {
|
|
186
187
|
if (!x) return 0;
|
|
187
|
-
const 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
|
|
191
|
+
return Pe(
|
|
191
192
|
x,
|
|
192
193
|
r,
|
|
193
|
-
|
|
194
|
+
W
|
|
194
195
|
);
|
|
195
|
-
}, [x,
|
|
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,
|
|
209
|
-
const e = (r =
|
|
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 = (
|
|
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
|
-
},
|
|
214
|
+
}, L = () => {
|
|
214
215
|
var e;
|
|
215
|
-
return ((e =
|
|
216
|
-
},
|
|
217
|
-
const s = Number(e).toFixed(2), [r,
|
|
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
|
-
)},${
|
|
222
|
-
},
|
|
222
|
+
)},${i}`;
|
|
223
|
+
}, C = () => {
|
|
223
224
|
var e;
|
|
224
|
-
return ((e =
|
|
225
|
+
return ((e = G()) == null ? void 0 : e.quantidade_fornecedor) ?? 0;
|
|
225
226
|
}, T = (e) => {
|
|
226
|
-
const s =
|
|
227
|
-
|
|
228
|
-
...
|
|
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 =
|
|
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 ===
|
|
238
|
+
const r = (u = s.marcas) == null ? void 0 : u.find((m) => m.nome === k);
|
|
238
239
|
if (!r) return;
|
|
239
|
-
const
|
|
240
|
-
if (!
|
|
241
|
-
const l =
|
|
242
|
-
|
|
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
|
-
},
|
|
247
|
+
}, Te = () => {
|
|
247
248
|
var s;
|
|
248
|
-
const e = (s =
|
|
249
|
+
const e = (s = a.fornecedores) == null ? void 0 : s[0];
|
|
249
250
|
return e ? e.marcas || [] : [];
|
|
250
|
-
},
|
|
251
|
-
var r,
|
|
252
|
-
const e = (r =
|
|
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 = (
|
|
255
|
+
const s = (i = e.marcas) == null ? void 0 : i.find((l) => l.nome === k);
|
|
255
256
|
return s ? s.embalagens || [] : [];
|
|
256
|
-
},
|
|
257
|
+
}, Ie = (e) => {
|
|
257
258
|
var l, d;
|
|
258
259
|
S(e);
|
|
259
|
-
const s = (l =
|
|
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
|
|
264
|
-
z(
|
|
265
|
-
},
|
|
264
|
+
const i = r.embalagens[0];
|
|
265
|
+
z(i.label);
|
|
266
|
+
}, Se = (e) => {
|
|
266
267
|
var l, d, u;
|
|
267
|
-
|
|
268
|
-
const s = (l =
|
|
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
|
|
279
|
-
|
|
280
|
-
},
|
|
281
|
-
e.preventDefault(), p(
|
|
282
|
-
},
|
|
283
|
-
const e =
|
|
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:
|
|
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:
|
|
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:
|
|
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(
|
|
585
|
+
/* @__PURE__ */ n.jsx(We, { width: 20, height: 20 }),
|
|
585
586
|
"Última compra ",
|
|
586
|
-
(
|
|
587
|
+
(ce = a.ultima_compra) == null ? void 0 : ce.data
|
|
587
588
|
] }),
|
|
588
589
|
/* @__PURE__ */ n.jsxs("div", { style: t.infoValue, children: [
|
|
589
|
-
Number(((
|
|
590
|
-
"
|
|
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:
|
|
600
|
-
onChange: (e) =>
|
|
601
|
+
value: we,
|
|
602
|
+
onChange: (e) => Se(e.target.value),
|
|
601
603
|
style: t.select,
|
|
602
|
-
children: (
|
|
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:
|
|
612
|
-
onChange: (e) =>
|
|
613
|
+
value: k,
|
|
614
|
+
onChange: (e) => Ie(e.target.value),
|
|
613
615
|
style: t.select,
|
|
614
|
-
children:
|
|
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:
|
|
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
|
-
|
|
632
|
-
|
|
633
|
+
$ && /* @__PURE__ */ n.jsx("div", { style: { marginTop: "8px", marginBottom: "8px" }, children: /* @__PURE__ */ n.jsx(
|
|
634
|
+
Ee,
|
|
633
635
|
{
|
|
634
|
-
data:
|
|
636
|
+
data: $,
|
|
635
637
|
controls: !0,
|
|
636
|
-
showLegend:
|
|
638
|
+
showLegend: he,
|
|
637
639
|
size: "sm",
|
|
638
|
-
showSuggestionBar:
|
|
640
|
+
showSuggestionBar: ye,
|
|
641
|
+
unitLabel: E,
|
|
639
642
|
onAddSuggestedWeight: (e) => T(e),
|
|
640
643
|
selectedQty: D,
|
|
641
|
-
selectedQtyDays:
|
|
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:
|
|
660
|
-
min:
|
|
661
|
-
onChange: (e) =>
|
|
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:
|
|
673
|
-
onChange: (e) =>
|
|
675
|
+
value: W,
|
|
676
|
+
onChange: (e) => A(Number(e.target.value)),
|
|
674
677
|
style: t.select,
|
|
675
678
|
"aria-label": "Quantos dias?",
|
|
676
|
-
children:
|
|
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
|
-
"
|
|
696
|
+
" ",
|
|
697
|
+
E
|
|
694
698
|
] }),
|
|
695
699
|
/* @__PURE__ */ n.jsx(
|
|
696
700
|
"button",
|
|
697
701
|
{
|
|
698
702
|
type: "button",
|
|
699
|
-
onClick:
|
|
700
|
-
disabled: h <= 0 ||
|
|
703
|
+
onClick: De,
|
|
704
|
+
disabled: h <= 0 || C() <= 0,
|
|
701
705
|
style: {
|
|
702
706
|
...t.addConsumoButton,
|
|
703
|
-
...h <= 0 ||
|
|
707
|
+
...h <= 0 || C() <= 0 ? t.addConsumoButtonDisabled : {}
|
|
704
708
|
},
|
|
705
709
|
onMouseEnter: (e) => {
|
|
706
|
-
h > 0 &&
|
|
710
|
+
h > 0 && C() > 0 && (e.currentTarget.style.backgroundColor = "#d1d5db");
|
|
707
711
|
},
|
|
708
712
|
onMouseLeave: (e) => {
|
|
709
|
-
h > 0 &&
|
|
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
|
-
...
|
|
734
|
+
...a.qtdPedido <= 0 ? t.quantityButtonDisabled : {}
|
|
731
735
|
},
|
|
732
|
-
onClick: () => T(Math.max(0,
|
|
736
|
+
onClick: () => T(Math.max(0, a.qtdPedido - 1)),
|
|
733
737
|
onMouseEnter: (e) => {
|
|
734
|
-
|
|
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
|
-
|
|
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
|
-
|
|
747
|
+
a.qtdPedido > 0 && (e.currentTarget.style.background = t.quantityButtonHover.background, e.currentTarget.style.transform = t.quantityButtonHover.transform);
|
|
744
748
|
},
|
|
745
|
-
disabled:
|
|
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:
|
|
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(
|
|
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
|
-
(
|
|
847
|
-
"
|
|
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:
|
|
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
|
-
|
|
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
|
-
|
|
880
|
+
q % 1 === 0 ? q.toString() : q.toFixed(1),
|
|
878
881
|
" ",
|
|
879
|
-
|
|
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:
|
|
896
|
+
disabled: a.qtdPedido <= 0,
|
|
894
897
|
style: {
|
|
895
898
|
...t.button,
|
|
896
899
|
...t.addButton,
|
|
897
|
-
...
|
|
900
|
+
...a.qtdPedido <= 0 ? t.addButtonDisabled : {}
|
|
898
901
|
},
|
|
899
902
|
onMouseEnter: (e) => {
|
|
900
|
-
|
|
903
|
+
a.qtdPedido > 0 && (e.currentTarget.style.backgroundColor = t.addButtonHover.backgroundColor);
|
|
901
904
|
},
|
|
902
905
|
onMouseLeave: (e) => {
|
|
903
|
-
|
|
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:
|
|
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
|
-
|
|
933
|
+
Oe as OrderForm
|
|
931
934
|
};
|
|
932
935
|
//# sourceMappingURL=index10.js.map
|