npm-pkg-hook 1.13.0 → 1.13.1
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.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -2
- package/.babelrc +0 -0
- package/.github/pull_request_template.md +0 -18
- package/.github/workflows/pepeline.yaml +0 -30
- package/eslint.config.mts +0 -153
- package/expire.json +0 -1
- package/jsconfig.json +0 -28
- package/script.txt +0 -7
- package/src/config/client/errors.ts +0 -39
- package/src/config/client/index.ts +0 -1
- package/src/config/content/en.json +0 -5
- package/src/config/content/es.json +0 -5
- package/src/config/content/index.ts +0 -16
- package/src/cookies/index.ts +0 -3
- package/src/hooks/addTenMinutes/index.ts +0 -14
- package/src/hooks/calculateLogLatHaversine/index.ts +0 -41
- package/src/hooks/completeSchedules/index.ts +0 -22
- package/src/hooks/convertToMilitaryTime/index.ts +0 -18
- package/src/hooks/generateStoreURL/index.ts +0 -41
- package/src/hooks/generateTemplate/index.ts +0 -66
- package/src/hooks/getCardType/index.ts +0 -24
- package/src/hooks/getCategoriesWithProduct/helpers/index.ts +0 -7
- package/src/hooks/getCategoriesWithProduct/index.ts +0 -62
- package/src/hooks/getGlobalSession/index.ts +0 -69
- package/src/hooks/getSession/index.ts +0 -72
- package/src/hooks/getTodayTimestamps/index.ts +0 -70
- package/src/hooks/getTotalHours/index.ts +0 -76
- package/src/hooks/handleLogin/index.ts +0 -14
- package/src/hooks/index.ts +0 -154
- package/src/hooks/isTokenExpired/index.ts +0 -17
- package/src/hooks/newMessageSubscription/index.ts +0 -28
- package/src/hooks/newStoreOrderSubscription/index.ts +0 -26
- package/src/hooks/statusOpenStores/helpers/index.ts +0 -124
- package/src/hooks/statusOpenStores/index.ts +0 -221
- package/src/hooks/updateExtProductFoodsOptional/index.ts +0 -49
- package/src/hooks/useAcumulateDate/index.ts +0 -18
- package/src/hooks/useAllStoresPendingToRegister/index.ts +0 -37
- package/src/hooks/useAmountInput/index.ts +0 -127
- package/src/hooks/useAnimationFrame/index.ts +0 -45
- package/src/hooks/useAnimationText/index.ts +0 -31
- package/src/hooks/useAsideCart/helpers/index.ts +0 -22
- package/src/hooks/useAsideCart/index.ts +0 -217
- package/src/hooks/useAsideCart/queries.ts +0 -10
- package/src/hooks/useBanner/index.ts +0 -20
- package/src/hooks/useCart/index.ts +0 -2
- package/src/hooks/useCart/queries.ts +0 -174
- package/src/hooks/useCart/useCart/helpers/index.ts +0 -79
- package/src/hooks/useCart/useCart/index.ts +0 -424
- package/src/hooks/useCart/useGetCart/index.ts +0 -34
- package/src/hooks/useCatWithProduct/index.ts +0 -54
- package/src/hooks/useCatWithProduct/queries.ts +0 -200
- package/src/hooks/useCatWithProduct/types/index.ts +0 -104
- package/src/hooks/useCatWithProductClient/index.ts +0 -57
- package/src/hooks/useCatWithProductClient/queries.ts +0 -56
- package/src/hooks/useCategoriesProduct/index.ts +0 -14
- package/src/hooks/useCategoriesProduct/queries.ts +0 -16
- package/src/hooks/useCategoryInStore/index.ts +0 -167
- package/src/hooks/useCategoryInStore/queries.ts +0 -78
- package/src/hooks/useCategoryStore/index.ts +0 -8
- package/src/hooks/useCategoryStore/queries.ts +0 -16
- package/src/hooks/useChartData/index.ts +0 -171
- package/src/hooks/useChartData/useChartData/index.ts +0 -200
- package/src/hooks/useChartData/useChartDataAllOrders/index.ts +0 -94
- package/src/hooks/useChatRoomSubscription/index.ts +0 -28
- package/src/hooks/useCheckbox/index.ts +0 -115
- package/src/hooks/useCities/index.ts +0 -14
- package/src/hooks/useCities/queries.ts +0 -12
- package/src/hooks/useClients/index.ts +0 -97
- package/src/hooks/useClients/queries.ts +0 -215
- package/src/hooks/useColorByLetters/helpers/alea.ts +0 -73
- package/src/hooks/useColorByLetters/helpers/colors.ts +0 -45
- package/src/hooks/useColorByLetters/helpers/index.ts +0 -24
- package/src/hooks/useColorByLetters/helpers/mersenne_twister.ts +0 -118
- package/src/hooks/useColorByLetters/index.ts +0 -24
- package/src/hooks/useConnection/index.ts +0 -24
- package/src/hooks/useCountries/index.ts +0 -20
- package/src/hooks/useCountries/queries.ts +0 -12
- package/src/hooks/useCreateDeliveryTime/index.ts +0 -51
- package/src/hooks/useCreateOrderStatusType/index.ts +0 -134
- package/src/hooks/useCreateProduct/helpers/index.ts +0 -23
- package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/index.ts +0 -52
- package/src/hooks/useCreateProduct/helpers/useEditImageProduct/index.ts +0 -182
- package/src/hooks/useCreateProduct/index.ts +0 -337
- package/src/hooks/useCreateStorePendingToRegister/index.ts +0 -17
- package/src/hooks/useCreateStorePendingToRegister/queries.ts +0 -10
- package/src/hooks/useDashboardComponents/index.ts +0 -50
- package/src/hooks/useDeleteExtraProductFoods/index.ts +0 -13
- package/src/hooks/useDeleteSubProductOptional/index.ts +0 -32
- package/src/hooks/useDeleteSubProductOptional/queries.ts +0 -10
- package/src/hooks/useDeliveryTime/index.ts +0 -29
- package/src/hooks/useDepartments/index.ts +0 -14
- package/src/hooks/useDepartments/queries.ts +0 -13
- package/src/hooks/useDessert/helpers/index.ts +0 -51
- package/src/hooks/useDessert/index.ts +0 -529
- package/src/hooks/useDessertWithPrice/helpers/index.ts +0 -76
- package/src/hooks/useDessertWithPrice/index.ts +0 -381
- package/src/hooks/useDessertWithPrice/queries.ts +0 -18
- package/src/hooks/useDevWS/index.ts +0 -53
- package/src/hooks/useDevices/index.ts +0 -2
- package/src/hooks/useDevices/queries.ts +0 -28
- package/src/hooks/useDevices/useGetDevices.ts +0 -28
- package/src/hooks/useDevices/useRegisterDevices.ts +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 -105
- package/src/hooks/useDownloadReports/useGetReportByDateRange/index.ts +0 -116
- package/src/hooks/useDrag/index.ts +0 -79
- package/src/hooks/useDropzone/index.ts +0 -94
- package/src/hooks/useDynamicAuth/index.ts +0 -14
- package/src/hooks/useDynamicAuth/queries.ts +0 -24
- package/src/hooks/useEditCategory/index.ts +0 -41
- package/src/hooks/useEditOneExtProductFoodOptional/index.ts +0 -28
- package/src/hooks/useEditOneExtProductFoodOptional/queries.ts +0 -16
- package/src/hooks/useEditSubProductOptional/index.ts +0 -12
- package/src/hooks/useEditSubProductOptional/queries.ts +0 -10
- package/src/hooks/useEmployee/index.ts +0 -18
- package/src/hooks/useEmployee/queries.ts +0 -85
- package/src/hooks/useEmployee/useCreateEmployee.ts +0 -90
- package/src/hooks/useEvent/index.ts +0 -34
- package/src/hooks/useFavoriteStores/index.ts +0 -31
- package/src/hooks/useFavoriteStores/queries.ts +0 -54
- package/src/hooks/useFetchJson/index.ts +0 -25
- package/src/hooks/useFetchMoreInteractions/index.jsx +0 -39
- package/src/hooks/useFilterConfigs/index.ts +0 -173
- package/src/hooks/useFingerprintjs/index.ts +0 -197
- package/src/hooks/useFormTools/index.ts +0 -143
- package/src/hooks/useFormatDate/index.ts +0 -91
- package/src/hooks/useFormatNumberPhone/index.ts +0 -23
- package/src/hooks/useFullScreenMode/index.ts +0 -61
- package/src/hooks/useGenerateNumberArray/index.ts +0 -17
- package/src/hooks/useGetAllLocationUser/index.ts +0 -13
- package/src/hooks/useGetAllLocationUser/queries.ts +0 -44
- package/src/hooks/useGetAllSales/index.ts +0 -26
- package/src/hooks/useGetCookies/index.ts +0 -43
- package/src/hooks/useGetExtProductFoodsSubOptionalAll/index.ts +0 -15
- package/src/hooks/useGetFoodRecomended/index.ts +0 -33
- package/src/hooks/useGetFoodRecomended/queries.ts +0 -47
- package/src/hooks/useGetMessagesToRoom/index.ts +0 -23
- package/src/hooks/useGetMinPrice/index.ts +0 -13
- package/src/hooks/useGetMinPrice/queries.ts +0 -7
- package/src/hooks/useGetOneStoreRating/index.ts +0 -41
- package/src/hooks/useGetOneStoreRating/queries.ts +0 -18
- package/src/hooks/useGetSalesAmountToday/index.ts +0 -31
- package/src/hooks/useGetStoreCookie/index.ts +0 -21
- package/src/hooks/useGoogleLogin/index.ts +0 -169
- package/src/hooks/useGoogleLogin/loadScript.ts +0 -15
- package/src/hooks/useGoogleLogin/removeScript.ts +0 -7
- package/src/hooks/useHover/index.ts +0 -32
- package/src/hooks/useImageOptimization/index.ts +0 -32
- package/src/hooks/useImageUploaderProduct/helper/canvasUtils.ts +0 -146
- package/src/hooks/useImageUploaderProduct/helper/getOrientation.ts +0 -54
- package/src/hooks/useImageUploaderProduct/helper/index.ts +0 -5
- package/src/hooks/useImageUploaderProduct/index.ts +0 -295
- package/src/hooks/useImageWeight/index.ts +0 -55
- package/src/hooks/useImagesStore/index.ts +0 -227
- package/src/hooks/useImagesStore/queries.ts +0 -193
- package/src/hooks/useImagesStore/utils/index.ts +0 -4
- package/src/hooks/useIncomingOrders/index.ts +0 -11
- package/src/hooks/useIncomingOrders/queries.ts +0 -87
- package/src/hooks/useInnerHtml/index.ts +0 -39
- package/src/hooks/useIntersection/index.ts +0 -84
- package/src/hooks/useInventory/index.ts +0 -2
- package/src/hooks/useInventory/queries.ts +0 -58
- package/src/hooks/useInventory/useGetProductsInStock.ts +0 -16
- package/src/hooks/useInventory/useUpdateManageStock.ts +0 -41
- package/src/hooks/useKeypress/index.ts +0 -28
- package/src/hooks/useLazyScript/index.ts +0 -74
- package/src/hooks/useLocalBackendIp/index.ts +0 -34
- package/src/hooks/useLocalSorage/index.ts +0 -36
- package/src/hooks/useLocationManager/index.ts +0 -63
- package/src/hooks/useLocationNavigate/index.ts +0 -54
- package/src/hooks/useLoginEmployeeInStore/index.ts +0 -38
- package/src/hooks/useLogout/helpers/BroadcastChannel.ts +0 -74
- package/src/hooks/useLogout/helpers/apiBaseUrl.ts +0 -12
- package/src/hooks/useLogout/helpers/fetchData.ts +0 -37
- package/src/hooks/useLogout/helpers/getCsrfToken.ts +0 -37
- package/src/hooks/useLogout/helpers/index.ts +0 -65
- package/src/hooks/useLogout/helpers/logger.ts +0 -88
- package/src/hooks/useLogout/helpers/parseUrl.ts +0 -39
- package/src/hooks/useLogout/index.ts +0 -105
- package/src/hooks/useManageNewOrder/helpers/index.ts +0 -45
- package/src/hooks/useManageNewOrder/helpers/mock.ts +0 -0
- package/src/hooks/useManageNewOrder/index.ts +0 -104
- package/src/hooks/useManageQueryParams/index.ts +0 -120
- package/src/hooks/useMobile/index.ts +0 -65
- package/src/hooks/useModules/helpers/index.ts +0 -1
- package/src/hooks/useModules/helpers/validateModules.ts +0 -43
- package/src/hooks/useModules/index.ts +0 -124
- package/src/hooks/useMouse/index.ts +0 -55
- package/src/hooks/useMutateHeight/index.ts +0 -36
- package/src/hooks/useOrderClient/index.ts +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 -99
- package/src/hooks/useOrders/index.ts +0 -3
- package/src/hooks/useOrders/queries.ts +0 -99
- package/src/hooks/useOrders/useChangeOrderState/index.ts +0 -128
- package/src/hooks/useOrders/useOrdersFromStore/index.ts +0 -77
- package/src/hooks/usePWAInstall/index.ts +0 -38
- package/src/hooks/usePaymentMethod/index.ts +0 -3
- package/src/hooks/usePaymentMethod/paymentMethod.gql.ts +0 -62
- package/src/hooks/usePaymentMethod/paymentMethod.types.ts +0 -28
- package/src/hooks/usePaymentMethod/useCreatePaymentMethod/index.ts +0 -25
- package/src/hooks/usePaymentMethod/useGetAllPaymentMethods/index.ts +0 -19
- package/src/hooks/usePaymentMethod/useGetPaymentMethod/index.ts +0 -26
- package/src/hooks/usePortFetcher/index.ts +0 -33
- package/src/hooks/usePrintSaleTicket/index.ts +0 -68
- package/src/hooks/useProductsFood/index.ts +0 -341
- package/src/hooks/useProductsFood/queriesStore.ts +0 -964
- package/src/hooks/useProductsFood/types/index.ts +0 -0
- package/src/hooks/useProductsFood/useEditProduct.ts +0 -49
- package/src/hooks/useProductsFood/usetagsProducts.ts +0 -101
- package/src/hooks/useProviders/index.ts +0 -3
- package/src/hooks/useProviders/queries.ts +0 -31
- package/src/hooks/useProviders/useProvidersCreateStore/index.ts +0 -13
- package/src/hooks/useProviders/useProvidersDataStore/index.ts +0 -25
- package/src/hooks/useProvidersStore/index.ts +0 -25
- package/src/hooks/useProvidersStore/queries.ts +0 -31
- package/src/hooks/usePushNotificationOrder/index.ts +0 -52
- package/src/hooks/usePushNotifications/helpers/index.ts +0 -123
- package/src/hooks/usePushNotifications/index.ts +0 -150
- package/src/hooks/useQueryLocationsMap/index.ts +0 -20
- package/src/hooks/useQueryLocationsMap/queries.ts +0 -40
- package/src/hooks/useRatingArrayData/index.ts +0 -54
- package/src/hooks/useRatingArrayData/queries.ts +0 -19
- package/src/hooks/useReactToPrint/index.ts +0 -4
- package/src/hooks/useReactToPrint/index.txt +0 -1223
- package/src/hooks/useRemoveExtraProductFoodsOptional/index.ts +0 -24
- package/src/hooks/useRemoveExtraProductFoodsOptional/queries.ts +0 -48
- package/src/hooks/useReport/index.ts +0 -48
- package/src/hooks/useReport/queries.ts +0 -72
- package/src/hooks/useRestaurant/helpers/index.ts +0 -28
- package/src/hooks/useRestaurant/helpers/manageStatusOpen.ts +0 -26
- package/src/hooks/useRestaurant/index.ts +0 -71
- package/src/hooks/useRestaurant/queries.ts +0 -81
- package/src/hooks/useRoads/index.ts +0 -20
- package/src/hooks/useRoads/queries.ts +0 -13
- package/src/hooks/useRoles/index.ts +0 -4
- package/src/hooks/useRoles/queries.ts +0 -70
- package/src/hooks/useRoles/useCreateRole.ts +0 -40
- package/src/hooks/useRoles/useGetRoles.ts +0 -37
- package/src/hooks/useRoles/useRemoveRoles.ts +0 -40
- package/src/hooks/useRoles/useUpdateRolesPriority.ts +0 -44
- package/src/hooks/useSales/helpers/add-product.utils.ts +0 -120
- package/src/hooks/useSales/helpers/apply-discount-to-cart.utils.ts +0 -292
- package/src/hooks/useSales/helpers/comment-product.utils.ts +0 -41
- package/src/hooks/useSales/helpers/constants/index.ts +0 -38
- package/src/hooks/useSales/helpers/extras.utils.ts +0 -42
- package/src/hooks/useSales/helpers/filterProductsByCarProId.utils.ts +0 -17
- package/src/hooks/useSales/helpers/increment-product-quantity.utils.ts +0 -76
- package/src/hooks/useSales/helpers/index.ts +0 -3
- package/src/hooks/useSales/helpers/initializer.utils.ts +0 -22
- package/src/hooks/useSales/helpers/isStockInsufficient.ts +0 -3
- package/src/hooks/useSales/helpers/remove-product.utils.test.ts +0 -49
- package/src/hooks/useSales/helpers/remove-product.utils.ts +0 -34
- package/src/hooks/useSales/helpers/resolveProduct.ts +0 -29
- package/src/hooks/useSales/helpers/useAddToCart.ts +0 -64
- package/src/hooks/useSales/index.ts +0 -1418
- package/src/hooks/useSales/queries.ts +0 -532
- package/src/hooks/useSales/types/index.ts +0 -206
- package/src/hooks/useSales/types/use-sales.types.ts +0 -8
- package/src/hooks/useSales/useGetSale.ts +0 -21
- package/src/hooks/useSales/useTotalSales.ts +0 -24
- package/src/hooks/useSaveAvailableProduct/helpers/index.ts +0 -38
- package/src/hooks/useSaveAvailableProduct/index.ts +0 -32
- package/src/hooks/useSaveAvailableProduct/queries.ts +0 -10
- package/src/hooks/useSaveLocation/index.ts +0 -17
- package/src/hooks/useSaveLocation/queries.ts +0 -19
- package/src/hooks/useSchedule/index.ts +0 -35
- package/src/hooks/useSchedule/queries.ts +0 -43
- package/src/hooks/useSchedule/schedule.ts +0 -79
- package/src/hooks/useScheduleData/index.ts +0 -135
- package/src/hooks/useScroll/index.ts +0 -56
- package/src/hooks/useScrollRotate/index.ts +0 -16
- package/src/hooks/useSetImageProducts/index.ts +0 -59
- package/src/hooks/useSetImageProducts/queries.ts +0 -18
- package/src/hooks/useSetSession/index.ts +0 -44
- package/src/hooks/useSetState/index.ts +0 -24
- package/src/hooks/useSetupSchedule/helpers/index.ts +0 -85
- package/src/hooks/useSetupSchedule/index.ts +0 -284
- package/src/hooks/useStatusOpenStore/helpers/index.ts +0 -124
- package/src/hooks/useStatusOpenStore/index.ts +0 -195
- package/src/hooks/useStatusOrdersClient/helpers/index.ts +0 -14
- package/src/hooks/useStatusOrdersClient/index.ts +0 -18
- package/src/hooks/useStatusOrdersClient/queries.ts +0 -80
- package/src/hooks/useStock/index.ts +0 -1
- package/src/hooks/useStock/useStockUpdatedAllSubscription.ts +0 -40
- package/src/hooks/useStockMovements/helpers/index.ts +0 -16
- package/src/hooks/useStockMovements/index.ts +0 -39
- package/src/hooks/useStore/index.ts +0 -83
- package/src/hooks/useStore/queries.ts +0 -163
- package/src/hooks/useStoreCalendar/index.ts +0 -5
- package/src/hooks/useStoreContacts/index.ts +0 -53
- package/src/hooks/useStoreContacts/queries.ts +0 -48
- package/src/hooks/useStoreTable/index.ts +0 -2
- package/src/hooks/useStoreTable/queries.ts +0 -47
- package/src/hooks/useStoreTable/useStoreTableCreate.ts +0 -77
- package/src/hooks/useStoreTable/useStoreTables.ts +0 -15
- package/src/hooks/useSubscriptionValidation/index.ts +0 -112
- 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 -157
- package/src/hooks/useTheme/index.ts +0 -65
- package/src/hooks/useTimeAgo/useTimeAgo.ts +0 -39
- package/src/hooks/useTokenCards/index.ts +0 -45
- package/src/hooks/useTopProductsMovements/index.ts +0 -27
- package/src/hooks/useTotalAllSales/index.ts +0 -25
- package/src/hooks/useTotalProductsInStock/index.ts +0 -23
- package/src/hooks/useTotalProductsSold/index.ts +0 -23
- package/src/hooks/useTotalProductsSolded/index.ts +0 -20
- package/src/hooks/useUpdateCart/index.ts +0 -131
- package/src/hooks/useUpdateCartCookie/index.ts +0 -60
- package/src/hooks/useUpdateDashboardComponent/index.ts +0 -91
- package/src/hooks/useUpdateExistingOrders/index.ts +0 -85
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.ts +0 -61
- package/src/hooks/useUpdateModuleOrder/index.ts +0 -37
- package/src/hooks/useUpdateMultipleExtProduct/index.ts +0 -34
- package/src/hooks/useUpdateMultipleExtProduct/queries.ts +0 -33
- package/src/hooks/useUpdateMultipleProducts/index.ts +0 -117
- package/src/hooks/useUpdateMultipleProducts/queries.ts +0 -51
- package/src/hooks/useUploadProducts/helpers/index.ts +0 -1
- package/src/hooks/useUploadProducts/helpers/parseNumber.ts +0 -37
- package/src/hooks/useUploadProducts/helpers/validateProductDataExcel.ts +0 -73
- package/src/hooks/useUploadProducts/index.ts +0 -442
- package/src/hooks/useUpsertGoal/index.ts +0 -68
- package/src/hooks/useUser/index.ts +0 -24
- package/src/hooks/useUser/queries.ts +0 -131
- package/src/hooks/useWeeklyStockMovement/helpers/index.ts +0 -32
- package/src/hooks/useWeeklyStockMovement/index.ts +0 -52
- package/src/hooks/useWindowSize/index.ts +0 -45
- package/src/index.ts +0 -11
- package/src/mock/dessert/index.ts +0 -16
- package/src/mock/index.ts +0 -1
- package/src/security/index.ts +0 -1
- package/src/services/index.ts +0 -1
- package/src/utils/UtilDateRange.ts +0 -56
- package/src/utils/generateCode.ts +0 -222
- package/src/utils/index.ts +0 -2
- package/src/utils/utils.ts +0 -344
- package/tsconfig.eslint.json +0 -16
- package/tsconfig.json +0 -21
- package/tsup.config.ts +0 -24
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { useMutation } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
import { DELETE_CAT_EXTRA_PRODUCTS } from './queries'
|
|
4
|
-
|
|
5
|
-
export const useRemoveExtraProductFoodsOptional = () => {
|
|
6
|
-
const [DeleteExtProductFoodsOptional, { loading, error }] = useMutation(DELETE_CAT_EXTRA_PRODUCTS)
|
|
7
|
-
|
|
8
|
-
const handleDeleteOptional = async elem => {
|
|
9
|
-
const { state, opExPid } = elem || {}
|
|
10
|
-
DeleteExtProductFoodsOptional({
|
|
11
|
-
variables: {
|
|
12
|
-
state,
|
|
13
|
-
opExPid,
|
|
14
|
-
isCustomOpExPid: true
|
|
15
|
-
}
|
|
16
|
-
})
|
|
17
|
-
}
|
|
18
|
-
return {
|
|
19
|
-
handleDeleteOptional,
|
|
20
|
-
DeleteExtProductFoodsOptional,
|
|
21
|
-
loading,
|
|
22
|
-
error
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const DELETE_CAT_EXTRA_PRODUCTS = gql`
|
|
4
|
-
mutation DeleteExtProductFoodsOptional($opExPid: ID, $state: Int, $isCustomOpExPid: Boolean) {
|
|
5
|
-
DeleteExtProductFoodsOptional(opExPid: $opExPid, state: $state, isCustomOpExPid: $isCustomOpExPid) {
|
|
6
|
-
success
|
|
7
|
-
message
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
`
|
|
11
|
-
|
|
12
|
-
export const GET_EXTRAS_PRODUCT_FOOD_OPTIONAL = gql`
|
|
13
|
-
query ExtProductFoodsOptionalAll(
|
|
14
|
-
$search: String
|
|
15
|
-
$min: Int
|
|
16
|
-
$max: Int
|
|
17
|
-
$pId: ID
|
|
18
|
-
) {
|
|
19
|
-
ExtProductFoodsOptionalAll(
|
|
20
|
-
search: $search
|
|
21
|
-
min: $min
|
|
22
|
-
max: $max
|
|
23
|
-
pId: $pId
|
|
24
|
-
) {
|
|
25
|
-
pId
|
|
26
|
-
opExPid
|
|
27
|
-
OptionalProName
|
|
28
|
-
state
|
|
29
|
-
code
|
|
30
|
-
numbersOptionalOnly
|
|
31
|
-
createdAt
|
|
32
|
-
required
|
|
33
|
-
updatedAt
|
|
34
|
-
ExtProductFoodsSubOptionalAll {
|
|
35
|
-
pId
|
|
36
|
-
opExPid
|
|
37
|
-
idStore
|
|
38
|
-
opSubExPid
|
|
39
|
-
OptionalSubProName
|
|
40
|
-
exCodeOptionExtra
|
|
41
|
-
exCode
|
|
42
|
-
state
|
|
43
|
-
createdAt
|
|
44
|
-
updatedAt
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
`
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { useQuery, useLazyQuery } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
import { GET_ALL_SALES, GET_ALL_TOTAL_SALES } from './queries'
|
|
4
|
-
|
|
5
|
-
export const useReport = ({
|
|
6
|
-
fromDate = '',
|
|
7
|
-
more,
|
|
8
|
-
search = '',
|
|
9
|
-
channel = null,
|
|
10
|
-
toDate = '',
|
|
11
|
-
lazyQuery = false
|
|
12
|
-
}) => {
|
|
13
|
-
const [getAllSalesStore, { data: lazyDataSales, loading: lazyLoading }] = useLazyQuery(GET_ALL_SALES)
|
|
14
|
-
|
|
15
|
-
// Combine both queries to reduce separate requests
|
|
16
|
-
const { data, fetchMore, loading } = useQuery(GET_ALL_SALES, {
|
|
17
|
-
fetchPolicy: lazyQuery ? 'cache-and-network' : 'network-only',
|
|
18
|
-
skip: lazyQuery,
|
|
19
|
-
variables: {
|
|
20
|
-
min: 0,
|
|
21
|
-
fromDate,
|
|
22
|
-
channel,
|
|
23
|
-
search,
|
|
24
|
-
toDate,
|
|
25
|
-
max: more
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
// Get total sales in the same query
|
|
30
|
-
const { data: totalSalesData } = useQuery(GET_ALL_TOTAL_SALES, {
|
|
31
|
-
variables: {
|
|
32
|
-
fromDate,
|
|
33
|
-
toDate
|
|
34
|
-
}
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
const totalSales = totalSalesData?.getAllSalesStoreTotal ?? {}
|
|
38
|
-
console.log(totalSales)
|
|
39
|
-
return {
|
|
40
|
-
getAllSalesStore: lazyQuery ? getAllSalesStore : () => { }, // Return function only if in lazy mode
|
|
41
|
-
data: lazyQuery ? lazyDataSales : data, // Use data from lazy query if available
|
|
42
|
-
loading: lazyQuery ? lazyLoading || loading : loading,
|
|
43
|
-
totalSales: totalSales.TOTAL || 0,
|
|
44
|
-
restaurant: totalSales.restaurant || 0,
|
|
45
|
-
delivery: totalSales.delivery || 0,
|
|
46
|
-
fetchMore
|
|
47
|
-
}
|
|
48
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const GET_ALL_SALES = gql`
|
|
4
|
-
query getAllSalesStore($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: String, $toDate: String ) {
|
|
5
|
-
getAllSalesStore(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
|
|
6
|
-
totalProductsPrice
|
|
7
|
-
channel
|
|
8
|
-
pDatCre
|
|
9
|
-
pCodeRef
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
`
|
|
13
|
-
|
|
14
|
-
export const GET_ALL_TOTAL_SALES = gql`
|
|
15
|
-
query getAllSalesStoreTotal($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: String, $toDate: String) {
|
|
16
|
-
getAllSalesStoreTotal(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
|
|
17
|
-
restaurant
|
|
18
|
-
delivery
|
|
19
|
-
TOTAL
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
`
|
|
23
|
-
export const GET_ALL_SALES_STATISTICS = gql`
|
|
24
|
-
query getAllSalesStoreStatistic($idStore: ID,$search: String, $min: Int, $max: Int $fromDate: DateTime, $toDate: DateTime ) {
|
|
25
|
-
getAllSalesStoreStatistic(idStore: $idStore, search: $search, min: $min, max: $max, toDate: $toDate, fromDate: $fromDate) {
|
|
26
|
-
pdpId
|
|
27
|
-
idStore
|
|
28
|
-
pCodeRef
|
|
29
|
-
payId
|
|
30
|
-
pPRecoger
|
|
31
|
-
totalProductsPrice
|
|
32
|
-
pSState
|
|
33
|
-
pDatCre
|
|
34
|
-
locationUser
|
|
35
|
-
pDatMod
|
|
36
|
-
getAllPedidoStore{
|
|
37
|
-
pdpId
|
|
38
|
-
pId
|
|
39
|
-
idStore
|
|
40
|
-
ShoppingCard
|
|
41
|
-
pCodeRef
|
|
42
|
-
pPStateP
|
|
43
|
-
payId
|
|
44
|
-
pPRecoger
|
|
45
|
-
pDatCre
|
|
46
|
-
pDatMod
|
|
47
|
-
getAllShoppingCard {
|
|
48
|
-
ShoppingCard
|
|
49
|
-
comments
|
|
50
|
-
cantProducts
|
|
51
|
-
pId
|
|
52
|
-
productFood{
|
|
53
|
-
pId
|
|
54
|
-
carProId
|
|
55
|
-
colorId
|
|
56
|
-
idStore
|
|
57
|
-
pName
|
|
58
|
-
ProPrice
|
|
59
|
-
ProDescuento
|
|
60
|
-
ProDescription
|
|
61
|
-
ValueDelivery
|
|
62
|
-
ProImage
|
|
63
|
-
ProStar
|
|
64
|
-
pState
|
|
65
|
-
pDatCre
|
|
66
|
-
pDatMod
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
`
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
*
|
|
3
|
-
* @param array
|
|
4
|
-
*/
|
|
5
|
-
export function filterAndSortByDate (array = []) {
|
|
6
|
-
const isError = !Array.isArray(array) || !array.length
|
|
7
|
-
try {
|
|
8
|
-
if (isError) return []
|
|
9
|
-
|
|
10
|
-
const currentDate = new Date()
|
|
11
|
-
const sevenDaysAgo = currentDate.getTime() - 7 * 24 * 60 * 60 * 1000
|
|
12
|
-
|
|
13
|
-
const filteredAndSorted = array.map(item => {
|
|
14
|
-
const createdAtDate = new Date(item.createdAt)
|
|
15
|
-
const isNew = (createdAtDate.getTime() <= sevenDaysAgo)
|
|
16
|
-
return { ...item, isNew }
|
|
17
|
-
}).sort((a, b) => {
|
|
18
|
-
const dateA = new Date(a.createdAt).getTime()
|
|
19
|
-
const dateB = new Date(b.createdAt).getTime()
|
|
20
|
-
return dateB - dateA
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
return filteredAndSorted
|
|
24
|
-
} catch (error) {
|
|
25
|
-
if (isError) return []
|
|
26
|
-
if (Array.isArray(array)) return array
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { addTenMinutes } from '../../addTenMinutes'
|
|
2
|
-
import { statusOpenStores } from '../../statusOpenStores'
|
|
3
|
-
|
|
4
|
-
export const getStatusForStores = (stores = []) => {
|
|
5
|
-
return stores.map((store) => {
|
|
6
|
-
const min = addTenMinutes(store?.deliveryTimeMinutes)
|
|
7
|
-
if (store?.scheduleOpenAll) {
|
|
8
|
-
return {
|
|
9
|
-
...store,
|
|
10
|
-
status: { message: '', open: true },
|
|
11
|
-
open: 1,
|
|
12
|
-
min: min ?? ''
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
const dataSchedules =
|
|
16
|
-
(store?.getStoreSchedules?.length > 0 && store.getStoreSchedules) || []
|
|
17
|
-
const status = statusOpenStores({ dataSchedules })
|
|
18
|
-
|
|
19
|
-
return {
|
|
20
|
-
...store,
|
|
21
|
-
status,
|
|
22
|
-
min: min ?? '',
|
|
23
|
-
open: status?.open ? 1 : 0
|
|
24
|
-
}
|
|
25
|
-
}).sort((a, b) => {return b.open - a.open})
|
|
26
|
-
}
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { useLazyQuery } from '@apollo/client'
|
|
2
|
-
import { useEffect, useState } from 'react'
|
|
3
|
-
|
|
4
|
-
import { useManageQueryParams } from '../useManageQueryParams'
|
|
5
|
-
|
|
6
|
-
import { filterAndSortByDate } from './helpers'
|
|
7
|
-
import { getStatusForStores } from './helpers/manageStatusOpen'
|
|
8
|
-
import { GET_ALL_RESTAURANT } from './queries'
|
|
9
|
-
|
|
10
|
-
export const useRestaurant = ({
|
|
11
|
-
location = {
|
|
12
|
-
query: {},
|
|
13
|
-
push: (props, state, { shallow }) => {
|
|
14
|
-
return { ...props, state, shallow }
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
} = {}) => {
|
|
18
|
-
const [loadingFilter, setLoadingFilter] = useState(false)
|
|
19
|
-
const { handleQuery, handleCleanQuery } = useManageQueryParams({
|
|
20
|
-
location
|
|
21
|
-
})
|
|
22
|
-
|
|
23
|
-
const [getAllStoreInStore, {
|
|
24
|
-
data,
|
|
25
|
-
loading,
|
|
26
|
-
error,
|
|
27
|
-
fetchMore
|
|
28
|
-
}] = useLazyQuery(GET_ALL_RESTAURANT, {
|
|
29
|
-
fetchPolicy: 'cache-and-network',
|
|
30
|
-
notifyOnNetworkStatusChange: true,
|
|
31
|
-
nextFetchPolicy: 'cache-first',
|
|
32
|
-
refetchWritePolicy: 'merge',
|
|
33
|
-
context: { clientName: 'admin-store' }
|
|
34
|
-
})
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
getAllStoreInStore({})
|
|
38
|
-
}, [location])
|
|
39
|
-
const handleSendQueries = (name, value) => {
|
|
40
|
-
if (value) handleQuery(name, value)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
const handleCleanQueries = (name) => {
|
|
44
|
-
handleCleanQuery(name)
|
|
45
|
-
}
|
|
46
|
-
const handleFilterStore = async () => {
|
|
47
|
-
setLoadingFilter(true)
|
|
48
|
-
try {
|
|
49
|
-
await getAllStoreInStore({
|
|
50
|
-
|
|
51
|
-
}).then(() => {
|
|
52
|
-
setLoadingFilter(false)
|
|
53
|
-
})
|
|
54
|
-
} catch (error) {
|
|
55
|
-
setLoadingFilter(false)
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
const dataRestaurant = data?.getAllStoreInStore || []
|
|
59
|
-
const dataSort = filterAndSortByDate(dataRestaurant)
|
|
60
|
-
const statuses = getStatusForStores(dataSort)
|
|
61
|
-
|
|
62
|
-
return [statuses, {
|
|
63
|
-
loading,
|
|
64
|
-
loadingFilter,
|
|
65
|
-
error,
|
|
66
|
-
fetchMore,
|
|
67
|
-
handleSendQueries,
|
|
68
|
-
handleFilterStore,
|
|
69
|
-
handleCleanQueries
|
|
70
|
-
}]
|
|
71
|
-
}
|
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
export const GET_ALL_RESTAURANT = gql`
|
|
3
|
-
query getAllStoreInStore($search: String, $min: Int, $max: Int){
|
|
4
|
-
getAllStoreInStore(search: $search, min: $min, max: $max) {
|
|
5
|
-
open
|
|
6
|
-
scheduleOpenAll
|
|
7
|
-
getStoreSchedules {
|
|
8
|
-
idStore
|
|
9
|
-
schId
|
|
10
|
-
schDay
|
|
11
|
-
schHoSta
|
|
12
|
-
schHoEnd
|
|
13
|
-
schState
|
|
14
|
-
}
|
|
15
|
-
idStore
|
|
16
|
-
cId
|
|
17
|
-
id
|
|
18
|
-
dId
|
|
19
|
-
deliveryTimeMinutes
|
|
20
|
-
ctId
|
|
21
|
-
catStore
|
|
22
|
-
neighborhoodStore
|
|
23
|
-
Viaprincipal
|
|
24
|
-
storeOwner
|
|
25
|
-
storeName
|
|
26
|
-
cateStore{
|
|
27
|
-
catStore
|
|
28
|
-
cName
|
|
29
|
-
}
|
|
30
|
-
emailStore
|
|
31
|
-
storePhone
|
|
32
|
-
socialRaz
|
|
33
|
-
Image
|
|
34
|
-
banner
|
|
35
|
-
documentIdentifier
|
|
36
|
-
uPhoNum
|
|
37
|
-
ULocation
|
|
38
|
-
upLat
|
|
39
|
-
upLon
|
|
40
|
-
uState
|
|
41
|
-
siteWeb
|
|
42
|
-
description
|
|
43
|
-
NitStore
|
|
44
|
-
typeRegiments
|
|
45
|
-
typeContribute
|
|
46
|
-
secVia
|
|
47
|
-
addressStore
|
|
48
|
-
createdAt
|
|
49
|
-
pais{
|
|
50
|
-
cId
|
|
51
|
-
cName
|
|
52
|
-
cCalCod
|
|
53
|
-
cState
|
|
54
|
-
cDatCre
|
|
55
|
-
cDatMod
|
|
56
|
-
}
|
|
57
|
-
city {
|
|
58
|
-
ctId
|
|
59
|
-
dId
|
|
60
|
-
cName
|
|
61
|
-
cState
|
|
62
|
-
cDatCre
|
|
63
|
-
cDatMod
|
|
64
|
-
}
|
|
65
|
-
department {
|
|
66
|
-
dId
|
|
67
|
-
cId
|
|
68
|
-
dName
|
|
69
|
-
dState
|
|
70
|
-
dDatCre
|
|
71
|
-
dDatMod
|
|
72
|
-
}
|
|
73
|
-
getAllRatingStar {
|
|
74
|
-
rSId
|
|
75
|
-
rScore
|
|
76
|
-
idStore
|
|
77
|
-
createAt
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
`
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
import { GET_ALL_ROAD } from './queries'
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Custom hook to fetch all roads.
|
|
7
|
-
*
|
|
8
|
-
* @returns {Object} - Returns an object containing road data and any associated query state/error.
|
|
9
|
-
*/
|
|
10
|
-
export function useRoads () {
|
|
11
|
-
const { data, loading, error } = useQuery(GET_ALL_ROAD)
|
|
12
|
-
|
|
13
|
-
// Here, you can handle any additional logic you might need, like mapping data, handling errors, etc.
|
|
14
|
-
|
|
15
|
-
return {
|
|
16
|
-
data: data || [],
|
|
17
|
-
loading,
|
|
18
|
-
error
|
|
19
|
-
}
|
|
20
|
-
}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const GET_ALL_ROLES = gql`
|
|
4
|
-
query getRoles($idStore: ID, $search: String, $min: Int, $max: Int, $fromDate: DateTime, $toDate: DateTime, $page: Int) {
|
|
5
|
-
getRoles(idStore: $idStore, search: $search, min: $min, max: $max, fromDate: $fromDate, toDate: $toDate, page: $page) {
|
|
6
|
-
success
|
|
7
|
-
message
|
|
8
|
-
errors {
|
|
9
|
-
path
|
|
10
|
-
message
|
|
11
|
-
type
|
|
12
|
-
context {
|
|
13
|
-
limit
|
|
14
|
-
value
|
|
15
|
-
label
|
|
16
|
-
key
|
|
17
|
-
}
|
|
18
|
-
__typename
|
|
19
|
-
}
|
|
20
|
-
pagination {
|
|
21
|
-
totalRecords
|
|
22
|
-
totalPages
|
|
23
|
-
currentPage
|
|
24
|
-
__typename
|
|
25
|
-
}
|
|
26
|
-
data {
|
|
27
|
-
idRole
|
|
28
|
-
name
|
|
29
|
-
priority
|
|
30
|
-
description
|
|
31
|
-
permissions
|
|
32
|
-
createdAt
|
|
33
|
-
updatedAt
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
`
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Mutación para crear un nuevo rol
|
|
41
|
-
*/
|
|
42
|
-
export const CREATE_ROLE_MUTATION = gql`
|
|
43
|
-
mutation createRoleMutation($input: IRole!) {
|
|
44
|
-
createRoleMutation(input: $input) {
|
|
45
|
-
success
|
|
46
|
-
message
|
|
47
|
-
errors {
|
|
48
|
-
path
|
|
49
|
-
message
|
|
50
|
-
type
|
|
51
|
-
context {
|
|
52
|
-
limit
|
|
53
|
-
value
|
|
54
|
-
label
|
|
55
|
-
key
|
|
56
|
-
}
|
|
57
|
-
__typename
|
|
58
|
-
}
|
|
59
|
-
data {
|
|
60
|
-
idRole
|
|
61
|
-
name
|
|
62
|
-
priority
|
|
63
|
-
description
|
|
64
|
-
permissions
|
|
65
|
-
createdAt
|
|
66
|
-
updatedAt
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
`
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { useMutation } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
import { CREATE_ROLE_MUTATION } from './queries'
|
|
4
|
-
/**
|
|
5
|
-
* Custom hook para crear un nuevo rol
|
|
6
|
-
* @param root0
|
|
7
|
-
* @param root0.sendNotification
|
|
8
|
-
* @returns {Object} - Estado de la mutación, incluyendo loading, error, data y la función createRoleMutation
|
|
9
|
-
*/
|
|
10
|
-
export const useCreateRole = ({
|
|
11
|
-
sendNotification = () => {
|
|
12
|
-
return {
|
|
13
|
-
title: '',
|
|
14
|
-
description: '',
|
|
15
|
-
backgroundColor: ''
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
} = {
|
|
19
|
-
sendNotification: () => {
|
|
20
|
-
}
|
|
21
|
-
}) => {
|
|
22
|
-
const [createRoleMutation, { loading, error, data }] = useMutation(CREATE_ROLE_MUTATION, {
|
|
23
|
-
onError: () => {
|
|
24
|
-
sendNotification({
|
|
25
|
-
title: 'Error',
|
|
26
|
-
description: 'Ocurrió un error inesperado',
|
|
27
|
-
backgroundColor: 'error'
|
|
28
|
-
})
|
|
29
|
-
},
|
|
30
|
-
onCompleted: () => {
|
|
31
|
-
return null
|
|
32
|
-
}
|
|
33
|
-
})
|
|
34
|
-
|
|
35
|
-
return [createRoleMutation, {
|
|
36
|
-
loading,
|
|
37
|
-
error,
|
|
38
|
-
data: data?.createRoleMutation ?? null
|
|
39
|
-
}]
|
|
40
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
import { GET_ALL_ROLES } from './queries'
|
|
4
|
-
|
|
5
|
-
export const useGetRoles = ({
|
|
6
|
-
max,
|
|
7
|
-
order = 'DESC',
|
|
8
|
-
search,
|
|
9
|
-
sendNotification = () => { }
|
|
10
|
-
} = {}) => {
|
|
11
|
-
const {
|
|
12
|
-
loading,
|
|
13
|
-
error,
|
|
14
|
-
called,
|
|
15
|
-
data,
|
|
16
|
-
refetch
|
|
17
|
-
} = useQuery(GET_ALL_ROLES, {
|
|
18
|
-
onError: () => {
|
|
19
|
-
sendNotification({
|
|
20
|
-
title: 'Error',
|
|
21
|
-
description: 'Algo salió mal',
|
|
22
|
-
backgroundColor: 'error'
|
|
23
|
-
})
|
|
24
|
-
},
|
|
25
|
-
variables: {
|
|
26
|
-
search,
|
|
27
|
-
max: max || 25,
|
|
28
|
-
order
|
|
29
|
-
}
|
|
30
|
-
})
|
|
31
|
-
return [data?.getRoles, {
|
|
32
|
-
loading: called ? false : loading,
|
|
33
|
-
buttonLoading: loading,
|
|
34
|
-
error,
|
|
35
|
-
refetch
|
|
36
|
-
}]
|
|
37
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { useMutation, gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
// Define the GraphQL mutation
|
|
4
|
-
const REMOVE_ROLES_MUTATION = gql`
|
|
5
|
-
mutation removeRoles($roleIds: [ID!]!) {
|
|
6
|
-
removeRoles(roleIds: $roleIds) {
|
|
7
|
-
success
|
|
8
|
-
message
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
`
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Custom hook to call removeRoles mutation.
|
|
15
|
-
*
|
|
16
|
-
* @returns {Object} An object containing the mutation function and the loading/error state.
|
|
17
|
-
*/
|
|
18
|
-
export function useRemoveRoles () {
|
|
19
|
-
const [removeRoles, { loading, error, data }] = useMutation(REMOVE_ROLES_MUTATION, {
|
|
20
|
-
onError: (err) => {
|
|
21
|
-
console.error('Error removing roles:', err)
|
|
22
|
-
}
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
const removeRolesHandler = async ({ roleIds = [] }) => {
|
|
26
|
-
try {
|
|
27
|
-
const { data } = await removeRoles({ variables: { roleIds } })
|
|
28
|
-
return data.removeRoles
|
|
29
|
-
} catch (err) {
|
|
30
|
-
console.error('Error removing roles:', err)
|
|
31
|
-
throw err
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
return [removeRolesHandler, {
|
|
36
|
-
loading,
|
|
37
|
-
error,
|
|
38
|
-
data
|
|
39
|
-
}]
|
|
40
|
-
}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import { useMutation, gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
// Define the mutation
|
|
4
|
-
const UPDATE_ROLES_PRIORITY = gql`
|
|
5
|
-
mutation updateRolesPriority($roles: [IParamsPriority]!) {
|
|
6
|
-
updateRolesPriority(roles: $roles) {
|
|
7
|
-
success
|
|
8
|
-
message
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
`
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Custom hook to update roles priority
|
|
15
|
-
* @returns {Object} - Returns the mutation function and the mutation state
|
|
16
|
-
*/
|
|
17
|
-
export const useUpdateRolesPriority = () => {
|
|
18
|
-
const [updateRolesPriority, { data, loading, error }] = useMutation(UPDATE_ROLES_PRIORITY)
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Function to update the priority of roles
|
|
22
|
-
* @param {Array} roles - The array of roles with their priorities to be updated
|
|
23
|
-
* @returns {Promise<void>}
|
|
24
|
-
*/
|
|
25
|
-
const handleUpdateRolesPriority = async (roles) => {
|
|
26
|
-
try {
|
|
27
|
-
const response = await updateRolesPriority({
|
|
28
|
-
variables: { roles }
|
|
29
|
-
})
|
|
30
|
-
|
|
31
|
-
// You can handle the response or any additional logic here
|
|
32
|
-
return response
|
|
33
|
-
} catch (err) {
|
|
34
|
-
// Handle the error as needed
|
|
35
|
-
console.error('Error updating roles priority:', err)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return [handleUpdateRolesPriority, {
|
|
40
|
-
data,
|
|
41
|
-
loading,
|
|
42
|
-
error
|
|
43
|
-
}]
|
|
44
|
-
}
|