eatopia-ds 0.0.949 → 0.0.951
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 +448 -383
- package/build/index10.js.map +1 -1
- package/build/index11.js +28 -26
- package/build/index11.js.map +1 -1
- package/build/index18.js +25 -21
- package/build/index18.js.map +1 -1
- package/build/index46.js +1 -1
- package/build/index49.js +1 -1
- package/package.json +1 -1
package/build/index10.js
CHANGED
|
@@ -1,37 +1,115 @@
|
|
|
1
|
-
import { j as
|
|
2
|
-
import
|
|
3
|
-
import { StockLeadTime as
|
|
4
|
-
import { calculateConsumptionForecast as
|
|
5
|
-
import { AlertIcon as
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
return `${
|
|
9
|
-
},
|
|
10
|
-
const
|
|
11
|
-
return
|
|
12
|
-
},
|
|
13
|
-
const
|
|
14
|
-
return
|
|
15
|
-
},
|
|
16
|
-
const
|
|
17
|
-
return
|
|
18
|
-
},
|
|
19
|
-
(
|
|
20
|
-
)
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
1
|
+
import { j as t } from "./index24.js";
|
|
2
|
+
import Le, { useState as k, useEffect as Y, useMemo as D } from "react";
|
|
3
|
+
import { StockLeadTime as ze } from "./index18.js";
|
|
4
|
+
import { calculateConsumptionForecast as ye, calculateTotalConsumptionForRange as He } from "./index21.js";
|
|
5
|
+
import { AlertIcon as Ne } from "./index23.js";
|
|
6
|
+
const he = [1, 2, 3, 7, 10, 15, 30, 60, 90], v = (n) => {
|
|
7
|
+
const m = n.getFullYear(), q = String(n.getMonth() + 1).padStart(2, "0"), d = String(n.getDate()).padStart(2, "0");
|
|
8
|
+
return `${m}-${q}-${d}`;
|
|
9
|
+
}, I = (n) => {
|
|
10
|
+
const m = n.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
|
+
}, _e = () => {
|
|
13
|
+
const n = /* @__PURE__ */ new Date();
|
|
14
|
+
return n.setDate(n.getDate() + 1), n.setHours(0, 0, 0, 0), v(n);
|
|
15
|
+
}, A = () => {
|
|
16
|
+
const n = /* @__PURE__ */ new Date();
|
|
17
|
+
return n.setDate(n.getDate() + 1), n.setHours(0, 0, 0, 0), n;
|
|
18
|
+
}, P = (n) => n <= 0 ? 7 : he.reduce(
|
|
19
|
+
(m, q) => Math.abs(q - n) < Math.abs(m - n) ? q : m
|
|
20
|
+
), Ue = 42, ve = {
|
|
21
|
+
position: "relative",
|
|
22
|
+
height: `${Ue}px`,
|
|
23
|
+
border: "1.5px solid #e2e8f0",
|
|
24
|
+
borderRadius: "10px",
|
|
25
|
+
backgroundColor: "#f8fafc",
|
|
26
|
+
display: "flex",
|
|
27
|
+
alignItems: "center",
|
|
28
|
+
boxSizing: "border-box"
|
|
29
|
+
}, je = {
|
|
30
|
+
position: "absolute",
|
|
31
|
+
inset: 0,
|
|
32
|
+
width: "100%",
|
|
33
|
+
height: "100%",
|
|
34
|
+
border: "none",
|
|
35
|
+
background: "transparent",
|
|
36
|
+
outline: "none",
|
|
37
|
+
fontSize: "14px",
|
|
38
|
+
fontWeight: "500",
|
|
39
|
+
color: "#0f172a",
|
|
40
|
+
fontFamily: "Inter, sans-serif",
|
|
41
|
+
cursor: "pointer",
|
|
42
|
+
boxSizing: "border-box"
|
|
43
|
+
}, W = ({
|
|
44
|
+
children: n,
|
|
45
|
+
...m
|
|
46
|
+
}) => /* @__PURE__ */ t.jsxs("div", { style: ve, children: [
|
|
47
|
+
/* @__PURE__ */ t.jsx(
|
|
48
|
+
"select",
|
|
49
|
+
{
|
|
50
|
+
...m,
|
|
51
|
+
style: {
|
|
52
|
+
...je,
|
|
53
|
+
padding: "0 36px 0 14px",
|
|
54
|
+
appearance: "none",
|
|
55
|
+
WebkitAppearance: "none"
|
|
56
|
+
},
|
|
57
|
+
children: n
|
|
58
|
+
}
|
|
59
|
+
),
|
|
60
|
+
/* @__PURE__ */ t.jsx(
|
|
61
|
+
"span",
|
|
62
|
+
{
|
|
63
|
+
"aria-hidden": !0,
|
|
64
|
+
style: {
|
|
65
|
+
position: "absolute",
|
|
66
|
+
right: "12px",
|
|
67
|
+
top: "50%",
|
|
68
|
+
transform: "translateY(-50%)",
|
|
69
|
+
pointerEvents: "none",
|
|
70
|
+
color: "#64748b",
|
|
71
|
+
display: "flex",
|
|
72
|
+
alignItems: "center"
|
|
73
|
+
},
|
|
74
|
+
children: /* @__PURE__ */ t.jsx(
|
|
75
|
+
"svg",
|
|
76
|
+
{
|
|
77
|
+
width: "14",
|
|
78
|
+
height: "14",
|
|
79
|
+
viewBox: "0 0 24 24",
|
|
80
|
+
fill: "none",
|
|
81
|
+
stroke: "currentColor",
|
|
82
|
+
strokeWidth: "2.5",
|
|
83
|
+
strokeLinecap: "round",
|
|
84
|
+
strokeLinejoin: "round",
|
|
85
|
+
children: /* @__PURE__ */ t.jsx("polyline", { points: "6 9 12 15 18 9" })
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
}
|
|
89
|
+
)
|
|
90
|
+
] }), Ve = (n) => /* @__PURE__ */ t.jsx("div", { style: ve, children: /* @__PURE__ */ t.jsx(
|
|
91
|
+
"input",
|
|
92
|
+
{
|
|
93
|
+
type: "date",
|
|
94
|
+
...n,
|
|
95
|
+
style: { ...je, padding: "0 14px" }
|
|
96
|
+
}
|
|
97
|
+
) });
|
|
98
|
+
function Ze({
|
|
99
|
+
data: n,
|
|
100
|
+
onSubmit: m,
|
|
101
|
+
onCancel: q,
|
|
102
|
+
timelineData: d,
|
|
103
|
+
fornecedoresOptions: Ye,
|
|
104
|
+
marcasOptions: Ae,
|
|
105
|
+
embalagensOptions: Oe,
|
|
29
106
|
dailyConsumptionAverages: x,
|
|
30
|
-
showSuggestionBar:
|
|
31
|
-
showLegendTimeline:
|
|
107
|
+
showSuggestionBar: ke = !0,
|
|
108
|
+
showLegendTimeline: qe = !1,
|
|
109
|
+
initialQtdDays: j
|
|
32
110
|
}) {
|
|
33
|
-
var
|
|
34
|
-
|
|
111
|
+
var ee, te, ne, oe, re, se, ie, ae, le, ce, de, ue, fe, ge, pe, me;
|
|
112
|
+
Le.useEffect(() => {
|
|
35
113
|
const e = document.createElement("style");
|
|
36
114
|
return e.textContent = `
|
|
37
115
|
.order-form-quantity-input::-webkit-outer-spin-button,
|
|
@@ -46,61 +124,61 @@ function Oe({
|
|
|
46
124
|
document.head.removeChild(e);
|
|
47
125
|
};
|
|
48
126
|
}, []);
|
|
49
|
-
const [
|
|
50
|
-
|
|
127
|
+
const [C, Ce] = k(!1);
|
|
128
|
+
Y(() => {
|
|
51
129
|
const e = () => {
|
|
52
|
-
|
|
130
|
+
Ce(window.innerWidth <= 768);
|
|
53
131
|
};
|
|
54
132
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
55
133
|
}, []);
|
|
56
|
-
const
|
|
57
|
-
if (!(
|
|
58
|
-
const { restockSuggestionStart: e, restockSuggestionEnd: s } =
|
|
134
|
+
const O = () => {
|
|
135
|
+
if (!(d != null && d.timeline)) return 0;
|
|
136
|
+
const { restockSuggestionStart: e, restockSuggestionEnd: s } = d.timeline;
|
|
59
137
|
if (!e || !s) return 0;
|
|
60
|
-
const r = new Date(e), l = new Date(s).getTime() - r.getTime(),
|
|
61
|
-
return
|
|
62
|
-
},
|
|
138
|
+
const r = new Date(e), l = new Date(s).getTime() - r.getTime(), c = Math.ceil(l / (1e3 * 60 * 60 * 24));
|
|
139
|
+
return c > 0 ? c : 0;
|
|
140
|
+
}, we = () => {
|
|
63
141
|
var i;
|
|
64
|
-
const e =
|
|
65
|
-
if (!s) return
|
|
66
|
-
const r =
|
|
67
|
-
return isNaN(r.getTime()) || r < e ?
|
|
68
|
-
},
|
|
69
|
-
var i, l,
|
|
70
|
-
const e = (i =
|
|
142
|
+
const e = A(), s = (i = d == null ? void 0 : d.timeline) == null ? void 0 : i.stockEndDate;
|
|
143
|
+
if (!s) return v(e);
|
|
144
|
+
const r = I(s);
|
|
145
|
+
return isNaN(r.getTime()) || r < e ? v(e) : v(r);
|
|
146
|
+
}, Fe = () => P(O()), Te = () => j != null && j > 0 ? P(j) : Fe(), g = (() => {
|
|
147
|
+
var i, l, c;
|
|
148
|
+
const e = (i = n == null ? void 0 : n.fornecedores) == null ? void 0 : i[0];
|
|
71
149
|
if (!e) return null;
|
|
72
|
-
const s =
|
|
150
|
+
const s = O();
|
|
73
151
|
if (!x || s <= 0) {
|
|
74
|
-
const u = (l = e.marcas) == null ? void 0 : l[0], f = (
|
|
152
|
+
const u = (l = e.marcas) == null ? void 0 : l[0], f = (c = u == null ? void 0 : u.embalagens) == null ? void 0 : c[0];
|
|
75
153
|
return u && f ? {
|
|
76
154
|
marca: u.nome,
|
|
77
155
|
embalagem: f.label,
|
|
78
|
-
quantidade: (
|
|
156
|
+
quantidade: (n == null ? void 0 : n.qtdPedido) > 0 ? n.qtdPedido : 0,
|
|
79
157
|
valorUnitario: f.valor_unitario
|
|
80
158
|
} : null;
|
|
81
159
|
}
|
|
82
160
|
let r = null;
|
|
83
161
|
for (const u of e.marcas || [])
|
|
84
162
|
for (const f of u.embalagens || []) {
|
|
85
|
-
const
|
|
86
|
-
if (!(
|
|
87
|
-
for (let
|
|
88
|
-
const
|
|
163
|
+
const p = f.quantidade_fornecedor;
|
|
164
|
+
if (!(p <= 0))
|
|
165
|
+
for (let h = 1; h <= 100; h++) {
|
|
166
|
+
const xe = h * p, U = ye({
|
|
89
167
|
dailyAverages: x,
|
|
90
168
|
startDate: /* @__PURE__ */ new Date(),
|
|
91
|
-
totalQuantity:
|
|
169
|
+
totalQuantity: xe
|
|
92
170
|
});
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
95
|
-
(!r ||
|
|
171
|
+
if (U.totalDays >= s) {
|
|
172
|
+
const be = h * f.valor_unitario * p, V = U.totalDays - s;
|
|
173
|
+
(!r || V < r.daysDifference || V === r.daysDifference && be < r.totalValue) && (r = {
|
|
96
174
|
marca: u.nome,
|
|
97
175
|
embalagem: f.label,
|
|
98
|
-
quantidade:
|
|
176
|
+
quantidade: h,
|
|
99
177
|
valorUnitario: f.valor_unitario,
|
|
100
|
-
totalKg:
|
|
101
|
-
totalValue:
|
|
102
|
-
days:
|
|
103
|
-
daysDifference:
|
|
178
|
+
totalKg: xe,
|
|
179
|
+
totalValue: be,
|
|
180
|
+
days: U.totalDays,
|
|
181
|
+
daysDifference: V
|
|
104
182
|
});
|
|
105
183
|
}
|
|
106
184
|
}
|
|
@@ -111,181 +189,181 @@ function Oe({
|
|
|
111
189
|
quantidade: r.quantidade,
|
|
112
190
|
valorUnitario: r.valorUnitario
|
|
113
191
|
} : null;
|
|
114
|
-
})(),
|
|
115
|
-
var i, l,
|
|
192
|
+
})(), Se = () => {
|
|
193
|
+
var i, l, c;
|
|
116
194
|
if (g)
|
|
117
195
|
return g.valorUnitario;
|
|
118
|
-
const e = (i =
|
|
196
|
+
const e = (i = n == null ? void 0 : n.fornecedores) == null ? void 0 : i[0];
|
|
119
197
|
if (!e) return 0;
|
|
120
198
|
const s = (l = e.marcas) == null ? void 0 : l[0];
|
|
121
199
|
if (!s) return 0;
|
|
122
|
-
const r = (
|
|
200
|
+
const r = (c = s.embalagens) == null ? void 0 : c[0];
|
|
123
201
|
return (r == null ? void 0 : r.valor_unitario) ?? 0;
|
|
124
|
-
},
|
|
125
|
-
...
|
|
126
|
-
qtdPedido: (g == null ? void 0 : g.quantidade) ?? (
|
|
127
|
-
valorTotal: (
|
|
128
|
-
}), [
|
|
129
|
-
((
|
|
130
|
-
), [
|
|
131
|
-
(g == null ? void 0 : g.marca) ?? ((
|
|
132
|
-
), [
|
|
133
|
-
(g == null ? void 0 : g.embalagem) ?? ((
|
|
134
|
-
), [
|
|
135
|
-
|
|
136
|
-
), [
|
|
137
|
-
|
|
138
|
-
var
|
|
139
|
-
const e =
|
|
202
|
+
}, R = n.unidade_medida ?? "kg", Ie = ((ee = n.ultima_compra) == null ? void 0 : ee.unidade) ?? n.unidade_medida ?? "kg", [a, $] = k({
|
|
203
|
+
...n,
|
|
204
|
+
qtdPedido: (g == null ? void 0 : g.quantidade) ?? (n == null ? void 0 : n.qtdPedido) ?? 0,
|
|
205
|
+
valorTotal: (n == null ? void 0 : n.valorTotal) ?? ((g == null ? void 0 : g.quantidade) ?? (n == null ? void 0 : n.qtdPedido) ?? 0) * Se()
|
|
206
|
+
}), [Ee, Q] = k(
|
|
207
|
+
((ne = (te = n == null ? void 0 : n.fornecedores) == null ? void 0 : te[0]) == null ? void 0 : ne.nome) ?? ""
|
|
208
|
+
), [w, E] = k(
|
|
209
|
+
(g == null ? void 0 : g.marca) ?? ((ie = (se = (re = (oe = n == null ? void 0 : n.fornecedores) == null ? void 0 : oe[0]) == null ? void 0 : re.marcas) == null ? void 0 : se[0]) == null ? void 0 : ie.nome) ?? ""
|
|
210
|
+
), [T, B] = k(
|
|
211
|
+
(g == null ? void 0 : g.embalagem) ?? ((fe = (ue = (de = (ce = (le = (ae = n == null ? void 0 : n.fornecedores) == null ? void 0 : ae[0]) == null ? void 0 : le.marcas) == null ? void 0 : ce[0]) == null ? void 0 : de.embalagens) == null ? void 0 : ue[0]) == null ? void 0 : fe.label) ?? ""
|
|
212
|
+
), [L, G] = k(
|
|
213
|
+
we
|
|
214
|
+
), [z, K] = k(Te);
|
|
215
|
+
Y(() => {
|
|
216
|
+
var c, u, f;
|
|
217
|
+
const e = A(), s = (c = d == null ? void 0 : d.timeline) == null ? void 0 : c.stockEndDate;
|
|
140
218
|
let r;
|
|
141
219
|
if (s) {
|
|
142
|
-
const
|
|
143
|
-
r = isNaN(
|
|
220
|
+
const p = I(s);
|
|
221
|
+
r = isNaN(p.getTime()) || p < e ? v(e) : v(p);
|
|
144
222
|
} else
|
|
145
|
-
r =
|
|
223
|
+
r = v(e);
|
|
146
224
|
let i = 0;
|
|
147
|
-
if ((u =
|
|
148
|
-
const
|
|
149
|
-
!isNaN(
|
|
225
|
+
if ((u = d == null ? void 0 : d.timeline) != null && u.restockSuggestionStart && ((f = d == null ? void 0 : d.timeline) != null && f.restockSuggestionEnd)) {
|
|
226
|
+
const p = I(d.timeline.restockSuggestionStart), h = I(d.timeline.restockSuggestionEnd);
|
|
227
|
+
!isNaN(p.getTime()) && !isNaN(h.getTime()) && (i = Math.ceil((h.getTime() - p.getTime()) / (1e3 * 60 * 60 * 24)) || 0);
|
|
150
228
|
}
|
|
151
|
-
const l =
|
|
152
|
-
|
|
153
|
-
}, [
|
|
229
|
+
const l = j != null && j > 0 ? P(j) : P(i);
|
|
230
|
+
G(r), K(l);
|
|
231
|
+
}, [d, n, j]), Y(() => {
|
|
154
232
|
var s, r, i;
|
|
155
233
|
if (g) return;
|
|
156
|
-
const e = (s =
|
|
234
|
+
const e = (s = n == null ? void 0 : n.fornecedores) == null ? void 0 : s[0];
|
|
157
235
|
if (e) {
|
|
158
|
-
|
|
236
|
+
Q(e.nome);
|
|
159
237
|
const l = (r = e.marcas) == null ? void 0 : r[0];
|
|
160
238
|
if (l) {
|
|
161
|
-
|
|
162
|
-
const
|
|
163
|
-
|
|
239
|
+
E(l.nome);
|
|
240
|
+
const c = (i = l.embalagens) == null ? void 0 : i[0];
|
|
241
|
+
c && B(c.label);
|
|
164
242
|
}
|
|
165
243
|
}
|
|
166
|
-
}, [
|
|
167
|
-
const
|
|
168
|
-
var l,
|
|
244
|
+
}, [n, g]);
|
|
245
|
+
const M = D(() => {
|
|
246
|
+
var l, c, u;
|
|
169
247
|
const e = (l = a.fornecedores) == null ? void 0 : l[0];
|
|
170
248
|
if (!e) return 0;
|
|
171
|
-
const s = (
|
|
249
|
+
const s = (c = e.marcas) == null ? void 0 : c.find((f) => f.nome === w);
|
|
172
250
|
if (!s) return 0;
|
|
173
251
|
const r = (u = s.embalagens) == null ? void 0 : u.find(
|
|
174
|
-
(f) => f.label ===
|
|
252
|
+
(f) => f.label === T
|
|
175
253
|
), i = (r == null ? void 0 : r.quantidade_fornecedor) ?? 0;
|
|
176
254
|
return a.qtdPedido * i;
|
|
177
255
|
}, [
|
|
178
256
|
a.qtdPedido,
|
|
179
257
|
a.fornecedores,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
]),
|
|
258
|
+
w,
|
|
259
|
+
T
|
|
260
|
+
]), H = D(() => !x || M <= 0 ? null : ye({
|
|
183
261
|
dailyAverages: x,
|
|
184
262
|
startDate: /* @__PURE__ */ new Date(),
|
|
185
|
-
totalQuantity:
|
|
186
|
-
}), [x,
|
|
263
|
+
totalQuantity: M
|
|
264
|
+
}), [x, M]), F = (H == null ? void 0 : H.totalDays) ?? 0, b = D(() => {
|
|
187
265
|
if (!x) return 0;
|
|
188
|
-
const e =
|
|
266
|
+
const e = A(), s = I(L);
|
|
189
267
|
if (isNaN(s.getTime())) return 0;
|
|
190
268
|
const r = s < e ? e : s;
|
|
191
|
-
return
|
|
269
|
+
return He(
|
|
192
270
|
x,
|
|
193
271
|
r,
|
|
194
|
-
|
|
272
|
+
z
|
|
195
273
|
);
|
|
196
|
-
}, [x,
|
|
197
|
-
if (
|
|
274
|
+
}, [x, L, z]), J = D(() => {
|
|
275
|
+
if (d)
|
|
198
276
|
return {
|
|
199
|
-
...
|
|
277
|
+
...d,
|
|
200
278
|
timeline: {
|
|
201
|
-
...
|
|
279
|
+
...d.timeline,
|
|
202
280
|
dailyConsumptionAverage: x
|
|
203
281
|
}
|
|
204
282
|
};
|
|
205
|
-
}, [
|
|
206
|
-
if (!
|
|
283
|
+
}, [d, x]);
|
|
284
|
+
if (!n)
|
|
207
285
|
return null;
|
|
208
|
-
const
|
|
286
|
+
const X = () => {
|
|
209
287
|
var r, i, l;
|
|
210
288
|
const e = (r = a.fornecedores) == null ? void 0 : r[0];
|
|
211
289
|
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
|
-
},
|
|
290
|
+
const s = (i = e.marcas) == null ? void 0 : i.find((c) => c.nome === w);
|
|
291
|
+
return s ? ((l = s.embalagens) == null ? void 0 : l.find((c) => c.label === T)) ?? null : null;
|
|
292
|
+
}, N = () => {
|
|
215
293
|
var e;
|
|
216
|
-
return ((e =
|
|
217
|
-
},
|
|
294
|
+
return ((e = X()) == null ? void 0 : e.valor_unitario) ?? 0;
|
|
295
|
+
}, Z = (e) => {
|
|
218
296
|
const s = Number(e).toFixed(2), [r, i] = s.split(".");
|
|
219
297
|
return `R$ ${r.replace(
|
|
220
298
|
/\B(?=(\d{3})+(?!\d))/g,
|
|
221
299
|
"."
|
|
222
300
|
)},${i}`;
|
|
223
|
-
},
|
|
301
|
+
}, y = () => {
|
|
224
302
|
var e;
|
|
225
|
-
return ((e =
|
|
226
|
-
},
|
|
227
|
-
const s =
|
|
228
|
-
|
|
303
|
+
return ((e = X()) == null ? void 0 : e.quantidade_fornecedor) ?? 0;
|
|
304
|
+
}, S = (e) => {
|
|
305
|
+
const s = N(), r = e * s;
|
|
306
|
+
$((i) => ({
|
|
229
307
|
...i,
|
|
230
308
|
qtdPedido: e,
|
|
231
309
|
valorTotal: r
|
|
232
310
|
}));
|
|
233
|
-
},
|
|
234
|
-
var
|
|
311
|
+
}, _ = (e) => {
|
|
312
|
+
var c, u, f;
|
|
235
313
|
B(e);
|
|
236
|
-
const s = (
|
|
314
|
+
const s = (c = a.fornecedores) == null ? void 0 : c[0];
|
|
237
315
|
if (!s) return;
|
|
238
|
-
const r = (u = s.marcas) == null ? void 0 : u.find((
|
|
316
|
+
const r = (u = s.marcas) == null ? void 0 : u.find((p) => p.nome === w);
|
|
239
317
|
if (!r) return;
|
|
240
|
-
const i = (f = r.embalagens) == null ? void 0 : f.find((
|
|
318
|
+
const i = (f = r.embalagens) == null ? void 0 : f.find((p) => p.label === e);
|
|
241
319
|
if (!i) return;
|
|
242
320
|
const l = a.qtdPedido * (i.valor_unitario ?? 0);
|
|
243
|
-
|
|
244
|
-
...
|
|
321
|
+
$((p) => ({
|
|
322
|
+
...p,
|
|
245
323
|
valorTotal: l
|
|
246
324
|
}));
|
|
247
|
-
},
|
|
325
|
+
}, Be = () => {
|
|
248
326
|
var s;
|
|
249
327
|
const e = (s = a.fornecedores) == null ? void 0 : s[0];
|
|
250
328
|
return e ? e.marcas || [] : [];
|
|
251
|
-
},
|
|
329
|
+
}, Me = () => {
|
|
252
330
|
var r, i;
|
|
253
331
|
const e = (r = a.fornecedores) == null ? void 0 : r[0];
|
|
254
332
|
if (!e) return [];
|
|
255
|
-
const s = (i = e.marcas) == null ? void 0 : i.find((l) => l.nome ===
|
|
333
|
+
const s = (i = e.marcas) == null ? void 0 : i.find((l) => l.nome === w);
|
|
256
334
|
return s ? s.embalagens || [] : [];
|
|
257
|
-
},
|
|
258
|
-
var l,
|
|
259
|
-
|
|
335
|
+
}, De = (e) => {
|
|
336
|
+
var l, c;
|
|
337
|
+
E(e);
|
|
260
338
|
const s = (l = a.fornecedores) == null ? void 0 : l[0];
|
|
261
339
|
if (!s) return;
|
|
262
|
-
const r = (
|
|
340
|
+
const r = (c = s.marcas) == null ? void 0 : c.find((u) => u.nome === e);
|
|
263
341
|
if (!r || !r.embalagens || r.embalagens.length === 0) return;
|
|
264
342
|
const i = r.embalagens[0];
|
|
265
|
-
|
|
266
|
-
},
|
|
267
|
-
var l,
|
|
268
|
-
|
|
343
|
+
_(i.label);
|
|
344
|
+
}, Pe = (e) => {
|
|
345
|
+
var l, c, u;
|
|
346
|
+
Q(e);
|
|
269
347
|
const s = (l = a.fornecedores) == null ? void 0 : l.find(
|
|
270
348
|
(f) => f.nome === e
|
|
271
349
|
);
|
|
272
350
|
if (!s) return;
|
|
273
|
-
const r = (
|
|
351
|
+
const r = (c = s.marcas) == null ? void 0 : c[0];
|
|
274
352
|
if (!r) {
|
|
275
|
-
|
|
353
|
+
E(""), B("");
|
|
276
354
|
return;
|
|
277
355
|
}
|
|
278
|
-
|
|
356
|
+
E(r.nome);
|
|
279
357
|
const i = (u = r.embalagens) == null ? void 0 : u[0];
|
|
280
|
-
i ?
|
|
281
|
-
},
|
|
282
|
-
e.preventDefault(),
|
|
283
|
-
},
|
|
284
|
-
const e =
|
|
285
|
-
if (e <= 0 ||
|
|
286
|
-
const s = Math.ceil(
|
|
287
|
-
|
|
288
|
-
},
|
|
358
|
+
i ? _(i.label) : B("");
|
|
359
|
+
}, We = (e) => {
|
|
360
|
+
e.preventDefault(), m(a);
|
|
361
|
+
}, Re = () => {
|
|
362
|
+
const e = y();
|
|
363
|
+
if (e <= 0 || b <= 0) return;
|
|
364
|
+
const s = Math.ceil(b / e);
|
|
365
|
+
S(s);
|
|
366
|
+
}, o = {
|
|
289
367
|
container: {
|
|
290
368
|
display: "flex",
|
|
291
369
|
flexDirection: "column",
|
|
@@ -360,64 +438,6 @@ function Oe({
|
|
|
360
438
|
color: "#111827",
|
|
361
439
|
fontFamily: "Inter, sans-serif"
|
|
362
440
|
},
|
|
363
|
-
select: {
|
|
364
|
-
height: "36px",
|
|
365
|
-
padding: "6px 10px",
|
|
366
|
-
border: "1px solid #d1d5db",
|
|
367
|
-
borderRadius: "6px",
|
|
368
|
-
fontSize: "14px",
|
|
369
|
-
backgroundColor: "white",
|
|
370
|
-
color: "#374151",
|
|
371
|
-
cursor: "pointer",
|
|
372
|
-
outline: "none",
|
|
373
|
-
fontFamily: "Inter, sans-serif",
|
|
374
|
-
boxSizing: "border-box",
|
|
375
|
-
lineHeight: "1"
|
|
376
|
-
},
|
|
377
|
-
dateInput: {
|
|
378
|
-
height: "36px",
|
|
379
|
-
padding: "6px 10px",
|
|
380
|
-
border: "1px solid #d1d5db",
|
|
381
|
-
borderRadius: "6px",
|
|
382
|
-
fontSize: "14px",
|
|
383
|
-
backgroundColor: "white",
|
|
384
|
-
color: "#374151",
|
|
385
|
-
outline: "none",
|
|
386
|
-
fontFamily: "Inter, sans-serif",
|
|
387
|
-
boxSizing: "border-box",
|
|
388
|
-
lineHeight: "1"
|
|
389
|
-
},
|
|
390
|
-
rangeTotal: {
|
|
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"
|
|
420
|
-
},
|
|
421
441
|
// Estilos da seção de pedido (estilo calculadora)
|
|
422
442
|
orderSectionContainer: {
|
|
423
443
|
backgroundColor: "#f5f5f5",
|
|
@@ -552,10 +572,10 @@ function Oe({
|
|
|
552
572
|
backgroundColor: "#DC2626"
|
|
553
573
|
}
|
|
554
574
|
};
|
|
555
|
-
return /* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
/* @__PURE__ */
|
|
558
|
-
/* @__PURE__ */
|
|
575
|
+
return /* @__PURE__ */ t.jsxs("form", { onSubmit: We, style: o.container, children: [
|
|
576
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.header, children: [
|
|
577
|
+
/* @__PURE__ */ t.jsx("h2", { style: o.itemTitle, children: a.nome }),
|
|
578
|
+
/* @__PURE__ */ t.jsx("div", { style: o.valorUnitario, children: /* @__PURE__ */ t.jsx(
|
|
559
579
|
"div",
|
|
560
580
|
{
|
|
561
581
|
style: {
|
|
@@ -566,11 +586,11 @@ function Oe({
|
|
|
566
586
|
backgroundColor: "#FF4E00",
|
|
567
587
|
fontWeight: "600"
|
|
568
588
|
},
|
|
569
|
-
children:
|
|
589
|
+
children: Z(N())
|
|
570
590
|
}
|
|
571
591
|
) })
|
|
572
592
|
] }),
|
|
573
|
-
/* @__PURE__ */
|
|
593
|
+
/* @__PURE__ */ t.jsxs(
|
|
574
594
|
"div",
|
|
575
595
|
{
|
|
576
596
|
style: {
|
|
@@ -580,182 +600,227 @@ function Oe({
|
|
|
580
600
|
flexDirection: "column"
|
|
581
601
|
},
|
|
582
602
|
children: [
|
|
583
|
-
/* @__PURE__ */
|
|
584
|
-
/* @__PURE__ */
|
|
585
|
-
/* @__PURE__ */
|
|
603
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.infoRow, children: [
|
|
604
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.infoText, children: [
|
|
605
|
+
/* @__PURE__ */ t.jsx(Ne, { width: 20, height: 20 }),
|
|
586
606
|
"Última compra ",
|
|
587
|
-
(
|
|
607
|
+
(ge = a.ultima_compra) == null ? void 0 : ge.data
|
|
588
608
|
] }),
|
|
589
|
-
/* @__PURE__ */
|
|
590
|
-
Number(((
|
|
609
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.infoValue, children: [
|
|
610
|
+
Number(((pe = a.ultima_compra) == null ? void 0 : pe.quantidade) ?? 0).toFixed(2),
|
|
591
611
|
" ",
|
|
592
|
-
|
|
612
|
+
Ie.toUpperCase()
|
|
593
613
|
] })
|
|
594
614
|
] }),
|
|
595
|
-
/* @__PURE__ */
|
|
596
|
-
/* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */
|
|
598
|
-
/* @__PURE__ */
|
|
599
|
-
|
|
615
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.formGrid, children: [
|
|
616
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.formField, children: [
|
|
617
|
+
/* @__PURE__ */ t.jsx("label", { style: o.label, children: "Fornecedores:" }),
|
|
618
|
+
/* @__PURE__ */ t.jsx(
|
|
619
|
+
W,
|
|
600
620
|
{
|
|
601
|
-
value:
|
|
602
|
-
onChange: (e) =>
|
|
603
|
-
|
|
604
|
-
children: (fe = a.fornecedores) == null ? void 0 : fe.map((e) => /* @__PURE__ */ n.jsx("option", { value: e.nome, children: e.nome }, e.nome))
|
|
621
|
+
value: Ee,
|
|
622
|
+
onChange: (e) => Pe(e.target.value),
|
|
623
|
+
children: (me = a.fornecedores) == null ? void 0 : me.map((e) => /* @__PURE__ */ t.jsx("option", { value: e.nome, children: e.nome }, e.nome))
|
|
605
624
|
}
|
|
606
625
|
)
|
|
607
626
|
] }),
|
|
608
|
-
/* @__PURE__ */
|
|
609
|
-
/* @__PURE__ */
|
|
610
|
-
/* @__PURE__ */
|
|
611
|
-
|
|
627
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.formField, children: [
|
|
628
|
+
/* @__PURE__ */ t.jsx("label", { style: o.label, children: "Marcas:" }),
|
|
629
|
+
/* @__PURE__ */ t.jsx(
|
|
630
|
+
W,
|
|
612
631
|
{
|
|
613
|
-
value:
|
|
614
|
-
onChange: (e) =>
|
|
615
|
-
|
|
616
|
-
children: Te().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.nome, children: e.nome }, e.nome))
|
|
632
|
+
value: w,
|
|
633
|
+
onChange: (e) => De(e.target.value),
|
|
634
|
+
children: Be().map((e) => /* @__PURE__ */ t.jsx("option", { value: e.nome, children: e.nome }, e.nome))
|
|
617
635
|
}
|
|
618
636
|
)
|
|
619
637
|
] }),
|
|
620
|
-
/* @__PURE__ */
|
|
621
|
-
/* @__PURE__ */
|
|
622
|
-
/* @__PURE__ */
|
|
623
|
-
|
|
638
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.formField, children: [
|
|
639
|
+
/* @__PURE__ */ t.jsx("label", { style: o.label, children: "Embalagem:" }),
|
|
640
|
+
/* @__PURE__ */ t.jsx(
|
|
641
|
+
W,
|
|
624
642
|
{
|
|
625
|
-
value:
|
|
626
|
-
onChange: (e) =>
|
|
627
|
-
|
|
628
|
-
children: Fe().map((e) => /* @__PURE__ */ n.jsx("option", { value: e.label, children: e.label }, e.label))
|
|
643
|
+
value: T,
|
|
644
|
+
onChange: (e) => _(e.target.value),
|
|
645
|
+
children: Me().map((e) => /* @__PURE__ */ t.jsx("option", { value: e.label, children: e.label }, e.label))
|
|
629
646
|
}
|
|
630
647
|
)
|
|
631
648
|
] })
|
|
632
649
|
] }),
|
|
633
|
-
|
|
634
|
-
|
|
650
|
+
J && /* @__PURE__ */ t.jsx("div", { style: { marginTop: "8px", marginBottom: "8px" }, children: /* @__PURE__ */ t.jsx(
|
|
651
|
+
ze,
|
|
635
652
|
{
|
|
636
|
-
data:
|
|
653
|
+
data: J,
|
|
637
654
|
controls: !0,
|
|
638
|
-
showLegend:
|
|
655
|
+
showLegend: qe,
|
|
639
656
|
size: "sm",
|
|
640
|
-
showSuggestionBar:
|
|
641
|
-
unitLabel:
|
|
642
|
-
onAddSuggestedWeight: (e) =>
|
|
643
|
-
selectedQty:
|
|
644
|
-
selectedQtyDays:
|
|
657
|
+
showSuggestionBar: ke,
|
|
658
|
+
unitLabel: R,
|
|
659
|
+
onAddSuggestedWeight: (e) => S(e),
|
|
660
|
+
selectedQty: M,
|
|
661
|
+
selectedQtyDays: F
|
|
645
662
|
}
|
|
646
663
|
) }),
|
|
647
|
-
/* @__PURE__ */
|
|
664
|
+
/* @__PURE__ */ t.jsxs(
|
|
648
665
|
"div",
|
|
649
666
|
{
|
|
650
667
|
style: {
|
|
651
|
-
|
|
668
|
+
display: "grid",
|
|
669
|
+
gridTemplateColumns: C ? "1fr 1fr" : "1fr 1fr 1fr",
|
|
670
|
+
gap: "16px",
|
|
652
671
|
marginTop: "8px",
|
|
653
672
|
alignItems: "flex-start"
|
|
654
673
|
},
|
|
655
674
|
children: [
|
|
656
|
-
/* @__PURE__ */
|
|
657
|
-
/* @__PURE__ */
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
|
|
675
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.formField, children: [
|
|
676
|
+
/* @__PURE__ */ t.jsx("label", { style: o.label, children: "Data inicial" }),
|
|
677
|
+
/* @__PURE__ */ t.jsx(
|
|
678
|
+
Ve,
|
|
660
679
|
{
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
onChange: (e) => O(e.target.value),
|
|
665
|
-
style: t.dateInput,
|
|
680
|
+
value: L,
|
|
681
|
+
min: _e(),
|
|
682
|
+
onChange: (e) => G(e.target.value),
|
|
666
683
|
"aria-label": "Data inicial"
|
|
667
684
|
}
|
|
668
685
|
)
|
|
669
686
|
] }),
|
|
670
|
-
/* @__PURE__ */
|
|
671
|
-
/* @__PURE__ */
|
|
672
|
-
/* @__PURE__ */
|
|
673
|
-
|
|
687
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.formField, children: [
|
|
688
|
+
/* @__PURE__ */ t.jsx("label", { style: o.label, children: "Quantos dias?" }),
|
|
689
|
+
/* @__PURE__ */ t.jsx(
|
|
690
|
+
W,
|
|
674
691
|
{
|
|
675
|
-
value:
|
|
676
|
-
onChange: (e) =>
|
|
677
|
-
style: t.select,
|
|
692
|
+
value: z,
|
|
693
|
+
onChange: (e) => K(Number(e.target.value)),
|
|
678
694
|
"aria-label": "Quantos dias?",
|
|
679
|
-
children:
|
|
695
|
+
children: he.map((e) => /* @__PURE__ */ t.jsx("option", { value: e, children: e }, e))
|
|
680
696
|
}
|
|
681
697
|
)
|
|
682
698
|
] }),
|
|
683
|
-
/* @__PURE__ */
|
|
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
|
-
|
|
699
|
+
/* @__PURE__ */ t.jsxs(
|
|
700
|
+
"div",
|
|
701
|
+
{
|
|
702
|
+
style: {
|
|
703
|
+
...o.formField,
|
|
704
|
+
...C ? { gridColumn: "1 / -1" } : {}
|
|
705
|
+
},
|
|
706
|
+
children: [
|
|
707
|
+
/* @__PURE__ */ t.jsx("label", { style: o.label, children: "Consumo previsto" }),
|
|
708
|
+
/* @__PURE__ */ t.jsxs(
|
|
709
|
+
"div",
|
|
710
|
+
{
|
|
711
|
+
style: {
|
|
712
|
+
display: "flex",
|
|
713
|
+
alignItems: "center",
|
|
714
|
+
justifyContent: "space-between",
|
|
715
|
+
padding: "8px 14px",
|
|
716
|
+
backgroundColor: "#f8fafc",
|
|
717
|
+
border: "1.5px solid #e2e8f0",
|
|
718
|
+
borderRadius: "10px",
|
|
719
|
+
height: "42px"
|
|
720
|
+
},
|
|
721
|
+
children: [
|
|
722
|
+
/* @__PURE__ */ t.jsxs(
|
|
723
|
+
"span",
|
|
724
|
+
{
|
|
725
|
+
style: {
|
|
726
|
+
fontSize: "18px",
|
|
727
|
+
fontWeight: "700",
|
|
728
|
+
color: "#0f172a",
|
|
729
|
+
fontFamily: "Inter, sans-serif",
|
|
730
|
+
letterSpacing: "-0.3px"
|
|
731
|
+
},
|
|
732
|
+
children: [
|
|
733
|
+
b.toFixed(2),
|
|
734
|
+
" ",
|
|
735
|
+
/* @__PURE__ */ t.jsx(
|
|
736
|
+
"span",
|
|
737
|
+
{
|
|
738
|
+
style: {
|
|
739
|
+
fontSize: "13px",
|
|
740
|
+
fontWeight: "500",
|
|
741
|
+
color: "#64748b"
|
|
742
|
+
},
|
|
743
|
+
children: R
|
|
744
|
+
}
|
|
745
|
+
)
|
|
746
|
+
]
|
|
747
|
+
}
|
|
748
|
+
),
|
|
749
|
+
/* @__PURE__ */ t.jsx(
|
|
750
|
+
"button",
|
|
751
|
+
{
|
|
752
|
+
type: "button",
|
|
753
|
+
onClick: Re,
|
|
754
|
+
disabled: b <= 0 || y() <= 0,
|
|
755
|
+
style: {
|
|
756
|
+
display: "flex",
|
|
757
|
+
alignItems: "center",
|
|
758
|
+
justifyContent: "center",
|
|
759
|
+
width: "30px",
|
|
760
|
+
height: "30px",
|
|
761
|
+
minWidth: "30px",
|
|
762
|
+
borderRadius: "8px",
|
|
763
|
+
border: "none",
|
|
764
|
+
backgroundColor: b > 0 && y() > 0 ? "#FF4E00" : "#e5e7eb",
|
|
765
|
+
color: b > 0 && y() > 0 ? "white" : "#9ca3af",
|
|
766
|
+
fontSize: "16px",
|
|
767
|
+
cursor: b > 0 && y() > 0 ? "pointer" : "not-allowed",
|
|
768
|
+
opacity: b <= 0 || y() <= 0 ? 0.5 : 1,
|
|
769
|
+
transition: "all 0.2s",
|
|
770
|
+
fontFamily: "Inter, sans-serif"
|
|
771
|
+
},
|
|
772
|
+
onMouseEnter: (e) => {
|
|
773
|
+
b > 0 && y() > 0 && (e.currentTarget.style.backgroundColor = "#e04400");
|
|
774
|
+
},
|
|
775
|
+
onMouseLeave: (e) => {
|
|
776
|
+
b > 0 && y() > 0 && (e.currentTarget.style.backgroundColor = "#FF4E00");
|
|
777
|
+
},
|
|
778
|
+
"aria-label": "Definir quantidade pelo consumo previsto",
|
|
779
|
+
children: "↻"
|
|
780
|
+
}
|
|
781
|
+
)
|
|
782
|
+
]
|
|
783
|
+
}
|
|
784
|
+
)
|
|
785
|
+
]
|
|
786
|
+
}
|
|
787
|
+
)
|
|
723
788
|
]
|
|
724
789
|
}
|
|
725
790
|
),
|
|
726
|
-
/* @__PURE__ */
|
|
727
|
-
/* @__PURE__ */
|
|
728
|
-
/* @__PURE__ */
|
|
791
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.orderSectionContainer, children: [
|
|
792
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.quantityRow, children: [
|
|
793
|
+
/* @__PURE__ */ t.jsx(
|
|
729
794
|
"button",
|
|
730
795
|
{
|
|
731
796
|
type: "button",
|
|
732
797
|
style: {
|
|
733
|
-
...
|
|
734
|
-
...a.qtdPedido <= 0 ?
|
|
798
|
+
...o.quantityButton,
|
|
799
|
+
...a.qtdPedido <= 0 ? o.quantityButtonDisabled : {}
|
|
735
800
|
},
|
|
736
|
-
onClick: () =>
|
|
801
|
+
onClick: () => S(Math.max(0, a.qtdPedido - 1)),
|
|
737
802
|
onMouseEnter: (e) => {
|
|
738
|
-
a.qtdPedido > 0 && (e.currentTarget.style.background =
|
|
803
|
+
a.qtdPedido > 0 && (e.currentTarget.style.background = o.quantityButtonHover.background, e.currentTarget.style.transform = o.quantityButtonHover.transform);
|
|
739
804
|
},
|
|
740
805
|
onMouseLeave: (e) => {
|
|
741
|
-
e.currentTarget.style.background =
|
|
806
|
+
e.currentTarget.style.background = o.quantityButton.background, e.currentTarget.style.transform = "";
|
|
742
807
|
},
|
|
743
808
|
onMouseDown: (e) => {
|
|
744
|
-
a.qtdPedido > 0 && (e.currentTarget.style.background =
|
|
809
|
+
a.qtdPedido > 0 && (e.currentTarget.style.background = o.quantityButtonActive.background, e.currentTarget.style.transform = o.quantityButtonActive.transform);
|
|
745
810
|
},
|
|
746
811
|
onMouseUp: (e) => {
|
|
747
|
-
a.qtdPedido > 0 && (e.currentTarget.style.background =
|
|
812
|
+
a.qtdPedido > 0 && (e.currentTarget.style.background = o.quantityButtonHover.background, e.currentTarget.style.transform = o.quantityButtonHover.transform);
|
|
748
813
|
},
|
|
749
814
|
disabled: a.qtdPedido <= 0,
|
|
750
815
|
"aria-label": "Diminuir quantidade",
|
|
751
|
-
children: /* @__PURE__ */
|
|
816
|
+
children: /* @__PURE__ */ t.jsx(
|
|
752
817
|
"svg",
|
|
753
818
|
{
|
|
754
819
|
style: { width: "24px", height: "24px" },
|
|
755
820
|
fill: "none",
|
|
756
821
|
viewBox: "0 0 24 24",
|
|
757
822
|
stroke: "#000",
|
|
758
|
-
children: /* @__PURE__ */
|
|
823
|
+
children: /* @__PURE__ */ t.jsx(
|
|
759
824
|
"path",
|
|
760
825
|
{
|
|
761
826
|
strokeLinecap: "round",
|
|
@@ -768,50 +833,50 @@ function Oe({
|
|
|
768
833
|
)
|
|
769
834
|
}
|
|
770
835
|
),
|
|
771
|
-
/* @__PURE__ */
|
|
772
|
-
/* @__PURE__ */
|
|
836
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.quantityInputContainer, children: [
|
|
837
|
+
/* @__PURE__ */ t.jsx(
|
|
773
838
|
"input",
|
|
774
839
|
{
|
|
775
840
|
type: "number",
|
|
776
841
|
value: a.qtdPedido,
|
|
777
|
-
onChange: (e) =>
|
|
842
|
+
onChange: (e) => S(
|
|
778
843
|
Math.max(0, parseInt(e.target.value) || 0)
|
|
779
844
|
),
|
|
780
|
-
style:
|
|
845
|
+
style: o.quantityInput,
|
|
781
846
|
className: "order-form-quantity-input",
|
|
782
847
|
min: "0",
|
|
783
848
|
"aria-label": "Quantidade"
|
|
784
849
|
}
|
|
785
850
|
),
|
|
786
|
-
/* @__PURE__ */
|
|
851
|
+
/* @__PURE__ */ t.jsx("span", { style: o.quantityLabel, children: T || "unidades" })
|
|
787
852
|
] }),
|
|
788
|
-
/* @__PURE__ */
|
|
853
|
+
/* @__PURE__ */ t.jsx(
|
|
789
854
|
"button",
|
|
790
855
|
{
|
|
791
856
|
type: "button",
|
|
792
|
-
style:
|
|
793
|
-
onClick: () =>
|
|
857
|
+
style: o.quantityButton,
|
|
858
|
+
onClick: () => S(a.qtdPedido + 1),
|
|
794
859
|
onMouseEnter: (e) => {
|
|
795
|
-
e.currentTarget.style.background =
|
|
860
|
+
e.currentTarget.style.background = o.quantityButtonHover.background, e.currentTarget.style.transform = o.quantityButtonHover.transform;
|
|
796
861
|
},
|
|
797
862
|
onMouseLeave: (e) => {
|
|
798
|
-
e.currentTarget.style.background =
|
|
863
|
+
e.currentTarget.style.background = o.quantityButton.background, e.currentTarget.style.transform = "";
|
|
799
864
|
},
|
|
800
865
|
onMouseDown: (e) => {
|
|
801
|
-
e.currentTarget.style.background =
|
|
866
|
+
e.currentTarget.style.background = o.quantityButtonActive.background, e.currentTarget.style.transform = o.quantityButtonActive.transform;
|
|
802
867
|
},
|
|
803
868
|
onMouseUp: (e) => {
|
|
804
|
-
e.currentTarget.style.background =
|
|
869
|
+
e.currentTarget.style.background = o.quantityButtonHover.background, e.currentTarget.style.transform = o.quantityButtonHover.transform;
|
|
805
870
|
},
|
|
806
871
|
"aria-label": "Aumentar quantidade",
|
|
807
|
-
children: /* @__PURE__ */
|
|
872
|
+
children: /* @__PURE__ */ t.jsx(
|
|
808
873
|
"svg",
|
|
809
874
|
{
|
|
810
875
|
style: { width: "24px", height: "24px" },
|
|
811
876
|
fill: "none",
|
|
812
877
|
viewBox: "0 0 24 24",
|
|
813
878
|
stroke: "#FF4E00",
|
|
814
|
-
children: /* @__PURE__ */
|
|
879
|
+
children: /* @__PURE__ */ t.jsx(
|
|
815
880
|
"path",
|
|
816
881
|
{
|
|
817
882
|
strokeLinecap: "round",
|
|
@@ -825,61 +890,61 @@ function Oe({
|
|
|
825
890
|
}
|
|
826
891
|
)
|
|
827
892
|
] }),
|
|
828
|
-
/* @__PURE__ */
|
|
893
|
+
/* @__PURE__ */ t.jsxs(
|
|
829
894
|
"div",
|
|
830
895
|
{
|
|
831
896
|
style: {
|
|
832
|
-
...
|
|
833
|
-
...
|
|
897
|
+
...o.totalsRow,
|
|
898
|
+
...C ? {
|
|
834
899
|
flexDirection: "column",
|
|
835
900
|
gap: "12px",
|
|
836
901
|
alignItems: "stretch"
|
|
837
902
|
} : {}
|
|
838
903
|
},
|
|
839
904
|
children: [
|
|
840
|
-
/* @__PURE__ */
|
|
905
|
+
/* @__PURE__ */ t.jsxs(
|
|
841
906
|
"div",
|
|
842
907
|
{
|
|
843
908
|
style: {
|
|
844
|
-
...
|
|
845
|
-
...
|
|
909
|
+
...o.totalItem,
|
|
910
|
+
...C ? { justifyContent: "space-between", width: "100%" } : {}
|
|
846
911
|
},
|
|
847
912
|
children: [
|
|
848
|
-
/* @__PURE__ */
|
|
849
|
-
/* @__PURE__ */
|
|
850
|
-
(a.qtdPedido *
|
|
913
|
+
/* @__PURE__ */ t.jsx("span", { style: o.totalLabel, children: "Total:" }),
|
|
914
|
+
/* @__PURE__ */ t.jsxs("span", { style: o.totalValue, children: [
|
|
915
|
+
(a.qtdPedido * y()).toFixed(2),
|
|
851
916
|
" ",
|
|
852
|
-
|
|
917
|
+
R
|
|
853
918
|
] })
|
|
854
919
|
]
|
|
855
920
|
}
|
|
856
921
|
),
|
|
857
|
-
/* @__PURE__ */
|
|
922
|
+
/* @__PURE__ */ t.jsxs(
|
|
858
923
|
"div",
|
|
859
924
|
{
|
|
860
925
|
style: {
|
|
861
|
-
...
|
|
862
|
-
...
|
|
926
|
+
...o.totalItem,
|
|
927
|
+
...C ? { justifyContent: "space-between", width: "100%" } : {}
|
|
863
928
|
},
|
|
864
929
|
children: [
|
|
865
|
-
/* @__PURE__ */
|
|
866
|
-
/* @__PURE__ */
|
|
930
|
+
/* @__PURE__ */ t.jsx("span", { style: o.totalLabel, children: "Valor:" }),
|
|
931
|
+
/* @__PURE__ */ t.jsx("span", { style: o.totalValueHighlight, children: Z(a.qtdPedido * N()) })
|
|
867
932
|
]
|
|
868
933
|
}
|
|
869
934
|
),
|
|
870
|
-
|
|
935
|
+
F > 0 && /* @__PURE__ */ t.jsxs(
|
|
871
936
|
"div",
|
|
872
937
|
{
|
|
873
938
|
style: {
|
|
874
|
-
...
|
|
875
|
-
...
|
|
939
|
+
...o.totalItem,
|
|
940
|
+
...C ? { justifyContent: "space-between", width: "100%" } : {}
|
|
876
941
|
},
|
|
877
942
|
children: [
|
|
878
|
-
/* @__PURE__ */
|
|
879
|
-
/* @__PURE__ */
|
|
880
|
-
|
|
943
|
+
/* @__PURE__ */ t.jsx("span", { style: o.totalLabel, children: "Duração:" }),
|
|
944
|
+
/* @__PURE__ */ t.jsxs("span", { style: o.totalValue, children: [
|
|
945
|
+
F % 1 === 0 ? F.toString() : F.toFixed(1),
|
|
881
946
|
" ",
|
|
882
|
-
|
|
947
|
+
F === 1 ? "dia" : "dias"
|
|
883
948
|
] })
|
|
884
949
|
]
|
|
885
950
|
}
|
|
@@ -888,37 +953,37 @@ function Oe({
|
|
|
888
953
|
}
|
|
889
954
|
)
|
|
890
955
|
] }),
|
|
891
|
-
/* @__PURE__ */
|
|
892
|
-
/* @__PURE__ */
|
|
956
|
+
/* @__PURE__ */ t.jsxs("div", { style: o.buttons, children: [
|
|
957
|
+
/* @__PURE__ */ t.jsx(
|
|
893
958
|
"button",
|
|
894
959
|
{
|
|
895
960
|
type: "submit",
|
|
896
961
|
disabled: a.qtdPedido <= 0,
|
|
897
962
|
style: {
|
|
898
|
-
...
|
|
899
|
-
...
|
|
900
|
-
...a.qtdPedido <= 0 ?
|
|
963
|
+
...o.button,
|
|
964
|
+
...o.addButton,
|
|
965
|
+
...a.qtdPedido <= 0 ? o.addButtonDisabled : {}
|
|
901
966
|
},
|
|
902
967
|
onMouseEnter: (e) => {
|
|
903
|
-
a.qtdPedido > 0 && (e.currentTarget.style.backgroundColor =
|
|
968
|
+
a.qtdPedido > 0 && (e.currentTarget.style.backgroundColor = o.addButtonHover.backgroundColor);
|
|
904
969
|
},
|
|
905
970
|
onMouseLeave: (e) => {
|
|
906
|
-
a.qtdPedido > 0 && (e.currentTarget.style.backgroundColor =
|
|
971
|
+
a.qtdPedido > 0 && (e.currentTarget.style.backgroundColor = o.addButton.backgroundColor);
|
|
907
972
|
},
|
|
908
973
|
children: "Adicionar"
|
|
909
974
|
}
|
|
910
975
|
),
|
|
911
|
-
/* @__PURE__ */
|
|
976
|
+
/* @__PURE__ */ t.jsx(
|
|
912
977
|
"button",
|
|
913
978
|
{
|
|
914
979
|
type: "button",
|
|
915
|
-
style: { ...
|
|
916
|
-
onClick:
|
|
980
|
+
style: { ...o.button, ...o.cancelButton },
|
|
981
|
+
onClick: q,
|
|
917
982
|
onMouseEnter: (e) => {
|
|
918
|
-
e.currentTarget.style.backgroundColor =
|
|
983
|
+
e.currentTarget.style.backgroundColor = o.cancelButtonHover.backgroundColor;
|
|
919
984
|
},
|
|
920
985
|
onMouseLeave: (e) => {
|
|
921
|
-
e.currentTarget.style.backgroundColor =
|
|
986
|
+
e.currentTarget.style.backgroundColor = o.cancelButton.backgroundColor;
|
|
922
987
|
},
|
|
923
988
|
children: "Cancelar"
|
|
924
989
|
}
|
|
@@ -930,6 +995,6 @@ function Oe({
|
|
|
930
995
|
] });
|
|
931
996
|
}
|
|
932
997
|
export {
|
|
933
|
-
|
|
998
|
+
Ze as OrderForm
|
|
934
999
|
};
|
|
935
1000
|
//# sourceMappingURL=index10.js.map
|