@zauru-sdk/hooks 2.0.3 → 2.0.5
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/dist/esm/receptions.js +89 -34
- package/dist/receptions.d.ts +9 -22
- package/package.json +5 -5
package/dist/esm/receptions.js
CHANGED
|
@@ -81,7 +81,7 @@ exports.useGetPurchaseOrderGeneralInfo = useGetPurchaseOrderGeneralInfo;
|
|
|
81
81
|
const useGetPesadas = (purchaseOrder, stocks_only_integer = false) => {
|
|
82
82
|
const [pesadas, footerPesadas, headersPesadas] = (0, react_2.useMemo)(() => {
|
|
83
83
|
if (!purchaseOrder)
|
|
84
|
-
return [[],
|
|
84
|
+
return [[], [], []];
|
|
85
85
|
const tempPesadas = [
|
|
86
86
|
...purchaseOrder.purchase_order_details?.map((x, index) => {
|
|
87
87
|
const parsedReference = x.reference?.split(","); //eg: "reference": "698,25,0", // peso neto, canastas, descuento
|
|
@@ -119,18 +119,42 @@ const useGetPesadas = (purchaseOrder, stocks_only_integer = false) => {
|
|
|
119
119
|
};
|
|
120
120
|
}),
|
|
121
121
|
];
|
|
122
|
-
const totales =
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
122
|
+
const totales = [
|
|
123
|
+
//#
|
|
124
|
+
{
|
|
125
|
+
contennt: "",
|
|
126
|
+
},
|
|
127
|
+
//baskets
|
|
128
|
+
{
|
|
129
|
+
contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
130
|
+
},
|
|
131
|
+
//totalWeight
|
|
132
|
+
{
|
|
133
|
+
contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
134
|
+
},
|
|
135
|
+
//discount
|
|
136
|
+
{
|
|
137
|
+
contennt: "-",
|
|
138
|
+
},
|
|
139
|
+
//netWeight
|
|
140
|
+
{
|
|
141
|
+
contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
142
|
+
},
|
|
143
|
+
//weightByBasket
|
|
144
|
+
{
|
|
145
|
+
contennt: "-",
|
|
146
|
+
},
|
|
147
|
+
//lbDiscounted
|
|
148
|
+
{
|
|
149
|
+
contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.lbDiscounted)).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
150
|
+
},
|
|
151
|
+
//probableUtilization
|
|
152
|
+
{
|
|
153
|
+
contennt: (0, common_1.toFixedIfNeeded)(tempPesadas
|
|
154
|
+
?.map((x) => Number(x.probableUtilization))
|
|
155
|
+
.reduce(common_1.reduceAdd, 0)),
|
|
156
|
+
},
|
|
157
|
+
];
|
|
134
158
|
const headers = [
|
|
135
159
|
{ label: "#", name: "id", type: "label", width: 5 },
|
|
136
160
|
{ label: "Canastas", name: "baskets", type: "label" },
|
|
@@ -209,13 +233,28 @@ const getPesadasByForm = (formInput, stocks_only_integer = false) => {
|
|
|
209
233
|
});
|
|
210
234
|
index++;
|
|
211
235
|
}
|
|
212
|
-
const totales =
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
236
|
+
const totales = [
|
|
237
|
+
//#
|
|
238
|
+
{
|
|
239
|
+
contennt: "",
|
|
240
|
+
},
|
|
241
|
+
//baskets
|
|
242
|
+
{
|
|
243
|
+
contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
244
|
+
},
|
|
245
|
+
//totalWeight
|
|
246
|
+
{
|
|
247
|
+
contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
248
|
+
},
|
|
249
|
+
//netWeight
|
|
250
|
+
{
|
|
251
|
+
contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
252
|
+
},
|
|
253
|
+
//weightByBasket
|
|
254
|
+
{
|
|
255
|
+
contennt: "-",
|
|
256
|
+
},
|
|
257
|
+
];
|
|
219
258
|
const headers = [
|
|
220
259
|
{ label: "#", name: "id", type: "label", width: 5 },
|
|
221
260
|
{ label: "Canastas", name: "baskets", type: "label" },
|
|
@@ -241,7 +280,7 @@ exports.getPesadasByForm = getPesadasByForm;
|
|
|
241
280
|
const useGetBasketDetails = (purchaseOrder) => {
|
|
242
281
|
const [basketsJoined, footerBasketsJoined, headersBasketsJoined] = (0, react_2.useMemo)(() => {
|
|
243
282
|
if (!purchaseOrder)
|
|
244
|
-
return [[],
|
|
283
|
+
return [[], [], []];
|
|
245
284
|
const bsq = purchaseOrder?.lots.length > 0
|
|
246
285
|
? purchaseOrder?.lots
|
|
247
286
|
?.map((x) => {
|
|
@@ -281,12 +320,20 @@ const useGetBasketDetails = (purchaseOrder) => {
|
|
|
281
320
|
});
|
|
282
321
|
}
|
|
283
322
|
}
|
|
284
|
-
const totales =
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
323
|
+
const totales = [
|
|
324
|
+
//color
|
|
325
|
+
{
|
|
326
|
+
contennt: "",
|
|
327
|
+
},
|
|
328
|
+
//total
|
|
329
|
+
{
|
|
330
|
+
contennt: (0, common_1.toFixedIfNeeded)(joinedBaskets?.map((x) => x.total).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
331
|
+
},
|
|
332
|
+
//cc
|
|
333
|
+
{
|
|
334
|
+
contennt: joinedBaskets?.map((x) => x.cc).reduce(common_1.reduceAdd, 0),
|
|
335
|
+
},
|
|
336
|
+
];
|
|
290
337
|
const headers = [
|
|
291
338
|
{ label: "Color", name: "color", type: "label" },
|
|
292
339
|
{ label: "Canastas recibidas", name: "total", type: "label" },
|
|
@@ -308,7 +355,7 @@ const getBasketDetailsByForm = (formInput) => {
|
|
|
308
355
|
if (!formInput)
|
|
309
356
|
return {
|
|
310
357
|
basketDetailsArray,
|
|
311
|
-
totales:
|
|
358
|
+
totales: [],
|
|
312
359
|
headers: [],
|
|
313
360
|
};
|
|
314
361
|
// Regex para identificar los campos relevantes
|
|
@@ -349,12 +396,20 @@ const getBasketDetailsByForm = (formInput) => {
|
|
|
349
396
|
}
|
|
350
397
|
}
|
|
351
398
|
}
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
399
|
+
const totales = [
|
|
400
|
+
//color
|
|
401
|
+
{
|
|
402
|
+
contennt: "",
|
|
403
|
+
},
|
|
404
|
+
//total
|
|
405
|
+
{
|
|
406
|
+
contennt: (0, common_1.toFixedIfNeeded)(basketDetailsArray.map((x) => x.total).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
407
|
+
},
|
|
408
|
+
//cc
|
|
409
|
+
{
|
|
410
|
+
contennt: basketDetailsArray.map((x) => x.cc).reduce(common_1.reduceAdd, 0),
|
|
411
|
+
},
|
|
412
|
+
];
|
|
358
413
|
// Definir los encabezados de la tabla
|
|
359
414
|
const headers = [
|
|
360
415
|
{ label: "Color", name: "color", type: "label" },
|
package/dist/receptions.d.ts
CHANGED
|
@@ -47,15 +47,7 @@ type PesadaBody = {
|
|
|
47
47
|
probableUtilization: number;
|
|
48
48
|
lbDiscounted: number;
|
|
49
49
|
};
|
|
50
|
-
|
|
51
|
-
id: string;
|
|
52
|
-
baskets: string;
|
|
53
|
-
totalWeight: string;
|
|
54
|
-
discount: string;
|
|
55
|
-
netWeight: string;
|
|
56
|
-
weightByBasket: string;
|
|
57
|
-
};
|
|
58
|
-
export declare const useGetPesadas: (purchaseOrder?: PurchaseOrderGraphQL, stocks_only_integer?: boolean) => [PesadaBody[], PesadaFooter, GenericDynamicTableColumn[]];
|
|
50
|
+
export declare const useGetPesadas: (purchaseOrder?: PurchaseOrderGraphQL, stocks_only_integer?: boolean) => [PesadaBody[], any[], GenericDynamicTableColumn[]];
|
|
59
51
|
/**
|
|
60
52
|
* Sirve para imprimir offline
|
|
61
53
|
* @param formInput
|
|
@@ -64,12 +56,8 @@ export declare const useGetPesadas: (purchaseOrder?: PurchaseOrderGraphQL, stock
|
|
|
64
56
|
export declare const getPesadasByForm: (formInput: FormInput, stocks_only_integer?: boolean) => {
|
|
65
57
|
tempPesadas: PesadaBody[];
|
|
66
58
|
totales: {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
totalWeight: string | number;
|
|
70
|
-
netWeight: string | number;
|
|
71
|
-
weightByBasket: string;
|
|
72
|
-
};
|
|
59
|
+
contennt: string;
|
|
60
|
+
}[];
|
|
73
61
|
headers: GenericDynamicTableColumn[];
|
|
74
62
|
};
|
|
75
63
|
type BasketDetailsBody = {
|
|
@@ -78,12 +66,7 @@ type BasketDetailsBody = {
|
|
|
78
66
|
color: string;
|
|
79
67
|
cc: number;
|
|
80
68
|
};
|
|
81
|
-
|
|
82
|
-
id: string;
|
|
83
|
-
total: string;
|
|
84
|
-
cc: number;
|
|
85
|
-
};
|
|
86
|
-
export declare const useGetBasketDetails: (purchaseOrder?: PurchaseOrderGraphQL) => [BasketDetailsBody[], BasketDetailsFooter, GenericDynamicTableColumn[]];
|
|
69
|
+
export declare const useGetBasketDetails: (purchaseOrder?: PurchaseOrderGraphQL) => [BasketDetailsBody[], any[], GenericDynamicTableColumn[]];
|
|
87
70
|
/**
|
|
88
71
|
* Para imprimir en modo offline
|
|
89
72
|
* @param formInput
|
|
@@ -91,7 +74,11 @@ export declare const useGetBasketDetails: (purchaseOrder?: PurchaseOrderGraphQL)
|
|
|
91
74
|
*/
|
|
92
75
|
export declare const getBasketDetailsByForm: (formInput: FormInput) => {
|
|
93
76
|
basketDetailsArray: BasketDetailsBody[];
|
|
94
|
-
totales:
|
|
77
|
+
totales: ({
|
|
78
|
+
contennt: string;
|
|
79
|
+
} | {
|
|
80
|
+
contennt: number;
|
|
81
|
+
})[];
|
|
95
82
|
headers: GenericDynamicTableColumn[];
|
|
96
83
|
};
|
|
97
84
|
export declare const useGetProviderNameByPurchaseOrder: (payees: PayeeGraphQL[], purchaseOrder?: PurchaseOrderGraphQL) => string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zauru-sdk/hooks",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.5",
|
|
4
4
|
"description": "Hooks reutilizables dentro de las webapps de Zauru.",
|
|
5
5
|
"main": "./dist/esm/index.js",
|
|
6
6
|
"module": "./dist/esm/index.js",
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
28
|
"@remix-run/react": "^2.8.1",
|
|
29
|
-
"@zauru-sdk/common": "^2.0.
|
|
29
|
+
"@zauru-sdk/common": "^2.0.4",
|
|
30
30
|
"@zauru-sdk/icons": "^2.0.0",
|
|
31
|
-
"@zauru-sdk/redux": "^2.0.
|
|
32
|
-
"@zauru-sdk/types": "^2.0.
|
|
31
|
+
"@zauru-sdk/redux": "^2.0.4",
|
|
32
|
+
"@zauru-sdk/types": "^2.0.4",
|
|
33
33
|
"react": "^18.2.0",
|
|
34
34
|
"react-dom": "^18.2.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "2f1bd6a004c343ec036dabe6d876b3a8ead23161"
|
|
37
37
|
}
|