npm-pkg-hook 1.0.2 → 1.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/.babelrc +13 -13
- package/.env +1 -0
- package/.eslintrc.js +132 -0
- package/.eslintrc.json +107 -107
- package/.github/pull_request_template.md +17 -17
- package/.github/workflows/pepeline.yaml +29 -29
- package/.vscode/extensions.json +6 -0
- package/.vscode/settings.json +12 -0
- package/README.md +1 -1
- package/jsconfig.json +27 -27
- package/next.config.js +128 -128
- package/package.json +8 -6
- package/script.txt +7 -0
- package/src/cookies/index.ts +3 -3
- package/src/hooks/index.js +47 -19
- package/src/hooks/updateExtProductFoodsOptional/index.js +38 -0
- package/src/hooks/useAcumulateDate/index.js +16 -16
- package/src/hooks/useAnimationText/index.jsx +31 -30
- 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 +77 -77
- package/src/hooks/useCategoryStore/index.js +7 -7
- package/src/hooks/useCategoryStore/queries.js +16 -16
- package/src/hooks/useChartData/index.js +170 -0
- package/src/hooks/useCheckbox/index.js +114 -114
- package/src/hooks/useClients/index.js +13 -13
- package/src/hooks/useClients/queries.js +117 -117
- 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 +62 -57
- package/src/hooks/useEvent/index.js +33 -33
- package/src/hooks/useFetchJson/index.js +24 -24
- package/src/hooks/useFetchMoreInteractions/index.jsx +37 -34
- package/src/hooks/useFormTools/index.js +83 -70
- package/src/hooks/useFormatDate/index.js +34 -0
- package/src/hooks/useFullScreenMode/index.js +65 -65
- package/src/hooks/useHover/index.js +28 -28
- 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/useInnerHtml/index.js +37 -37
- package/src/hooks/useIntersection/index.js +84 -31
- package/src/hooks/useKeypress/index.js +27 -27
- package/src/hooks/useLazyScript/index.js +72 -0
- package/src/hooks/useLocalSorage/index.js +35 -35
- package/src/hooks/useLocationNavigate/index.js +54 -54
- package/src/hooks/useMobile/index.js +37 -37
- package/src/hooks/useMutateHeight/index.js +37 -0
- package/src/hooks/useProductsFood/index.js +190 -0
- package/src/hooks/{useGetProductsFood → useProductsFood}/queriesStore.js +780 -765
- package/src/hooks/useProductsFood/usetagsProducts.js +57 -0
- package/src/hooks/useReactToPrint/index.js +1201 -0
- package/src/hooks/useReport/index.js +35 -0
- package/src/hooks/useReport/queries.js +122 -0
- package/src/hooks/useRestaurant/index.js +19 -19
- package/src/hooks/useRestaurant/queries.js +79 -69
- package/src/hooks/useSales/index.js +589 -489
- package/src/hooks/useSales/queries.js +290 -229
- 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/useSetState/index.js +24 -24
- package/src/hooks/useStore/index.js +17 -17
- package/src/hooks/useStore/queries.js +135 -135
- package/src/hooks/useStoreCalendar/index.js +7 -0
- package/src/hooks/useTimeAgo/useTimeAgo.js +39 -39
- package/src/hooks/useUpdateCart/index.js +124 -124
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +37 -0
- package/src/hooks/useUser/index.js +7 -3
- package/src/hooks/useUser/queries.js +69 -0
- package/src/hooks/useWindowSize/index.js +37 -37
- 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 +106 -54
- package/src/hooks/useGetCategorieStore/index.js +0 -21
- package/src/hooks/useGetProductsFood/index.js +0 -46
|
@@ -1,230 +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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
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
|
+
}
|
|
230
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
|
+
}
|