npm-pkg-hook 1.12.4 → 1.12.8
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 +57529 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +57315 -0
- package/dist/index.mjs.map +1 -0
- package/eslint.config.mts +153 -0
- package/package.json +30 -45
- package/src/config/client/errors.ts +39 -0
- package/src/hooks/addTenMinutes/{index.js → index.ts} +4 -4
- package/src/hooks/calculateLogLatHaversine/{index.js → index.ts} +15 -4
- package/src/hooks/completeSchedules/{index.js → index.ts} +4 -4
- package/src/hooks/convertToMilitaryTime/index.ts +18 -0
- package/src/hooks/generateStoreURL/index.ts +41 -0
- package/src/hooks/generateTemplate/{index.js → index.ts} +15 -11
- package/src/hooks/getCardType/{index.js → index.ts} +1 -1
- 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.js → index.ts} +18 -12
- package/src/hooks/getTotalHours/index.ts +76 -0
- package/src/hooks/handleLogin/{index.js → index.ts} +4 -0
- package/src/hooks/index.ts +8 -2
- package/src/hooks/statusOpenStores/helpers/{index.js → index.ts} +24 -1
- package/src/hooks/statusOpenStores/index.ts +221 -0
- package/src/hooks/updateExtProductFoodsOptional/{index.js → index.ts} +12 -3
- package/src/hooks/useAcumulateDate/index.ts +18 -0
- package/src/hooks/useAllStoresPendingToRegister/{index.js → index.ts} +3 -0
- package/src/hooks/useAmountInput/index.ts +42 -32
- package/src/hooks/useAnimationText/{index.jsx → index.ts} +2 -2
- package/src/hooks/useAsideCart/{index.js → index.ts} +22 -19
- package/src/hooks/useBanner/{index.js → index.ts} +2 -1
- package/src/hooks/useCart/useCart/helpers/{index.js → index.ts} +10 -6
- package/src/hooks/useCart/useCart/{index.js → index.ts} +29 -17
- package/src/hooks/useCart/useGetCart/{index.js → index.ts} +2 -1
- package/src/hooks/useCatWithProduct/{index.js → index.ts} +11 -5
- package/src/hooks/useCatWithProduct/types/index.ts +104 -0
- package/src/hooks/useCatWithProductClient/{index.js → index.ts} +3 -2
- package/src/hooks/useCategoriesProduct/{index.js → index.ts} +2 -1
- package/src/hooks/useCategoryInStore/index.ts +167 -0
- package/src/hooks/useCategoryStore/{index.js → index.ts} +2 -1
- package/src/hooks/useCategoryStore/{queries.js → queries.ts} +2 -2
- package/src/hooks/useChartData/{index.js → index.ts} +9 -8
- package/src/hooks/useChartData/useChartData/{index.js → index.ts} +31 -30
- package/src/hooks/useChartData/useChartDataAllOrders/{index.js → index.ts} +2 -2
- package/src/hooks/useCheckbox/{index.js → index.ts} +1 -1
- package/src/hooks/useCities/{index.js → index.ts} +2 -1
- package/src/hooks/useClients/{index.js → index.ts} +2 -1
- package/src/hooks/useClients/{queries.js → queries.ts} +7 -4
- package/src/hooks/useColorByLetters/helpers/{alea.js → alea.ts} +19 -0
- package/src/hooks/useColorByLetters/helpers/{index.js → index.ts} +5 -1
- package/src/hooks/useColorByLetters/helpers/{mersenne_twister.js → mersenne_twister.ts} +1 -1
- package/src/hooks/useColorByLetters/{index.js → index.ts} +3 -6
- package/src/hooks/useConnection/{index.js → index.ts} +3 -3
- package/src/hooks/useCountries/{index.js → index.ts} +2 -1
- package/src/hooks/useCreateOrderStatusType/index.ts +8 -6
- package/src/hooks/useCreateProduct/helpers/{index.js → index.ts} +1 -1
- 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.js → index.ts} +22 -19
- package/src/hooks/useCreateStorePendingToRegister/{index.js → index.ts} +5 -1
- package/src/hooks/useDeleteExtraProductFoods/{index.js → index.ts} +2 -1
- package/src/hooks/useDeleteSubProductOptional/{index.js → index.ts} +5 -3
- package/src/hooks/useDeliveryTime/{index.js → index.ts} +3 -1
- package/src/hooks/useDepartments/{index.js → index.ts} +2 -1
- package/src/hooks/useDessert/{index.js → index.ts} +56 -52
- package/src/hooks/useDessertWithPrice/helpers/{index.js → index.ts} +4 -4
- package/src/hooks/useDessertWithPrice/{index.js → index.ts} +34 -26
- package/src/hooks/useDevWS/index.ts +43 -43
- package/src/hooks/useDevices/{useGetDevices.js → useGetDevices.ts} +3 -3
- package/src/hooks/useDevices/{useRegisterDevices.js → useRegisterDevices.ts} +5 -5
- package/src/hooks/useDownloadReports/helpers/downloadFileFromResponse.ts +17 -17
- package/src/hooks/useDownloadReports/useDownloadReportByDay/index.ts +4 -2
- package/src/hooks/useDownloadReports/useGetReportByDateRange/index.ts +3 -2
- 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} +5 -5
- 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.js → index.ts} +2 -1
- package/src/hooks/useEmployee/{queries.js → queries.ts} +1 -1
- package/src/hooks/useEmployee/{useCreateEmployee.js → useCreateEmployee.ts} +6 -2
- package/src/hooks/useFavoriteStores/{index.js → index.ts} +5 -3
- package/src/hooks/useFetchMoreInteractions/index.jsx +26 -26
- package/src/hooks/useFilterConfigs/index.ts +173 -0
- package/src/hooks/useFingerprintjs/{index.js → index.ts} +29 -4
- package/src/hooks/useFormTools/{index.js → index.ts} +38 -11
- package/src/hooks/useFormatDate/{index.js → index.ts} +10 -5
- package/src/hooks/useFullScreenMode/{index.js → index.ts} +1 -5
- package/src/hooks/useGetAllLocationUser/{index.js → index.ts} +2 -1
- package/src/hooks/useGetAllLocationUser/{queries.js → queries.ts} +2 -2
- package/src/hooks/{useSales/useGetAllSales/index.js → useGetAllSales/index.ts} +3 -2
- package/src/hooks/useGetExtProductFoodsSubOptionalAll/{index.js → index.ts} +2 -1
- package/src/hooks/useGetFoodRecomended/{index.js → index.ts} +2 -1
- package/src/hooks/useGetMinPrice/{index.js → index.ts} +2 -1
- package/src/hooks/useGetOneStoreRating/{index.js → index.ts} +2 -1
- package/src/hooks/useGetStoreCookie/{index.js → index.ts} +1 -1
- 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 +25 -9
- package/src/hooks/useImageUploaderProduct/helper/getOrientation.ts +5 -4
- package/src/hooks/useImageUploaderProduct/index.ts +227 -224
- package/src/hooks/useImageWeight/{index.js → index.ts} +4 -0
- package/src/hooks/useImagesStore/{index.js → index.ts} +7 -5
- package/src/hooks/useImagesStore/{queries.js → queries.ts} +1 -1
- package/src/hooks/useIncomingOrders/{index.js → index.ts} +2 -1
- package/src/hooks/useIncomingOrders/{queries.js → queries.ts} +1 -1
- package/src/hooks/useIntersection/{index.js → index.ts} +1 -1
- package/src/hooks/useInventory/{queries.js → queries.ts} +2 -2
- package/src/hooks/useInventory/{useGetProductsInStock.js → useGetProductsInStock.ts} +2 -1
- package/src/hooks/useLazyScript/{index.js → index.ts} +3 -0
- package/src/hooks/useLocalSorage/{index.js → index.ts} +3 -3
- package/src/hooks/useLocationManager/{index.js → index.ts} +3 -3
- package/src/hooks/useLoginEmployeeInStore/{index.js → index.ts} +1 -1
- package/src/hooks/useLogout/helpers/BroadcastChannel.ts +74 -0
- package/src/hooks/useLogout/helpers/{apiBaseUrl.js → apiBaseUrl.ts} +4 -0
- package/src/hooks/useLogout/helpers/{fetchData.js → fetchData.ts} +10 -1
- package/src/hooks/useLogout/helpers/{getCsrfToken.js → getCsrfToken.ts} +8 -1
- package/src/hooks/useLogout/helpers/{index.js → index.ts} +14 -6
- package/src/hooks/useLogout/helpers/{logger.js → logger.ts} +26 -8
- package/src/hooks/useLogout/helpers/{parseUrl.js → parseUrl.ts} +5 -2
- package/src/hooks/useLogout/{index.js → index.ts} +29 -20
- package/src/hooks/useManageNewOrder/helpers/{index.js → index.ts} +1 -1
- package/src/hooks/useManageNewOrder/{index.js → index.ts} +6 -4
- package/src/hooks/useManageQueryParams/index.ts +120 -0
- package/src/hooks/useModules/helpers/{validateModules.js → validateModules.ts} +1 -1
- package/src/hooks/useModules/index.ts +124 -0
- package/src/hooks/useMouse/index.ts +23 -18
- package/src/hooks/useOrderStatusTypes/useOrderStatusTypes/index.ts +1 -1
- package/src/hooks/useOrderStatusTypes/useUpdateOrderStatusPriorities/index.ts +7 -5
- package/src/hooks/useOrders/{queries.js → queries.ts} +30 -20
- package/src/hooks/useOrders/useChangeOrderState/index.ts +79 -76
- package/src/hooks/useOrders/useOrdersFromStore/index.ts +4 -3
- 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/usePrintSaleTicket/index.ts +4 -0
- package/src/hooks/useProductsFood/{index.js → index.ts} +115 -27
- package/src/hooks/useProductsFood/{queriesStore.js → queriesStore.ts} +1 -1
- package/src/hooks/useProductsFood/{useEditProduct.js → useEditProduct.ts} +2 -1
- package/src/hooks/useProductsFood/{usetagsProducts.js → usetagsProducts.ts} +6 -3
- 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.js → index.ts} +1 -1
- package/src/hooks/usePushNotifications/helpers/{index.js → index.ts} +9 -0
- package/src/hooks/usePushNotifications/{index.js → index.ts} +2 -1
- package/src/hooks/useQueryLocationsMap/{index.js → index.ts} +2 -1
- package/src/hooks/useRatingArrayData/{index.js → index.ts} +4 -4
- package/src/hooks/useRatingArrayData/{queries.js → queries.ts} +1 -1
- package/src/hooks/useRemoveExtraProductFoodsOptional/{index.js → index.ts} +2 -1
- package/src/hooks/useReport/{index.js → index.ts} +2 -1
- package/src/hooks/useReport/{queries.js → queries.ts} +2 -53
- package/src/hooks/useRestaurant/helpers/{index.js → index.ts} +4 -0
- package/src/hooks/useRestaurant/helpers/{manageStatusOpen.js → manageStatusOpen.ts} +1 -1
- package/src/hooks/useRestaurant/{index.js → index.ts} +5 -3
- package/src/hooks/useRoads/{index.js → index.ts} +2 -1
- package/src/hooks/useRoles/{queries.js → queries.ts} +1 -1
- package/src/hooks/useRoles/{useCreateRole.js → useCreateRole.ts} +4 -1
- package/src/hooks/useRoles/{useGetRoles.js → useGetRoles.ts} +2 -1
- 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.js → index.ts} +559 -522
- package/src/hooks/useSales/{queries.js → queries.ts} +187 -79
- 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.js → useGetSale.ts} +10 -2
- package/src/hooks/useSales/{useTotalSales.js → useTotalSales.ts} +2 -1
- package/src/hooks/useSaveAvailableProduct/helpers/{index.js → index.ts} +4 -4
- package/src/hooks/useSaveAvailableProduct/{index.js → index.ts} +2 -1
- package/src/hooks/useSaveLocation/{index.js → index.ts} +2 -1
- package/src/hooks/useSaveLocation/{queries.js → queries.ts} +1 -1
- package/src/hooks/useSchedule/{index.jsx → index.ts} +14 -1
- package/src/hooks/useSchedule/{index.js → schedule.ts} +2 -1
- package/src/hooks/useScheduleData/{index.js → index.ts} +21 -9
- package/src/hooks/useSetImageProducts/{index.js → index.ts} +4 -2
- package/src/hooks/useSetupSchedule/{index.js → index.ts} +40 -28
- package/src/hooks/useStatusOpenStore/helpers/{index.js → index.ts} +24 -1
- package/src/hooks/useStatusOpenStore/{index.js → index.ts} +30 -14
- 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.js → index.ts} +1 -1
- package/src/hooks/useStockMovements/{index.js → index.ts} +4 -3
- package/src/hooks/useStore/{index.js → index.ts} +30 -27
- package/src/hooks/useStoreContacts/{index.js → index.ts} +11 -5
- package/src/hooks/useStoreTable/{useStoreTableCreate.js → useStoreTableCreate.ts} +3 -2
- package/src/hooks/useStoreTable/{useStoreTables.js → useStoreTables.ts} +2 -1
- package/src/hooks/useSubscriptionValidation/index.ts +112 -0
- package/src/hooks/useTagProducts/useDeleteOneTag.ts +66 -66
- package/src/hooks/useTagProducts/useGetAllTags.ts +2 -2
- package/src/hooks/useTagProducts/useRegisterMultipleTags.ts +27 -26
- package/src/hooks/useTheme/index.ts +65 -0
- package/src/hooks/useTimeAgo/{useTimeAgo.js → useTimeAgo.ts} +7 -7
- package/src/hooks/useTokenCards/{index.js → index.ts} +7 -3
- package/src/hooks/useUpdateCart/{index.js → index.ts} +3 -2
- package/src/hooks/useUpdateCartCookie/{index.js → index.ts} +23 -6
- package/src/hooks/useUpdateDashboardComponent/index.ts +11 -11
- package/src/hooks/useUpdateExtProductFoodsSubOptional/{index.js → index.ts} +2 -1
- package/src/hooks/useUpdateModuleOrder/{index.js → index.ts} +2 -2
- package/src/hooks/useUpdateMultipleExtProduct/{index.js → index.ts} +2 -1
- package/src/hooks/useUpdateMultipleProducts/{index.js → index.ts} +57 -20
- package/src/hooks/useUploadProducts/helpers/{parseNumber.js → parseNumber.ts} +3 -3
- package/src/hooks/useUploadProducts/{index.js → index.ts} +89 -69
- package/src/hooks/useUpsertGoal/{index.js → index.ts} +1 -1
- package/src/hooks/useUser/{index.js → index.ts} +5 -4
- package/src/hooks/useWeeklyStockMovement/helpers/{index.js → index.ts} +3 -3
- package/src/hooks/useWeeklyStockMovement/{index.js → index.ts} +4 -3
- package/src/hooks/useWindowSize/{index.js → index.ts} +9 -2
- package/src/index.ts +13 -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/{index.js → utils.ts} +69 -31
- package/tsconfig.eslint.json +16 -0
- package/tsconfig.json +18 -2
- package/tsup.config.ts +24 -0
- package/.eslintrc.js +0 -38
- package/.eslintrc.json +0 -127
- package/src/config/client/errors.js +0 -26
- package/src/hooks/convertToMilitaryTime/index.js +0 -14
- package/src/hooks/generateStoreURL/index.js +0 -38
- package/src/hooks/getGlobalSession/index.js +0 -49
- package/src/hooks/getSession/index.js +0 -18
- package/src/hooks/getTotalHours/index.js +0 -48
- package/src/hooks/statusOpenStores/index.js +0 -156
- package/src/hooks/useAcumulateDate/index.js +0 -16
- package/src/hooks/useCategoryInStore/index.js +0 -100
- package/src/hooks/useEditOneExtProductFoodOptional/index.js +0 -28
- package/src/hooks/useEditSubProductOptional/index.js +0 -11
- package/src/hooks/useLogout/helpers/BroadcastChannel.js +0 -31
- package/src/hooks/useManageQueryParams/index.js +0 -40
- package/src/hooks/useModules/index.js +0 -58
- package/src/hooks/useSales/helpers/index.js +0 -55
- package/src/hooks/useSubscriptionValidation/index.js +0 -41
- package/src/index.jsx +0 -9
- package/src/security/index.js +0 -1
- package/src/utils/UtilDateRange.js +0 -31
- /package/src/config/client/{index.js → index.ts} +0 -0
- /package/src/config/content/{index.js → index.ts} +0 -0
- /package/src/cookies/{index.js → index.ts} +0 -0
- /package/src/hooks/getCategoriesWithProduct/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/isTokenExpired/{index.js → index.ts} +0 -0
- /package/src/hooks/newMessageSubscription/{index.js → index.ts} +0 -0
- /package/src/hooks/newStoreOrderSubscription/{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/useCart/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useCatWithProduct/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useCatWithProductClient/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useCategoriesProduct/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useCategoryInStore/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useChatRoomSubscription/{index.js → index.ts} +0 -0
- /package/src/hooks/useCities/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useColorByLetters/helpers/{colors.js → colors.ts} +0 -0
- /package/src/hooks/useCountries/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useCreateDeliveryTime/{index.js → index.ts} +0 -0
- /package/src/hooks/useCreateStorePendingToRegister/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useDashboardComponents/{index.js → index.ts} +0 -0
- /package/src/hooks/useDeleteSubProductOptional/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useDepartments/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useDessert/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useDessertWithPrice/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useDevices/{index.js → index.ts} +0 -0
- /package/src/hooks/useDevices/{queries.js → queries.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/useEvent/{index.js → index.ts} +0 -0
- /package/src/hooks/useFavoriteStores/{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/useGetCookies/{index.js → index.ts} +0 -0
- /package/src/hooks/useGetFoodRecomended/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useGetMessagesToRoom/{index.js → index.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/useGetSalesAmountToday/{index.js → index.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/useImagesStore/utils/{index.js → index.ts} +0 -0
- /package/src/hooks/useInnerHtml/{index.js → index.ts} +0 -0
- /package/src/hooks/useInventory/{index.js → index.ts} +0 -0
- /package/src/hooks/useInventory/{useUpdateManageStock.js → useUpdateManageStock.ts} +0 -0
- /package/src/hooks/useKeypress/{index.js → index.ts} +0 -0
- /package/src/hooks/useLocalBackendIp/{index.js → index.ts} +0 -0
- /package/src/hooks/useLocationNavigate/{index.js → index.ts} +0 -0
- /package/src/hooks/useManageNewOrder/helpers/{mock.js → mock.ts} +0 -0
- /package/src/hooks/useMobile/{index.js → index.ts} +0 -0
- /package/src/hooks/useModules/helpers/{index.js → index.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/useOrders/{index.js → index.ts} +0 -0
- /package/src/hooks/usePWAInstall/{index.js → index.ts} +0 -0
- /package/src/{services/index.js → hooks/useProductsFood/types/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/useQueryLocationsMap/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useReactToPrint/{index.js → index.txt} +0 -0
- /package/src/hooks/useRemoveExtraProductFoodsOptional/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useRestaurant/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useRoads/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useRoles/{index.js → index.ts} +0 -0
- /package/src/hooks/useRoles/{useRemoveRoles.js → useRemoveRoles.ts} +0 -0
- /package/src/hooks/useRoles/{useUpdateRolesPriority.js → useUpdateRolesPriority.ts} +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/useSetImageProducts/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useSetSession/{index.js → index.ts} +0 -0
- /package/src/hooks/useSetState/{index.js → index.ts} +0 -0
- /package/src/hooks/useSetupSchedule/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useStatusOrdersClient/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useStore/{queries.js → queries.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/hooks/useStoreTable/{index.js → index.ts} +0 -0
- /package/src/hooks/useStoreTable/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useTopProductsMovements/{index.js → index.ts} +0 -0
- /package/src/hooks/useTotalAllSales/{index.js → index.ts} +0 -0
- /package/src/hooks/useTotalProductsInStock/{index.js → index.ts} +0 -0
- /package/src/hooks/useTotalProductsSold/{index.js → index.ts} +0 -0
- /package/src/hooks/useTotalProductsSolded/{index.js → index.ts} +0 -0
- /package/src/hooks/useUpdateExistingOrders/{index.js → index.ts} +0 -0
- /package/src/hooks/useUpdateMultipleExtProduct/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useUpdateMultipleProducts/{queries.js → queries.ts} +0 -0
- /package/src/hooks/useUploadProducts/helpers/{index.js → index.ts} +0 -0
- /package/src/hooks/useUploadProducts/helpers/{validateProductDataExcel.js → validateProductDataExcel.ts} +0 -0
- /package/src/hooks/useUser/{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,16 +1,17 @@
|
|
|
1
1
|
import { useQuery } from '@apollo/client'
|
|
2
|
-
import { useState } from 'react'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
|
|
3
4
|
import { SPANISH_MONTHS } from '../../../utils/index'
|
|
4
5
|
import { GET_ALL_SALES } from '../../useReport/queries'
|
|
5
6
|
|
|
6
7
|
// Función para calcular el total de ventas por mes
|
|
7
8
|
const calculateSalesByMonth = (salesData) => {
|
|
8
9
|
try {
|
|
9
|
-
const result = Array.from({ length: 12 }, (_, mes) =>
|
|
10
|
+
const result = Array.from({ length: 12 }, (_, mes) => {return {
|
|
10
11
|
Mes: mes,
|
|
11
12
|
Year: new Date().getFullYear(),
|
|
12
13
|
totalProductsPrice: 0
|
|
13
|
-
})
|
|
14
|
+
}})
|
|
14
15
|
|
|
15
16
|
salesData?.forEach((value) => {
|
|
16
17
|
const mes = new Date(value.pDatCre).getMonth()
|
|
@@ -26,15 +27,15 @@ const calculateSalesByMonth = (salesData) => {
|
|
|
26
27
|
// Función para llenar los meses faltantes
|
|
27
28
|
const fillMissingMonths = (data) => {
|
|
28
29
|
try {
|
|
29
|
-
const allMonths = Array.from({ length: 12 }, (_, i) => i)
|
|
30
|
-
const missingMonths = allMonths.filter(month => !data.some(data => data.Mes === month))
|
|
30
|
+
const allMonths = Array.from({ length: 12 }, (_, i) => {return i})
|
|
31
|
+
const missingMonths = allMonths.filter(month => {return !data.some(data => {return data.Mes === month})})
|
|
31
32
|
return data.concat(
|
|
32
|
-
missingMonths.map(element =>
|
|
33
|
+
missingMonths.map(element => {return {
|
|
33
34
|
Mes: element,
|
|
34
35
|
totalProductsPrice: 0,
|
|
35
36
|
Year: ''
|
|
36
|
-
})
|
|
37
|
-
).sort((a, b) => a.Mes - b.Mes)
|
|
37
|
+
}})
|
|
38
|
+
).sort((a, b) => {return a.Mes - b.Mes})
|
|
38
39
|
} catch (error) {
|
|
39
40
|
return []
|
|
40
41
|
}
|
|
@@ -42,16 +43,16 @@ const fillMissingMonths = (data) => {
|
|
|
42
43
|
// eslint-disable-next-line prefer-const
|
|
43
44
|
let chartTypeYear = ''
|
|
44
45
|
// Función para obtener los datos del gráfico
|
|
45
|
-
const getChartData = (asFilter, newResult, result, chartType) =>
|
|
46
|
+
const getChartData = (asFilter, newResult, result, chartType) => {return {
|
|
46
47
|
labels: asFilter
|
|
47
|
-
? newResult.map(data => SPANISH_MONTHS[data.Mes])
|
|
48
|
-
: result.map(data => SPANISH_MONTHS[data.Mes]),
|
|
48
|
+
? newResult.map(data => {return SPANISH_MONTHS[data.Mes]})
|
|
49
|
+
: result.map(data => {return SPANISH_MONTHS[data.Mes]}),
|
|
49
50
|
datasets: [
|
|
50
51
|
{
|
|
51
52
|
label: `Ventas por meses del año ${asFilter ? chartTypeYear : ''}`,
|
|
52
53
|
data: asFilter
|
|
53
|
-
? newResult.map(data => data.totalProductsPrice)
|
|
54
|
-
: result.map(data => data.totalProductsPrice),
|
|
54
|
+
? newResult.map(data => {return data.totalProductsPrice})
|
|
55
|
+
: result.map(data => {return data.totalProductsPrice}),
|
|
55
56
|
backgroundColor: [
|
|
56
57
|
'rgba(255, 99, 132, 0.2)',
|
|
57
58
|
'rgba(54, 162, 235, 0.2)',
|
|
@@ -62,13 +63,13 @@ const getChartData = (asFilter, newResult, result, chartType) => ({
|
|
|
62
63
|
],
|
|
63
64
|
borderColor: chartType === 'bar'
|
|
64
65
|
? [
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
66
|
+
'rgba(255, 99, 132, 1)',
|
|
67
|
+
'rgba(54, 162, 235, 1)',
|
|
68
|
+
'rgba(255, 206, 86, 1)',
|
|
69
|
+
'rgba(75, 192, 192, 1)',
|
|
70
|
+
'rgba(153, 102, 255, 1)',
|
|
71
|
+
'rgba(255, 159, 64, 1)'
|
|
72
|
+
]
|
|
72
73
|
: 'rgb(255 0 0)',
|
|
73
74
|
tension: 0.6,
|
|
74
75
|
fill: false,
|
|
@@ -78,7 +79,7 @@ const getChartData = (asFilter, newResult, result, chartType) => ({
|
|
|
78
79
|
minBarLength: 3
|
|
79
80
|
}
|
|
80
81
|
]
|
|
81
|
-
}
|
|
82
|
+
}}
|
|
82
83
|
|
|
83
84
|
// Función para agrupar los datos por año
|
|
84
85
|
const groupSalesByYear = (salesData = []) => {
|
|
@@ -107,7 +108,7 @@ const getUniqueYears = (salesData = []) => {
|
|
|
107
108
|
years.push(y)
|
|
108
109
|
}
|
|
109
110
|
})
|
|
110
|
-
return years.sort((a, b) => b - a)
|
|
111
|
+
return years.sort((a, b) => {return b - a})
|
|
111
112
|
} catch (error) {
|
|
112
113
|
return []
|
|
113
114
|
}
|
|
@@ -126,7 +127,7 @@ export const useChartData = ({ year }) => {
|
|
|
126
127
|
|
|
127
128
|
const dataChart = getChartData(asFilter, newResult, filledResult, chartType)
|
|
128
129
|
|
|
129
|
-
|
|
130
|
+
|
|
130
131
|
const groupedData = groupSalesByYear(data?.getAllSalesStore)
|
|
131
132
|
const years = getUniqueYears(data?.getAllSalesStore)
|
|
132
133
|
|
|
@@ -136,17 +137,17 @@ export const useChartData = ({ year }) => {
|
|
|
136
137
|
setChartTypeYear(currentYear || '')
|
|
137
138
|
|
|
138
139
|
if (filledResult?.length > 0) {
|
|
139
|
-
const filterToYear = filledResult.filter((elem) => elem?.Year === currentYear)
|
|
140
|
-
|
|
141
|
-
const missingNewMonths = allMonths?.filter(month => !filterToYear.some(data => data.Mes === month))
|
|
140
|
+
const filterToYear = filledResult.filter((elem) => {return elem?.Year === currentYear})
|
|
141
|
+
|
|
142
|
+
const missingNewMonths = allMonths?.filter(month => {return !filterToYear.some(data => {return data.Mes === month})})
|
|
142
143
|
|
|
143
144
|
const newFilteredResult = filterToYear.concat(
|
|
144
|
-
missingNewMonths.map(element =>
|
|
145
|
+
missingNewMonths.map(element => {return {
|
|
145
146
|
Mes: element,
|
|
146
147
|
totalProductsPrice: 0,
|
|
147
148
|
Year: ''
|
|
148
|
-
})
|
|
149
|
-
).sort((a, b) => a.Mes - b.Mes)
|
|
149
|
+
}})
|
|
150
|
+
).sort((a, b) => {return a.Mes - b.Mes})
|
|
150
151
|
|
|
151
152
|
setNewResult(newFilteredResult)
|
|
152
153
|
return newFilteredResult
|
|
@@ -158,7 +159,7 @@ export const useChartData = ({ year }) => {
|
|
|
158
159
|
setChartTypeYear(new Date().getFullYear())
|
|
159
160
|
}
|
|
160
161
|
|
|
161
|
-
const sortYear = () => years.sort((a, b) => b - a)
|
|
162
|
+
const sortYear = () => {return years.sort((a, b) => {return b - a})}
|
|
162
163
|
const labelTitle = `Ventas por meses del año ${asFilter ? chartTypeYear : ''}`
|
|
163
164
|
const organiceYears = sortYear()
|
|
164
165
|
const options = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useGetAllSales } from '../../
|
|
1
|
+
import { useGetAllSales } from '../../useGetAllSales'
|
|
2
2
|
|
|
3
3
|
export const useChartDataAllOrders = ({
|
|
4
4
|
onScreen = false
|
|
@@ -77,7 +77,7 @@ export const useChartDataAllOrders = ({
|
|
|
77
77
|
callbacks: {
|
|
78
78
|
label: (tooltipItem, data) => {
|
|
79
79
|
const dataset = data?.datasets[tooltipItem.datasetIndex]
|
|
80
|
-
const total = dataset?.data?.reduce((previousValue, currentValue) => previousValue + currentValue)
|
|
80
|
+
const total = dataset?.data?.reduce((previousValue, currentValue) => {return previousValue + currentValue})
|
|
81
81
|
const currentValue = dataset?.data[tooltipItem?.index]
|
|
82
82
|
const percentage = ((currentValue / total) * 100).toFixed(2)
|
|
83
83
|
return `${data?.labels[tooltipItem?.index]}: ${currentValue} (${percentage}%)`
|
|
@@ -15,7 +15,7 @@ import { useCallback, useState } from 'react'
|
|
|
15
15
|
* - clearAll (callback)
|
|
16
16
|
*/
|
|
17
17
|
|
|
18
|
-
export const useCheckboxState = (elem, selectedIds = [], disabledIds = [], setArray = () => {
|
|
18
|
+
export const useCheckboxState = (elem, selectedIds = [], disabledIds = [], setArray = () => { }) => {
|
|
19
19
|
const numTotalItems = elem?.length
|
|
20
20
|
const [checkedItems, setCheckedItems] = useState(new Set(selectedIds))
|
|
21
21
|
const [disabledItems, setDisabledItems] = useState(new Set(disabledIds))
|
|
@@ -27,6 +27,7 @@ mutation createClients ($input: IClients) {
|
|
|
27
27
|
gender
|
|
28
28
|
clientLastName
|
|
29
29
|
clientName
|
|
30
|
+
default
|
|
30
31
|
createAt
|
|
31
32
|
updateAt
|
|
32
33
|
}
|
|
@@ -56,6 +57,7 @@ query getAllClients($idStore: ID, $search: String, $min: Int, $max: Int, $fromDa
|
|
|
56
57
|
clientLastName
|
|
57
58
|
|
|
58
59
|
clientName
|
|
60
|
+
default
|
|
59
61
|
createAt
|
|
60
62
|
updateAt
|
|
61
63
|
}
|
|
@@ -93,6 +95,7 @@ query getOneClients($cliId: ID) {
|
|
|
93
95
|
ccClient
|
|
94
96
|
clientLastName
|
|
95
97
|
clientName
|
|
98
|
+
default
|
|
96
99
|
createAt
|
|
97
100
|
updateAt
|
|
98
101
|
|
|
@@ -137,12 +140,12 @@ mutation registerSalesStore(
|
|
|
137
140
|
$input: [IShoppingCart]
|
|
138
141
|
$id: ID
|
|
139
142
|
$tableId: ID
|
|
140
|
-
$discount:
|
|
143
|
+
$discount: DiscountInput
|
|
141
144
|
$idStore: ID
|
|
142
145
|
$pCodeRef: String
|
|
143
146
|
$change: Float
|
|
144
147
|
$shoppingCartRefCode: String
|
|
145
|
-
$
|
|
148
|
+
$payId: ID
|
|
146
149
|
$pickUp: Int
|
|
147
150
|
$totalProductsPrice: Float
|
|
148
151
|
$valueDelivery: Float
|
|
@@ -158,7 +161,7 @@ mutation registerSalesStore(
|
|
|
158
161
|
pCodeRef: $pCodeRef
|
|
159
162
|
change: $change
|
|
160
163
|
|
|
161
|
-
|
|
164
|
+
payId: $payId
|
|
162
165
|
pickUp: $pickUp
|
|
163
166
|
totalProductsPrice: $totalProductsPrice
|
|
164
167
|
valueDelivery: $valueDelivery
|
|
@@ -183,7 +186,7 @@ mutation registerSalesStore(
|
|
|
183
186
|
idStore
|
|
184
187
|
id
|
|
185
188
|
channel
|
|
186
|
-
|
|
189
|
+
payId
|
|
187
190
|
pSState
|
|
188
191
|
createdAt
|
|
189
192
|
updatedAt
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*
|
|
3
|
+
*/
|
|
1
4
|
class AleaGen {
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
* @param seed
|
|
8
|
+
*/
|
|
2
9
|
constructor (seed) {
|
|
3
10
|
if (seed == null) { seed = +(new Date()) }
|
|
4
11
|
let n = 0xefc8249d
|
|
@@ -19,6 +26,10 @@ class AleaGen {
|
|
|
19
26
|
if (this.s2 < 0) {
|
|
20
27
|
this.s2 += 1
|
|
21
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
*
|
|
31
|
+
* @param data
|
|
32
|
+
*/
|
|
22
33
|
function mash (data) {
|
|
23
34
|
data = String(data)
|
|
24
35
|
for (let i = 0; i < data.length; i++) {
|
|
@@ -35,6 +46,9 @@ class AleaGen {
|
|
|
35
46
|
}
|
|
36
47
|
}
|
|
37
48
|
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
*/
|
|
38
52
|
next () {
|
|
39
53
|
const { c, s0, s1, s2 } = this
|
|
40
54
|
const t = 2091639 * s0 + c * 2.3283064365386963e-10 // 2^-32
|
|
@@ -43,6 +57,11 @@ class AleaGen {
|
|
|
43
57
|
return this.s2 = t - (this.c = t | 0)
|
|
44
58
|
}
|
|
45
59
|
|
|
60
|
+
/**
|
|
61
|
+
*
|
|
62
|
+
* @param f
|
|
63
|
+
* @param t
|
|
64
|
+
*/
|
|
46
65
|
copy (f, t) {
|
|
47
66
|
t.c = f.c
|
|
48
67
|
t.s0 = f.s0
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import MersenneTwister from './mersenne_twister.js'
|
|
2
1
|
import AleaGen from './alea.js'
|
|
2
|
+
import MersenneTwister from './mersenne_twister.js'
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
*
|
|
6
|
+
* @param opts
|
|
7
|
+
*/
|
|
4
8
|
function minMax (opts) {
|
|
5
9
|
const { random, min, max } = opts
|
|
6
10
|
return Math.floor(random * (max - min + 1) + min)
|
|
@@ -64,7 +64,7 @@ MersenneTwister.prototype.init_by_array = function (init_key, key_length) {
|
|
|
64
64
|
/* generates a random number on [0,0xffffffff]-interval */
|
|
65
65
|
MersenneTwister.prototype.genrand_int32 = function () {
|
|
66
66
|
let y
|
|
67
|
-
const mag01 =
|
|
67
|
+
const mag01 = [0x0, this.MATRIX_A]
|
|
68
68
|
/* mag01[x] = x * MATRIX_A for x=0,1 */
|
|
69
69
|
if (this.mti >= this.N) { /* generate N words at one time */
|
|
70
70
|
let kk
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import { randomNumber } from './helpers'
|
|
2
2
|
import { BACKGROUND_COLORS, TEXT_COLORS } from './helpers/colors'
|
|
3
3
|
|
|
4
|
-
export const useColorByLetters = ({
|
|
5
|
-
value = ''
|
|
6
|
-
} = {
|
|
7
|
-
value: ''
|
|
8
|
-
}) => {
|
|
4
|
+
export const useColorByLetters = (params?: { value?: string }) => {
|
|
5
|
+
const value = params?.value ?? '';
|
|
9
6
|
const key = randomNumber({ value, min: 0, max: 19 })
|
|
10
7
|
|
|
11
|
-
const getCustomColors = (text) => {
|
|
8
|
+
const getCustomColors = (text: string) => {
|
|
12
9
|
const key = randomNumber({ text, min: 0, max: 19 })
|
|
13
10
|
return {
|
|
14
11
|
key,
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export const useConnection = ({ setConnectionStatus }) => {
|
|
2
|
+
/**
|
|
3
|
+
*
|
|
4
|
+
*/
|
|
2
5
|
async function updateConnectionStatus () {
|
|
3
6
|
if (navigator.onLine) {
|
|
4
7
|
setConnectionStatus(navigator.onLine)
|
|
@@ -7,9 +10,6 @@ export const useConnection = ({ setConnectionStatus }) => {
|
|
|
7
10
|
}
|
|
8
11
|
}
|
|
9
12
|
|
|
10
|
-
// Attaching event handler for the load event
|
|
11
|
-
// window.addEventListener('load', updateConnectionStatus);
|
|
12
|
-
|
|
13
13
|
if (typeof window !== 'undefined') {
|
|
14
14
|
// Attaching event handler for the online event
|
|
15
15
|
window.addEventListener('online', function () {
|
|
@@ -56,6 +56,8 @@ interface ResponseOrderStatusType {
|
|
|
56
56
|
|
|
57
57
|
/**
|
|
58
58
|
* 🧩 Hook personalizado para crear un OrderStatusType
|
|
59
|
+
* @param root0
|
|
60
|
+
* @param root0.sendNotification
|
|
59
61
|
*/
|
|
60
62
|
export const useCreateOrderStatusType = ({
|
|
61
63
|
sendNotification
|
|
@@ -71,14 +73,14 @@ export const useCreateOrderStatusType = ({
|
|
|
71
73
|
CREATE_ORDER_STATUS_TYPE,
|
|
72
74
|
{
|
|
73
75
|
update(cache, { data }) {
|
|
74
|
-
console.log(
|
|
76
|
+
console.log('🚀 ~ useCreateOrderStatusType ~ data:', data, cache)
|
|
75
77
|
const newItem = data?.createOrderStatusType?.data
|
|
76
78
|
if (!newItem) return
|
|
77
79
|
|
|
78
80
|
cache.modify({
|
|
79
81
|
fields: {
|
|
80
82
|
getAllOrderStatusTypes(existing = {}) {
|
|
81
|
-
|
|
83
|
+
console.log('🚀 ~ useCreateOrderStatusType ~ existing:', existing)
|
|
82
84
|
|
|
83
85
|
}
|
|
84
86
|
}
|
|
@@ -97,7 +99,7 @@ export const useCreateOrderStatusType = ({
|
|
|
97
99
|
? 'Estado de orden creado'
|
|
98
100
|
: 'Error al crear el estado de orden',
|
|
99
101
|
description: message,
|
|
100
|
-
backgroundColor: success ? 'success' : 'error'
|
|
102
|
+
backgroundColor: success ? 'success' : 'error'
|
|
101
103
|
})
|
|
102
104
|
}
|
|
103
105
|
}
|
|
@@ -106,7 +108,7 @@ export const useCreateOrderStatusType = ({
|
|
|
106
108
|
const handleCreateStatus = async (input: OrderStatusTypeInput) => {
|
|
107
109
|
try {
|
|
108
110
|
const response = await createOrderStatusType({
|
|
109
|
-
variables: { data: input }
|
|
111
|
+
variables: { data: input }
|
|
110
112
|
})
|
|
111
113
|
|
|
112
114
|
return response.data?.createOrderStatusType
|
|
@@ -114,7 +116,7 @@ export const useCreateOrderStatusType = ({
|
|
|
114
116
|
sendNotification({
|
|
115
117
|
title: 'Error al crear el estado de orden',
|
|
116
118
|
description: 'Ha ocurrido un error inesperado al crear el estado de orden.',
|
|
117
|
-
backgroundColor: 'error'
|
|
119
|
+
backgroundColor: 'error'
|
|
118
120
|
})
|
|
119
121
|
throw err
|
|
120
122
|
}
|
|
@@ -125,7 +127,7 @@ export const useCreateOrderStatusType = ({
|
|
|
125
127
|
{
|
|
126
128
|
data: data?.createOrderStatusType,
|
|
127
129
|
loading,
|
|
128
|
-
error
|
|
130
|
+
error
|
|
129
131
|
}
|
|
130
132
|
]
|
|
131
133
|
}
|
|
@@ -8,7 +8,7 @@ const MAX_PRICE = 999999999999.99
|
|
|
8
8
|
* @returns {boolean} - Retorna `true` si todos los valores están en rango, `false` si alguno excede el máximo.
|
|
9
9
|
*/
|
|
10
10
|
export const verifyPriceInRange = ({ values = [], sendNotification }) => {
|
|
11
|
-
const isAnyValueOutOfRange = values.some(value => value > MAX_PRICE)
|
|
11
|
+
const isAnyValueOutOfRange = values.some(value => {return value > MAX_PRICE})
|
|
12
12
|
// Si algún valor está fuera del rango, envía una notificación y retorna false
|
|
13
13
|
if (isAnyValueOutOfRange) {
|
|
14
14
|
sendNotification({
|
|
@@ -14,7 +14,7 @@ export function getCatProductsWithProduct (dataOld = {}, carProId = '') {
|
|
|
14
14
|
const catProductsWithProduct = copyDataOld?.catProductsWithProduct || []
|
|
15
15
|
|
|
16
16
|
// Find the index of the product to update
|
|
17
|
-
const indexToUpdate = catProductsWithProduct?.findIndex(product => product?.carProId === carProId)
|
|
17
|
+
const indexToUpdate = catProductsWithProduct?.findIndex(product => {return product?.carProId === carProId})
|
|
18
18
|
|
|
19
19
|
if (indexToUpdate !== -1) {
|
|
20
20
|
// Create a new product
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import { useRef, useState } from 'react'
|
|
3
3
|
|
|
4
4
|
export const useEditImageProduct = ({ sendNotification = () => { }, initialState }) => {
|
|
5
5
|
const [openEditImage, setopenEditImage] = useState(false)
|
|
6
|
-
|
|
6
|
+
|
|
7
7
|
const [tags, setTags] = useState([])
|
|
8
8
|
const [{ src, alt }, setPreviewImg] = useState([])
|
|
9
9
|
const [errors, setErrors] = useState({})
|
|
@@ -77,9 +77,9 @@ export const useEditImageProduct = ({ sendNotification = () => { }, initialState
|
|
|
77
77
|
setPreviewImg(
|
|
78
78
|
file
|
|
79
79
|
? {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
src: URL.createObjectURL(file),
|
|
81
|
+
alt: ''
|
|
82
|
+
}
|
|
83
83
|
: initialState
|
|
84
84
|
)
|
|
85
85
|
// You can use the file object to send it to a server or to download it
|
|
@@ -100,6 +100,12 @@ export const useEditImageProduct = ({ sendNotification = () => { }, initialState
|
|
|
100
100
|
})
|
|
101
101
|
// You can use the file object to send it to a server or to download it
|
|
102
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
*
|
|
105
|
+
* @param image
|
|
106
|
+
* @param crop
|
|
107
|
+
* @param zoom
|
|
108
|
+
*/
|
|
103
109
|
function getPixelCrop (image, crop, zoom) {
|
|
104
110
|
const imgWidth = image.naturalWidth
|
|
105
111
|
const imgHeight = image.naturalHeight
|
|
@@ -150,9 +156,9 @@ export const useEditImageProduct = ({ sendNotification = () => { }, initialState
|
|
|
150
156
|
setPreviewImg(
|
|
151
157
|
file
|
|
152
158
|
? {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
159
|
+
src: URL.createObjectURL(file),
|
|
160
|
+
alt: ''
|
|
161
|
+
}
|
|
156
162
|
: initialState
|
|
157
163
|
)
|
|
158
164
|
// You can use the file object to send it to a server or to download it
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import { useMutation } from '@apollo/client'
|
|
3
|
-
import { useRef, useState } from 'react'
|
|
4
|
-
|
|
3
|
+
import { useRef, useState } from 'react'
|
|
4
|
+
|
|
5
|
+
import { RandomCode } from '../../utils'
|
|
5
6
|
import { useLocalStorage } from '../useLocalSorage'
|
|
6
7
|
import {
|
|
7
8
|
UPDATE_PRODUCT_FOOD
|
|
8
9
|
} from '../useProductsFood/queriesStore'
|
|
9
|
-
import {
|
|
10
|
-
import { useTagsProducts } from './../useProductsFood/usetagsProducts'
|
|
11
|
-
import { useEditImageProduct } from './helpers/useEditImageProduct'
|
|
12
|
-
import { getCatProductsWithProduct } from './helpers/manageCacheDataCatProduct'
|
|
13
|
-
import { UPDATE_IMAGE_PRODUCT_FOOD } from '../useSetImageProducts/queries'
|
|
10
|
+
import { useTagsProducts } from '../useProductsFood/usetagsProducts'
|
|
14
11
|
import { useSetImageProducts } from '../useSetImageProducts'
|
|
12
|
+
import { UPDATE_IMAGE_PRODUCT_FOOD } from '../useSetImageProducts/queries'
|
|
13
|
+
import { useStore } from '../useStore'
|
|
14
|
+
|
|
15
|
+
import { getCatProductsWithProduct } from './helpers/manageCacheDataCatProduct'
|
|
16
|
+
import { useEditImageProduct } from './helpers/useEditImageProduct'
|
|
17
|
+
|
|
15
18
|
|
|
16
19
|
export const useCreateProduct = ({
|
|
17
20
|
router,
|
|
@@ -63,11 +66,11 @@ export const useCreateProduct = ({
|
|
|
63
66
|
const [checkStock, setCheckStock] = useState(false)
|
|
64
67
|
|
|
65
68
|
const handleIncreaseStock = () => {
|
|
66
|
-
setStock(prevStock => prevStock + 1)
|
|
69
|
+
setStock(prevStock => {return prevStock + 1})
|
|
67
70
|
}
|
|
68
71
|
|
|
69
72
|
const handleDecreaseStock = () => {
|
|
70
|
-
setStock(prevStock => (prevStock > 1 ? prevStock - 1 : 1))
|
|
73
|
+
setStock(prevStock => {return (prevStock > 1 ? prevStock - 1 : 1)})
|
|
71
74
|
}
|
|
72
75
|
|
|
73
76
|
const handleCheckStock = () => {
|
|
@@ -98,7 +101,7 @@ export const useCreateProduct = ({
|
|
|
98
101
|
|
|
99
102
|
const handleCheck = (e) => {
|
|
100
103
|
const { name, checked } = e.target
|
|
101
|
-
return setCheck((prev) =>
|
|
104
|
+
return setCheck((prev) => {return { ...prev, [name]: checked }})
|
|
102
105
|
}
|
|
103
106
|
|
|
104
107
|
const handleUpdateBanner = event => {
|
|
@@ -106,23 +109,23 @@ export const useCreateProduct = ({
|
|
|
106
109
|
setPreviewImg(
|
|
107
110
|
files.length
|
|
108
111
|
? {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
src: URL.createObjectURL(files[0]),
|
|
113
|
+
alt: files[0].name
|
|
114
|
+
}
|
|
112
115
|
: initialState
|
|
113
116
|
)
|
|
114
117
|
}
|
|
115
118
|
const handleChange = (e, error) => {
|
|
116
119
|
const { name, value } = e.target
|
|
117
|
-
setValues((prev) =>
|
|
120
|
+
setValues((prev) => {return {
|
|
118
121
|
...prev,
|
|
119
122
|
[name]: value
|
|
120
|
-
})
|
|
123
|
+
}})
|
|
121
124
|
|
|
122
|
-
setErrors((prev) =>
|
|
125
|
+
setErrors((prev) => {return {
|
|
123
126
|
...prev,
|
|
124
127
|
[name]: error
|
|
125
|
-
})
|
|
128
|
+
}})
|
|
126
129
|
}
|
|
127
130
|
const handleChangeFilter = e => {
|
|
128
131
|
setSearch(e.target.value)
|
|
@@ -165,7 +168,7 @@ export const useCreateProduct = ({
|
|
|
165
168
|
fileInputRef.current.click()
|
|
166
169
|
}
|
|
167
170
|
}
|
|
168
|
-
|
|
171
|
+
|
|
169
172
|
const { img } = useEditImageProduct({ sendNotification, initialState })
|
|
170
173
|
|
|
171
174
|
const handleRegister = async () => {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import { useMutation } from '@apollo/client'
|
|
1
|
+
import { useMutation } from '@apollo/client'
|
|
2
|
+
|
|
2
3
|
import { CREATE_STORE_PENDING_TO_REGISTER } from './queries'
|
|
3
4
|
|
|
5
|
+
/**
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
4
8
|
export function useCreateStorePendingToRegister () {
|
|
5
9
|
const [createStorePendingToRegister, { data, loading, error }] = useMutation(CREATE_STORE_PENDING_TO_REGISTER)
|
|
6
10
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { useMutation } from '@apollo/client'
|
|
2
|
-
|
|
1
|
+
import { useMutation } from '@apollo/client'
|
|
2
|
+
|
|
3
3
|
import { updateCacheMod } from '../../utils'
|
|
4
|
-
import { GET_EXTRAS_PRODUCT_FOOD_OPTIONAL } from '../useRemoveExtraProductFoodsOptional/queries'
|
|
4
|
+
import { GET_EXTRAS_PRODUCT_FOOD_OPTIONAL } from '../useRemoveExtraProductFoodsOptional/queries'
|
|
5
|
+
|
|
6
|
+
import { DELETE_CAT_EXTRA_SUB_OPTIONAL_PRODUCTS } from './queries'
|
|
5
7
|
|
|
6
8
|
export const useDeleteSubProductOptional = ({ setAlertBox = () => { } } = {}) => {
|
|
7
9
|
const [DeleteExtFoodSubsOptional, {
|
|
@@ -2,6 +2,8 @@ import { useEffect, useState } from 'react'
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Custom hook to handle delivery time input validation and formatting.
|
|
5
|
+
* @param root0
|
|
6
|
+
* @param root0.initialTime
|
|
5
7
|
* @returns {Object} An object containing state and functions for handling delivery time.
|
|
6
8
|
*/
|
|
7
9
|
export const useDeliveryTime = ({ initialTime = '' }) => {
|
|
@@ -16,7 +18,7 @@ export const useDeliveryTime = ({ initialTime = '' }) => {
|
|
|
16
18
|
* Handles changes to the delivery time input.
|
|
17
19
|
* @param {String} value - The input change value.
|
|
18
20
|
*/
|
|
19
|
-
const handleDeliveryTimeChange = (value) => {
|
|
21
|
+
const handleDeliveryTimeChange = (value: string) => {
|
|
20
22
|
setDeliveryTime(value)
|
|
21
23
|
}
|
|
22
24
|
|