contentoh-components-library 0.1.1 → 8.0.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/.env.development +16 -3
- package/.env.production +14 -1
- package/CHANGELOG.md +40 -0
- package/dist/assets/fonts/avenirnext/AvenirNextLTPro-Bold.otf +0 -0
- package/dist/assets/fonts/avenirnext/AvenirNextLTPro-It.otf +0 -0
- package/dist/assets/fonts/avenirnext/AvenirNextLTPro-Regular.otf +0 -0
- package/dist/assets/fonts/lato/Lato-Bold.ttf +0 -0
- package/dist/assets/fonts/lato/Lato-Italic.ttf +0 -0
- package/dist/assets/fonts/lato/Lato-Light.ttf +0 -0
- package/dist/assets/fonts/lato/Lato-Regular.ttf +0 -0
- package/dist/assets/fonts/lato/Lato-Thin.ttf +0 -0
- package/dist/assets/fonts/lato/OFL.txt +93 -0
- package/dist/assets/fonts/raleway/Raleway-Black.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-Bold.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-ExtraBold.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-Italic.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-Medium.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-Regular.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-SemiBold.ttf +0 -0
- package/dist/assets/images/activedFilter/removeFilter.svg +3 -0
- package/dist/assets/images/arrow/arrowIcon.svg +3 -0
- package/dist/assets/images/arrow/polygon.svg +3 -0
- package/dist/assets/images/asignationOptions/availableIcon.svg +3 -0
- package/dist/assets/images/asignationOptions/removeAsigned.svg +4 -0
- package/dist/assets/images/asignationOptions/requestToProvider.svg +3 -0
- package/dist/assets/images/asignationOptions/requestToTeam.svg +3 -0
- package/dist/assets/images/card/masterCardIcon.svg +5 -0
- package/dist/assets/images/checkBox/checked.svg +3 -0
- package/dist/assets/images/checkBox/unchecked.svg +3 -0
- package/dist/assets/images/componentAssigned/assignedImage1.svg +9 -0
- package/dist/assets/images/componentAssigned/assignedImage2.svg +9 -0
- package/dist/assets/images/componentAssigned/clock.svg +4 -0
- package/dist/assets/images/componentAssigned/flag.svg +3 -0
- package/dist/assets/images/defaultImages/defaultProductImage.png +0 -0
- package/dist/assets/images/defaultImages/defaultProfileImage.svg +13 -0
- package/dist/assets/images/defaultImages/defaultUpdate.png +0 -0
- package/dist/assets/images/dropDownButton/dropDownArrowButton.svg +3 -0
- package/dist/assets/images/editField/editField.svg +3 -0
- package/dist/assets/images/flags/highPriority.svg +3 -0
- package/dist/assets/images/flags/lowPriority.svg +3 -0
- package/dist/assets/images/flags/mediumPriority.svg +3 -0
- package/dist/assets/images/flags/noPriority.svg +3 -0
- package/dist/assets/images/generalButton/acceptIcon.svg +3 -0
- package/dist/assets/images/generalButton/closeIcon.svg +4 -0
- package/dist/assets/images/generalButton/deleteIcon.svg +13 -0
- package/dist/assets/images/generalButton/deleteIconHover.svg +13 -0
- package/dist/assets/images/generalButton/gridLayout.svg +3 -0
- package/dist/assets/images/generalButton/nullIcon.svg +3 -0
- package/dist/assets/images/generalButton/openModal.svg +3 -0
- package/dist/assets/images/generalButton/rejectIcon.svg +3 -0
- package/dist/assets/images/generalButton/rowLayout.svg +3 -0
- package/dist/assets/images/generalButton/saveIcon.svg +3 -0
- package/dist/assets/images/generalButton/saveIconHover.svg +3 -0
- package/dist/assets/images/generalImage/assigned.svg +14 -0
- package/dist/assets/images/generalImage/bags.svg +25 -0
- package/dist/assets/images/generalImage/clock.svg +4 -0
- package/dist/assets/images/generalImage/flag.svg +3 -0
- package/dist/assets/images/genericModal/genericModalCheck.svg +3 -0
- package/dist/assets/images/genericModal/genericModalClose.svg +3 -0
- package/dist/assets/images/genericModal/genericModalDown.svg +3 -0
- package/dist/assets/images/genericModal/genericModalUp.svg +3 -0
- package/dist/assets/images/genericModal/genericModalWarning.svg +12 -0
- package/dist/assets/images/logo/logoLogin.svg +15 -0
- package/dist/assets/images/menuNotification/menuNotificationComment.svg +3 -0
- package/dist/assets/images/menuNotification/menuNotificationProduct.svg +3 -0
- package/dist/assets/images/menuProfile/logOut.svg +3 -0
- package/dist/assets/images/menuProfile/myAccount.svg +3 -0
- package/dist/assets/images/menuProfile/settings.svg +3 -0
- package/dist/assets/images/modalsSVGs/attributesSent.svg +208 -0
- package/dist/assets/images/modalsSVGs/descriptionSent.svg +237 -0
- package/dist/assets/images/modalsSVGs/providerSent.svg +445 -0
- package/dist/assets/images/modalsSVGs/uploadingImages.svg +148 -0
- package/dist/assets/images/productImage/openModal.svg +3 -0
- package/dist/assets/images/productNotification/productNotification.svg +3 -0
- package/dist/assets/images/profileHeader/profilePicture.svg +9 -0
- package/dist/assets/images/providerAndCadena/Cadena.svg +188 -0
- package/dist/assets/images/providerAndCadena/LoginContentoh.svg +15 -0
- package/dist/assets/images/providerAndCadena/Proveedor.svg +231 -0
- package/dist/assets/images/sideMenuButton/contenoh.svg +5 -0
- package/dist/assets/images/sideMenuButton/dashboard.svg +5 -0
- package/dist/assets/images/sideMenuButton/products.svg +10 -0
- package/dist/assets/images/sideMenuButton/providers.svg +10 -0
- package/dist/assets/images/sideMenuButton/tasks.svg +3 -0
- package/dist/components/atoms/AsignationOption/index.js +10 -5
- package/dist/components/atoms/AsignationOption/styles.js +1 -1
- package/dist/components/atoms/AtomList/index.js +5 -3
- package/dist/components/atoms/AtomList/styles.js +1 -1
- package/dist/components/atoms/Avatar/index.js +4 -2
- package/dist/components/atoms/Card/Card.stories.js +22 -0
- package/dist/components/atoms/Card/index.js +19 -0
- package/dist/components/atoms/Card/styles.js +18 -0
- package/dist/components/atoms/CheckBox/index.js +3 -1
- package/dist/components/atoms/Commentary/Commentary.stories.js +1 -0
- package/dist/components/atoms/Commentary/index.js +15 -0
- package/dist/components/atoms/Commentary/styles.js +20 -0
- package/dist/components/atoms/CustomerTypeImage/index.js +2 -1
- package/dist/components/atoms/EditField/EditField.stories.js +24 -0
- package/dist/components/atoms/EditField/index.js +29 -0
- package/dist/components/atoms/EditField/styles.js +20 -0
- package/dist/components/atoms/GeneralButton/GeneralButton.stories.js +1 -1
- package/dist/components/atoms/GeneralButton/index.js +3 -1
- package/dist/components/atoms/GeneralButton/styles.js +12 -2
- package/dist/components/atoms/GeneralInput/index.js +60 -8
- package/dist/components/atoms/GeneralInput/styles.js +4 -1
- package/dist/components/atoms/GeneralTextBox/styles.js +1 -1
- package/dist/components/atoms/GenericModal/GenericModal.stories.js +171 -0
- package/dist/components/atoms/GenericModal/index.js +23 -0
- package/dist/components/atoms/GenericModal/styles.js +22 -0
- package/dist/components/atoms/GradientPanel/GradientPanel.stories.js +135 -4
- package/dist/components/atoms/GradientPanel/index.js +4 -2
- package/dist/components/atoms/GradientPanel/styles.js +2 -2
- package/dist/components/atoms/Graphic/Graphic.stories.js +30 -0
- package/dist/components/atoms/Graphic/index.js +30 -0
- package/dist/components/atoms/Graphic/styles.js +18 -0
- package/dist/components/atoms/Input/index.js +19 -0
- package/dist/components/atoms/Input/style.js +26 -0
- package/dist/components/atoms/LabelToInput/index.js +48 -0
- package/dist/components/atoms/LabelToInput/style.js +22 -0
- package/dist/components/atoms/LoadImageMenu/LoadImageMenu.stories.js +29 -0
- package/dist/components/atoms/LoadImageMenu/index.js +74 -0
- package/dist/components/atoms/LoadImageMenu/styles.js +20 -0
- package/dist/components/atoms/LogoImage/LogoImage.stories.js +22 -0
- package/dist/components/atoms/LogoImage/index.js +23 -0
- package/dist/components/atoms/LogoImage/styles.js +18 -0
- package/dist/components/atoms/MenuNotification/MenuNotification.stories.js +33 -0
- package/dist/components/atoms/MenuNotification/index.js +35 -0
- package/dist/components/atoms/MenuNotification/styles.js +20 -0
- package/dist/components/atoms/MenuProfile/MenuProfile.stories.js +24 -0
- package/dist/components/atoms/MenuProfile/index.js +47 -0
- package/dist/components/atoms/MenuProfile/styles.js +20 -0
- package/dist/components/atoms/Notification/Notification.stories.js +30 -0
- package/dist/components/atoms/Notification/index.js +27 -0
- package/dist/components/atoms/Notification/styles.js +20 -0
- package/dist/components/atoms/Percent/Percent.stories.js +33 -0
- package/dist/components/atoms/Percent/index.js +32 -0
- package/dist/components/atoms/Percent/styles.js +20 -0
- package/dist/components/atoms/PriorityFlag/index.js +1 -1
- package/dist/components/atoms/ProductImage/styles.js +1 -1
- package/dist/components/atoms/ProgressBar/index.js +2 -2
- package/dist/components/atoms/ProgressBar/styles.js +3 -5
- package/dist/components/atoms/ScreenHeader/ScreenHeader.stories.js +9 -2
- package/dist/components/atoms/ScreenHeader/index.js +5 -3
- package/dist/components/atoms/ScreenHeader/styles.js +17 -2
- package/dist/components/atoms/Select/index.js +32 -0
- package/dist/components/atoms/Select/style.js +32 -0
- package/dist/components/atoms/StatusTag/styles.js +1 -1
- package/dist/components/atoms/ValidationPanel/index.js +4 -3
- package/dist/components/molecules/AddProvidersAndProducts/AddProvidersAndProducts.stories.js +28 -0
- package/dist/components/molecules/AddProvidersAndProducts/index.js +36 -0
- package/dist/components/molecules/AddProvidersAndProducts/styles.js +20 -0
- package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +44 -0
- package/dist/components/molecules/AssignedWork/index.js +55 -0
- package/dist/components/molecules/AssignedWork/styles.js +20 -0
- package/dist/components/molecules/AvatarAndValidation/index.js +17 -7
- package/dist/components/molecules/AvatarAndValidation/styles.js +1 -1
- package/dist/components/molecules/EditionActiveImage/index.js +6 -2
- package/dist/components/molecules/FeaturesBar/index.js +21 -2
- package/dist/components/molecules/FeaturesBar/styles.js +1 -1
- package/dist/components/molecules/GalleryElement/index.js +51 -20
- package/dist/components/molecules/GalleryElement/styles.js +1 -1
- package/dist/components/molecules/GalleryHeader/GalleryHeader.stories.js +22 -0
- package/dist/components/molecules/GalleryHeader/index.js +30 -0
- package/dist/components/molecules/GalleryHeader/styles.js +20 -0
- package/dist/components/molecules/ImageSelector/index.js +8 -5
- package/dist/components/molecules/ParentComponent/ParentComponent.stories.js +25 -0
- package/dist/components/molecules/ParentComponent/index.js +67 -0
- package/dist/components/molecules/ParentComponent/styles.js +18 -0
- package/dist/components/molecules/PayMethod/PayMethod.stories.js +22 -0
- package/dist/components/molecules/PayMethod/index.js +61 -0
- package/dist/components/molecules/PayMethod/styles.js +20 -0
- package/dist/components/molecules/PlanSelection/PlanSelection.stories.js +0 -3
- package/dist/components/molecules/PlanSelection/index.js +1 -1
- package/dist/components/molecules/PlanSelection/styles.js +1 -1
- package/dist/components/molecules/ProductNameHeader/index.js +1 -2
- package/dist/components/molecules/ProductNotification/ProductNotification.stories.js +24 -0
- package/dist/components/molecules/ProductNotification/index.js +71 -0
- package/dist/components/molecules/ProductNotification/styles.js +20 -0
- package/dist/components/molecules/ProfileHeader/ProfileHeader.stories.js +30 -0
- package/dist/components/molecules/ProfileHeader/index.js +73 -0
- package/dist/components/molecules/ProfileHeader/styles.js +20 -0
- package/dist/components/molecules/RetailerSelector/RetailerSelector.stories.js +42 -0
- package/dist/components/molecules/RetailerSelector/index.js +71 -0
- package/dist/components/molecules/RetailerSelector/styles.js +20 -0
- package/dist/components/molecules/SidebarNotification/SidebarNotification.stories.js +98 -0
- package/dist/components/molecules/SidebarNotification/index.js +105 -0
- package/dist/components/molecules/SidebarNotification/styles.js +20 -0
- package/dist/components/molecules/StatusAsignationInfo/index.js +51 -12
- package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
- package/dist/components/molecules/TableHeader/index.js +5 -4
- package/dist/components/molecules/TabsMenu/index.js +4 -2
- package/dist/components/molecules/TagAndInput/index.js +28 -3
- package/dist/components/molecules/TagAndInput/styles.js +1 -1
- package/dist/components/organisms/FullProductNameHeader/index.js +32 -8
- package/dist/components/organisms/FullTabsMenu/index.js +17 -5
- package/dist/components/organisms/FullTabsMenu/styles.js +1 -1
- package/dist/components/organisms/Fullplan/FullPlan.stories.js +13 -15
- package/dist/components/organisms/Fullplan/index.js +1 -1
- package/dist/components/organisms/Fullplan/styles.js +1 -1
- package/dist/components/organisms/ImageDataTable/index.js +77 -15
- package/dist/components/organisms/ImageDataTable/styles.js +7 -1
- package/dist/components/organisms/ImagePreviewer/index.js +6 -19
- package/dist/components/organisms/InputGroup/index.js +53 -8
- package/dist/components/organisms/InputGroup/styles.js +1 -1
- package/dist/components/organisms/ProductImageModal/ProductImageModal.stories.js +122 -120
- package/dist/components/organisms/ProductImageModal/index.js +28 -12
- package/dist/components/organisms/ProductImageModal/styles.js +1 -1
- package/dist/components/pages/CustomerLogin/CustomerLogin.stories.js +95 -0
- package/dist/components/pages/CustomerLogin/index.js +29 -0
- package/dist/components/pages/CustomerLogin/styles.js +18 -0
- package/dist/components/pages/CustomerPayMethod/CustomerPayMethod.stories.js +72 -0
- package/dist/components/pages/CustomerPayMethod/index.js +29 -0
- package/dist/components/pages/CustomerPayMethod/styles.js +18 -0
- package/dist/components/pages/CustomerType/CustomerType.stories.js +16 -5
- package/dist/components/pages/CustomerType/styles.js +1 -3
- package/dist/components/pages/OnboardPlan/OnboardPlan.stories.js +24 -10
- package/dist/components/pages/OnboardPlan/index.js +8 -10
- package/dist/components/pages/OnboardPlan/styles.js +1 -1
- package/dist/components/pages/RetailerPlan/RetailerPlan.stories.js +59 -0
- package/dist/components/pages/RetailerPlan/index.js +31 -0
- package/dist/components/pages/RetailerPlan/styles.js +18 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +101 -313
- package/dist/components/pages/RetailerProductEdition/index.js +1071 -39
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/global-files/data.js +219 -0
- package/dist/global-files/variables.js +1 -0
- package/dist/index.js +7 -2
- package/package.json +10 -4
- package/src/assets/images/arrow/arrowIcon.svg +3 -0
- package/src/assets/images/arrow/polygon.svg +3 -0
- package/src/assets/images/card/masterCardIcon.svg +5 -0
- package/src/assets/images/componentAssigned/assignedImage1.svg +9 -0
- package/src/assets/images/componentAssigned/assignedImage2.svg +9 -0
- package/src/assets/images/componentAssigned/clock.svg +4 -0
- package/src/assets/images/componentAssigned/flag.svg +3 -0
- package/src/assets/images/defaultImages/defaultUpdate.png +0 -0
- package/src/assets/images/editField/editField.svg +3 -0
- package/src/assets/images/generalButton/deleteIcon.svg +13 -0
- package/src/assets/images/generalButton/deleteIconHover.svg +13 -0
- package/src/assets/images/generalButton/saveIcon.svg +3 -0
- package/src/assets/images/generalButton/saveIconHover.svg +3 -0
- package/src/assets/images/generalImage/assigned.svg +14 -0
- package/src/assets/images/generalImage/bags.svg +25 -0
- package/src/assets/images/generalImage/clock.svg +4 -0
- package/src/assets/images/generalImage/flag.svg +3 -0
- package/src/assets/images/genericModal/genericModalCheck.svg +3 -0
- package/src/assets/images/genericModal/genericModalClose.svg +3 -0
- package/src/assets/images/genericModal/genericModalDown.svg +3 -0
- package/src/assets/images/genericModal/genericModalUp.svg +3 -0
- package/src/assets/images/genericModal/genericModalWarning.svg +12 -0
- package/src/assets/images/logo/logoLogin.svg +15 -0
- package/src/assets/images/menuNotification/menuNotificationComment.svg +3 -0
- package/src/assets/images/menuNotification/menuNotificationProduct.svg +3 -0
- package/src/assets/images/menuProfile/logOut.svg +3 -0
- package/src/assets/images/menuProfile/myAccount.svg +3 -0
- package/src/assets/images/menuProfile/settings.svg +3 -0
- package/src/assets/images/modalsSVGs/attributesSent.svg +208 -0
- package/src/assets/images/modalsSVGs/descriptionSent.svg +237 -0
- package/src/assets/images/modalsSVGs/providerSent.svg +445 -0
- package/src/assets/images/modalsSVGs/uploadingImages.svg +148 -0
- package/src/assets/images/productNotification/productNotification.svg +3 -0
- package/src/assets/images/profileHeader/profilePicture.svg +9 -0
- package/src/components/atoms/AsignationOption/index.js +6 -4
- package/src/components/atoms/AsignationOption/styles.js +3 -1
- package/src/components/atoms/AtomList/index.js +4 -2
- package/src/components/atoms/AtomList/styles.js +4 -2
- package/src/components/atoms/Avatar/index.js +2 -1
- package/src/components/atoms/Card/Card.stories.js +12 -0
- package/src/components/atoms/Card/index.js +9 -0
- package/src/components/atoms/Card/styles.js +8 -0
- package/src/components/atoms/CheckBox/index.js +1 -1
- package/src/components/atoms/Commentary/Commentary.stories.js +0 -0
- package/src/components/atoms/Commentary/index.js +9 -0
- package/src/components/atoms/Commentary/styles.js +15 -0
- package/src/components/atoms/CustomerTypeImage/index.js +1 -1
- package/src/components/atoms/EditField/EditField.stories.js +13 -0
- package/src/components/atoms/EditField/index.js +15 -0
- package/src/components/atoms/EditField/styles.js +35 -0
- package/src/components/atoms/GeneralButton/GeneralButton.stories.js +3 -0
- package/src/components/atoms/GeneralButton/index.js +7 -1
- package/src/components/atoms/GeneralButton/styles.js +56 -9
- package/src/components/atoms/GeneralInput/index.js +62 -9
- package/src/components/atoms/GeneralInput/styles.js +3 -1
- package/src/components/atoms/GeneralTextBox/index.js +7 -6
- package/src/components/atoms/GeneralTextBox/styles.js +1 -1
- package/src/components/atoms/GenericModal/GenericModal.stories.js +140 -0
- package/src/components/atoms/GenericModal/index.js +12 -0
- package/src/components/atoms/GenericModal/styles.js +126 -0
- package/src/components/atoms/GradientPanel/GradientPanel.stories.js +110 -3
- package/src/components/atoms/GradientPanel/index.js +4 -2
- package/src/components/atoms/GradientPanel/styles.js +111 -8
- package/src/components/atoms/Graphic/Graphic.stories.js +21 -0
- package/src/components/atoms/Graphic/index.js +18 -0
- package/src/components/atoms/Graphic/styles.js +4 -0
- package/src/components/atoms/Input/index.js +14 -0
- package/src/components/atoms/Input/style.js +27 -0
- package/src/components/atoms/LabelToInput/index.js +27 -0
- package/src/components/atoms/LabelToInput/style.js +30 -0
- package/src/components/atoms/LoadImageMenu/LoadImageMenu.stories.js +17 -0
- package/src/components/atoms/LoadImageMenu/index.js +58 -0
- package/src/components/atoms/LoadImageMenu/styles.js +72 -0
- package/src/components/atoms/LogoImage/LogoImage.stories.js +10 -0
- package/src/components/atoms/LogoImage/index.js +10 -0
- package/src/components/atoms/LogoImage/styles.js +12 -0
- package/src/components/atoms/MenuNotification/MenuNotification.stories.js +17 -0
- package/src/components/atoms/MenuNotification/index.js +30 -0
- package/src/components/atoms/MenuNotification/styles.js +50 -0
- package/src/components/atoms/MenuProfile/MenuProfile.stories.js +13 -0
- package/src/components/atoms/MenuProfile/index.js +31 -0
- package/src/components/atoms/MenuProfile/styles.js +57 -0
- package/src/components/atoms/Notification/Notification.stories.js +16 -0
- package/src/components/atoms/Notification/index.js +20 -0
- package/src/components/atoms/Notification/styles.js +42 -0
- package/src/components/atoms/Percent/Percent.stories.js +38 -0
- package/src/components/atoms/Percent/index.js +15 -0
- package/src/components/atoms/Percent/styles.js +79 -0
- package/src/components/atoms/PriorityFlag/index.js +1 -1
- package/src/components/atoms/ProductImage/styles.js +1 -1
- package/src/components/atoms/ProgressBar/index.js +2 -2
- package/src/components/atoms/ProgressBar/styles.js +53 -3
- package/src/components/atoms/ScreenHeader/ScreenHeader.stories.js +9 -0
- package/src/components/atoms/ScreenHeader/index.js +4 -1
- package/src/components/atoms/ScreenHeader/styles.js +17 -6
- package/src/components/atoms/Select/index.js +33 -0
- package/src/components/atoms/Select/style.js +77 -0
- package/src/components/atoms/StatusTag/styles.js +9 -1
- package/src/components/atoms/ValidationPanel/index.js +3 -3
- package/src/components/molecules/AddProvidersAndProducts/AddProvidersAndProducts.stories.js +16 -0
- package/src/components/molecules/AddProvidersAndProducts/index.js +19 -0
- package/src/components/molecules/AddProvidersAndProducts/styles.js +23 -0
- package/src/components/molecules/AssignedWork/AssignedWork.stories.js +41 -0
- package/src/components/molecules/AssignedWork/index.js +40 -0
- package/src/components/molecules/AssignedWork/styles.js +111 -0
- package/src/components/molecules/AvatarAndValidation/index.js +24 -6
- package/src/components/molecules/AvatarAndValidation/styles.js +1 -1
- package/src/components/molecules/EditionActiveImage/index.js +5 -2
- package/src/components/molecules/FeaturesBar/index.js +21 -8
- package/src/components/molecules/FeaturesBar/styles.js +9 -2
- package/src/components/molecules/GalleryElement/index.js +59 -37
- package/src/components/molecules/GalleryElement/styles.js +38 -11
- package/src/components/molecules/GalleryHeader/GalleryHeader.stories.js +10 -0
- package/src/components/molecules/GalleryHeader/index.js +19 -0
- package/src/components/molecules/GalleryHeader/styles.js +45 -0
- package/src/components/molecules/ImageSelector/index.js +14 -11
- package/src/components/molecules/ParentComponent/ParentComponent.stories.js +18 -0
- package/src/components/molecules/ParentComponent/index.js +66 -0
- package/src/components/molecules/ParentComponent/styles.js +7 -0
- package/src/components/molecules/PayMethod/PayMethod.stories.js +12 -0
- package/src/components/molecules/PayMethod/index.js +46 -0
- package/src/components/molecules/PayMethod/styles.js +31 -0
- package/src/components/molecules/PlanSelection/PlanSelection.stories.js +1 -3
- package/src/components/molecules/PlanSelection/index.js +1 -1
- package/src/components/molecules/PlanSelection/styles.js +2 -2
- package/src/components/molecules/ProductNameHeader/index.js +1 -2
- package/src/components/molecules/ProductNotification/ProductNotification.stories.js +13 -0
- package/src/components/molecules/ProductNotification/index.js +53 -0
- package/src/components/molecules/ProductNotification/styles.js +37 -0
- package/src/components/molecules/ProfileHeader/ProfileHeader.stories.js +16 -0
- package/src/components/molecules/ProfileHeader/index.js +54 -0
- package/src/components/molecules/ProfileHeader/styles.js +30 -0
- package/src/components/molecules/RetailerSelector/RetailerSelector.stories.js +35 -0
- package/src/components/molecules/RetailerSelector/index.js +63 -0
- package/src/components/molecules/RetailerSelector/styles.js +18 -0
- package/src/components/molecules/SidebarNotification/SidebarNotification.stories.js +101 -0
- package/src/components/molecules/SidebarNotification/index.js +95 -0
- package/src/components/molecules/SidebarNotification/styles.js +63 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +55 -19
- package/src/components/molecules/StatusAsignationInfo/styles.js +10 -0
- package/src/components/molecules/TableHeader/index.js +5 -2
- package/src/components/molecules/TabsMenu/index.js +6 -2
- package/src/components/molecules/TagAndInput/index.js +35 -2
- package/src/components/molecules/TagAndInput/styles.js +1 -1
- package/src/components/organisms/FullProductNameHeader/index.js +28 -7
- package/src/components/organisms/FullTabsMenu/index.js +13 -2
- package/src/components/organisms/FullTabsMenu/styles.js +1 -1
- package/src/components/organisms/Fullplan/FullPlan.stories.js +7 -9
- package/src/components/organisms/Fullplan/index.js +1 -1
- package/src/components/organisms/Fullplan/styles.js +2 -2
- package/src/components/organisms/ImageDataTable/index.js +77 -11
- package/src/components/organisms/ImageDataTable/styles.js +8 -0
- package/src/components/organisms/ImagePreviewer/index.js +5 -10
- package/src/components/organisms/InputGroup/index.js +56 -11
- package/src/components/organisms/InputGroup/styles.js +3 -0
- package/src/components/organisms/ProductImageModal/ProductImageModal.stories.js +77 -74
- package/src/components/organisms/ProductImageModal/index.js +29 -12
- package/src/components/organisms/ProductImageModal/styles.js +4 -0
- package/src/components/pages/CustomerLogin/CustomerLogin.stories.js +76 -0
- package/src/components/pages/CustomerLogin/index.js +22 -0
- package/src/components/pages/CustomerLogin/styles.js +12 -0
- package/src/components/pages/CustomerPayMethod/CustomerPayMethod.stories.js +56 -0
- package/src/components/pages/CustomerPayMethod/index.js +23 -0
- package/src/components/pages/CustomerPayMethod/styles.js +21 -0
- package/src/components/pages/CustomerType/CustomerType.stories.js +8 -8
- package/src/components/pages/CustomerType/styles.js +1 -1
- package/src/components/pages/OnboardPlan/OnboardPlan.stories.js +36 -21
- package/src/components/pages/OnboardPlan/index.js +8 -9
- package/src/components/pages/OnboardPlan/styles.js +16 -10
- package/src/components/pages/RetailerPlan/RetailerPlan.stories.js +49 -0
- package/src/components/pages/RetailerPlan/index.js +24 -0
- package/src/components/pages/RetailerPlan/styles.js +27 -0
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +104 -317
- package/src/components/pages/RetailerProductEdition/index.js +809 -34
- package/src/components/pages/RetailerProductEdition/styles.js +54 -5
- package/src/global-files/data.js +152 -0
- package/src/global-files/global-styles.css +10 -0
- package/src/global-files/variables.js +1 -0
- package/src/index.js +2 -1
- package/src/components/molecules/TextAndGradient/TextAndGradient.stories.js +0 -23
- package/src/components/molecules/TextAndGradient/index.js +0 -23
- package/src/components/molecules/TextAndGradient/styles.js +0 -37
|
@@ -5,81 +5,856 @@ import { ImageDataTable } from "../../organisms/ImageDataTable";
|
|
|
5
5
|
import { FullProductNameHeader } from "../../organisms/FullProductNameHeader";
|
|
6
6
|
import { FullTabsMenu } from "../../organisms/FullTabsMenu";
|
|
7
7
|
import { InputGroup } from "../../organisms/InputGroup";
|
|
8
|
-
import { useEffect, useState } from "react";
|
|
8
|
+
import { useEffect, useReducer, useState, useCallback } from "react";
|
|
9
9
|
import { GalleryElement } from "../../molecules/GalleryElement";
|
|
10
|
+
import { getRetailerServices, getPercentage } from "../../../global-files/data";
|
|
11
|
+
import { GalleryHeader } from "../../molecules/GalleryHeader";
|
|
12
|
+
import { ProductImageModal } from "../../organisms/ProductImageModal";
|
|
13
|
+
import { useDropzone } from "react-dropzone";
|
|
10
14
|
import axios from "axios";
|
|
15
|
+
import { v4 as uuidv4 } from "uuid";
|
|
16
|
+
import AWS from "aws-sdk";
|
|
17
|
+
import attributesSent from "../../../assets/images/modalsSVGs/attributesSent.svg";
|
|
18
|
+
import descriptionSent from "../../../assets/images/modalsSVGs/descriptionSent.svg";
|
|
19
|
+
import imagesSent from "../../../assets/images/modalsSVGs/uploadingImages.svg";
|
|
20
|
+
import { TagAndInput } from "../../molecules/TagAndInput/index";
|
|
21
|
+
import { Button } from "../../atoms/GeneralButton";
|
|
22
|
+
import { Commentary } from "../../atoms/Commentary";
|
|
11
23
|
|
|
12
|
-
|
|
24
|
+
const reducerImages = (state, action) => {
|
|
25
|
+
let { values, attrForImgs } = state;
|
|
26
|
+
switch (action.action) {
|
|
27
|
+
case "init":
|
|
28
|
+
return action.init;
|
|
29
|
+
case "addImg":
|
|
30
|
+
values = [...values, action.img];
|
|
31
|
+
return { ...state, values };
|
|
32
|
+
case "changeImageInfo":
|
|
33
|
+
values[action.index][action.attribute] = action.value;
|
|
34
|
+
return { ...state, values };
|
|
35
|
+
case "changeAttrValue":
|
|
36
|
+
attrForImgs[action.retailer][action.index].value = action.value;
|
|
37
|
+
return { ...state, attrForImgs, values };
|
|
38
|
+
default:
|
|
39
|
+
return state;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const S3_BUCKET = process.env.REACT_APP_IMAGES_BUCKET;
|
|
44
|
+
const REGION = "us-east-1";
|
|
45
|
+
|
|
46
|
+
AWS.config.update({
|
|
47
|
+
accessKeyId: process.env.REACT_APP_KEY_UPLOAD_TO_S3,
|
|
48
|
+
secretAccessKey: process.env.REACT_APP_ACCESS_KEY_UPLOAD_TO_S3,
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const myBucket = new AWS.S3({
|
|
52
|
+
params: { Bucket: S3_BUCKET },
|
|
53
|
+
region: REGION,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const RetailerProductEdition = ({
|
|
57
|
+
productData,
|
|
58
|
+
tabsSections,
|
|
59
|
+
articleId,
|
|
60
|
+
productSelected = {},
|
|
61
|
+
user = {},
|
|
62
|
+
}) => {
|
|
13
63
|
const [activeTab, setActiveTab] = useState("Descripción");
|
|
14
|
-
const [activeImage, setActiveImage] = useState(
|
|
15
|
-
productData?.services?.Imágenes[0]
|
|
16
|
-
);
|
|
64
|
+
const [activeImage, setActiveImage] = useState();
|
|
17
65
|
const [imageLayout, setImageLayout] = useState(true);
|
|
18
66
|
const [headerTop, setHeaderTop] = useState(0);
|
|
67
|
+
const [descriptions, setDescriptions] = useState([]);
|
|
68
|
+
const [datasheets, setDatasheets] = useState([]);
|
|
69
|
+
const [images, setImages] = useReducer(reducerImages, {});
|
|
70
|
+
const [showModal, setShowModal] = useState(false);
|
|
71
|
+
const [retailerSelected, setRetailerSelected] = useState(54); // revisar después como trabajar esto de mejor forma
|
|
72
|
+
const { getRootProps, getInputProps } = useDropzone({
|
|
73
|
+
accept: "image/*",
|
|
74
|
+
noKeyboard: true,
|
|
75
|
+
multiple: true,
|
|
76
|
+
noClick: true,
|
|
77
|
+
onDrop: (acceptedFiles) => {
|
|
78
|
+
const newImages = [];
|
|
79
|
+
acceptedFiles.map((file) => {
|
|
80
|
+
const reader = new FileReader();
|
|
81
|
+
reader.fileName = file.name;
|
|
82
|
+
reader.onload = async function (e) {
|
|
83
|
+
const ext = e.srcElement.fileName.split(".");
|
|
84
|
+
const img = new Image();
|
|
85
|
+
img.src = e.target.result;
|
|
86
|
+
const width = img.width;
|
|
87
|
+
const height = img.height;
|
|
88
|
+
const newImg = {
|
|
89
|
+
action: "addImg",
|
|
90
|
+
img: {
|
|
91
|
+
src: e.target.result,
|
|
92
|
+
name: e.target.fileName,
|
|
93
|
+
ext: ext[ext.length - 1],
|
|
94
|
+
width: width,
|
|
95
|
+
height: width,
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
setImages(newImg);
|
|
99
|
+
};
|
|
100
|
+
reader.onerror = function (error) {
|
|
101
|
+
console.log("dropzoneError: ", error);
|
|
102
|
+
};
|
|
103
|
+
reader.readAsDataURL(file);
|
|
104
|
+
return file;
|
|
105
|
+
});
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
const [updatedDatasheets, setUpdatedDatasheets] = useState([]);
|
|
109
|
+
const [updatedDescriptions, setUpdatedDescriptions] = useState([]);
|
|
110
|
+
const [imagesUploaded, setImagesUploaded] = useState(false);
|
|
111
|
+
const [dataImages, setDataImages] = useState();
|
|
112
|
+
const [percentages, setPercentages] = useState(
|
|
113
|
+
new Array(productSelected.retailers.length).fill({ percentage: 0 })
|
|
114
|
+
);
|
|
115
|
+
const [activePercentage, setActivePercentage] = useState(0);
|
|
116
|
+
const [activeRetailer, setActiveRetailer] = useState({});
|
|
117
|
+
const [services, setServices] = useState([]);
|
|
118
|
+
const [servicesData, setServicesData] = useState([]);
|
|
119
|
+
const [message, setMessage] = useState("");
|
|
120
|
+
const [product, setProduct] = useState({});
|
|
121
|
+
const [icon, setIcon] = useState(null);
|
|
122
|
+
const [version, setVersion] = useState(productSelected?.version);
|
|
123
|
+
const [comments, setComments] = useState({});
|
|
124
|
+
const [requiredNull, setRequiredNull] = useState(0);
|
|
19
125
|
|
|
20
|
-
const
|
|
21
|
-
const
|
|
22
|
-
|
|
126
|
+
const loadData = async () => {
|
|
127
|
+
const services = await getRetailerServices(
|
|
128
|
+
productSelected.article.id_article,
|
|
129
|
+
parseInt(productSelected.article.id_category),
|
|
130
|
+
productSelected.version
|
|
23
131
|
);
|
|
132
|
+
console.log(services, "parsedResponse");
|
|
133
|
+
//Converts the data inside the datasheets object to array
|
|
134
|
+
setServices(services);
|
|
135
|
+
setActiveRetailer(productSelected?.retailers[0]);
|
|
136
|
+
setImages({
|
|
137
|
+
action: "init",
|
|
138
|
+
init: services[2],
|
|
139
|
+
});
|
|
140
|
+
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
141
|
+
setProduct(productSelected);
|
|
142
|
+
};
|
|
24
143
|
|
|
25
|
-
|
|
144
|
+
const getServices = async (tab) => {
|
|
145
|
+
let serviceActive = "";
|
|
146
|
+
switch (tab) {
|
|
147
|
+
case "Ficha técnica":
|
|
148
|
+
serviceActive = "datasheet";
|
|
149
|
+
break;
|
|
150
|
+
case "Imágenes":
|
|
151
|
+
serviceActive = "images";
|
|
152
|
+
break;
|
|
153
|
+
default:
|
|
154
|
+
serviceActive = "description";
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
const selected = productSelected;
|
|
158
|
+
const servicesResponse = await axios.get(
|
|
159
|
+
`${process.env.REACT_APP_SERVICES_ENDPOINT}?articleId=${selected.article.id_article}&orderId=${selected.article.id_order}&end=true`
|
|
160
|
+
);
|
|
161
|
+
const parsedResponse = JSON.parse(servicesResponse.data.body).data;
|
|
162
|
+
|
|
163
|
+
setServicesData(parsedResponse);
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
const translateConcept = (concept) => {
|
|
167
|
+
let translation = "";
|
|
168
|
+
if (concept === "datasheet") {
|
|
169
|
+
translation = "Ficha ténica";
|
|
170
|
+
} else if (concept === "description") {
|
|
171
|
+
translation = "Descripción";
|
|
172
|
+
} else if (concept === "images") {
|
|
173
|
+
translation = "Imágenes";
|
|
174
|
+
}
|
|
175
|
+
return translation;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const getComments = async (tab) => {
|
|
179
|
+
const commentsResponse = await Promise.all([
|
|
180
|
+
axios.get(
|
|
181
|
+
`${process.env.REACT_APP_COMMENTS_ENDPOINT}?articleId=${productSelected?.article?.id_article}&concept=description&orderIdColab=${productSelected?.orderId}&version=${version}`
|
|
182
|
+
),
|
|
183
|
+
axios.get(
|
|
184
|
+
`${process.env.REACT_APP_COMMENTS_ENDPOINT}?articleId=${productSelected?.article?.id_article}&concept=datasheet&orderIdColab=${productSelected?.orderId}&version=${version}`
|
|
185
|
+
),
|
|
186
|
+
axios.get(
|
|
187
|
+
`${process.env.REACT_APP_COMMENTS_ENDPOINT}?articleId=${productSelected?.article?.id_article}&concept=images&orderIdColab=${productSelected?.orderId}&version=${version}`
|
|
188
|
+
),
|
|
189
|
+
]);
|
|
190
|
+
|
|
191
|
+
let comments = {};
|
|
192
|
+
commentsResponse.map(
|
|
193
|
+
(comment) =>
|
|
194
|
+
JSON.parse(comment.data.body).data[0] &&
|
|
195
|
+
(comments[
|
|
196
|
+
translateConcept(JSON.parse(comment.data.body).data[0]?.concept)
|
|
197
|
+
] = JSON.parse(comment.data.body).data[0])
|
|
198
|
+
);
|
|
199
|
+
setComments(comments);
|
|
200
|
+
//const comment = JSON.parse(commentsResponse.data.body).data;
|
|
201
|
+
//setComment(comment[0]);
|
|
26
202
|
};
|
|
27
203
|
|
|
28
204
|
useEffect(() => {
|
|
29
|
-
|
|
205
|
+
loadData();
|
|
206
|
+
getPercentage({ data: [productSelected] }).then((res) =>
|
|
207
|
+
setPercentages(res)
|
|
208
|
+
);
|
|
209
|
+
getServices();
|
|
210
|
+
getComments();
|
|
30
211
|
}, []);
|
|
31
212
|
|
|
213
|
+
useEffect(() => {
|
|
214
|
+
productSelected.retailers.forEach((retailer) => {
|
|
215
|
+
retailer["percentage"] = percentages.filter(
|
|
216
|
+
(percent) => retailer.id === percent.id_retailer
|
|
217
|
+
)[0]?.percentage;
|
|
218
|
+
});
|
|
219
|
+
setActivePercentage(productSelected?.retailers[0]?.percentage);
|
|
220
|
+
}, [percentages]);
|
|
221
|
+
|
|
222
|
+
useEffect(() => {
|
|
223
|
+
if (services.length > 0) {
|
|
224
|
+
services[0][activeRetailer?.id].data = Object.values(
|
|
225
|
+
services[0][activeRetailer?.id].data
|
|
226
|
+
);
|
|
227
|
+
setActivePercentage(Math.round(activeRetailer.percentage, 0));
|
|
228
|
+
setDatasheets([services[0][activeRetailer.id], services[0].inputs]);
|
|
229
|
+
setDescriptions(
|
|
230
|
+
services[1].filter((service) => service.id === activeRetailer.id)
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
}, [activeRetailer]);
|
|
234
|
+
|
|
235
|
+
const thumbs = () => {
|
|
236
|
+
const imageInputs = images.inputs.map((e) => ({
|
|
237
|
+
value: e.id,
|
|
238
|
+
name: e.name,
|
|
239
|
+
}));
|
|
240
|
+
const imageType = images.imageType.map((e) => ({
|
|
241
|
+
value: e.id,
|
|
242
|
+
name: e.name,
|
|
243
|
+
}));
|
|
244
|
+
const imagePackagingType = images.imagePackagingType.map((e) => ({
|
|
245
|
+
value: e.id,
|
|
246
|
+
name: e.name,
|
|
247
|
+
}));
|
|
248
|
+
return images?.values?.map((image, index) => (
|
|
249
|
+
<GalleryElement
|
|
250
|
+
key={index}
|
|
251
|
+
image={image}
|
|
252
|
+
gridLayout={imageLayout}
|
|
253
|
+
id={"gallery-element-" + index}
|
|
254
|
+
index={index}
|
|
255
|
+
imageType={imageType}
|
|
256
|
+
imagePackagingType={imagePackagingType}
|
|
257
|
+
imageInputs={imageInputs}
|
|
258
|
+
changeImage={setImages}
|
|
259
|
+
/>
|
|
260
|
+
));
|
|
261
|
+
};
|
|
262
|
+
|
|
263
|
+
const saveDescriptions = async () => {
|
|
264
|
+
const dataObject = {
|
|
265
|
+
articleId: productSelected?.article?.id_article,
|
|
266
|
+
articleData: updatedDescriptions,
|
|
267
|
+
};
|
|
268
|
+
try {
|
|
269
|
+
await axios.put(
|
|
270
|
+
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
|
|
271
|
+
dataObject,
|
|
272
|
+
{
|
|
273
|
+
headers: {
|
|
274
|
+
Authorization:
|
|
275
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
276
|
+
},
|
|
277
|
+
}
|
|
278
|
+
);
|
|
279
|
+
} catch (error) {
|
|
280
|
+
console.log(error);
|
|
281
|
+
}
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
const saveDatasheets = async () => {
|
|
285
|
+
const dataObject = {
|
|
286
|
+
articleId: productSelected?.article?.id_article,
|
|
287
|
+
articleData: updatedDatasheets,
|
|
288
|
+
};
|
|
289
|
+
try {
|
|
290
|
+
await axios.put(
|
|
291
|
+
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?datasheet=true&version=${version}`,
|
|
292
|
+
dataObject,
|
|
293
|
+
{
|
|
294
|
+
headers: {
|
|
295
|
+
Authorization:
|
|
296
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
297
|
+
},
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
console.log("saved");
|
|
301
|
+
} catch (error) {
|
|
302
|
+
console.log(error);
|
|
303
|
+
}
|
|
304
|
+
};
|
|
305
|
+
|
|
306
|
+
const updateImages = useCallback(async () => {
|
|
307
|
+
const imagesList = images?.values?.slice();
|
|
308
|
+
const imagesListTemp = imagesList.reduce((acc, image) => {
|
|
309
|
+
acc[image.image_id] = ++acc[image.image_id] || 0;
|
|
310
|
+
return acc;
|
|
311
|
+
}, {});
|
|
312
|
+
|
|
313
|
+
const duplicated = imagesList.filter((image) => {
|
|
314
|
+
return imagesListTemp[image.image_id];
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
const attrForImgs = Object.values(images?.attrForImgs);
|
|
318
|
+
attrForImgs.pop();
|
|
319
|
+
const data = {
|
|
320
|
+
articleId,
|
|
321
|
+
attrReqImgs: attrForImgs.map((e) => ({
|
|
322
|
+
attrId: e[0].id,
|
|
323
|
+
value: e[0].value,
|
|
324
|
+
})),
|
|
325
|
+
articleData: imagesList.filter((e) => !e.id),
|
|
326
|
+
updateImages: imagesList.filter((e) => e.id),
|
|
327
|
+
};
|
|
328
|
+
let valid =
|
|
329
|
+
data.articleData.length === 0
|
|
330
|
+
? true
|
|
331
|
+
: data.articleData.every((e, i) => {
|
|
332
|
+
if (e.image_id && e.packing_type && e.image_type) {
|
|
333
|
+
return true;
|
|
334
|
+
}
|
|
335
|
+
return false;
|
|
336
|
+
});
|
|
337
|
+
if (valid && data.updateImages.length > 0 && duplicated.length === 0) {
|
|
338
|
+
valid = data.updateImages.every((e, i) => {
|
|
339
|
+
if (e.image_id && e.packing_type && e.image_type) {
|
|
340
|
+
return true;
|
|
341
|
+
}
|
|
342
|
+
return false;
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
if (valid && duplicated.length === 0) {
|
|
346
|
+
try {
|
|
347
|
+
data.articleData.forEach((e) => {
|
|
348
|
+
e.uuid = uuidv4();
|
|
349
|
+
});
|
|
350
|
+
setDataImages(data);
|
|
351
|
+
if (data.articleData.length > 0) {
|
|
352
|
+
setImagesUploaded(false);
|
|
353
|
+
const promiseArray = [];
|
|
354
|
+
data.articleData.forEach((e) => {
|
|
355
|
+
const file = Buffer.from(
|
|
356
|
+
e.src.replace(/^data:image\/\w+;base64,/, ""),
|
|
357
|
+
"base64"
|
|
358
|
+
);
|
|
359
|
+
const params = {
|
|
360
|
+
ACL: "public-read",
|
|
361
|
+
Body: file,
|
|
362
|
+
Bucket: S3_BUCKET,
|
|
363
|
+
Key: `id-${data.articleId}/${version}/${e.image_id}-${e.uuid}.${e.ext}`,
|
|
364
|
+
};
|
|
365
|
+
promiseArray.push(myBucket.putObject(params).promise());
|
|
366
|
+
});
|
|
367
|
+
await Promise.all(promiseArray);
|
|
368
|
+
setImagesUploaded(true);
|
|
369
|
+
} else {
|
|
370
|
+
setImagesUploaded(true);
|
|
371
|
+
}
|
|
372
|
+
} catch (err) {
|
|
373
|
+
console.log(err);
|
|
374
|
+
// setMainLoading(false);
|
|
375
|
+
}
|
|
376
|
+
} else {
|
|
377
|
+
// setMainLoading(false);
|
|
378
|
+
console.log(
|
|
379
|
+
"Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.",
|
|
380
|
+
"Recuerda hay campos obligatorios y no podras avanzar si no estan completos."
|
|
381
|
+
);
|
|
382
|
+
// setAlertList((prev) => [
|
|
383
|
+
// ...prev,
|
|
384
|
+
// {
|
|
385
|
+
// titleMsg: "Completa los campos que solicita cada una de la imágenes",
|
|
386
|
+
// alertMsg:
|
|
387
|
+
// "Recuerda hay campos obligatorios y no podras avanzar si no estan completos.",
|
|
388
|
+
// },
|
|
389
|
+
// ]);
|
|
390
|
+
}
|
|
391
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
392
|
+
}, [images, imagesUploaded]);
|
|
393
|
+
|
|
394
|
+
useEffect(async () => {
|
|
395
|
+
if (imagesUploaded) {
|
|
396
|
+
dataImages.articleData = dataImages.articleData.map((e) => {
|
|
397
|
+
delete e.src;
|
|
398
|
+
e.imageID = e.image_id;
|
|
399
|
+
e.packingType = e.packing_type;
|
|
400
|
+
e.imageType = e.image_type;
|
|
401
|
+
return e;
|
|
402
|
+
});
|
|
403
|
+
try {
|
|
404
|
+
await axios.put(
|
|
405
|
+
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
406
|
+
dataImages,
|
|
407
|
+
{
|
|
408
|
+
headers: {
|
|
409
|
+
Authorization:
|
|
410
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
411
|
+
},
|
|
412
|
+
}
|
|
413
|
+
);
|
|
414
|
+
console.log("imágenes guardadas con éxito");
|
|
415
|
+
} catch (error) {
|
|
416
|
+
console.log(error);
|
|
417
|
+
}
|
|
418
|
+
}
|
|
419
|
+
}, [dataImages, imagesUploaded]);
|
|
420
|
+
|
|
421
|
+
const approveRejectButtons = (action) => {
|
|
422
|
+
let concept = "";
|
|
423
|
+
switch (activeTab) {
|
|
424
|
+
case "Descripción":
|
|
425
|
+
concept = "description";
|
|
426
|
+
break;
|
|
427
|
+
case "Ficha técnica":
|
|
428
|
+
concept = "datasheet";
|
|
429
|
+
break;
|
|
430
|
+
case "Imágenes":
|
|
431
|
+
concept = "images";
|
|
432
|
+
break;
|
|
433
|
+
default:
|
|
434
|
+
break;
|
|
435
|
+
}
|
|
436
|
+
concept = action ? action : concept;
|
|
437
|
+
return (
|
|
438
|
+
(productSelected[`${concept}_status`] === "QF" &&
|
|
439
|
+
(user.id_role === 1 || user.id_role === 4 || user.id_role === 5)) ||
|
|
440
|
+
(productSelected[`${concept}_status`] === "AF" &&
|
|
441
|
+
(user.id_role === 1 || user.id_role === 6)) ||
|
|
442
|
+
(productSelected[`${concept}_status`] === "RP" &&
|
|
443
|
+
(user.id_role === 1 || user.id_role === 6))
|
|
444
|
+
);
|
|
445
|
+
};
|
|
446
|
+
|
|
447
|
+
const getSectionIcon = () => {
|
|
448
|
+
switch (activeTab) {
|
|
449
|
+
case "Ficha técnica":
|
|
450
|
+
setIcon(attributesSent);
|
|
451
|
+
break;
|
|
452
|
+
case "Descripción":
|
|
453
|
+
setIcon(descriptionSent);
|
|
454
|
+
break;
|
|
455
|
+
case "Imágenes0,,":
|
|
456
|
+
setIcon(imagesSent);
|
|
457
|
+
break;
|
|
458
|
+
default:
|
|
459
|
+
break;
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
const updateCompaniesList = (status, result, retailerId, concept) => {
|
|
464
|
+
let serv = servicesData.slice();
|
|
465
|
+
let item = serv.find(
|
|
466
|
+
(item) => item.id_retailer === retailerId && item.service === concept
|
|
467
|
+
);
|
|
468
|
+
let index = serv.indexOf(item);
|
|
469
|
+
if (
|
|
470
|
+
status === "IN_PROGRESS" ||
|
|
471
|
+
status === "QF" ||
|
|
472
|
+
status === "RF" ||
|
|
473
|
+
status === "RA"
|
|
474
|
+
) {
|
|
475
|
+
if (result === "A") {
|
|
476
|
+
if (activeTab === "Imágenes") {
|
|
477
|
+
serv.map((item) => {
|
|
478
|
+
item.status = "AF";
|
|
479
|
+
});
|
|
480
|
+
} else {
|
|
481
|
+
serv[index].status = "AF";
|
|
482
|
+
}
|
|
483
|
+
} else if (result === "R") {
|
|
484
|
+
if (activeTab === "Imágenes") {
|
|
485
|
+
serv.map((item) => {
|
|
486
|
+
item.status = "RF";
|
|
487
|
+
});
|
|
488
|
+
} else {
|
|
489
|
+
serv[index].status = "RF";
|
|
490
|
+
}
|
|
491
|
+
} else {
|
|
492
|
+
if (status === "IN_PROGRESS" || status === "ASSIGNED") {
|
|
493
|
+
serv.map((item) => {
|
|
494
|
+
item.status = "QF";
|
|
495
|
+
});
|
|
496
|
+
} else {
|
|
497
|
+
serv.map((item) => {
|
|
498
|
+
if (item.status === "RF" || item.status === "RA") {
|
|
499
|
+
item.status = "QF";
|
|
500
|
+
}
|
|
501
|
+
return item;
|
|
502
|
+
});
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
} else if (status === "AF" || status === "RP") {
|
|
506
|
+
if (result === "A") {
|
|
507
|
+
if (activeTab === "Imágenes") {
|
|
508
|
+
serv.map((item) => {
|
|
509
|
+
item.status = "AA";
|
|
510
|
+
});
|
|
511
|
+
} else {
|
|
512
|
+
serv[index].status = "AA";
|
|
513
|
+
}
|
|
514
|
+
} else {
|
|
515
|
+
if (activeTab === "Imágenes") {
|
|
516
|
+
serv.map((item) => {
|
|
517
|
+
item.status = "RA";
|
|
518
|
+
});
|
|
519
|
+
} else {
|
|
520
|
+
serv[index].status = "RA";
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
}
|
|
524
|
+
//console.log(serv, "serv");
|
|
525
|
+
setServicesData(serv);
|
|
526
|
+
};
|
|
527
|
+
|
|
528
|
+
const sendToFacilitator = async (result) => {
|
|
529
|
+
console.log("exce");
|
|
530
|
+
let concept = "";
|
|
531
|
+
switch (activeTab) {
|
|
532
|
+
case "Descripción":
|
|
533
|
+
concept = "description";
|
|
534
|
+
break;
|
|
535
|
+
case "Ficha técnica":
|
|
536
|
+
concept = "datasheet";
|
|
537
|
+
break;
|
|
538
|
+
case "Imágenes":
|
|
539
|
+
concept = "images";
|
|
540
|
+
break;
|
|
541
|
+
default:
|
|
542
|
+
break;
|
|
543
|
+
}
|
|
544
|
+
let evalStatus = "";
|
|
545
|
+
let productTemp = { ...productSelected };
|
|
546
|
+
evalStatus = productSelected[`${concept}_status`];
|
|
547
|
+
const specialistDone =
|
|
548
|
+
evalStatus === "RF" ||
|
|
549
|
+
evalStatus === "RA" ||
|
|
550
|
+
evalStatus === "IN_PROGRESS";
|
|
551
|
+
|
|
552
|
+
if (specialistDone) {
|
|
553
|
+
setMessage(`${activeTab} enviada a facilitador`);
|
|
554
|
+
getSectionIcon();
|
|
555
|
+
productTemp[`${concept}_status`] = "QF";
|
|
556
|
+
} else if (evalStatus === "QF") {
|
|
557
|
+
setMessage("Evaluación enviada");
|
|
558
|
+
getSectionIcon();
|
|
559
|
+
productTemp[`${concept}_status`] = "AF";
|
|
560
|
+
} else if (evalStatus === "AF") {
|
|
561
|
+
setMessage("Evaluación enviada");
|
|
562
|
+
getSectionIcon();
|
|
563
|
+
productTemp[`${concept}_status`] = "AA";
|
|
564
|
+
} else if (evalStatus === "RP") {
|
|
565
|
+
setMessage("Evaluación enviada");
|
|
566
|
+
getSectionIcon();
|
|
567
|
+
productTemp[`${concept}_status`] = "AA";
|
|
568
|
+
}
|
|
569
|
+
let data = {};
|
|
570
|
+
if (result) {
|
|
571
|
+
updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
|
|
572
|
+
data = {
|
|
573
|
+
articleId: productSelected.article.id_article,
|
|
574
|
+
orderId: productSelected.orderId,
|
|
575
|
+
concept: concept,
|
|
576
|
+
result: result,
|
|
577
|
+
evalStatus: evalStatus,
|
|
578
|
+
retailerId: activeRetailer.id,
|
|
579
|
+
};
|
|
580
|
+
await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
581
|
+
headers: {
|
|
582
|
+
Authorization:
|
|
583
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
584
|
+
},
|
|
585
|
+
});
|
|
586
|
+
} else {
|
|
587
|
+
if (specialistDone) {
|
|
588
|
+
updateCompaniesList(evalStatus, result, activeRetailer.id);
|
|
589
|
+
}
|
|
590
|
+
data = {
|
|
591
|
+
articleId: productSelected.article.id_article,
|
|
592
|
+
orderId: productSelected.orderId,
|
|
593
|
+
concept: concept,
|
|
594
|
+
evalStatus: evalStatus,
|
|
595
|
+
retailerId: activeRetailer.id,
|
|
596
|
+
};
|
|
597
|
+
|
|
598
|
+
switch (user.id_role) {
|
|
599
|
+
case 7:
|
|
600
|
+
case 8:
|
|
601
|
+
data.especialist = true;
|
|
602
|
+
break;
|
|
603
|
+
case 4:
|
|
604
|
+
case 5:
|
|
605
|
+
data.facilitator = true;
|
|
606
|
+
break;
|
|
607
|
+
default:
|
|
608
|
+
break;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
612
|
+
headers: {
|
|
613
|
+
Authorization:
|
|
614
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJmNTkyN2Y4ZS1jYmY3LTQ5MjItOWUwOS1lNjllYzBiMjczMWEiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImY1OTI3ZjhlLWNiZjctNDkyMi05ZTA5LWU2OWVjMGIyNzMxYSIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxYTk4MzZlNS1kMDYyLTQ4ZjQtYjY4Yi04NDZhZWEwMDFlMDIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY0NjM1MzAyMywibmFtZSI6IklzbWFlbCBMb3BleiIsInBob25lX251bWJlciI6Iis1MjMxMTEzNjYzMzYiLCJleHAiOjE2NDYzNTY2MjMsImlhdCI6MTY0NjM1MzAyMywiZW1haWwiOiJpbG9wZXpAY29udGVudG9oLmNvbSJ9.LX6wMUK1eiE49heX3nVIMR4oRrWEaI-xyUErYx9_AWlxLn5jksbmmZmXujeaailxxcvaVQDYIbKSyrahwmqUohaDChM3TgDHCHTvAeiDGoVAFIjKyzk_wzttgVrKu5P_45bNrds7PVmLC981W8aVdQO32JklWhCpO_jEbtIgGeklQ6PF9yOd5TEWtq4kJTuYrbZpl21qnZ_wopbLSOz4Ty_OoIbvkFFcPV2jSBsMggQns3GqlHjlCLMtSN43IgQbuZ711BPWk6MMIFI48tl7HEC9rm1z1l0aejtn7ooiYKNsV2V__OL0Mi3ziDmoTDp3Ra02m0J176b99V17mFmj7A",
|
|
615
|
+
},
|
|
616
|
+
});
|
|
617
|
+
setProduct(productTemp);
|
|
618
|
+
setModalSent(true);
|
|
619
|
+
}
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
const userAssigned = (tab, rol) => {
|
|
623
|
+
let concept = "";
|
|
624
|
+
switch (tab) {
|
|
625
|
+
case "Ficha técnica":
|
|
626
|
+
concept = "datasheet";
|
|
627
|
+
break;
|
|
628
|
+
case "Imágenes":
|
|
629
|
+
concept = "images";
|
|
630
|
+
break;
|
|
631
|
+
|
|
632
|
+
default:
|
|
633
|
+
concept = "description";
|
|
634
|
+
break;
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
const allowedRoles = [1, 4, 5, 6, 7, 8];
|
|
638
|
+
|
|
639
|
+
const validUser = allowedRoles.indexOf(user?.id_role) !== -1;
|
|
640
|
+
|
|
641
|
+
return (
|
|
642
|
+
productSelected.article[`id_${concept}_${rol}`] === user.id_user &&
|
|
643
|
+
validUser
|
|
644
|
+
);
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
const auditorAssigned = () => {
|
|
648
|
+
return productSelected?.article[`id_auditor`] === user.id_user;
|
|
649
|
+
};
|
|
650
|
+
|
|
651
|
+
function specialistValid(tab) {
|
|
652
|
+
let concept = "";
|
|
653
|
+
switch (tab) {
|
|
654
|
+
case "Ficha técnica":
|
|
655
|
+
concept = "datasheet";
|
|
656
|
+
break;
|
|
657
|
+
case "Imágenes":
|
|
658
|
+
concept = "images";
|
|
659
|
+
break;
|
|
660
|
+
|
|
661
|
+
default:
|
|
662
|
+
concept = "description";
|
|
663
|
+
break;
|
|
664
|
+
}
|
|
665
|
+
return (
|
|
666
|
+
product[`${concept}_status`] === "IN_PROGRESS" ||
|
|
667
|
+
product[`${concept}_status`] === "RF" ||
|
|
668
|
+
product[`${concept}_status`] === "RA"
|
|
669
|
+
);
|
|
670
|
+
}
|
|
671
|
+
|
|
672
|
+
function versionMatch() {
|
|
673
|
+
return productSelected?.version === version;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
useEffect(() => {
|
|
677
|
+
// let concept = "";
|
|
678
|
+
// switch (activeTab) {
|
|
679
|
+
// case "Ficha técnica":
|
|
680
|
+
// concept = "datasheet";
|
|
681
|
+
// break;
|
|
682
|
+
// case "Imágenes":
|
|
683
|
+
// concept = "images";
|
|
684
|
+
// break;
|
|
685
|
+
// default:
|
|
686
|
+
// concept = "description";
|
|
687
|
+
// break;
|
|
688
|
+
// }
|
|
689
|
+
// getComments(concept);
|
|
690
|
+
}, [activeTab]);
|
|
691
|
+
|
|
32
692
|
return (
|
|
33
693
|
<Container headerTop={headerTop}>
|
|
34
694
|
<HeaderTop setHeaderTop={setHeaderTop} />
|
|
35
695
|
<div className="data-container">
|
|
36
696
|
<div className="image-data-panel">
|
|
37
697
|
<ImagePreviewer
|
|
38
|
-
activeImage={activeImage}
|
|
39
|
-
imagesArray={
|
|
698
|
+
activeImage={images?.values ? images?.values[activeImage] : {}}
|
|
699
|
+
imagesArray={images}
|
|
40
700
|
setActiveImage={setActiveImage}
|
|
701
|
+
setShowModal={setShowModal}
|
|
41
702
|
/>
|
|
42
703
|
<ImageDataTable
|
|
43
|
-
|
|
44
|
-
activeImage={activeImage}
|
|
704
|
+
lists={images}
|
|
705
|
+
activeImage={images?.values ? images?.values[activeImage] : {}}
|
|
706
|
+
retailerSelected={activeRetailer.id}
|
|
707
|
+
setImages={setImages}
|
|
708
|
+
assignationsImages={[
|
|
709
|
+
productSelected.article.id_images_especialist,
|
|
710
|
+
productSelected.article.id_images_facilitator,
|
|
711
|
+
]}
|
|
712
|
+
imagesStatus={productSelected?.images_status}
|
|
45
713
|
/>
|
|
46
714
|
</div>
|
|
47
715
|
<div className="product-information">
|
|
48
|
-
<FullProductNameHeader
|
|
716
|
+
<FullProductNameHeader
|
|
717
|
+
headerData={product}
|
|
718
|
+
percent={activePercentage}
|
|
719
|
+
activeRetailer={activeRetailer}
|
|
720
|
+
setActiveRetailer={setActiveRetailer}
|
|
721
|
+
approveRejectButtons={approveRejectButtons}
|
|
722
|
+
sendToFacilitator={sendToFacilitator}
|
|
723
|
+
auditorAssigned={auditorAssigned}
|
|
724
|
+
userAssigned={userAssigned(activeTab, "facilitator")}
|
|
725
|
+
/>
|
|
49
726
|
<FullTabsMenu
|
|
50
727
|
tabsSections={tabsSections}
|
|
51
|
-
status={
|
|
728
|
+
status={{
|
|
729
|
+
Descripción: servicesData.filter(
|
|
730
|
+
(service) =>
|
|
731
|
+
service.id_retailer === activeRetailer?.id &&
|
|
732
|
+
service.service === "description"
|
|
733
|
+
)[0]?.status,
|
|
734
|
+
"Ficha técnica": servicesData.filter(
|
|
735
|
+
(service) =>
|
|
736
|
+
service.id_retailer === activeRetailer?.id &&
|
|
737
|
+
service.service === "datasheet"
|
|
738
|
+
)[0]?.status,
|
|
739
|
+
Imágenes: product?.images_status,
|
|
740
|
+
}}
|
|
52
741
|
profileImage={productData.asigned}
|
|
742
|
+
activeTab={activeTab}
|
|
53
743
|
setActiveTab={setActiveTab}
|
|
54
744
|
setImageLayout={setImageLayout}
|
|
745
|
+
saveDescriptions={saveDescriptions}
|
|
746
|
+
saveDatasheets={saveDatasheets}
|
|
747
|
+
updateImages={updateImages}
|
|
748
|
+
assignations={{
|
|
749
|
+
Descripción: [
|
|
750
|
+
productSelected.article.id_description_especialist,
|
|
751
|
+
productSelected.article.id_description_facilitator,
|
|
752
|
+
],
|
|
753
|
+
"Ficha técnica": [
|
|
754
|
+
productSelected.article.id_datasheet_especialist,
|
|
755
|
+
productSelected.article.id_datasheet_facilitator,
|
|
756
|
+
],
|
|
757
|
+
Imágenes: [
|
|
758
|
+
productSelected.article.id_images_especialist,
|
|
759
|
+
productSelected.article.id_images_facilitator,
|
|
760
|
+
],
|
|
761
|
+
}}
|
|
55
762
|
/>
|
|
56
763
|
<div
|
|
57
764
|
className={
|
|
58
765
|
"services-information-container " +
|
|
59
|
-
(imageLayout && activeTab === "Imágenes"
|
|
766
|
+
(imageLayout && activeTab === "Imágenes" ? "image-services" : "")
|
|
60
767
|
}
|
|
61
768
|
>
|
|
62
|
-
{
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
image={image}
|
|
76
|
-
gridLayout={imageLayout}
|
|
77
|
-
id={"gallery-element-" + index}
|
|
769
|
+
{!imageLayout && <GalleryHeader />}
|
|
770
|
+
{activeTab === "Ficha técnica" &&
|
|
771
|
+
(product?.services?.datasheets === 1 ? (
|
|
772
|
+
datasheets[0]?.data?.map((dataGroup, index) => (
|
|
773
|
+
<InputGroup
|
|
774
|
+
key={index + "-" + activeRetailer.name}
|
|
775
|
+
articleId={productSelected.article.id_article}
|
|
776
|
+
version={version}
|
|
777
|
+
activeSection={activeTab}
|
|
778
|
+
inputGroup={dataGroup}
|
|
779
|
+
dataInputs={datasheets[1]}
|
|
780
|
+
updatedDatasheets={updatedDatasheets}
|
|
781
|
+
setUpdatedDatasheets={setUpdatedDatasheets}
|
|
78
782
|
/>
|
|
79
|
-
))
|
|
783
|
+
))
|
|
784
|
+
) : (
|
|
785
|
+
<p>no tienes este servicio</p>
|
|
786
|
+
))}
|
|
787
|
+
{activeTab === "Descripción" &&
|
|
788
|
+
(product?.services?.descriptions === 1 ? (
|
|
789
|
+
<InputGroup
|
|
790
|
+
activeSection={activeTab}
|
|
791
|
+
inputGroup={descriptions[0]}
|
|
792
|
+
updatedDescriptions={updatedDescriptions}
|
|
793
|
+
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
794
|
+
articleId={articleId}
|
|
795
|
+
version={version}
|
|
796
|
+
dinamicHeight={true}
|
|
797
|
+
/>
|
|
798
|
+
) : (
|
|
799
|
+
<p>no tienes este servicio</p>
|
|
800
|
+
))}
|
|
801
|
+
|
|
802
|
+
{activeTab === "Imágenes" &&
|
|
803
|
+
(product?.services?.images === 1 ? (
|
|
804
|
+
<section className="container">
|
|
805
|
+
<div {...getRootProps({ className: "dropzone" })}>
|
|
806
|
+
<input {...getInputProps()} />
|
|
807
|
+
<aside>{thumbs()}</aside>
|
|
808
|
+
</div>
|
|
809
|
+
</section>
|
|
810
|
+
) : (
|
|
811
|
+
<p>no tienes este servicio</p>
|
|
812
|
+
))}
|
|
80
813
|
</div>
|
|
814
|
+
{(userAssigned(activeTab, "especialist" || "facilitator") ||
|
|
815
|
+
auditorAssigned()) && (
|
|
816
|
+
<div className="commentary-box">
|
|
817
|
+
{!comments[activeTab] ? (
|
|
818
|
+
<div className="commentary">
|
|
819
|
+
<TagAndInput
|
|
820
|
+
label={"Caja de Comentario"}
|
|
821
|
+
inputType={"textarea"}
|
|
822
|
+
inputCols={80}
|
|
823
|
+
inputRows={4}
|
|
824
|
+
/>
|
|
825
|
+
<div className="buttons-box">
|
|
826
|
+
<Button
|
|
827
|
+
buttonType={"general-transparent-button"}
|
|
828
|
+
label={"Enviar comentario"}
|
|
829
|
+
/>
|
|
830
|
+
<Button
|
|
831
|
+
buttonType={
|
|
832
|
+
requiredNull !== 0 ||
|
|
833
|
+
!specialistValid(activeTab) ||
|
|
834
|
+
!versionMatch()
|
|
835
|
+
? "general-button-disabled"
|
|
836
|
+
: "general-green-button"
|
|
837
|
+
}
|
|
838
|
+
label={"Enviar evaluación"}
|
|
839
|
+
onClick={() => sendToFacilitator()}
|
|
840
|
+
/>
|
|
841
|
+
</div>
|
|
842
|
+
</div>
|
|
843
|
+
) : (
|
|
844
|
+
<Commentary comment={comments[activeTab].message} />
|
|
845
|
+
)}
|
|
846
|
+
</div>
|
|
847
|
+
)}
|
|
81
848
|
</div>
|
|
82
849
|
</div>
|
|
850
|
+
{showModal && (
|
|
851
|
+
<ProductImageModal
|
|
852
|
+
images={images}
|
|
853
|
+
setShowModal={setShowModal}
|
|
854
|
+
sendToFacilitator={sendToFacilitator}
|
|
855
|
+
approveRejectButtons={approveRejectButtons}
|
|
856
|
+
/>
|
|
857
|
+
)}
|
|
83
858
|
</Container>
|
|
84
859
|
);
|
|
85
860
|
};
|