npm-pkg-hook 1.1.5 → 1.1.9
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/.eslintrc.js +19 -113
- package/.eslintrc.json +127 -108
- package/.github/pull_request_template.md +17 -17
- package/.github/workflows/pepeline.yaml +29 -29
- package/next.config.js +2 -5
- package/package.json +27 -24
- package/script.txt +6 -6
- package/src/config/client/errors.js +14 -14
- package/src/config/client/index.js +1 -1
- package/src/hooks/getCategoriesWithProduct/helpers/index.js +7 -0
- package/src/hooks/getCategoriesWithProduct/index.js +62 -0
- package/src/hooks/getSession/index.js +18 -18
- package/src/hooks/index.js +13 -9
- package/src/hooks/useAcumulateDate/index.js +1 -1
- package/src/hooks/useAnimationFrame/index.js +45 -45
- package/src/hooks/useAsideCart/helpers/index.js +22 -0
- package/src/hooks/useAsideCart/index.js +156 -0
- package/src/hooks/useAsideCart/queries.js +10 -0
- package/src/hooks/useBanner/index.js +11 -11
- package/src/hooks/useCart/index.js +2 -0
- package/src/hooks/useCart/queries.js +164 -0
- package/src/hooks/useCart/useCart/helpers/index.js +75 -0
- package/src/hooks/useCart/useCart/index.js +411 -0
- package/src/hooks/useCart/useGetCart/index.js +31 -0
- package/src/hooks/useCatWithProduct/index.js +15 -15
- package/src/hooks/useCatWithProduct/queries.js +1 -1
- package/src/hooks/useCatWithProductClient/index.js +48 -0
- package/src/hooks/useCatWithProductClient/queries.js +55 -0
- package/src/hooks/useCategoriesProduct/index.js +12 -12
- package/src/hooks/useCategoriesProduct/queries.js +16 -16
- package/src/hooks/useCategoryInStore/index.js +39 -36
- package/src/hooks/useCategoryInStore/queries.js +78 -78
- package/src/hooks/useCategoryStore/index.js +2 -2
- package/src/hooks/useChartData/index.js +159 -156
- package/src/hooks/useChartData/useChartData/index.js +199 -197
- package/src/hooks/useChartData/useChartDataAllOrders/index.js +94 -94
- package/src/hooks/useCheckbox/index.js +115 -115
- package/src/hooks/useClients/index.js +12 -14
- package/src/hooks/useClients/queries.js +1 -1
- package/src/hooks/useConnection/index.js +20 -21
- package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.js +6 -2
- package/src/hooks/useCreateProduct/index.js +22 -19
- package/src/hooks/useDeleteSubProductOptional/index.js +31 -30
- package/src/hooks/useDeleteSubProductOptional/queries.js +10 -10
- package/src/hooks/useDessert/helpers/index.js +51 -51
- package/src/hooks/useDessert/index.js +56 -65
- package/src/hooks/useDevices/index.js +35 -36
- package/src/hooks/useDevices/queries.js +19 -19
- package/src/hooks/useDropzone/index.js +94 -79
- package/src/hooks/useDynamicAuth/index.js +13 -13
- package/src/hooks/useDynamicAuth/queries.js +24 -24
- package/src/hooks/useEmployee/queries.js +1 -1
- package/src/hooks/useEvent/index.js +33 -33
- package/src/hooks/useFavoriteStores/index.js +19 -0
- package/src/hooks/useFavoriteStores/queries.js +47 -0
- package/src/hooks/useFetchJson/index.js +25 -25
- package/src/hooks/useFingerprintjs/index.js +172 -176
- package/src/hooks/useFormTools/index.js +12 -11
- package/src/hooks/useFormatDate/index.js +20 -21
- package/src/hooks/useFormatNumberPhone/index.js +9 -9
- package/src/hooks/useFullScreenMode/index.js +65 -65
- package/src/hooks/useGenerateNumberArray/index.js +17 -17
- package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.js +14 -0
- package/src/hooks/useGetFoodRecomended/index.js +33 -0
- package/src/hooks/useGetFoodRecomended/queries.js +47 -0
- package/src/hooks/useGetMinPrice/index.js +8 -0
- package/src/hooks/useGetMinPrice/queries.js +7 -0
- package/src/hooks/useGetOneStoreRating/index.js +40 -0
- package/src/hooks/useGetOneStoreRating/queries.js +18 -0
- package/src/hooks/useGoogleLogin/index.js +160 -161
- package/src/hooks/useHover/index.js +29 -29
- package/src/hooks/useImageOptimization/index.js +15 -15
- package/src/hooks/useImageWeight/index.js +18 -19
- package/src/hooks/useImagesStore/index.js +139 -140
- package/src/hooks/useImagesStore/queries.js +19 -18
- package/src/hooks/useInnerHtml/index.js +39 -38
- package/src/hooks/useIntersection/index.js +4 -4
- package/src/hooks/useKeypress/index.js +28 -28
- package/src/hooks/useLazyScript/index.js +35 -36
- package/src/hooks/useLocalSorage/index.js +2 -2
- package/src/hooks/useLocationNavigate/index.js +54 -54
- package/src/hooks/useLogout/index.js +24 -24
- package/src/hooks/useManageQueryParams/index.js +36 -37
- package/src/hooks/useMobile/index.js +39 -38
- package/src/hooks/useMutateHeight/index.js +15 -16
- package/src/hooks/useOrderClient/index.js +5 -0
- package/src/hooks/useOrders/index.js +10 -16
- package/src/hooks/useOrders/queries.js +1 -1
- package/src/hooks/useProductsFood/index.js +32 -32
- package/src/hooks/useProductsFood/queriesStore.js +49 -48
- package/src/hooks/useProductsFood/useEditProduct.js +2 -4
- package/src/hooks/useProductsFood/usetagsProducts.js +83 -83
- package/src/hooks/useProviders/index.js +3 -3
- package/src/hooks/useProviders/queries.js +31 -31
- package/src/hooks/useProviders/useProvidersCreateStore/index.js +12 -13
- package/src/hooks/useProviders/useProvidersDataStore/index.js +24 -24
- package/src/hooks/useProvidersStore/index.js +24 -24
- package/src/hooks/useProvidersStore/queries.js +31 -31
- package/src/hooks/useRatingArrayData/index.js +54 -0
- package/src/hooks/{useRatingData → useRatingArrayData}/queries.js +19 -18
- package/src/hooks/useReactToPrint/index.js +1120 -1098
- package/src/hooks/useRemoveExtraProductFoodsOptional/index.js +23 -23
- package/src/hooks/useRemoveExtraProductFoodsOptional/queries.js +48 -48
- package/src/hooks/useReport/index.js +9 -9
- package/src/hooks/useReport/queries.js +1 -1
- package/src/hooks/useRestaurant/index.js +19 -19
- package/src/hooks/useRestaurant/queries.js +80 -80
- package/src/hooks/useSales/index.js +476 -451
- package/src/hooks/useSales/queries.js +14 -15
- package/src/hooks/useSales/useGetAllSales/index.js +25 -25
- package/src/hooks/useSales/useTotalSales.js +18 -18
- package/src/hooks/useSaveAvailableProduct/helpers/index.js +29 -29
- package/src/hooks/useSaveAvailableProduct/index.js +16 -16
- package/src/hooks/useSaveAvailableProduct/queries.js +1 -1
- package/src/hooks/useSchedule/index.js +33 -36
- package/src/hooks/useSchedule/index.jsx +22 -22
- package/src/hooks/useSchedule/queries.js +34 -35
- package/src/hooks/useScheduleData/index.js +123 -171
- package/src/hooks/useScroll/index.js +56 -57
- package/src/hooks/useScrollRotate/index.js +16 -14
- package/src/hooks/useSetSession/index.js +16 -16
- package/src/hooks/useSetState/index.js +3 -3
- package/src/hooks/useStatusOpenStore/helpers/index.js +101 -102
- package/src/hooks/useStatusOpenStore/index.js +172 -173
- package/src/hooks/useStatusOrdersClient/helpers/index.js +14 -0
- package/src/hooks/useStatusOrdersClient/index.js +17 -0
- package/src/hooks/useStatusOrdersClient/queries.js +80 -0
- package/src/hooks/useStore/index.js +40 -25
- package/src/hooks/useStore/queries.js +162 -136
- package/src/hooks/useStoreCalendar/index.js +5 -7
- package/src/hooks/useStoreContacts/index.js +16 -16
- package/src/hooks/useStoreContacts/queries.js +1 -1
- package/src/hooks/useTimeAgo/useTimeAgo.js +39 -39
- package/src/hooks/useUpdateCart/index.js +34 -28
- package/src/hooks/useUpdateExistingOrders/index.js +35 -35
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +38 -37
- package/src/hooks/useUser/index.js +1 -1
- package/src/hooks/useUser/queries.js +1 -1
- package/src/hooks/useWindowSize/index.js +38 -38
- package/src/mock/dessert/index.js +16 -16
- package/src/mock/index.js +1 -2
- package/src/utils/index.js +42 -45
- package/src/hooks/useRatingData/index.js +0 -53
- package/src/hooks/useSalesClient/index.js +0 -1
|
@@ -3,92 +3,92 @@ import { useMutation } from '@apollo/client'
|
|
|
3
3
|
import { REGISTER_TAGS_PRODUCT } from './queriesStore'
|
|
4
4
|
|
|
5
5
|
export const useTagsProducts = () => {
|
|
6
|
-
|
|
7
|
-
|
|
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
|
-
const [tags, setTags] = useState({
|
|
51
|
-
id: '',
|
|
52
|
-
tag: ''
|
|
53
|
-
})
|
|
6
|
+
const [registerTag] = useMutation(REGISTER_TAGS_PRODUCT)
|
|
7
|
+
const data = [
|
|
8
|
+
{
|
|
9
|
+
id: 1,
|
|
10
|
+
tag: 'Bebida fría'
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
id: 2,
|
|
14
|
+
tag: 'Bebida caliente'
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
id: 3,
|
|
18
|
+
tag: 'Bebida alcohólica'
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
id: 4,
|
|
22
|
+
tag: 'Bebida sin alcohol'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
id: 5,
|
|
26
|
+
tag: 'Entrante'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
id: 6,
|
|
30
|
+
tag: 'Plato principal'
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
id: 7,
|
|
34
|
+
tag: 'Postre'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
id: 8,
|
|
38
|
+
tag: 'Sopa'
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
id: 9,
|
|
42
|
+
tag: 'Ensalada'
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
id: 10,
|
|
46
|
+
tag: 'Mariscos'
|
|
47
|
+
}
|
|
48
|
+
]
|
|
54
49
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
const [tags, setTags] = useState({
|
|
51
|
+
id: '',
|
|
52
|
+
tag: ''
|
|
53
|
+
})
|
|
54
|
+
|
|
55
|
+
const handleAddTag = (id, tag) => {
|
|
56
|
+
if (tags.id === id) {
|
|
62
57
|
return setTags({
|
|
63
|
-
id,
|
|
64
|
-
tag
|
|
58
|
+
id: '',
|
|
59
|
+
tag: ''
|
|
65
60
|
})
|
|
66
61
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
62
|
+
return setTags({
|
|
63
|
+
id,
|
|
64
|
+
tag
|
|
65
|
+
})
|
|
66
|
+
}
|
|
67
|
+
const handleRegister = tag => {
|
|
68
|
+
const {
|
|
69
|
+
pId,
|
|
70
|
+
idUser,
|
|
71
|
+
idStore,
|
|
72
|
+
nameTag
|
|
73
|
+
} = tag || {}
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
}
|
|
75
|
+
registerTag({
|
|
76
|
+
variables: {
|
|
77
|
+
input: {
|
|
78
|
+
pId,
|
|
79
|
+
idUser,
|
|
80
|
+
nameTag,
|
|
81
|
+
idStore
|
|
83
82
|
}
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}
|
|
83
|
+
}
|
|
84
|
+
}).catch(err => { return console.log({ message: `${err}`, duration: 7000 }) })
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
tags,
|
|
88
|
+
error: false,
|
|
89
|
+
data,
|
|
90
|
+
loading: false,
|
|
91
|
+
handleRegister,
|
|
92
|
+
handleAddTag
|
|
93
|
+
}
|
|
94
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './useProvidersCreateStore'
|
|
2
|
-
export * from './useProvidersDataStore'
|
|
3
|
-
export * from './queries'
|
|
1
|
+
export * from './useProvidersCreateStore'
|
|
2
|
+
export * from './useProvidersDataStore'
|
|
3
|
+
export * from './queries'
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const CREATE_PROVIDERS = gql`
|
|
4
|
-
mutation registerProviders($input: IProviders) {
|
|
5
|
-
registerProviders(input: $input) {
|
|
6
|
-
success
|
|
7
|
-
message
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
`
|
|
11
|
-
export const GET_ALL_PROVIDERS = gql`
|
|
12
|
-
query getAllProviders($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: DateTime, $toDate: DateTime ) {
|
|
13
|
-
getAllProviders(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
|
|
14
|
-
idProvider
|
|
15
|
-
idStore
|
|
16
|
-
prImage
|
|
17
|
-
prPathImage
|
|
18
|
-
PrNit
|
|
19
|
-
prName
|
|
20
|
-
PrNumberPhone
|
|
21
|
-
PrNumberIdentity
|
|
22
|
-
PrAdres
|
|
23
|
-
PrMail
|
|
24
|
-
TotalBysPr
|
|
25
|
-
TotalDeuda
|
|
26
|
-
prState
|
|
27
|
-
DatCre
|
|
28
|
-
DatMod
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
`
|
|
1
|
+
import { gql } from '@apollo/client'
|
|
2
|
+
|
|
3
|
+
export const CREATE_PROVIDERS = gql`
|
|
4
|
+
mutation registerProviders($input: IProviders) {
|
|
5
|
+
registerProviders(input: $input) {
|
|
6
|
+
success
|
|
7
|
+
message
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
`
|
|
11
|
+
export const GET_ALL_PROVIDERS = gql`
|
|
12
|
+
query getAllProviders($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: DateTime, $toDate: DateTime ) {
|
|
13
|
+
getAllProviders(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
|
|
14
|
+
idProvider
|
|
15
|
+
idStore
|
|
16
|
+
prImage
|
|
17
|
+
prPathImage
|
|
18
|
+
PrNit
|
|
19
|
+
prName
|
|
20
|
+
PrNumberPhone
|
|
21
|
+
PrNumberIdentity
|
|
22
|
+
PrAdres
|
|
23
|
+
PrMail
|
|
24
|
+
TotalBysPr
|
|
25
|
+
TotalDeuda
|
|
26
|
+
prState
|
|
27
|
+
DatCre
|
|
28
|
+
DatMod
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { useMutation } from
|
|
2
|
-
import { CREATE_PROVIDERS } from
|
|
3
|
-
|
|
4
|
-
export const useProvidersCreateStore = ({ setAlertBox = () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
1
|
+
import { useMutation } from '@apollo/client'
|
|
2
|
+
import { CREATE_PROVIDERS } from '../queries'
|
|
3
|
+
|
|
4
|
+
export const useProvidersCreateStore = ({ setAlertBox = () => { } } = {}) => {
|
|
5
|
+
const [registerProviders, { loading, error }] = useMutation(CREATE_PROVIDERS, {
|
|
6
|
+
onCompleted: (data) => {
|
|
7
|
+
setAlertBox({ message: `${data.registerProviders.message}` })
|
|
8
|
+
}
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
return [registerProviders, { loading, error }]
|
|
12
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { useQuery } from
|
|
2
|
-
import { GET_ALL_PROVIDERS } from
|
|
3
|
-
|
|
4
|
-
export const useProvidersStore = () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
1
|
+
import { useQuery } from '@apollo/client'
|
|
2
|
+
import { GET_ALL_PROVIDERS } from '../queries'
|
|
3
|
+
|
|
4
|
+
export const useProvidersStore = () => {
|
|
5
|
+
const {
|
|
6
|
+
data,
|
|
7
|
+
fetchMore,
|
|
8
|
+
loading,
|
|
9
|
+
error,
|
|
10
|
+
called
|
|
11
|
+
} = useQuery(GET_ALL_PROVIDERS, {
|
|
12
|
+
fetchPolicy: 'cache-and-network',
|
|
13
|
+
notifyOnNetworkStatusChange: true,
|
|
14
|
+
nextFetchPolicy: 'cache-first',
|
|
15
|
+
refetchWritePolicy: 'merge'
|
|
16
|
+
})
|
|
17
|
+
const providerData = data?.getAllProviders || []
|
|
18
|
+
return [providerData, {
|
|
19
|
+
fetchMore,
|
|
20
|
+
called,
|
|
21
|
+
error,
|
|
22
|
+
loading
|
|
23
|
+
}]
|
|
24
|
+
}
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
import { useQuery } from
|
|
2
|
-
import { GET_ALL_PROVIDERS } from
|
|
3
|
-
|
|
4
|
-
export const useProvidersStore = () => {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
1
|
+
import { useQuery } from '@apollo/client'
|
|
2
|
+
import { GET_ALL_PROVIDERS } from './queries'
|
|
3
|
+
|
|
4
|
+
export const useProvidersStore = () => {
|
|
5
|
+
const {
|
|
6
|
+
data,
|
|
7
|
+
fetchMore,
|
|
8
|
+
loading,
|
|
9
|
+
error,
|
|
10
|
+
called
|
|
11
|
+
} = useQuery(GET_ALL_PROVIDERS, {
|
|
12
|
+
fetchPolicy: 'cache-and-network',
|
|
13
|
+
notifyOnNetworkStatusChange: true,
|
|
14
|
+
nextFetchPolicy: 'cache-first',
|
|
15
|
+
refetchWritePolicy: 'merge'
|
|
16
|
+
})
|
|
17
|
+
const providerData = data?.getAllProviders || []
|
|
18
|
+
return [providerData, {
|
|
19
|
+
fetchMore,
|
|
20
|
+
called,
|
|
21
|
+
error,
|
|
22
|
+
loading
|
|
23
|
+
}]
|
|
24
|
+
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const CREATE_PROVIDERS = gql`
|
|
4
|
-
mutation registerProviders($input: IProviders) {
|
|
5
|
-
registerProviders(input: $input) {
|
|
6
|
-
success
|
|
7
|
-
message
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
`
|
|
11
|
-
export const GET_ALL_PROVIDERS = gql`
|
|
12
|
-
query getAllProviders($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: DateTime, $toDate: DateTime ) {
|
|
13
|
-
getAllProviders(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
|
|
14
|
-
idProvider
|
|
15
|
-
idStore
|
|
16
|
-
prImage
|
|
17
|
-
prPathImage
|
|
18
|
-
PrNit
|
|
19
|
-
prName
|
|
20
|
-
PrNumberPhone
|
|
21
|
-
PrNumberIdentity
|
|
22
|
-
PrAdres
|
|
23
|
-
PrMail
|
|
24
|
-
TotalBysPr
|
|
25
|
-
TotalDeuda
|
|
26
|
-
prState
|
|
27
|
-
DatCre
|
|
28
|
-
DatMod
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
`
|
|
1
|
+
import { gql } from '@apollo/client'
|
|
2
|
+
|
|
3
|
+
export const CREATE_PROVIDERS = gql`
|
|
4
|
+
mutation registerProviders($input: IProviders) {
|
|
5
|
+
registerProviders(input: $input) {
|
|
6
|
+
success
|
|
7
|
+
message
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
`
|
|
11
|
+
export const GET_ALL_PROVIDERS = gql`
|
|
12
|
+
query getAllProviders($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: DateTime, $toDate: DateTime ) {
|
|
13
|
+
getAllProviders(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
|
|
14
|
+
idProvider
|
|
15
|
+
idStore
|
|
16
|
+
prImage
|
|
17
|
+
prPathImage
|
|
18
|
+
PrNit
|
|
19
|
+
prName
|
|
20
|
+
PrNumberPhone
|
|
21
|
+
PrNumberIdentity
|
|
22
|
+
PrAdres
|
|
23
|
+
PrMail
|
|
24
|
+
TotalBysPr
|
|
25
|
+
TotalDeuda
|
|
26
|
+
prState
|
|
27
|
+
DatCre
|
|
28
|
+
DatMod
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
`
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react'
|
|
2
|
+
import { useQuery } from '@apollo/client'
|
|
3
|
+
// eslint-disable-next-line camelcase
|
|
4
|
+
import { GET_All_RATING_STORE } from './queries'
|
|
5
|
+
|
|
6
|
+
export const useRatingArrayData = () => {
|
|
7
|
+
const { data: dataRating } = useQuery(GET_All_RATING_STORE)
|
|
8
|
+
|
|
9
|
+
const calculateTotalRatings = (ratings = []) => {
|
|
10
|
+
return ratings.reduce(
|
|
11
|
+
(total, rating) => ({
|
|
12
|
+
rAppearance: total?.rAppearance + rating?.rAppearance,
|
|
13
|
+
rTasty: total?.rTasty + rating?.rTasty,
|
|
14
|
+
rGoodCondition: total?.rGoodCondition + rating?.rGoodCondition,
|
|
15
|
+
rGoodTemperature: total?.rGoodTemperature + rating?.rGoodTemperature
|
|
16
|
+
}),
|
|
17
|
+
{
|
|
18
|
+
rAppearance: 0,
|
|
19
|
+
rTasty: 0,
|
|
20
|
+
rGoodCondition: 0,
|
|
21
|
+
rGoodTemperature: 0
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const [totalRatings, setTotalRatings] = useState(
|
|
27
|
+
calculateTotalRatings(dataRating?.getAllRating || [])
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
setTotalRatings(calculateTotalRatings(dataRating?.getAllRating || []))
|
|
32
|
+
}, [dataRating])
|
|
33
|
+
|
|
34
|
+
const dataArr = [
|
|
35
|
+
{
|
|
36
|
+
name: 'Buena apariencia',
|
|
37
|
+
value: totalRatings.rAppearance || 0
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'Es deliciosa',
|
|
41
|
+
value: totalRatings.rTasty || 0
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Buenas condiciones',
|
|
45
|
+
value: totalRatings.rGoodCondition || 0
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: 'Buena temperatura',
|
|
49
|
+
value: totalRatings.rGoodTemperature || 0
|
|
50
|
+
}
|
|
51
|
+
]
|
|
52
|
+
|
|
53
|
+
return dataArr
|
|
54
|
+
}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
idStore
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
}
|
|
18
|
-
|
|
1
|
+
import { gql } from '@apollo/client'
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line camelcase
|
|
4
|
+
export const GET_All_RATING_STORE = gql`
|
|
5
|
+
query getAllRating($idStore: ID){
|
|
6
|
+
getAllRating(idStore: $idStore){
|
|
7
|
+
idStore
|
|
8
|
+
rId
|
|
9
|
+
id
|
|
10
|
+
rAppearance
|
|
11
|
+
rTasty
|
|
12
|
+
rGoodTemperature
|
|
13
|
+
rGoodCondition
|
|
14
|
+
rState
|
|
15
|
+
createAt
|
|
16
|
+
updateAt
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
`
|