eatopia-ds 0.0.951 → 0.0.952
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 +60 -58
- package/build/index10.js.map +1 -1
- package/build/index11.js +11 -10
- package/build/index11.js.map +1 -1
- package/build/index18.js +490 -485
- 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 +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 +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,25 +1,25 @@
|
|
|
1
1
|
import { j as t } from "./index24.js";
|
|
2
|
-
import
|
|
3
|
-
import { StockLeadTime as
|
|
4
|
-
import { calculateConsumptionForecast as ye, calculateTotalConsumptionForRange as
|
|
5
|
-
import { AlertIcon as
|
|
2
|
+
import ze, { useState as k, useEffect as Y, useMemo as D } from "react";
|
|
3
|
+
import { StockLeadTime as He } from "./index18.js";
|
|
4
|
+
import { calculateConsumptionForecast as ye, calculateTotalConsumptionForRange as Ne } from "./index21.js";
|
|
5
|
+
import { AlertIcon as _e } from "./index23.js";
|
|
6
6
|
const he = [1, 2, 3, 7, 10, 15, 30, 60, 90], v = (n) => {
|
|
7
7
|
const m = n.getFullYear(), q = String(n.getMonth() + 1).padStart(2, "0"), d = String(n.getDate()).padStart(2, "0");
|
|
8
8
|
return `${m}-${q}-${d}`;
|
|
9
9
|
}, I = (n) => {
|
|
10
10
|
const m = n.split("-").map(Number);
|
|
11
11
|
return m.length !== 3 || m.some(Number.isNaN) ? /* @__PURE__ */ new Date(NaN) : new Date(m[0], m[1] - 1, m[2]);
|
|
12
|
-
},
|
|
12
|
+
}, Ue = () => {
|
|
13
13
|
const n = /* @__PURE__ */ new Date();
|
|
14
14
|
return n.setDate(n.getDate() + 1), n.setHours(0, 0, 0, 0), v(n);
|
|
15
|
-
},
|
|
15
|
+
}, O = () => {
|
|
16
16
|
const n = /* @__PURE__ */ new Date();
|
|
17
17
|
return n.setDate(n.getDate() + 1), n.setHours(0, 0, 0, 0), n;
|
|
18
18
|
}, P = (n) => n <= 0 ? 7 : he.reduce(
|
|
19
19
|
(m, q) => Math.abs(q - n) < Math.abs(m - n) ? q : m
|
|
20
|
-
),
|
|
20
|
+
), Ve = 42, ve = {
|
|
21
21
|
position: "relative",
|
|
22
|
-
height: `${
|
|
22
|
+
height: `${Ve}px`,
|
|
23
23
|
border: "1.5px solid #e2e8f0",
|
|
24
24
|
borderRadius: "10px",
|
|
25
25
|
backgroundColor: "#f8fafc",
|
|
@@ -87,7 +87,7 @@ const he = [1, 2, 3, 7, 10, 15, 30, 60, 90], v = (n) => {
|
|
|
87
87
|
)
|
|
88
88
|
}
|
|
89
89
|
)
|
|
90
|
-
] }),
|
|
90
|
+
] }), Ye = (n) => /* @__PURE__ */ t.jsx("div", { style: ve, children: /* @__PURE__ */ t.jsx(
|
|
91
91
|
"input",
|
|
92
92
|
{
|
|
93
93
|
type: "date",
|
|
@@ -95,21 +95,22 @@ const he = [1, 2, 3, 7, 10, 15, 30, 60, 90], v = (n) => {
|
|
|
95
95
|
style: { ...je, padding: "0 14px" }
|
|
96
96
|
}
|
|
97
97
|
) });
|
|
98
|
-
function
|
|
98
|
+
function et({
|
|
99
99
|
data: n,
|
|
100
100
|
onSubmit: m,
|
|
101
101
|
onCancel: q,
|
|
102
102
|
timelineData: d,
|
|
103
|
-
fornecedoresOptions:
|
|
103
|
+
fornecedoresOptions: Oe,
|
|
104
104
|
marcasOptions: Ae,
|
|
105
|
-
embalagensOptions:
|
|
105
|
+
embalagensOptions: $e,
|
|
106
106
|
dailyConsumptionAverages: x,
|
|
107
107
|
showSuggestionBar: ke = !0,
|
|
108
108
|
showLegendTimeline: qe = !1,
|
|
109
|
-
initialQtdDays: j
|
|
109
|
+
initialQtdDays: j,
|
|
110
|
+
stockLeadTimeZoomOnly: Ce = !1
|
|
110
111
|
}) {
|
|
111
112
|
var ee, te, ne, oe, re, se, ie, ae, le, ce, de, ue, fe, ge, pe, me;
|
|
112
|
-
|
|
113
|
+
ze.useEffect(() => {
|
|
113
114
|
const e = document.createElement("style");
|
|
114
115
|
return e.textContent = `
|
|
115
116
|
.order-form-quantity-input::-webkit-outer-spin-button,
|
|
@@ -124,30 +125,30 @@ function Ze({
|
|
|
124
125
|
document.head.removeChild(e);
|
|
125
126
|
};
|
|
126
127
|
}, []);
|
|
127
|
-
const [C,
|
|
128
|
+
const [C, we] = k(!1);
|
|
128
129
|
Y(() => {
|
|
129
130
|
const e = () => {
|
|
130
|
-
|
|
131
|
+
we(window.innerWidth <= 768);
|
|
131
132
|
};
|
|
132
133
|
return e(), window.addEventListener("resize", e), () => window.removeEventListener("resize", e);
|
|
133
134
|
}, []);
|
|
134
|
-
const
|
|
135
|
+
const A = () => {
|
|
135
136
|
if (!(d != null && d.timeline)) return 0;
|
|
136
137
|
const { restockSuggestionStart: e, restockSuggestionEnd: s } = d.timeline;
|
|
137
138
|
if (!e || !s) return 0;
|
|
138
139
|
const r = new Date(e), l = new Date(s).getTime() - r.getTime(), c = Math.ceil(l / (1e3 * 60 * 60 * 24));
|
|
139
140
|
return c > 0 ? c : 0;
|
|
140
|
-
},
|
|
141
|
+
}, Fe = () => {
|
|
141
142
|
var i;
|
|
142
|
-
const e =
|
|
143
|
+
const e = O(), s = (i = d == null ? void 0 : d.timeline) == null ? void 0 : i.stockEndDate;
|
|
143
144
|
if (!s) return v(e);
|
|
144
145
|
const r = I(s);
|
|
145
146
|
return isNaN(r.getTime()) || r < e ? v(e) : v(r);
|
|
146
|
-
},
|
|
147
|
+
}, Te = () => P(A()), Se = () => j != null && j > 0 ? P(j) : Te(), g = (() => {
|
|
147
148
|
var i, l, c;
|
|
148
149
|
const e = (i = n == null ? void 0 : n.fornecedores) == null ? void 0 : i[0];
|
|
149
150
|
if (!e) return null;
|
|
150
|
-
const s =
|
|
151
|
+
const s = A();
|
|
151
152
|
if (!x || s <= 0) {
|
|
152
153
|
const u = (l = e.marcas) == null ? void 0 : l[0], f = (c = u == null ? void 0 : u.embalagens) == null ? void 0 : c[0];
|
|
153
154
|
return u && f ? {
|
|
@@ -189,7 +190,7 @@ function Ze({
|
|
|
189
190
|
quantidade: r.quantidade,
|
|
190
191
|
valorUnitario: r.valorUnitario
|
|
191
192
|
} : null;
|
|
192
|
-
})(),
|
|
193
|
+
})(), Ie = () => {
|
|
193
194
|
var i, l, c;
|
|
194
195
|
if (g)
|
|
195
196
|
return g.valorUnitario;
|
|
@@ -199,22 +200,22 @@ function Ze({
|
|
|
199
200
|
if (!s) return 0;
|
|
200
201
|
const r = (c = s.embalagens) == null ? void 0 : c[0];
|
|
201
202
|
return (r == null ? void 0 : r.valor_unitario) ?? 0;
|
|
202
|
-
}, R = n.unidade_medida ?? "kg",
|
|
203
|
+
}, R = n.unidade_medida ?? "kg", Ee = ((ee = n.ultima_compra) == null ? void 0 : ee.unidade) ?? n.unidade_medida ?? "kg", [a, $] = k({
|
|
203
204
|
...n,
|
|
204
205
|
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) *
|
|
206
|
-
}), [
|
|
206
|
+
valorTotal: (n == null ? void 0 : n.valorTotal) ?? ((g == null ? void 0 : g.quantidade) ?? (n == null ? void 0 : n.qtdPedido) ?? 0) * Ie()
|
|
207
|
+
}), [Be, Q] = k(
|
|
207
208
|
((ne = (te = n == null ? void 0 : n.fornecedores) == null ? void 0 : te[0]) == null ? void 0 : ne.nome) ?? ""
|
|
208
209
|
), [w, E] = k(
|
|
209
210
|
(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
211
|
), [T, B] = k(
|
|
211
212
|
(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
213
|
), [L, G] = k(
|
|
213
|
-
|
|
214
|
-
), [z, K] = k(
|
|
214
|
+
Fe
|
|
215
|
+
), [z, K] = k(Se);
|
|
215
216
|
Y(() => {
|
|
216
217
|
var c, u, f;
|
|
217
|
-
const e =
|
|
218
|
+
const e = O(), s = (c = d == null ? void 0 : d.timeline) == null ? void 0 : c.stockEndDate;
|
|
218
219
|
let r;
|
|
219
220
|
if (s) {
|
|
220
221
|
const p = I(s);
|
|
@@ -263,15 +264,15 @@ function Ze({
|
|
|
263
264
|
totalQuantity: M
|
|
264
265
|
}), [x, M]), F = (H == null ? void 0 : H.totalDays) ?? 0, b = D(() => {
|
|
265
266
|
if (!x) return 0;
|
|
266
|
-
const e =
|
|
267
|
+
const e = O(), s = I(L);
|
|
267
268
|
if (isNaN(s.getTime())) return 0;
|
|
268
269
|
const r = s < e ? e : s;
|
|
269
|
-
return
|
|
270
|
+
return Ne(
|
|
270
271
|
x,
|
|
271
272
|
r,
|
|
272
273
|
z
|
|
273
274
|
);
|
|
274
|
-
}, [x, L, z]),
|
|
275
|
+
}, [x, L, z]), Z = D(() => {
|
|
275
276
|
if (d)
|
|
276
277
|
return {
|
|
277
278
|
...d,
|
|
@@ -283,7 +284,7 @@ function Ze({
|
|
|
283
284
|
}, [d, x]);
|
|
284
285
|
if (!n)
|
|
285
286
|
return null;
|
|
286
|
-
const
|
|
287
|
+
const J = () => {
|
|
287
288
|
var r, i, l;
|
|
288
289
|
const e = (r = a.fornecedores) == null ? void 0 : r[0];
|
|
289
290
|
if (!e) return null;
|
|
@@ -291,8 +292,8 @@ function Ze({
|
|
|
291
292
|
return s ? ((l = s.embalagens) == null ? void 0 : l.find((c) => c.label === T)) ?? null : null;
|
|
292
293
|
}, N = () => {
|
|
293
294
|
var e;
|
|
294
|
-
return ((e =
|
|
295
|
-
},
|
|
295
|
+
return ((e = J()) == null ? void 0 : e.valor_unitario) ?? 0;
|
|
296
|
+
}, X = (e) => {
|
|
296
297
|
const s = Number(e).toFixed(2), [r, i] = s.split(".");
|
|
297
298
|
return `R$ ${r.replace(
|
|
298
299
|
/\B(?=(\d{3})+(?!\d))/g,
|
|
@@ -300,7 +301,7 @@ function Ze({
|
|
|
300
301
|
)},${i}`;
|
|
301
302
|
}, y = () => {
|
|
302
303
|
var e;
|
|
303
|
-
return ((e =
|
|
304
|
+
return ((e = J()) == null ? void 0 : e.quantidade_fornecedor) ?? 0;
|
|
304
305
|
}, S = (e) => {
|
|
305
306
|
const s = N(), r = e * s;
|
|
306
307
|
$((i) => ({
|
|
@@ -322,17 +323,17 @@ function Ze({
|
|
|
322
323
|
...p,
|
|
323
324
|
valorTotal: l
|
|
324
325
|
}));
|
|
325
|
-
},
|
|
326
|
+
}, Me = () => {
|
|
326
327
|
var s;
|
|
327
328
|
const e = (s = a.fornecedores) == null ? void 0 : s[0];
|
|
328
329
|
return e ? e.marcas || [] : [];
|
|
329
|
-
},
|
|
330
|
+
}, De = () => {
|
|
330
331
|
var r, i;
|
|
331
332
|
const e = (r = a.fornecedores) == null ? void 0 : r[0];
|
|
332
333
|
if (!e) return [];
|
|
333
334
|
const s = (i = e.marcas) == null ? void 0 : i.find((l) => l.nome === w);
|
|
334
335
|
return s ? s.embalagens || [] : [];
|
|
335
|
-
},
|
|
336
|
+
}, Pe = (e) => {
|
|
336
337
|
var l, c;
|
|
337
338
|
E(e);
|
|
338
339
|
const s = (l = a.fornecedores) == null ? void 0 : l[0];
|
|
@@ -341,7 +342,7 @@ function Ze({
|
|
|
341
342
|
if (!r || !r.embalagens || r.embalagens.length === 0) return;
|
|
342
343
|
const i = r.embalagens[0];
|
|
343
344
|
_(i.label);
|
|
344
|
-
},
|
|
345
|
+
}, We = (e) => {
|
|
345
346
|
var l, c, u;
|
|
346
347
|
Q(e);
|
|
347
348
|
const s = (l = a.fornecedores) == null ? void 0 : l.find(
|
|
@@ -356,9 +357,9 @@ function Ze({
|
|
|
356
357
|
E(r.nome);
|
|
357
358
|
const i = (u = r.embalagens) == null ? void 0 : u[0];
|
|
358
359
|
i ? _(i.label) : B("");
|
|
359
|
-
},
|
|
360
|
+
}, Re = (e) => {
|
|
360
361
|
e.preventDefault(), m(a);
|
|
361
|
-
},
|
|
362
|
+
}, Le = () => {
|
|
362
363
|
const e = y();
|
|
363
364
|
if (e <= 0 || b <= 0) return;
|
|
364
365
|
const s = Math.ceil(b / e);
|
|
@@ -572,7 +573,7 @@ function Ze({
|
|
|
572
573
|
backgroundColor: "#DC2626"
|
|
573
574
|
}
|
|
574
575
|
};
|
|
575
|
-
return /* @__PURE__ */ t.jsxs("form", { onSubmit:
|
|
576
|
+
return /* @__PURE__ */ t.jsxs("form", { onSubmit: Re, style: o.container, children: [
|
|
576
577
|
/* @__PURE__ */ t.jsxs("div", { style: o.header, children: [
|
|
577
578
|
/* @__PURE__ */ t.jsx("h2", { style: o.itemTitle, children: a.nome }),
|
|
578
579
|
/* @__PURE__ */ t.jsx("div", { style: o.valorUnitario, children: /* @__PURE__ */ t.jsx(
|
|
@@ -586,7 +587,7 @@ function Ze({
|
|
|
586
587
|
backgroundColor: "#FF4E00",
|
|
587
588
|
fontWeight: "600"
|
|
588
589
|
},
|
|
589
|
-
children:
|
|
590
|
+
children: X(N())
|
|
590
591
|
}
|
|
591
592
|
) })
|
|
592
593
|
] }),
|
|
@@ -602,14 +603,14 @@ function Ze({
|
|
|
602
603
|
children: [
|
|
603
604
|
/* @__PURE__ */ t.jsxs("div", { style: o.infoRow, children: [
|
|
604
605
|
/* @__PURE__ */ t.jsxs("div", { style: o.infoText, children: [
|
|
605
|
-
/* @__PURE__ */ t.jsx(
|
|
606
|
+
/* @__PURE__ */ t.jsx(_e, { width: 20, height: 20 }),
|
|
606
607
|
"Última compra ",
|
|
607
608
|
(ge = a.ultima_compra) == null ? void 0 : ge.data
|
|
608
609
|
] }),
|
|
609
610
|
/* @__PURE__ */ t.jsxs("div", { style: o.infoValue, children: [
|
|
610
611
|
Number(((pe = a.ultima_compra) == null ? void 0 : pe.quantidade) ?? 0).toFixed(2),
|
|
611
612
|
" ",
|
|
612
|
-
|
|
613
|
+
Ee.toUpperCase()
|
|
613
614
|
] })
|
|
614
615
|
] }),
|
|
615
616
|
/* @__PURE__ */ t.jsxs("div", { style: o.formGrid, children: [
|
|
@@ -618,8 +619,8 @@ function Ze({
|
|
|
618
619
|
/* @__PURE__ */ t.jsx(
|
|
619
620
|
W,
|
|
620
621
|
{
|
|
621
|
-
value:
|
|
622
|
-
onChange: (e) =>
|
|
622
|
+
value: Be,
|
|
623
|
+
onChange: (e) => We(e.target.value),
|
|
623
624
|
children: (me = a.fornecedores) == null ? void 0 : me.map((e) => /* @__PURE__ */ t.jsx("option", { value: e.nome, children: e.nome }, e.nome))
|
|
624
625
|
}
|
|
625
626
|
)
|
|
@@ -630,8 +631,8 @@ function Ze({
|
|
|
630
631
|
W,
|
|
631
632
|
{
|
|
632
633
|
value: w,
|
|
633
|
-
onChange: (e) =>
|
|
634
|
-
children:
|
|
634
|
+
onChange: (e) => Pe(e.target.value),
|
|
635
|
+
children: Me().map((e) => /* @__PURE__ */ t.jsx("option", { value: e.nome, children: e.nome }, e.nome))
|
|
635
636
|
}
|
|
636
637
|
)
|
|
637
638
|
] }),
|
|
@@ -642,16 +643,17 @@ function Ze({
|
|
|
642
643
|
{
|
|
643
644
|
value: T,
|
|
644
645
|
onChange: (e) => _(e.target.value),
|
|
645
|
-
children:
|
|
646
|
+
children: De().map((e) => /* @__PURE__ */ t.jsx("option", { value: e.label, children: e.label }, e.label))
|
|
646
647
|
}
|
|
647
648
|
)
|
|
648
649
|
] })
|
|
649
650
|
] }),
|
|
650
|
-
|
|
651
|
-
|
|
651
|
+
Z && /* @__PURE__ */ t.jsx("div", { style: { marginTop: "8px", marginBottom: "8px" }, children: /* @__PURE__ */ t.jsx(
|
|
652
|
+
He,
|
|
652
653
|
{
|
|
653
|
-
data:
|
|
654
|
+
data: Z,
|
|
654
655
|
controls: !0,
|
|
656
|
+
controlsZoomOnly: Ce,
|
|
655
657
|
showLegend: qe,
|
|
656
658
|
size: "sm",
|
|
657
659
|
showSuggestionBar: ke,
|
|
@@ -675,10 +677,10 @@ function Ze({
|
|
|
675
677
|
/* @__PURE__ */ t.jsxs("div", { style: o.formField, children: [
|
|
676
678
|
/* @__PURE__ */ t.jsx("label", { style: o.label, children: "Data inicial" }),
|
|
677
679
|
/* @__PURE__ */ t.jsx(
|
|
678
|
-
|
|
680
|
+
Ye,
|
|
679
681
|
{
|
|
680
682
|
value: L,
|
|
681
|
-
min:
|
|
683
|
+
min: Ue(),
|
|
682
684
|
onChange: (e) => G(e.target.value),
|
|
683
685
|
"aria-label": "Data inicial"
|
|
684
686
|
}
|
|
@@ -750,7 +752,7 @@ function Ze({
|
|
|
750
752
|
"button",
|
|
751
753
|
{
|
|
752
754
|
type: "button",
|
|
753
|
-
onClick:
|
|
755
|
+
onClick: Le,
|
|
754
756
|
disabled: b <= 0 || y() <= 0,
|
|
755
757
|
style: {
|
|
756
758
|
display: "flex",
|
|
@@ -928,7 +930,7 @@ function Ze({
|
|
|
928
930
|
},
|
|
929
931
|
children: [
|
|
930
932
|
/* @__PURE__ */ t.jsx("span", { style: o.totalLabel, children: "Valor:" }),
|
|
931
|
-
/* @__PURE__ */ t.jsx("span", { style: o.totalValueHighlight, children:
|
|
933
|
+
/* @__PURE__ */ t.jsx("span", { style: o.totalValueHighlight, children: X(a.qtdPedido * N()) })
|
|
932
934
|
]
|
|
933
935
|
}
|
|
934
936
|
),
|
|
@@ -995,6 +997,6 @@ function Ze({
|
|
|
995
997
|
] });
|
|
996
998
|
}
|
|
997
999
|
export {
|
|
998
|
-
|
|
1000
|
+
et as OrderForm
|
|
999
1001
|
};
|
|
1000
1002
|
//# sourceMappingURL=index10.js.map
|