contentoh-components-library 10.0.0 → 12.1.17
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 +20 -12
- package/.env.production +10 -2
- package/CHANGELOG.md +39 -0
- package/dist/assets/images/carouselImagesLogin/login2.svg +117 -0
- package/dist/assets/images/carouselImagesLogin/login3.svg +147 -0
- package/dist/assets/images/carouselImagesLogin/loginImage.svg +301 -0
- package/dist/assets/images/editField/showPassword.png +0 -0
- package/dist/assets/images/generalButton/downloadIcon.svg +3 -0
- package/dist/assets/images/genericModal/closeWhite.svg +3 -0
- package/dist/assets/images/genericModal/errorModal.svg +3 -0
- package/dist/assets/images/genericModal/yellowAlert.svg +12 -0
- package/dist/assets/images/sliderToolTip/infoIcon.svg +4 -0
- package/dist/assets/images/sliderToolTip/slide1.svg +5 -0
- package/dist/assets/images/sliderToolTip/slide2.svg +9 -0
- package/dist/assets/images/sliderToolTip/slide3.svg +9 -0
- package/dist/assets/images/sliderToolTip/slide4.svg +9 -0
- package/dist/assets/images/sliderToolTip/slide5.svg +40 -0
- package/dist/assets/images/verticalSideMenuMainPage/closeMenu.svg +4 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconFAQS.svg +12 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconGroup.svg +3 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconLogo.svg +12 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg +15 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconProduct.svg +3 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconSpeedometer.svg +12 -0
- package/dist/assets/images/verticalSideMenuMainPage/iconTask.svg +10 -0
- package/dist/assets/images/verticalSideMenuMainPage/openMenu.svg +4 -0
- package/dist/components/atoms/ActivedFilter/ActivedFilter.stories.js +7 -1
- package/dist/components/atoms/ActivedFilter/index.js +12 -4
- package/dist/components/atoms/AsignationOption/AsignationOptions.stories.js +7 -1
- package/dist/components/atoms/AsignationOption/index.js +52 -23
- package/dist/components/atoms/AsignationOption/styles.js +1 -1
- package/dist/components/atoms/AtomList/AtomList.stories.js +7 -1
- package/dist/components/atoms/AtomList/index.js +14 -9
- package/dist/components/atoms/Avatar/AsignationImage.stories.js +7 -1
- package/dist/components/atoms/Avatar/index.js +11 -8
- package/dist/components/atoms/Card/Card.stories.js +7 -1
- package/dist/components/atoms/Card/index.js +8 -4
- package/dist/components/atoms/CharCounter/CharCounter.stories.js +31 -0
- package/dist/components/atoms/CharCounter/index.js +22 -0
- package/dist/components/atoms/CharCounter/styles.js +20 -0
- package/dist/components/atoms/CheckBox/CheckBox.stories.js +7 -1
- package/dist/components/atoms/CheckBox/index.js +19 -13
- package/dist/components/atoms/Commentary/index.js +10 -2
- package/dist/components/atoms/Commentary/styles.js +4 -1
- package/dist/components/atoms/CustomerTypeImage/CustomerTypeImage.stories.js +7 -1
- package/dist/components/atoms/CustomerTypeImage/index.js +8 -6
- package/dist/components/atoms/DropDownButton/DropDownButton.stories.js +7 -1
- package/dist/components/atoms/DropDownButton/index.js +9 -6
- package/dist/components/atoms/DropDownButton/styles.js +1 -1
- package/dist/components/atoms/EditField/EditField.stories.js +7 -1
- package/dist/components/atoms/EditField/index.js +17 -10
- package/dist/components/atoms/FeatureTag/FeatureTag.stories.js +7 -1
- package/dist/components/atoms/FeatureTag/index.js +11 -5
- package/dist/components/atoms/GeneralButton/GeneralButton.stories.js +7 -1
- package/dist/components/atoms/GeneralButton/index.js +13 -7
- package/dist/components/atoms/GeneralButton/styles.js +4 -2
- package/dist/components/atoms/GeneralInput/GeneralInput.stories.js +7 -1
- package/dist/components/atoms/GeneralInput/index.js +128 -69
- package/dist/components/atoms/GeneralInput/styles.js +8 -2
- package/dist/components/atoms/GeneralTextBox/GeneralTextBox.stories.js +7 -1
- package/dist/components/atoms/GeneralTextBox/index.js +12 -7
- package/dist/components/atoms/GenericModal/GenericModal.stories.js +46 -59
- package/dist/components/atoms/GenericModal/index.js +15 -8
- package/dist/components/atoms/GenericModal/styles.js +1 -1
- package/dist/components/atoms/GradientPanel/GradientPanel.stories.js +85 -80
- package/dist/components/atoms/GradientPanel/index.js +11 -7
- package/dist/components/atoms/GradientPanel/styles.js +2 -2
- package/dist/components/atoms/Graphic/Graphic.stories.js +7 -1
- package/dist/components/atoms/Graphic/index.js +9 -5
- package/dist/components/atoms/Input/index.js +15 -8
- package/dist/components/atoms/Input/style.js +4 -4
- package/dist/components/atoms/InputFormatter/Wysiwyg.stories.js +30 -0
- package/dist/components/atoms/InputFormatter/index.js +187 -0
- package/dist/components/atoms/InputFormatter/styles.js +33 -0
- package/dist/components/atoms/LabelToInput/index.js +18 -13
- package/dist/components/atoms/LabelToInput/style.js +3 -3
- package/dist/components/atoms/LoadImageMenu/LoadImageMenu.stories.js +7 -1
- package/dist/components/atoms/LoadImageMenu/index.js +33 -22
- package/dist/components/atoms/Loading/Loading.stories.js +28 -0
- package/dist/components/atoms/Loading/index.js +27 -0
- package/dist/components/atoms/Loading/styles.js +22 -0
- package/dist/components/atoms/LogoImage/LogoImage.stories.js +7 -1
- package/dist/components/atoms/LogoImage/index.js +9 -6
- package/dist/components/atoms/MenuNotification/MenuNotification.stories.js +7 -1
- package/dist/components/atoms/MenuNotification/index.js +21 -15
- package/dist/components/atoms/MenuProfile/MenuProfile.stories.js +7 -1
- package/dist/components/atoms/MenuProfile/index.js +25 -15
- package/dist/components/atoms/Notification/Notification.stories.js +5 -1
- package/dist/components/atoms/Notification/index.js +15 -9
- package/dist/components/atoms/Percent/Percent.stories.js +7 -1
- package/dist/components/atoms/Percent/index.js +21 -14
- package/dist/components/atoms/PriorityFlag/PriorityFlag.stories.js +7 -1
- package/dist/components/atoms/PriorityFlag/index.js +8 -4
- package/dist/components/atoms/ProductImage/ProductImage.stories.js +7 -1
- package/dist/components/atoms/ProductImage/index.js +11 -8
- package/dist/components/atoms/ProductPercentCard/Percent.stories.js +41 -0
- package/dist/components/atoms/ProductPercentCard/index.js +45 -0
- package/dist/components/atoms/ProductPercentCard/styles.js +20 -0
- package/dist/components/atoms/ProgressBar/ProgressBar.stories.js +7 -1
- package/dist/components/atoms/ProgressBar/index.js +8 -3
- package/dist/components/atoms/ProgressBar/styles.js +1 -1
- package/dist/components/atoms/ScreenHeader/ScreenHeader.stories.js +7 -1
- package/dist/components/atoms/ScreenHeader/index.js +9 -3
- package/dist/components/atoms/ScreenHeader/styles.js +1 -1
- package/dist/components/atoms/Select/index.js +27 -20
- package/dist/components/atoms/Select/style.js +1 -1
- package/dist/components/atoms/SideMenuButton/SideMenuButton.stories.js +5 -1
- package/dist/components/atoms/SideMenuButton/index.js +10 -4
- package/dist/components/atoms/SliderToolTip/SliderToolTip.stories.js +47 -0
- package/dist/components/atoms/SliderToolTip/index.js +200 -0
- package/dist/components/atoms/SliderToolTip/styles.js +24 -0
- package/dist/components/atoms/StatusTag/StatusTag.stories.js +7 -1
- package/dist/components/atoms/StatusTag/index.js +43 -3
- package/dist/components/atoms/StatusTag/styles.js +1 -1
- package/dist/components/atoms/TabSection/TabSection.stories.js +7 -1
- package/dist/components/atoms/TabSection/index.js +8 -3
- package/dist/components/atoms/ValidationPanel/ValidationPanel.stories.js +7 -1
- package/dist/components/atoms/ValidationPanel/index.js +41 -28
- package/dist/components/atoms/VerticalSideMenuMainPage/VerticalSideMenuMainPage.stories.js +28 -0
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +98 -0
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +24 -0
- package/dist/components/molecules/AddProvidersAndProducts/AddProvidersAndProducts.stories.js +5 -1
- package/dist/components/molecules/AddProvidersAndProducts/index.js +18 -12
- package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +5 -1
- package/dist/components/molecules/AssignedWork/index.js +36 -30
- package/dist/components/molecules/AvatarAndValidation/AvatarAndValidation.stories.js +7 -1
- package/dist/components/molecules/AvatarAndValidation/index.js +27 -25
- package/dist/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +37 -0
- package/dist/components/molecules/CarouselImagesLogin/index.js +92 -0
- package/dist/components/molecules/CarouselImagesLogin/styles.js +21 -0
- package/dist/components/molecules/EditionActiveImage/EditionActiveImage.stories.js +7 -1
- package/dist/components/molecules/EditionActiveImage/index.js +14 -10
- package/dist/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +28 -0
- package/dist/components/molecules/EmailResetPasswordLogin/index.js +153 -0
- package/dist/components/molecules/EmailResetPasswordLogin/styles.js +20 -0
- package/dist/components/molecules/FeaturesBar/FeaturesBar.stories.js +7 -1
- package/dist/components/molecules/FeaturesBar/index.js +11 -9
- package/dist/components/molecules/GalleryElement/GalleryElement.stories.js +7 -1
- package/dist/components/molecules/GalleryElement/index.js +96 -57
- package/dist/components/molecules/GalleryHeader/GalleryHeader.stories.js +7 -1
- package/dist/components/molecules/GalleryHeader/index.js +46 -16
- package/dist/components/molecules/HeaderTop/HeaderTop.stories.js +7 -1
- package/dist/components/molecules/HeaderTop/index.js +10 -7
- package/dist/components/molecules/ImageSelector/ImageSelector.stories.js +7 -1
- package/dist/components/molecules/ImageSelector/index.js +15 -13
- package/dist/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +28 -0
- package/dist/components/molecules/LoginPasswordStrength/index.js +126 -0
- package/dist/components/molecules/LoginPasswordStrength/styles.js +78 -0
- package/dist/components/molecules/LogoLoading/Loading.stories.js +28 -0
- package/dist/components/molecules/LogoLoading/index.js +22 -0
- package/dist/components/molecules/LogoLoading/styles.js +18 -0
- package/dist/components/molecules/ParentComponent/ParentComponent.stories.js +10 -2
- package/dist/components/molecules/ParentComponent/index.js +9 -5
- package/dist/components/molecules/PayMethod/PayMethod.stories.js +7 -1
- package/dist/components/molecules/PayMethod/index.js +38 -33
- package/dist/components/molecules/PlanSelection/PlanSelection.stories.js +7 -1
- package/dist/components/molecules/PlanSelection/index.js +14 -11
- package/dist/components/molecules/ProductNameHeader/ProductNameHeader.stories.js +7 -1
- package/dist/components/molecules/ProductNameHeader/index.js +18 -14
- package/dist/components/molecules/ProductNotification/ProductNotification.stories.js +7 -1
- package/dist/components/molecules/ProductNotification/index.js +12 -9
- package/dist/components/molecules/ProfileHeader/ProfileHeader.stories.js +5 -1
- package/dist/components/molecules/ProfileHeader/index.js +21 -15
- package/dist/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationFirstStep/index.js +308 -0
- package/dist/components/molecules/RegistrationFirstStep/styles.js +20 -0
- package/dist/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationSecondStep/index.js +172 -0
- package/dist/components/molecules/RegistrationSecondStep/styles.js +20 -0
- package/dist/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +28 -0
- package/dist/components/molecules/RegistrationThirdStep/index.js +155 -0
- package/dist/components/molecules/RegistrationThirdStep/styles.js +20 -0
- package/dist/components/molecules/RetailerSelector/RetailerSelector.stories.js +7 -1
- package/dist/components/molecules/RetailerSelector/index.js +36 -25
- package/dist/components/molecules/RetailerSelector/styles.js +1 -1
- package/dist/components/molecules/SidebarNotification/SidebarNotification.stories.js +5 -1
- package/dist/components/molecules/SidebarNotification/index.js +43 -37
- package/dist/components/molecules/SignInLogin/SignInLogin.stories.js +28 -0
- package/dist/components/molecules/SignInLogin/index.js +315 -0
- package/dist/components/molecules/SignInLogin/styles.js +20 -0
- package/dist/components/molecules/StatusAsignationInfo/StatusAsignationInfo.stories.js +7 -1
- package/dist/components/molecules/StatusAsignationInfo/index.js +111 -98
- package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
- package/dist/components/molecules/TableHeader/TableHeader.stories.js +7 -1
- package/dist/components/molecules/TableHeader/index.js +21 -9
- package/dist/components/molecules/TableHeader/styles.js +1 -1
- package/dist/components/molecules/TableRow/TableRow.stories.js +7 -1
- package/dist/components/molecules/TableRow/index.js +11 -7
- package/dist/components/molecules/TabsMenu/TabsMenu.stories.js +7 -1
- package/dist/components/molecules/TabsMenu/index.js +13 -10
- package/dist/components/molecules/TagAndInput/TagAndInput.stories.js +7 -1
- package/dist/components/molecules/TagAndInput/index.js +43 -23
- package/dist/components/molecules/TagAndInput/styles.js +10 -2
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +28 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +211 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/styles.js +20 -0
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +69 -0
- package/dist/components/organisms/ChangePassword/ChangePassword.stories.js +28 -0
- package/dist/components/organisms/ChangePassword/index.js +124 -0
- package/dist/components/organisms/ChangePassword/styles.js +18 -0
- package/dist/components/organisms/FullProductNameHeader/FullProductNameHeader.stories.js +7 -1
- package/dist/components/organisms/FullProductNameHeader/index.js +64 -34
- package/dist/components/organisms/FullTabsMenu/FullTabsMenu.stories.js +7 -1
- package/dist/components/organisms/FullTabsMenu/index.js +30 -23
- package/dist/components/organisms/Fullplan/FullPlan.stories.js +7 -1
- package/dist/components/organisms/Fullplan/index.js +23 -15
- package/dist/components/organisms/GlobalModal/index.js +73 -0
- package/dist/components/organisms/GlobalModal/styles.js +66 -0
- package/dist/components/organisms/ImageDataTable/ImageDataTable.stories.js +7 -1
- package/dist/components/organisms/ImageDataTable/index.js +85 -62
- package/dist/components/organisms/ImagePreviewer/ImagePreviewer.stories.js +7 -1
- package/dist/components/organisms/ImagePreviewer/index.js +12 -8
- package/dist/components/organisms/ImagesGroup/index.js +5 -1
- package/dist/components/organisms/InputGroup/InputGroup.stories.js +7 -1
- package/dist/components/organisms/InputGroup/index.js +44 -37
- package/dist/components/organisms/InputGroup/styles.js +1 -1
- package/dist/components/organisms/ProductImageModal/ProductImageModal.stories.js +7 -1
- package/dist/components/organisms/ProductImageModal/index.js +49 -46
- package/dist/components/organisms/ProductImageModal/styles.js +1 -1
- package/dist/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +38 -0
- package/dist/components/pages/ChangePasswordLogin/index.js +108 -0
- package/dist/components/pages/ChangePasswordLogin/styles.js +18 -0
- package/dist/components/pages/CustomerLogin/CustomerLogin.stories.js +52 -47
- package/dist/components/pages/CustomerLogin/index.js +18 -12
- package/dist/components/pages/CustomerPayMethod/CustomerPayMethod.stories.js +36 -28
- package/dist/components/pages/CustomerPayMethod/index.js +18 -12
- package/dist/components/pages/CustomerType/CustomerType.stories.js +21 -22
- package/dist/components/pages/CustomerType/index.js +18 -12
- package/dist/components/pages/EmailResetPassword/EmailResetPassword.stories.js +37 -0
- package/dist/components/pages/EmailResetPassword/index.js +130 -0
- package/dist/components/pages/EmailResetPassword/styles.js +20 -0
- package/dist/components/pages/OnboardPlan/OnboardPlan.stories.js +12 -9
- package/dist/components/pages/OnboardPlan/index.js +18 -12
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +175 -0
- package/dist/components/pages/ProviderProductEdition/index.js +1800 -0
- package/dist/components/pages/ProviderProductEdition/styles.js +23 -0
- package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +37 -0
- package/dist/components/pages/RegistrationLoginFirstStep/index.js +269 -0
- package/dist/components/pages/RegistrationLoginFirstStep/styles.js +20 -0
- package/dist/components/pages/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +38 -0
- package/dist/components/pages/RegistrationLoginSecondStep/index.js +176 -0
- package/dist/components/pages/RegistrationLoginSecondStep/styles.js +20 -0
- package/dist/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +37 -0
- package/dist/components/pages/RegistrationLoginThirdStep/index.js +178 -0
- package/dist/components/pages/RegistrationLoginThirdStep/styles.js +20 -0
- package/dist/components/pages/RetailerPlan/RetailerPlan.stories.js +13 -10
- package/dist/components/pages/RetailerPlan/index.js +18 -12
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +41 -75
- package/dist/components/pages/RetailerProductEdition/index.js +1180 -590
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +37 -0
- package/dist/components/pages/VerificationCodeResetPassword/index.js +121 -0
- package/dist/components/pages/VerificationCodeResetPassword/styles.js +20 -0
- package/dist/components/pages/VerificationCodeResetPassword/utils.js +69 -0
- package/dist/global-files/data.js +85 -14
- package/dist/index.js +316 -100
- package/package.json +28 -8
- package/src/assets/images/carouselImagesLogin/login2.svg +117 -0
- package/src/assets/images/carouselImagesLogin/login3.svg +147 -0
- package/src/assets/images/carouselImagesLogin/loginImage.svg +301 -0
- package/src/assets/images/editField/showPassword.png +0 -0
- package/src/assets/images/generalButton/downloadIcon.svg +3 -0
- package/src/assets/images/genericModal/closeWhite.svg +3 -0
- package/src/assets/images/genericModal/errorModal.svg +3 -0
- package/src/assets/images/genericModal/yellowAlert.svg +12 -0
- package/src/assets/images/sliderToolTip/infoIcon.svg +4 -0
- package/src/assets/images/sliderToolTip/slide1.svg +5 -0
- package/src/assets/images/sliderToolTip/slide2.svg +9 -0
- package/src/assets/images/sliderToolTip/slide3.svg +9 -0
- package/src/assets/images/sliderToolTip/slide4.svg +9 -0
- package/src/assets/images/sliderToolTip/slide5.svg +40 -0
- package/src/assets/images/verticalSideMenuMainPage/closeMenu.svg +4 -0
- package/src/assets/images/verticalSideMenuMainPage/iconFAQS.svg +12 -0
- package/src/assets/images/verticalSideMenuMainPage/iconGroup.svg +3 -0
- package/src/assets/images/verticalSideMenuMainPage/iconLogo.svg +12 -0
- package/src/assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg +15 -0
- package/src/assets/images/verticalSideMenuMainPage/iconProduct.svg +3 -0
- package/src/assets/images/verticalSideMenuMainPage/iconSpeedometer.svg +12 -0
- package/src/assets/images/verticalSideMenuMainPage/iconTask.svg +10 -0
- package/src/assets/images/verticalSideMenuMainPage/openMenu.svg +4 -0
- package/src/components/atoms/AsignationOption/index.js +18 -1
- package/src/components/atoms/AsignationOption/styles.js +19 -1
- package/src/components/atoms/CharCounter/CharCounter.stories.js +11 -0
- package/src/components/atoms/CharCounter/index.js +13 -0
- package/src/components/atoms/CharCounter/styles.js +10 -0
- package/src/components/atoms/CheckBox/index.js +8 -2
- package/src/components/atoms/Commentary/index.js +2 -2
- package/src/components/atoms/Commentary/styles.js +1 -0
- package/src/components/atoms/DropDownButton/styles.js +6 -0
- package/src/components/atoms/GeneralButton/index.js +1 -0
- package/src/components/atoms/GeneralButton/styles.js +14 -0
- package/src/components/atoms/GeneralInput/index.js +109 -62
- package/src/components/atoms/GeneralInput/styles.js +34 -0
- package/src/components/atoms/GenericModal/index.js +2 -2
- package/src/components/atoms/GenericModal/styles.js +11 -3
- package/src/components/atoms/GradientPanel/styles.js +8 -1
- package/src/components/atoms/Input/index.js +2 -1
- package/src/components/atoms/Input/style.js +9 -5
- package/src/components/atoms/InputFormatter/Wysiwyg.stories.js +12 -0
- package/src/components/atoms/InputFormatter/index.js +146 -0
- package/src/components/atoms/InputFormatter/styles.js +41 -0
- package/src/components/atoms/LabelToInput/index.js +0 -1
- package/src/components/atoms/LabelToInput/style.js +15 -4
- package/src/components/atoms/Loading/Loading.stories.js +10 -0
- package/src/components/atoms/Loading/index.js +13 -0
- package/src/components/atoms/Loading/styles.js +57 -0
- package/src/components/atoms/LogoImage/index.js +1 -1
- package/src/components/atoms/ProductPercentCard/Percent.stories.js +41 -0
- package/src/components/atoms/ProductPercentCard/index.js +23 -0
- package/src/components/atoms/{Percent → ProductPercentCard}/styles.js +11 -7
- package/src/components/atoms/ProgressBar/styles.js +2 -1
- package/src/components/atoms/ScreenHeader/index.js +7 -3
- package/src/components/atoms/ScreenHeader/styles.js +14 -2
- package/src/components/atoms/Select/index.js +3 -1
- package/src/components/atoms/Select/style.js +1 -2
- package/src/components/atoms/SliderToolTip/SliderToolTip.stories.js +23 -0
- package/src/components/atoms/SliderToolTip/index.js +182 -0
- package/src/components/atoms/SliderToolTip/styles.js +168 -0
- package/src/components/atoms/StatusTag/index.js +30 -2
- package/src/components/atoms/StatusTag/styles.js +9 -4
- package/src/components/atoms/ValidationPanel/index.js +4 -3
- package/src/components/atoms/VerticalSideMenuMainPage/VerticalSideMenuMainPage.stories.js +12 -0
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +54 -0
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +45 -0
- package/src/components/molecules/AvatarAndValidation/index.js +14 -15
- package/src/components/molecules/CarouselImagesLogin/CarouselImagesLogin.stories.js +17 -0
- package/src/components/molecules/CarouselImagesLogin/index.js +65 -0
- package/src/components/molecules/CarouselImagesLogin/styles.js +60 -0
- package/src/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +11 -0
- package/src/components/molecules/EmailResetPasswordLogin/index.js +85 -0
- package/src/components/molecules/EmailResetPasswordLogin/styles.js +23 -0
- package/src/components/molecules/GalleryElement/index.js +26 -6
- package/src/components/molecules/GalleryHeader/index.js +8 -2
- package/src/components/molecules/LoginPasswordStrength/LoginPasswordStrength.stories.js +8 -0
- package/src/components/molecules/LoginPasswordStrength/index.js +84 -0
- package/src/components/molecules/LoginPasswordStrength/styles.js +91 -0
- package/src/components/molecules/LogoLoading/Loading.stories.js +10 -0
- package/src/components/molecules/LogoLoading/index.js +12 -0
- package/src/components/molecules/LogoLoading/styles.js +16 -0
- package/src/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +11 -0
- package/src/components/molecules/RegistrationFirstStep/index.js +227 -0
- package/src/components/molecules/RegistrationFirstStep/styles.js +87 -0
- package/src/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +11 -0
- package/src/components/molecules/RegistrationSecondStep/index.js +135 -0
- package/src/components/molecules/RegistrationSecondStep/styles.js +64 -0
- package/src/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +11 -0
- package/src/components/molecules/RegistrationThirdStep/index.js +130 -0
- package/src/components/molecules/RegistrationThirdStep/styles.js +44 -0
- package/src/components/molecules/RetailerSelector/index.js +7 -1
- package/src/components/molecules/RetailerSelector/styles.js +3 -0
- package/src/components/molecules/SignInLogin/SignInLogin.stories.js +11 -0
- package/src/components/molecules/SignInLogin/index.js +226 -0
- package/src/components/molecules/SignInLogin/styles.js +120 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +60 -53
- package/src/components/molecules/StatusAsignationInfo/styles.js +8 -2
- package/src/components/molecules/TableHeader/index.js +14 -2
- package/src/components/molecules/TableHeader/styles.js +8 -0
- package/src/components/molecules/TagAndInput/index.js +19 -1
- package/src/components/molecules/TagAndInput/styles.js +28 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +11 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +171 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/styles.js +54 -0
- package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +54 -0
- package/src/components/organisms/ChangePassword/ChangePassword.stories.js +11 -0
- package/src/components/organisms/ChangePassword/index.js +77 -0
- package/src/components/organisms/ChangePassword/styles.js +13 -0
- package/src/components/organisms/FullProductNameHeader/index.js +47 -16
- package/src/components/organisms/FullTabsMenu/index.js +15 -12
- package/src/components/organisms/GlobalModal/index.js +68 -0
- package/src/components/organisms/GlobalModal/styles.js +113 -0
- package/src/components/organisms/ImageDataTable/index.js +29 -8
- package/src/components/organisms/InputGroup/index.js +28 -8
- package/src/components/organisms/InputGroup/styles.js +2 -2
- package/src/components/organisms/ProductImageModal/index.js +8 -9
- package/src/components/organisms/ProductImageModal/styles.js +3 -0
- package/src/components/pages/ChangePasswordLogin/ChangePasswordLogin.stories.js +18 -0
- package/src/components/pages/ChangePasswordLogin/index.js +77 -0
- package/src/components/pages/ChangePasswordLogin/styles.js +20 -0
- package/src/components/pages/EmailResetPassword/EmailResetPassword.stories.js +17 -0
- package/src/components/pages/EmailResetPassword/index.js +77 -0
- package/src/components/pages/EmailResetPassword/styles.js +27 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +172 -0
- package/src/components/pages/ProviderProductEdition/index.js +1275 -0
- package/src/components/pages/ProviderProductEdition/styles.js +118 -0
- package/src/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +17 -0
- package/src/components/pages/RegistrationLoginFirstStep/index.js +160 -0
- package/src/components/pages/RegistrationLoginFirstStep/styles.js +85 -0
- package/src/components/pages/RegistrationLoginSecondStep/RegistrationLoginSecondStep.stories.js +18 -0
- package/src/components/pages/RegistrationLoginSecondStep/index.js +111 -0
- package/src/components/pages/RegistrationLoginSecondStep/styles.js +64 -0
- package/src/components/pages/RegistrationLoginThirdStep/RegistrationLoginThirdStep.stories.js +17 -0
- package/src/components/pages/RegistrationLoginThirdStep/index.js +106 -0
- package/src/components/pages/RegistrationLoginThirdStep/styles.js +48 -0
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +32 -65
- package/src/components/pages/RetailerProductEdition/index.js +924 -442
- package/src/components/pages/RetailerProductEdition/styles.js +17 -3
- package/src/components/pages/VerificationCodeResetPassword/VerificationCodeResetPassword.stories.js +17 -0
- package/src/components/pages/VerificationCodeResetPassword/index.js +92 -0
- package/src/components/pages/VerificationCodeResetPassword/styles.js +54 -0
- package/src/components/pages/VerificationCodeResetPassword/utils.js +56 -0
- package/src/global-files/data.js +56 -8
- package/src/index.js +23 -8
- package/src/components/atoms/Percent/Percent.stories.js +0 -38
- package/src/components/atoms/Percent/index.js +0 -15
|
@@ -0,0 +1,1275 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { HeaderTop } from "../../molecules/HeaderTop";
|
|
3
|
+
import { ImagePreviewer } from "../../organisms/ImagePreviewer";
|
|
4
|
+
import { ImageDataTable } from "../../organisms/ImageDataTable";
|
|
5
|
+
import { FullProductNameHeader } from "../../organisms/FullProductNameHeader";
|
|
6
|
+
import { FullTabsMenu } from "../../organisms/FullTabsMenu";
|
|
7
|
+
import { InputGroup } from "../../organisms/InputGroup";
|
|
8
|
+
import { useEffect, useReducer, useState, useCallback } from "react";
|
|
9
|
+
import { GalleryElement } from "../../molecules/GalleryElement";
|
|
10
|
+
import { saveAs } from "file-saver";
|
|
11
|
+
import {
|
|
12
|
+
getRetailerServices,
|
|
13
|
+
getPercentage,
|
|
14
|
+
fetchUsers,
|
|
15
|
+
} from "../../../global-files/data";
|
|
16
|
+
import { GalleryHeader } from "../../molecules/GalleryHeader";
|
|
17
|
+
import { ProductImageModal } from "../../organisms/ProductImageModal";
|
|
18
|
+
import { useDropzone } from "react-dropzone";
|
|
19
|
+
import axios from "axios";
|
|
20
|
+
import { v4 as uuidv4 } from "uuid";
|
|
21
|
+
import AWS from "aws-sdk";
|
|
22
|
+
import attributesSent from "../../../assets/images/modalsSVGs/attributesSent.svg";
|
|
23
|
+
import descriptionSent from "../../../assets/images/modalsSVGs/descriptionSent.svg";
|
|
24
|
+
import imagesSent from "../../../assets/images/modalsSVGs/uploadingImages.svg";
|
|
25
|
+
import { TagAndInput } from "../../molecules/TagAndInput/index";
|
|
26
|
+
import { Button } from "../../atoms/GeneralButton";
|
|
27
|
+
import { Commentary } from "../../atoms/Commentary";
|
|
28
|
+
import { GenericModal } from "../../atoms/GenericModal";
|
|
29
|
+
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
30
|
+
import { Loading } from "../../atoms/Loading";
|
|
31
|
+
import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
|
|
32
|
+
import { Link } from "react-router-dom";
|
|
33
|
+
import face from "../../../assets/images/defaultImages/defaultProfileImage.svg";
|
|
34
|
+
import errorModal from "../../../assets/images/genericModal/errorModal.svg";
|
|
35
|
+
import { GlobalModal } from "../../organisms/GlobalModal/index";
|
|
36
|
+
|
|
37
|
+
const reducerImages = (state, action) => {
|
|
38
|
+
let { values, attrForImgs } = state;
|
|
39
|
+
switch (action.action) {
|
|
40
|
+
case "init":
|
|
41
|
+
return action.init;
|
|
42
|
+
case "addImg":
|
|
43
|
+
values = [...values, action.img];
|
|
44
|
+
return { ...state, values };
|
|
45
|
+
case "changeImageInfo":
|
|
46
|
+
values[action.index][action.attribute] = action.value;
|
|
47
|
+
return { ...state, values };
|
|
48
|
+
case "changeAttrValue":
|
|
49
|
+
attrForImgs[action.retailer][action.index].value = action.value;
|
|
50
|
+
return { ...state, attrForImgs, values };
|
|
51
|
+
case "deleteImage":
|
|
52
|
+
values = values.filter(
|
|
53
|
+
(value) => action.selectedImages.indexOf(value) === -1
|
|
54
|
+
);
|
|
55
|
+
return { ...state, values };
|
|
56
|
+
default:
|
|
57
|
+
return state;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
const S3_BUCKET = process.env.REACT_APP_IMAGES_BUCKET;
|
|
62
|
+
const REGION = "us-east-1";
|
|
63
|
+
|
|
64
|
+
AWS.config.update({
|
|
65
|
+
accessKeyId: process.env.REACT_APP_KEY_UPLOAD_TO_S3,
|
|
66
|
+
secretAccessKey: process.env.REACT_APP_ACCESS_KEY_UPLOAD_TO_S3,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
const myBucket = new AWS.S3({
|
|
70
|
+
params: { Bucket: S3_BUCKET },
|
|
71
|
+
region: REGION,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
export const ProviderProductEdition = ({
|
|
75
|
+
tabsSections,
|
|
76
|
+
productSelected = {},
|
|
77
|
+
productToEdit,
|
|
78
|
+
user = {},
|
|
79
|
+
location = {},
|
|
80
|
+
token,
|
|
81
|
+
revision = false,
|
|
82
|
+
setShowContentohRequestModal,
|
|
83
|
+
showSurvey,
|
|
84
|
+
}) => {
|
|
85
|
+
const [activeTab, setActiveTab] = useState("Descripción");
|
|
86
|
+
const [activeImage, setActiveImage] = useState();
|
|
87
|
+
const [imageLayout, setImageLayout] = useState(false);
|
|
88
|
+
const [headerTop, setHeaderTop] = useState(0);
|
|
89
|
+
const [descriptions, setDescriptions] = useState([]);
|
|
90
|
+
const [datasheets, setDatasheets] = useState([]);
|
|
91
|
+
const [images, setImages] = useReducer(reducerImages, {});
|
|
92
|
+
const [showModal, setShowModal] = useState(false);
|
|
93
|
+
const { getRootProps, getInputProps } = useDropzone({
|
|
94
|
+
accept: "image/*",
|
|
95
|
+
noKeyboard: true,
|
|
96
|
+
multiple: true,
|
|
97
|
+
noClick: true,
|
|
98
|
+
onDrop: (acceptedFiles) => {
|
|
99
|
+
const newImages = [];
|
|
100
|
+
acceptedFiles.map((file) => {
|
|
101
|
+
const reader = new FileReader();
|
|
102
|
+
reader.fileName = file.name;
|
|
103
|
+
reader.onload = async function (e) {
|
|
104
|
+
const ext = e.srcElement.fileName.split(".");
|
|
105
|
+
const img = new Image();
|
|
106
|
+
img.src = e.target.result;
|
|
107
|
+
setTimeout(() => {
|
|
108
|
+
const width = img.width;
|
|
109
|
+
const height = img.height;
|
|
110
|
+
const newImg = {
|
|
111
|
+
action: "addImg",
|
|
112
|
+
img: {
|
|
113
|
+
src: e.target.result,
|
|
114
|
+
name: e.target.fileName,
|
|
115
|
+
ext: ext[ext.length - 1],
|
|
116
|
+
width: width,
|
|
117
|
+
height: height,
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
setImages(newImg);
|
|
121
|
+
}, 500);
|
|
122
|
+
};
|
|
123
|
+
reader.onerror = function (error) {
|
|
124
|
+
console.log("dropzoneError: ", error);
|
|
125
|
+
};
|
|
126
|
+
reader.readAsDataURL(file);
|
|
127
|
+
return file;
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
const [updatedDatasheets, setUpdatedDatasheets] = useState([]);
|
|
132
|
+
const [updatedDescriptions, setUpdatedDescriptions] = useState([]);
|
|
133
|
+
const [imagesUploaded, setImagesUploaded] = useState(false);
|
|
134
|
+
const [dataImages, setDataImages] = useState();
|
|
135
|
+
const [percentages, setPercentages] = useState(
|
|
136
|
+
product?.retailers
|
|
137
|
+
? new Array(product?.retailers?.length).fill({ percentage: 0 })
|
|
138
|
+
: new Array(product?.retailersAvailable?.length).fill({ percentage: 0 })
|
|
139
|
+
);
|
|
140
|
+
const [activePercentage, setActivePercentage] = useState(0);
|
|
141
|
+
const [activeRetailer, setActiveRetailer] = useState({});
|
|
142
|
+
const [services, setServices] = useState([]);
|
|
143
|
+
const [servicesData, setServicesData] = useState([]);
|
|
144
|
+
const [message, setMessage] = useState("");
|
|
145
|
+
const [product, setProduct] = useState(
|
|
146
|
+
JSON.parse(sessionStorage.getItem("productSelected"))
|
|
147
|
+
? JSON.parse(sessionStorage.getItem("productSelected"))
|
|
148
|
+
: productSelected
|
|
149
|
+
);
|
|
150
|
+
const [productEdit, setProductEdit] = useState(
|
|
151
|
+
JSON.parse(sessionStorage.getItem("productEdit"))
|
|
152
|
+
? JSON.parse(sessionStorage.getItem("productEdit"))
|
|
153
|
+
: productToEdit
|
|
154
|
+
);
|
|
155
|
+
const [icon, setIcon] = useState(null);
|
|
156
|
+
const [version, setVersion] = useState(product?.version);
|
|
157
|
+
const [comments, setComments] = useState({});
|
|
158
|
+
const [comment, setComment] = useState("");
|
|
159
|
+
const [requiredNull, setRequiredNull] = useState({
|
|
160
|
+
"Ficha técnica": 0,
|
|
161
|
+
Descripción: 0,
|
|
162
|
+
Imágenes: 0,
|
|
163
|
+
});
|
|
164
|
+
const [crossComment, setCrossComment] = useState(false);
|
|
165
|
+
const [userGroups, setUserGroups] = useState([]);
|
|
166
|
+
const [assig, setAssig] = useState({});
|
|
167
|
+
const [selectedImages, setSelectedImages] = useState([]);
|
|
168
|
+
const [componentsArray, setComponentsArray] = useState([]);
|
|
169
|
+
const [checkAll, setCheckAll] = useState(false);
|
|
170
|
+
const isRetailer = user?.is_retailer;
|
|
171
|
+
const [loading, setLoading] = useState(true);
|
|
172
|
+
const [statusArray, setStatusArray] = useState([]);
|
|
173
|
+
|
|
174
|
+
const originProp = location?.state?.origin;
|
|
175
|
+
const [origin, setOrigin] = useState({
|
|
176
|
+
"Ficha técnica": originProp,
|
|
177
|
+
Descripción: originProp,
|
|
178
|
+
Imágenes: originProp,
|
|
179
|
+
});
|
|
180
|
+
const [inCart, setInCart] = useState(false);
|
|
181
|
+
const [modalSent, setModalSent] = useState(false);
|
|
182
|
+
const [modalViewError, setModalViewError] = useState(false);
|
|
183
|
+
const [showGenericModal, setShowGenericModal] = useState(false);
|
|
184
|
+
const [dataGenericModal, setDataGenericModal] = useState({
|
|
185
|
+
message: "¿Estás seguro de continuar?",
|
|
186
|
+
detail: ` ${
|
|
187
|
+
user.is_retailer
|
|
188
|
+
? "Asegurate de haber revisado las tres secciones"
|
|
189
|
+
: "Envíar el producto a la cadena"
|
|
190
|
+
}`,
|
|
191
|
+
button1: {
|
|
192
|
+
name: "Cerrar",
|
|
193
|
+
action: () => setModalViewTextArea(false),
|
|
194
|
+
},
|
|
195
|
+
button2: {
|
|
196
|
+
name: "Continuar",
|
|
197
|
+
action: () => evaluationToRetailer(false),
|
|
198
|
+
},
|
|
199
|
+
img: face,
|
|
200
|
+
});
|
|
201
|
+
const [modalViewTextArea, setModalViewTextArea] = useState(false);
|
|
202
|
+
const [socketType, setSocketType] = useState(null);
|
|
203
|
+
const [saving, setSaving] = useState(loading);
|
|
204
|
+
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
checkAll && setSelectedImages(images.values);
|
|
207
|
+
}, [checkAll]);
|
|
208
|
+
|
|
209
|
+
const loadData = async () => {
|
|
210
|
+
const services = await getRetailerServices(
|
|
211
|
+
product?.id_article || product?.article?.id_article,
|
|
212
|
+
parseInt(product?.article?.id_category || product?.id_category),
|
|
213
|
+
product?.version
|
|
214
|
+
);
|
|
215
|
+
|
|
216
|
+
//Converts the data inside the datasheets object to array
|
|
217
|
+
setServices(services);
|
|
218
|
+
getServices();
|
|
219
|
+
|
|
220
|
+
if (!originProp) {
|
|
221
|
+
setActiveRetailer(product.retailers[0] || product.availableRetailers[0]);
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
//setActiveRetailer(product?.retailers[0]);
|
|
225
|
+
setImages({
|
|
226
|
+
action: "init",
|
|
227
|
+
init: services[2],
|
|
228
|
+
});
|
|
229
|
+
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
230
|
+
|
|
231
|
+
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
232
|
+
setLoading(false);
|
|
233
|
+
};
|
|
234
|
+
|
|
235
|
+
const getServices = async () => {
|
|
236
|
+
const productInOrder = product.id_order || product.orderId;
|
|
237
|
+
const idArticle = product?.id_article || product?.article?.id_article;
|
|
238
|
+
if (isRevision() || productInOrder) {
|
|
239
|
+
const servicesResponse = await axios.get(
|
|
240
|
+
`${
|
|
241
|
+
process.env.REACT_APP_SERVICES_ENDPOINT
|
|
242
|
+
}?articleId=${idArticle}&orderId=${
|
|
243
|
+
product?.id_order ?? product.orderId
|
|
244
|
+
}&end=true`
|
|
245
|
+
);
|
|
246
|
+
const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
|
|
247
|
+
let retailers = product.retailers || product.retailersAvailable;
|
|
248
|
+
let active = retailers?.filter((retailer) =>
|
|
249
|
+
parsedResponse?.map((srv) => srv.id_retailer).includes(retailer.id)
|
|
250
|
+
)[0];
|
|
251
|
+
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
252
|
+
setServicesData(parsedResponse);
|
|
253
|
+
}
|
|
254
|
+
};
|
|
255
|
+
|
|
256
|
+
const isRevision = () => {
|
|
257
|
+
if (productEdit) {
|
|
258
|
+
const concept = getConcept(activeTab);
|
|
259
|
+
const isRetailer = user.is_retailer === 1;
|
|
260
|
+
const currentService = productEdit?.product[`${concept}_status`];
|
|
261
|
+
const orgn = origin[activeTab];
|
|
262
|
+
const revision = [
|
|
263
|
+
"RequestWithContentoh",
|
|
264
|
+
"RequestWithoutContentoh",
|
|
265
|
+
"Contentoh",
|
|
266
|
+
].includes(orgn);
|
|
267
|
+
if (isRetailer) {
|
|
268
|
+
if (revision && currentService === "AP") return true;
|
|
269
|
+
} else {
|
|
270
|
+
const { product } = productEdit;
|
|
271
|
+
if (
|
|
272
|
+
orgn === "Contentoh" ||
|
|
273
|
+
(["RECEIVED", "IN_PROGRESS"].includes(currentService) &&
|
|
274
|
+
orgn === "RequestWithoutContentoh") ||
|
|
275
|
+
(currentService === "AA" && orgn === "RequestWithContentoh") ||
|
|
276
|
+
(currentService === "RC" &&
|
|
277
|
+
orgn === "RequestWithoutContentoh" &&
|
|
278
|
+
(!product.id_order || !product.orderId))
|
|
279
|
+
)
|
|
280
|
+
return true;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return false;
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
const getCart = async () => {
|
|
287
|
+
const res = await axios.get(process.env.REACT_APP_CART, {
|
|
288
|
+
headers: {
|
|
289
|
+
Authorization: token,
|
|
290
|
+
},
|
|
291
|
+
});
|
|
292
|
+
const arr = JSON.parse(res.data.body).data.map((e) => e.article_id);
|
|
293
|
+
setInCart(arr.some((e) => e.articleId === product.id_article));
|
|
294
|
+
};
|
|
295
|
+
|
|
296
|
+
useEffect(async () => {
|
|
297
|
+
sessionStorage.setItem("user", JSON.stringify(user));
|
|
298
|
+
loadData();
|
|
299
|
+
getCart();
|
|
300
|
+
setUserGroups(await fetchUsers(token));
|
|
301
|
+
let arr = [];
|
|
302
|
+
switch (user.id_role) {
|
|
303
|
+
case 7:
|
|
304
|
+
case 8:
|
|
305
|
+
arr = ["IN_PROGRESS", "RF", "RA"];
|
|
306
|
+
break;
|
|
307
|
+
case 4:
|
|
308
|
+
case 5:
|
|
309
|
+
arr = ["RF", "AF", "AA", "AP", "AC"];
|
|
310
|
+
break;
|
|
311
|
+
case 6:
|
|
312
|
+
arr = ["RP", "RC", "AF"];
|
|
313
|
+
break;
|
|
314
|
+
default:
|
|
315
|
+
arr = [];
|
|
316
|
+
break;
|
|
317
|
+
}
|
|
318
|
+
setStatusArray(arr);
|
|
319
|
+
}, [product]);
|
|
320
|
+
|
|
321
|
+
const loadAssignations = (currentProduct) => {
|
|
322
|
+
setAssig(product?.asignations);
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
useEffect(() => {
|
|
326
|
+
loadAssignations(product);
|
|
327
|
+
}, [userGroups]);
|
|
328
|
+
|
|
329
|
+
useEffect(() => {
|
|
330
|
+
const productTemp = product;
|
|
331
|
+
const retailers = productTemp?.retailersAvailable || productTemp?.retailers;
|
|
332
|
+
retailers?.forEach((retailer) => {
|
|
333
|
+
retailer["percentage"] = percentages?.filter(
|
|
334
|
+
(percent) => retailer?.id === percent?.id_retailer
|
|
335
|
+
)[0]?.percentage;
|
|
336
|
+
});
|
|
337
|
+
|
|
338
|
+
setProduct(productTemp);
|
|
339
|
+
setActivePercentage(retailers[0]?.percentage);
|
|
340
|
+
}, [percentages]);
|
|
341
|
+
|
|
342
|
+
const loadInputs = () => {
|
|
343
|
+
if (services.length > 0) {
|
|
344
|
+
if (services[0][activeRetailer.id]?.data)
|
|
345
|
+
services[0][activeRetailer.id].data = Object.values(
|
|
346
|
+
services[0][activeRetailer.id].data
|
|
347
|
+
);
|
|
348
|
+
setActivePercentage(Math.round(activeRetailer?.percentage, 0));
|
|
349
|
+
|
|
350
|
+
const datagroups = services[0][activeRetailer.id];
|
|
351
|
+
const inputs = services[0]?.inputs;
|
|
352
|
+
const descriptions = services[1]?.filter(
|
|
353
|
+
(service) => service?.id === activeRetailer?.id
|
|
354
|
+
);
|
|
355
|
+
setDatasheets([datagroups, inputs]);
|
|
356
|
+
setDescriptions(descriptions);
|
|
357
|
+
}
|
|
358
|
+
};
|
|
359
|
+
|
|
360
|
+
useEffect(() => {
|
|
361
|
+
loadInputs();
|
|
362
|
+
}, [servicesData, activeRetailer, services]);
|
|
363
|
+
|
|
364
|
+
const thumbs = () => {
|
|
365
|
+
const imageInputs = socketType?.slice();
|
|
366
|
+
const imageType = images?.imageType?.map((e) => ({
|
|
367
|
+
value: e?.id,
|
|
368
|
+
name: e?.name,
|
|
369
|
+
}));
|
|
370
|
+
const imagePackagingType = images?.imagePackagingType?.map((e) => ({
|
|
371
|
+
value: e?.id,
|
|
372
|
+
name: e?.name,
|
|
373
|
+
}));
|
|
374
|
+
return images?.values?.map((image, index) => (
|
|
375
|
+
<GalleryElement
|
|
376
|
+
setCheckAll={setCheckAll}
|
|
377
|
+
key={index}
|
|
378
|
+
image={image}
|
|
379
|
+
gridLayout={imageLayout}
|
|
380
|
+
id={"gallery-element-" + index}
|
|
381
|
+
index={index + "-" + image.name}
|
|
382
|
+
number={index}
|
|
383
|
+
imageType={imageType}
|
|
384
|
+
imagePackagingType={imagePackagingType}
|
|
385
|
+
imageInputs={imageInputs}
|
|
386
|
+
changeImage={setImages}
|
|
387
|
+
selectedImages={selectedImages}
|
|
388
|
+
setSelectedImages={setSelectedImages}
|
|
389
|
+
/>
|
|
390
|
+
));
|
|
391
|
+
};
|
|
392
|
+
|
|
393
|
+
useEffect(() => {
|
|
394
|
+
const imageInputs = images?.inputs?.map((e) => ({
|
|
395
|
+
value: e?.id,
|
|
396
|
+
name: e?.name,
|
|
397
|
+
required: e?.required,
|
|
398
|
+
active: images?.values.some((value) => value?.image_id === e?.id),
|
|
399
|
+
}));
|
|
400
|
+
setSocketType(imageInputs);
|
|
401
|
+
}, [images]);
|
|
402
|
+
|
|
403
|
+
const saveDescriptions = async () => {
|
|
404
|
+
setLoading(true);
|
|
405
|
+
const productTemp = product;
|
|
406
|
+
const dataObject = {
|
|
407
|
+
articleId: product?.id_article,
|
|
408
|
+
articleData: updatedDescriptions,
|
|
409
|
+
};
|
|
410
|
+
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
411
|
+
try {
|
|
412
|
+
await axios.put(
|
|
413
|
+
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
|
|
414
|
+
dataObject,
|
|
415
|
+
{
|
|
416
|
+
headers: {
|
|
417
|
+
Authorization: token,
|
|
418
|
+
},
|
|
419
|
+
}
|
|
420
|
+
);
|
|
421
|
+
if (productTemp.status === "ASSIGNED") {
|
|
422
|
+
productTemp.status = "IN_PROGRESS";
|
|
423
|
+
setProduct(productTemp);
|
|
424
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
setMessage("Descripciones guardadas con éxito");
|
|
428
|
+
loadData();
|
|
429
|
+
} catch (error) {
|
|
430
|
+
console.log(error);
|
|
431
|
+
}
|
|
432
|
+
};
|
|
433
|
+
|
|
434
|
+
const saveDatasheets = async () => {
|
|
435
|
+
setLoading(true);
|
|
436
|
+
const dataObject = {
|
|
437
|
+
articleId: product?.id_article,
|
|
438
|
+
articleData: updatedDatasheets,
|
|
439
|
+
};
|
|
440
|
+
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
441
|
+
try {
|
|
442
|
+
await axios.put(
|
|
443
|
+
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?datasheet=true&version=${version}`,
|
|
444
|
+
dataObject,
|
|
445
|
+
{
|
|
446
|
+
headers: {
|
|
447
|
+
Authorization: token,
|
|
448
|
+
},
|
|
449
|
+
}
|
|
450
|
+
);
|
|
451
|
+
setMessage("Fichas técnicas guardadas");
|
|
452
|
+
if (productTemp.status === "ASSIGNED") {
|
|
453
|
+
productTemp.status = "IN_PROGRESS";
|
|
454
|
+
setProduct(productTemp);
|
|
455
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
456
|
+
}
|
|
457
|
+
loadData();
|
|
458
|
+
} catch (error) {
|
|
459
|
+
console.log(error);
|
|
460
|
+
}
|
|
461
|
+
};
|
|
462
|
+
|
|
463
|
+
const updateImages = useCallback(async () => {
|
|
464
|
+
const imagesList = images?.values?.slice();
|
|
465
|
+
const imagesListTemp = imagesList?.reduce((acc, image) => {
|
|
466
|
+
acc[image?.image_id] = ++acc[image?.image_id] || 0;
|
|
467
|
+
return acc;
|
|
468
|
+
}, {});
|
|
469
|
+
|
|
470
|
+
const duplicated = imagesList?.filter((image) => {
|
|
471
|
+
return imagesListTemp[image?.image_id];
|
|
472
|
+
});
|
|
473
|
+
|
|
474
|
+
const attrForImgs = Object.values(images?.attrForImgs);
|
|
475
|
+
attrForImgs.pop();
|
|
476
|
+
const data = {
|
|
477
|
+
articleId: product?.id_article,
|
|
478
|
+
attrReqImgs: attrForImgs?.map((e) => ({
|
|
479
|
+
attrId: e[0]?.id,
|
|
480
|
+
value: e[0]?.value,
|
|
481
|
+
})),
|
|
482
|
+
articleData: imagesList?.filter((e) => !e.id),
|
|
483
|
+
updateImages: imagesList?.filter((e) => e.id),
|
|
484
|
+
};
|
|
485
|
+
if (product?.orderId) data["orderId"] = product?.orderId;
|
|
486
|
+
let valid =
|
|
487
|
+
data?.articleData?.length === 0
|
|
488
|
+
? true
|
|
489
|
+
: data?.articleData?.every((e, i) => {
|
|
490
|
+
if (e?.image_id && e?.packing_type && e?.image_type) {
|
|
491
|
+
return true;
|
|
492
|
+
}
|
|
493
|
+
return false;
|
|
494
|
+
});
|
|
495
|
+
if (valid && data?.updateImages?.length > 0 && duplicated?.length === 0) {
|
|
496
|
+
valid = data?.updateImages?.every((e, i) => {
|
|
497
|
+
if (e?.image_id && e?.packing_type && e?.image_type) {
|
|
498
|
+
return true;
|
|
499
|
+
}
|
|
500
|
+
return false;
|
|
501
|
+
});
|
|
502
|
+
}
|
|
503
|
+
if (valid && duplicated?.length === 0) {
|
|
504
|
+
setLoading(true);
|
|
505
|
+
try {
|
|
506
|
+
data?.articleData?.forEach((e) => {
|
|
507
|
+
e.uuid = uuidv4();
|
|
508
|
+
});
|
|
509
|
+
setDataImages(data);
|
|
510
|
+
if (data?.articleData?.length > 0) {
|
|
511
|
+
setImagesUploaded(false);
|
|
512
|
+
const promiseArray = [];
|
|
513
|
+
data?.articleData?.forEach((e) => {
|
|
514
|
+
const file = Buffer.from(
|
|
515
|
+
e.src.replace(/^data:image\/\w+;base64,/, ""),
|
|
516
|
+
"base64"
|
|
517
|
+
);
|
|
518
|
+
const params = {
|
|
519
|
+
ACL: "public-read",
|
|
520
|
+
Body: file,
|
|
521
|
+
Bucket: S3_BUCKET,
|
|
522
|
+
Key: `id-${data.articleId}/${version}/${e?.image_id}-${e?.uuid}.${e?.ext}`,
|
|
523
|
+
};
|
|
524
|
+
promiseArray.push(myBucket.putObject(params).promise());
|
|
525
|
+
});
|
|
526
|
+
await Promise.all(promiseArray);
|
|
527
|
+
setImagesUploaded(true);
|
|
528
|
+
} else {
|
|
529
|
+
setImagesUploaded(true);
|
|
530
|
+
}
|
|
531
|
+
} catch (err) {
|
|
532
|
+
console.log(err);
|
|
533
|
+
// setMainLoading(false);
|
|
534
|
+
}
|
|
535
|
+
} else {
|
|
536
|
+
// setMainLoading(false);
|
|
537
|
+
setMessage(
|
|
538
|
+
"Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.\nRecuerda hay campos obligatorios y no podras avanzar si no estan completos."
|
|
539
|
+
);
|
|
540
|
+
}
|
|
541
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
542
|
+
}, [images, imagesUploaded]);
|
|
543
|
+
|
|
544
|
+
useEffect(async () => {
|
|
545
|
+
if (imagesUploaded) {
|
|
546
|
+
dataImages.articleData = dataImages?.articleData.map((e) => {
|
|
547
|
+
delete e.src;
|
|
548
|
+
e.imageID = e.image_id;
|
|
549
|
+
e.packingType = e.packing_type;
|
|
550
|
+
e.imageType = e.image_type;
|
|
551
|
+
if (product?.orderId) e["orderId"] = product?.orderId;
|
|
552
|
+
return e;
|
|
553
|
+
});
|
|
554
|
+
try {
|
|
555
|
+
await axios.put(
|
|
556
|
+
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
557
|
+
dataImages,
|
|
558
|
+
{
|
|
559
|
+
headers: {
|
|
560
|
+
Authorization: token,
|
|
561
|
+
},
|
|
562
|
+
}
|
|
563
|
+
);
|
|
564
|
+
setMessage("Imágenes guardadas con éxito");
|
|
565
|
+
sessionStorage.removeItem("imagesList");
|
|
566
|
+
loadData();
|
|
567
|
+
} catch (error) {
|
|
568
|
+
console.log(error);
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
}, [dataImages, imagesUploaded]);
|
|
572
|
+
|
|
573
|
+
const getConcept = (tab) => {
|
|
574
|
+
switch (tab) {
|
|
575
|
+
case "Descripción":
|
|
576
|
+
return "description";
|
|
577
|
+
case "Ficha técnica":
|
|
578
|
+
return "datasheet";
|
|
579
|
+
case "Imágenes":
|
|
580
|
+
return "images";
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
|
|
584
|
+
const getSectionIcon = () => {
|
|
585
|
+
switch (activeTab) {
|
|
586
|
+
case "Ficha técnica":
|
|
587
|
+
setIcon(attributesSent);
|
|
588
|
+
break;
|
|
589
|
+
case "Descripción":
|
|
590
|
+
setIcon(descriptionSent);
|
|
591
|
+
break;
|
|
592
|
+
case "Imágenes0,,":
|
|
593
|
+
setIcon(imagesSent);
|
|
594
|
+
break;
|
|
595
|
+
default:
|
|
596
|
+
break;
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
const createComment = async (e, body, tab) => {
|
|
601
|
+
let concept = "";
|
|
602
|
+
switch (activeTab) {
|
|
603
|
+
case "Ficha técnica":
|
|
604
|
+
concept = "datasheet";
|
|
605
|
+
break;
|
|
606
|
+
case "Imágenes":
|
|
607
|
+
concept = "images";
|
|
608
|
+
break;
|
|
609
|
+
|
|
610
|
+
default:
|
|
611
|
+
concept = "description";
|
|
612
|
+
break;
|
|
613
|
+
}
|
|
614
|
+
const data = {
|
|
615
|
+
articleId: product?.id_article,
|
|
616
|
+
orderId: product?.orderId,
|
|
617
|
+
message: body,
|
|
618
|
+
concept: concept,
|
|
619
|
+
version: version,
|
|
620
|
+
};
|
|
621
|
+
await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
622
|
+
headers: {
|
|
623
|
+
Authorization: token,
|
|
624
|
+
},
|
|
625
|
+
});
|
|
626
|
+
};
|
|
627
|
+
|
|
628
|
+
useEffect(() => {
|
|
629
|
+
setComment(comments[activeTab]);
|
|
630
|
+
}, [activeTab]);
|
|
631
|
+
|
|
632
|
+
const commentRevised = async () => {
|
|
633
|
+
const data = {
|
|
634
|
+
commentId: comment.id,
|
|
635
|
+
};
|
|
636
|
+
await axios.put(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
637
|
+
headers: {
|
|
638
|
+
Authorization: token,
|
|
639
|
+
},
|
|
640
|
+
});
|
|
641
|
+
setCrossComment(false);
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
const setAssignation = async (assignationType, assignationId) => {
|
|
645
|
+
let concept = "";
|
|
646
|
+
switch (activeTab) {
|
|
647
|
+
case "Ficha técnica":
|
|
648
|
+
concept = "datasheet";
|
|
649
|
+
break;
|
|
650
|
+
case "Imágenes":
|
|
651
|
+
concept = "images";
|
|
652
|
+
break;
|
|
653
|
+
|
|
654
|
+
default:
|
|
655
|
+
concept = "description";
|
|
656
|
+
break;
|
|
657
|
+
}
|
|
658
|
+
const productTemp = product;
|
|
659
|
+
productTemp.article[`id_${concept}_${assignationType}`] = assignationId;
|
|
660
|
+
const data = {
|
|
661
|
+
articleList: [
|
|
662
|
+
{
|
|
663
|
+
orderId: product.orderId,
|
|
664
|
+
articleId: product?.id_article,
|
|
665
|
+
},
|
|
666
|
+
],
|
|
667
|
+
concept: concept,
|
|
668
|
+
[`${assignationType}Id`]: assignationId,
|
|
669
|
+
};
|
|
670
|
+
axios({
|
|
671
|
+
method: "post",
|
|
672
|
+
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
673
|
+
data: data,
|
|
674
|
+
headers: {
|
|
675
|
+
Authorization: token,
|
|
676
|
+
},
|
|
677
|
+
});
|
|
678
|
+
loadAssignations(productTemp);
|
|
679
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
680
|
+
};
|
|
681
|
+
|
|
682
|
+
const evaluationComplete = (tab) => {
|
|
683
|
+
const concept = getConcept(tab);
|
|
684
|
+
let serv = servicesData.filter((item) => item.service === concept);
|
|
685
|
+
if (
|
|
686
|
+
["RequestWithContentoh", "RequestWithoutContentoh"].includes(origin[tab])
|
|
687
|
+
) {
|
|
688
|
+
serv = serv.filter((f) => f.id_retailer === activeRetailer.id);
|
|
689
|
+
}
|
|
690
|
+
const statusArray =
|
|
691
|
+
user.is_retailer === 1 ? ["AC", "RC"] : ["AP", "RP", "AC"];
|
|
692
|
+
return (
|
|
693
|
+
serv.length > 0 && serv.every((item) => statusArray.includes(item.status))
|
|
694
|
+
);
|
|
695
|
+
};
|
|
696
|
+
|
|
697
|
+
const downloadImages = () => {
|
|
698
|
+
selectedImages.forEach((e) => {
|
|
699
|
+
if (e.id) {
|
|
700
|
+
saveAs(
|
|
701
|
+
`https://${process.env.REACT_APP_IMAGES_BUCKET}.s3.amazonaws.com/${e.srcDB}`,
|
|
702
|
+
`${product.article.upc}_${e.name}.${e.ext}`
|
|
703
|
+
);
|
|
704
|
+
}
|
|
705
|
+
});
|
|
706
|
+
};
|
|
707
|
+
|
|
708
|
+
const deleteImages = () => {
|
|
709
|
+
setLoading(true);
|
|
710
|
+
const { values } = images;
|
|
711
|
+
const imgsInBack = [];
|
|
712
|
+
|
|
713
|
+
selectedImages.forEach((selectedImg) => {
|
|
714
|
+
if (selectedImg.id) imgsInBack.push(selectedImg);
|
|
715
|
+
});
|
|
716
|
+
|
|
717
|
+
const imgsLeft = values.filter(
|
|
718
|
+
(value) => selectedImages.indexOf(value) === -1
|
|
719
|
+
);
|
|
720
|
+
|
|
721
|
+
if (imgsInBack.length > 0) {
|
|
722
|
+
const data = {
|
|
723
|
+
articleId: product?.id_article || product?.article?.id_article,
|
|
724
|
+
deleteImages: imgsInBack,
|
|
725
|
+
};
|
|
726
|
+
try {
|
|
727
|
+
axios.put(
|
|
728
|
+
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
729
|
+
data,
|
|
730
|
+
{
|
|
731
|
+
headers: { Authorization: token },
|
|
732
|
+
}
|
|
733
|
+
);
|
|
734
|
+
} catch (err) {
|
|
735
|
+
console.log(err);
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
setImages({
|
|
740
|
+
action: "deleteImage",
|
|
741
|
+
selectedImages,
|
|
742
|
+
});
|
|
743
|
+
|
|
744
|
+
setTimeout(() => {
|
|
745
|
+
setLoading(false);
|
|
746
|
+
}, 500);
|
|
747
|
+
|
|
748
|
+
setMessage("");
|
|
749
|
+
setComponentsArray([]);
|
|
750
|
+
};
|
|
751
|
+
|
|
752
|
+
const askToDeleteImages = () => {
|
|
753
|
+
if (selectedImages.length > 0) {
|
|
754
|
+
setMessage("¿Está seguro de eliminar las imágenes seleccionadas?");
|
|
755
|
+
setComponentsArray([
|
|
756
|
+
<ScreenHeader
|
|
757
|
+
key={"1"}
|
|
758
|
+
text={"¿Está seguro de eliminar las imágenes seleccionadas?"}
|
|
759
|
+
headerType="retailer-name-header"
|
|
760
|
+
color={"white"}
|
|
761
|
+
/>,
|
|
762
|
+
<Button
|
|
763
|
+
key={"2"}
|
|
764
|
+
buttonType="general-white-button"
|
|
765
|
+
label={"Cancelar"}
|
|
766
|
+
onClick={() => setMessage("")}
|
|
767
|
+
/>,
|
|
768
|
+
<Button
|
|
769
|
+
key={"3"}
|
|
770
|
+
buttonType="general-button-default"
|
|
771
|
+
label={"Aceptar"}
|
|
772
|
+
onClick={() => {
|
|
773
|
+
setMessage("");
|
|
774
|
+
deleteImages();
|
|
775
|
+
}}
|
|
776
|
+
/>,
|
|
777
|
+
]);
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
|
|
781
|
+
const specialistValid = (tab) => {
|
|
782
|
+
let concept = "";
|
|
783
|
+
switch (tab) {
|
|
784
|
+
case "Ficha técnica":
|
|
785
|
+
concept = "datasheet";
|
|
786
|
+
break;
|
|
787
|
+
case "Imágenes":
|
|
788
|
+
concept = "images";
|
|
789
|
+
break;
|
|
790
|
+
case "Descripción":
|
|
791
|
+
concept = "description";
|
|
792
|
+
break;
|
|
793
|
+
}
|
|
794
|
+
return (
|
|
795
|
+
product[`${concept}_status`] === "IN_PROGRESS" ||
|
|
796
|
+
product[`${concept}_status`] === "RF" ||
|
|
797
|
+
product[`${concept}_status`] === "RA"
|
|
798
|
+
);
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
const confirmStatusComplete = () => {
|
|
802
|
+
const { datasheet_status, description_status, images_status } = product;
|
|
803
|
+
const completionStates =
|
|
804
|
+
user.is_retailer === 1
|
|
805
|
+
? ["AC", "Evaluated", "NS"]
|
|
806
|
+
: ["AP", "Evaluated", "NS"];
|
|
807
|
+
const dsEvaluated = completionStates.includes(datasheet_status);
|
|
808
|
+
const descsEvaluated = completionStates.includes(description_status);
|
|
809
|
+
const imgsEvaluated = completionStates.includes(images_status);
|
|
810
|
+
|
|
811
|
+
const AllEvaluated = dsEvaluated && descsEvaluated && imgsEvaluated;
|
|
812
|
+
|
|
813
|
+
return AllEvaluated;
|
|
814
|
+
};
|
|
815
|
+
|
|
816
|
+
const sendEvaluation = async (result) => {
|
|
817
|
+
setLoading(true);
|
|
818
|
+
let data = {};
|
|
819
|
+
const retailerId = activeRetailer?.id;
|
|
820
|
+
if (result) {
|
|
821
|
+
data = {
|
|
822
|
+
articleId: product.id_article,
|
|
823
|
+
orderId: product.id_order ?? product.orderId,
|
|
824
|
+
concept: getConcept(activeTab),
|
|
825
|
+
result: result,
|
|
826
|
+
retailerId,
|
|
827
|
+
};
|
|
828
|
+
await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
829
|
+
headers: {
|
|
830
|
+
Authorization: token,
|
|
831
|
+
},
|
|
832
|
+
});
|
|
833
|
+
} else {
|
|
834
|
+
const productTemp = product;
|
|
835
|
+
const concept = getConcept(activeTab);
|
|
836
|
+
productTemp[`${concept}_status`] = "Evaluated";
|
|
837
|
+
data = {
|
|
838
|
+
articleId: product.id_article,
|
|
839
|
+
orderId: product.id_order ?? product.orderId,
|
|
840
|
+
concept,
|
|
841
|
+
retailerId,
|
|
842
|
+
};
|
|
843
|
+
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
844
|
+
headers: {
|
|
845
|
+
Authorization: token,
|
|
846
|
+
},
|
|
847
|
+
});
|
|
848
|
+
setProduct(productTemp);
|
|
849
|
+
setProductEdit({
|
|
850
|
+
ArticleId: productTemp.id_article,
|
|
851
|
+
idCategory: productTemp.article.id_category,
|
|
852
|
+
product: productTemp,
|
|
853
|
+
});
|
|
854
|
+
sessionStorage.setItem(
|
|
855
|
+
"productEdit",
|
|
856
|
+
JSON.stringify({
|
|
857
|
+
ArticleId: productTemp.id_article,
|
|
858
|
+
idCategory: productTemp.article.id_category,
|
|
859
|
+
product: productTemp,
|
|
860
|
+
})
|
|
861
|
+
);
|
|
862
|
+
setOrigin((prev) => ({ ...prev, [concept]: "Evaluated" }));
|
|
863
|
+
}
|
|
864
|
+
loadData();
|
|
865
|
+
showSurvey && showSurvey(confirmStatusComplete());
|
|
866
|
+
};
|
|
867
|
+
|
|
868
|
+
const evaluationToRetailer = async (result) => {
|
|
869
|
+
const data = {
|
|
870
|
+
articleId: product.id_article,
|
|
871
|
+
companyId: user.is_retailer
|
|
872
|
+
? product.provider_company_id
|
|
873
|
+
: product.retailer_company_id,
|
|
874
|
+
versionId: product.version,
|
|
875
|
+
status: result,
|
|
876
|
+
};
|
|
877
|
+
await axios.put(`${process.env.REACT_APP_RETAILER_REQUEST}`, data, {
|
|
878
|
+
headers: {
|
|
879
|
+
Authorization: token,
|
|
880
|
+
},
|
|
881
|
+
});
|
|
882
|
+
const prod = productEdit;
|
|
883
|
+
const statusComplete = user.is_retailer ? `${result}C` : `${result}P`;
|
|
884
|
+
prod.product.datasheet_status = statusComplete;
|
|
885
|
+
prod.product.description_status = statusComplete;
|
|
886
|
+
prod.product.images_status = statusComplete;
|
|
887
|
+
prod.product.article_status = statusComplete;
|
|
888
|
+
prod.product.services_status = `["${statusComplete}","${statusComplete}","${statusComplete}"]`;
|
|
889
|
+
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
890
|
+
setProduct(prod);
|
|
891
|
+
setShowGenericModal && setShowGenericModal(false);
|
|
892
|
+
loadData();
|
|
893
|
+
};
|
|
894
|
+
|
|
895
|
+
const getSectionStatus = () => {
|
|
896
|
+
const concept = getConcept(activeTab);
|
|
897
|
+
return ["AA", "AP", "RECEIVED", "IN_PROGRESS", "RC"].includes(
|
|
898
|
+
productEdit.product[`${concept}_status`]
|
|
899
|
+
);
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
const enableActions = (versionStatus) => {
|
|
903
|
+
if (versionStatus) {
|
|
904
|
+
return ["AP", "AC", "RC"].includes(versionStatus);
|
|
905
|
+
}
|
|
906
|
+
return true;
|
|
907
|
+
};
|
|
908
|
+
|
|
909
|
+
useEffect(() => {
|
|
910
|
+
setSaving(loading);
|
|
911
|
+
}, [loading]);
|
|
912
|
+
|
|
913
|
+
return (
|
|
914
|
+
<Container headerTop={headerTop}>
|
|
915
|
+
<HeaderTop setHeaderTop={setHeaderTop} />
|
|
916
|
+
<div className="data-container">
|
|
917
|
+
<div className="image-data-panel">
|
|
918
|
+
<ImagePreviewer
|
|
919
|
+
activeImage={images?.values ? images?.values[activeImage] : {}}
|
|
920
|
+
imagesArray={images}
|
|
921
|
+
setActiveImage={setActiveImage}
|
|
922
|
+
setShowModal={setShowModal}
|
|
923
|
+
/>
|
|
924
|
+
<ImageDataTable
|
|
925
|
+
lists={images}
|
|
926
|
+
activeImage={images?.values ? images?.values[activeImage] : {}}
|
|
927
|
+
retailerSelected={activeRetailer?.id}
|
|
928
|
+
setImages={setImages}
|
|
929
|
+
assignationsImages={assig}
|
|
930
|
+
imagesStatus={product?.images_status}
|
|
931
|
+
setAssignation={setAssignation}
|
|
932
|
+
isRetailer={isRetailer}
|
|
933
|
+
onClickSave={() =>
|
|
934
|
+
product?.services?.images === 1 && updateImages()
|
|
935
|
+
}
|
|
936
|
+
/>
|
|
937
|
+
</div>
|
|
938
|
+
<div className="product-information">
|
|
939
|
+
<FullProductNameHeader
|
|
940
|
+
headerData={product}
|
|
941
|
+
percent={activePercentage}
|
|
942
|
+
activeRetailer={activeRetailer}
|
|
943
|
+
setActiveRetailer={setActiveRetailer}
|
|
944
|
+
showValidationButtons={isRevision() && getSectionStatus()}
|
|
945
|
+
servicesData={servicesData ? servicesData : null}
|
|
946
|
+
approve={() => {
|
|
947
|
+
if (
|
|
948
|
+
origin[activeTab] === "RequestWithoutContentoh" &&
|
|
949
|
+
!user.is_retailer &&
|
|
950
|
+
(!product.id_order || !product.orderId)
|
|
951
|
+
) {
|
|
952
|
+
setDataGenericModal((prev) => ({
|
|
953
|
+
...prev,
|
|
954
|
+
button2: {
|
|
955
|
+
name: "Continuar",
|
|
956
|
+
action: () => evaluationToRetailer("A"),
|
|
957
|
+
},
|
|
958
|
+
}));
|
|
959
|
+
setShowGenericModal(true);
|
|
960
|
+
} else {
|
|
961
|
+
if (user.is_retailer) {
|
|
962
|
+
if (product.id_order || product.orderId) {
|
|
963
|
+
sendEvaluation("A");
|
|
964
|
+
} else {
|
|
965
|
+
setDataGenericModal((prev) => ({
|
|
966
|
+
...prev,
|
|
967
|
+
button2: {
|
|
968
|
+
name: "Continuar",
|
|
969
|
+
action: () => evaluationToRetailer("A"),
|
|
970
|
+
},
|
|
971
|
+
}));
|
|
972
|
+
setShowGenericModal(true);
|
|
973
|
+
}
|
|
974
|
+
} else {
|
|
975
|
+
sendEvaluation("A");
|
|
976
|
+
}
|
|
977
|
+
}
|
|
978
|
+
}}
|
|
979
|
+
reject={() => {
|
|
980
|
+
if (
|
|
981
|
+
origin[activeTab] === "RequestWithoutContentoh" &&
|
|
982
|
+
!user.is_retailer &&
|
|
983
|
+
(!product.id_order || !product.orderId)
|
|
984
|
+
) {
|
|
985
|
+
return;
|
|
986
|
+
} else {
|
|
987
|
+
if (user.is_retailer) {
|
|
988
|
+
if (product.id_order || product.orderId) {
|
|
989
|
+
sendEvaluation("R");
|
|
990
|
+
setModalViewError(true);
|
|
991
|
+
} else {
|
|
992
|
+
setDataGenericModal((prev) => ({
|
|
993
|
+
...prev,
|
|
994
|
+
button2: {
|
|
995
|
+
name: "Continuar",
|
|
996
|
+
action: () => evaluationToRetailer("R"),
|
|
997
|
+
},
|
|
998
|
+
}));
|
|
999
|
+
setShowGenericModal(true);
|
|
1000
|
+
}
|
|
1001
|
+
} else {
|
|
1002
|
+
sendEvaluation("R");
|
|
1003
|
+
setModalViewError(true);
|
|
1004
|
+
}
|
|
1005
|
+
}
|
|
1006
|
+
}}
|
|
1007
|
+
/>
|
|
1008
|
+
<FullTabsMenu
|
|
1009
|
+
tabsSections={tabsSections}
|
|
1010
|
+
status={
|
|
1011
|
+
product[`${getConcept(activeTab)}_status`] ||
|
|
1012
|
+
product?.version_status
|
|
1013
|
+
}
|
|
1014
|
+
activeTab={activeTab}
|
|
1015
|
+
setActiveTab={setActiveTab}
|
|
1016
|
+
setImageLayout={setImageLayout}
|
|
1017
|
+
downloadImages={downloadImages}
|
|
1018
|
+
askToDeleteImages={askToDeleteImages}
|
|
1019
|
+
assig={assig}
|
|
1020
|
+
setAssignation={setAssignation}
|
|
1021
|
+
isRetailer={isRetailer}
|
|
1022
|
+
showSaveButton={["AP", "AC", "RC"].includes(product.version_status)}
|
|
1023
|
+
onClickSave={() => {
|
|
1024
|
+
switch (activeTab) {
|
|
1025
|
+
case "Descripción":
|
|
1026
|
+
!saving && saveDescriptions();
|
|
1027
|
+
break;
|
|
1028
|
+
case "Ficha técnica":
|
|
1029
|
+
!saving && saveDatasheets();
|
|
1030
|
+
break;
|
|
1031
|
+
case "Imágenes":
|
|
1032
|
+
!saving && updateImages();
|
|
1033
|
+
break;
|
|
1034
|
+
default:
|
|
1035
|
+
break;
|
|
1036
|
+
}
|
|
1037
|
+
}}
|
|
1038
|
+
/>
|
|
1039
|
+
<div
|
|
1040
|
+
className={
|
|
1041
|
+
"services-information-container " +
|
|
1042
|
+
(imageLayout && activeTab === "Imágenes" ? "image-services" : "")
|
|
1043
|
+
}
|
|
1044
|
+
>
|
|
1045
|
+
{loading ? (
|
|
1046
|
+
<Loading />
|
|
1047
|
+
) : (
|
|
1048
|
+
<>
|
|
1049
|
+
{!imageLayout && activeTab === "Imágenes" && (
|
|
1050
|
+
<GalleryHeader
|
|
1051
|
+
setSelectedImages={setSelectedImages}
|
|
1052
|
+
checkAll={checkAll}
|
|
1053
|
+
setCheckAll={setCheckAll}
|
|
1054
|
+
/>
|
|
1055
|
+
)}
|
|
1056
|
+
{activeTab === "Ficha técnica" &&
|
|
1057
|
+
(product?.datasheet_status !== "NS" ? (
|
|
1058
|
+
datasheets[0]?.data?.map((dataGroup, index) => (
|
|
1059
|
+
<InputGroup
|
|
1060
|
+
key={index + "-" + activeRetailer.name}
|
|
1061
|
+
articleId={product.id_article}
|
|
1062
|
+
version={version}
|
|
1063
|
+
activeSection={activeTab}
|
|
1064
|
+
inputGroup={dataGroup}
|
|
1065
|
+
dataInputs={datasheets[1]}
|
|
1066
|
+
updatedDatasheets={updatedDatasheets}
|
|
1067
|
+
setUpdatedDatasheets={setUpdatedDatasheets}
|
|
1068
|
+
//enableActions={enableActions(product.version_status)} ADD THIS VALIDATION
|
|
1069
|
+
/>
|
|
1070
|
+
))
|
|
1071
|
+
) : (
|
|
1072
|
+
<ScreenHeader
|
|
1073
|
+
text={"No cuentas con este servicio"}
|
|
1074
|
+
headerType={"input-name-header"}
|
|
1075
|
+
/>
|
|
1076
|
+
))}
|
|
1077
|
+
{activeTab === "Descripción" &&
|
|
1078
|
+
(product?.description_status !== "NS" ? (
|
|
1079
|
+
<InputGroup
|
|
1080
|
+
activeSection={activeTab}
|
|
1081
|
+
inputGroup={descriptions[0]}
|
|
1082
|
+
updatedDescriptions={updatedDescriptions}
|
|
1083
|
+
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
1084
|
+
articleId={product?.id_article}
|
|
1085
|
+
version={version}
|
|
1086
|
+
dinamicHeight={true}
|
|
1087
|
+
/>
|
|
1088
|
+
) : (
|
|
1089
|
+
<ScreenHeader
|
|
1090
|
+
text={"No cuentas con este servicio"}
|
|
1091
|
+
headerType={"input-name-header"}
|
|
1092
|
+
/>
|
|
1093
|
+
))}
|
|
1094
|
+
|
|
1095
|
+
{activeTab === "Imágenes" &&
|
|
1096
|
+
(product?.images_status !== "NS" ? (
|
|
1097
|
+
<section className="container">
|
|
1098
|
+
<div {...getRootProps({ className: "dropzone" })}>
|
|
1099
|
+
<input {...getInputProps()} />
|
|
1100
|
+
<aside>{thumbs()}</aside>
|
|
1101
|
+
</div>
|
|
1102
|
+
</section>
|
|
1103
|
+
) : (
|
|
1104
|
+
<ScreenHeader
|
|
1105
|
+
text={"No cuentas con este servicio"}
|
|
1106
|
+
headerType={"input-name-header"}
|
|
1107
|
+
/>
|
|
1108
|
+
))}
|
|
1109
|
+
</>
|
|
1110
|
+
)}
|
|
1111
|
+
</div>
|
|
1112
|
+
{isRevision() && getSectionStatus() ? (
|
|
1113
|
+
<div className="commentary-box">
|
|
1114
|
+
{!comment ? (
|
|
1115
|
+
<div className="commentary">
|
|
1116
|
+
<TagAndInput
|
|
1117
|
+
label={"Caja de Comentario"}
|
|
1118
|
+
inputType={"textarea"}
|
|
1119
|
+
inputCols={80}
|
|
1120
|
+
inputRows={4}
|
|
1121
|
+
inputId={"commentary-box"}
|
|
1122
|
+
index={0}
|
|
1123
|
+
/>
|
|
1124
|
+
<div className="buttons-box">
|
|
1125
|
+
<Button
|
|
1126
|
+
buttonType={"general-transparent-button"}
|
|
1127
|
+
label={"Enviar comentario"}
|
|
1128
|
+
onClick={(e) =>
|
|
1129
|
+
createComment(
|
|
1130
|
+
e,
|
|
1131
|
+
document.querySelector(
|
|
1132
|
+
"#description-commentary-box-0 .ql-container .ql-editor > p"
|
|
1133
|
+
).innerHTML,
|
|
1134
|
+
activeTab
|
|
1135
|
+
)
|
|
1136
|
+
}
|
|
1137
|
+
/>
|
|
1138
|
+
</div>
|
|
1139
|
+
</div>
|
|
1140
|
+
) : (
|
|
1141
|
+
<div className="feedback-box">
|
|
1142
|
+
<Commentary
|
|
1143
|
+
comment={comment.message}
|
|
1144
|
+
reviewed={crossComment}
|
|
1145
|
+
/>
|
|
1146
|
+
<Button
|
|
1147
|
+
buttonType={"circular-button accept-button"}
|
|
1148
|
+
onClick={async () => {
|
|
1149
|
+
setCrossComment(true);
|
|
1150
|
+
commentRevised();
|
|
1151
|
+
}}
|
|
1152
|
+
/>
|
|
1153
|
+
</div>
|
|
1154
|
+
)}
|
|
1155
|
+
<Button
|
|
1156
|
+
buttonType={
|
|
1157
|
+
evaluationComplete(activeTab) &&
|
|
1158
|
+
(productEdit.product.id_order || productEdit.product.orderId)
|
|
1159
|
+
? "general-green-button"
|
|
1160
|
+
: "general-button-disabled"
|
|
1161
|
+
}
|
|
1162
|
+
label={"Enviar evaluación"}
|
|
1163
|
+
onClick={() => {
|
|
1164
|
+
//setModalSent(true);
|
|
1165
|
+
sendEvaluation();
|
|
1166
|
+
setMessage(`¡Evaluación de ${activeTab} completada!`);
|
|
1167
|
+
}}
|
|
1168
|
+
/>
|
|
1169
|
+
</div>
|
|
1170
|
+
) : revision ? null : (
|
|
1171
|
+
<div className="required-inputs-message">
|
|
1172
|
+
<div>
|
|
1173
|
+
<p>
|
|
1174
|
+
Los atributos son requeridos por las plataformas de las
|
|
1175
|
+
cadenas, es muy importante completar los campos requeridos ya
|
|
1176
|
+
que pueden rechazar el producto por falta de información.
|
|
1177
|
+
</p>
|
|
1178
|
+
</div>
|
|
1179
|
+
{inCart ? (
|
|
1180
|
+
<button type="button">
|
|
1181
|
+
<Link to="/checkout">
|
|
1182
|
+
<p>Articulo en carrito</p>
|
|
1183
|
+
<p>Ir a checkout</p>
|
|
1184
|
+
</Link>
|
|
1185
|
+
</button>
|
|
1186
|
+
) : (
|
|
1187
|
+
<Button
|
|
1188
|
+
onClick={() => {
|
|
1189
|
+
setShowContentohRequestModal &&
|
|
1190
|
+
setShowContentohRequestModal(true);
|
|
1191
|
+
}}
|
|
1192
|
+
buttonType="general-default-button"
|
|
1193
|
+
label="Enviar a Content-oh!"
|
|
1194
|
+
/>
|
|
1195
|
+
)}
|
|
1196
|
+
</div>
|
|
1197
|
+
)}
|
|
1198
|
+
</div>
|
|
1199
|
+
</div>
|
|
1200
|
+
{showModal && (
|
|
1201
|
+
<ProductImageModal images={images} setShowModal={setShowModal} />
|
|
1202
|
+
)}
|
|
1203
|
+
{message.length > 0 && !showSurvey && (
|
|
1204
|
+
<GenericModal
|
|
1205
|
+
buttonType={componentsArray.length > 0 && "delete-product"}
|
|
1206
|
+
componentsArray={
|
|
1207
|
+
componentsArray.length > 0
|
|
1208
|
+
? componentsArray
|
|
1209
|
+
: [
|
|
1210
|
+
<img key="1" src={succes} alt="success icon" />,
|
|
1211
|
+
<ScreenHeader
|
|
1212
|
+
key="2"
|
|
1213
|
+
headerType={"retailer-name-header"}
|
|
1214
|
+
text={message}
|
|
1215
|
+
color={"white"}
|
|
1216
|
+
/>,
|
|
1217
|
+
]
|
|
1218
|
+
}
|
|
1219
|
+
onClick={() => setMessage("")}
|
|
1220
|
+
/>
|
|
1221
|
+
)}
|
|
1222
|
+
{modalSent && (
|
|
1223
|
+
<GlobalModal
|
|
1224
|
+
close={() => setModalSent(false)}
|
|
1225
|
+
message={message}
|
|
1226
|
+
detail={""}
|
|
1227
|
+
bold={!evaluationComplete(activeTab) && "Aprueba / Rechaza"}
|
|
1228
|
+
widthImg={!evaluationComplete(activeTab) ? "160px" : "354px"}
|
|
1229
|
+
heightImg={!evaluationComplete(activeTab) ? "84px" : "354px"}
|
|
1230
|
+
img={getSectionIcon()}
|
|
1231
|
+
/>
|
|
1232
|
+
)}
|
|
1233
|
+
{modalViewError && (
|
|
1234
|
+
<GlobalModal
|
|
1235
|
+
close={() => setModalViewError(false)}
|
|
1236
|
+
message={`${activeTab} rechazada`}
|
|
1237
|
+
detail={"Agrega tu comentarios para enviar el rechazo"}
|
|
1238
|
+
button1={{
|
|
1239
|
+
name: "Enviar",
|
|
1240
|
+
action: (e) => {
|
|
1241
|
+
createComment(e, document.querySelector("#area").value);
|
|
1242
|
+
setModalViewError(false);
|
|
1243
|
+
setModalViewTextArea(true);
|
|
1244
|
+
},
|
|
1245
|
+
}}
|
|
1246
|
+
img={errorModal}
|
|
1247
|
+
textArea={true}
|
|
1248
|
+
/>
|
|
1249
|
+
)}
|
|
1250
|
+
{showGenericModal && (
|
|
1251
|
+
<GlobalModal
|
|
1252
|
+
close={() => setShowGenericModal(false)}
|
|
1253
|
+
message={dataGenericModal.message}
|
|
1254
|
+
detail={dataGenericModal.detail}
|
|
1255
|
+
button1={dataGenericModal.button1}
|
|
1256
|
+
button2={dataGenericModal.button2}
|
|
1257
|
+
img={dataGenericModal.img}
|
|
1258
|
+
/>
|
|
1259
|
+
)}
|
|
1260
|
+
{modalViewTextArea && (
|
|
1261
|
+
<GlobalModal
|
|
1262
|
+
close={() => setModalViewTextArea(false)}
|
|
1263
|
+
message={`Gracias, tus comentarios fueron entregados.`}
|
|
1264
|
+
detail={"Trabajaremos en conjunto para resolverlo."}
|
|
1265
|
+
button1={{
|
|
1266
|
+
name: "Cerrar",
|
|
1267
|
+
action: () => setModalViewTextArea(false),
|
|
1268
|
+
}}
|
|
1269
|
+
img={face}
|
|
1270
|
+
textArea={false}
|
|
1271
|
+
/>
|
|
1272
|
+
)}
|
|
1273
|
+
</Container>
|
|
1274
|
+
);
|
|
1275
|
+
};
|