npm-pkg-hook 1.10.2 → 1.10.6
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/hooks/index.js +7 -0
- package/src/hooks/useCatWithProduct/queries.js +3 -2
- package/src/hooks/useCatWithProductClient/queries.js +1 -0
- package/src/hooks/useChartData/useChartDataAllOrders/index.js +1 -1
- package/src/hooks/useCreateProduct/index.js +35 -13
- package/src/hooks/useDepartments/queries.js +5 -4
- package/src/hooks/useImagesStore/queries.js +1 -65
- package/src/hooks/useInventory/index.js +2 -0
- package/src/hooks/useInventory/queries.js +58 -0
- package/src/hooks/useInventory/useGetProductsInStock.js +15 -0
- package/src/hooks/useInventory/useUpdateManageStock.js +41 -0
- package/src/hooks/useLocationManager/index.js +2 -2
- package/src/hooks/useModules/helpers/validateModules.js +15 -15
- package/src/hooks/useOrders/queries.js +1 -1
- package/src/hooks/useProductsFood/index.js +13 -5
- package/src/hooks/useProductsFood/queriesStore.js +20 -9
- package/src/hooks/useReport/index.js +1 -1
- package/src/hooks/useSales/index.js +130 -41
- package/src/hooks/useSetImageProducts/index.js +30 -0
- package/src/hooks/useSetImageProducts/queries.js +13 -0
- package/src/hooks/useStockMovements/helpers/index.js +16 -0
- package/src/hooks/useStockMovements/index.js +36 -0
- package/src/hooks/useTopProductsMovements/index.js +27 -0
- package/src/hooks/useTotalAllSales/index.js +25 -0
- package/src/hooks/useTotalProductsInStock/index.js +23 -0
- package/src/hooks/useTotalProductsSold/index.js +23 -0
- package/src/hooks/useTotalProductsSolded/index.js +20 -0
- package/src/hooks/useUpdateExistingOrders/index.js +1 -1
- package/src/hooks/useUpdateMultipleProducts/index.js +29 -8
- package/src/hooks/useUpdateMultipleProducts/queries.js +1 -1
- package/src/hooks/useUploadProducts/helpers/validateProductDataExcel.js +24 -16
- package/src/hooks/useUploadProducts/index.js +9 -4
- package/src/hooks/useUser/queries.js +1 -2
- package/src/index.jsx +3 -1
- package/src/utils/index.js +2 -5
package/package.json
CHANGED
package/src/hooks/index.js
CHANGED
|
@@ -122,3 +122,10 @@ export * from './useCart'
|
|
|
122
122
|
export * from './useGetStoreCookie'
|
|
123
123
|
export * from './getGlobalSession'
|
|
124
124
|
export * from './handleLogin'
|
|
125
|
+
export * from './useInventory'
|
|
126
|
+
export * from './useStockMovements'
|
|
127
|
+
export * from './useTopProductsMovements'
|
|
128
|
+
export * from './useTotalProductsSold'
|
|
129
|
+
export * from './useTotalProductsInStock/index'
|
|
130
|
+
export * from './useTotalAllSales/index'
|
|
131
|
+
export * from './useTotalProductsSolded'
|
|
@@ -119,7 +119,7 @@ query ExtProductFoodsAll($search: String, $min: Int, $max: Int, $pId: ID) {
|
|
|
119
119
|
export const GET_ALL_CATEGORIES_WITH_PRODUCT = gql`
|
|
120
120
|
query getCatProductsWithProduct($search: String, $productName: String, $min: Int, $max: Int, $gender: [String], $desc: [String], $categories: [ID], ) {
|
|
121
121
|
getCatProductsWithProduct(search: $search, min: $min, productName:$productName, max: $max, gender: $gender, desc: $desc, categories: $categories,) {
|
|
122
|
-
|
|
122
|
+
totalCount,
|
|
123
123
|
catProductsWithProduct {
|
|
124
124
|
carProId
|
|
125
125
|
pState
|
|
@@ -135,8 +135,9 @@ query getCatProductsWithProduct($search: String, $productName: String, $min: Int
|
|
|
135
135
|
pDatMod
|
|
136
136
|
productFoodsAll {
|
|
137
137
|
pId
|
|
138
|
+
stock
|
|
139
|
+
manageStock
|
|
138
140
|
sizeId
|
|
139
|
-
|
|
140
141
|
colorId
|
|
141
142
|
carProId
|
|
142
143
|
cId
|
|
@@ -5,7 +5,6 @@ import { convertBase64, RandomCode } from '../../utils'
|
|
|
5
5
|
import { useLocalStorage } from '../useLocalSorage'
|
|
6
6
|
import {
|
|
7
7
|
GET_ALL_FOOD_PRODUCTS,
|
|
8
|
-
UPDATE_IMAGE_PRODUCT_FOOD,
|
|
9
8
|
UPDATE_PRODUCT_FOOD
|
|
10
9
|
} from '../useProductsFood/queriesStore'
|
|
11
10
|
import { useStore } from '../useStore'
|
|
@@ -13,6 +12,8 @@ import { useTagsProducts } from './../useProductsFood/usetagsProducts'
|
|
|
13
12
|
import { useEditImageProduct } from './helpers/useEditImageProduct'
|
|
14
13
|
import { getCatProductsWithProduct } from './helpers/manageCacheDataCatProduct'
|
|
15
14
|
import { assignWith } from 'lodash'
|
|
15
|
+
import { UPDATE_IMAGE_PRODUCT_FOOD } from '../useSetImageProducts/queries'
|
|
16
|
+
import useSetImageProducts from '../useSetImageProducts'
|
|
16
17
|
export * from './helpers'
|
|
17
18
|
|
|
18
19
|
export const useCreateProduct = ({
|
|
@@ -38,6 +39,7 @@ export const useCreateProduct = ({
|
|
|
38
39
|
ValueDelivery: 0,
|
|
39
40
|
carProId: ''
|
|
40
41
|
})
|
|
42
|
+
const [updateImageProducts] = useSetImageProducts()
|
|
41
43
|
const [names, setName] = useLocalStorage('namefood', '')
|
|
42
44
|
const [showMore, setShowMore] = useState(50)
|
|
43
45
|
const [search, setSearch] = useState('')
|
|
@@ -52,7 +54,25 @@ export const useCreateProduct = ({
|
|
|
52
54
|
const [{ alt, src }, setPreviewImg] = useState(initialState)
|
|
53
55
|
const fileInputRef = useRef(null)
|
|
54
56
|
const [arrTags, setTags] = useState([])
|
|
57
|
+
const [stock, setStock] = useState(1)
|
|
58
|
+
// Manage stock optional value boolean
|
|
59
|
+
const [checkStock, setCheckStock] = useState(false)
|
|
55
60
|
|
|
61
|
+
const handleIncreaseStock = () => {
|
|
62
|
+
setStock(prevStock => prevStock + 1)
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const handleDecreaseStock = () => {
|
|
66
|
+
setStock(prevStock => (prevStock > 1 ? prevStock - 1 : 1))
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const handleCheckStock = () => {
|
|
70
|
+
setCheckStock(prev => {
|
|
71
|
+
const newCheckStock = !prev
|
|
72
|
+
setStock(newCheckStock ? 1 : stock)
|
|
73
|
+
return newCheckStock
|
|
74
|
+
})
|
|
75
|
+
}
|
|
56
76
|
const [dataStore] = useStore()
|
|
57
77
|
const {
|
|
58
78
|
data,
|
|
@@ -123,9 +143,7 @@ export const useCreateProduct = ({
|
|
|
123
143
|
|
|
124
144
|
const [updateProductFoods, { loading }] = useMutation(UPDATE_PRODUCT_FOOD, {
|
|
125
145
|
})
|
|
126
|
-
const [setImageProducts] = useMutation(UPDATE_IMAGE_PRODUCT_FOOD
|
|
127
|
-
context: { clientName: 'admin-server' }
|
|
128
|
-
})
|
|
146
|
+
const [setImageProducts] = useMutation(UPDATE_IMAGE_PRODUCT_FOOD)
|
|
129
147
|
|
|
130
148
|
const onFileInputChange = async event => {
|
|
131
149
|
const { files } = event.target
|
|
@@ -172,7 +190,7 @@ export const useCreateProduct = ({
|
|
|
172
190
|
}
|
|
173
191
|
const formatPrice = ProPrice ?? 0
|
|
174
192
|
if (!carProId && !names) return setErrors({ ...errors, carProId: true })
|
|
175
|
-
const ProImage =
|
|
193
|
+
const ProImage = '/images/placeholder-image.webp'
|
|
176
194
|
const pCode = RandomCode(9)
|
|
177
195
|
try {
|
|
178
196
|
const res = await updateProductFoods({
|
|
@@ -184,8 +202,10 @@ export const useCreateProduct = ({
|
|
|
184
202
|
ValueDelivery: check?.desc ? 0 : ValueDelivery,
|
|
185
203
|
ProDescription,
|
|
186
204
|
pName: names,
|
|
205
|
+
manageStock: checkStock,
|
|
187
206
|
pCode,
|
|
188
207
|
carProId,
|
|
208
|
+
stock,
|
|
189
209
|
pState: 1,
|
|
190
210
|
sTateLogistic: 1,
|
|
191
211
|
ProStar: 0,
|
|
@@ -234,14 +254,11 @@ export const useCreateProduct = ({
|
|
|
234
254
|
return
|
|
235
255
|
}
|
|
236
256
|
if (image !== null) {
|
|
257
|
+
console.log(image)
|
|
237
258
|
try {
|
|
238
|
-
await
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
file: image,
|
|
242
|
-
pCode
|
|
243
|
-
}
|
|
244
|
-
}
|
|
259
|
+
await updateImageProducts({
|
|
260
|
+
pId: res?.data?.updateProductFoods?.data?.pId,
|
|
261
|
+
image
|
|
245
262
|
})
|
|
246
263
|
} catch {
|
|
247
264
|
sendNotification({
|
|
@@ -254,7 +271,7 @@ export const useCreateProduct = ({
|
|
|
254
271
|
setPid(res?.data?.updateProductFoods?.data?.pId ?? null)
|
|
255
272
|
return res
|
|
256
273
|
} catch (error) {
|
|
257
|
-
console.log(
|
|
274
|
+
console.log('🚀 ~ handleRegister ~ error:', error)
|
|
258
275
|
setAlertBox({ message: 'Ha ocurrido un error', duration: 7000 })
|
|
259
276
|
}
|
|
260
277
|
}
|
|
@@ -283,9 +300,11 @@ export const useCreateProduct = ({
|
|
|
283
300
|
fileInputRef,
|
|
284
301
|
values,
|
|
285
302
|
search,
|
|
303
|
+
stock,
|
|
286
304
|
pId,
|
|
287
305
|
dataTags: data,
|
|
288
306
|
tags,
|
|
307
|
+
checkStock,
|
|
289
308
|
loading,
|
|
290
309
|
active,
|
|
291
310
|
idStore: dataStore?.getStore?.idStore || '',
|
|
@@ -297,6 +316,8 @@ export const useCreateProduct = ({
|
|
|
297
316
|
handleChangeFilter,
|
|
298
317
|
handleUpdateBanner,
|
|
299
318
|
onClickSearch,
|
|
319
|
+
handleDecreaseStock,
|
|
320
|
+
handleIncreaseStock,
|
|
300
321
|
changeHandler,
|
|
301
322
|
setErrors,
|
|
302
323
|
setCheck,
|
|
@@ -305,6 +326,7 @@ export const useCreateProduct = ({
|
|
|
305
326
|
onFileInputChange,
|
|
306
327
|
handleRegisterTags,
|
|
307
328
|
setShowMore,
|
|
329
|
+
handleCheckStock,
|
|
308
330
|
onTargetClick,
|
|
309
331
|
handleAddTag,
|
|
310
332
|
handleCheck,
|
|
@@ -74,71 +74,7 @@ export const GET_ALL_EMPLOYEE_STORE = gql`
|
|
|
74
74
|
}
|
|
75
75
|
}
|
|
76
76
|
`
|
|
77
|
-
|
|
78
|
-
query productFoodsAll(
|
|
79
|
-
$search: String
|
|
80
|
-
$min: Int
|
|
81
|
-
$max: Int
|
|
82
|
-
$gender: [String]
|
|
83
|
-
$pState: Int
|
|
84
|
-
$desc: [String]
|
|
85
|
-
$categories: [ID]
|
|
86
|
-
$fromDate: DateTime
|
|
87
|
-
$toDate: DateTime
|
|
88
|
-
) {
|
|
89
|
-
productFoodsAll(
|
|
90
|
-
search: $search
|
|
91
|
-
min: $min
|
|
92
|
-
max: $max
|
|
93
|
-
gender: $gender
|
|
94
|
-
desc: $desc
|
|
95
|
-
pState: $pState
|
|
96
|
-
categories: $categories
|
|
97
|
-
toDate: $toDate
|
|
98
|
-
fromDate: $fromDate
|
|
99
|
-
) {
|
|
100
|
-
pId
|
|
101
|
-
sizeId #Talla
|
|
102
|
-
colorId #Color
|
|
103
|
-
cId #Country
|
|
104
|
-
dId #Department
|
|
105
|
-
ctId #Cuidad
|
|
106
|
-
fId #Características
|
|
107
|
-
pName
|
|
108
|
-
ProPrice
|
|
109
|
-
ProDescuento
|
|
110
|
-
free
|
|
111
|
-
ProUniDisponibles
|
|
112
|
-
ProDescription
|
|
113
|
-
ProProtegido
|
|
114
|
-
ProAssurance
|
|
115
|
-
ValueDelivery
|
|
116
|
-
ProStar
|
|
117
|
-
sTateLogistic
|
|
118
|
-
ProImage
|
|
119
|
-
ProWidth
|
|
120
|
-
ProHeight
|
|
121
|
-
ProLength
|
|
122
|
-
ProWeight
|
|
123
|
-
ProQuantity
|
|
124
|
-
ProOutstanding
|
|
125
|
-
pDatCre
|
|
126
|
-
pDatMod
|
|
127
|
-
ProDelivery
|
|
128
|
-
ProVoltaje
|
|
129
|
-
pState
|
|
130
|
-
feat {
|
|
131
|
-
fId
|
|
132
|
-
thpId
|
|
133
|
-
hpqrQuestion
|
|
134
|
-
}
|
|
135
|
-
area {
|
|
136
|
-
aId
|
|
137
|
-
aName
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
`
|
|
77
|
+
|
|
142
78
|
export const GET_ALL_RATING_START_STORE = gql`
|
|
143
79
|
query getAllRatingStar($idStore: ID) {
|
|
144
80
|
getAllRatingStar(idStore: $idStore) {
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { useQuery, gql } from "@apollo/client";
|
|
2
|
+
|
|
3
|
+
export const GET_PRODUCTS_IN_STOCK = gql`
|
|
4
|
+
query getProductsInStock($limit: Int, $offset: Int) {
|
|
5
|
+
getProductsInStock(limit: $limit, offset: $offset) {
|
|
6
|
+
pId
|
|
7
|
+
sizeId #Talla
|
|
8
|
+
colorId #Color
|
|
9
|
+
carProId #Categoria a la cual pertenece el producto
|
|
10
|
+
caId
|
|
11
|
+
cId #Country
|
|
12
|
+
dId #Department
|
|
13
|
+
ctId #Cuidad
|
|
14
|
+
fId #Características
|
|
15
|
+
pName
|
|
16
|
+
getOneTags {
|
|
17
|
+
tPsId
|
|
18
|
+
idUser
|
|
19
|
+
idStore
|
|
20
|
+
pId
|
|
21
|
+
nameTag
|
|
22
|
+
}
|
|
23
|
+
ProPrice
|
|
24
|
+
ProDescuento
|
|
25
|
+
free
|
|
26
|
+
ProUniDisponibles
|
|
27
|
+
ProDescription
|
|
28
|
+
ProProtegido
|
|
29
|
+
ProAssurance
|
|
30
|
+
ValueDelivery
|
|
31
|
+
ProStar
|
|
32
|
+
sTateLogistic
|
|
33
|
+
ProImage
|
|
34
|
+
ProWidth
|
|
35
|
+
ProHeight
|
|
36
|
+
ProLength
|
|
37
|
+
ProWeight
|
|
38
|
+
ProQuantity
|
|
39
|
+
ProOutstanding
|
|
40
|
+
pDatCre
|
|
41
|
+
pDatMod
|
|
42
|
+
ProDelivery
|
|
43
|
+
ProVoltaje
|
|
44
|
+
pState
|
|
45
|
+
feat {
|
|
46
|
+
fId
|
|
47
|
+
thpId
|
|
48
|
+
hpqrQuestion
|
|
49
|
+
}
|
|
50
|
+
area {
|
|
51
|
+
aId
|
|
52
|
+
aName
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
`
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useQuery } from '@apollo/client'
|
|
2
|
+
import { GET_PRODUCTS_IN_STOCK } from './queries'
|
|
3
|
+
|
|
4
|
+
export const useGetProductsInStock = (storeId) => {
|
|
5
|
+
const { data, loading, error } = useQuery(GET_PRODUCTS_IN_STOCK, {
|
|
6
|
+
variables: { storeId },
|
|
7
|
+
skip: !storeId
|
|
8
|
+
})
|
|
9
|
+
|
|
10
|
+
return {
|
|
11
|
+
data: data?.getProductsInStock || [],
|
|
12
|
+
loading,
|
|
13
|
+
error
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { gql, useMutation } from '@apollo/client'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* GraphQL Mutation for updating stock and manageStock
|
|
5
|
+
*/
|
|
6
|
+
const UPDATE_MANAGE_STOCK = gql`
|
|
7
|
+
mutation UpdateManageStock($input: InputManageStock) {
|
|
8
|
+
updateManageStock(input: $input) {
|
|
9
|
+
success
|
|
10
|
+
message
|
|
11
|
+
data {
|
|
12
|
+
pId
|
|
13
|
+
manageStock
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
`
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Custom hook to update stock and manageStock
|
|
21
|
+
* @returns {object} { updateManageStock, data, loading, error }
|
|
22
|
+
*/
|
|
23
|
+
export const useUpdateManageStock = () => {
|
|
24
|
+
const [updateManageStockMutation, { data, loading, error }] = useMutation(UPDATE_MANAGE_STOCK)
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Function to call the mutation with given input
|
|
28
|
+
* @param {Object} input - { pId, stock, manageStock }
|
|
29
|
+
* @returns {Promise<Object>} Mutation response
|
|
30
|
+
*/
|
|
31
|
+
const updateManageStock = async (input) => {
|
|
32
|
+
try {
|
|
33
|
+
const { data } = await updateManageStockMutation({ variables: { input } })
|
|
34
|
+
return data?.updateManageStock
|
|
35
|
+
} catch (err) {
|
|
36
|
+
return { success: false, message: err.message }
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
return [updateManageStock, { data, loading, error }]
|
|
41
|
+
}
|
|
@@ -26,7 +26,7 @@ export function useLocationManager (getDepartments, getCities) {
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
const handleDepartmentSearch = (value) => {
|
|
29
|
-
getCities({ variables: { dId:
|
|
29
|
+
getCities({ variables: { dId: 'ddd5a096-efc6-4541-a568-c91895bc219e' } })
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
const handleChangeLocation = (e, error) => {
|
|
@@ -41,7 +41,7 @@ export function useLocationManager (getDepartments, getCities) {
|
|
|
41
41
|
case 'countryId':
|
|
42
42
|
handleCountrySearch(value)
|
|
43
43
|
break
|
|
44
|
-
case '
|
|
44
|
+
case 'code_dId':
|
|
45
45
|
handleDepartmentSearch(value)
|
|
46
46
|
break
|
|
47
47
|
default:
|
|
@@ -7,23 +7,23 @@
|
|
|
7
7
|
* @returns {Array} - Filtered list of valid modules.
|
|
8
8
|
*/
|
|
9
9
|
export const validateModules = (modules = [], permissions = {}) => {
|
|
10
|
-
return
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
if (!Array.isArray(modules) || module.length <= 0) return []
|
|
11
|
+
return modules?.map(module => {
|
|
12
|
+
// Check if the main module's view has "read" permission
|
|
13
|
+
const hasReadPermission = permissions[module.view]?.includes('read')
|
|
14
14
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
// Validate and filter subModules if they exist
|
|
16
|
+
const validSubModules = module.subModules?.filter(subModule =>
|
|
17
|
+
permissions[subModule.view]?.includes('read')
|
|
18
|
+
) || []
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
// If the module or its subModules don't have read permission, exclude it
|
|
21
|
+
if (!hasReadPermission && validSubModules.length === 0) {
|
|
22
|
+
return null
|
|
23
|
+
}
|
|
24
24
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
// Return the module with its valid subModules
|
|
26
|
+
return { ...module, subModules: validSubModules }
|
|
27
|
+
})
|
|
28
28
|
.filter(Boolean) // Remove null values
|
|
29
29
|
}
|
|
@@ -25,9 +25,15 @@ export const useProductsFood = ({
|
|
|
25
25
|
search = null,
|
|
26
26
|
toDate
|
|
27
27
|
}) => {
|
|
28
|
-
// const [productsFood, setProductsFood] = useState([])
|
|
29
28
|
const [showMore, setShowMore] = useState(500)
|
|
30
|
-
const {
|
|
29
|
+
const {
|
|
30
|
+
data,
|
|
31
|
+
loading,
|
|
32
|
+
fetchMore,
|
|
33
|
+
refetch,
|
|
34
|
+
error,
|
|
35
|
+
called
|
|
36
|
+
} = useQuery(GET_ALL_PRODUCT_STORE, {
|
|
31
37
|
fetchPolicy,
|
|
32
38
|
notifyOnNetworkStatusChange: true,
|
|
33
39
|
nextFetchPolicy: 'cache-first',
|
|
@@ -45,14 +51,15 @@ export const useProductsFood = ({
|
|
|
45
51
|
toDate: toDate || null
|
|
46
52
|
}
|
|
47
53
|
})
|
|
48
|
-
|
|
49
|
-
const productsFood = data?.productFoodsAll
|
|
54
|
+
const productsFood = data?.productFoodsAll.data ?? []
|
|
50
55
|
return [
|
|
51
56
|
productsFood, {
|
|
52
|
-
|
|
57
|
+
pagination: data?.productFoodsAll.pagination || {},
|
|
53
58
|
loading: called ? false : loading,
|
|
59
|
+
error,
|
|
54
60
|
showMore,
|
|
55
61
|
fetchMore,
|
|
62
|
+
refetch,
|
|
56
63
|
setShowMore
|
|
57
64
|
}
|
|
58
65
|
]
|
|
@@ -202,6 +209,7 @@ export const useGetOneProductsFood = ({ fetchOnlyProduct = false } = {}) => {
|
|
|
202
209
|
loading,
|
|
203
210
|
error
|
|
204
211
|
}] = useLazyQuery(GET_ONE_PRODUCTS_FOOD)
|
|
212
|
+
|
|
205
213
|
const [handleGetExtProductFood, { data: dataOptional }] = useExtProductFoodsOptionalAll()
|
|
206
214
|
const [handleExtProductFoodsAll, { data: dataExtra }] = useExtProductFoodsAll()
|
|
207
215
|
const handleGetOneProduct = async (food) => {
|
|
@@ -76,7 +76,7 @@ export const GET_ALL_EMPLOYEE_STORE = gql`
|
|
|
76
76
|
`
|
|
77
77
|
|
|
78
78
|
export const GET_ALL_PRODUCT_STORE = gql`
|
|
79
|
-
|
|
79
|
+
query productFoodsAll(
|
|
80
80
|
$search: String
|
|
81
81
|
$min: Int
|
|
82
82
|
$max: Int
|
|
@@ -86,6 +86,7 @@ export const GET_ALL_PRODUCT_STORE = gql`
|
|
|
86
86
|
$categories: [ID]
|
|
87
87
|
$fromDate: DateTime
|
|
88
88
|
$toDate: DateTime
|
|
89
|
+
$page: Int
|
|
89
90
|
) {
|
|
90
91
|
productFoodsAll(
|
|
91
92
|
search: $search
|
|
@@ -97,10 +98,22 @@ export const GET_ALL_PRODUCT_STORE = gql`
|
|
|
97
98
|
categories: $categories
|
|
98
99
|
toDate: $toDate
|
|
99
100
|
fromDate: $fromDate
|
|
101
|
+
page: $page
|
|
100
102
|
) {
|
|
103
|
+
success
|
|
104
|
+
message
|
|
105
|
+
pagination {
|
|
106
|
+
totalRecords
|
|
107
|
+
totalPages
|
|
108
|
+
currentPage
|
|
109
|
+
__typename
|
|
110
|
+
}
|
|
111
|
+
data {
|
|
101
112
|
pId
|
|
102
113
|
sizeId #Talla
|
|
103
114
|
colorId #Color
|
|
115
|
+
stock
|
|
116
|
+
manageStock
|
|
104
117
|
carProId #Categoria a la cual pertenece el producto
|
|
105
118
|
caId
|
|
106
119
|
cId #Country
|
|
@@ -147,6 +160,7 @@ export const GET_ALL_PRODUCT_STORE = gql`
|
|
|
147
160
|
aName
|
|
148
161
|
}
|
|
149
162
|
}
|
|
163
|
+
}
|
|
150
164
|
}
|
|
151
165
|
`
|
|
152
166
|
export const GET_ALL_RATING_START_STORE = gql`
|
|
@@ -315,14 +329,7 @@ export const UPDATE = gql`
|
|
|
315
329
|
}
|
|
316
330
|
}
|
|
317
331
|
`
|
|
318
|
-
|
|
319
|
-
mutation setImageProducts($input: IFileImageProductFood) {
|
|
320
|
-
setImageProducts(input: $input) {
|
|
321
|
-
success
|
|
322
|
-
message
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
`
|
|
332
|
+
|
|
326
333
|
export const UPDATE_PRODUCT_FOOD = gql`
|
|
327
334
|
mutation updateProductFoods($input: InputProductFood) {
|
|
328
335
|
updateProductFoods(input: $input) {
|
|
@@ -579,6 +586,8 @@ export const GET_ONE_PRODUCTS_FOOD = gql`
|
|
|
579
586
|
idStore
|
|
580
587
|
cId
|
|
581
588
|
caId
|
|
589
|
+
stock
|
|
590
|
+
manageStock
|
|
582
591
|
dId
|
|
583
592
|
ctId
|
|
584
593
|
tpId
|
|
@@ -850,7 +859,9 @@ export const GET_ALL_CATEGORIES_WITH_PRODUCT = gql`
|
|
|
850
859
|
pId
|
|
851
860
|
sizeId
|
|
852
861
|
colorId
|
|
862
|
+
stock
|
|
853
863
|
carProId
|
|
864
|
+
manageStock
|
|
854
865
|
cId
|
|
855
866
|
dId
|
|
856
867
|
ctId
|
|
@@ -34,7 +34,7 @@ export const useReport = ({
|
|
|
34
34
|
})
|
|
35
35
|
|
|
36
36
|
const totalSales = totalSalesData?.getAllSalesStoreTotal ?? {}
|
|
37
|
-
|
|
37
|
+
console.log(totalSales)
|
|
38
38
|
return {
|
|
39
39
|
getAllSalesStore: lazyQuery ? getAllSalesStore : () => { }, // Return function only if in lazy mode
|
|
40
40
|
data: lazyQuery ? lazyDataSales : data, // Use data from lazy query if available
|