npm-pkg-hook 1.0.6 → 1.0.8
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/package.json +1 -1
- package/src/config/client/errors.js +24 -0
- package/src/config/client/index.js +1 -0
- package/src/hooks/index.js +4 -0
- package/src/hooks/useCatWithProduct/index.js +2 -0
- package/src/hooks/useCatWithProduct/queries.js +8 -7
- package/src/hooks/useCategoryInStore/index.js +1 -0
- package/src/hooks/useClients/index.js +63 -13
- package/src/hooks/useClients/queries.js +10 -1
- package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.js +9 -2
- package/src/hooks/useCreateProduct/index.js +19 -6
- package/src/hooks/useEmployee/index.js +13 -0
- package/src/hooks/useEmployee/queries.js +17 -0
- package/src/hooks/useFormTools/index.js +22 -8
- package/src/hooks/useFormatDate/index.js +1 -1
- package/src/hooks/useImagesStore/queries.js +213 -173
- package/src/hooks/useLazyScript/index.js +3 -3
- package/src/hooks/useLogout/index.js +41 -0
- package/src/hooks/useProductsFood/index.js +3 -3
- package/src/hooks/useProductsFood/queriesStore.js +632 -526
- package/src/hooks/useProductsFood/usetagsProducts.js +22 -10
- package/src/hooks/useReport/queries.js +2 -1
- package/src/hooks/useSales/index.js +256 -155
- package/src/hooks/useSales/queries.js +348 -198
- package/src/hooks/useSales/useGetSale.js +9 -8
- package/src/hooks/useSales/useTotalSales.js +10 -3
- package/src/hooks/useSetSession/index.js +21 -0
- package/src/hooks/useStore/index.js +42 -13
- package/src/hooks/useStoreContacts/index.js +47 -0
- package/src/hooks/useStoreContacts/queries.js +48 -0
- package/src/hooks/useUser/index.js +6 -1
- package/src/hooks/useUser/queries.js +18 -0
- package/src/utils/index.js +46 -9
|
@@ -1,34 +1,61 @@
|
|
|
1
|
-
import { gql } from
|
|
1
|
+
import { gql } from "@apollo/client";
|
|
2
2
|
|
|
3
3
|
export const GET_ALL_SALES = gql`
|
|
4
|
-
query getAllSalesStore(
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
query getAllSalesStore(
|
|
5
|
+
$idStore: ID
|
|
6
|
+
$search: String
|
|
7
|
+
$min: Int
|
|
8
|
+
$max: Int
|
|
9
|
+
$fromDate: DateTime
|
|
10
|
+
$toDate: DateTime
|
|
11
|
+
) {
|
|
12
|
+
getAllSalesStore(
|
|
13
|
+
idStore: $idStore
|
|
14
|
+
search: $search
|
|
15
|
+
min: $min
|
|
16
|
+
max: $max
|
|
17
|
+
toDate: $toDate
|
|
18
|
+
fromDate: $fromDate
|
|
19
|
+
) {
|
|
20
|
+
totalProductsPrice
|
|
21
|
+
pDatCre
|
|
22
|
+
}
|
|
9
23
|
}
|
|
10
|
-
|
|
11
|
-
`
|
|
24
|
+
`;
|
|
12
25
|
|
|
13
26
|
export const GET_ALL_COUNT_SALES = gql`
|
|
14
|
-
query getTodaySales {
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
|
|
27
|
+
query getTodaySales {
|
|
28
|
+
getTodaySales
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
18
31
|
export const GET_ALL_SALES_STATISTICS = gql`
|
|
19
|
-
query getAllSalesStoreStatistic(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
query getAllSalesStoreStatistic(
|
|
33
|
+
$idStore: ID
|
|
34
|
+
$search: String
|
|
35
|
+
$min: Int
|
|
36
|
+
$max: Int
|
|
37
|
+
$fromDate: DateTime
|
|
38
|
+
$toDate: DateTime
|
|
39
|
+
) {
|
|
40
|
+
getAllSalesStoreStatistic(
|
|
41
|
+
idStore: $idStore
|
|
42
|
+
search: $search
|
|
43
|
+
min: $min
|
|
44
|
+
max: $max
|
|
45
|
+
toDate: $toDate
|
|
46
|
+
fromDate: $fromDate
|
|
47
|
+
) {
|
|
48
|
+
pdpId
|
|
49
|
+
idStore
|
|
50
|
+
pCodeRef
|
|
51
|
+
payMethodPState
|
|
52
|
+
pPRecoger
|
|
53
|
+
totalProductsPrice
|
|
54
|
+
pSState
|
|
55
|
+
pDatCre
|
|
56
|
+
locationUser
|
|
57
|
+
pDatMod
|
|
58
|
+
getAllPedidoStore {
|
|
32
59
|
pdpId
|
|
33
60
|
pId
|
|
34
61
|
idStore
|
|
@@ -44,146 +71,166 @@ query getAllSalesStoreStatistic($idStore: ID,$search: String, $min: Int, $max: I
|
|
|
44
71
|
comments
|
|
45
72
|
cantProducts
|
|
46
73
|
pId
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
74
|
+
productFood {
|
|
75
|
+
pId
|
|
76
|
+
carProId
|
|
77
|
+
colorId
|
|
78
|
+
idStore
|
|
79
|
+
pName
|
|
80
|
+
ProPrice
|
|
81
|
+
ProDescuento
|
|
82
|
+
ProDescription
|
|
83
|
+
ValueDelivery
|
|
84
|
+
ProImage
|
|
85
|
+
ProStar
|
|
86
|
+
pState
|
|
87
|
+
pDatCre
|
|
88
|
+
pDatMod
|
|
89
|
+
}
|
|
62
90
|
}
|
|
63
91
|
}
|
|
64
92
|
}
|
|
65
93
|
}
|
|
66
|
-
|
|
67
|
-
`
|
|
94
|
+
`;
|
|
68
95
|
|
|
69
96
|
export const GET_ONE_SALES = gql`
|
|
70
|
-
query getOnePedidoStore($pCodeRef: String) {
|
|
71
|
-
|
|
72
|
-
pdpId
|
|
73
|
-
pCodeRef
|
|
74
|
-
idStore
|
|
75
|
-
pPDate
|
|
76
|
-
channel
|
|
77
|
-
pSState
|
|
78
|
-
pDatCre
|
|
79
|
-
pDatMod
|
|
80
|
-
pPRecoger
|
|
81
|
-
payMethodPState
|
|
82
|
-
pdpId
|
|
83
|
-
totalProductsPrice
|
|
84
|
-
locationUser
|
|
85
|
-
getAllPedidoStore {
|
|
97
|
+
query getOnePedidoStore($pCodeRef: String) {
|
|
98
|
+
getOnePedidoStore(pCodeRef: $pCodeRef) {
|
|
86
99
|
pdpId
|
|
87
|
-
idStore
|
|
88
100
|
pCodeRef
|
|
89
|
-
|
|
90
|
-
|
|
101
|
+
idStore
|
|
102
|
+
pPDate
|
|
103
|
+
channel
|
|
104
|
+
pSState
|
|
105
|
+
pDatCre
|
|
106
|
+
pDatMod
|
|
107
|
+
pPRecoger
|
|
108
|
+
payMethodPState
|
|
109
|
+
pdpId
|
|
110
|
+
totalProductsPrice
|
|
111
|
+
locationUser
|
|
112
|
+
getAllPedidoStore {
|
|
113
|
+
pdpId
|
|
114
|
+
idStore
|
|
115
|
+
pCodeRef
|
|
91
116
|
ShoppingCard
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
117
|
+
getAllShoppingCard {
|
|
118
|
+
ShoppingCard
|
|
119
|
+
cantProducts
|
|
120
|
+
subProductsId
|
|
121
|
+
comments
|
|
122
|
+
pId
|
|
123
|
+
productFood {
|
|
124
|
+
pId
|
|
125
|
+
carProId
|
|
126
|
+
colorId
|
|
127
|
+
idStore
|
|
128
|
+
pName
|
|
129
|
+
ProPrice
|
|
130
|
+
ProDescuento
|
|
131
|
+
ProDescription
|
|
132
|
+
ValueDelivery
|
|
133
|
+
ProImage
|
|
134
|
+
ProStar
|
|
135
|
+
pState
|
|
136
|
+
pDatCre
|
|
137
|
+
pDatMod
|
|
138
|
+
}
|
|
111
139
|
}
|
|
112
140
|
}
|
|
113
141
|
}
|
|
114
142
|
}
|
|
115
|
-
|
|
116
|
-
`
|
|
117
|
-
|
|
143
|
+
`;
|
|
118
144
|
|
|
119
145
|
export const CREATE_CLIENTS = gql`
|
|
120
|
-
mutation createClients
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
146
|
+
mutation createClients($input: IClients) {
|
|
147
|
+
createClients(input: $input) {
|
|
148
|
+
cliId
|
|
149
|
+
idStore
|
|
150
|
+
idUser
|
|
151
|
+
clState
|
|
152
|
+
ClientAddress
|
|
153
|
+
clientNumber
|
|
154
|
+
ccClient
|
|
155
|
+
gender
|
|
156
|
+
clientLastName
|
|
157
|
+
clientName
|
|
158
|
+
createAt
|
|
159
|
+
updateAt
|
|
160
|
+
}
|
|
134
161
|
}
|
|
135
|
-
|
|
136
|
-
`
|
|
162
|
+
`;
|
|
137
163
|
export const DELETE_ONE_CLIENTS = gql`
|
|
138
|
-
mutation deleteClient($cliId: ID, $clState: Int!) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
164
|
+
mutation deleteClient($cliId: ID, $clState: Int!) {
|
|
165
|
+
deleteClient(cliId: $cliId, clState: $clState) {
|
|
166
|
+
success
|
|
167
|
+
message
|
|
168
|
+
}
|
|
142
169
|
}
|
|
143
|
-
|
|
144
|
-
`
|
|
170
|
+
`;
|
|
145
171
|
export const GET_ALL_CLIENTS = gql`
|
|
146
|
-
query getAllClients(
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
172
|
+
query getAllClients(
|
|
173
|
+
$idStore: ID
|
|
174
|
+
$cId: ID
|
|
175
|
+
$dId: ID
|
|
176
|
+
$ctId: ID
|
|
177
|
+
$search: String
|
|
178
|
+
$min: Int
|
|
179
|
+
$max: Int
|
|
180
|
+
$fromDate: DateTime
|
|
181
|
+
$toDate: DateTime
|
|
182
|
+
) {
|
|
183
|
+
getAllClients(
|
|
184
|
+
idStore: $idStore
|
|
185
|
+
cId: $cId
|
|
186
|
+
dId: $dId
|
|
187
|
+
ctId: $ctId
|
|
188
|
+
search: $search
|
|
189
|
+
min: $min
|
|
190
|
+
max: $max
|
|
191
|
+
fromDate: $fromDate
|
|
192
|
+
toDate: $toDate
|
|
193
|
+
) {
|
|
194
|
+
cliId
|
|
195
|
+
idStore
|
|
196
|
+
gender
|
|
197
|
+
# idUser
|
|
198
|
+
clState
|
|
199
|
+
clientNumber
|
|
200
|
+
ccClient
|
|
201
|
+
clientLastName
|
|
202
|
+
clientName
|
|
203
|
+
ClientAddress
|
|
204
|
+
createAt
|
|
205
|
+
updateAt
|
|
206
|
+
}
|
|
161
207
|
}
|
|
162
|
-
|
|
163
|
-
`
|
|
208
|
+
`;
|
|
164
209
|
export const GET_ONE_CLIENT = gql`
|
|
165
|
-
query getOneClients($cliId: ID) {
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
210
|
+
query getOneClients($cliId: ID) {
|
|
211
|
+
getOneClients(cliId: $cliId) {
|
|
212
|
+
cliId
|
|
213
|
+
idStore
|
|
214
|
+
idUser
|
|
215
|
+
clState
|
|
216
|
+
clientNumber
|
|
217
|
+
ClientAddress
|
|
218
|
+
gender
|
|
219
|
+
ccClient
|
|
220
|
+
clientLastName
|
|
221
|
+
clientName
|
|
222
|
+
createAt
|
|
223
|
+
updateAt
|
|
224
|
+
}
|
|
180
225
|
}
|
|
181
|
-
|
|
182
|
-
`
|
|
226
|
+
`;
|
|
183
227
|
|
|
184
228
|
export const CREATE_SHOPPING_CARD = gql`
|
|
185
|
-
mutation
|
|
186
|
-
|
|
229
|
+
mutation registerShoppingCard(
|
|
230
|
+
$input: IShoppingCard
|
|
231
|
+
$idSubArray: IID_SUB_ITEMS
|
|
232
|
+
) {
|
|
233
|
+
registerShoppingCard(input: $input, idSubArray: $idSubArray) {
|
|
187
234
|
ShoppingCard
|
|
188
235
|
id
|
|
189
236
|
pId
|
|
@@ -201,46 +248,179 @@ mutation registerShoppingCard($input: IShoppingCard, $idSubArray: IID_SUB_ITEMS
|
|
|
201
248
|
cantProducts
|
|
202
249
|
comments
|
|
203
250
|
# idSubArray
|
|
251
|
+
}
|
|
204
252
|
}
|
|
205
|
-
|
|
206
|
-
`
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
getOnePedidoStore(pCodeRef: $pCodeRef) {
|
|
210
|
-
pdpId
|
|
211
|
-
pCodeRef
|
|
212
|
-
idStore
|
|
213
|
-
pPDate
|
|
214
|
-
channel
|
|
215
|
-
channel
|
|
216
|
-
change
|
|
217
|
-
pSState
|
|
218
|
-
pDatCre
|
|
219
|
-
pDatMod
|
|
220
|
-
pPRecoger
|
|
221
|
-
payMethodPState
|
|
222
|
-
pdpId
|
|
223
|
-
totalProductsPrice
|
|
224
|
-
locationUser
|
|
225
|
-
getAllPedidoStore {
|
|
253
|
+
`;
|
|
254
|
+
export const GET_ONE_SALE = gql`
|
|
255
|
+
query getOnePedidoStore($pCodeRef: String) {
|
|
256
|
+
getOnePedidoStore(pCodeRef: $pCodeRef) {
|
|
226
257
|
pdpId
|
|
227
|
-
idStore
|
|
228
258
|
pCodeRef
|
|
229
|
-
|
|
230
|
-
|
|
259
|
+
idStore
|
|
260
|
+
pPDate
|
|
261
|
+
channel
|
|
262
|
+
pSState
|
|
263
|
+
pDatCre
|
|
264
|
+
pDatMod
|
|
265
|
+
pPRecoger
|
|
266
|
+
payMethodPState
|
|
267
|
+
pdpId
|
|
268
|
+
totalProductsPrice
|
|
269
|
+
locationUser
|
|
270
|
+
getAllPedidoStore {
|
|
271
|
+
pdpId
|
|
272
|
+
idStore
|
|
273
|
+
pCodeRef
|
|
274
|
+
ShoppingCard
|
|
275
|
+
getAllShoppingCard {
|
|
276
|
+
ShoppingCard
|
|
277
|
+
cantProducts
|
|
278
|
+
refCodePid
|
|
279
|
+
subProductsId
|
|
280
|
+
comments
|
|
281
|
+
pId
|
|
282
|
+
salesExtProductFoodOptional {
|
|
283
|
+
pId
|
|
284
|
+
opExPid
|
|
285
|
+
OptionalProName
|
|
286
|
+
state
|
|
287
|
+
code
|
|
288
|
+
required
|
|
289
|
+
numbersOptionalOnly
|
|
290
|
+
pDatCre
|
|
291
|
+
pDatMod
|
|
292
|
+
saleExtProductFoodsSubOptionalAll {
|
|
293
|
+
pId
|
|
294
|
+
opExPid
|
|
295
|
+
idStore
|
|
296
|
+
opSubExPid
|
|
297
|
+
OptionalSubProName
|
|
298
|
+
exCodeOptionExtra
|
|
299
|
+
exCode
|
|
300
|
+
state
|
|
301
|
+
pDatCre
|
|
302
|
+
pDatMod
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
ExtProductFoodsAll {
|
|
306
|
+
pId
|
|
307
|
+
exPid
|
|
308
|
+
exState
|
|
309
|
+
extraName
|
|
310
|
+
extraPrice
|
|
311
|
+
newExtraPrice
|
|
312
|
+
quantity
|
|
313
|
+
state
|
|
314
|
+
pDatCre
|
|
315
|
+
pDatMod
|
|
316
|
+
}
|
|
317
|
+
productFood {
|
|
318
|
+
pId
|
|
319
|
+
carProId
|
|
320
|
+
colorId
|
|
321
|
+
idStore
|
|
322
|
+
pName
|
|
323
|
+
ProPrice
|
|
324
|
+
ProDescuento
|
|
325
|
+
ProDescription
|
|
326
|
+
ValueDelivery
|
|
327
|
+
ProImage
|
|
328
|
+
ProStar
|
|
329
|
+
pState
|
|
330
|
+
pDatCre
|
|
331
|
+
pDatMod
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
`;
|
|
338
|
+
|
|
339
|
+
export const CREATE_SHOPPING_CARD_TO_USER_STORE = gql`
|
|
340
|
+
mutation registerSalesStore(
|
|
341
|
+
$input: [IShoppingCard]
|
|
342
|
+
$id: ID
|
|
343
|
+
$idStore: ID
|
|
344
|
+
$pCodeRef: String
|
|
345
|
+
$discount: Int
|
|
346
|
+
$change: String
|
|
347
|
+
$valueDelivery: Float
|
|
348
|
+
$payMethodPState: Int
|
|
349
|
+
$pickUp: Int
|
|
350
|
+
$totalProductsPrice: Float
|
|
351
|
+
$idSubArray: IID_SUB_ITEMS
|
|
352
|
+
) {
|
|
353
|
+
registerSalesStore(
|
|
354
|
+
input: $input
|
|
355
|
+
id: $id
|
|
356
|
+
idStore: $idStore
|
|
357
|
+
pCodeRef: $pCodeRef
|
|
358
|
+
change: $change
|
|
359
|
+
discount: $discount
|
|
360
|
+
valueDelivery: $valueDelivery
|
|
361
|
+
payMethodPState: $payMethodPState
|
|
362
|
+
pickUp: $pickUp
|
|
363
|
+
totalProductsPrice: $totalProductsPrice
|
|
364
|
+
idSubArray: $idSubArray
|
|
365
|
+
) {
|
|
366
|
+
ShoppingCard {
|
|
367
|
+
ShoppingCard
|
|
368
|
+
id
|
|
369
|
+
pId
|
|
231
370
|
subProductsId
|
|
232
371
|
ShoppingCardRefCode
|
|
233
372
|
uuid
|
|
234
373
|
discountCardProduct
|
|
235
374
|
idUser
|
|
375
|
+
cName
|
|
236
376
|
idStore
|
|
377
|
+
cState
|
|
378
|
+
cDatCre
|
|
379
|
+
cDatMod
|
|
237
380
|
csDescription
|
|
238
|
-
ShoppingCard
|
|
239
381
|
cantProducts
|
|
240
|
-
subProductsId
|
|
241
382
|
comments
|
|
383
|
+
}
|
|
384
|
+
Response {
|
|
385
|
+
success
|
|
386
|
+
message
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
`;
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
export const GET_ALL_PEDIDOS = gql`
|
|
394
|
+
query getAllPedidoStoreFinal($idStore: ID, $search: String, $min: Int, $max: Int, $statusOrder: Int) {
|
|
395
|
+
getAllPedidoStoreFinal(idStore: $idStore, search: $search, min: $min, max: $max, statusOrder: $statusOrder) {
|
|
396
|
+
pdpId
|
|
397
|
+
idStore
|
|
398
|
+
pCodeRef
|
|
399
|
+
payMethodPState
|
|
400
|
+
pPRecoger
|
|
401
|
+
totalProductsPrice
|
|
402
|
+
pSState
|
|
403
|
+
pDatCre
|
|
404
|
+
channel
|
|
405
|
+
locationUser
|
|
406
|
+
pDatMod
|
|
407
|
+
getAllPedidoStore{
|
|
408
|
+
pdpId
|
|
242
409
|
pId
|
|
243
|
-
|
|
410
|
+
idStore
|
|
411
|
+
ShoppingCard
|
|
412
|
+
pCodeRef
|
|
413
|
+
pPStateP
|
|
414
|
+
payMethodPState
|
|
415
|
+
pPRecoger
|
|
416
|
+
pDatCre
|
|
417
|
+
pDatMod
|
|
418
|
+
getAllShoppingCard {
|
|
419
|
+
ShoppingCard
|
|
420
|
+
comments
|
|
421
|
+
cantProducts
|
|
422
|
+
pId
|
|
423
|
+
productFood{
|
|
244
424
|
pId
|
|
245
425
|
carProId
|
|
246
426
|
colorId
|
|
@@ -260,34 +440,4 @@ query getOnePedidoStore($pCodeRef: String) {
|
|
|
260
440
|
}
|
|
261
441
|
}
|
|
262
442
|
}
|
|
263
|
-
`
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
export const CREATE_SHOPPING_CARD_TO_USER_STORE = gql`
|
|
267
|
-
mutation registerSalesStore($input: [IShoppingCard], $id: ID, $idStore: ID, $pCodeRef: String, $change: String, $valueDelivery: Float, $payMethodPState: Int, $pickUp: Int, $totalProductsPrice: Float, $idSubArray: IID_SUB_ITEMS){
|
|
268
|
-
registerSalesStore(input: $input, id: $id, idStore: $idStore, pCodeRef: $pCodeRef, change: $change, valueDelivery: $valueDelivery, payMethodPState: $payMethodPState, pickUp: $pickUp, totalProductsPrice: $totalProductsPrice, idSubArray: $idSubArray){
|
|
269
|
-
ShoppingCard {
|
|
270
|
-
ShoppingCard
|
|
271
|
-
id
|
|
272
|
-
pId
|
|
273
|
-
subProductsId
|
|
274
|
-
ShoppingCardRefCode
|
|
275
|
-
uuid
|
|
276
|
-
discountCardProduct
|
|
277
|
-
idUser
|
|
278
|
-
cName
|
|
279
|
-
idStore
|
|
280
|
-
cState
|
|
281
|
-
cDatCre
|
|
282
|
-
cDatMod
|
|
283
|
-
csDescription
|
|
284
|
-
cantProducts
|
|
285
|
-
comments
|
|
286
|
-
}
|
|
287
|
-
Response {
|
|
288
|
-
success
|
|
289
|
-
message
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
443
|
`
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { useLazyQuery } from '@apollo/client'
|
|
2
2
|
import { GET_ONE_SALE } from './queries'
|
|
3
|
-
export const useGetSale = () => {
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
export const useGetSale = () => {
|
|
5
|
+
const [getOnePedidoStore, { loading, data, called, error }] = useLazyQuery(GET_ONE_SALE)
|
|
6
|
+
return {
|
|
7
|
+
data: data?.getOnePedidoStore, // actualizado aquí
|
|
8
|
+
loading,
|
|
9
|
+
error,
|
|
10
|
+
called,
|
|
11
|
+
getOnePedidoStore
|
|
12
|
+
}
|
|
11
13
|
}
|
|
12
|
-
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
1
|
+
import { useApolloClient, useQuery } from '@apollo/client'
|
|
2
2
|
import { useState } from 'react'
|
|
3
3
|
import { GET_ALL_COUNT_SALES } from './queries'
|
|
4
|
-
|
|
4
|
+
export * from './queries'
|
|
5
5
|
export const useTotalSales = () => {
|
|
6
6
|
const [count, setCount] = useState(0)
|
|
7
|
+
const client = useApolloClient();
|
|
8
|
+
|
|
7
9
|
const { loading, error } = useQuery(GET_ALL_COUNT_SALES, {
|
|
8
10
|
onCompleted: (data) => {
|
|
9
|
-
|
|
11
|
+
if (data) {
|
|
12
|
+
client.writeQuery({ query: GET_ALL_COUNT_SALES, data }); // Almacena la respuesta en la cache
|
|
13
|
+
}
|
|
14
|
+
if (data?.getTodaySales) {
|
|
15
|
+
setCount(data?.getTodaySales || 0)
|
|
16
|
+
}
|
|
10
17
|
},
|
|
11
18
|
fetchPolicy: 'cache-and-network',
|
|
12
19
|
notifyOnNetworkStatusChange: true,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Cookies } from "../../cookies"
|
|
2
|
+
|
|
3
|
+
export const useSetSession = () => {
|
|
4
|
+
const bookOptionsCookie = {
|
|
5
|
+
RESTAURANT: 'restaurant'
|
|
6
|
+
}
|
|
7
|
+
const handleSession = async (props) => {
|
|
8
|
+
try {
|
|
9
|
+
const { cookie } = props
|
|
10
|
+
for (const element of cookie) {
|
|
11
|
+
const { name, value } = element
|
|
12
|
+
if (value) {
|
|
13
|
+
await Cookies.set(bookOptionsCookie[name], value)
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
} catch (error) {
|
|
17
|
+
throw new Error(error)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return [handleSession]
|
|
21
|
+
}
|