npm-pkg-hook 1.12.3 → 1.12.7
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/dist/index.cjs +20089 -0
- package/dist/index.js +19854 -0
- package/dist/index.mjs +19854 -0
- package/package.json +28 -6
- package/.babelrc +0 -0
- package/.env +0 -5
- package/.eslintrc.js +0 -38
- package/.eslintrc.json +0 -127
- package/.github/pull_request_template.md +0 -18
- package/.github/workflows/pepeline.yaml +0 -30
- package/expire.json +0 -1
- package/jsconfig.json +0 -28
- package/script.txt +0 -7
- package/src/config/client/errors.js +0 -26
- package/src/config/client/index.js +0 -1
- package/src/config/content/en.json +0 -5
- package/src/config/content/es.json +0 -5
- package/src/config/content/index.js +0 -16
- package/src/cookies/index.js +0 -3
- package/src/hooks/addTenMinutes/index.js +0 -14
- package/src/hooks/calculateLogLatHaversine/index.js +0 -30
- package/src/hooks/completeSchedules/index.js +0 -22
- package/src/hooks/convertToMilitaryTime/index.js +0 -14
- package/src/hooks/generateStoreURL/index.js +0 -38
- package/src/hooks/generateTemplate/index.js +0 -62
- package/src/hooks/getCardType/index.js +0 -24
- package/src/hooks/getCategoriesWithProduct/helpers/index.js +0 -7
- package/src/hooks/getCategoriesWithProduct/index.js +0 -62
- package/src/hooks/getGlobalSession/index.js +0 -49
- package/src/hooks/getSession/index.js +0 -18
- package/src/hooks/getTodayTimestamps/index.js +0 -64
- package/src/hooks/getTotalHours/index.js +0 -48
- package/src/hooks/handleLogin/index.js +0 -10
- package/src/hooks/index.ts +0 -146
- package/src/hooks/isTokenExpired/index.js +0 -17
- package/src/hooks/newMessageSubscription/index.js +0 -28
- package/src/hooks/newStoreOrderSubscription/index.js +0 -26
- package/src/hooks/statusOpenStores/helpers/index.js +0 -101
- package/src/hooks/statusOpenStores/index.js +0 -156
- package/src/hooks/updateExtProductFoodsOptional/index.js +0 -40
- package/src/hooks/useAcumulateDate/index.js +0 -16
- package/src/hooks/useAllStoresPendingToRegister/index.js +0 -34
- package/src/hooks/useAmountInput/index.ts +0 -117
- package/src/hooks/useAnimationFrame/index.js +0 -45
- package/src/hooks/useAnimationText/index.jsx +0 -31
- package/src/hooks/useAsideCart/helpers/index.js +0 -22
- package/src/hooks/useAsideCart/index.js +0 -214
- package/src/hooks/useAsideCart/queries.js +0 -10
- package/src/hooks/useBanner/index.js +0 -19
- package/src/hooks/useCart/index.js +0 -2
- package/src/hooks/useCart/queries.js +0 -174
- package/src/hooks/useCart/useCart/helpers/index.js +0 -75
- package/src/hooks/useCart/useCart/index.js +0 -412
- package/src/hooks/useCart/useGetCart/index.js +0 -33
- package/src/hooks/useCatWithProduct/index.js +0 -48
- package/src/hooks/useCatWithProduct/queries.js +0 -200
- package/src/hooks/useCatWithProductClient/index.js +0 -56
- package/src/hooks/useCatWithProductClient/queries.js +0 -56
- package/src/hooks/useCategoriesProduct/index.js +0 -13
- package/src/hooks/useCategoriesProduct/queries.js +0 -16
- package/src/hooks/useCategoryInStore/index.js +0 -100
- package/src/hooks/useCategoryInStore/queries.js +0 -78
- package/src/hooks/useCategoryStore/index.js +0 -7
- package/src/hooks/useCategoryStore/queries.js +0 -16
- package/src/hooks/useChartData/index.js +0 -170
- package/src/hooks/useChartData/useChartData/index.js +0 -199
- package/src/hooks/useChartData/useChartDataAllOrders/index.js +0 -94
- package/src/hooks/useChatRoomSubscription/index.js +0 -28
- package/src/hooks/useCheckbox/index.js +0 -115
- package/src/hooks/useCities/index.js +0 -13
- package/src/hooks/useCities/queries.js +0 -12
- package/src/hooks/useClients/index.js +0 -96
- package/src/hooks/useClients/queries.js +0 -212
- package/src/hooks/useColorByLetters/helpers/alea.js +0 -54
- package/src/hooks/useColorByLetters/helpers/colors.js +0 -45
- package/src/hooks/useColorByLetters/helpers/index.js +0 -18
- package/src/hooks/useColorByLetters/helpers/mersenne_twister.js +0 -118
- package/src/hooks/useColorByLetters/index.js +0 -27
- package/src/hooks/useConnection/index.js +0 -24
- package/src/hooks/useCountries/index.js +0 -19
- package/src/hooks/useCountries/queries.js +0 -12
- package/src/hooks/useCreateDeliveryTime/index.js +0 -51
- package/src/hooks/useCreateOrderStatusType/index.ts +0 -132
- package/src/hooks/useCreateProduct/helpers/index.js +0 -23
- package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/index.js +0 -52
- package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.js +0 -176
- package/src/hooks/useCreateProduct/index.js +0 -334
- package/src/hooks/useCreateStorePendingToRegister/index.js +0 -13
- package/src/hooks/useCreateStorePendingToRegister/queries.js +0 -10
- package/src/hooks/useDashboardComponents/index.js +0 -50
- package/src/hooks/useDeleteExtraProductFoods/index.js +0 -12
- package/src/hooks/useDeleteSubProductOptional/index.js +0 -30
- package/src/hooks/useDeleteSubProductOptional/queries.js +0 -10
- package/src/hooks/useDeliveryTime/index.js +0 -27
- package/src/hooks/useDepartments/index.js +0 -13
- package/src/hooks/useDepartments/queries.js +0 -13
- package/src/hooks/useDessert/helpers/index.js +0 -51
- package/src/hooks/useDessert/index.js +0 -525
- package/src/hooks/useDessertWithPrice/helpers/index.js +0 -76
- package/src/hooks/useDessertWithPrice/index.js +0 -373
- package/src/hooks/useDessertWithPrice/queries.js +0 -18
- package/src/hooks/useDevWS/index.ts +0 -53
- package/src/hooks/useDevices/index.js +0 -2
- package/src/hooks/useDevices/queries.js +0 -28
- package/src/hooks/useDevices/useGetDevices.js +0 -28
- package/src/hooks/useDevices/useRegisterDevices.js +0 -75
- package/src/hooks/useDownloadReports/helpers/downloadFileFromResponse.ts +0 -21
- package/src/hooks/useDownloadReports/index.ts +0 -2
- package/src/hooks/useDownloadReports/useDownloadReportByDay/index.ts +0 -103
- package/src/hooks/useDownloadReports/useGetReportByDateRange/index.ts +0 -115
- package/src/hooks/useDrag/index.js +0 -63
- package/src/hooks/useDropzone/index.js +0 -94
- package/src/hooks/useDynamicAuth/index.js +0 -13
- package/src/hooks/useDynamicAuth/queries.js +0 -24
- package/src/hooks/useEditCategory/index.js +0 -41
- package/src/hooks/useEditOneExtProductFoodOptional/index.js +0 -28
- package/src/hooks/useEditOneExtProductFoodOptional/queries.js +0 -16
- package/src/hooks/useEditSubProductOptional/index.js +0 -11
- package/src/hooks/useEditSubProductOptional/queries.js +0 -10
- package/src/hooks/useEmployee/index.js +0 -17
- package/src/hooks/useEmployee/queries.js +0 -85
- package/src/hooks/useEmployee/useCreateEmployee.js +0 -86
- package/src/hooks/useEvent/index.js +0 -34
- package/src/hooks/useFavoriteStores/index.js +0 -29
- package/src/hooks/useFavoriteStores/queries.js +0 -54
- package/src/hooks/useFetchJson/index.js +0 -25
- package/src/hooks/useFetchMoreInteractions/index.jsx +0 -39
- package/src/hooks/useFingerprintjs/index.js +0 -172
- package/src/hooks/useFormTools/index.js +0 -116
- package/src/hooks/useFormatDate/index.js +0 -86
- package/src/hooks/useFormatNumberPhone/index.js +0 -23
- package/src/hooks/useFullScreenMode/index.js +0 -65
- package/src/hooks/useGenerateNumberArray/index.js +0 -17
- package/src/hooks/useGetAllLocationUser/index.js +0 -12
- package/src/hooks/useGetAllLocationUser/queries.js +0 -44
- package/src/hooks/useGetCookies/index.js +0 -43
- package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.js +0 -14
- package/src/hooks/useGetFoodRecomended/index.js +0 -32
- package/src/hooks/useGetFoodRecomended/queries.js +0 -47
- package/src/hooks/useGetMessagesToRoom/index.js +0 -23
- package/src/hooks/useGetMinPrice/index.js +0 -12
- package/src/hooks/useGetMinPrice/queries.js +0 -7
- package/src/hooks/useGetOneStoreRating/index.js +0 -40
- package/src/hooks/useGetOneStoreRating/queries.js +0 -18
- package/src/hooks/useGetSalesAmountToday/index.js +0 -31
- package/src/hooks/useGetStoreCookie/index.js +0 -21
- package/src/hooks/useGoogleLogin/index.js +0 -160
- package/src/hooks/useGoogleLogin/loadScript.js +0 -15
- package/src/hooks/useGoogleLogin/removeScript.js +0 -7
- package/src/hooks/useHover/index.js +0 -29
- package/src/hooks/useImageOptimization/index.js +0 -28
- package/src/hooks/useImageUploaderProduct/helper/canvasUtils.ts +0 -130
- package/src/hooks/useImageUploaderProduct/helper/getOrientation.ts +0 -53
- package/src/hooks/useImageUploaderProduct/helper/index.ts +0 -5
- package/src/hooks/useImageUploaderProduct/index.ts +0 -292
- package/src/hooks/useImageWeight/index.js +0 -51
- package/src/hooks/useImagesStore/index.js +0 -225
- package/src/hooks/useImagesStore/queries.js +0 -193
- package/src/hooks/useImagesStore/utils/index.js +0 -4
- package/src/hooks/useIncomingOrders/index.js +0 -10
- package/src/hooks/useIncomingOrders/queries.js +0 -87
- package/src/hooks/useInnerHtml/index.js +0 -39
- package/src/hooks/useIntersection/index.js +0 -84
- package/src/hooks/useInventory/index.js +0 -2
- package/src/hooks/useInventory/queries.js +0 -58
- package/src/hooks/useInventory/useGetProductsInStock.js +0 -15
- package/src/hooks/useInventory/useUpdateManageStock.js +0 -41
- package/src/hooks/useKeypress/index.js +0 -28
- package/src/hooks/useLazyScript/index.js +0 -71
- package/src/hooks/useLocalBackendIp/index.js +0 -34
- package/src/hooks/useLocalSorage/index.js +0 -36
- package/src/hooks/useLocationManager/index.js +0 -63
- package/src/hooks/useLocationNavigate/index.js +0 -54
- package/src/hooks/useLoginEmployeeInStore/index.js +0 -38
- package/src/hooks/useLogout/helpers/BroadcastChannel.js +0 -31
- package/src/hooks/useLogout/helpers/apiBaseUrl.js +0 -8
- package/src/hooks/useLogout/helpers/fetchData.js +0 -28
- package/src/hooks/useLogout/helpers/getCsrfToken.js +0 -30
- package/src/hooks/useLogout/helpers/index.js +0 -57
- package/src/hooks/useLogout/helpers/logger.js +0 -70
- package/src/hooks/useLogout/helpers/parseUrl.js +0 -36
- package/src/hooks/useLogout/index.js +0 -96
- package/src/hooks/useManageNewOrder/helpers/index.js +0 -45
- package/src/hooks/useManageNewOrder/helpers/mock.js +0 -0
- package/src/hooks/useManageNewOrder/index.js +0 -102
- package/src/hooks/useManageQueryParams/index.js +0 -40
- package/src/hooks/useMobile/index.js +0 -65
- package/src/hooks/useModules/helpers/index.js +0 -1
- package/src/hooks/useModules/helpers/validateModules.js +0 -29
- package/src/hooks/useModules/index.js +0 -58
- package/src/hooks/useMouse/index.ts +0 -50
- package/src/hooks/useMutateHeight/index.js +0 -36
- package/src/hooks/useOrderClient/index.js +0 -5
- package/src/hooks/useOrderStatusTypes/index.ts +0 -2
- package/src/hooks/useOrderStatusTypes/useOrderStatusTypes/index.ts +0 -133
- package/src/hooks/useOrderStatusTypes/useUpdateOrderStatusPriorities/index.ts +0 -97
- package/src/hooks/useOrders/index.js +0 -3
- package/src/hooks/useOrders/queries.js +0 -89
- package/src/hooks/useOrders/useChangeOrderState/index.ts +0 -125
- package/src/hooks/useOrders/useOrdersFromStore/index.ts +0 -77
- package/src/hooks/usePWAInstall/index.js +0 -38
- package/src/hooks/usePortFetcher/index.ts +0 -33
- package/src/hooks/useProductsFood/index.js +0 -253
- package/src/hooks/useProductsFood/queriesStore.js +0 -964
- package/src/hooks/useProductsFood/useEditProduct.js +0 -48
- package/src/hooks/useProductsFood/usetagsProducts.js +0 -98
- package/src/hooks/useProviders/index.js +0 -3
- package/src/hooks/useProviders/queries.js +0 -31
- package/src/hooks/useProviders/useProvidersCreateStore/index.js +0 -12
- package/src/hooks/useProviders/useProvidersDataStore/index.js +0 -24
- package/src/hooks/useProvidersStore/index.js +0 -24
- package/src/hooks/useProvidersStore/queries.js +0 -31
- package/src/hooks/usePushNotificationOrder/index.js +0 -52
- package/src/hooks/usePushNotifications/helpers/index.js +0 -114
- package/src/hooks/usePushNotifications/index.js +0 -149
- package/src/hooks/useQueryLocationsMap/index.js +0 -19
- package/src/hooks/useQueryLocationsMap/queries.js +0 -40
- package/src/hooks/useRatingArrayData/index.js +0 -54
- package/src/hooks/useRatingArrayData/queries.js +0 -19
- package/src/hooks/useReactToPrint/index.js +0 -1223
- package/src/hooks/useRemoveExtraProductFoodsOptional/index.js +0 -23
- package/src/hooks/useRemoveExtraProductFoodsOptional/queries.js +0 -48
- package/src/hooks/useReport/index.js +0 -47
- package/src/hooks/useReport/queries.js +0 -123
- package/src/hooks/useRestaurant/helpers/index.js +0 -24
- package/src/hooks/useRestaurant/helpers/manageStatusOpen.js +0 -26
- package/src/hooks/useRestaurant/index.js +0 -69
- package/src/hooks/useRestaurant/queries.js +0 -81
- package/src/hooks/useRoads/index.js +0 -19
- package/src/hooks/useRoads/queries.js +0 -13
- package/src/hooks/useRoles/index.js +0 -4
- package/src/hooks/useRoles/queries.js +0 -70
- package/src/hooks/useRoles/useCreateRole.js +0 -37
- package/src/hooks/useRoles/useGetRoles.js +0 -36
- package/src/hooks/useRoles/useRemoveRoles.js +0 -40
- package/src/hooks/useRoles/useUpdateRolesPriority.js +0 -44
- package/src/hooks/useSales/helpers/index.js +0 -55
- package/src/hooks/useSales/index.js +0 -1381
- package/src/hooks/useSales/queries.js +0 -424
- package/src/hooks/useSales/useGetAllSales/index.js +0 -25
- package/src/hooks/useSales/useGetSale.js +0 -13
- package/src/hooks/useSales/useTotalSales.js +0 -23
- package/src/hooks/useSaveAvailableProduct/helpers/index.js +0 -38
- package/src/hooks/useSaveAvailableProduct/index.js +0 -31
- package/src/hooks/useSaveAvailableProduct/queries.js +0 -10
- package/src/hooks/useSaveLocation/index.js +0 -16
- package/src/hooks/useSaveLocation/queries.js +0 -19
- package/src/hooks/useSchedule/index.js +0 -78
- package/src/hooks/useSchedule/index.jsx +0 -22
- package/src/hooks/useSchedule/queries.js +0 -43
- package/src/hooks/useScheduleData/index.js +0 -123
- package/src/hooks/useScroll/index.js +0 -56
- package/src/hooks/useScrollRotate/index.js +0 -16
- package/src/hooks/useSetImageProducts/index.js +0 -57
- package/src/hooks/useSetImageProducts/queries.js +0 -18
- package/src/hooks/useSetSession/index.js +0 -44
- package/src/hooks/useSetState/index.js +0 -24
- package/src/hooks/useSetupSchedule/helpers/index.js +0 -85
- package/src/hooks/useSetupSchedule/index.js +0 -272
- package/src/hooks/useStatusOpenStore/helpers/index.js +0 -101
- package/src/hooks/useStatusOpenStore/index.js +0 -179
- package/src/hooks/useStatusOrdersClient/helpers/index.js +0 -14
- package/src/hooks/useStatusOrdersClient/index.js +0 -17
- package/src/hooks/useStatusOrdersClient/queries.js +0 -80
- package/src/hooks/useStockMovements/helpers/index.js +0 -16
- package/src/hooks/useStockMovements/index.js +0 -38
- package/src/hooks/useStore/index.js +0 -80
- package/src/hooks/useStore/queries.js +0 -163
- package/src/hooks/useStoreCalendar/index.js +0 -5
- package/src/hooks/useStoreContacts/index.js +0 -47
- package/src/hooks/useStoreContacts/queries.js +0 -48
- package/src/hooks/useStoreTable/index.js +0 -2
- package/src/hooks/useStoreTable/queries.js +0 -47
- package/src/hooks/useStoreTable/useStoreTableCreate.js +0 -76
- package/src/hooks/useStoreTable/useStoreTables.js +0 -14
- package/src/hooks/useSubscriptionValidation/index.js +0 -41
- package/src/hooks/useTagProducts/index.ts +0 -3
- package/src/hooks/useTagProducts/useDeleteOneTag.ts +0 -106
- package/src/hooks/useTagProducts/useGetAllTags.ts +0 -68
- package/src/hooks/useTagProducts/useRegisterMultipleTags.ts +0 -156
- package/src/hooks/useTimeAgo/useTimeAgo.js +0 -39
- package/src/hooks/useTokenCards/index.js +0 -41
- package/src/hooks/useTopProductsMovements/index.js +0 -27
- package/src/hooks/useTotalAllSales/index.js +0 -25
- package/src/hooks/useTotalProductsInStock/index.js +0 -23
- package/src/hooks/useTotalProductsSold/index.js +0 -23
- package/src/hooks/useTotalProductsSolded/index.js +0 -20
- package/src/hooks/useUpdateCart/index.js +0 -130
- package/src/hooks/useUpdateCartCookie/index.js +0 -43
- package/src/hooks/useUpdateDashboardComponent/index.ts +0 -91
- package/src/hooks/useUpdateExistingOrders/index.js +0 -85
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +0 -60
- package/src/hooks/useUpdateModuleOrder/index.js +0 -37
- package/src/hooks/useUpdateMultipleExtProduct/index.js +0 -33
- package/src/hooks/useUpdateMultipleExtProduct/queries.js +0 -33
- package/src/hooks/useUpdateMultipleProducts/index.js +0 -80
- package/src/hooks/useUpdateMultipleProducts/queries.js +0 -51
- package/src/hooks/useUploadProducts/helpers/index.js +0 -1
- package/src/hooks/useUploadProducts/helpers/parseNumber.js +0 -37
- package/src/hooks/useUploadProducts/helpers/validateProductDataExcel.js +0 -73
- package/src/hooks/useUploadProducts/index.js +0 -422
- package/src/hooks/useUpsertGoal/index.js +0 -68
- package/src/hooks/useUser/index.js +0 -23
- package/src/hooks/useUser/queries.js +0 -131
- package/src/hooks/useWeeklyStockMovement/helpers/index.js +0 -32
- package/src/hooks/useWeeklyStockMovement/index.js +0 -51
- package/src/hooks/useWindowSize/index.js +0 -38
- package/src/index.jsx +0 -9
- package/src/mock/dessert/index.js +0 -16
- package/src/mock/index.js +0 -1
- package/src/security/index.js +0 -1
- package/src/services/index.js +0 -0
- package/src/utils/UtilDateRange.js +0 -31
- package/src/utils/index.js +0 -306
- package/tsconfig.json +0 -5
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import { useEffect, useState } from 'react'
|
|
2
|
-
import {
|
|
3
|
-
useGetSale,
|
|
4
|
-
updateExistingOrders,
|
|
5
|
-
convertDateFormat,
|
|
6
|
-
useOrdersFromStore
|
|
7
|
-
} from '../../hooks'
|
|
8
|
-
import { findOrderByCodeRef, isDateInRange } from './helpers'
|
|
9
|
-
|
|
10
|
-
export const useManageNewOrder = ({
|
|
11
|
-
client,
|
|
12
|
-
idStore,
|
|
13
|
-
setAlertBox = ({ message, duration }) => {
|
|
14
|
-
return { message, duration }
|
|
15
|
-
},
|
|
16
|
-
playNotificationSound = () => {},
|
|
17
|
-
setIsOpenOrder = (boolean) => { return boolean },
|
|
18
|
-
setCountOrders = (number) => { return number },
|
|
19
|
-
sendNotification = ({ title, description, backgroundColor }) => {
|
|
20
|
-
return {
|
|
21
|
-
title,
|
|
22
|
-
description,
|
|
23
|
-
backgroundColor
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}) => {
|
|
27
|
-
const KEY_STATUS_ORDER = 'ACEPTA'
|
|
28
|
-
const [orders, setOrders] = useState([])
|
|
29
|
-
|
|
30
|
-
const [data] = useOrdersFromStore({
|
|
31
|
-
idStore,
|
|
32
|
-
search: '',
|
|
33
|
-
fromDate: convertDateFormat({ start: true }),
|
|
34
|
-
toDate: convertDateFormat({ start: false })
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
useEffect(() => {
|
|
38
|
-
if (data) {
|
|
39
|
-
const dataOrder = data[KEY_STATUS_ORDER]
|
|
40
|
-
if (Array.isArray(dataOrder) && dataOrder) {
|
|
41
|
-
const filteredOrders = dataOrder.filter(order =>
|
|
42
|
-
isDateInRange(order?.pDatCre) && order?.pSState === 1
|
|
43
|
-
) ?? []
|
|
44
|
-
setOrders(filteredOrders)
|
|
45
|
-
setCountOrders(filteredOrders.length)
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}, [data])
|
|
49
|
-
|
|
50
|
-
const { getOneSalesStore } = useGetSale()
|
|
51
|
-
|
|
52
|
-
const handleNewOrder = (order) => {
|
|
53
|
-
const dataOrder = data[KEY_STATUS_ORDER]
|
|
54
|
-
setOrders(dataOrder)
|
|
55
|
-
const { pCodeRef } = order || {}
|
|
56
|
-
if (pCodeRef) {
|
|
57
|
-
const isCodeRefExists = findOrderByCodeRef(data, pCodeRef)
|
|
58
|
-
if (isCodeRefExists) {
|
|
59
|
-
return
|
|
60
|
-
}
|
|
61
|
-
setIsOpenOrder(true)
|
|
62
|
-
getOneSalesStore({
|
|
63
|
-
variables: {
|
|
64
|
-
pCodeRef: pCodeRef ?? ''
|
|
65
|
-
}
|
|
66
|
-
}).then((response) => {
|
|
67
|
-
console.log(response)
|
|
68
|
-
// const currentSale = response?.data?.getOneSalesStore || {}
|
|
69
|
-
client.cache.modify({
|
|
70
|
-
fields: {
|
|
71
|
-
// getAllOrdersFromStore (existingOrders = []) {
|
|
72
|
-
// try {
|
|
73
|
-
// const cache = updateExistingOrders(
|
|
74
|
-
// existingOrders,
|
|
75
|
-
// pCodeRef,
|
|
76
|
-
// 1,
|
|
77
|
-
// currentSale
|
|
78
|
-
// )
|
|
79
|
-
// const currentOrder = cache[KEY_STATUS_ORDER]
|
|
80
|
-
// const filteredOrders = currentOrder.filter(order =>
|
|
81
|
-
// isDateInRange(order.pDatCre)
|
|
82
|
-
// )
|
|
83
|
-
// setOrders(filteredOrders)
|
|
84
|
-
// playNotificationSound()
|
|
85
|
-
// return cache
|
|
86
|
-
// } catch (e) {
|
|
87
|
-
// return existingOrders
|
|
88
|
-
// }
|
|
89
|
-
// }
|
|
90
|
-
}
|
|
91
|
-
})
|
|
92
|
-
})
|
|
93
|
-
sendNotification({
|
|
94
|
-
title: 'Pedido',
|
|
95
|
-
description: 'Nuevo pedido',
|
|
96
|
-
backgroundColor: 'success'
|
|
97
|
-
})
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
return [orders, { handleNewOrder }]
|
|
102
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
'use client'
|
|
2
|
-
import { useRouter, useSearchParams } from 'next/navigation'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Hook to manage query parameters in Next.js 13+ (App Router),
|
|
6
|
-
* with support for custom router/query injection.
|
|
7
|
-
* @param {Object} [options] - Optional parameters.
|
|
8
|
-
* @param {Object} [options.location] - Custom location object with query and push method
|
|
9
|
-
*/
|
|
10
|
-
export const useManageQueryParams = ({
|
|
11
|
-
location
|
|
12
|
-
} = {}) => {
|
|
13
|
-
const router = useRouter()
|
|
14
|
-
const searchParams = useSearchParams()
|
|
15
|
-
|
|
16
|
-
const activeQuery = location?.query || Object.fromEntries(searchParams.entries())
|
|
17
|
-
const pushFn = location?.push || ((url) => router.push(url))
|
|
18
|
-
|
|
19
|
-
const handleQuery = (name, value = '') => {
|
|
20
|
-
const params = new URLSearchParams(activeQuery)
|
|
21
|
-
params.set(name, value)
|
|
22
|
-
pushFn(`?${params.toString()}`)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const handleCleanQuery = (name) => {
|
|
26
|
-
const params = new URLSearchParams(activeQuery)
|
|
27
|
-
params.delete(name)
|
|
28
|
-
pushFn(`?${params.toString()}`)
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const getQuery = (name) => {
|
|
32
|
-
return activeQuery?.[name] || ''
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
getQuery,
|
|
37
|
-
handleQuery,
|
|
38
|
-
handleCleanQuery
|
|
39
|
-
}
|
|
40
|
-
}
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from 'react'
|
|
2
|
-
|
|
3
|
-
export const MEDIA_QUERY = {
|
|
4
|
-
MOBILE: '(max-width: 768px)',
|
|
5
|
-
TABLET: '(max-width: 960px)',
|
|
6
|
-
DESKTOP: '(min-width: 961px)'
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export const useMobile = ({ callback } = {}) => {
|
|
10
|
-
const [isMobile, setIsMobile] = useState(false)
|
|
11
|
-
const [isTablet, setIsTablet] = useState(false)
|
|
12
|
-
const [isDesktop, setIsDesktop] = useState(false)
|
|
13
|
-
|
|
14
|
-
const prevValues = useRef({
|
|
15
|
-
isMobile: false,
|
|
16
|
-
isTablet: false,
|
|
17
|
-
isDesktop: false
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (typeof window === 'undefined') return
|
|
22
|
-
|
|
23
|
-
const mobileQuery = window.matchMedia(MEDIA_QUERY.MOBILE)
|
|
24
|
-
const tabletQuery = window.matchMedia(MEDIA_QUERY.TABLET)
|
|
25
|
-
const desktopQuery = window.matchMedia(MEDIA_QUERY.DESKTOP)
|
|
26
|
-
|
|
27
|
-
const updateMatches = () => {
|
|
28
|
-
const newIsMobile = mobileQuery.matches
|
|
29
|
-
const newIsTablet = tabletQuery.matches
|
|
30
|
-
const newIsDesktop = desktopQuery.matches
|
|
31
|
-
|
|
32
|
-
const hasChanged =
|
|
33
|
-
newIsMobile !== prevValues.current.isMobile ||
|
|
34
|
-
newIsTablet !== prevValues.current.isTablet ||
|
|
35
|
-
newIsDesktop !== prevValues.current.isDesktop
|
|
36
|
-
|
|
37
|
-
if (hasChanged) {
|
|
38
|
-
prevValues.current = {
|
|
39
|
-
isMobile: newIsMobile,
|
|
40
|
-
isTablet: newIsTablet,
|
|
41
|
-
isDesktop: newIsDesktop
|
|
42
|
-
}
|
|
43
|
-
callback?.(prevValues.current)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
setIsMobile(newIsMobile)
|
|
47
|
-
setIsTablet(newIsTablet)
|
|
48
|
-
setIsDesktop(newIsDesktop)
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
updateMatches()
|
|
52
|
-
|
|
53
|
-
mobileQuery.addEventListener('change', updateMatches)
|
|
54
|
-
tabletQuery.addEventListener('change', updateMatches)
|
|
55
|
-
desktopQuery.addEventListener('change', updateMatches)
|
|
56
|
-
|
|
57
|
-
return () => {
|
|
58
|
-
mobileQuery.removeEventListener('change', updateMatches)
|
|
59
|
-
tabletQuery.removeEventListener('change', updateMatches)
|
|
60
|
-
desktopQuery.removeEventListener('change', updateMatches)
|
|
61
|
-
}
|
|
62
|
-
}, [callback])
|
|
63
|
-
|
|
64
|
-
return { isMobile, isTablet, isDesktop }
|
|
65
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './validateModules'
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Validates and filters modules based on the "read" permission.
|
|
3
|
-
* If a module's view does not have "read" permission in the permissions object, the module is removed.
|
|
4
|
-
*
|
|
5
|
-
* @param {Array} modules - List of modules to validate.
|
|
6
|
-
* @param {Object} permissions - Permissions object mapping views to their allowed actions.
|
|
7
|
-
* @returns {Array} - Filtered list of valid modules.
|
|
8
|
-
*/
|
|
9
|
-
export const validateModules = (modules = [], permissions = {}) => {
|
|
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
|
-
|
|
15
|
-
// Validate and filter subModules if they exist
|
|
16
|
-
const validSubModules = module.subModules?.filter(subModule =>
|
|
17
|
-
permissions[subModule.view]?.includes('read')
|
|
18
|
-
) || []
|
|
19
|
-
|
|
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
|
-
|
|
25
|
-
// Return the module with its valid subModules
|
|
26
|
-
return { ...module, subModules: validSubModules }
|
|
27
|
-
})
|
|
28
|
-
.filter(Boolean) // Remove null values
|
|
29
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { gql, useQuery } from '@apollo/client'
|
|
2
|
-
import { validateModules } from './helpers/validateModules'
|
|
3
|
-
|
|
4
|
-
const GET_MODULES = gql`
|
|
5
|
-
query GetModules {
|
|
6
|
-
modules {
|
|
7
|
-
mName
|
|
8
|
-
mId
|
|
9
|
-
mPath
|
|
10
|
-
mPriority
|
|
11
|
-
mIcon
|
|
12
|
-
view
|
|
13
|
-
subModules {
|
|
14
|
-
smId
|
|
15
|
-
smName
|
|
16
|
-
smPath
|
|
17
|
-
view
|
|
18
|
-
smState
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
export const useModules = ({
|
|
25
|
-
dataUser = {},
|
|
26
|
-
callback = () => {}
|
|
27
|
-
}) => {
|
|
28
|
-
const { role } = dataUser ?? {
|
|
29
|
-
role: {
|
|
30
|
-
permissions: {}
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
const {
|
|
34
|
-
loading,
|
|
35
|
-
error,
|
|
36
|
-
data
|
|
37
|
-
} = useQuery(GET_MODULES, {
|
|
38
|
-
fetchPolicy: 'cache-and-network',
|
|
39
|
-
onCompleted: (data) => {
|
|
40
|
-
if (Array.isArray(data?.modules)) {
|
|
41
|
-
callback(data.modules)
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
onError: (error) => {
|
|
45
|
-
console.error('Error fetching modules:', error)
|
|
46
|
-
}
|
|
47
|
-
})
|
|
48
|
-
|
|
49
|
-
const permissions = role?.permissions ?? {}
|
|
50
|
-
|
|
51
|
-
const filteredModules = validateModules(data ? data.modules : [], permissions)
|
|
52
|
-
|
|
53
|
-
return {
|
|
54
|
-
loading,
|
|
55
|
-
error,
|
|
56
|
-
modules: data ? filteredModules : []
|
|
57
|
-
}
|
|
58
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { useEffect, useRef, useState } from "react";
|
|
2
|
-
|
|
3
|
-
export function useMouse(
|
|
4
|
-
options: { resetOnExit } = { resetOnExit: false }
|
|
5
|
-
) {
|
|
6
|
-
const [position, setPosition] = useState({ x: 0, y: 0 });
|
|
7
|
-
|
|
8
|
-
const ref = useRef();
|
|
9
|
-
|
|
10
|
-
const setMousePosition = (event) => {
|
|
11
|
-
if (ref.current) {
|
|
12
|
-
const rect = event.currentTarget.getBoundingClientRect();
|
|
13
|
-
|
|
14
|
-
const x = Math.max(
|
|
15
|
-
0,
|
|
16
|
-
Math.round(
|
|
17
|
-
event.pageX - rect.left - (window.pageXOffset || window.scrollX)
|
|
18
|
-
)
|
|
19
|
-
);
|
|
20
|
-
|
|
21
|
-
const y = Math.max(
|
|
22
|
-
0,
|
|
23
|
-
Math.round(
|
|
24
|
-
event.pageY - rect.top - (window.pageYOffset || window.scrollY)
|
|
25
|
-
)
|
|
26
|
-
);
|
|
27
|
-
|
|
28
|
-
setPosition({ x, y });
|
|
29
|
-
} else {
|
|
30
|
-
setPosition({ x: event.clientX, y: event.clientY });
|
|
31
|
-
}
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const resetMousePosition = () => setPosition({ x: 0, y: 0 });
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
const element = ref?.current ? ref.current : document;
|
|
38
|
-
element.addEventListener("mousemove", setMousePosition);
|
|
39
|
-
if (options.resetOnExit)
|
|
40
|
-
element.addEventListener("mouseleave", resetMousePosition);
|
|
41
|
-
|
|
42
|
-
return () => {
|
|
43
|
-
element.removeEventListener("mousemove", setMousePosition);
|
|
44
|
-
if (options.resetOnExit)
|
|
45
|
-
element.removeEventListener("mouseleave", resetMousePosition);
|
|
46
|
-
};
|
|
47
|
-
}, [ref.current]);
|
|
48
|
-
|
|
49
|
-
return { ref, ...position };
|
|
50
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
useEffect,
|
|
3
|
-
useRef,
|
|
4
|
-
useState
|
|
5
|
-
} from 'react'
|
|
6
|
-
|
|
7
|
-
export const useMutateHeight = ({ isCollapsed = false }) => {
|
|
8
|
-
const [collapsed, setCollapsed] = useState(isCollapsed)
|
|
9
|
-
const childrenContainerRef = useRef(null)
|
|
10
|
-
|
|
11
|
-
useEffect(() => {
|
|
12
|
-
setCollapsed(isCollapsed)
|
|
13
|
-
if (childrenContainerRef.current !== null) {
|
|
14
|
-
const height = isCollapsed
|
|
15
|
-
? childrenContainerRef.current.scrollHeight
|
|
16
|
-
: 0
|
|
17
|
-
childrenContainerRef.current.style.height = `${height}px`
|
|
18
|
-
}
|
|
19
|
-
}, [isCollapsed])
|
|
20
|
-
|
|
21
|
-
const handleCollapsed = visible => {
|
|
22
|
-
setCollapsed(visible)
|
|
23
|
-
if (childrenContainerRef.current !== null) {
|
|
24
|
-
const height = visible ? childrenContainerRef.current.scrollHeight : 0
|
|
25
|
-
childrenContainerRef.current.style.height = `${height}px`
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
handleCollapsed,
|
|
31
|
-
childrenContainerRef,
|
|
32
|
-
collapsed
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
// https://codesandbox.io/s/dropdown-navigation-9fx6r?file=/src/Navigation/Navigation.js:357-775
|
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
import { useQuery, gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* GraphQL query to fetch order status types.
|
|
5
|
-
*/
|
|
6
|
-
const GET_ORDER_STATUS_TYPES = gql`
|
|
7
|
-
query getAllOrderStatusTypes {
|
|
8
|
-
getAllOrderStatusTypes {
|
|
9
|
-
message
|
|
10
|
-
success
|
|
11
|
-
__typename
|
|
12
|
-
data {
|
|
13
|
-
backgroundColor
|
|
14
|
-
color
|
|
15
|
-
createdAt
|
|
16
|
-
description
|
|
17
|
-
idStatus
|
|
18
|
-
name
|
|
19
|
-
priority
|
|
20
|
-
state
|
|
21
|
-
updatedAt
|
|
22
|
-
__typename
|
|
23
|
-
}
|
|
24
|
-
pagination {
|
|
25
|
-
currentPage
|
|
26
|
-
totalPages
|
|
27
|
-
totalRecords
|
|
28
|
-
__typename
|
|
29
|
-
}
|
|
30
|
-
errors {
|
|
31
|
-
context {
|
|
32
|
-
key
|
|
33
|
-
label
|
|
34
|
-
limit
|
|
35
|
-
value
|
|
36
|
-
__typename
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
`
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* @typedef {Object} OrderStatusType
|
|
45
|
-
* @property {string} idStatus - Unique identifier for the status
|
|
46
|
-
* @property {string} name - Name of the status
|
|
47
|
-
* @property {number} priority - Priority level
|
|
48
|
-
* @property {string} backgroundColor - Background color in hex
|
|
49
|
-
* @property {string} color - Text color in hex
|
|
50
|
-
* @property {number} state - Status state (e.g. active/inactive)
|
|
51
|
-
*/
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Custom hook to fetch order status types.
|
|
55
|
-
*
|
|
56
|
-
* @returns {{
|
|
57
|
-
* statusTypes: OrderStatusType[] | null,
|
|
58
|
-
* loading: boolean,
|
|
59
|
-
* error: Error | undefined,
|
|
60
|
-
* refetch: () => void
|
|
61
|
-
* }}
|
|
62
|
-
*/
|
|
63
|
-
/**
|
|
64
|
-
* Retrieves order status types via the corresponding GraphQL query and exposes loading state, errors, and refetch capabilities.
|
|
65
|
-
*
|
|
66
|
-
* @param options - Optional configuration values for the hook.
|
|
67
|
-
* @param options.callback - Callback invoked when the query completes successfully, receiving the raw query response.
|
|
68
|
-
* @returns An object containing the normalized status types data along with loading, error, and refetch helpers.
|
|
69
|
-
*/
|
|
70
|
-
export interface OrderStatusType {
|
|
71
|
-
idStatus: string
|
|
72
|
-
name: string
|
|
73
|
-
priority: number
|
|
74
|
-
backgroundColor: string
|
|
75
|
-
color: string
|
|
76
|
-
state: number
|
|
77
|
-
description: string
|
|
78
|
-
createdAt: string
|
|
79
|
-
updatedAt: string
|
|
80
|
-
__typename: string
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
export interface OrderStatusTypeErrorContext {
|
|
84
|
-
key: string
|
|
85
|
-
label: string
|
|
86
|
-
limit: number
|
|
87
|
-
value: string
|
|
88
|
-
__typename: string
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
export interface OrderStatusTypeError {
|
|
92
|
-
context: OrderStatusTypeErrorContext[]
|
|
93
|
-
__typename: string
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface GetAllOrderStatusTypesResponse {
|
|
97
|
-
message: string
|
|
98
|
-
success: boolean
|
|
99
|
-
__typename: string
|
|
100
|
-
data: OrderStatusType[]
|
|
101
|
-
errors?: OrderStatusTypeError[] | null
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface OrderStatusTypesQueryResult {
|
|
105
|
-
getAllOrderStatusTypes: GetAllOrderStatusTypesResponse
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
export interface UseOrderStatusTypesOptions {
|
|
109
|
-
callback?: (payload: OrderStatusTypesQueryResult) => void
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
export const useOrderStatusTypes = ({
|
|
113
|
-
callback = () => undefined
|
|
114
|
-
}: UseOrderStatusTypesOptions = {}) => {
|
|
115
|
-
const {
|
|
116
|
-
data,
|
|
117
|
-
loading,
|
|
118
|
-
error,
|
|
119
|
-
refetch
|
|
120
|
-
} = useQuery<OrderStatusTypesQueryResult>(GET_ORDER_STATUS_TYPES, {
|
|
121
|
-
onCompleted: callback,
|
|
122
|
-
fetchPolicy: 'cache-and-network'
|
|
123
|
-
})
|
|
124
|
-
|
|
125
|
-
const statusTypes = data?.getAllOrderStatusTypes?.data ?? null
|
|
126
|
-
|
|
127
|
-
return {
|
|
128
|
-
data: statusTypes,
|
|
129
|
-
loading,
|
|
130
|
-
error,
|
|
131
|
-
refetch
|
|
132
|
-
}
|
|
133
|
-
}
|
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import { gql, useMutation } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* GraphQL mutation to update the priority of order statuses.
|
|
5
|
-
*/
|
|
6
|
-
const UPDATE_ORDER_STATUS_PRIORITIES = gql`
|
|
7
|
-
mutation UpdateOrderStatusPriorities($data: [OrderStatusPriorityInput!]!) {
|
|
8
|
-
updateOrderStatusPriorities(data: $data) {
|
|
9
|
-
success
|
|
10
|
-
message
|
|
11
|
-
errors {
|
|
12
|
-
path
|
|
13
|
-
message
|
|
14
|
-
}
|
|
15
|
-
data {
|
|
16
|
-
idStatus
|
|
17
|
-
name
|
|
18
|
-
priority
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Custom hook to update the priority of order statuses.
|
|
26
|
-
*
|
|
27
|
-
* @returns {{
|
|
28
|
-
* updatePriorities: (input: OrderStatusPriorityInput[]) => Promise<UpdateStatusPriorityResponse>,
|
|
29
|
-
* loading: boolean,
|
|
30
|
-
* error: any
|
|
31
|
-
* }}
|
|
32
|
-
*/
|
|
33
|
-
export const useUpdateOrderStatusPriorities = ({
|
|
34
|
-
sendNotification = (...res) => { }
|
|
35
|
-
} = {}) => {
|
|
36
|
-
const [mutate, { loading, error }] = useMutation(UPDATE_ORDER_STATUS_PRIORITIES)
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* Executes the mutation to update order status priorities.
|
|
40
|
-
*
|
|
41
|
-
* @param {OrderStatusPriorityInput[]} input - Array of objects containing idStatus and priority.
|
|
42
|
-
* @returns {Promise<UpdateStatusPriorityResponse>} Response from the server.
|
|
43
|
-
*/
|
|
44
|
-
const updatePriorities = async (input) => {
|
|
45
|
-
if (!Array.isArray(input) || input.length === 0) {
|
|
46
|
-
return {
|
|
47
|
-
success: false,
|
|
48
|
-
message: 'Input must be a non-empty array.',
|
|
49
|
-
data: [],
|
|
50
|
-
errors: [{ path: 'input', message: 'Invalid or empty input array.' }],
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const isValid = input.every(
|
|
55
|
-
({ idStatus, priority }) =>
|
|
56
|
-
typeof idStatus === 'string' &&
|
|
57
|
-
idStatus.length > 0 &&
|
|
58
|
-
typeof priority === 'number' &&
|
|
59
|
-
priority >= 0
|
|
60
|
-
)
|
|
61
|
-
|
|
62
|
-
if (!isValid) {
|
|
63
|
-
return {
|
|
64
|
-
success: false,
|
|
65
|
-
message: 'Validation failed for one or more input items.',
|
|
66
|
-
data: [],
|
|
67
|
-
errors: [{ path: 'input', message: 'Each item must have a valid idStatus and priority.' }],
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
try {
|
|
72
|
-
const { data } = await mutate({ variables: { data: input } })
|
|
73
|
-
if (data) {
|
|
74
|
-
const { updateOrderStatusPriorities } = data ?? {}
|
|
75
|
-
const { success, message } = updateOrderStatusPriorities ?? {
|
|
76
|
-
success: false,
|
|
77
|
-
message: ''
|
|
78
|
-
}
|
|
79
|
-
return sendNotification({
|
|
80
|
-
title: success ? 'Exitoso' : 'Error',
|
|
81
|
-
description: message,
|
|
82
|
-
backgroundColor: success ? 'success' : 'error'
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
return data.updateOrderStatusPriorities
|
|
86
|
-
} catch (err) {
|
|
87
|
-
return {
|
|
88
|
-
success: false,
|
|
89
|
-
message: 'Unexpected error while updating priorities.',
|
|
90
|
-
data: [],
|
|
91
|
-
errors: [{ path: 'mutation', message: err.message }],
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return [updatePriorities, { loading, error }]
|
|
97
|
-
}
|