npm-pkg-hook 1.0.2 → 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.
Files changed (84) hide show
  1. package/.babelrc +13 -13
  2. package/.env +1 -0
  3. package/.eslintrc.js +132 -0
  4. package/.eslintrc.json +107 -107
  5. package/.github/pull_request_template.md +17 -17
  6. package/.github/workflows/pepeline.yaml +29 -29
  7. package/.vscode/extensions.json +6 -0
  8. package/.vscode/settings.json +12 -0
  9. package/README.md +1 -1
  10. package/jsconfig.json +27 -27
  11. package/next.config.js +128 -128
  12. package/package.json +8 -6
  13. package/script.txt +7 -0
  14. package/src/cookies/index.ts +3 -3
  15. package/src/hooks/index.js +46 -19
  16. package/src/hooks/updateExtProductFoodsOptional/index.js +38 -0
  17. package/src/hooks/useAcumulateDate/index.js +16 -16
  18. package/src/hooks/useAnimationText/index.jsx +31 -30
  19. package/src/hooks/useBanner/index.js +19 -0
  20. package/src/hooks/useCatWithProduct/index.js +42 -0
  21. package/src/hooks/useCatWithProduct/queries.js +172 -0
  22. package/src/hooks/useCategoryInStore/index.js +94 -0
  23. package/src/hooks/{useGetCategorieStore → useCategoryInStore}/queries.js +77 -77
  24. package/src/hooks/useCategoryStore/index.js +7 -7
  25. package/src/hooks/useCategoryStore/queries.js +16 -16
  26. package/src/hooks/useChartData/index.js +168 -0
  27. package/src/hooks/useCheckbox/index.js +114 -114
  28. package/src/hooks/useClients/index.js +13 -13
  29. package/src/hooks/useClients/queries.js +117 -117
  30. package/src/hooks/useConnection/index.js +23 -0
  31. package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.js +165 -0
  32. package/src/hooks/useCreateProduct/index.js +268 -0
  33. package/src/hooks/useDessert/index.js +141 -0
  34. package/src/hooks/useDrag/index.js +62 -57
  35. package/src/hooks/useEvent/index.js +33 -33
  36. package/src/hooks/useFetchJson/index.js +24 -24
  37. package/src/hooks/useFetchMoreInteractions/index.jsx +37 -34
  38. package/src/hooks/useFormTools/index.js +83 -70
  39. package/src/hooks/useFormatDate/index.js +34 -0
  40. package/src/hooks/useFullScreenMode/index.js +65 -65
  41. package/src/hooks/useHover/index.js +28 -28
  42. package/src/hooks/useImageOptimization/index.js +28 -0
  43. package/src/hooks/useImageWeight/index.js +52 -0
  44. package/src/hooks/useImagesStore/index.js +171 -0
  45. package/src/hooks/useImagesStore/queries.js +216 -0
  46. package/src/hooks/useInnerHtml/index.js +37 -37
  47. package/src/hooks/useIntersection/index.js +84 -31
  48. package/src/hooks/useKeypress/index.js +27 -27
  49. package/src/hooks/useLazyScript/index.js +72 -0
  50. package/src/hooks/useLocalSorage/index.js +35 -35
  51. package/src/hooks/useLocationNavigate/index.js +54 -54
  52. package/src/hooks/useMobile/index.js +37 -37
  53. package/src/hooks/useMutateHeight/index.js +37 -0
  54. package/src/hooks/useProductsFood/index.js +190 -0
  55. package/src/hooks/{useGetProductsFood → useProductsFood}/queriesStore.js +780 -765
  56. package/src/hooks/useProductsFood/usetagsProducts.js +57 -0
  57. package/src/hooks/useReport/index.js +35 -0
  58. package/src/hooks/useReport/queries.js +122 -0
  59. package/src/hooks/useRestaurant/index.js +19 -19
  60. package/src/hooks/useRestaurant/queries.js +79 -69
  61. package/src/hooks/useSales/index.js +589 -489
  62. package/src/hooks/useSales/queries.js +290 -229
  63. package/src/hooks/useSales/useGetSale.js +12 -0
  64. package/src/hooks/useSales/useTotalSales.js +17 -0
  65. package/src/hooks/useSaveAvailableProduct/helpers/index.js +30 -0
  66. package/src/hooks/useSaveAvailableProduct/index.js +26 -0
  67. package/src/hooks/useSaveAvailableProduct/queries.js +10 -0
  68. package/src/hooks/useSchedule/index.jsx +23 -0
  69. package/src/hooks/useSetState/index.js +24 -24
  70. package/src/hooks/useStore/index.js +17 -17
  71. package/src/hooks/useStore/queries.js +135 -135
  72. package/src/hooks/useStoreCalendar/index.js +7 -0
  73. package/src/hooks/useTimeAgo/useTimeAgo.js +39 -39
  74. package/src/hooks/useUpdateCart/index.js +124 -124
  75. package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +37 -0
  76. package/src/hooks/useUser/index.js +7 -3
  77. package/src/hooks/useUser/queries.js +69 -0
  78. package/src/hooks/useWindowSize/index.js +37 -37
  79. package/src/index.jsx +2 -1
  80. package/src/mock/dessert/index.js +16 -0
  81. package/src/mock/index.js +2 -0
  82. package/src/utils/index.js +106 -54
  83. package/src/hooks/useGetCategorieStore/index.js +0 -21
  84. package/src/hooks/useGetProductsFood/index.js +0 -46
@@ -0,0 +1,172 @@
1
+ import { gql } from '@apollo/client'
2
+
3
+ export const CREATE_FOOD_PRODUCT = gql`
4
+ mutation newRegisterFoodProduct($input: FoodProductInput){
5
+ newRegisterFoodProduct(input: $input){
6
+ success
7
+ message
8
+ }
9
+ }
10
+ `
11
+ export const GET_BANNER_PROMO_DASHBOARD = gql`
12
+ query getPromoStoreAdmin($min: Int, $max: Int){
13
+ getPromoStoreAdmin(min: $min, max: $max){
14
+ pSoId
15
+ comments
16
+ mainName
17
+ metaTags
18
+ urlImage
19
+ bPromoState
20
+ createAt
21
+ updateAt
22
+ }
23
+ }
24
+ `
25
+
26
+ export const CREATE_STORE_CALENDAR = gql`
27
+ mutation setStoreSchedule($input: ITstoreSchedule!){
28
+ setStoreSchedule(input: $input){
29
+ message
30
+ success
31
+ }
32
+ }
33
+ `
34
+ export const DELETE_ONE_CAT_PRODUCTS = gql`
35
+ mutation deleteCatOfProducts($idPc: ID!, $pState: Int){
36
+ deleteCatOfProducts(idPc: $idPc, pState: $pState){
37
+ success
38
+ message
39
+ }
40
+ }
41
+ `
42
+ export const DELETE_ONE_CAT_PRODUCTS_FINAL = gql`
43
+
44
+ mutation deleteCatFinalOfProducts($idPc: ID){
45
+ deleteCatFinalOfProducts(idPc: $idPc){
46
+ success
47
+ message
48
+ }
49
+ }
50
+ `
51
+ export const DELETE_EXTRA_PRODUCTS = gql`
52
+ mutation deleteextraproductfoods($id: ID, $state: Int){
53
+ deleteextraproductfoods(id: $id, state: $state){
54
+ success,
55
+ message
56
+ }
57
+ }
58
+ `
59
+ export const EDIT_EXTRA_PRODUCTS = gql`
60
+ mutation editExtProductFoods($input: InputExtProductFood!) {
61
+ editExtProductFoods(input: $input) {
62
+ success
63
+ message
64
+ }
65
+ }
66
+ `
67
+ export const DELETE_CAT_EXTRA_PRODUCTS = gql`
68
+ mutation DeleteExtProductFoodsOptional($opExPid: ID, $state: Int){
69
+ DeleteExtProductFoodsOptional(opExPid: $opExPid, state: $state){
70
+ success,
71
+ message
72
+ }
73
+ }
74
+ `
75
+ export const DELETE_CAT_EXTRA_SUB_OPTIONAL_PRODUCTS = gql`
76
+ mutation DeleteExtFoodSubsOptional($opSubExPid: ID, $state: Int){
77
+ DeleteExtFoodSubsOptional(opSubExPid: $opSubExPid, state: $state){
78
+ success,
79
+ message
80
+ }
81
+ }
82
+ `
83
+ export const UPDATE_CAT_IN_PRODUCT = gql`
84
+ mutation updatedCatWithProducts($input: LineItemsIdPro){
85
+ updatedCatWithProducts(input: $input){
86
+ success
87
+ message
88
+ }
89
+ }
90
+ `
91
+ export const GET_ULTIMATE_CATEGORY_PRODUCTS = gql`
92
+ query catProductsAll($search: String, $min: Int, $max: Int, $gender: [String], $desc: [String], $categories: [ID], ) {
93
+ catProductsAll(search: $search, min: $min, max: $max, gender: $gender, desc: $desc, categories: $categories,) {
94
+ carProId
95
+ idStore
96
+ pName
97
+ ProDescription
98
+ ProImage
99
+ pState
100
+ pDatCre
101
+ pDatMod
102
+ }
103
+ }
104
+ `
105
+ export const GET_ALL_EXTRA_PRODUCT = gql`
106
+ query ExtProductFoodsAll($search: String, $min: Int, $max: Int, $pId: ID) {
107
+ ExtProductFoodsAll(search: $search, min: $min, max: $max, pId: $pId) {
108
+ pId
109
+ exPid
110
+ exState
111
+ extraName
112
+ extraPrice
113
+ state
114
+ pDatCre
115
+ pDatMod
116
+ }
117
+ }
118
+ `
119
+ export const GET_ALL_CATEGORIES_WITH_PRODUCT = gql`
120
+ query getCatProductsWithProduct($search: String, $min: Int, $max: Int, $gender: [String], $desc: [String], $categories: [ID], ) {
121
+ getCatProductsWithProduct(search: $search, min: $min, max: $max, gender: $gender, desc: $desc, categories: $categories,) {
122
+ totalCount,
123
+ catProductsWithProduct {
124
+ carProId
125
+ pState
126
+ pState
127
+ ProImage
128
+ idStore
129
+ pName
130
+ totalCount
131
+ ProDescription
132
+ ProImage
133
+ pState
134
+ pDatCre
135
+ pDatMod
136
+ productFoodsAll {
137
+ pId
138
+ sizeId
139
+ colorId
140
+ carProId
141
+ cId
142
+ dId
143
+ ctId
144
+ idStore
145
+ caId
146
+ fId
147
+ pName
148
+ ProPrice
149
+ ProDescuento
150
+ ProUniDisponibles
151
+ ProDescription
152
+ ProProtegido
153
+ ProAssurance
154
+ ProImage
155
+ ProStar
156
+ ProWidth
157
+ ProHeight
158
+ ProLength
159
+ ProWeight
160
+ ProQuantity
161
+ ProOutstanding
162
+ ProDelivery
163
+ ProVoltaje
164
+ pState
165
+ sTateLogistic
166
+ pDatCre
167
+ pDatMod
168
+ }
169
+ }
170
+ }
171
+ }
172
+ `
@@ -0,0 +1,94 @@
1
+ import { useMutation, useQuery } from '@apollo/client';
2
+ import { useState } from 'react';
3
+ import { DELETE_ONE_CAT_PRODUCTS, GET_ULTIMATE_CATEGORY_PRODUCTS } from '../useProductsFood/queriesStore';
4
+ import { UPDATE_CAT_IN_PRODUCT } from './../useProductsFood/queriesStore';
5
+ import { GET_ONE_STORE_IN_CATEGORY } from './queries';
6
+ export const useCategoryInStore = ({ catStoreId }) => {
7
+ // STATES
8
+ const [categories, setOneCategoryInStore] = useState([])
9
+ const [deleteCatOfProducts] = useMutation(DELETE_ONE_CAT_PRODUCTS, {
10
+ onError: (e) => {
11
+ setAlertBox({
12
+ message: e.graphQLErrors[0].message,
13
+ color: WColor
14
+ })
15
+ },
16
+ update(cache) {
17
+ cache.modify({
18
+ fields: {
19
+ catProductsAll(dataOld = []) {
20
+ return cache.writeQuery({ query: GET_ULTIMATE_CATEGORY_PRODUCTS, data: dataOld })
21
+ }
22
+ }
23
+ })
24
+ }
25
+ })
26
+ const [updatedCatWithProducts] = useMutation(UPDATE_CAT_IN_PRODUCT, {
27
+ onError: (e) => {
28
+ console.log({
29
+ message: e.graphQLErrors[0].message,
30
+ color: WColor
31
+ })
32
+ },
33
+ update(cache) {
34
+ cache.modify({
35
+ fields: {
36
+ catProductsAll(dataOld = []) {
37
+ return cache.writeQuery({ query: GET_ULTIMATE_CATEGORY_PRODUCTS, data: dataOld })
38
+ }
39
+ }
40
+ })
41
+ }
42
+ })
43
+ // QUERIES
44
+ const { data } = useQuery(GET_ULTIMATE_CATEGORY_PRODUCTS)
45
+ const {
46
+ loading,
47
+ error
48
+ } = useQuery(GET_ONE_STORE_IN_CATEGORY, {
49
+ variables: {
50
+ catStore: catStoreId
51
+ },
52
+ onError: () => {
53
+ console.log({ message: '', duration: 5000 })
54
+ },
55
+ onCompleted: () => {
56
+ setOneCategoryInStore(data.getOneCatStore)
57
+ }
58
+ })
59
+ // HANDLESS
60
+ const handlerDeleteCategoryInStore = (category) => {
61
+ const { pState, idPc } = category || {}
62
+ if (!idPc || !pState) return
63
+ return deleteCatOfProducts({
64
+ variables: { idPc, pState }, update(cache) {
65
+ cache.modify({
66
+ fields: {
67
+ catProductsAll(dataOld = []) {
68
+ return cache.writeQuery({ query: GET_ULTIMATE_CATEGORY_PRODUCTS, data: dataOld })
69
+ }
70
+ }
71
+ })
72
+ }
73
+ })
74
+ }
75
+ const handleUpdateCatInProduct = async ({ data }) => {
76
+ await updatedCatWithProducts({
77
+ variables: {
78
+ input: {
79
+ setData: data?.map(x => { return { idProduct: x.pId } }),
80
+ idCat: idCat
81
+ }
82
+ }
83
+ })
84
+ }
85
+ return {
86
+ categories,
87
+ data: data?.catProductsAll || [],
88
+ loading,
89
+ error,
90
+ handlerDeleteCategoryInStore,
91
+ handleUpdateCatInProduct
92
+ }
93
+ }
94
+
@@ -1,78 +1,78 @@
1
- import { gql } from "@apollo/client";
2
-
3
- export const GET_ONE_STORE_IN_CATEGORY = gql`
4
- query getOneCatStore($catStore: ID){
5
- getOneCatStore(catStore: $catStore){
6
- catStore
7
- idUser
8
- cName
9
- cState
10
- cDatCre
11
- cPathImage
12
- cDatMod
13
- csDescription
14
- getAllStore {
15
- idStore
16
- cId
17
- id
18
- dId
19
- ctId
20
- catStore
21
- neighborhoodStore
22
- Viaprincipal
23
- storeOwner
24
- storeName
25
- emailStore
26
- storePhone
27
- socialRaz
28
- Image
29
- banner
30
- documentIdentifier
31
- uPhoNum
32
- ULocation
33
- upLat
34
- upLon
35
- uState
36
- siteWeb
37
- description
38
- NitStore
39
- typeRegiments
40
- typeContribute
41
- secVia
42
- addressStore
43
- createdAt
44
- pais {
45
- cId
46
- cName
47
- cCalCod
48
- cState
49
- cDatCre
50
- cDatMod
51
- }
52
- city {
53
- ctId
54
- dId
55
- cName
56
- cState
57
- cDatCre
58
- cDatMod
59
- }
60
- department {
61
- dId
62
- cId
63
- dName
64
- dState
65
- dDatCre
66
- dDatMod
67
- }
68
- getAllRatingStar {
69
- rSId
70
- rScore
71
- idStore
72
- createAt
73
-
74
- }
75
- }
76
- }
77
- }
1
+ import { gql } from "@apollo/client";
2
+
3
+ export const GET_ONE_STORE_IN_CATEGORY = gql`
4
+ query getOneCatStore($catStore: ID){
5
+ getOneCatStore(catStore: $catStore){
6
+ catStore
7
+ idUser
8
+ cName
9
+ cState
10
+ cDatCre
11
+ cPathImage
12
+ cDatMod
13
+ csDescription
14
+ getAllStore {
15
+ idStore
16
+ cId
17
+ id
18
+ dId
19
+ ctId
20
+ catStore
21
+ neighborhoodStore
22
+ Viaprincipal
23
+ storeOwner
24
+ storeName
25
+ emailStore
26
+ storePhone
27
+ socialRaz
28
+ Image
29
+ banner
30
+ documentIdentifier
31
+ uPhoNum
32
+ ULocation
33
+ upLat
34
+ upLon
35
+ uState
36
+ siteWeb
37
+ description
38
+ NitStore
39
+ typeRegiments
40
+ typeContribute
41
+ secVia
42
+ addressStore
43
+ createdAt
44
+ pais {
45
+ cId
46
+ cName
47
+ cCalCod
48
+ cState
49
+ cDatCre
50
+ cDatMod
51
+ }
52
+ city {
53
+ ctId
54
+ dId
55
+ cName
56
+ cState
57
+ cDatCre
58
+ cDatMod
59
+ }
60
+ department {
61
+ dId
62
+ cId
63
+ dName
64
+ dState
65
+ dDatCre
66
+ dDatMod
67
+ }
68
+ getAllRatingStar {
69
+ rSId
70
+ rScore
71
+ idStore
72
+ createAt
73
+
74
+ }
75
+ }
76
+ }
77
+ }
78
78
  `
@@ -1,7 +1,7 @@
1
- import { useQuery } from '@apollo/client'
2
- import { GET_ALL_CAT_STORE } from './queries'
3
-
4
- export const useCategoryStore = () => {
5
- const { data } = useQuery(GET_ALL_CAT_STORE)
6
- return [data]
7
- }
1
+ import { useQuery } from '@apollo/client'
2
+ import { GET_ALL_CAT_STORE } from './queries'
3
+
4
+ export const useCategoryStore = () => {
5
+ const { data } = useQuery(GET_ALL_CAT_STORE)
6
+ return [data]
7
+ }
@@ -1,16 +1,16 @@
1
- import { gql } from '@apollo/client'
2
-
3
- export const GET_ALL_CAT_STORE = gql`
4
- query getAllCatStore{
5
- getAllCatStore{
6
- catStore
7
- idUser
8
- cPathImage
9
- cName
10
- cState
11
- cDatCre
12
- cDatMod
13
- csDescription
14
- }
15
- }
16
- `
1
+ import { gql } from '@apollo/client'
2
+
3
+ export const GET_ALL_CAT_STORE = gql`
4
+ query getAllCatStore{
5
+ getAllCatStore{
6
+ catStore
7
+ idUser
8
+ cPathImage
9
+ cName
10
+ cState
11
+ cDatCre
12
+ cDatMod
13
+ csDescription
14
+ }
15
+ }
16
+ `
@@ -0,0 +1,168 @@
1
+ import { useQuery } from '@apollo/client';
2
+ import { useState } from 'react';
3
+ import { SPANISH_MONTHS } from "../../utils/index";
4
+ import { GET_ALL_SALES } from "../useReport/queries";
5
+
6
+ export const useChartData = ({ year }) => {
7
+ // Construcción del nuevo array:
8
+ const { data, loading } = useQuery(GET_ALL_SALES)
9
+ const [chartType, setChartType] = useState('bar')
10
+ const [chartTypeYear, setChartTypeYear] = useState(new Date().getFullYear())
11
+ const [asFilter, setFilter] = useState(false)
12
+ const [newResult, setNewResult] = useState([])
13
+ let result = []
14
+ data?.getAllSalesStore?.length > 0 && data?.getAllSalesStore.reduce(function (res, value) {
15
+ // Creamos la posición del array para cada mes
16
+ let mes = new Date(value.pDatCre).getMonth()
17
+ let Year = new Date(value.pDatCre).getFullYear()
18
+ if (!res[mes]) {
19
+ res[mes] = { Mes: mes, Year }
20
+ // Inicializamos a 0 el valor de cada key
21
+ Object.keys(value).forEach((key) => {
22
+ if (key != 'pDatCre') {
23
+ res[mes][key] = 0
24
+ }
25
+ })
26
+
27
+ result.push(res[mes])
28
+ }
29
+ // Sumamos el valor de cada clave dentro de un bucle
30
+ Object.keys(value).forEach(function (key) {
31
+ if (key != 'pDatCre') {
32
+ res[mes]['totalProductsPrice'] += value['totalProductsPrice']
33
+ }
34
+ })
35
+ return res
36
+ }, {})
37
+
38
+ let allMonths = Array.from({ length: 12 }, (_, i) => { return i })
39
+ let missingMonths = allMonths.filter(month => { return !result.some(data => { return data.Mes === month }) })
40
+
41
+ for (const element of missingMonths) {
42
+ result.push({
43
+ 'Mes': element,
44
+ 'totalProductsPrice': 0,
45
+ 'Year': ''
46
+ })
47
+ }
48
+
49
+ result.sort((a, b) => { return a.Mes - b.Mes })
50
+
51
+ const labelTitle = `Ventas por meses del año ${asFilter ? chartTypeYear : ''}`
52
+ // Resultado:
53
+
54
+ const dataChart = {
55
+ labels: asFilter ? newResult.map(data => {
56
+ return SPANISH_MONTHS[data.Mes]
57
+ }) : result.map(data => {
58
+ return SPANISH_MONTHS[data.Mes]
59
+ }),
60
+ datasets: [
61
+ {
62
+ label: labelTitle,
63
+ data: asFilter ? newResult.map(data => { return data.totalProductsPrice }) : result.map(data => { return data.totalProductsPrice }),
64
+ backgroundColor: [
65
+ 'rgba(255, 99, 132, 0.2)',
66
+ 'rgba(54, 162, 235, 0.2)',
67
+ 'rgba(255, 206, 86, 0.2)',
68
+ 'rgba(75, 192, 192, 0.2)',
69
+ 'rgba(153, 102, 255, 0.2)',
70
+ 'rgba(255, 159, 64, 0.2)'
71
+ ],
72
+ borderColor: chartType === 'bar' ? [
73
+ 'rgba(255, 99, 132, 1)',
74
+ 'rgba(54, 162, 235, 1)',
75
+ 'rgba(255, 206, 86, 1)',
76
+ 'rgba(75, 192, 192, 1)',
77
+ 'rgba(153, 102, 255, 1)',
78
+ 'rgba(255, 159, 64, 1)'
79
+ ] : 'rgb(255 0 0)',
80
+ tension: 0.6,
81
+ fill: false,
82
+ borderWidth: 1,
83
+ barPercentage: 1,
84
+ barThickness: 50,
85
+ minBarLength: 3,
86
+ }
87
+ ]
88
+ }
89
+ const options = {
90
+ interaction: {
91
+ mode: 'index',
92
+ intersect: false,
93
+ },
94
+ scales: {
95
+ x: {
96
+ stacked: true
97
+ },
98
+ y: {
99
+ stacked: true
100
+ }
101
+ },
102
+ plugins: {
103
+ title: {
104
+ display: true,
105
+ text: labelTitle
106
+ },
107
+ }
108
+ }
109
+ const groupedData = {}
110
+
111
+ data && data.getAllSalesStore.forEach((item) => {
112
+ const year = new Date(item.pDatCre).getFullYear()
113
+ if (!groupedData[year]) {
114
+ groupedData[year] = []
115
+ }
116
+ groupedData[year].push(item)
117
+ })
118
+ const years = []
119
+ data && data.getAllSalesStore.forEach((item) => {
120
+ const y = new Date(item.pDatCre).getFullYear()
121
+ if (!years.includes(y)) {
122
+ years.push(y)
123
+ }
124
+ })
125
+ const handleChangeYear = (value) => {
126
+ setFilter(true)
127
+ if (result?.length > 0) {
128
+ const filterToYear = result.filter((elem) => {
129
+ return elem?.Year == parseInt(value)
130
+ })
131
+ let missingNewMonths = allMonths.filter(month => { return !filterToYear.some(data => { return data.Mes === month }) })
132
+ for (const element of missingNewMonths) {
133
+ filterToYear.push({
134
+ 'Mes': element,
135
+ 'totalProductsPrice': 0,
136
+ 'Year': ''
137
+ })
138
+ }
139
+ filterToYear.sort((a, b) => { return a.Mes - b.Mes })
140
+ setNewResult(filterToYear)
141
+ return filterToYear
142
+ }
143
+ }
144
+ const cleanFilter = () => {
145
+ setFilter(false)
146
+ setChartTypeYear(new Date().getFullYear())
147
+ }
148
+ const sortYear = () => {
149
+ return years.sort((a, b) => { return b - a });
150
+ }
151
+
152
+ const organiceYears = sortYear()
153
+ return {
154
+ handleChangeYear,
155
+ setFilter,
156
+ cleanFilter,
157
+ setChartType,
158
+ years: organiceYears,
159
+ asFilter,
160
+ chartTypeYear,
161
+ options,
162
+ chartType,
163
+ labelTitle,
164
+ result,
165
+ dataChart,
166
+ loading
167
+ }
168
+ }