npm-pkg-hook 1.0.1 → 1.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.
- package/.env +1 -0
- package/.eslintrc.js +132 -0
- package/.github/pull_request_template.md +18 -0
- package/.github/workflows/pepeline.yaml +30 -0
- package/.vscode/extensions.json +6 -0
- package/.vscode/settings.json +12 -0
- package/next.config.js +4 -4
- package/package.json +17 -7
- package/script.txt +7 -0
- package/src/hooks/index.js +39 -8
- package/src/hooks/updateExtProductFoodsOptional/index.js +38 -0
- package/src/hooks/useAcumulateDate/index.js +14 -14
- package/src/hooks/useAnimationText/index.jsx +7 -6
- package/src/hooks/useBanner/index.js +19 -0
- package/src/hooks/useCatWithProduct/index.js +42 -0
- package/src/hooks/useCatWithProduct/queries.js +172 -0
- package/src/hooks/useCategoryInStore/index.js +94 -0
- package/src/hooks/{useGetCategorieStore → useCategoryInStore}/queries.js +0 -0
- package/src/hooks/useChartData/index.js +168 -0
- package/src/hooks/useCheckbox/index.js +114 -0
- package/src/hooks/useClients/index.js +13 -0
- package/src/hooks/useClients/queries.js +118 -0
- package/src/hooks/useConnection/index.js +23 -0
- package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.js +165 -0
- package/src/hooks/useCreateProduct/index.js +268 -0
- package/src/hooks/useDessert/index.js +141 -0
- package/src/hooks/useDrag/index.js +14 -9
- package/src/hooks/useFetchMoreInteractions/index.jsx +6 -3
- package/src/hooks/useFormTools/index.js +16 -3
- package/src/hooks/useFormatDate/index.js +34 -0
- package/src/hooks/useImageOptimization/index.js +28 -0
- package/src/hooks/useImageWeight/index.js +52 -0
- package/src/hooks/useImagesStore/index.js +171 -0
- package/src/hooks/useImagesStore/queries.js +216 -0
- package/src/hooks/useIntersection/index.js +54 -1
- package/src/hooks/useLazyScript/index.js +72 -0
- package/src/hooks/useLocationNavigate/index.js +1 -1
- package/src/hooks/useMobile/index.js +38 -0
- package/src/hooks/useMutateHeight/index.js +37 -0
- package/src/hooks/useProductsFood/index.js +190 -0
- package/src/hooks/useProductsFood/queriesStore.js +781 -0
- package/src/hooks/useProductsFood/usetagsProducts.js +57 -0
- package/src/hooks/useReport/index.js +35 -0
- package/src/hooks/useReport/queries.js +122 -0
- package/src/hooks/useRestaurant/queries.js +11 -1
- package/src/hooks/useSales/index.js +589 -0
- package/src/hooks/useSales/queries.js +291 -0
- package/src/hooks/useSales/useGetSale.js +12 -0
- package/src/hooks/useSales/useTotalSales.js +17 -0
- package/src/hooks/useSaveAvailableProduct/helpers/index.js +30 -0
- package/src/hooks/useSaveAvailableProduct/index.js +26 -0
- package/src/hooks/useSaveAvailableProduct/queries.js +10 -0
- package/src/hooks/useSchedule/index.jsx +23 -0
- package/src/hooks/useStore/index.js +18 -0
- package/src/hooks/useStore/queries.js +136 -0
- package/src/hooks/useStoreCalendar/index.js +7 -0
- package/src/hooks/useUpdateCart/index.js +5 -4
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +37 -0
- package/src/hooks/useUser/index.js +6 -2
- package/src/hooks/useUser/queries.js +69 -0
- package/src/index.jsx +2 -1
- package/src/mock/dessert/index.js +16 -0
- package/src/mock/index.js +2 -0
- package/src/utils/index.js +80 -1
- package/src/hooks/useGetCategorieStore/index.js +0 -21
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { gql } from '@apollo/client'
|
|
2
|
+
|
|
3
|
+
export const GET_ALL_SALES = gql`
|
|
4
|
+
query getAllSalesStore($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: DateTime, $toDate: DateTime ) {
|
|
5
|
+
getAllSalesStore(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
|
|
6
|
+
totalProductsPrice
|
|
7
|
+
pDatCre
|
|
8
|
+
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`
|
|
12
|
+
|
|
13
|
+
export const GET_ALL_COUNT_SALES = gql`
|
|
14
|
+
query getTodaySales {
|
|
15
|
+
getTodaySales
|
|
16
|
+
}
|
|
17
|
+
`
|
|
18
|
+
export const GET_ALL_SALES_STATISTICS = gql`
|
|
19
|
+
query getAllSalesStoreStatistic($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: DateTime, $toDate: DateTime ) {
|
|
20
|
+
getAllSalesStoreStatistic(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
|
|
21
|
+
pdpId
|
|
22
|
+
idStore
|
|
23
|
+
pCodeRef
|
|
24
|
+
payMethodPState
|
|
25
|
+
pPRecoger
|
|
26
|
+
totalProductsPrice
|
|
27
|
+
pSState
|
|
28
|
+
pDatCre
|
|
29
|
+
locationUser
|
|
30
|
+
pDatMod
|
|
31
|
+
getAllPedidoStore{
|
|
32
|
+
pdpId
|
|
33
|
+
pId
|
|
34
|
+
idStore
|
|
35
|
+
ShoppingCard
|
|
36
|
+
pCodeRef
|
|
37
|
+
pPStateP
|
|
38
|
+
payMethodPState
|
|
39
|
+
pPRecoger
|
|
40
|
+
pDatCre
|
|
41
|
+
pDatMod
|
|
42
|
+
getAllShoppingCard {
|
|
43
|
+
ShoppingCard
|
|
44
|
+
comments
|
|
45
|
+
cantProducts
|
|
46
|
+
pId
|
|
47
|
+
productFood{
|
|
48
|
+
pId
|
|
49
|
+
carProId
|
|
50
|
+
colorId
|
|
51
|
+
idStore
|
|
52
|
+
pName
|
|
53
|
+
ProPrice
|
|
54
|
+
ProDescuento
|
|
55
|
+
ProDescription
|
|
56
|
+
ValueDelivery
|
|
57
|
+
ProImage
|
|
58
|
+
ProStar
|
|
59
|
+
pState
|
|
60
|
+
pDatCre
|
|
61
|
+
pDatMod
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
`
|
|
68
|
+
|
|
69
|
+
export const GET_ONE_SALES = gql`
|
|
70
|
+
query getOnePedidoStore($pCodeRef: String) {
|
|
71
|
+
getOnePedidoStore(pCodeRef: $pCodeRef) {
|
|
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 {
|
|
86
|
+
pdpId
|
|
87
|
+
idStore
|
|
88
|
+
pCodeRef
|
|
89
|
+
ShoppingCard
|
|
90
|
+
getAllShoppingCard {
|
|
91
|
+
ShoppingCard
|
|
92
|
+
cantProducts
|
|
93
|
+
subProductsId
|
|
94
|
+
comments
|
|
95
|
+
pId
|
|
96
|
+
productFood {
|
|
97
|
+
pId
|
|
98
|
+
carProId
|
|
99
|
+
colorId
|
|
100
|
+
idStore
|
|
101
|
+
pName
|
|
102
|
+
ProPrice
|
|
103
|
+
ProDescuento
|
|
104
|
+
ProDescription
|
|
105
|
+
ValueDelivery
|
|
106
|
+
ProImage
|
|
107
|
+
ProStar
|
|
108
|
+
pState
|
|
109
|
+
pDatCre
|
|
110
|
+
pDatMod
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
`
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
export const CREATE_CLIENTS = gql`
|
|
120
|
+
mutation createClients ($input: IClients) {
|
|
121
|
+
createClients(input: $input) {
|
|
122
|
+
cliId
|
|
123
|
+
idStore
|
|
124
|
+
idUser
|
|
125
|
+
clState
|
|
126
|
+
ClientAddress
|
|
127
|
+
clientNumber
|
|
128
|
+
ccClient
|
|
129
|
+
gender
|
|
130
|
+
clientLastName
|
|
131
|
+
clientName
|
|
132
|
+
createAt
|
|
133
|
+
updateAt
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
`
|
|
137
|
+
export const DELETE_ONE_CLIENTS = gql`
|
|
138
|
+
mutation deleteClient($cliId: ID, $clState: Int!) {
|
|
139
|
+
deleteClient(cliId: $cliId, clState: $clState) {
|
|
140
|
+
success
|
|
141
|
+
message
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
`
|
|
145
|
+
export const GET_ALL_CLIENTS = gql`
|
|
146
|
+
query getAllClients($idStore: ID, $cId: ID, $dId: ID, $ctId: ID, $search: String, $min: Int, $max: Int, $fromDate: DateTime, $toDate: DateTime ) {
|
|
147
|
+
getAllClients(idStore: $idStore, cId: $cId, dId: $dId, ctId: $ctId, search: $search, min: $min, max: $max, fromDate: $fromDate, toDate: $toDate) {
|
|
148
|
+
cliId
|
|
149
|
+
idStore
|
|
150
|
+
gender
|
|
151
|
+
# idUser
|
|
152
|
+
clState
|
|
153
|
+
clientNumber
|
|
154
|
+
ccClient
|
|
155
|
+
clientLastName
|
|
156
|
+
clientName
|
|
157
|
+
ClientAddress
|
|
158
|
+
createAt
|
|
159
|
+
updateAt
|
|
160
|
+
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
`
|
|
164
|
+
export const GET_ONE_CLIENT = gql`
|
|
165
|
+
query getOneClients($cliId: ID) {
|
|
166
|
+
getOneClients(cliId: $cliId) {
|
|
167
|
+
cliId
|
|
168
|
+
idStore
|
|
169
|
+
idUser
|
|
170
|
+
clState
|
|
171
|
+
clientNumber
|
|
172
|
+
ClientAddress
|
|
173
|
+
gender
|
|
174
|
+
ccClient
|
|
175
|
+
clientLastName
|
|
176
|
+
clientName
|
|
177
|
+
createAt
|
|
178
|
+
updateAt
|
|
179
|
+
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
`
|
|
183
|
+
|
|
184
|
+
export const CREATE_SHOPPING_CARD = gql`
|
|
185
|
+
mutation registerShoppingCard($input: IShoppingCard, $idSubArray: IID_SUB_ITEMS){
|
|
186
|
+
registerShoppingCard(input: $input, idSubArray: $idSubArray){
|
|
187
|
+
ShoppingCard
|
|
188
|
+
id
|
|
189
|
+
pId
|
|
190
|
+
subProductsId
|
|
191
|
+
ShoppingCardRefCode
|
|
192
|
+
uuid
|
|
193
|
+
discountCardProduct
|
|
194
|
+
idUser
|
|
195
|
+
cName
|
|
196
|
+
idStore
|
|
197
|
+
cState
|
|
198
|
+
cDatCre
|
|
199
|
+
cDatMod
|
|
200
|
+
csDescription
|
|
201
|
+
cantProducts
|
|
202
|
+
comments
|
|
203
|
+
# idSubArray
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
`
|
|
207
|
+
export const GET_ONE_SALE = gql`
|
|
208
|
+
query getOnePedidoStore($pCodeRef: String) {
|
|
209
|
+
getOnePedidoStore(pCodeRef: $pCodeRef) {
|
|
210
|
+
pdpId
|
|
211
|
+
pCodeRef
|
|
212
|
+
idStore
|
|
213
|
+
pPDate
|
|
214
|
+
channel
|
|
215
|
+
pSState
|
|
216
|
+
pDatCre
|
|
217
|
+
pDatMod
|
|
218
|
+
pPRecoger
|
|
219
|
+
payMethodPState
|
|
220
|
+
pdpId
|
|
221
|
+
totalProductsPrice
|
|
222
|
+
locationUser
|
|
223
|
+
getAllPedidoStore {
|
|
224
|
+
pdpId
|
|
225
|
+
idStore
|
|
226
|
+
pCodeRef
|
|
227
|
+
ShoppingCard
|
|
228
|
+
getAllShoppingCard {
|
|
229
|
+
subProductsId
|
|
230
|
+
ShoppingCardRefCode
|
|
231
|
+
uuid
|
|
232
|
+
discountCardProduct
|
|
233
|
+
idUser
|
|
234
|
+
idStore
|
|
235
|
+
csDescription
|
|
236
|
+
ShoppingCard
|
|
237
|
+
cantProducts
|
|
238
|
+
subProductsId
|
|
239
|
+
comments
|
|
240
|
+
pId
|
|
241
|
+
productFood {
|
|
242
|
+
pId
|
|
243
|
+
carProId
|
|
244
|
+
colorId
|
|
245
|
+
idStore
|
|
246
|
+
pName
|
|
247
|
+
ProPrice
|
|
248
|
+
ProDescuento
|
|
249
|
+
ProDescription
|
|
250
|
+
ValueDelivery
|
|
251
|
+
ProImage
|
|
252
|
+
ProStar
|
|
253
|
+
pState
|
|
254
|
+
pDatCre
|
|
255
|
+
pDatMod
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
`
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
export const CREATE_SHOPPING_CARD_TO_USER_STORE = gql`
|
|
265
|
+
mutation registerSalesStore($input: [IShoppingCard], $id: ID, $idStore: ID, $pCodeRef: String, $change: String, $valueDelivery: Float, $payMethodPState: Int, $pickUp: Int, $totalProductsPrice: Float, $idSubArray: IID_SUB_ITEMS){
|
|
266
|
+
registerSalesStore(input: $input, id: $id, idStore: $idStore, pCodeRef: $pCodeRef, change: $change, valueDelivery: $valueDelivery, payMethodPState: $payMethodPState, pickUp: $pickUp, totalProductsPrice: $totalProductsPrice, idSubArray: $idSubArray){
|
|
267
|
+
ShoppingCard {
|
|
268
|
+
ShoppingCard
|
|
269
|
+
id
|
|
270
|
+
pId
|
|
271
|
+
subProductsId
|
|
272
|
+
ShoppingCardRefCode
|
|
273
|
+
uuid
|
|
274
|
+
discountCardProduct
|
|
275
|
+
idUser
|
|
276
|
+
cName
|
|
277
|
+
idStore
|
|
278
|
+
cState
|
|
279
|
+
cDatCre
|
|
280
|
+
cDatMod
|
|
281
|
+
csDescription
|
|
282
|
+
cantProducts
|
|
283
|
+
comments
|
|
284
|
+
}
|
|
285
|
+
Response {
|
|
286
|
+
success
|
|
287
|
+
message
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
`
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { useLazyQuery } from '@apollo/client'
|
|
2
|
+
import { GET_ONE_SALE } from './queries'
|
|
3
|
+
export const useGetSale = () => {
|
|
4
|
+
|
|
5
|
+
const [getOnePedidoStore, {data, loading}] = useLazyQuery(GET_ONE_SALE)
|
|
6
|
+
return {
|
|
7
|
+
data: data?.getOnePedidoStore || {},
|
|
8
|
+
loading,
|
|
9
|
+
getOnePedidoStore
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useQuery } from '@apollo/client'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import { GET_ALL_COUNT_SALES } from './queries'
|
|
4
|
+
|
|
5
|
+
export const useTotalSales = () => {
|
|
6
|
+
const [count, setCount] = useState(0)
|
|
7
|
+
const { loading, error } = useQuery(GET_ALL_COUNT_SALES, {
|
|
8
|
+
onCompleted: (data) => {
|
|
9
|
+
setCount(data?.getTodaySales || 0)
|
|
10
|
+
},
|
|
11
|
+
fetchPolicy: 'cache-and-network',
|
|
12
|
+
notifyOnNetworkStatusChange: true,
|
|
13
|
+
nextFetchPolicy: 'cache-first',
|
|
14
|
+
refetchWritePolicy: 'merge',
|
|
15
|
+
})
|
|
16
|
+
return [count, { loading, error }]
|
|
17
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const days = [
|
|
2
|
+
{
|
|
3
|
+
day: 1,
|
|
4
|
+
name: 'L'
|
|
5
|
+
},
|
|
6
|
+
{
|
|
7
|
+
day: 2,
|
|
8
|
+
name: 'M'
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
day: 3,
|
|
12
|
+
name: 'M'
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
day: 4,
|
|
16
|
+
name: 'J'
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
day: 5,
|
|
20
|
+
name: 'V'
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
day: 6,
|
|
24
|
+
name: 'S'
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
day: 0,
|
|
28
|
+
name: 'D'
|
|
29
|
+
},
|
|
30
|
+
]
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useMutation } from "@apollo/client";
|
|
2
|
+
import { useState } from "react";
|
|
3
|
+
import { days } from './helpers/index';
|
|
4
|
+
import { CREATE_AVAILABLE_PRODUCTS_DAYS } from "./queries";
|
|
5
|
+
|
|
6
|
+
export const useSaveAvailableProduct = () => {
|
|
7
|
+
const [selectedDays, setSelectedDays] = useState([])
|
|
8
|
+
|
|
9
|
+
const handleDaySelection = (day) => {
|
|
10
|
+
if (selectedDays.includes(day)) {
|
|
11
|
+
setSelectedDays(selectedDays.filter((selectedDay) => {return selectedDay !== day}))
|
|
12
|
+
} else {
|
|
13
|
+
setSelectedDays([...selectedDays, day])
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const [registerAvailableProduct, { loading }] = useMutation(CREATE_AVAILABLE_PRODUCTS_DAYS, {
|
|
17
|
+
onError: () => { return console.log({ message: 'Lo sentimos ocurrió un error, vuelve a intentarlo' }) },
|
|
18
|
+
})
|
|
19
|
+
return {
|
|
20
|
+
handleDaySelection,
|
|
21
|
+
selectedDays,
|
|
22
|
+
days,
|
|
23
|
+
Loading: loading,
|
|
24
|
+
registerAvailableProduct,
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useQuery } from '@apollo/client'
|
|
2
|
+
import { GET_ONE_SCHEDULE_STORE, GET_SCHEDULE_STORE } from '../useProductsFood/queriesStore'
|
|
3
|
+
|
|
4
|
+
export const useSchedule = ({ day = null }) => {
|
|
5
|
+
const {
|
|
6
|
+
data,
|
|
7
|
+
loading,
|
|
8
|
+
error
|
|
9
|
+
} = useQuery(GET_ONE_SCHEDULE_STORE, { variables: { schDay: day } })
|
|
10
|
+
|
|
11
|
+
return [data?.getOneStoreSchedules, { loading, error }]
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const useSchedules = ({ schDay = 1 }) => {
|
|
15
|
+
const {
|
|
16
|
+
data,
|
|
17
|
+
loading,
|
|
18
|
+
error
|
|
19
|
+
} = useQuery(GET_SCHEDULE_STORE, { variables: { schDay: schDay } })
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
return [data?.getStoreSchedules, { loading, error }]
|
|
23
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { useQuery } from '@apollo/client'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
import { GET_ONE_STORE } from './queries'
|
|
4
|
+
|
|
5
|
+
export const useStore = () => {
|
|
6
|
+
const [store, setStore] = useState({})
|
|
7
|
+
const { loading, error } = useQuery(GET_ONE_STORE, {
|
|
8
|
+
fetchPolicy: 'cache-and-network',
|
|
9
|
+
onCompleted: (res) => {
|
|
10
|
+
const { getStore } = res || {}
|
|
11
|
+
setStore(getStore)
|
|
12
|
+
},
|
|
13
|
+
onError: (err) => {
|
|
14
|
+
console.log(err)
|
|
15
|
+
}
|
|
16
|
+
})
|
|
17
|
+
return [store, { loading, error }]
|
|
18
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
import { gql } from '@apollo/client'
|
|
2
|
+
|
|
3
|
+
export const CREATE_ONE_STORE = gql`
|
|
4
|
+
mutation newRegisterStore($input: IStore){
|
|
5
|
+
newRegisterStore(input: $input){
|
|
6
|
+
success
|
|
7
|
+
message
|
|
8
|
+
idStore
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
`
|
|
12
|
+
export const GET_ONE_STORE = gql`
|
|
13
|
+
query getStore($id: ID){
|
|
14
|
+
getStore(id: $id ){
|
|
15
|
+
cId
|
|
16
|
+
id
|
|
17
|
+
dId
|
|
18
|
+
idStore
|
|
19
|
+
ctId
|
|
20
|
+
neighborhoodStore
|
|
21
|
+
Viaprincipal
|
|
22
|
+
catStore
|
|
23
|
+
storeOwner
|
|
24
|
+
storeName
|
|
25
|
+
ImageName
|
|
26
|
+
emailStore
|
|
27
|
+
storePhone
|
|
28
|
+
socialRaz
|
|
29
|
+
Image
|
|
30
|
+
banner
|
|
31
|
+
|
|
32
|
+
documentIdentifier
|
|
33
|
+
uPhoNum
|
|
34
|
+
storeName
|
|
35
|
+
ULocation
|
|
36
|
+
upLat
|
|
37
|
+
upLon
|
|
38
|
+
uState
|
|
39
|
+
siteWeb
|
|
40
|
+
|
|
41
|
+
description
|
|
42
|
+
createdAt
|
|
43
|
+
secVia
|
|
44
|
+
NitStore
|
|
45
|
+
typeRegiments
|
|
46
|
+
typeContribute
|
|
47
|
+
addressStore
|
|
48
|
+
pais {
|
|
49
|
+
cId
|
|
50
|
+
cName
|
|
51
|
+
cCalCod
|
|
52
|
+
cState
|
|
53
|
+
cDatCre
|
|
54
|
+
cDatMod
|
|
55
|
+
}
|
|
56
|
+
city {
|
|
57
|
+
ctId
|
|
58
|
+
dId
|
|
59
|
+
cName
|
|
60
|
+
cState
|
|
61
|
+
cDatCre
|
|
62
|
+
cDatMod
|
|
63
|
+
}
|
|
64
|
+
department {
|
|
65
|
+
dId
|
|
66
|
+
cId
|
|
67
|
+
dName
|
|
68
|
+
dState
|
|
69
|
+
dDatCre
|
|
70
|
+
dDatMod
|
|
71
|
+
}
|
|
72
|
+
getStoreSchedules {
|
|
73
|
+
idStore
|
|
74
|
+
schId
|
|
75
|
+
id
|
|
76
|
+
schDay
|
|
77
|
+
schHoSta
|
|
78
|
+
schHoEnd
|
|
79
|
+
schState
|
|
80
|
+
}
|
|
81
|
+
cateStore {
|
|
82
|
+
catStore
|
|
83
|
+
cName
|
|
84
|
+
cState
|
|
85
|
+
cDatCre
|
|
86
|
+
cDatMod
|
|
87
|
+
csDescription
|
|
88
|
+
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
`
|
|
93
|
+
export const GET_ONE_STORE_BY_ID = gql`
|
|
94
|
+
query getOneStore($idStore: ID){
|
|
95
|
+
getOneStore(idStore: $idStore ){
|
|
96
|
+
cId
|
|
97
|
+
id
|
|
98
|
+
dId
|
|
99
|
+
idStore
|
|
100
|
+
ctId
|
|
101
|
+
neighborhoodStore
|
|
102
|
+
Viaprincipal
|
|
103
|
+
catStore
|
|
104
|
+
storeOwner
|
|
105
|
+
storeName
|
|
106
|
+
emailStore
|
|
107
|
+
storePhone
|
|
108
|
+
socialRaz
|
|
109
|
+
Image
|
|
110
|
+
banner
|
|
111
|
+
documentIdentifier
|
|
112
|
+
uPhoNum
|
|
113
|
+
ULocation
|
|
114
|
+
upLat
|
|
115
|
+
upLon
|
|
116
|
+
uState
|
|
117
|
+
siteWeb
|
|
118
|
+
description
|
|
119
|
+
secVia
|
|
120
|
+
NitStore
|
|
121
|
+
typeRegiments
|
|
122
|
+
typeContribute
|
|
123
|
+
addressStore
|
|
124
|
+
createAt
|
|
125
|
+
cateStore {
|
|
126
|
+
catStore
|
|
127
|
+
cName
|
|
128
|
+
cState
|
|
129
|
+
cDatCre
|
|
130
|
+
cDatMod
|
|
131
|
+
csDescription
|
|
132
|
+
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
`
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import debounce from 'lodash
|
|
2
|
-
import { useState } from 'react'
|
|
3
|
-
import { useEffect } from 'react'
|
|
1
|
+
import debounce from 'lodash'
|
|
2
|
+
import { useState, useEffect } from 'react'
|
|
4
3
|
import { getCurrentDomain } from '../../utils'
|
|
5
4
|
import { trigger } from '../useEvent'
|
|
5
|
+
import { Cookies } from '../../cookies'
|
|
6
|
+
|
|
6
7
|
// EXAMPLE
|
|
7
8
|
// https://codesandbox.io/s/nextjs-cart-system-tfg1e?file=/pages/_app.js
|
|
8
9
|
|
|
9
10
|
// Method to execute the event to add all items of the app.cart cookie
|
|
10
|
-
const updateCart = debounce((items = []) => {
|
|
11
|
+
const updateCart = debounce.debounce((items = []) => {
|
|
11
12
|
trigger({ eventType: 'app.cart', data: { loading: true, items } })
|
|
12
13
|
}, 3000)
|
|
13
14
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { useMutation } from '@apollo/client'
|
|
2
|
+
import { updateCacheMod } from '../../utils'
|
|
3
|
+
import { GET_EXTRAS_PRODUCT_FOOD_OPTIONAL, GET_EXTRAS_PRODUCT_FOOD_SUB_OPTIONAL } from '../useProductsFood/queriesStore'
|
|
4
|
+
|
|
5
|
+
export const useUpdateExtProductFoodsSubOptional = () => {
|
|
6
|
+
const [updateExtProductFoodsSubOptional] = useMutation(GET_EXTRAS_PRODUCT_FOOD_SUB_OPTIONAL)
|
|
7
|
+
|
|
8
|
+
const handleMutateExtProductFoodsSubOptional = ({
|
|
9
|
+
pId,
|
|
10
|
+
title,
|
|
11
|
+
listId,
|
|
12
|
+
id,
|
|
13
|
+
state = 1,
|
|
14
|
+
}) => {
|
|
15
|
+
updateExtProductFoodsSubOptional({
|
|
16
|
+
variables: {
|
|
17
|
+
input: {
|
|
18
|
+
pId,
|
|
19
|
+
OptionalSubProName: title,
|
|
20
|
+
exCodeOptionExtra: listId,
|
|
21
|
+
exCode: id,
|
|
22
|
+
state
|
|
23
|
+
}
|
|
24
|
+
}, update: (cache, { data: { ExtProductFoodsOptionalAll } }) => {
|
|
25
|
+
return updateCacheMod({
|
|
26
|
+
cache,
|
|
27
|
+
query: GET_EXTRAS_PRODUCT_FOOD_OPTIONAL,
|
|
28
|
+
nameFun: 'ExtProductFoodsOptionalAll',
|
|
29
|
+
dataNew: ExtProductFoodsOptionalAll
|
|
30
|
+
})
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
handleMutateExtProductFoodsSubOptional
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { gql } from '@apollo/client'
|
|
2
|
+
|
|
3
|
+
export const LOGIN = gql`
|
|
4
|
+
mutation login($input: LoginInput){
|
|
5
|
+
login(input: $input){
|
|
6
|
+
token
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
`
|
|
10
|
+
export const GET_USER = gql`
|
|
11
|
+
query getUser($id: ID){
|
|
12
|
+
getUser(id: $id ){
|
|
13
|
+
id
|
|
14
|
+
name
|
|
15
|
+
username
|
|
16
|
+
lastName
|
|
17
|
+
email
|
|
18
|
+
avatar
|
|
19
|
+
uToken
|
|
20
|
+
uPhoNum
|
|
21
|
+
ULocation
|
|
22
|
+
upLat
|
|
23
|
+
uState
|
|
24
|
+
upLon
|
|
25
|
+
upIdeDoc
|
|
26
|
+
siteWeb
|
|
27
|
+
description
|
|
28
|
+
password
|
|
29
|
+
createAt
|
|
30
|
+
role {
|
|
31
|
+
id
|
|
32
|
+
name
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
`
|
|
37
|
+
export const GET_ALL_USER = gql`
|
|
38
|
+
query getAllUser($search: String){
|
|
39
|
+
getAllUser(search: $search){
|
|
40
|
+
id
|
|
41
|
+
name
|
|
42
|
+
username
|
|
43
|
+
lastName
|
|
44
|
+
email
|
|
45
|
+
email
|
|
46
|
+
siteWeb
|
|
47
|
+
description
|
|
48
|
+
uPhoNum
|
|
49
|
+
upLat
|
|
50
|
+
upLon
|
|
51
|
+
createAt
|
|
52
|
+
avatar
|
|
53
|
+
latestMessage {
|
|
54
|
+
uuid
|
|
55
|
+
content
|
|
56
|
+
from
|
|
57
|
+
to
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
`
|
|
62
|
+
export const UPDATE_AVATAR = gql`
|
|
63
|
+
mutation updateAvatar($file: Upload){
|
|
64
|
+
UpdateAvatar(file: $file){
|
|
65
|
+
status
|
|
66
|
+
urlAvatar
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
`
|