npm-pkg-hook 1.0.0 → 1.0.2

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.
Files changed (47) hide show
  1. package/.babelrc +14 -0
  2. package/.eslintrc.json +108 -0
  3. package/.github/pull_request_template.md +18 -0
  4. package/.github/workflows/pepeline.yaml +30 -0
  5. package/README.md +1 -0
  6. package/jsconfig.json +28 -0
  7. package/next.config.js +129 -0
  8. package/package.json +33 -3
  9. package/src/cookies/index.ts +3 -0
  10. package/src/hooks/index.js +19 -0
  11. package/src/hooks/useAcumulateDate/index.js +16 -0
  12. package/src/hooks/useAnimationText/index.jsx +30 -0
  13. package/src/hooks/useCategoryStore/index.js +7 -0
  14. package/src/hooks/useCategoryStore/queries.js +16 -0
  15. package/src/hooks/useCheckbox/index.js +114 -0
  16. package/src/hooks/useClients/index.js +13 -0
  17. package/src/hooks/useClients/queries.js +118 -0
  18. package/src/hooks/useDrag/index.js +57 -0
  19. package/src/hooks/useEvent/index.js +33 -0
  20. package/src/hooks/useFetchJson/index.js +25 -0
  21. package/src/hooks/useFetchMoreInteractions/index.jsx +35 -0
  22. package/src/hooks/useFormTools/index.js +71 -0
  23. package/src/hooks/useFullScreenMode/index.js +66 -0
  24. package/src/hooks/useGetCategorieStore/index.js +21 -0
  25. package/src/hooks/useGetCategorieStore/queries.js +78 -0
  26. package/src/hooks/useGetProductsFood/index.js +46 -0
  27. package/src/hooks/useGetProductsFood/queriesStore.js +766 -0
  28. package/src/hooks/useHover/index.js +29 -0
  29. package/src/hooks/useInnerHtml/index.js +38 -0
  30. package/src/hooks/useIntersection/index.js +31 -0
  31. package/src/hooks/useKeypress/index.js +28 -0
  32. package/src/hooks/useLocalSorage/index.js +36 -0
  33. package/src/hooks/useLocationNavigate/index.js +54 -0
  34. package/src/hooks/useMobile/index.js +38 -0
  35. package/src/hooks/useRestaurant/index.js +19 -0
  36. package/src/hooks/useRestaurant/queries.js +70 -0
  37. package/src/hooks/useSales/index.js +489 -0
  38. package/src/hooks/useSales/queries.js +230 -0
  39. package/src/hooks/useSetState/index.js +24 -0
  40. package/src/hooks/useStore/index.js +18 -0
  41. package/src/hooks/useStore/queries.js +136 -0
  42. package/src/hooks/useTimeAgo/useTimeAgo.js +39 -0
  43. package/src/hooks/useUpdateCart/index.js +124 -0
  44. package/src/hooks/useUser/index.js +3 -0
  45. package/src/hooks/useWindowSize/index.js +38 -0
  46. package/src/index.jsx +1 -6
  47. package/src/utils/index.js +54 -0
@@ -0,0 +1,489 @@
1
+ import {
2
+ useState,
3
+ useEffect,
4
+ useCallback,
5
+ useReducer
6
+ } from 'react'
7
+ import {
8
+ getCurrentDomain,
9
+ RandomCode,
10
+ updateCacheMod
11
+ } from '../../utils'
12
+ import { Cookies } from '../../cookies'
13
+ import { useGetProductsFood } from '../useGetProductsFood'
14
+ import { useStore } from '../useStore'
15
+ import moment from 'moment'
16
+ import {
17
+ CREATE_SHOPPING_CARD_TO_USER_STORE,
18
+ GET_ALL_SALES,
19
+ GET_ALL_SALES_STATISTICS
20
+ } from './queries'
21
+ import { useLazyQuery, useMutation } from '@apollo/client'
22
+ import { GET_ALL_EXTRA_PRODUCT, GET_EXTRAS_PRODUCT_FOOD_OPTIONAL, GET_ONE_PRODUCTS_FOOD } from '../useGetProductsFood/queriesStore'
23
+
24
+ const initialState = {
25
+ PRODUCT: [],
26
+ totalPrice: 0,
27
+ sortBy: null,
28
+ itemsInCart: 0,
29
+ animateType: '',
30
+ startAnimateUp: '',
31
+ priceRange: 0,
32
+ counter: 0,
33
+ totalAmount: 0,
34
+ payMethodPState: 0
35
+ }
36
+
37
+ const initializer = (initialValue = initialState) => { return JSON.parse(Cookies.get(process.env.LOCAL_SALES_STORE) || JSON.stringify(initialState)) || initialValue }
38
+
39
+ export const useSales = () => {
40
+ const domain = getCurrentDomain()
41
+ const [modalItem, setModalItem] = useState(false)
42
+ const keyToSaveData = process.env.LOCAL_SALES_STORE
43
+ const saveDataState = JSON.parse(Cookies.get(keyToSaveData) || '[]')
44
+ const [search, setSearch] = useState('')
45
+ const [arr] = useState([])
46
+ const [totalProductPrice, setTotalProductPrice] = useState(0)
47
+ const [showMore, setShowMore] = useState(50)
48
+ const [inputValue, setInputValue] = useState('')
49
+ const [delivery, setDelivery] = useState(false)
50
+ const [print, setPrint] = useState(false)
51
+ const [values, setValues] = useState({})
52
+ const [dataStore] = useStore()
53
+ const { createdAt } = dataStore || {}
54
+ const [valuesDates, setValuesDates] = useState(() => { return { fromDate: moment(createdAt || null).format('YYYY-MM-DD'), toDate: moment().format('YYYY-MM-DD') } })
55
+ const [registerSalesStore] = useMutation(CREATE_SHOPPING_CARD_TO_USER_STORE)
56
+ const [product, setProduct] = useState({
57
+ PRODUCT: {},
58
+ })
59
+ const [productFoodsOne, { data: dataProduct, loading: loadingProduct }] = useLazyQuery(GET_ONE_PRODUCTS_FOOD)
60
+ const [ExtProductFoodsOptionalAll, { data: dataOptional }] = useLazyQuery(GET_EXTRAS_PRODUCT_FOOD_OPTIONAL)
61
+ const [ExtProductFoodsAll, { data: dataExtra }] = useLazyQuery(GET_ALL_EXTRA_PRODUCT)
62
+
63
+ const [productsFood, { loading, fetchMore }] = useGetProductsFood({
64
+ search: search?.length >= 4 ? search : '',
65
+ gender: [],
66
+ desc: [],
67
+ categories: arr || [],
68
+ toDate: valuesDates?.toDate,
69
+ fromDate: valuesDates?.fromDate,
70
+ max: showMore,
71
+ min: 0
72
+ })
73
+
74
+ const max = productsFood?.reduce(function (a, b) {
75
+ return Math.max(a, b?.ProPrice || 0)
76
+ }, 0)
77
+ const initialStateSales = {
78
+ PRODUCT: [],
79
+ totalPrice: 0,
80
+ sortBy: null,
81
+ itemsInCart: 0,
82
+ animateType: '',
83
+ startAnimateUp: '',
84
+ priceRange: max || 0,
85
+ counter: 0,
86
+ totalAmount: 0,
87
+ payMethodPState: 0
88
+ }
89
+ // HANDLESS
90
+ // FILTER PRODUCT DATA_DB
91
+ const handleChangeFilter = (e) => { return setSearch(e.target.value) }
92
+ const handleChange = e => { return setValues({ ...values, [e.target.name]: e.target.value }) }
93
+ const onChangeInput = (e) => { return setValuesDates({ ...valuesDates, [e.target.name]: e.target.value }) }
94
+ const handleChangeFilterProduct = (e) => {
95
+ let text = searchedInput(e.target.value)
96
+ if (text === undefined || text === '') {
97
+ return
98
+ }
99
+ let filteredData = handleList(text)
100
+ setFilteredList(filteredData)
101
+ }
102
+
103
+ const handleChangeNumber = useCallback((state, action) => {
104
+ const event = action.payload
105
+ const { value, index, id } = event || {}
106
+ const productExist = productsFood?.find((items) => {
107
+ return items.pId === id
108
+ })
109
+ const OneProduct = state?.PRODUCT.find((items) => {
110
+ return items.pId === id
111
+ })
112
+ if (value <= 0) {
113
+ dispatch({ type: 'REMOVE_PRODUCT_TO_CART', payload: OneProduct })
114
+ }
115
+ const finalQuantity = state.PRODUCT['ProQuantity'] = value || 0
116
+ const ARR_PRODUCT = state?.PRODUCT?.map((items, i) => {
117
+ return i === index
118
+ ? {
119
+ ...items,
120
+ ProQuantity: (finalQuantity),
121
+ ProPrice: value ? (value * productExist?.ProPrice) : productExist?.ProPrice
122
+ }
123
+ : items
124
+ })
125
+ return {
126
+ ...state,
127
+ PRODUCT: ARR_PRODUCT,
128
+ counter: state.counter + 1
129
+ }
130
+ }, [productsFood])
131
+ const PRODUCT = (state, action) => {
132
+ const productExist = state.PRODUCT.find((items) => {
133
+ return items.pId === action.id
134
+ })
135
+ const OurProduct = productsFood.find((items) => {
136
+ return items.pId === action.id
137
+ })
138
+ const isFree = productExist?.free
139
+
140
+ switch (action.type) {
141
+ case 'ADD_TO_CART':
142
+ return addToCartFunc(state, action)
143
+ case 'ADD_PRODUCT':
144
+ return {
145
+ ...state,
146
+ // eslint-disable-next-line
147
+ PRODUCT: [...state?.PRODUCT, action?.payload],
148
+ }
149
+ case 'REMOVE_PRODUCT':
150
+ return removeFunc(state, action)
151
+ case 'REMOVE_PRODUCT_TO_CART':
152
+ return {
153
+ ...state,
154
+ PRODUCT: state?.PRODUCT?.filter((t) => {
155
+ return t.pId !== action?.payload.pId
156
+ }),
157
+ counter: state.counter - action.payload.ProQuantity
158
+ }
159
+ case 'ON_CHANGE': {
160
+ return handleChangeNumber(state, action)
161
+ }
162
+ case 'REMOVE_ALL_PRODUCTS':
163
+ return {
164
+ ...state,
165
+ PRODUCT: [],
166
+ counter: 0
167
+ }
168
+
169
+ case 'TOGGLE_FREE_PRODUCT':
170
+ return toggleFreeProducts(state, action)
171
+ case 'INCREMENT':
172
+ return {
173
+ ...state,
174
+ counter: state.counter + 1,
175
+ PRODUCT: state?.PRODUCT?.map((items) => {
176
+ return items.pId === action.id
177
+ ? {
178
+ ...items,
179
+ ProQuantity: items.ProQuantity + 1,
180
+ ProPrice: isFree ? 0 : (productExist.ProQuantity + 1) * OurProduct?.ProPrice
181
+ }
182
+ : items
183
+ })
184
+ }
185
+ case 'PRICE_RANGE':
186
+ return {
187
+ ...state,
188
+ priceRange: action.payload
189
+ }
190
+ case 'SORT':
191
+ return { ...state, sortBy: action.payload }
192
+ case 'DECREMENT':
193
+ return {
194
+ ...state
195
+ // counter: state.counter - 1,
196
+ // PRODUCT: state?.PRODUCT?.map((items) => {
197
+ // return items.pId === action.id ? {
198
+ // ...items,
199
+ // ProQuantity: items.ProQuantity - 1,
200
+ // // ProPrice: ((productExist.ProQuantity + 1) * OurProduct?.ProPrice),
201
+ // } : items
202
+ // })
203
+ }
204
+ case 'PAYMENT_METHOD_TRANSACTION':
205
+ return {
206
+ ...state,
207
+ payMethodPState: 1
208
+ }
209
+ case 'PAYMENT_METHOD_MONEY':
210
+ return {
211
+ ...state,
212
+ payMethodPState: 0
213
+ }
214
+ default:
215
+ return state
216
+ }
217
+ }
218
+ const [data, dispatch] = useReducer(PRODUCT, initialStateSales, initializer)
219
+ useEffect(() => {
220
+ Cookies.set(keyToSaveData, JSON.stringify(data), { domain, path: '/' })
221
+ }, [data, domain])
222
+
223
+
224
+ function addToCartFunc(state, action) {
225
+ const productExist = state.PRODUCT.find((items) => {
226
+ return items.pId === action.payload.pId
227
+ })
228
+ const OurProduct = productsFood.find((items) => {
229
+ return items.pId === action.payload.pId
230
+ })
231
+ const isFree = productExist?.free
232
+ return {
233
+ ...state,
234
+ counter: state.counter + 1,
235
+ totalAmount: state.totalAmount + action.payload.ProPrice,
236
+ startAnimateUp: 'start-animate-up',
237
+ PRODUCT: !productExist
238
+ ? [
239
+ ...state.PRODUCT,
240
+ {
241
+ pId: action.payload.pId,
242
+ pName: action.payload.pName,
243
+ ProDescription: action.payload.ProDescription,
244
+ ProImage: action.payload.ProImage,
245
+ ProPrice: action.payload.ProPrice,
246
+ ProQuantity: 1
247
+ }
248
+ ]
249
+ : state.PRODUCT.map((items) => {
250
+ return items.pId === action.payload.pId
251
+ ? {
252
+ ...items,
253
+ ProPrice: isFree ? 0 : (productExist.ProQuantity + 1) * OurProduct?.ProPrice,
254
+ ProQuantity: productExist.ProQuantity + 1,
255
+ free: isFree ? true : false
256
+ }
257
+ : items
258
+ })
259
+ }
260
+ }
261
+ function removeFunc(state, action) {
262
+ const productExist = state.PRODUCT.find((items) => {
263
+ return items.pId === action.payload.pId
264
+ })
265
+ const OurProduct = productsFood.find((items) => {
266
+ return items.pId === action.payload.pId
267
+ })
268
+ return {
269
+ ...state,
270
+ counter: state.counter - 1,
271
+ totalAmount: state.totalAmount - action.payload.ProPrice,
272
+ PRODUCT: action.payload.ProQuantity > 1
273
+ ? state.PRODUCT.map((items) => {
274
+ return items.pId === action.payload.pId
275
+ ? {
276
+ ...items,
277
+ pId: action.payload.pId,
278
+ ProQuantity: items.ProQuantity - 1,
279
+ ProPrice: (productExist.ProPrice - OurProduct?.ProPrice)
280
+ }
281
+ : items
282
+ })
283
+ : state.PRODUCT.filter((items) => {
284
+ return items.pId !== action.payload.pId
285
+ })
286
+ }
287
+ }
288
+ // TOGGLE_FREE_PRODUCT
289
+ function toggleFreeProducts(state, action) {
290
+ const productExist = productsFood.find((items) => {
291
+ return items.pId === action.payload.pId
292
+ })
293
+ return {
294
+ ...state,
295
+ PRODUCT: state?.PRODUCT?.map((items) => {
296
+ return items.pId === action.payload.pId
297
+ ? {
298
+ ...items,
299
+ free: !items.free,
300
+ ProPrice: items.ProPrice
301
+ ? 0
302
+ : items.ProQuantity * productExist?.ProPrice
303
+ }
304
+ : items
305
+ })
306
+ }
307
+ }
308
+
309
+ const getSortedProduct = (sortData, sortBy) => {
310
+ if (sortBy && sortBy === 'PRICE_HIGH_TO_LOW') {
311
+ return (
312
+ sortData ??
313
+ sortData.sort((a, b) => {
314
+ return b['ProPrice'] - a['ProPrice']
315
+ })
316
+ )
317
+ }
318
+ if (sortBy && sortBy === 'PRICE_LOW_TO_HIGH') {
319
+ return (
320
+ sortData ??
321
+ sortData.sort((a, b) => {
322
+ return a['ProPrice'] - b['ProPrice']
323
+ })
324
+ )
325
+ }
326
+ return sortData
327
+ }
328
+ const PriceRangeFunc = (products, price) => {
329
+ return (
330
+ products?.length > 0 &&
331
+ products?.filter((items) => {
332
+ return items?.ProPrice >= price
333
+ })
334
+ )
335
+ }
336
+ const [_, setFilteredList] = useState([]);
337
+ const sortedProduct = getSortedProduct(data.PRODUCT, data.sortBy)
338
+ const finalFilter = PriceRangeFunc(sortedProduct, data.priceRange)
339
+
340
+ const handleList = (text) => {
341
+ let inputText = text.toLowerCase()
342
+ let dataList = []
343
+ dataList = finalFilter.filter((item) => {
344
+ return item.pName.toLowerCase().includes(inputText)
345
+ })
346
+ return dataList
347
+ }
348
+ const searchedInput = (words) => {
349
+ setInputValue(words)
350
+ let n = words.split(' ')
351
+ if (n.length !== 0) {
352
+ if (n[n.length - 1] === '') {
353
+ n.pop()
354
+ }
355
+ return n[n.length - 1]
356
+ }
357
+ return ''
358
+ }
359
+ const newArrayProducts =
360
+ data?.PRODUCT?.length > 0 &&
361
+ data?.PRODUCT?.map((x) => {
362
+ return {
363
+ pId: x?.pId,
364
+ id: values?.cliId,
365
+ cantProducts: x?.ProQuantity,
366
+ comments: 'Comentarios'
367
+ }
368
+ })
369
+
370
+ const handleSubmit = () => {
371
+ const code = RandomCode(5)
372
+ return registerSalesStore({
373
+ variables: {
374
+ input: newArrayProducts || [],
375
+ id: values?.cliId,
376
+ pCodeRef: code,
377
+ change: values.change,
378
+ valueDelivery: parseInt(values.valueDelivery),
379
+ payMethodPState: data.payMethodPState,
380
+ pickUp: 1,
381
+ totalProductsPrice: data?.totalAmount || 0
382
+ },
383
+ update: (cache, { data: { getAllSalesStoreStatistic } }) => {
384
+ return updateCacheMod(
385
+ {
386
+ cache,
387
+ query: GET_ALL_SALES_STATISTICS,
388
+ nameFun: 'getAllSalesStoreStatistic',
389
+ dataNew: getAllSalesStoreStatistic,
390
+ type: 2
391
+ },
392
+ cache.modify({
393
+ fields: {
394
+ getAllSalesStore(dataOld = []) {
395
+ return cache.writeQuery({
396
+ query: GET_ALL_SALES,
397
+ data: dataOld
398
+ })
399
+ }
400
+ }
401
+ })
402
+ )
403
+ }
404
+ })
405
+ .then((responseRegisterR) => {
406
+ if (responseRegisterR) {
407
+ const { data } = responseRegisterR || {}
408
+ const { registerSalesStore } = data || {}
409
+ const { Response } = registerSalesStore || {}
410
+ if (Response.success === true) {
411
+ console.log({ message: `${Response.message}`, color: 'success' })
412
+ dispatch({ type: 'REMOVE_ALL_PRODUCTS' })
413
+ setValues({})
414
+ }
415
+ }
416
+ })
417
+ }
418
+ let suma = 0
419
+ let total = 0
420
+ useEffect(() => {
421
+ data.PRODUCT.forEach((a) => {
422
+ const { ProPrice } = a || {}
423
+ suma += ProPrice
424
+ setTotalProductPrice(Math.abs(suma))
425
+ })
426
+ if (data.PRODUCT.length === 0) {
427
+ setTotalProductPrice(0)
428
+ }
429
+ }, [totalProductPrice, suma, total, data])
430
+
431
+
432
+ const handleProduct = (PRODUCT) => {
433
+ const { pId } = PRODUCT || {}
434
+ try {
435
+ productFoodsOne({ variables: { pId } })
436
+ ExtProductFoodsOptionalAll({ variables: { pId } })
437
+ ExtProductFoodsAll({ variables: { pId } })
438
+ setProduct(() => {
439
+ return {
440
+ PRODUCT,
441
+ }})
442
+ } catch (error) {
443
+ console.log({ message: 'Lo sentimos, ocurrió un error' })
444
+ }
445
+ }
446
+
447
+ return {
448
+ loading,
449
+ fetchMore,
450
+ totalProductPrice,
451
+ saveDataState,
452
+ product,
453
+ data,
454
+ inputValue,
455
+ newArrayProducts,
456
+ delivery,
457
+ valuesDates,
458
+ print,
459
+ finalFilter,
460
+ showMore,
461
+ max,
462
+ values,
463
+ initialStateSales,
464
+ productsFood,
465
+ modalItem,
466
+
467
+ dataProduct: dataProduct?.productFoodsOne || {},
468
+ dataOptional: dataOptional?.ExtProductFoodsOptionalAll || [],
469
+ dataExtra: dataExtra?.ExtProductFoodsAll || [],
470
+
471
+ dispatch,
472
+ setModalItem,
473
+ handleChangeFilter,
474
+ handleProduct,
475
+ handleChange,
476
+ onChangeInput,
477
+ setDelivery,
478
+ setValues,
479
+ setShowMore,
480
+ PriceRangeFunc,
481
+ handleSubmit,
482
+ handleChangeFilterProduct,
483
+ setTotalProductPrice,
484
+ setInputValue,
485
+ getSortedProduct,
486
+ setPrint,
487
+ PRODUCT
488
+ }
489
+ }
@@ -0,0 +1,230 @@
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
+ export const GET_ALL_SALES_STATISTICS = gql`
13
+ query getAllSalesStoreStatistic($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: DateTime, $toDate: DateTime ) {
14
+ getAllSalesStoreStatistic(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
15
+ pdpId
16
+ idStore
17
+ pCodeRef
18
+ payMethodPState
19
+ pPRecoger
20
+ totalProductsPrice
21
+ pSState
22
+ pDatCre
23
+ locationUser
24
+ pDatMod
25
+ getAllPedidoStore{
26
+ pdpId
27
+ pId
28
+ idStore
29
+ ShoppingCard
30
+ pCodeRef
31
+ pPStateP
32
+ payMethodPState
33
+ pPRecoger
34
+ pDatCre
35
+ pDatMod
36
+ getAllShoppingCard {
37
+ ShoppingCard
38
+ comments
39
+ cantProducts
40
+ pId
41
+ productFood{
42
+ pId
43
+ carProId
44
+ colorId
45
+ idStore
46
+ pName
47
+ ProPrice
48
+ ProDescuento
49
+ ProDescription
50
+ ValueDelivery
51
+ ProImage
52
+ ProStar
53
+ pState
54
+ pDatCre
55
+ pDatMod
56
+ }
57
+ }
58
+ }
59
+ }
60
+ }
61
+ `
62
+
63
+ export const GET_ONE_SALES = gql`
64
+ query getOneSalesStore($pCodeRef: String) {
65
+ getOneSalesStore(pCodeRef: $pCodeRef) {
66
+ pdpId
67
+ idStore
68
+ pCodeRef
69
+ payMethodPState
70
+ pPRecoger
71
+ totalProductsPrice
72
+ pSState
73
+ pDatCre
74
+ locationUser
75
+ pDatMod
76
+ getAllPedidoStore{
77
+ pdpId
78
+ pId
79
+ idStore
80
+ ShoppingCard
81
+ pCodeRef
82
+ pPStateP
83
+ payMethodPState
84
+ pPRecoger
85
+ pDatCre
86
+ pDatMod
87
+ getAllShoppingCard {
88
+ ShoppingCard
89
+ comments
90
+ cantProducts
91
+ pId
92
+ productFood{
93
+ pId
94
+ carProId
95
+ colorId
96
+ idStore
97
+ pName
98
+ ProPrice
99
+ ProDescuento
100
+ ProDescription
101
+ ValueDelivery
102
+ ProImage
103
+ ProStar
104
+ pState
105
+ pDatCre
106
+ pDatMod
107
+ }
108
+ }
109
+ }
110
+ }
111
+ }
112
+ `
113
+
114
+
115
+ export const CREATE_CLIENTS = gql`
116
+ mutation createClients ($input: IClients) {
117
+ createClients(input: $input) {
118
+ cliId
119
+ idStore
120
+ idUser
121
+ clState
122
+ ClientAddress
123
+ clientNumber
124
+ ccClient
125
+ gender
126
+ clientLastName
127
+ clientName
128
+ createAt
129
+ updateAt
130
+ }
131
+ }
132
+ `
133
+ export const DELETE_ONE_CLIENTS = gql`
134
+ mutation deleteClient($cliId: ID, $clState: Int!) {
135
+ deleteClient(cliId: $cliId, clState: $clState) {
136
+ success
137
+ message
138
+ }
139
+ }
140
+ `
141
+ export const GET_ALL_CLIENTS = gql`
142
+ query getAllClients($idStore: ID, $cId: ID, $dId: ID, $ctId: ID, $search: String, $min: Int, $max: Int, $fromDate: DateTime, $toDate: DateTime ) {
143
+ getAllClients(idStore: $idStore, cId: $cId, dId: $dId, ctId: $ctId, search: $search, min: $min, max: $max, fromDate: $fromDate, toDate: $toDate) {
144
+ cliId
145
+ idStore
146
+ gender
147
+ # idUser
148
+ clState
149
+ clientNumber
150
+ ccClient
151
+ clientLastName
152
+ clientName
153
+ ClientAddress
154
+ createAt
155
+ updateAt
156
+
157
+ }
158
+ }
159
+ `
160
+ export const GET_ONE_CLIENT = gql`
161
+ query getOneClients($cliId: ID) {
162
+ getOneClients(cliId: $cliId) {
163
+ cliId
164
+ idStore
165
+ idUser
166
+ clState
167
+ clientNumber
168
+ ClientAddress
169
+ gender
170
+ ccClient
171
+ clientLastName
172
+ clientName
173
+ createAt
174
+ updateAt
175
+
176
+ }
177
+ }
178
+ `
179
+
180
+ export const CREATE_SHOPPING_CARD = gql`
181
+ mutation registerShoppingCard($input: IShoppingCard, $idSubArray: IID_SUB_ITEMS){
182
+ registerShoppingCard(input: $input, idSubArray: $idSubArray){
183
+ ShoppingCard
184
+ id
185
+ pId
186
+ subProductsId
187
+ ShoppingCardRefCode
188
+ uuid
189
+ discountCardProduct
190
+ idUser
191
+ cName
192
+ idStore
193
+ cState
194
+ cDatCre
195
+ cDatMod
196
+ csDescription
197
+ cantProducts
198
+ comments
199
+ # idSubArray
200
+ }
201
+ }
202
+ `
203
+ export const CREATE_SHOPPING_CARD_TO_USER_STORE = gql`
204
+ mutation registerSalesStore($input: [IShoppingCard], $id: ID, $idStore: ID, $pCodeRef: String, $change: String, $valueDelivery: Float, $payMethodPState: Int, $pickUp: Int, $totalProductsPrice: Float, $idSubArray: IID_SUB_ITEMS){
205
+ registerSalesStore(input: $input, id: $id, idStore: $idStore, pCodeRef: $pCodeRef, change: $change, valueDelivery: $valueDelivery, payMethodPState: $payMethodPState, pickUp: $pickUp, totalProductsPrice: $totalProductsPrice, idSubArray: $idSubArray){
206
+ ShoppingCard {
207
+ ShoppingCard
208
+ id
209
+ pId
210
+ subProductsId
211
+ ShoppingCardRefCode
212
+ uuid
213
+ discountCardProduct
214
+ idUser
215
+ cName
216
+ idStore
217
+ cState
218
+ cDatCre
219
+ cDatMod
220
+ csDescription
221
+ cantProducts
222
+ comments
223
+ }
224
+ Response {
225
+ success
226
+ message
227
+ }
228
+ }
229
+ }
230
+ `