@zauru-sdk/hooks 2.0.4 → 2.0.6
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 +68 -25
- package/dist/receptions.d.ts +16 -9
- package/package.json +2 -2
package/dist/esm/receptions.js
CHANGED
|
@@ -120,35 +120,47 @@ const useGetPesadas = (purchaseOrder, stocks_only_integer = false) => {
|
|
|
120
120
|
}),
|
|
121
121
|
];
|
|
122
122
|
const totales = [
|
|
123
|
+
//#
|
|
124
|
+
{
|
|
125
|
+
content: "",
|
|
126
|
+
name: "id",
|
|
127
|
+
},
|
|
123
128
|
//baskets
|
|
124
129
|
{
|
|
125
|
-
|
|
130
|
+
content: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
131
|
+
name: "baskets",
|
|
126
132
|
},
|
|
127
133
|
//totalWeight
|
|
128
134
|
{
|
|
129
|
-
|
|
135
|
+
content: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
136
|
+
name: "totalWeight",
|
|
130
137
|
},
|
|
131
138
|
//discount
|
|
132
139
|
{
|
|
133
|
-
|
|
140
|
+
content: "-",
|
|
141
|
+
name: "discount",
|
|
134
142
|
},
|
|
135
143
|
//netWeight
|
|
136
144
|
{
|
|
137
|
-
|
|
145
|
+
content: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
146
|
+
name: "netWeight",
|
|
138
147
|
},
|
|
139
148
|
//weightByBasket
|
|
140
149
|
{
|
|
141
|
-
|
|
150
|
+
content: "-",
|
|
151
|
+
name: "weightByBasket",
|
|
142
152
|
},
|
|
143
153
|
//lbDiscounted
|
|
144
154
|
{
|
|
145
|
-
|
|
155
|
+
content: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.lbDiscounted)).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
156
|
+
name: "lbDiscounted",
|
|
146
157
|
},
|
|
147
158
|
//probableUtilization
|
|
148
159
|
{
|
|
149
|
-
|
|
160
|
+
content: (0, common_1.toFixedIfNeeded)(tempPesadas
|
|
150
161
|
?.map((x) => Number(x.probableUtilization))
|
|
151
162
|
.reduce(common_1.reduceAdd, 0)),
|
|
163
|
+
name: "probableUtilization",
|
|
152
164
|
},
|
|
153
165
|
];
|
|
154
166
|
const headers = [
|
|
@@ -230,21 +242,30 @@ const getPesadasByForm = (formInput, stocks_only_integer = false) => {
|
|
|
230
242
|
index++;
|
|
231
243
|
}
|
|
232
244
|
const totales = [
|
|
245
|
+
//#
|
|
246
|
+
{
|
|
247
|
+
content: "",
|
|
248
|
+
name: "id",
|
|
249
|
+
},
|
|
233
250
|
//baskets
|
|
234
251
|
{
|
|
235
|
-
|
|
252
|
+
content: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
253
|
+
name: "baskets",
|
|
236
254
|
},
|
|
237
255
|
//totalWeight
|
|
238
256
|
{
|
|
239
|
-
|
|
257
|
+
content: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
258
|
+
name: "totalWeight",
|
|
240
259
|
},
|
|
241
260
|
//netWeight
|
|
242
261
|
{
|
|
243
|
-
|
|
262
|
+
content: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
263
|
+
name: "netWeight",
|
|
244
264
|
},
|
|
245
265
|
//weightByBasket
|
|
246
266
|
{
|
|
247
|
-
|
|
267
|
+
content: "-",
|
|
268
|
+
name: "weightByBasket",
|
|
248
269
|
},
|
|
249
270
|
];
|
|
250
271
|
const headers = [
|
|
@@ -272,7 +293,7 @@ exports.getPesadasByForm = getPesadasByForm;
|
|
|
272
293
|
const useGetBasketDetails = (purchaseOrder) => {
|
|
273
294
|
const [basketsJoined, footerBasketsJoined, headersBasketsJoined] = (0, react_2.useMemo)(() => {
|
|
274
295
|
if (!purchaseOrder)
|
|
275
|
-
return [[],
|
|
296
|
+
return [[], [], []];
|
|
276
297
|
const bsq = purchaseOrder?.lots.length > 0
|
|
277
298
|
? purchaseOrder?.lots
|
|
278
299
|
?.map((x) => {
|
|
@@ -312,12 +333,23 @@ const useGetBasketDetails = (purchaseOrder) => {
|
|
|
312
333
|
});
|
|
313
334
|
}
|
|
314
335
|
}
|
|
315
|
-
const totales =
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
336
|
+
const totales = [
|
|
337
|
+
//color
|
|
338
|
+
{
|
|
339
|
+
content: "",
|
|
340
|
+
name: "color",
|
|
341
|
+
},
|
|
342
|
+
//total
|
|
343
|
+
{
|
|
344
|
+
content: (0, common_1.toFixedIfNeeded)(joinedBaskets?.map((x) => x.total).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
345
|
+
name: "total",
|
|
346
|
+
},
|
|
347
|
+
//cc
|
|
348
|
+
{
|
|
349
|
+
content: joinedBaskets?.map((x) => x.cc).reduce(common_1.reduceAdd, 0),
|
|
350
|
+
name: "cc",
|
|
351
|
+
},
|
|
352
|
+
];
|
|
321
353
|
const headers = [
|
|
322
354
|
{ label: "Color", name: "color", type: "label" },
|
|
323
355
|
{ label: "Canastas recibidas", name: "total", type: "label" },
|
|
@@ -339,7 +371,7 @@ const getBasketDetailsByForm = (formInput) => {
|
|
|
339
371
|
if (!formInput)
|
|
340
372
|
return {
|
|
341
373
|
basketDetailsArray,
|
|
342
|
-
totales:
|
|
374
|
+
totales: [],
|
|
343
375
|
headers: [],
|
|
344
376
|
};
|
|
345
377
|
// Regex para identificar los campos relevantes
|
|
@@ -380,12 +412,23 @@ const getBasketDetailsByForm = (formInput) => {
|
|
|
380
412
|
}
|
|
381
413
|
}
|
|
382
414
|
}
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
415
|
+
const totales = [
|
|
416
|
+
//color
|
|
417
|
+
{
|
|
418
|
+
content: "",
|
|
419
|
+
name: "color",
|
|
420
|
+
},
|
|
421
|
+
//total
|
|
422
|
+
{
|
|
423
|
+
content: (0, common_1.toFixedIfNeeded)(basketDetailsArray.map((x) => x.total).reduce(common_1.reduceAdd, 0))?.toString(),
|
|
424
|
+
name: "total",
|
|
425
|
+
},
|
|
426
|
+
//cc
|
|
427
|
+
{
|
|
428
|
+
content: basketDetailsArray.map((x) => x.cc).reduce(common_1.reduceAdd, 0),
|
|
429
|
+
name: "cc",
|
|
430
|
+
},
|
|
431
|
+
];
|
|
389
432
|
// Definir los encabezados de la tabla
|
|
390
433
|
const headers = [
|
|
391
434
|
{ label: "Color", name: "color", type: "label" },
|
package/dist/receptions.d.ts
CHANGED
|
@@ -47,7 +47,12 @@ type PesadaBody = {
|
|
|
47
47
|
probableUtilization: number;
|
|
48
48
|
lbDiscounted: number;
|
|
49
49
|
};
|
|
50
|
-
export
|
|
50
|
+
export type FooterColumnConfig = {
|
|
51
|
+
content: React.ReactNode;
|
|
52
|
+
className?: string;
|
|
53
|
+
name?: string;
|
|
54
|
+
};
|
|
55
|
+
export declare const useGetPesadas: (purchaseOrder?: PurchaseOrderGraphQL, stocks_only_integer?: boolean) => [PesadaBody[], FooterColumnConfig[], GenericDynamicTableColumn[]];
|
|
51
56
|
/**
|
|
52
57
|
* Sirve para imprimir offline
|
|
53
58
|
* @param formInput
|
|
@@ -56,7 +61,8 @@ export declare const useGetPesadas: (purchaseOrder?: PurchaseOrderGraphQL, stock
|
|
|
56
61
|
export declare const getPesadasByForm: (formInput: FormInput, stocks_only_integer?: boolean) => {
|
|
57
62
|
tempPesadas: PesadaBody[];
|
|
58
63
|
totales: {
|
|
59
|
-
|
|
64
|
+
content: string;
|
|
65
|
+
name: string;
|
|
60
66
|
}[];
|
|
61
67
|
headers: GenericDynamicTableColumn[];
|
|
62
68
|
};
|
|
@@ -66,12 +72,7 @@ type BasketDetailsBody = {
|
|
|
66
72
|
color: string;
|
|
67
73
|
cc: number;
|
|
68
74
|
};
|
|
69
|
-
|
|
70
|
-
id: string;
|
|
71
|
-
total: string;
|
|
72
|
-
cc: number;
|
|
73
|
-
};
|
|
74
|
-
export declare const useGetBasketDetails: (purchaseOrder?: PurchaseOrderGraphQL) => [BasketDetailsBody[], BasketDetailsFooter, GenericDynamicTableColumn[]];
|
|
75
|
+
export declare const useGetBasketDetails: (purchaseOrder?: PurchaseOrderGraphQL) => [BasketDetailsBody[], FooterColumnConfig[], GenericDynamicTableColumn[]];
|
|
75
76
|
/**
|
|
76
77
|
* Para imprimir en modo offline
|
|
77
78
|
* @param formInput
|
|
@@ -79,7 +80,13 @@ export declare const useGetBasketDetails: (purchaseOrder?: PurchaseOrderGraphQL)
|
|
|
79
80
|
*/
|
|
80
81
|
export declare const getBasketDetailsByForm: (formInput: FormInput) => {
|
|
81
82
|
basketDetailsArray: BasketDetailsBody[];
|
|
82
|
-
totales:
|
|
83
|
+
totales: ({
|
|
84
|
+
content: string;
|
|
85
|
+
name: string;
|
|
86
|
+
} | {
|
|
87
|
+
content: number;
|
|
88
|
+
name: string;
|
|
89
|
+
})[];
|
|
83
90
|
headers: GenericDynamicTableColumn[];
|
|
84
91
|
};
|
|
85
92
|
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.6",
|
|
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",
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"react": "^18.2.0",
|
|
34
34
|
"react-dom": "^18.2.0"
|
|
35
35
|
},
|
|
36
|
-
"gitHead": "
|
|
36
|
+
"gitHead": "fe4dd4b5af130e19ea2b9ef4566b41a059fb901c"
|
|
37
37
|
}
|