@zauru-sdk/hooks 2.0.2 → 2.0.4

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.
@@ -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,38 @@ const useGetPesadas = (purchaseOrder, stocks_only_integer = false) => {
119
119
  };
120
120
  }),
121
121
  ];
122
- const totales = {
123
- id: "",
124
- baskets: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0))?.toString(),
125
- totalWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0))?.toString(),
126
- discount: "-",
127
- netWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0))?.toString(),
128
- weightByBasket: "-",
129
- lbDiscounted: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.lbDiscounted)).reduce(common_1.reduceAdd, 0))?.toString(),
130
- probableUtilization: (0, common_1.toFixedIfNeeded)(tempPesadas
131
- ?.map((x) => Number(x.probableUtilization))
132
- .reduce(common_1.reduceAdd, 0)),
133
- };
122
+ const totales = [
123
+ //baskets
124
+ {
125
+ contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0))?.toString(),
126
+ },
127
+ //totalWeight
128
+ {
129
+ contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0))?.toString(),
130
+ },
131
+ //discount
132
+ {
133
+ contennt: "-",
134
+ },
135
+ //netWeight
136
+ {
137
+ contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0))?.toString(),
138
+ },
139
+ //weightByBasket
140
+ {
141
+ contennt: "-",
142
+ },
143
+ //lbDiscounted
144
+ {
145
+ contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.lbDiscounted)).reduce(common_1.reduceAdd, 0))?.toString(),
146
+ },
147
+ //probableUtilization
148
+ {
149
+ contennt: (0, common_1.toFixedIfNeeded)(tempPesadas
150
+ ?.map((x) => Number(x.probableUtilization))
151
+ .reduce(common_1.reduceAdd, 0)),
152
+ },
153
+ ];
134
154
  const headers = [
135
155
  { label: "#", name: "id", type: "label", width: 5 },
136
156
  { label: "Canastas", name: "baskets", type: "label" },
@@ -209,13 +229,24 @@ const getPesadasByForm = (formInput, stocks_only_integer = false) => {
209
229
  });
210
230
  index++;
211
231
  }
212
- const totales = {
213
- id: "",
214
- baskets: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0)),
215
- totalWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0)),
216
- netWeight: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0)),
217
- weightByBasket: "-",
218
- };
232
+ const totales = [
233
+ //baskets
234
+ {
235
+ contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.baskets).reduce(common_1.reduceAdd, 0))?.toString(),
236
+ },
237
+ //totalWeight
238
+ {
239
+ contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => x.totalWeight).reduce(common_1.reduceAdd, 0))?.toString(),
240
+ },
241
+ //netWeight
242
+ {
243
+ contennt: (0, common_1.toFixedIfNeeded)(tempPesadas?.map((x) => Number(x.netWeight)).reduce(common_1.reduceAdd, 0))?.toString(),
244
+ },
245
+ //weightByBasket
246
+ {
247
+ contennt: "-",
248
+ },
249
+ ];
219
250
  const headers = [
220
251
  { label: "#", name: "id", type: "label", width: 5 },
221
252
  { label: "Canastas", name: "baskets", type: "label" },
@@ -47,15 +47,7 @@ type PesadaBody = {
47
47
  probableUtilization: number;
48
48
  lbDiscounted: number;
49
49
  };
50
- type PesadaFooter = {
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
- id: string;
68
- baskets: string | number;
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 = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zauru-sdk/hooks",
3
- "version": "2.0.2",
3
+ "version": "2.0.4",
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.2",
29
+ "@zauru-sdk/common": "^2.0.4",
30
30
  "@zauru-sdk/icons": "^2.0.0",
31
- "@zauru-sdk/redux": "^2.0.0",
32
- "@zauru-sdk/types": "^2.0.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": "5caadc022d1be3bbcaf6e73de37524a6b06c806c"
36
+ "gitHead": "78f1e67e363a88974b8b74b5c0f0637fa3782ef0"
37
37
  }