npm-pkg-hook 1.3.9 → 1.4.0
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/.babelrc +2 -10
- package/.env +5 -1
- package/dist/index.js +17953 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +17711 -0
- package/dist/index.mjs.map +1 -0
- package/eslint.config.mjs +154 -0
- package/expire.json +1 -0
- package/index.d.ts +2 -0
- package/jest.config.ts +9 -0
- package/package.json +45 -36
- package/src/config/client/errors.ts +39 -0
- package/src/config/content/en.json +5 -0
- package/src/config/content/es.json +5 -0
- package/src/config/content/index.ts +16 -0
- package/src/hooks/addTenMinutes/index.ts +14 -0
- package/src/hooks/calculateLogLatHaversine/index.ts +41 -0
- package/src/hooks/completeSchedules/index.ts +22 -0
- package/src/hooks/convertToMilitaryTime/index.ts +18 -0
- package/src/hooks/generateStoreURL/index.ts +41 -0
- package/src/hooks/generateTemplate/index.ts +66 -0
- package/src/hooks/getCardType/index.ts +24 -0
- package/src/hooks/getCategoriesWithProduct/{index.js → index.ts} +7 -7
- package/src/hooks/getGlobalSession/index.ts +69 -0
- package/src/hooks/getSession/index.ts +72 -0
- package/src/hooks/getTodayTimestamps/index.ts +70 -0
- package/src/hooks/getTotalHours/index.ts +76 -0
- package/src/hooks/handleLogin/index.ts +14 -0
- package/src/hooks/index.ts +154 -0
- package/src/hooks/isTokenExpired/index.ts +17 -0
- package/src/hooks/newMessageSubscription/index.ts +28 -0
- package/src/hooks/newStoreOrderSubscription/index.ts +26 -0
- package/src/hooks/{useStatusOpenStore/helpers/index.js → statusOpenStores/helpers/index.ts} +24 -1
- package/src/hooks/statusOpenStores/index.ts +221 -0
- package/src/hooks/updateExtProductFoodsOptional/{index.js → index.ts} +15 -6
- package/src/hooks/useAcumulateDate/index.ts +18 -0
- package/src/hooks/useAllStoresPendingToRegister/index.ts +37 -0
- package/src/hooks/useAmountInput/index.ts +127 -0
- package/src/hooks/useAnimationText/{index.jsx → index.ts} +2 -2
- package/src/hooks/useAsideCart/index.ts +217 -0
- package/src/hooks/useBanner/{index.js → index.ts} +2 -1
- package/src/hooks/useCart/{queries.js → queries.ts} +11 -1
- package/src/hooks/useCart/useCart/helpers/{index.js → index.ts} +10 -6
- package/src/hooks/useCart/useCart/{index.js → index.ts} +58 -44
- package/src/hooks/useCart/useGetCart/{index.js → index.ts} +6 -3
- package/src/hooks/useCatWithProduct/{index.js → index.ts} +17 -7
- package/src/hooks/useCatWithProduct/{queries.js → queries.ts} +50 -23
- package/src/hooks/useCatWithProduct/types/index.ts +104 -0
- package/src/hooks/useCatWithProductClient/{index.js → index.ts} +19 -18
- package/src/hooks/useCatWithProductClient/{queries.js → queries.ts} +1 -0
- package/src/hooks/useCategoriesProduct/{index.js → index.ts} +3 -1
- package/src/hooks/useCategoriesProduct/{queries.js → queries.ts} +2 -2
- package/src/hooks/useCategoryInStore/index.ts +167 -0
- package/src/hooks/useCategoryInStore/{queries.js → queries.ts} +2 -2
- package/src/hooks/useCategoryStore/{index.js → index.ts} +4 -3
- package/src/hooks/useCategoryStore/{queries.js → queries.ts} +2 -2
- package/src/hooks/useChartData/{index.js → index.ts} +31 -34
- package/src/hooks/useChartData/useChartData/{index.js → index.ts} +31 -30
- package/src/hooks/useChartData/useChartDataAllOrders/{index.js → index.ts} +4 -4
- package/src/hooks/useChatRoomSubscription/index.ts +28 -0
- package/src/hooks/useCheckbox/{index.js → index.ts} +1 -1
- package/src/hooks/useCities/index.ts +14 -0
- package/src/hooks/useCities/queries.ts +12 -0
- package/src/hooks/useClients/{index.js → index.ts} +36 -10
- package/src/hooks/useClients/queries.ts +215 -0
- package/src/hooks/useColorByLetters/helpers/alea.ts +73 -0
- package/src/hooks/useColorByLetters/helpers/colors.ts +45 -0
- package/src/hooks/useColorByLetters/helpers/index.ts +24 -0
- package/src/hooks/useColorByLetters/helpers/mersenne_twister.ts +118 -0
- package/src/hooks/useColorByLetters/index.ts +24 -0
- package/src/hooks/useConnection/index.ts +24 -0
- package/src/hooks/useCountries/index.ts +20 -0
- package/src/hooks/useCountries/queries.ts +12 -0
- package/src/hooks/useCreateDeliveryTime/index.ts +51 -0
- package/src/hooks/useCreateOrderStatusType/index.ts +134 -0
- package/src/hooks/useCreateProduct/helpers/index.ts +23 -0
- package/src/hooks/useCreateProduct/helpers/manageCacheDataCatProduct/{index.js → index.ts} +1 -1
- package/src/hooks/useCreateProduct/helpers/useEditImageProduct/{index.js → index.ts} +14 -8
- package/src/hooks/useCreateProduct/index.ts +337 -0
- package/src/hooks/useCreateStorePendingToRegister/index.ts +17 -0
- package/src/hooks/useCreateStorePendingToRegister/queries.ts +10 -0
- package/src/hooks/useDashboardComponents/index.ts +50 -0
- package/src/hooks/useDeleteExtraProductFoods/index.ts +13 -0
- package/src/hooks/useDeleteSubProductOptional/{index.js → index.ts} +5 -3
- package/src/hooks/useDeliveryTime/index.ts +29 -0
- package/src/hooks/useDepartments/index.ts +14 -0
- package/src/hooks/useDepartments/queries.ts +13 -0
- package/src/hooks/useDessert/{index.js → index.ts} +162 -114
- package/src/hooks/useDessertWithPrice/helpers/index.ts +76 -0
- package/src/hooks/useDessertWithPrice/index.ts +381 -0
- package/src/hooks/useDessertWithPrice/queries.ts +18 -0
- package/src/hooks/useDevWS/index.ts +53 -0
- package/src/hooks/useDevices/index.ts +2 -0
- package/src/hooks/useDevices/queries.ts +28 -0
- package/src/hooks/useDevices/useGetDevices.ts +28 -0
- package/src/hooks/useDevices/useRegisterDevices.ts +75 -0
- package/src/hooks/useDownloadReports/helpers/downloadFileFromResponse.ts +21 -0
- package/src/hooks/useDownloadReports/index.ts +2 -0
- package/src/hooks/useDownloadReports/useDownloadReportByDay/index.ts +105 -0
- package/src/hooks/useDownloadReports/useGetReportByDateRange/index.ts +116 -0
- package/src/hooks/useDrag/{index.js → index.ts} +16 -0
- package/src/hooks/useDropzone/{index.js → index.ts} +2 -2
- package/src/hooks/useDynamicAuth/{index.js → index.ts} +2 -1
- package/src/hooks/useEditCategory/{index.js → index.ts} +14 -14
- package/src/hooks/useEditOneExtProductFoodOptional/index.ts +28 -0
- package/src/hooks/useEditOneExtProductFoodOptional/{queries.js → queries.ts} +2 -2
- package/src/hooks/useEditSubProductOptional/index.ts +12 -0
- package/src/hooks/useEmployee/index.ts +18 -0
- package/src/hooks/useEmployee/queries.ts +85 -0
- package/src/hooks/useEmployee/useCreateEmployee.ts +90 -0
- package/src/hooks/useEvent/{index.js → index.ts} +1 -0
- package/src/hooks/useFavoriteStores/index.ts +31 -0
- package/src/hooks/useFavoriteStores/queries.ts +54 -0
- package/src/hooks/useFetchMoreInteractions/index.jsx +26 -26
- package/src/hooks/useFilterConfigs/index.ts +173 -0
- package/src/hooks/useFingerprintjs/{index.js → index.ts} +32 -7
- package/src/hooks/useFormTools/index.ts +143 -0
- package/src/hooks/useFormatDate/index.ts +91 -0
- package/src/hooks/useFullScreenMode/{index.js → index.ts} +1 -5
- package/src/hooks/useGetAllLocationUser/index.ts +13 -0
- package/src/hooks/useGetAllLocationUser/queries.ts +44 -0
- package/src/hooks/{useSales/useGetAllSales/index.js → useGetAllSales/index.ts} +3 -2
- package/src/hooks/useGetCookies/index.ts +43 -0
- package/src/hooks/useGetExtProductFoodsSubOptionalAll/{index.js → index.ts} +2 -1
- package/src/hooks/useGetFoodRecomended/{index.js → index.ts} +2 -1
- package/src/hooks/useGetMessagesToRoom/index.ts +23 -0
- package/src/hooks/useGetMinPrice/{index.js → index.ts} +2 -1
- package/src/hooks/useGetOneStoreRating/{index.js → index.ts} +2 -1
- package/src/hooks/useGetSalesAmountToday/index.ts +31 -0
- package/src/hooks/useGetStoreCookie/index.ts +21 -0
- package/src/hooks/useGoogleLogin/{index.js → index.ts} +14 -5
- package/src/hooks/useHover/{index.js → index.ts} +3 -0
- package/src/hooks/useImageOptimization/{index.js → index.ts} +4 -0
- package/src/hooks/useImageUploaderProduct/helper/canvasUtils.ts +146 -0
- package/src/hooks/useImageUploaderProduct/helper/getOrientation.ts +54 -0
- package/src/hooks/useImageUploaderProduct/helper/index.ts +5 -0
- package/src/hooks/useImageUploaderProduct/index.ts +295 -0
- package/src/hooks/useImageWeight/{index.js → index.ts} +4 -0
- package/src/hooks/useImagesStore/index.ts +227 -0
- package/src/hooks/useImagesStore/{queries.js → queries.ts} +4 -68
- package/src/hooks/useImagesStore/utils/index.ts +4 -0
- package/src/hooks/useIncomingOrders/index.ts +11 -0
- package/src/hooks/useIncomingOrders/queries.ts +87 -0
- package/src/hooks/useIntersection/{index.js → index.ts} +1 -1
- package/src/hooks/useInventory/index.ts +2 -0
- package/src/hooks/useInventory/queries.ts +58 -0
- package/src/hooks/useInventory/useGetProductsInStock.ts +16 -0
- package/src/hooks/useInventory/useUpdateManageStock.ts +41 -0
- package/src/hooks/useLazyScript/{index.js → index.ts} +3 -0
- package/src/hooks/useLocalBackendIp/index.ts +34 -0
- package/src/hooks/useLocalSorage/{index.js → index.ts} +3 -3
- package/src/hooks/useLocationManager/index.ts +63 -0
- package/src/hooks/useLoginEmployeeInStore/index.ts +38 -0
- package/src/hooks/useLogout/helpers/BroadcastChannel.ts +74 -0
- package/src/hooks/useLogout/helpers/apiBaseUrl.ts +12 -0
- package/src/hooks/useLogout/helpers/fetchData.ts +37 -0
- package/src/hooks/useLogout/helpers/getCsrfToken.ts +37 -0
- package/src/hooks/useLogout/helpers/index.ts +65 -0
- package/src/hooks/useLogout/helpers/logger.ts +88 -0
- package/src/hooks/useLogout/helpers/parseUrl.ts +39 -0
- package/src/hooks/useLogout/index.ts +105 -0
- package/src/hooks/useManageNewOrder/helpers/index.ts +45 -0
- package/src/hooks/useManageNewOrder/index.ts +104 -0
- package/src/hooks/useManageQueryParams/index.ts +120 -0
- package/src/hooks/useMobile/index.ts +65 -0
- package/src/hooks/useModules/helpers/index.ts +1 -0
- package/src/hooks/useModules/helpers/validateModules.ts +43 -0
- package/src/hooks/useModules/index.ts +124 -0
- package/src/hooks/useMouse/index.ts +55 -0
- package/src/hooks/useOrderStatusTypes/index.ts +2 -0
- package/src/hooks/useOrderStatusTypes/useOrderStatusTypes/index.ts +133 -0
- package/src/hooks/useOrderStatusTypes/useUpdateOrderStatusPriorities/index.ts +99 -0
- package/src/hooks/useOrders/index.ts +3 -0
- package/src/hooks/useOrders/queries.ts +99 -0
- package/src/hooks/useOrders/useChangeOrderState/index.ts +128 -0
- package/src/hooks/useOrders/{index.js → useOrdersFromStore/index.ts} +20 -18
- package/src/hooks/usePWAInstall/index.ts +38 -0
- package/src/hooks/usePaymentMethod/index.ts +3 -0
- package/src/hooks/usePaymentMethod/paymentMethod.gql.ts +62 -0
- package/src/hooks/usePaymentMethod/paymentMethod.types.ts +28 -0
- package/src/hooks/usePaymentMethod/useCreatePaymentMethod/index.ts +25 -0
- package/src/hooks/usePaymentMethod/useGetAllPaymentMethods/index.ts +19 -0
- package/src/hooks/usePaymentMethod/useGetPaymentMethod/index.ts +26 -0
- package/src/hooks/usePortFetcher/index.ts +33 -0
- package/src/hooks/usePrintSaleTicket/index.ts +68 -0
- package/src/hooks/useProductsFood/index.ts +341 -0
- package/src/hooks/useProductsFood/{queriesStore.js → queriesStore.ts} +151 -84
- package/src/hooks/useProductsFood/types/index.ts +0 -0
- package/src/hooks/useProductsFood/useEditProduct.ts +49 -0
- package/src/hooks/useProductsFood/usetagsProducts.ts +101 -0
- package/src/hooks/useProviders/useProvidersCreateStore/{index.js → index.ts} +2 -1
- package/src/hooks/useProviders/useProvidersDataStore/{index.js → index.ts} +2 -1
- package/src/hooks/useProvidersStore/{index.js → index.ts} +2 -1
- package/src/hooks/usePushNotificationOrder/index.ts +52 -0
- package/src/hooks/usePushNotifications/helpers/index.ts +123 -0
- package/src/hooks/usePushNotifications/index.ts +150 -0
- package/src/hooks/useQueryLocationsMap/index.ts +20 -0
- package/src/hooks/useQueryLocationsMap/queries.ts +40 -0
- package/src/hooks/useRatingArrayData/{index.js → index.ts} +4 -4
- package/src/hooks/useRatingArrayData/{queries.js → queries.ts} +1 -1
- package/src/hooks/useReactToPrint/index.ts +4 -0
- package/src/hooks/useRemoveExtraProductFoodsOptional/{index.js → index.ts} +2 -1
- package/src/hooks/useRemoveExtraProductFoodsOptional/{queries.js → queries.ts} +4 -4
- package/src/hooks/useReport/{index.js → index.ts} +5 -5
- package/src/hooks/useReport/{queries.js → queries.ts} +4 -55
- package/src/hooks/useRestaurant/helpers/index.ts +28 -0
- package/src/hooks/useRestaurant/helpers/manageStatusOpen.ts +26 -0
- package/src/hooks/useRestaurant/index.ts +71 -0
- package/src/hooks/useRestaurant/{queries.js → queries.ts} +2 -1
- package/src/hooks/useRoads/index.ts +20 -0
- package/src/hooks/useRoads/queries.ts +13 -0
- package/src/hooks/useRoles/index.ts +4 -0
- package/src/hooks/useRoles/queries.ts +70 -0
- package/src/hooks/useRoles/useCreateRole.ts +40 -0
- package/src/hooks/useRoles/useGetRoles.ts +37 -0
- package/src/hooks/useRoles/useRemoveRoles.ts +40 -0
- package/src/hooks/useRoles/useUpdateRolesPriority.ts +44 -0
- package/src/hooks/useSales/helpers/add-product.utils.ts +120 -0
- package/src/hooks/useSales/helpers/apply-discount-to-cart.utils.ts +292 -0
- package/src/hooks/useSales/helpers/comment-product.utils.ts +41 -0
- package/src/hooks/useSales/helpers/constants/index.ts +38 -0
- package/src/hooks/useSales/helpers/extras.utils.ts +42 -0
- package/src/hooks/useSales/helpers/filterProductsByCarProId.utils.ts +17 -0
- package/src/hooks/useSales/helpers/increment-product-quantity.utils.ts +76 -0
- package/src/hooks/useSales/helpers/index.ts +3 -0
- package/src/hooks/useSales/helpers/initializer.utils.ts +22 -0
- package/src/hooks/useSales/helpers/isStockInsufficient.ts +3 -0
- package/src/hooks/useSales/helpers/remove-product.utils.test.ts +49 -0
- package/src/hooks/useSales/helpers/remove-product.utils.ts +34 -0
- package/src/hooks/useSales/helpers/resolveProduct.ts +29 -0
- package/src/hooks/useSales/helpers/useAddToCart.ts +64 -0
- package/src/hooks/useSales/index.ts +1418 -0
- package/src/hooks/useSales/{queries.js → queries.ts} +256 -166
- package/src/hooks/useSales/types/index.ts +206 -0
- package/src/hooks/useSales/types/use-sales.types.ts +8 -0
- package/src/hooks/useSales/useGetSale.ts +21 -0
- package/src/hooks/useSales/useTotalSales.ts +24 -0
- package/src/hooks/useSaveAvailableProduct/helpers/{index.js → index.ts} +4 -4
- package/src/hooks/useSaveAvailableProduct/{index.js → index.ts} +7 -1
- package/src/hooks/useSaveLocation/index.ts +17 -0
- package/src/hooks/useSaveLocation/queries.ts +19 -0
- package/src/hooks/useSchedule/{index.jsx → index.ts} +16 -4
- package/src/hooks/useSchedule/{index.js → schedule.ts} +22 -15
- package/src/hooks/useScheduleData/{index.js → index.ts} +21 -9
- package/src/hooks/useSetImageProducts/index.ts +59 -0
- package/src/hooks/useSetImageProducts/queries.ts +18 -0
- package/src/hooks/useSetSession/{index.js → index.ts} +16 -17
- package/src/hooks/useSetupSchedule/helpers/index.ts +85 -0
- package/src/hooks/useSetupSchedule/index.ts +284 -0
- package/src/hooks/useStatusOpenStore/helpers/index.ts +124 -0
- package/src/hooks/useStatusOpenStore/{index.js → index.ts} +39 -16
- package/src/hooks/useStatusOrdersClient/{index.js → index.ts} +3 -2
- package/src/hooks/useStatusOrdersClient/{queries.js → queries.ts} +2 -2
- package/src/hooks/useStock/index.ts +1 -0
- package/src/hooks/useStock/useStockUpdatedAllSubscription.ts +40 -0
- package/src/hooks/useStockMovements/helpers/index.ts +16 -0
- package/src/hooks/useStockMovements/index.ts +39 -0
- package/src/hooks/useStore/index.ts +83 -0
- package/src/hooks/useStore/{queries.js → queries.ts} +71 -71
- package/src/hooks/useStoreContacts/{index.js → index.ts} +11 -5
- package/src/hooks/useStoreTable/index.ts +2 -0
- package/src/hooks/useStoreTable/queries.ts +47 -0
- package/src/hooks/useStoreTable/useStoreTableCreate.ts +77 -0
- package/src/hooks/useStoreTable/useStoreTables.ts +15 -0
- package/src/hooks/useSubscriptionValidation/index.ts +112 -0
- package/src/hooks/useTagProducts/index.ts +3 -0
- package/src/hooks/useTagProducts/useDeleteOneTag.ts +106 -0
- package/src/hooks/useTagProducts/useGetAllTags.ts +68 -0
- package/src/hooks/useTagProducts/useRegisterMultipleTags.ts +157 -0
- package/src/hooks/useTheme/index.ts +65 -0
- package/src/hooks/useTimeAgo/{useTimeAgo.js → useTimeAgo.ts} +7 -7
- package/src/hooks/useTokenCards/index.ts +45 -0
- package/src/hooks/useTopProductsMovements/index.ts +27 -0
- package/src/hooks/useTotalAllSales/index.ts +25 -0
- package/src/hooks/useTotalProductsInStock/index.ts +23 -0
- package/src/hooks/useTotalProductsSold/index.ts +23 -0
- package/src/hooks/useTotalProductsSolded/index.ts +20 -0
- package/src/hooks/useUpdateCart/{index.js → index.ts} +3 -2
- package/src/hooks/useUpdateCartCookie/index.ts +60 -0
- package/src/hooks/useUpdateDashboardComponent/index.ts +91 -0
- package/src/hooks/useUpdateExistingOrders/{index.js → index.ts} +5 -11
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.ts +61 -0
- package/src/hooks/useUpdateModuleOrder/index.ts +37 -0
- package/src/hooks/useUpdateMultipleExtProduct/index.ts +34 -0
- package/src/hooks/useUpdateMultipleExtProduct/queries.ts +33 -0
- package/src/hooks/useUpdateMultipleProducts/index.ts +117 -0
- package/src/hooks/useUpdateMultipleProducts/queries.ts +51 -0
- package/src/hooks/useUploadProducts/helpers/index.ts +1 -0
- package/src/hooks/useUploadProducts/helpers/parseNumber.ts +37 -0
- package/src/hooks/useUploadProducts/helpers/validateProductDataExcel.ts +73 -0
- package/src/hooks/useUploadProducts/index.ts +442 -0
- package/src/hooks/useUpsertGoal/index.ts +68 -0
- package/src/hooks/useUser/{index.js → index.ts} +11 -4
- package/src/hooks/useUser/{queries.js → queries.ts} +9 -4
- package/src/hooks/useWeeklyStockMovement/helpers/index.ts +32 -0
- package/src/hooks/useWeeklyStockMovement/index.ts +52 -0
- package/src/hooks/useWindowSize/{index.js → index.ts} +9 -2
- package/src/index.ts +12 -0
- package/src/security/index.ts +1 -0
- package/src/services/index.ts +1 -0
- package/src/utils/UtilDateRange.ts +56 -0
- package/src/utils/generateCode.ts +222 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/utils.ts +344 -0
- package/tsconfig.eslint.json +17 -0
- package/tsconfig.json +21 -0
- package/tsup.config.ts +24 -0
- package/.eslintrc.js +0 -38
- package/.eslintrc.json +0 -127
- package/next.config.js +0 -126
- package/src/config/client/errors.js +0 -26
- package/src/hooks/getGlobalSession/index.js +0 -49
- package/src/hooks/getSession/index.js +0 -18
- package/src/hooks/handleLogin/index.js +0 -10
- package/src/hooks/index.js +0 -77
- package/src/hooks/useAcumulateDate/index.js +0 -16
- package/src/hooks/useAsideCart/index.js +0 -155
- package/src/hooks/useCategoryInStore/index.js +0 -98
- package/src/hooks/useClients/queries.js +0 -127
- package/src/hooks/useConnection/index.js +0 -22
- package/src/hooks/useCreateProduct/index.js +0 -291
- package/src/hooks/useDevices/index.js +0 -35
- package/src/hooks/useDevices/queries.js +0 -19
- package/src/hooks/useEditOneExtProductFoodOptional/index.js +0 -28
- package/src/hooks/useEditSubProductOptional/index.js +0 -11
- package/src/hooks/useEmployee/index.js +0 -13
- package/src/hooks/useEmployee/queries.js +0 -17
- package/src/hooks/useFavoriteStores/index.js +0 -19
- package/src/hooks/useFavoriteStores/queries.js +0 -47
- package/src/hooks/useFormTools/index.js +0 -100
- package/src/hooks/useFormatDate/index.js +0 -33
- package/src/hooks/useGetStoreCookie/index.js +0 -22
- package/src/hooks/useImagesStore/index.js +0 -183
- package/src/hooks/useLogout/helpers/BroadcastChannel.js +0 -32
- package/src/hooks/useLogout/helpers/apiBaseUrl.js +0 -8
- package/src/hooks/useLogout/helpers/fetchData.js +0 -29
- package/src/hooks/useLogout/helpers/getCsrfToken.js +0 -30
- package/src/hooks/useLogout/helpers/index.js +0 -54
- package/src/hooks/useLogout/helpers/logger.js +0 -72
- package/src/hooks/useLogout/helpers/parseUrl.js +0 -36
- package/src/hooks/useLogout/index.js +0 -46
- package/src/hooks/useManageQueryParams/index.js +0 -37
- package/src/hooks/useMobile/index.js +0 -39
- package/src/hooks/useOrders/queries.js +0 -328
- package/src/hooks/useProductsFood/index.js +0 -234
- package/src/hooks/useProductsFood/useEditProduct.js +0 -8
- package/src/hooks/useProductsFood/usetagsProducts.js +0 -94
- package/src/hooks/useRestaurant/index.js +0 -19
- package/src/hooks/useSales/helpers/index.js +0 -8
- package/src/hooks/useSales/index.js +0 -1102
- package/src/hooks/useSales/useGetSale.js +0 -13
- package/src/hooks/useSales/useTotalSales.js +0 -24
- package/src/hooks/useStore/index.js +0 -70
- package/src/hooks/useUpdateExtProductFoodsSubOptional/index.js +0 -38
- package/src/index.jsx +0 -4
- package/src/utils/index.js +0 -141
- /package/src/config/client/{index.js → index.ts} +0 -0
- /package/src/hooks/getCategoriesWithProduct/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useAnimationFrame/{index.js → index.ts} +0 -0
- /package/src/hooks/useAsideCart/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useAsideCart/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useCart/{index.js → index.ts} +0 -0
- /package/src/hooks/useDeleteSubProductOptional/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useDessert/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useDynamicAuth/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useEditSubProductOptional/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useFetchJson/{index.js → index.ts} +0 -0
- /package/src/hooks/useFormatNumberPhone/{index.js → index.ts} +0 -0
- /package/src/hooks/useGenerateNumberArray/{index.js → index.ts} +0 -0
- /package/src/hooks/useGetFoodRecomended/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useGetMinPrice/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useGetOneStoreRating/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useGoogleLogin/{loadScript.js → loadScript.ts} +0 -0
- /package/src/hooks/useGoogleLogin/{removeScript.js → removeScript.ts} +0 -0
- /package/src/hooks/useInnerHtml/{index.js → index.ts} +0 -0
- /package/src/hooks/useKeypress/{index.js → index.ts} +0 -0
- /package/src/hooks/useLocationNavigate/{index.js → index.ts} +0 -0
- /package/src/{security/index.js → hooks/useManageNewOrder/helpers/mock.ts} +0 -0
- /package/src/hooks/useMutateHeight/{index.js → index.ts} +0 -0
- /package/src/hooks/useOrderClient/{index.js → index.ts} +0 -0
- /package/src/hooks/useProviders/{index.js → index.ts} +0 -0
- /package/src/hooks/useProviders/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useProvidersStore/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useReactToPrint/{index.js → index.txt} +0 -0
- /package/src/hooks/useSaveAvailableProduct/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useSchedule/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useScroll/{index.js → index.ts} +0 -0
- /package/src/hooks/useScrollRotate/{index.js → index.ts} +0 -0
- /package/src/hooks/useSetState/{index.js → index.ts} +0 -0
- /package/src/hooks/useStatusOrdersClient/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useStoreCalendar/{index.js → index.ts} +0 -0
- /package/src/hooks/useStoreContacts/{queries.js → queries.ts} +0 -0
- /package/src/mock/dessert/{index.js → index.ts} +0 -0
- /package/src/mock/{index.js → index.ts} +0 -0
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import { useMutation, useQuery } from '@apollo/client'
|
|
2
|
-
import { useState } from 'react'
|
|
3
|
-
import {
|
|
4
|
-
DELETE_ONE_CAT_PRODUCTS,
|
|
5
|
-
GET_ULTIMATE_CATEGORY_PRODUCTS,
|
|
6
|
-
UPDATE_CAT_IN_PRODUCT
|
|
7
|
-
} from '../useProductsFood/queriesStore'
|
|
8
|
-
import { GET_ONE_STORE_IN_CATEGORY } from './queries'
|
|
9
|
-
|
|
10
|
-
export const useCategoryInStore = ({ catStoreId, setAlertBox = () => {} } = {}) => {
|
|
11
|
-
// STATES
|
|
12
|
-
const [categories, setOneCategoryInStore] = useState([])
|
|
13
|
-
const [deleteCatOfProducts] = useMutation(DELETE_ONE_CAT_PRODUCTS, {
|
|
14
|
-
onError: (e) => {
|
|
15
|
-
setAlertBox({
|
|
16
|
-
message: e.graphQLErrors[0].message,
|
|
17
|
-
color: 'error'
|
|
18
|
-
})
|
|
19
|
-
},
|
|
20
|
-
update (cache) {
|
|
21
|
-
cache.modify({
|
|
22
|
-
fields: {
|
|
23
|
-
catProductsAll (dataOld = []) {
|
|
24
|
-
return cache.writeQuery({ query: GET_ULTIMATE_CATEGORY_PRODUCTS, data: dataOld })
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
})
|
|
28
|
-
}
|
|
29
|
-
})
|
|
30
|
-
const [updatedCatWithProducts] = useMutation(UPDATE_CAT_IN_PRODUCT, {
|
|
31
|
-
onError: (e) => {
|
|
32
|
-
console.log({
|
|
33
|
-
message: e.graphQLErrors[0].message,
|
|
34
|
-
color: 'error'
|
|
35
|
-
})
|
|
36
|
-
},
|
|
37
|
-
update (cache) {
|
|
38
|
-
cache.modify({
|
|
39
|
-
fields: {
|
|
40
|
-
catProductsAll (dataOld = []) {
|
|
41
|
-
return cache.writeQuery({ query: GET_ULTIMATE_CATEGORY_PRODUCTS, data: dataOld })
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
})
|
|
47
|
-
// QUERIES
|
|
48
|
-
const { data } = useQuery(GET_ULTIMATE_CATEGORY_PRODUCTS)
|
|
49
|
-
const {
|
|
50
|
-
loading,
|
|
51
|
-
error
|
|
52
|
-
} = useQuery(GET_ONE_STORE_IN_CATEGORY, {
|
|
53
|
-
variables: {
|
|
54
|
-
catStore: catStoreId
|
|
55
|
-
},
|
|
56
|
-
onError: () => {
|
|
57
|
-
console.log({ message: '', duration: 5000 })
|
|
58
|
-
},
|
|
59
|
-
onCompleted: () => {
|
|
60
|
-
setOneCategoryInStore(data.getOneCatStore)
|
|
61
|
-
}
|
|
62
|
-
})
|
|
63
|
-
// HANDLESS
|
|
64
|
-
const handlerDeleteCategoryInStore = (category) => {
|
|
65
|
-
const { pState, idPc } = category || {}
|
|
66
|
-
if (!idPc || !pState) return
|
|
67
|
-
return deleteCatOfProducts({
|
|
68
|
-
variables: { idPc, pState },
|
|
69
|
-
update (cache) {
|
|
70
|
-
cache.modify({
|
|
71
|
-
fields: {
|
|
72
|
-
catProductsAll (dataOld = []) {
|
|
73
|
-
return cache.writeQuery({ query: GET_ULTIMATE_CATEGORY_PRODUCTS, data: dataOld })
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
})
|
|
77
|
-
}
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
const handleUpdateCatInProduct = async ({ data }) => {
|
|
81
|
-
await updatedCatWithProducts({
|
|
82
|
-
variables: {
|
|
83
|
-
input: {
|
|
84
|
-
setData: data?.map(x => { return { idProduct: x.pId } }),
|
|
85
|
-
idCat: ''
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
})
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
categories,
|
|
92
|
-
data: data?.catProductsAll || [],
|
|
93
|
-
loading,
|
|
94
|
-
error,
|
|
95
|
-
handlerDeleteCategoryInStore,
|
|
96
|
-
handleUpdateCatInProduct
|
|
97
|
-
}
|
|
98
|
-
}
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const CREATE_CLIENTS = gql`
|
|
4
|
-
mutation createClients ($input: IClients) {
|
|
5
|
-
createClients(input: $input) {
|
|
6
|
-
cliId
|
|
7
|
-
idStore
|
|
8
|
-
idUser
|
|
9
|
-
clState
|
|
10
|
-
ClientAddress
|
|
11
|
-
clientNumber
|
|
12
|
-
ccClient
|
|
13
|
-
gender
|
|
14
|
-
clientLastName
|
|
15
|
-
clientName
|
|
16
|
-
createAt
|
|
17
|
-
updateAt
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
`
|
|
21
|
-
export const DELETE_ONE_CLIENTS = gql`
|
|
22
|
-
mutation deleteClient($cliId: ID, $clState: Int!) {
|
|
23
|
-
deleteClient(cliId: $cliId, clState: $clState) {
|
|
24
|
-
success
|
|
25
|
-
message
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`
|
|
29
|
-
export const GET_ALL_CLIENTS = gql`
|
|
30
|
-
query getAllClients($idStore: ID, $cId: ID, $dId: ID, $ctId: ID, $search: String, $min: Int, $max: Int, $fromDate: DateTime, $toDate: DateTime ) {
|
|
31
|
-
getAllClients(idStore: $idStore, cId: $cId, dId: $dId, ctId: $ctId, search: $search, min: $min, max: $max, fromDate: $fromDate, toDate: $toDate) {
|
|
32
|
-
cliId
|
|
33
|
-
idStore
|
|
34
|
-
gender
|
|
35
|
-
# idUser
|
|
36
|
-
clState
|
|
37
|
-
clientNumber
|
|
38
|
-
ccClient
|
|
39
|
-
clientLastName
|
|
40
|
-
clientName
|
|
41
|
-
ClientAddress
|
|
42
|
-
createAt
|
|
43
|
-
updateAt
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
`
|
|
48
|
-
export const GET_ONE_CLIENT = gql`
|
|
49
|
-
query getOneClients($cliId: ID) {
|
|
50
|
-
getOneClients(cliId: $cliId) {
|
|
51
|
-
cliId
|
|
52
|
-
idStore
|
|
53
|
-
idUser
|
|
54
|
-
clState
|
|
55
|
-
clientNumber
|
|
56
|
-
ClientAddress
|
|
57
|
-
gender
|
|
58
|
-
ccClient
|
|
59
|
-
clientLastName
|
|
60
|
-
clientName
|
|
61
|
-
createAt
|
|
62
|
-
updateAt
|
|
63
|
-
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
`
|
|
67
|
-
|
|
68
|
-
export const EDIT_ONE_CLIENT = gql`
|
|
69
|
-
mutation editOneClient($input: IClients) {
|
|
70
|
-
editOneClient(input: $input) {
|
|
71
|
-
success
|
|
72
|
-
message
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
`
|
|
76
|
-
|
|
77
|
-
export const CREATE_SHOPPING_CARD = gql`
|
|
78
|
-
mutation registerShoppingCard($input: IShoppingCard, $idSubArray: IID_SUB_ITEMS){
|
|
79
|
-
registerShoppingCard(input: $input, idSubArray: $idSubArray){
|
|
80
|
-
ShoppingCard
|
|
81
|
-
id
|
|
82
|
-
pId
|
|
83
|
-
subProductsId
|
|
84
|
-
ShoppingCardRefCode
|
|
85
|
-
uuid
|
|
86
|
-
discountCardProduct
|
|
87
|
-
idUser
|
|
88
|
-
cName
|
|
89
|
-
idStore
|
|
90
|
-
cState
|
|
91
|
-
cDatCre
|
|
92
|
-
cDatMod
|
|
93
|
-
csDescription
|
|
94
|
-
cantProducts
|
|
95
|
-
comments
|
|
96
|
-
# idSubArray
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
`
|
|
100
|
-
export const CREATE_SHOPPING_CARD_TO_USER_STORE = gql`
|
|
101
|
-
mutation registerSalesStore($input: [IShoppingCard], $id: ID, $idStore: ID, $pCodeRef: String, $change: Float, $valueDelivery: Float, $payMethodPState: Int, $pickUp: Int, $totalProductsPrice: Float, $idSubArray: IID_SUB_ITEMS){
|
|
102
|
-
registerSalesStore(input: $input, id: $id, idStore: $idStore, pCodeRef: $pCodeRef, change: $change, valueDelivery: $valueDelivery, payMethodPState: $payMethodPState, pickUp: $pickUp, totalProductsPrice: $totalProductsPrice, idSubArray: $idSubArray){
|
|
103
|
-
ShoppingCard {
|
|
104
|
-
ShoppingCard
|
|
105
|
-
id
|
|
106
|
-
pId
|
|
107
|
-
subProductsId
|
|
108
|
-
ShoppingCardRefCode
|
|
109
|
-
uuid
|
|
110
|
-
discountCardProduct
|
|
111
|
-
idUser
|
|
112
|
-
cName
|
|
113
|
-
idStore
|
|
114
|
-
cState
|
|
115
|
-
cDatCre
|
|
116
|
-
cDatMod
|
|
117
|
-
csDescription
|
|
118
|
-
cantProducts
|
|
119
|
-
comments
|
|
120
|
-
}
|
|
121
|
-
Response {
|
|
122
|
-
success
|
|
123
|
-
message
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
`
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
export const useConnection = ({ setConnectionStatus }) => {
|
|
2
|
-
async function updateConnectionStatus () {
|
|
3
|
-
if (navigator.onLine) {
|
|
4
|
-
setConnectionStatus(navigator.onLine)
|
|
5
|
-
} else {
|
|
6
|
-
setConnectionStatus(navigator.onLine)
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
// Attaching event handler for the load event
|
|
11
|
-
// window.addEventListener('load', updateConnectionStatus);
|
|
12
|
-
|
|
13
|
-
// Attaching event handler for the online event
|
|
14
|
-
window.addEventListener('online', function (e) {
|
|
15
|
-
updateConnectionStatus()
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
// Attaching event handler for the offline event
|
|
19
|
-
window.addEventListener('offline', function (e) {
|
|
20
|
-
updateConnectionStatus()
|
|
21
|
-
})
|
|
22
|
-
}
|
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
|
2
|
-
import { useMutation } from '@apollo/client'
|
|
3
|
-
import { useRef, useState } from 'react'
|
|
4
|
-
import { convertBase64, RandomCode } from '../../utils'
|
|
5
|
-
import { useLocalStorage } from '../useLocalSorage'
|
|
6
|
-
import {
|
|
7
|
-
GET_ALL_FOOD_PRODUCTS,
|
|
8
|
-
UPDATE_IMAGE_PRODUCT_FOOD,
|
|
9
|
-
UPDATE_PRODUCT_FOOD
|
|
10
|
-
} from '../useProductsFood/queriesStore'
|
|
11
|
-
import { useStore } from '../useStore'
|
|
12
|
-
import { useTagsProducts } from './../useProductsFood/usetagsProducts'
|
|
13
|
-
import { useEditImageProduct } from './helpers/useEditImageProduct'
|
|
14
|
-
import { getCatProductsWithProduct } from './helpers/manageCacheDataCatProduct'
|
|
15
|
-
|
|
16
|
-
export const useCreateProduct = ({
|
|
17
|
-
setAlertBox = () => { },
|
|
18
|
-
router,
|
|
19
|
-
sendNotification = () => { }
|
|
20
|
-
}) => {
|
|
21
|
-
const [errors, setErrors] = useState({
|
|
22
|
-
names: ''
|
|
23
|
-
})
|
|
24
|
-
const [values, setValues] = useState({})
|
|
25
|
-
const [names, setName] = useLocalStorage('namefood', '')
|
|
26
|
-
const [showMore, setShowMore] = useState(50)
|
|
27
|
-
const [search, setSearch] = useState('')
|
|
28
|
-
const [imageBase64, setImageBase64] = useState(null)
|
|
29
|
-
const [active, setActive] = useState(0)
|
|
30
|
-
const [pId, setPid] = useState(null)
|
|
31
|
-
|
|
32
|
-
const [searchFilter, setSearchFilter] = useState({ gender: [], desc: [], speciality: [] })
|
|
33
|
-
const [filter, setFilter] = useState({ gender: [], desc: [], speciality: [] })
|
|
34
|
-
const initialState = { alt: '/ images/DEFAULTBANNER.png', src: '/images/DEFAULTBANNER.png' }
|
|
35
|
-
const [image, setImage] = useState(null)
|
|
36
|
-
const [{ alt, src }, setPreviewImg] = useState(initialState)
|
|
37
|
-
const fileInputRef = useRef(null)
|
|
38
|
-
const [arrTags, setTags] = useState([])
|
|
39
|
-
|
|
40
|
-
const [dataStore] = useStore()
|
|
41
|
-
const {
|
|
42
|
-
data,
|
|
43
|
-
tags,
|
|
44
|
-
handleRegister: handleRegisterTags,
|
|
45
|
-
handleAddTag
|
|
46
|
-
} = useTagsProducts()
|
|
47
|
-
|
|
48
|
-
// HANDLESS
|
|
49
|
-
const [check, setCheck] = useState({
|
|
50
|
-
availability: true,
|
|
51
|
-
noAvailability: false
|
|
52
|
-
})
|
|
53
|
-
|
|
54
|
-
const handleCheck = (e) => {
|
|
55
|
-
const { name, checked } = e.target
|
|
56
|
-
return setCheck((prev) => ({ ...prev, [name]: checked }))
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const handleUpdateBanner = event => {
|
|
60
|
-
const { files } = event.target
|
|
61
|
-
setPreviewImg(
|
|
62
|
-
files.length
|
|
63
|
-
? {
|
|
64
|
-
src: URL.createObjectURL(files[0]),
|
|
65
|
-
alt: files[0].name
|
|
66
|
-
}
|
|
67
|
-
: initialState
|
|
68
|
-
)
|
|
69
|
-
}
|
|
70
|
-
const handleChange = (e, error) => {
|
|
71
|
-
setValues({ ...values, [e.target.name]: e.target.value })
|
|
72
|
-
setErrors({ ...errors, [e.target.name]: error })
|
|
73
|
-
}
|
|
74
|
-
const handleChangeFilter = e => {
|
|
75
|
-
setSearch(e.target.value)
|
|
76
|
-
}
|
|
77
|
-
const onClickSearch = () => {
|
|
78
|
-
setSearchFilter({ ...filter })
|
|
79
|
-
}
|
|
80
|
-
const onClickClear = () => {
|
|
81
|
-
setSearchFilter({})
|
|
82
|
-
}
|
|
83
|
-
const handleChangeClick = e => {
|
|
84
|
-
const {
|
|
85
|
-
name,
|
|
86
|
-
value,
|
|
87
|
-
checked
|
|
88
|
-
} = e.target
|
|
89
|
-
!checked
|
|
90
|
-
? setFilter(s => { return { ...s, [name]: s[name].filter(f => { return f !== value }) } })
|
|
91
|
-
: setFilter({ ...filter, [name]: [...filter[name], value] })
|
|
92
|
-
setSearchFilter({ ...filter })
|
|
93
|
-
}
|
|
94
|
-
const handleCheckFreeShipping = e => {
|
|
95
|
-
// setCheck(e.target.checked)
|
|
96
|
-
handleCheck(e)
|
|
97
|
-
setValues({
|
|
98
|
-
...values,
|
|
99
|
-
ValueDelivery: ''
|
|
100
|
-
})
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
const [updateProductFoods] = useMutation(UPDATE_PRODUCT_FOOD, {
|
|
104
|
-
})
|
|
105
|
-
const [setImageProducts] = useMutation(UPDATE_IMAGE_PRODUCT_FOOD, {
|
|
106
|
-
context: { clientName: 'admin-server' }
|
|
107
|
-
})
|
|
108
|
-
|
|
109
|
-
const onFileInputChange = async event => {
|
|
110
|
-
const { files } = event.target
|
|
111
|
-
|
|
112
|
-
const file = event.target.files[0]
|
|
113
|
-
setImage(file)
|
|
114
|
-
const base64 = await convertBase64(file)
|
|
115
|
-
// eslint-disable-next-line
|
|
116
|
-
// const [size, { unit }] = await getFileSizeByUnit(file, "B");
|
|
117
|
-
setImageBase64(base64)
|
|
118
|
-
setPreviewImg(
|
|
119
|
-
files.length
|
|
120
|
-
? {
|
|
121
|
-
src: URL.createObjectURL(files[0]),
|
|
122
|
-
alt: files[0].name
|
|
123
|
-
}
|
|
124
|
-
: initialState
|
|
125
|
-
)
|
|
126
|
-
}
|
|
127
|
-
const onTargetClick = () => {
|
|
128
|
-
fileInputRef.current.click()
|
|
129
|
-
}
|
|
130
|
-
// eslint-disable-next-line no-unused-vars
|
|
131
|
-
const { img } = useEditImageProduct({ sendNotification, initialState })
|
|
132
|
-
|
|
133
|
-
const handleRegister = async () => {
|
|
134
|
-
const {
|
|
135
|
-
ProPrice,
|
|
136
|
-
ProDescuento,
|
|
137
|
-
ProDescription,
|
|
138
|
-
ProWeight,
|
|
139
|
-
ProHeight,
|
|
140
|
-
ValueDelivery,
|
|
141
|
-
carProId
|
|
142
|
-
} = values
|
|
143
|
-
if (!carProId && !names) return setErrors({ ...errors, carProId: true })
|
|
144
|
-
|
|
145
|
-
if (!ProPrice?.length > 0) {
|
|
146
|
-
return setErrors({ ...errors, ProPrice: true })
|
|
147
|
-
}
|
|
148
|
-
const ProImage = `https:${process.env.URL_ADMIN_SERVER}static/platos/${image?.name}`
|
|
149
|
-
const pCode = RandomCode(9)
|
|
150
|
-
const formatPrice = ProPrice ? parseFloat(ProPrice.replace(/\./g, '')) : 0
|
|
151
|
-
try {
|
|
152
|
-
updateProductFoods({
|
|
153
|
-
variables: {
|
|
154
|
-
input: {
|
|
155
|
-
idStore: dataStore?.getStore?.idStore || '',
|
|
156
|
-
ProPrice: check?.desc ? 0 : formatPrice,
|
|
157
|
-
ProDescuento: check?.desc ? 0 : parseInt(ProDescuento),
|
|
158
|
-
ValueDelivery: check?.desc ? 0 : parseFloat(ValueDelivery),
|
|
159
|
-
ProDescription,
|
|
160
|
-
pName: names,
|
|
161
|
-
pCode,
|
|
162
|
-
carProId,
|
|
163
|
-
pState: 1,
|
|
164
|
-
sTateLogistic: 1,
|
|
165
|
-
ProStar: 0,
|
|
166
|
-
ProImage,
|
|
167
|
-
ProHeight: parseFloat(ProHeight),
|
|
168
|
-
ProWeight,
|
|
169
|
-
ProOutstanding: check?.desc ? 1 : 0,
|
|
170
|
-
ProDelivery: check?.desc ? 1 : 0
|
|
171
|
-
}
|
|
172
|
-
},
|
|
173
|
-
update (cache) {
|
|
174
|
-
cache.modify({
|
|
175
|
-
fields: {
|
|
176
|
-
productFoodsAll (dataOld = []) {
|
|
177
|
-
return cache.writeQuery({ query: GET_ALL_FOOD_PRODUCTS, data: dataOld })
|
|
178
|
-
},
|
|
179
|
-
getCatProductsWithProduct (dataOld = {}) {
|
|
180
|
-
const updatedData = getCatProductsWithProduct(data, carProId)
|
|
181
|
-
return updatedData
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
})
|
|
185
|
-
}
|
|
186
|
-
}).then((res) => {
|
|
187
|
-
const { updateProductFoods } = res?.data || {}
|
|
188
|
-
const { pId } = updateProductFoods || {}
|
|
189
|
-
setPid(pId ?? null)
|
|
190
|
-
router.push(
|
|
191
|
-
{
|
|
192
|
-
query: {
|
|
193
|
-
...router.query,
|
|
194
|
-
food: pId
|
|
195
|
-
}
|
|
196
|
-
},
|
|
197
|
-
undefined,
|
|
198
|
-
{ shallow: true }
|
|
199
|
-
)
|
|
200
|
-
sendNotification({
|
|
201
|
-
backgroundColor: 'success',
|
|
202
|
-
title: 'Success',
|
|
203
|
-
description: `El producto ${names} subido con éxito`
|
|
204
|
-
})
|
|
205
|
-
const objTag = {
|
|
206
|
-
aName: tags.tag,
|
|
207
|
-
nameTag: tags.tag,
|
|
208
|
-
pId
|
|
209
|
-
}
|
|
210
|
-
handleRegisterTags(objTag)
|
|
211
|
-
setValues({})
|
|
212
|
-
}).catch(err => {
|
|
213
|
-
return sendNotification({
|
|
214
|
-
backgroundColor: 'error',
|
|
215
|
-
title: `${err}`,
|
|
216
|
-
description: 'Error inesperado'
|
|
217
|
-
})
|
|
218
|
-
})
|
|
219
|
-
if (image !== null) {
|
|
220
|
-
setImageProducts({
|
|
221
|
-
variables: {
|
|
222
|
-
input: {
|
|
223
|
-
file: image,
|
|
224
|
-
pCode
|
|
225
|
-
}
|
|
226
|
-
}
|
|
227
|
-
}).then(() => {
|
|
228
|
-
}).catch(() => {
|
|
229
|
-
sendNotification({
|
|
230
|
-
backgroundColor: 'error',
|
|
231
|
-
title: `Ocurrió un error en la imagen en el producto ${names}`,
|
|
232
|
-
description: 'error'
|
|
233
|
-
})
|
|
234
|
-
})
|
|
235
|
-
}
|
|
236
|
-
} catch (error) {
|
|
237
|
-
setAlertBox({ message: 'Ha ocurrido un error', duration: 7000 })
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
// Manage tags
|
|
242
|
-
const changeHandler = (name, value) => {
|
|
243
|
-
if (name === 'tags') {
|
|
244
|
-
setTags(value)
|
|
245
|
-
if (value.length > 0 && errors.tags) {
|
|
246
|
-
setErrors(prev => {
|
|
247
|
-
const prevErrors = { ...prev }
|
|
248
|
-
delete prevErrors.tags
|
|
249
|
-
return prevErrors
|
|
250
|
-
})
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
return {
|
|
255
|
-
errors,
|
|
256
|
-
src,
|
|
257
|
-
names,
|
|
258
|
-
setName,
|
|
259
|
-
alt,
|
|
260
|
-
showMore,
|
|
261
|
-
success: true,
|
|
262
|
-
fileInputRef,
|
|
263
|
-
values,
|
|
264
|
-
search,
|
|
265
|
-
pId,
|
|
266
|
-
dataTags: data,
|
|
267
|
-
tags,
|
|
268
|
-
active,
|
|
269
|
-
idStore: dataStore?.getStore?.idStore || '',
|
|
270
|
-
arrTags,
|
|
271
|
-
setPid,
|
|
272
|
-
handleChange,
|
|
273
|
-
onClickClear,
|
|
274
|
-
handleChangeClick,
|
|
275
|
-
handleChangeFilter,
|
|
276
|
-
handleUpdateBanner,
|
|
277
|
-
onClickSearch,
|
|
278
|
-
changeHandler,
|
|
279
|
-
setErrors,
|
|
280
|
-
handleRegister,
|
|
281
|
-
setActive,
|
|
282
|
-
onFileInputChange,
|
|
283
|
-
handleRegisterTags,
|
|
284
|
-
setShowMore,
|
|
285
|
-
onTargetClick,
|
|
286
|
-
handleAddTag,
|
|
287
|
-
handleCheck,
|
|
288
|
-
handleCheckFreeShipping,
|
|
289
|
-
check
|
|
290
|
-
}
|
|
291
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { useState, useEffect } from 'react'
|
|
2
|
-
import { useQuery } from '@apollo/client'
|
|
3
|
-
import { GET_ALL_DEVICES } from './queries'
|
|
4
|
-
import { useFormatDate } from '../useFormatDate'
|
|
5
|
-
|
|
6
|
-
export const useDevices = () => {
|
|
7
|
-
const { data, loading } = useQuery(GET_ALL_DEVICES, {
|
|
8
|
-
onError: (error) => {
|
|
9
|
-
console.error(error)
|
|
10
|
-
}
|
|
11
|
-
})
|
|
12
|
-
const [deviceId, setDeviceId] = useState(false)
|
|
13
|
-
const [date, setDate] = useState('')
|
|
14
|
-
|
|
15
|
-
useEffect(() => {
|
|
16
|
-
if (window) {
|
|
17
|
-
setDeviceId(window.localStorage.getItem('deviceid'))
|
|
18
|
-
}
|
|
19
|
-
}, [])
|
|
20
|
-
|
|
21
|
-
// Función para formatear la fecha
|
|
22
|
-
const formatDate = useFormatDate({ date })
|
|
23
|
-
|
|
24
|
-
const updateDate = (newDate) => {
|
|
25
|
-
setDate(newDate)
|
|
26
|
-
}
|
|
27
|
-
return {
|
|
28
|
-
data: data?.getDeviceUsers || [],
|
|
29
|
-
date,
|
|
30
|
-
deviceId,
|
|
31
|
-
formatDate,
|
|
32
|
-
loading,
|
|
33
|
-
updateDate
|
|
34
|
-
}
|
|
35
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { gql } from '@apollo/client'
|
|
2
|
-
|
|
3
|
-
export const GET_ALL_DEVICES = gql`
|
|
4
|
-
query getDeviceUsers{
|
|
5
|
-
getDeviceUsers{
|
|
6
|
-
dId
|
|
7
|
-
locationFormat
|
|
8
|
-
deviceId
|
|
9
|
-
deviceName
|
|
10
|
-
type
|
|
11
|
-
short_name
|
|
12
|
-
platform
|
|
13
|
-
version
|
|
14
|
-
dState
|
|
15
|
-
DatCre
|
|
16
|
-
DatMod
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
`
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import React from 'react'
|
|
2
|
-
import { useState } from 'react';
|
|
3
|
-
import { useMutation } from '@apollo/client'
|
|
4
|
-
import { UPDATE_EXT_PRODUCT_FOOD_OPTIONAL } from './queries';
|
|
5
|
-
export const useEditOneExtProductFoodOptional = () => {
|
|
6
|
-
const [updateExtProductFood] = useMutation(UPDATE_EXT_PRODUCT_FOOD_OPTIONAL);
|
|
7
|
-
const [loading, setLoading] = useState(false);
|
|
8
|
-
|
|
9
|
-
const updateOneExtraProductFood = async (input) => {
|
|
10
|
-
setLoading(true);
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
const { data } = await updateExtProductFood({
|
|
14
|
-
variables: { input }
|
|
15
|
-
});
|
|
16
|
-
console.log('Product food updated:', data.editExtProductFoodOptional);
|
|
17
|
-
setLoading(false);
|
|
18
|
-
} catch (error) {
|
|
19
|
-
console.error('Error updating product food:', error.message);
|
|
20
|
-
setLoading(false);
|
|
21
|
-
throw new Error('Error updating product food');
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
loading,
|
|
26
|
-
updateOneExtraProductFood
|
|
27
|
-
}
|
|
28
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { EDIT_EXTRA_SUB_OPTIONAL_PRODUCTS } from "./queries"
|
|
2
|
-
import { useMutation } from '@apollo/client'
|
|
3
|
-
|
|
4
|
-
export const useEditSubProductOptional = () => {
|
|
5
|
-
const [editExtFoodSubsOptional, {
|
|
6
|
-
loading,
|
|
7
|
-
error,
|
|
8
|
-
called
|
|
9
|
-
}] = useMutation(EDIT_EXTRA_SUB_OPTIONAL_PRODUCTS)
|
|
10
|
-
return [editExtFoodSubsOptional, { loading, error, called }]
|
|
11
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
2
|
-
import { useEffect, useState } from 'react'
|
|
3
|
-
import { GET_EMPLOYEES } from './queries'
|
|
4
|
-
|
|
5
|
-
export const useEmployee = () => {
|
|
6
|
-
const [clientes, setClients] = useState([])
|
|
7
|
-
const [more, setMore] = useState(100)
|
|
8
|
-
const { data, loading, error, fetchMore } = useQuery(GET_EMPLOYEES)
|
|
9
|
-
useEffect(() => {
|
|
10
|
-
setClients(data)
|
|
11
|
-
}, [clientes, data])
|
|
12
|
-
return [clientes?.employees, { loading, error, fetchMore, setMore, more }]
|
|
13
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { useQuery } from '@apollo/client'
|
|
2
|
-
import { GET_ALL_FAV_STORE } from './queries'
|
|
3
|
-
|
|
4
|
-
export const useFavoriteStores = () => {
|
|
5
|
-
const {
|
|
6
|
-
data,
|
|
7
|
-
loading,
|
|
8
|
-
error
|
|
9
|
-
} = useQuery(GET_ALL_FAV_STORE, {
|
|
10
|
-
fetchPolicy: 'cache-and-network',
|
|
11
|
-
onError: () => {
|
|
12
|
-
console.log('')
|
|
13
|
-
}
|
|
14
|
-
})
|
|
15
|
-
|
|
16
|
-
const favoriteStores = data?.getFavorite || []
|
|
17
|
-
|
|
18
|
-
return [favoriteStores, { loading, error }]
|
|
19
|
-
}
|