contentoh-components-library 21.4.69 → 21.4.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/images/Icons/infoNR.svg +8 -0
- package/dist/assets/images/flagsv2/highPriority.svg +3 -0
- package/dist/assets/images/flagsv2/lowPriority.svg +3 -0
- package/dist/assets/images/flagsv2/mediumPriority.svg +3 -0
- package/dist/assets/images/flagsv2/noPriority.svg +3 -0
- package/dist/assets/images/generalButton/closeIconWhite.svg +4 -0
- package/dist/assets/images/generalButton/closeIconv2.svg +4 -0
- package/dist/components/atoms/CharsMissing/Wysiwyg.stories.js +30 -0
- package/dist/components/atoms/CharsMissing/index.js +89 -0
- package/dist/components/atoms/CharsMissing/styles.js +33 -0
- package/dist/components/atoms/FeatureTagv2/FeatureTagv2.stories.js +32 -0
- package/dist/components/atoms/FeatureTagv2/index.js +29 -0
- package/dist/components/atoms/FeatureTagv2/styles.js +22 -0
- package/dist/components/atoms/GeneralButton/styles.js +6 -2
- package/dist/components/atoms/GeneralInputv2/GeneralInputv2.stories.js +50 -0
- package/dist/components/atoms/GeneralInputv2/index.js +188 -0
- package/dist/components/atoms/GeneralInputv2/styles.js +29 -0
- package/dist/components/atoms/InputFormatter/styles.js +3 -3
- package/dist/components/atoms/InputFormatterv2/Wysiwyg.stories.js +30 -0
- package/dist/components/atoms/InputFormatterv2/index.js +182 -0
- package/dist/components/atoms/InputFormatterv2/styles.js +33 -0
- package/dist/components/atoms/InputImages/InputImages.stories.js +34 -0
- package/dist/components/atoms/InputImages/index.js +46 -0
- package/dist/components/atoms/InputImages/styles.js +20 -0
- package/dist/components/atoms/NumberMandatory/NumberMandatory.stories.js +34 -0
- package/dist/components/atoms/NumberMandatory/index.js +35 -0
- package/dist/components/atoms/NumberMandatory/styles.js +20 -0
- package/dist/components/atoms/PriorityFlagv2/PriorityFlagv2.stories.js +38 -0
- package/dist/components/atoms/PriorityFlagv2/index.js +37 -0
- package/dist/components/atoms/PriorityFlagv2/styles.js +18 -0
- package/dist/components/atoms/ProductImagev2/ProductImagev2.stories.js +39 -0
- package/dist/components/atoms/ProductImagev2/index.js +34 -0
- package/dist/components/atoms/ProductImagev2/styles.js +18 -0
- package/dist/components/atoms/Progress/Progress.stories.js +49 -0
- package/dist/components/atoms/Progress/index.js +74 -0
- package/dist/components/atoms/Progress/styles.js +30 -0
- package/dist/components/atoms/ScreenHeaderv2/ScreenHeaderv2.stories.js +67 -0
- package/dist/components/atoms/ScreenHeaderv2/index.js +169 -0
- package/dist/components/atoms/ScreenHeaderv2/styles.js +40 -0
- package/dist/components/atoms/Selectv2/VersionSelect.js +38 -0
- package/dist/components/atoms/Selectv2/index.js +40 -0
- package/dist/components/atoms/Selectv2/style.js +38 -0
- package/dist/components/atoms/TabSectionv2/TabSection.stories.js +39 -0
- package/dist/components/atoms/TabSectionv2/index.js +26 -0
- package/dist/components/atoms/TabSectionv2/styles.js +20 -0
- package/dist/components/atoms/TooltipLight/Tooltip.stories.js +36 -0
- package/dist/components/atoms/TooltipLight/index.js +117 -0
- package/dist/components/atoms/TooltipLight/styles.js +23 -0
- package/dist/components/atoms/WordsMissing/Wysiwyg.stories.js +30 -0
- package/dist/components/atoms/WordsMissing/index.js +89 -0
- package/dist/components/atoms/WordsMissing/styles.js +20 -0
- package/dist/components/molecules/AsignationInfo/AsignationInfo.stories.js +34 -0
- package/dist/components/molecules/AsignationInfo/index.js +137 -0
- package/dist/components/molecules/AsignationInfo/styles.js +20 -0
- package/dist/components/molecules/EditionActiveImagev2/EditionActiveImagev2.stories.js +28 -0
- package/dist/components/molecules/EditionActiveImagev2/index.js +34 -0
- package/dist/components/molecules/EditionActiveImagev2/styles.js +18 -0
- package/dist/components/molecules/FeaturesBarv2/FeaturesBarv2.stories.js +45 -0
- package/dist/components/molecules/FeaturesBarv2/index.js +49 -0
- package/dist/components/molecules/FeaturesBarv2/styles.js +18 -0
- package/dist/components/molecules/GalleryElementv2/GalleryElementv2.stories.js +45 -0
- package/dist/components/molecules/GalleryElementv2/index.js +164 -0
- package/dist/components/molecules/GalleryElementv2/styles.js +20 -0
- package/dist/components/molecules/GalleryHeaderv2/GalleryHeaderv2.stories.js +28 -0
- package/dist/components/molecules/GalleryHeaderv2/index.js +61 -0
- package/dist/components/molecules/GalleryHeaderv2/styles.js +20 -0
- package/dist/components/molecules/HeaderTopv2/HeaderTopv2.stories.js +27 -0
- package/dist/components/molecules/HeaderTopv2/index.js +123 -0
- package/dist/components/molecules/HeaderTopv2/styles.js +18 -0
- package/dist/components/molecules/ImageSelectorv2/ImageSelectorv2.stories.js +55 -0
- package/dist/components/molecules/ImageSelectorv2/index.js +36 -0
- package/dist/components/molecules/ImageSelectorv2/styles.js +18 -0
- package/dist/components/molecules/Phase/Phase.stories.js +65 -0
- package/dist/components/molecules/Phase/index.js +104 -0
- package/dist/components/molecules/Phase/styles.js +24 -0
- package/dist/components/molecules/ProductNameHeaderv2/ProductNameHeaderv2.stories.js +65 -0
- package/dist/components/molecules/ProductNameHeaderv2/index.js +24 -0
- package/dist/components/molecules/ProductNameHeaderv2/styles.js +18 -0
- package/dist/components/molecules/ProductSkuStatus/ProductSkuStatus.stories.js +65 -0
- package/dist/components/molecules/ProductSkuStatus/index.js +36 -0
- package/dist/components/molecules/ProductSkuStatus/styles.js +18 -0
- package/dist/components/molecules/RetailerSelectorv2/RetailerSelectorv2.stories.js +48 -0
- package/dist/components/molecules/RetailerSelectorv2/index.js +109 -0
- package/dist/components/molecules/RetailerSelectorv2/styles.js +20 -0
- package/dist/components/molecules/ServiceDataValidator/ServiceDataValidator.stories.js +99 -0
- package/dist/components/molecules/ServiceDataValidator/index.js +57 -0
- package/dist/components/molecules/ServiceDataValidator/styles.js +20 -0
- package/dist/components/molecules/StatusRetailer/StatusAsignationInfo.stories.js +34 -0
- package/dist/components/molecules/StatusRetailer/index.js +74 -0
- package/dist/components/molecules/StatusRetailer/styles.js +20 -0
- package/dist/components/molecules/TabsMenuv2/TabsMenuv2.stories.js +35 -0
- package/dist/components/molecules/TabsMenuv2/index.js +145 -0
- package/dist/components/molecules/TabsMenuv2/styles.js +18 -0
- package/dist/components/molecules/TagAndInputv2/TagAndInputv2.stories.js +41 -0
- package/dist/components/molecules/TagAndInputv2/index.js +92 -0
- package/dist/components/molecules/TagAndInputv2/styles.js +29 -0
- package/dist/components/molecules/Validation/Validation.stories.js +28 -0
- package/dist/components/molecules/Validation/index.js +89 -0
- package/dist/components/molecules/Validation/styles.js +18 -0
- package/dist/components/molecules/VersionItemv2/VersionItemv2.stories.js +28 -0
- package/dist/components/molecules/VersionItemv2/index.js +74 -0
- package/dist/components/molecules/VersionItemv2/styles.js +20 -0
- package/dist/components/organisms/BarButtons/BarButtons.stories.js +30 -0
- package/dist/components/organisms/BarButtons/index.js +186 -0
- package/dist/components/organisms/BarButtons/styles.js +24 -0
- package/dist/components/organisms/Chatv2/ChatLists/ChatLists.stories.js +83 -0
- package/dist/components/organisms/Chatv2/ChatLists/index.js +160 -0
- package/dist/components/organisms/Chatv2/ChatLists/styles.js +29 -0
- package/dist/components/organisms/Chatv2/Chatv2.stories.js +194 -0
- package/dist/components/organisms/Chatv2/ContainerItems/ContainerItems.stories.js +176 -0
- package/dist/components/organisms/Chatv2/ContainerItems/index.js +556 -0
- package/dist/components/organisms/Chatv2/ContainerItems/styles.js +20 -0
- package/dist/components/organisms/Chatv2/ContentChat/ContentChat.stories.js +142 -0
- package/dist/components/organisms/Chatv2/ContentChat/index.js +1679 -0
- package/dist/components/organisms/Chatv2/ContentChat/styles.js +20 -0
- package/dist/components/organisms/Chatv2/Footer/Footer.stories.js +43 -0
- package/dist/components/organisms/Chatv2/Footer/index.js +984 -0
- package/dist/components/organisms/Chatv2/Footer/styles.js +32 -0
- package/dist/components/organisms/Chatv2/Header/Header.stories.js +96 -0
- package/dist/components/organisms/Chatv2/Header/index.js +83 -0
- package/dist/components/organisms/Chatv2/Header/styles.js +20 -0
- package/dist/components/organisms/Chatv2/index.js +306 -0
- package/dist/components/organisms/Chatv2/styles.js +34 -0
- package/dist/components/organisms/CompleteServices/CompleteServices.stories.js +100 -0
- package/dist/components/organisms/CompleteServices/index.js +93 -0
- package/dist/components/organisms/CompleteServices/styles.js +20 -0
- package/dist/components/organisms/DragAndDropPhases/DragAndDropPhases.stories.js +28 -0
- package/dist/components/organisms/DragAndDropPhases/index.js +110 -0
- package/dist/components/organisms/DragAndDropPhases/styles.js +20 -0
- package/dist/components/organisms/DragPrueba/DragPrueba.stories.js +28 -0
- package/dist/components/organisms/DragPrueba/index.js +95 -0
- package/dist/components/organisms/DragPrueba/styles.js +20 -0
- package/dist/components/organisms/FullProductNamev2/FullProductNamev2.stories.js +54 -0
- package/dist/components/organisms/FullProductNamev2/index.js +112 -0
- package/dist/components/organisms/FullProductNamev2/styles.js +20 -0
- package/dist/components/organisms/FullTabsMenuv2/FullTabsMenuv2.stories.js +39 -0
- package/dist/components/organisms/FullTabsMenuv2/index.js +168 -0
- package/dist/components/organisms/FullTabsMenuv2/styles.js +18 -0
- package/dist/components/organisms/ImageDataTablev2/ImageDataTablev2.stories.js +50 -0
- package/dist/components/organisms/ImageDataTablev2/index.js +128 -0
- package/dist/components/organisms/ImageDataTablev2/styles.js +26 -0
- package/dist/components/organisms/ImagePreviewerv2/ImagePreviewerv2.stories.js +48 -0
- package/dist/components/organisms/ImagePreviewerv2/index.js +36 -0
- package/dist/components/organisms/ImagePreviewerv2/styles.js +18 -0
- package/dist/components/organisms/InputGroupv2/InputGroupv2.stories.js +73 -0
- package/dist/components/organisms/InputGroupv2/index.js +228 -0
- package/dist/components/organisms/InputGroupv2/styles.js +28 -0
- package/dist/components/organisms/MandatoryBar/MandatoryBar.stories.js +31 -0
- package/dist/components/organisms/MandatoryBar/index.js +38 -0
- package/dist/components/organisms/MandatoryBar/styles.js +20 -0
- package/dist/components/organisms/ProductImageModalv2/ProductImageModalv2.stories.js +153 -0
- package/dist/components/organisms/ProductImageModalv2/index.js +106 -0
- package/dist/components/organisms/ProductImageModalv2/styles.js +20 -0
- package/dist/components/organisms/RenameImagesBar/RenameImagesBar.stories.js +31 -0
- package/dist/components/organisms/RenameImagesBar/index.js +38 -0
- package/dist/components/organisms/RenameImagesBar/styles.js +20 -0
- package/dist/components/organisms/VersionSelector/index.js +2 -4
- package/dist/components/organisms/VersionSelectorv2/VersionSelectorv2.stories.js +32 -0
- package/dist/components/organisms/VersionSelectorv2/index.js +166 -0
- package/dist/components/organisms/VersionSelectorv2/styles.js +20 -0
- package/dist/components/pages/ProductEditionv2/ProductEditionv2.stories.js +222 -0
- package/dist/components/pages/ProductEditionv2/index.js +2495 -0
- package/dist/components/pages/ProductEditionv2/styles.js +23 -0
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +34 -38
- package/dist/components/pages/ProviderProductEdition/index.js +63 -52
- package/dist/global-files/variables.js +3 -1
- package/package.json +1 -1
- package/src/assets/images/Icons/infoNR.svg +8 -0
- package/src/assets/images/flagsv2/highPriority.svg +3 -0
- package/src/assets/images/flagsv2/lowPriority.svg +3 -0
- package/src/assets/images/flagsv2/mediumPriority.svg +3 -0
- package/src/assets/images/flagsv2/noPriority.svg +3 -0
- package/src/assets/images/generalButton/closeIconWhite.svg +4 -0
- package/src/assets/images/generalButton/closeIconv2.svg +4 -0
- package/src/components/atoms/CharsMissing/Wysiwyg.stories.js +12 -0
- package/src/components/atoms/CharsMissing/index.js +60 -0
- package/src/components/atoms/CharsMissing/styles.js +44 -0
- package/src/components/atoms/FeatureTagv2/FeatureTagv2.stories.js +16 -0
- package/src/components/atoms/FeatureTagv2/index.js +10 -0
- package/src/components/atoms/FeatureTagv2/styles.js +56 -0
- package/src/components/atoms/GeneralButton/styles.js +46 -0
- package/src/components/atoms/GeneralInputv2/GeneralInputv2.stories.js +33 -0
- package/src/components/atoms/GeneralInputv2/index.js +155 -0
- package/src/components/atoms/GeneralInputv2/styles.js +67 -0
- package/src/components/atoms/InputFormatter/styles.js +7 -3
- package/src/components/atoms/InputFormatterv2/Wysiwyg.stories.js +12 -0
- package/src/components/atoms/InputFormatterv2/index.js +148 -0
- package/src/components/atoms/InputFormatterv2/styles.js +39 -0
- package/src/components/atoms/InputImages/InputImages.stories.js +19 -0
- package/src/components/atoms/InputImages/index.js +25 -0
- package/src/components/atoms/InputImages/styles.js +17 -0
- package/src/components/atoms/NumberMandatory/NumberMandatory.stories.js +19 -0
- package/src/components/atoms/NumberMandatory/index.js +16 -0
- package/src/components/atoms/NumberMandatory/styles.js +11 -0
- package/src/components/atoms/PriorityFlagv2/PriorityFlagv2.stories.js +20 -0
- package/src/components/atoms/PriorityFlagv2/index.js +20 -0
- package/src/components/atoms/PriorityFlagv2/styles.js +6 -0
- package/src/components/atoms/ProductImagev2/ProductImagev2.stories.js +28 -0
- package/src/components/atoms/ProductImagev2/index.js +16 -0
- package/src/components/atoms/ProductImagev2/styles.js +62 -0
- package/src/components/atoms/Progress/Progress.stories.js +25 -0
- package/src/components/atoms/Progress/index.js +74 -0
- package/src/components/atoms/Progress/styles.js +98 -0
- package/src/components/atoms/ScreenHeaderv2/ScreenHeaderv2.stories.js +53 -0
- package/src/components/atoms/ScreenHeaderv2/index.js +134 -0
- package/src/components/atoms/ScreenHeaderv2/styles.js +103 -0
- package/src/components/atoms/Selectv2/VersionSelect.js +27 -0
- package/src/components/atoms/Selectv2/index.js +35 -0
- package/src/components/atoms/Selectv2/style.js +93 -0
- package/src/components/atoms/TabSection/index.js +1 -1
- package/src/components/atoms/TabSectionv2/TabSection.stories.js +25 -0
- package/src/components/atoms/TabSectionv2/index.js +9 -0
- package/src/components/atoms/TabSectionv2/styles.js +20 -0
- package/src/components/atoms/TooltipLight/Tooltip.stories.js +20 -0
- package/src/components/atoms/TooltipLight/index.js +46 -0
- package/src/components/atoms/TooltipLight/styles.js +65 -0
- package/src/components/atoms/WordsMissing/Wysiwyg.stories.js +12 -0
- package/src/components/atoms/WordsMissing/index.js +60 -0
- package/src/components/atoms/WordsMissing/styles.js +10 -0
- package/src/components/molecules/AsignationInfo/AsignationInfo.stories.js +17 -0
- package/src/components/molecules/AsignationInfo/index.js +108 -0
- package/src/components/molecules/AsignationInfo/styles.js +86 -0
- package/src/components/molecules/EditionActiveImagev2/EditionActiveImagev2.stories.js +12 -0
- package/src/components/molecules/EditionActiveImagev2/index.js +15 -0
- package/src/components/molecules/EditionActiveImagev2/styles.js +7 -0
- package/src/components/molecules/FeaturesBarv2/FeaturesBarv2.stories.js +20 -0
- package/src/components/molecules/FeaturesBarv2/index.js +32 -0
- package/src/components/molecules/FeaturesBarv2/styles.js +17 -0
- package/src/components/molecules/GalleryElementv2/GalleryElementv2.stories.js +30 -0
- package/src/components/molecules/GalleryElementv2/index.js +142 -0
- package/src/components/molecules/GalleryElementv2/styles.js +119 -0
- package/src/components/molecules/GalleryHeaderv2/GalleryHeaderv2.stories.js +10 -0
- package/src/components/molecules/GalleryHeaderv2/index.js +25 -0
- package/src/components/molecules/GalleryHeaderv2/styles.js +47 -0
- package/src/components/molecules/HeaderTopv2/HeaderTopv2.stories.js +10 -0
- package/src/components/molecules/HeaderTopv2/index.js +100 -0
- package/src/components/molecules/HeaderTopv2/styles.js +33 -0
- package/src/components/molecules/ImageSelectorv2/ImageSelectorv2.stories.js +46 -0
- package/src/components/molecules/ImageSelectorv2/index.js +22 -0
- package/src/components/molecules/ImageSelectorv2/styles.js +15 -0
- package/src/components/molecules/Phase/Phase.stories.js +37 -0
- package/src/components/molecules/Phase/index.js +56 -0
- package/src/components/molecules/Phase/styles.js +82 -0
- package/src/components/molecules/ProductNameHeaderv2/ProductNameHeaderv2.stories.js +37 -0
- package/src/components/molecules/ProductNameHeaderv2/index.js +12 -0
- package/src/components/molecules/ProductNameHeaderv2/styles.js +10 -0
- package/src/components/molecules/ProductSkuStatus/ProductSkuStatus.stories.js +37 -0
- package/src/components/molecules/ProductSkuStatus/index.js +26 -0
- package/src/components/molecules/ProductSkuStatus/styles.js +7 -0
- package/src/components/molecules/RetailerSelectorv2/RetailerSelectorv2.stories.js +35 -0
- package/src/components/molecules/RetailerSelectorv2/index.js +80 -0
- package/src/components/molecules/RetailerSelectorv2/styles.js +21 -0
- package/src/components/molecules/ServiceDataValidator/ServiceDataValidator.stories.js +90 -0
- package/src/components/molecules/ServiceDataValidator/index.js +49 -0
- package/src/components/molecules/ServiceDataValidator/styles.js +36 -0
- package/src/components/molecules/StatusRetailer/StatusAsignationInfo.stories.js +17 -0
- package/src/components/molecules/StatusRetailer/index.js +55 -0
- package/src/components/molecules/StatusRetailer/styles.js +85 -0
- package/src/components/molecules/TabsMenuv2/TabsMenuv2.stories.js +19 -0
- package/src/components/molecules/TabsMenuv2/index.js +112 -0
- package/src/components/molecules/TabsMenuv2/styles.js +19 -0
- package/src/components/molecules/TagAndInputv2/TagAndInputv2.stories.js +24 -0
- package/src/components/molecules/TagAndInputv2/index.js +86 -0
- package/src/components/molecules/TagAndInputv2/styles.js +35 -0
- package/src/components/molecules/Validation/Validation.stories.js +12 -0
- package/src/components/molecules/Validation/index.js +77 -0
- package/src/components/molecules/Validation/styles.js +19 -0
- package/src/components/molecules/VersionItemv2/VersionItemv2.stories.js +14 -0
- package/src/components/molecules/VersionItemv2/index.js +59 -0
- package/src/components/molecules/VersionItemv2/styles.js +47 -0
- package/src/components/organisms/BarButtons/BarButtons.stories.js +13 -0
- package/src/components/organisms/BarButtons/index.js +150 -0
- package/src/components/organisms/BarButtons/styles.js +54 -0
- package/src/components/organisms/Chatv2/ChatLists/ChatLists.stories.js +65 -0
- package/src/components/organisms/Chatv2/ChatLists/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chatv2/ChatLists/THD.png +0 -0
- package/src/components/organisms/Chatv2/ChatLists/index.js +141 -0
- package/src/components/organisms/Chatv2/ChatLists/styles.js +162 -0
- package/src/components/organisms/Chatv2/Chatv2.stories.js +184 -0
- package/src/components/organisms/Chatv2/ContainerItems/ContainerItems.stories.js +142 -0
- package/src/components/organisms/Chatv2/ContainerItems/index.js +538 -0
- package/src/components/organisms/Chatv2/ContainerItems/styles.js +360 -0
- package/src/components/organisms/Chatv2/ContentChat/ContentChat.stories.js +102 -0
- package/src/components/organisms/Chatv2/ContentChat/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chatv2/ContentChat/THD.png +0 -0
- package/src/components/organisms/Chatv2/ContentChat/index.js +1016 -0
- package/src/components/organisms/Chatv2/ContentChat/styles.js +44 -0
- package/src/components/organisms/Chatv2/Footer/Footer.stories.js +22 -0
- package/src/components/organisms/Chatv2/Footer/index.js +668 -0
- package/src/components/organisms/Chatv2/Footer/styles.js +290 -0
- package/src/components/organisms/Chatv2/Header/Header.stories.js +66 -0
- package/src/components/organisms/Chatv2/Header/index.js +93 -0
- package/src/components/organisms/Chatv2/Header/styles.js +49 -0
- package/src/components/organisms/Chatv2/index.js +281 -0
- package/src/components/organisms/Chatv2/styles.js +85 -0
- package/src/components/organisms/CompleteServices/CompleteServices.stories.js +91 -0
- package/src/components/organisms/CompleteServices/index.js +82 -0
- package/src/components/organisms/CompleteServices/styles.js +35 -0
- package/src/components/organisms/DragAndDropPhases/DragAndDropPhases.stories.js +12 -0
- package/src/components/organisms/DragAndDropPhases/index.js +67 -0
- package/src/components/organisms/DragAndDropPhases/styles.js +20 -0
- package/src/components/organisms/DragPrueba/DragPrueba.stories.js +12 -0
- package/src/components/organisms/DragPrueba/index.js +57 -0
- package/src/components/organisms/DragPrueba/styles.js +8 -0
- package/src/components/organisms/FullProductNamev2/FullProductNamev2.stories.js +28 -0
- package/src/components/organisms/FullProductNamev2/index.js +101 -0
- package/src/components/organisms/FullProductNamev2/styles.js +49 -0
- package/src/components/organisms/FullTabsMenuv2/FullTabsMenuv2.stories.js +22 -0
- package/src/components/organisms/FullTabsMenuv2/index.js +142 -0
- package/src/components/organisms/FullTabsMenuv2/styles.js +47 -0
- package/src/components/organisms/ImageDataTablev2/ImageDataTablev2.stories.js +24 -0
- package/src/components/organisms/ImageDataTablev2/index.js +124 -0
- package/src/components/organisms/ImageDataTablev2/styles.js +18 -0
- package/src/components/organisms/ImagePreviewerv2/ImagePreviewerv2.stories.js +38 -0
- package/src/components/organisms/ImagePreviewerv2/index.js +22 -0
- package/src/components/organisms/ImagePreviewerv2/styles.js +7 -0
- package/src/components/organisms/InputGroupv2/InputGroupv2.stories.js +31 -0
- package/src/components/organisms/InputGroupv2/index.js +296 -0
- package/src/components/organisms/InputGroupv2/styles.js +90 -0
- package/src/components/organisms/MandatoryBar/MandatoryBar.stories.js +18 -0
- package/src/components/organisms/MandatoryBar/index.js +31 -0
- package/src/components/organisms/MandatoryBar/styles.js +12 -0
- package/src/components/organisms/ProductImageModalv2/ProductImageModalv2.stories.js +90 -0
- package/src/components/organisms/ProductImageModalv2/index.js +105 -0
- package/src/components/organisms/ProductImageModalv2/styles.js +71 -0
- package/src/components/organisms/RenameImagesBar/RenameImagesBar.stories.js +18 -0
- package/src/components/organisms/RenameImagesBar/index.js +30 -0
- package/src/components/organisms/RenameImagesBar/styles.js +12 -0
- package/src/components/organisms/VersionSelector/index.js +1 -2
- package/src/components/organisms/VersionSelectorv2/VersionSelectorv2.stories.js +15 -0
- package/src/components/organisms/VersionSelectorv2/index.js +105 -0
- package/src/components/organisms/VersionSelectorv2/styles.js +45 -0
- package/src/components/pages/ProductEditionv2/ProductEditionv2.stories.js +213 -0
- package/src/components/pages/ProductEditionv2/index.js +1758 -0
- package/src/components/pages/ProductEditionv2/styles.js +154 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +39 -29
- package/src/components/pages/ProviderProductEdition/index.js +29 -21
- package/src/global-files/data.js +1 -3
- package/src/global-files/variables.js +2 -0
|
@@ -0,0 +1,1758 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { HeaderTopv2 } from "../../molecules/HeaderTopv2";
|
|
3
|
+
import { ImagePreviewerv2 } from "../../organisms/ImagePreviewerv2";
|
|
4
|
+
import { ImageDataTable } from "../../organisms/ImageDataTable";
|
|
5
|
+
import { FullProductNamev2 } from "../../organisms/FullProductNamev2";
|
|
6
|
+
import { FullTabsMenuv2 } from "../../organisms/FullTabsMenuv2";
|
|
7
|
+
import { useEffect, useReducer, useState, useCallback } from "react";
|
|
8
|
+
import { saveAs } from "file-saver";
|
|
9
|
+
import {
|
|
10
|
+
getRetailerServices,
|
|
11
|
+
getPercentage,
|
|
12
|
+
fetchUsers,
|
|
13
|
+
} from "../../../global-files/data";
|
|
14
|
+
import { ProductImageModalv2 } from "../../organisms/ProductImageModalv2";
|
|
15
|
+
import { useDropzone } from "react-dropzone";
|
|
16
|
+
import axios from "axios";
|
|
17
|
+
import { v4 as uuidv4 } from "uuid";
|
|
18
|
+
import AWS from "aws-sdk";
|
|
19
|
+
import { TagAndInputv2 } from "../../molecules/TagAndInputv2";
|
|
20
|
+
import { Button } from "../../atoms/GeneralButton";
|
|
21
|
+
import { Commentary } from "../../atoms/Commentary";
|
|
22
|
+
import { GenericModal } from "../../atoms/GenericModal";
|
|
23
|
+
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
24
|
+
import { Loading } from "../../atoms/Loading";
|
|
25
|
+
import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
|
|
26
|
+
import { Link } from "react-router-dom";
|
|
27
|
+
import face from "../../../assets/images/defaultImages/defaultProfileImage.svg";
|
|
28
|
+
import errorModal from "../../../assets/images/genericModal/errorModal.svg";
|
|
29
|
+
import { GlobalModal } from "../../organisms/GlobalModal/index";
|
|
30
|
+
import { SliderToolTip } from "../../atoms/SliderToolTip";
|
|
31
|
+
import InfoIcon from "../../../assets/images/sliderToolTip/infoIcon.svg";
|
|
32
|
+
import Slide1_1 from "../../../assets/images/sliderToolTip/slide1.svg";
|
|
33
|
+
import Slide1_2 from "../../../assets/images/sliderToolTip/slide2.svg";
|
|
34
|
+
import Slide1_3 from "../../../assets/images/sliderToolTip/slide3.svg";
|
|
35
|
+
import Slide1_4 from "../../../assets/images/sliderToolTip/slide4.svg";
|
|
36
|
+
import Slide1_5 from "../../../assets/images/sliderToolTip/slide5.svg";
|
|
37
|
+
import { useCloseModal } from "../../../global-files/customHooks";
|
|
38
|
+
import { createMessage, sendMessage } from "../RetailerProductEdition/utils";
|
|
39
|
+
import { Modal } from "../../organisms/Modal";
|
|
40
|
+
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
41
|
+
import { CompleteServices } from "../../organisms/CompleteServices";
|
|
42
|
+
import { InputGroupv2 } from "../../organisms/InputGroupv2";
|
|
43
|
+
import { VersionSelectorv2 } from "../../organisms/VersionSelectorv2";
|
|
44
|
+
import { MandatoryBar } from "../../organisms/MandatoryBar";
|
|
45
|
+
import { GalleryHeaderv2 } from "../../molecules/GalleryHeaderv2";
|
|
46
|
+
import { GalleryElementv2 } from "../../molecules/GalleryElementv2";
|
|
47
|
+
import { RenameImagesBar } from "../../organisms/RenameImagesBar";
|
|
48
|
+
|
|
49
|
+
const reducerImages = (state, action) => {
|
|
50
|
+
let { values, attrForImgs, inputsByRetailer } = state;
|
|
51
|
+
switch (action.action) {
|
|
52
|
+
case "init":
|
|
53
|
+
const newInputsByRetailer = {};
|
|
54
|
+
action?.init?.inputsByRetailer?.forEach((inputs) => {
|
|
55
|
+
inputs?.forEach((input) => {
|
|
56
|
+
if (!newInputsByRetailer[`${input.id_retailer}`])
|
|
57
|
+
newInputsByRetailer[`${input.id_retailer}`] = [];
|
|
58
|
+
newInputsByRetailer[`${input.id_retailer}`].push(input);
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
inputsByRetailer = newInputsByRetailer;
|
|
62
|
+
return {
|
|
63
|
+
...action.init,
|
|
64
|
+
inputsByRetailer,
|
|
65
|
+
valuesInitial: action.init.values,
|
|
66
|
+
inputsInitial: action.init.inputs,
|
|
67
|
+
};
|
|
68
|
+
case "addImg":
|
|
69
|
+
values = [...values, action.img];
|
|
70
|
+
return { ...state, values };
|
|
71
|
+
case "changeImageInfo":
|
|
72
|
+
values[action.index][action.attribute] = action.value;
|
|
73
|
+
return { ...state, values };
|
|
74
|
+
case "changeAttrValue":
|
|
75
|
+
const index = attrForImgs.general.findIndex((f) => (f.id = action.id));
|
|
76
|
+
if (index !== -1) {
|
|
77
|
+
attrForImgs.general[index].value = action.value;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return { ...state, attrForImgs, values };
|
|
81
|
+
case "deleteImage":
|
|
82
|
+
values = values.filter(
|
|
83
|
+
(value) => action.selectedImages.indexOf(value) === -1
|
|
84
|
+
);
|
|
85
|
+
return { ...state, values };
|
|
86
|
+
case "orderImages": {
|
|
87
|
+
let { inputsByRetailer, valuesInitial, inputsInitial, inputs } = state;
|
|
88
|
+
try {
|
|
89
|
+
const orderedImages = [];
|
|
90
|
+
const imageIdArray = [];
|
|
91
|
+
if (action?.retailerId && !inputsByRetailer[action.retailerId])
|
|
92
|
+
inputsByRetailer[action.retailerId] = [];
|
|
93
|
+
action.retailerId &&
|
|
94
|
+
inputsByRetailer[action.retailerId]?.filter((input) => {
|
|
95
|
+
imageIdArray.push(input.id_image);
|
|
96
|
+
valuesInitial.forEach((value) => {
|
|
97
|
+
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
inputs = inputsInitial?.filter((input) =>
|
|
102
|
+
imageIdArray.includes(input.id)
|
|
103
|
+
);
|
|
104
|
+
|
|
105
|
+
values = orderedImages.length > 0 ? orderedImages : [];
|
|
106
|
+
} catch (error) {
|
|
107
|
+
console.log(error);
|
|
108
|
+
}
|
|
109
|
+
return { ...state, values, inputs };
|
|
110
|
+
}
|
|
111
|
+
default:
|
|
112
|
+
return state;
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
const S3_BUCKET = process.env.REACT_APP_IMAGES_BUCKET;
|
|
116
|
+
const REGION = "us-east-1";
|
|
117
|
+
|
|
118
|
+
AWS.config.update({
|
|
119
|
+
accessKeyId: process.env.REACT_APP_KUTS3,
|
|
120
|
+
secretAccessKey: process.env.REACT_APP_AKUTS3,
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
const myBucket = new AWS.S3({
|
|
124
|
+
params: { Bucket: S3_BUCKET },
|
|
125
|
+
region: REGION,
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
export const ProductEditionv2 = ({
|
|
129
|
+
tabsSections,
|
|
130
|
+
productSelected = {},
|
|
131
|
+
productToEdit,
|
|
132
|
+
user = {},
|
|
133
|
+
location = {},
|
|
134
|
+
token,
|
|
135
|
+
revision = false,
|
|
136
|
+
setShowContentohRequestModal,
|
|
137
|
+
showSurvey,
|
|
138
|
+
company,
|
|
139
|
+
addToCart,
|
|
140
|
+
}) => {
|
|
141
|
+
const [activeTab, setActiveTab] = useState("Descripción");
|
|
142
|
+
const [activeImage, setActiveImage] = useState();
|
|
143
|
+
const [imageLayout, setImageLayout] = useState(false);
|
|
144
|
+
const [headerTop, setHeaderTop] = useState(0);
|
|
145
|
+
const [descriptions, setDescriptions] = useState([]);
|
|
146
|
+
const [datasheets, setDatasheets] = useState([]);
|
|
147
|
+
const [images, setImages] = useReducer(reducerImages, {});
|
|
148
|
+
const [showModal, setShowModal] = useState(false);
|
|
149
|
+
const [boxData, setBoxData] = useState();
|
|
150
|
+
const [imageRules, setImageRules] = useState({
|
|
151
|
+
maxImg: 0,
|
|
152
|
+
minImg: 0,
|
|
153
|
+
requiredImg: 0,
|
|
154
|
+
});
|
|
155
|
+
const { getRootProps, getInputProps } = useDropzone({
|
|
156
|
+
accept: "image/*",
|
|
157
|
+
noKeyboard: true,
|
|
158
|
+
multiple: true,
|
|
159
|
+
noClick: true,
|
|
160
|
+
onDrop: (acceptedFiles) => {
|
|
161
|
+
const newImages = [];
|
|
162
|
+
acceptedFiles.map((file) => {
|
|
163
|
+
const reader = new FileReader();
|
|
164
|
+
reader.fileName = file.name;
|
|
165
|
+
reader.onload = async function (e) {
|
|
166
|
+
const ext = e.srcElement.fileName.split(".");
|
|
167
|
+
const img = new Image();
|
|
168
|
+
img.src = e.target.result;
|
|
169
|
+
setTimeout(() => {
|
|
170
|
+
const width = img.width;
|
|
171
|
+
const height = img.height;
|
|
172
|
+
const newImg = {
|
|
173
|
+
action: "addImg",
|
|
174
|
+
img: {
|
|
175
|
+
src: e.target.result,
|
|
176
|
+
name: e.target.fileName,
|
|
177
|
+
ext: ext[ext.length - 1],
|
|
178
|
+
width: width,
|
|
179
|
+
height: height,
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
setImages(newImg);
|
|
183
|
+
}, 500);
|
|
184
|
+
};
|
|
185
|
+
reader.onerror = function (error) {
|
|
186
|
+
console.log("dropzoneError: ", error);
|
|
187
|
+
};
|
|
188
|
+
reader.readAsDataURL(file);
|
|
189
|
+
return file;
|
|
190
|
+
});
|
|
191
|
+
},
|
|
192
|
+
});
|
|
193
|
+
const [updatedDatasheets, setUpdatedDatasheets] = useState([]);
|
|
194
|
+
const [updatedDescriptions, setUpdatedDescriptions] = useState([]);
|
|
195
|
+
const [imagesUploaded, setImagesUploaded] = useState(false);
|
|
196
|
+
const [dataImages, setDataImages] = useState();
|
|
197
|
+
const [percentages, setPercentages] = useState(
|
|
198
|
+
product?.retailers
|
|
199
|
+
? new Array(product?.retailers?.length).fill({ percentage: 0 })
|
|
200
|
+
: new Array(product?.retailersAvailable?.length).fill({ percentage: 0 })
|
|
201
|
+
);
|
|
202
|
+
const [activePercentage, setActivePercentage] = useState(0);
|
|
203
|
+
const [activeRetailer, setActiveRetailer] = useState({});
|
|
204
|
+
const [services, setServices] = useState([]);
|
|
205
|
+
const [servicesData, setServicesData] = useState([]);
|
|
206
|
+
const [message, setMessage] = useState("");
|
|
207
|
+
const [product, setProduct] = useState(
|
|
208
|
+
JSON.parse(sessionStorage.getItem("productSelected"))
|
|
209
|
+
? JSON.parse(sessionStorage.getItem("productSelected"))
|
|
210
|
+
: productSelected
|
|
211
|
+
);
|
|
212
|
+
const [productEdit, setProductEdit] = useState(
|
|
213
|
+
JSON.parse(sessionStorage.getItem("productEdit"))
|
|
214
|
+
? JSON.parse(sessionStorage.getItem("productEdit"))
|
|
215
|
+
: productToEdit
|
|
216
|
+
);
|
|
217
|
+
const [version, setVersion] = useState(product?.version);
|
|
218
|
+
const [comments] = useState({});
|
|
219
|
+
const [comment, setComment] = useState("");
|
|
220
|
+
const [crossComment, setCrossComment] = useState(false);
|
|
221
|
+
const [userGroups, setUserGroups] = useState([]);
|
|
222
|
+
const [assig, setAssig] = useState({});
|
|
223
|
+
const [selectedImages, setSelectedImages] = useState([]);
|
|
224
|
+
const [componentsArray, setComponentsArray] = useState([]);
|
|
225
|
+
const [checkAll, setCheckAll] = useState(false);
|
|
226
|
+
const isRetailer = user?.is_retailer;
|
|
227
|
+
const [loading, setLoading] = useState(true);
|
|
228
|
+
const [validatedAll, setValidatedAll] = useState(false);
|
|
229
|
+
const [showRejectModal, setShowRejectModal] = useState(false);
|
|
230
|
+
|
|
231
|
+
const [origin, setOrigin] = useState({
|
|
232
|
+
"Ficha técnica": null,
|
|
233
|
+
Descripción: null,
|
|
234
|
+
Imágenes: null,
|
|
235
|
+
});
|
|
236
|
+
|
|
237
|
+
const [inCart, setInCart] = useState(false);
|
|
238
|
+
const [dataGenericModal, setDataGenericModal] = useState({
|
|
239
|
+
message: "¿Estás seguro de continuar?",
|
|
240
|
+
detail: ` ${
|
|
241
|
+
user.is_retailer
|
|
242
|
+
? "Asegurate de haber revisado las tres secciones"
|
|
243
|
+
: "Envíar el producto a la cadena"
|
|
244
|
+
}`,
|
|
245
|
+
button1: {
|
|
246
|
+
name: "Cerrar",
|
|
247
|
+
action: closeGlobalModal,
|
|
248
|
+
},
|
|
249
|
+
button2: {
|
|
250
|
+
name: "Continuar",
|
|
251
|
+
action: () => evaluationToRetailer(false),
|
|
252
|
+
},
|
|
253
|
+
img: face,
|
|
254
|
+
});
|
|
255
|
+
const [socketType, setSocketType] = useState(null);
|
|
256
|
+
const [saving, setSaving] = useState(loading);
|
|
257
|
+
const [retailerStatus, setRetailerStatus] = useState(
|
|
258
|
+
product.statusByRetailer
|
|
259
|
+
);
|
|
260
|
+
const [showVersionSelector, setShowVersionSelector] =
|
|
261
|
+
useCloseModal("version-selector");
|
|
262
|
+
const [globalModal, setGlobalModal] = useState();
|
|
263
|
+
|
|
264
|
+
const updateAuditStatus = async (status) => {
|
|
265
|
+
const productTemp = product;
|
|
266
|
+
productTemp.article_status = status;
|
|
267
|
+
productTemp.datasheet_status = status;
|
|
268
|
+
productTemp.description_status = status;
|
|
269
|
+
productTemp.images_status = status;
|
|
270
|
+
|
|
271
|
+
const retailerStatusCopy = { ...retailerStatus };
|
|
272
|
+
const conceptArray = ["description", "datasheet", "images"];
|
|
273
|
+
Object.keys(retailerStatusCopy).forEach((key) => {
|
|
274
|
+
conceptArray.forEach((concept) => {
|
|
275
|
+
if (retailerStatusCopy[key][concept]) {
|
|
276
|
+
retailerStatusCopy[key][concept] = status;
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
});
|
|
280
|
+
setRetailerStatus(retailerStatusCopy);
|
|
281
|
+
productTemp.statusByRetailer = retailerStatusCopy;
|
|
282
|
+
setProduct(productTemp);
|
|
283
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
284
|
+
setProductEdit({
|
|
285
|
+
ArticleId: productTemp.id_article,
|
|
286
|
+
idCategory: productTemp.article.id_category,
|
|
287
|
+
product: productTemp,
|
|
288
|
+
});
|
|
289
|
+
sessionStorage.setItem(
|
|
290
|
+
"productEdit",
|
|
291
|
+
JSON.stringify({
|
|
292
|
+
ArticleId: productTemp.id_article,
|
|
293
|
+
idCategory: productTemp.article.id_category,
|
|
294
|
+
product: productTemp,
|
|
295
|
+
})
|
|
296
|
+
);
|
|
297
|
+
await loadData();
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
const addCart = async (retailers) => {
|
|
301
|
+
const { article, version } = product;
|
|
302
|
+
const articleToOrder = [
|
|
303
|
+
{
|
|
304
|
+
articleId: article.id_article,
|
|
305
|
+
version,
|
|
306
|
+
userId: user.id_user,
|
|
307
|
+
discount: 0,
|
|
308
|
+
subtotal: 0,
|
|
309
|
+
companyId: user.id_company,
|
|
310
|
+
datasheet: retailers,
|
|
311
|
+
description: retailers,
|
|
312
|
+
image: retailers,
|
|
313
|
+
attributeTranslations: false,
|
|
314
|
+
descriptionTranslations: false,
|
|
315
|
+
build: "[]",
|
|
316
|
+
manual: "[]",
|
|
317
|
+
userCreated: user.id_user,
|
|
318
|
+
},
|
|
319
|
+
];
|
|
320
|
+
let modatlType = "addedToCartError";
|
|
321
|
+
if (addToCart) {
|
|
322
|
+
const resCart = await addToCart({ data: articleToOrder });
|
|
323
|
+
if (resCart.data.statusCode === 200) {
|
|
324
|
+
modatlType = "addedToCart";
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
showGlobalModal(modatlType);
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
const closeGlobalModal = () => setGlobalModal();
|
|
331
|
+
|
|
332
|
+
const seenByProvider = async () => {
|
|
333
|
+
const productTemp = product;
|
|
334
|
+
const articleId = productTemp.id_article;
|
|
335
|
+
const orderId = productTemp.id_order ?? productTemp.orderId;
|
|
336
|
+
const promises = [];
|
|
337
|
+
const conceptArray = ["description", "datasheet", "images"];
|
|
338
|
+
conceptArray.forEach((concept) => {
|
|
339
|
+
const sectionStatusKey = `${concept}_status`;
|
|
340
|
+
const evalStatus = product[sectionStatusKey] || product?.version_status;
|
|
341
|
+
const data = { articleId, orderId, concept, evalStatus };
|
|
342
|
+
promises.push(
|
|
343
|
+
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
344
|
+
headers: {
|
|
345
|
+
Authorization: token,
|
|
346
|
+
},
|
|
347
|
+
})
|
|
348
|
+
);
|
|
349
|
+
});
|
|
350
|
+
await Promise.all(promises);
|
|
351
|
+
closeGlobalModal();
|
|
352
|
+
await updateAuditStatus("FAP");
|
|
353
|
+
};
|
|
354
|
+
|
|
355
|
+
const showGlobalModal = useCallback(
|
|
356
|
+
(type) => {
|
|
357
|
+
const formatter = new Intl.ListFormat("es", { type: "conjunction" });
|
|
358
|
+
switch (type) {
|
|
359
|
+
case "generic":
|
|
360
|
+
setGlobalModal(dataGenericModal);
|
|
361
|
+
break;
|
|
362
|
+
case "commentsSent":
|
|
363
|
+
setGlobalModal({
|
|
364
|
+
message: "Gracias, tus comentarios fueron entregados.",
|
|
365
|
+
detail: "Trabajaremos en conjunto para resolverlo.",
|
|
366
|
+
button1: {
|
|
367
|
+
name: "Cerrar",
|
|
368
|
+
action: closeGlobalModal,
|
|
369
|
+
},
|
|
370
|
+
img: face,
|
|
371
|
+
textArea: false,
|
|
372
|
+
});
|
|
373
|
+
break;
|
|
374
|
+
case "RAC":
|
|
375
|
+
const servicesRejected = [];
|
|
376
|
+
const translateServices = {
|
|
377
|
+
datasheet: "ficha técnica",
|
|
378
|
+
description: "descripción",
|
|
379
|
+
images: "imágenes",
|
|
380
|
+
};
|
|
381
|
+
Object.keys(translateServices).forEach((service) => {
|
|
382
|
+
if (product[`${service}_status`] === "RAC") {
|
|
383
|
+
servicesRejected.push(translateServices[service]);
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
const plural = ["Los servicios", "cumplen"];
|
|
387
|
+
const singular = ["El servicio", "cumple"];
|
|
388
|
+
const grammar = servicesRejected.length > 1 ? plural : singular;
|
|
389
|
+
const formatted = formatter.format(servicesRejected);
|
|
390
|
+
const text1 = `${grammar[0]} de ${formatted} no ${grammar[1]} con lo que la cadena necesita.`;
|
|
391
|
+
const text2 = `¡Solicita el servicio de Content-oh! para completarlo!`;
|
|
392
|
+
const retailers = product.retailersWithService.map((retailer) =>
|
|
393
|
+
Number(retailer)
|
|
394
|
+
);
|
|
395
|
+
setGlobalModal({
|
|
396
|
+
message:
|
|
397
|
+
"Tu producto no cumple con los requerimientos de la cadena",
|
|
398
|
+
customComponent: (
|
|
399
|
+
<>
|
|
400
|
+
<p className="generic-text">
|
|
401
|
+
{text1}
|
|
402
|
+
<br />
|
|
403
|
+
<br />
|
|
404
|
+
{text2}
|
|
405
|
+
</p>
|
|
406
|
+
</>
|
|
407
|
+
),
|
|
408
|
+
button1: {
|
|
409
|
+
name: "Continuar",
|
|
410
|
+
action: async () => await seenByProvider(),
|
|
411
|
+
},
|
|
412
|
+
button2: {
|
|
413
|
+
name: "Solicitar a Content-oh!",
|
|
414
|
+
action: async () => {
|
|
415
|
+
await addCart(retailers);
|
|
416
|
+
await seenByProvider();
|
|
417
|
+
},
|
|
418
|
+
},
|
|
419
|
+
img: errorModal,
|
|
420
|
+
});
|
|
421
|
+
break;
|
|
422
|
+
case "AAC":
|
|
423
|
+
setGlobalModal({
|
|
424
|
+
message: "Felicidades",
|
|
425
|
+
detail: "Tu producto cumple con los requerimientos de la cadena.",
|
|
426
|
+
button1: {
|
|
427
|
+
name: "Continuar",
|
|
428
|
+
action: async () => await seenByProvider(),
|
|
429
|
+
},
|
|
430
|
+
img: face,
|
|
431
|
+
});
|
|
432
|
+
break;
|
|
433
|
+
case "addedToCartError":
|
|
434
|
+
setGlobalModal({
|
|
435
|
+
detail:
|
|
436
|
+
"Parece que algo salió mal al intentar añadir tu producto a tu carrito.",
|
|
437
|
+
button1: {
|
|
438
|
+
name: "Continuar",
|
|
439
|
+
action: closeGlobalModal,
|
|
440
|
+
},
|
|
441
|
+
});
|
|
442
|
+
break;
|
|
443
|
+
case "addedToCart":
|
|
444
|
+
setGlobalModal({
|
|
445
|
+
message: "Producto añadido",
|
|
446
|
+
detail: "Tu producto se añadió al carrito de compras.",
|
|
447
|
+
button1: {
|
|
448
|
+
name: "Continuar",
|
|
449
|
+
action: closeGlobalModal,
|
|
450
|
+
},
|
|
451
|
+
img: face,
|
|
452
|
+
});
|
|
453
|
+
break;
|
|
454
|
+
default:
|
|
455
|
+
closeGlobalModal();
|
|
456
|
+
break;
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
[activeTab, dataGenericModal, product]
|
|
460
|
+
);
|
|
461
|
+
|
|
462
|
+
useEffect(() => {
|
|
463
|
+
checkAll && setSelectedImages(images.values);
|
|
464
|
+
}, [checkAll]);
|
|
465
|
+
|
|
466
|
+
useEffect(() => {
|
|
467
|
+
if (showModal) {
|
|
468
|
+
setActiveTab("Imágenes");
|
|
469
|
+
}
|
|
470
|
+
}, [showModal]);
|
|
471
|
+
|
|
472
|
+
useEffect(() => {
|
|
473
|
+
setOrigin({
|
|
474
|
+
"Ficha técnica": location?.state?.origin,
|
|
475
|
+
Descripción: location?.state?.origin,
|
|
476
|
+
Imágenes: location?.state?.origin,
|
|
477
|
+
});
|
|
478
|
+
}, [location?.state?.origin]);
|
|
479
|
+
|
|
480
|
+
const loadData = async () => {
|
|
481
|
+
const services = await getRetailerServices(
|
|
482
|
+
product?.id_article || product?.article?.id_article,
|
|
483
|
+
product?.article?.company_name || product?.categoryName,
|
|
484
|
+
parseInt(product?.article?.id_category || product?.id_category),
|
|
485
|
+
version,
|
|
486
|
+
token
|
|
487
|
+
);
|
|
488
|
+
//Converts the data inside the datasheets object to array
|
|
489
|
+
setServices(services);
|
|
490
|
+
await getServices();
|
|
491
|
+
|
|
492
|
+
setImages({ action: "init", init: services[2] });
|
|
493
|
+
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
494
|
+
getPercentage({ data: [product] }).then((res) => setPercentages(res[0]));
|
|
495
|
+
setLoading(false);
|
|
496
|
+
};
|
|
497
|
+
|
|
498
|
+
const getRetailerImageRules = async (product, version, token) => {
|
|
499
|
+
const services = await getRetailerServices(
|
|
500
|
+
product?.id_article || product?.article?.id_article,
|
|
501
|
+
product?.article?.company_name || product?.categoryName,
|
|
502
|
+
parseInt(product?.article?.id_category || product?.id_category),
|
|
503
|
+
version,
|
|
504
|
+
token
|
|
505
|
+
);
|
|
506
|
+
|
|
507
|
+
const rulesToImgByRetailer = services[2]?.rulesToImgByRetailer;
|
|
508
|
+
const retailerId = services[2]?.retailers?.[0]?.id;
|
|
509
|
+
const maxImg = rulesToImgByRetailer?.[retailerId]?.maxImg || 0;
|
|
510
|
+
const minImg = rulesToImgByRetailer?.[retailerId]?.minImg || 0;
|
|
511
|
+
const requiredImg = rulesToImgByRetailer?.[retailerId]?.requiredImg || 0;
|
|
512
|
+
|
|
513
|
+
// Actualizar el estado con las reglas de imágenes
|
|
514
|
+
setImageRules({ maxImg, minImg, requiredImg });
|
|
515
|
+
};
|
|
516
|
+
|
|
517
|
+
useEffect(() => {
|
|
518
|
+
getRetailerImageRules(product, version, token);
|
|
519
|
+
}, [product, version, token]);
|
|
520
|
+
|
|
521
|
+
|
|
522
|
+
const getServices = async () => {
|
|
523
|
+
const productInOrder = product.id_order || product.orderId;
|
|
524
|
+
const idArticle = product?.id_article || product?.article?.id_article;
|
|
525
|
+
let retailers = product.retailers || product.retailersAvailable;
|
|
526
|
+
let active = null;
|
|
527
|
+
if (isRevision() || productInOrder) {
|
|
528
|
+
const servicesResponse = await axios.get(
|
|
529
|
+
`${
|
|
530
|
+
process.env.REACT_APP_SERVICES_ENDPOINT
|
|
531
|
+
}?articleId=${idArticle}&orderId=${
|
|
532
|
+
product?.id_order ?? product.orderId
|
|
533
|
+
}&end=true`
|
|
534
|
+
);
|
|
535
|
+
const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
|
|
536
|
+
const retailerResponse = parsedResponse?.map((srv) => srv.id_retailer);
|
|
537
|
+
active = retailers?.find((retailer) =>
|
|
538
|
+
retailerResponse.includes(retailer.id)
|
|
539
|
+
);
|
|
540
|
+
setServicesData(parsedResponse);
|
|
541
|
+
}
|
|
542
|
+
retailers &&
|
|
543
|
+
!activeRetailer.id &&
|
|
544
|
+
setActiveRetailer(active ? active : retailers[0]);
|
|
545
|
+
};
|
|
546
|
+
|
|
547
|
+
const isRevision = () => {
|
|
548
|
+
if (productEdit) {
|
|
549
|
+
const concept = getConcept(activeTab);
|
|
550
|
+
const isRetailer = user.is_retailer === 1;
|
|
551
|
+
const currentService = productEdit?.product[`${concept}_status`];
|
|
552
|
+
const orgn = origin[activeTab];
|
|
553
|
+
const revision = [
|
|
554
|
+
"RequestWithContentoh",
|
|
555
|
+
"RequestWithoutContentoh",
|
|
556
|
+
"Contentoh",
|
|
557
|
+
].includes(orgn);
|
|
558
|
+
if (isRetailer) {
|
|
559
|
+
if (revision && currentService === "AP") return true;
|
|
560
|
+
} else {
|
|
561
|
+
const { product } = productEdit;
|
|
562
|
+
const isRequestWithoutContentoh =
|
|
563
|
+
orgn === "RequestWithoutContentoh" &&
|
|
564
|
+
(["R", "CA"].includes(currentService) ||
|
|
565
|
+
(currentService === "RCA" &&
|
|
566
|
+
(!product.id_order || !product.orderId)));
|
|
567
|
+
const isRequestWithContentoh =
|
|
568
|
+
orgn === "RequestWithContentoh" && currentService === "AA";
|
|
569
|
+
const isContentoh = orgn === "Contentoh" && currentService === "AA";
|
|
570
|
+
if (isContentoh || isRequestWithoutContentoh || isRequestWithContentoh)
|
|
571
|
+
return true;
|
|
572
|
+
}
|
|
573
|
+
}
|
|
574
|
+
return false;
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
const getCart = async () => {
|
|
578
|
+
const res = await axios.get(process.env.REACT_APP_CART, {
|
|
579
|
+
headers: {
|
|
580
|
+
Authorization: token,
|
|
581
|
+
},
|
|
582
|
+
});
|
|
583
|
+
const arr = JSON.parse(res.data.body).data.map((e) => e.article_id);
|
|
584
|
+
setInCart(arr.some((e) => e.articleId === product.id_article));
|
|
585
|
+
};
|
|
586
|
+
|
|
587
|
+
useEffect(() => {
|
|
588
|
+
sessionStorage.setItem("user", JSON.stringify(user));
|
|
589
|
+
loadData();
|
|
590
|
+
getCart();
|
|
591
|
+
fetchUsers(token).then((res) => setUserGroups(res));
|
|
592
|
+
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
593
|
+
if (["RAC", "AAC"].includes(product.article_status))
|
|
594
|
+
showGlobalModal(product.article_status);
|
|
595
|
+
}, [product, version]);
|
|
596
|
+
|
|
597
|
+
useEffect(() => {
|
|
598
|
+
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
599
|
+
}, [activeRetailer]);
|
|
600
|
+
|
|
601
|
+
const loadAssignations = (currentProduct) => {
|
|
602
|
+
setAssig(product?.asignations);
|
|
603
|
+
};
|
|
604
|
+
|
|
605
|
+
useEffect(() => {
|
|
606
|
+
loadAssignations(product);
|
|
607
|
+
}, [userGroups]);
|
|
608
|
+
|
|
609
|
+
useEffect(() => {
|
|
610
|
+
const productTemp = product;
|
|
611
|
+
const retailers = productTemp?.retailersAvailable || productTemp?.retailers;
|
|
612
|
+
if (Object.keys(percentages[productTemp.id_article] ?? {})?.length > 0) {
|
|
613
|
+
retailers?.forEach((retailer, index) => {
|
|
614
|
+
retailer["percentage"] = Number(
|
|
615
|
+
percentages[productTemp.id_article][retailer.id]?.percentageRequired
|
|
616
|
+
);
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
setProduct(productTemp);
|
|
620
|
+
retailers && setActivePercentage(retailers[0]?.percentage);
|
|
621
|
+
}, [percentages]);
|
|
622
|
+
|
|
623
|
+
const loadInputs = () => {
|
|
624
|
+
if (services.length > 0) {
|
|
625
|
+
if (services[0][activeRetailer.id]?.data)
|
|
626
|
+
services[0][activeRetailer.id].data = Object.values(
|
|
627
|
+
services[0][activeRetailer.id].data
|
|
628
|
+
);
|
|
629
|
+
setActivePercentage(Math.round(activeRetailer?.percentage, 0));
|
|
630
|
+
|
|
631
|
+
const datagroups = services[0][activeRetailer.id];
|
|
632
|
+
const inputs = services[0]?.inputs;
|
|
633
|
+
const descriptions = services[1]?.filter(
|
|
634
|
+
(service) => service?.id === activeRetailer?.id
|
|
635
|
+
);
|
|
636
|
+
setDatasheets([datagroups, inputs]);
|
|
637
|
+
setDescriptions(descriptions);
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
|
|
641
|
+
useEffect(() => {
|
|
642
|
+
loadInputs();
|
|
643
|
+
activeRetailer.id &&
|
|
644
|
+
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
645
|
+
}, [servicesData, activeRetailer, services]);
|
|
646
|
+
|
|
647
|
+
const thumbs = () => {
|
|
648
|
+
const imageInputs = socketType?.slice();
|
|
649
|
+
const imageType = images?.imageType?.map((e) => ({
|
|
650
|
+
value: e?.id,
|
|
651
|
+
name: e?.name,
|
|
652
|
+
}));
|
|
653
|
+
const imagePackagingType = images?.imagePackagingType?.map((e) => ({
|
|
654
|
+
value: e?.id,
|
|
655
|
+
name: e?.name,
|
|
656
|
+
}));
|
|
657
|
+
return images?.values?.map((image, index) => (
|
|
658
|
+
<GalleryElementv2
|
|
659
|
+
setCheckAll={setCheckAll}
|
|
660
|
+
key={index}
|
|
661
|
+
image={image}
|
|
662
|
+
gridLayout={imageLayout}
|
|
663
|
+
id={"gallery-element-" + index}
|
|
664
|
+
index={index + "-" + image.name}
|
|
665
|
+
number={index}
|
|
666
|
+
imageType={imageType}
|
|
667
|
+
imagePackagingType={imagePackagingType}
|
|
668
|
+
imageInputs={imageInputs}
|
|
669
|
+
changeImage={setImages}
|
|
670
|
+
selectedImages={selectedImages}
|
|
671
|
+
setSelectedImages={setSelectedImages}
|
|
672
|
+
/>
|
|
673
|
+
));
|
|
674
|
+
};
|
|
675
|
+
|
|
676
|
+
useEffect(() => {
|
|
677
|
+
const imageInputs = images?.inputs?.map((e) => ({
|
|
678
|
+
value: e?.id,
|
|
679
|
+
name: e?.name,
|
|
680
|
+
required: e?.required,
|
|
681
|
+
active: images?.values.some((value) => value?.image_id === e?.id),
|
|
682
|
+
}));
|
|
683
|
+
setSocketType(imageInputs);
|
|
684
|
+
}, [images]);
|
|
685
|
+
|
|
686
|
+
const saveDescriptions = async () => {
|
|
687
|
+
setLoading(true);
|
|
688
|
+
const dataObject = {
|
|
689
|
+
articleId: product?.id_article,
|
|
690
|
+
articleData: updatedDescriptions,
|
|
691
|
+
};
|
|
692
|
+
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
693
|
+
try {
|
|
694
|
+
const res = await axios.put(
|
|
695
|
+
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
|
|
696
|
+
dataObject,
|
|
697
|
+
{
|
|
698
|
+
headers: {
|
|
699
|
+
Authorization: token,
|
|
700
|
+
},
|
|
701
|
+
}
|
|
702
|
+
);
|
|
703
|
+
if (res.data.statusCode === 200) {
|
|
704
|
+
setUpdatedDescriptions([]);
|
|
705
|
+
setMessage("Descripciones guardadas con éxito");
|
|
706
|
+
await loadData();
|
|
707
|
+
}
|
|
708
|
+
} catch (error) {
|
|
709
|
+
console.log(error);
|
|
710
|
+
}
|
|
711
|
+
};
|
|
712
|
+
|
|
713
|
+
const saveDatasheets = async () => {
|
|
714
|
+
const parseBoxData = [];
|
|
715
|
+
Object.entries(boxData).forEach(([, box], index) => {
|
|
716
|
+
const { value } = box;
|
|
717
|
+
const attributesIds = Object.keys(value);
|
|
718
|
+
attributesIds.forEach((attributeId) => {
|
|
719
|
+
const boxId = index + 1;
|
|
720
|
+
const valueOfAtribute = value[attributeId];
|
|
721
|
+
parseBoxData.push({
|
|
722
|
+
attributeId,
|
|
723
|
+
value: valueOfAtribute,
|
|
724
|
+
boxId,
|
|
725
|
+
})
|
|
726
|
+
});
|
|
727
|
+
});
|
|
728
|
+
|
|
729
|
+
const dataObject = {
|
|
730
|
+
articleId: product?.id_article,
|
|
731
|
+
articleData: updatedDatasheets,
|
|
732
|
+
...(parseBoxData.length > 0 && { boxData: parseBoxData }),
|
|
733
|
+
};
|
|
734
|
+
|
|
735
|
+
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
736
|
+
try {
|
|
737
|
+
const res = await axios.put(
|
|
738
|
+
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?datasheet=true&version=${version}`,
|
|
739
|
+
dataObject,
|
|
740
|
+
{
|
|
741
|
+
headers: {
|
|
742
|
+
Authorization: token,
|
|
743
|
+
},
|
|
744
|
+
}
|
|
745
|
+
);
|
|
746
|
+
if (res.data.statusCode === 200) {
|
|
747
|
+
setUpdatedDatasheets([]);
|
|
748
|
+
setMessage("Fichas técnicas guardadas");
|
|
749
|
+
await loadData();
|
|
750
|
+
}
|
|
751
|
+
} catch (error) {
|
|
752
|
+
console.log(error);
|
|
753
|
+
}
|
|
754
|
+
console.log(dataObject)
|
|
755
|
+
};
|
|
756
|
+
|
|
757
|
+
const updateImages = useCallback(async () => {
|
|
758
|
+
const imagesList = images?.values?.slice();
|
|
759
|
+
const imagesListTemp = imagesList?.reduce((acc, image) => {
|
|
760
|
+
acc[image?.image_id] = ++acc[image?.image_id] || 0;
|
|
761
|
+
return acc;
|
|
762
|
+
}, {});
|
|
763
|
+
|
|
764
|
+
const duplicated = imagesList?.filter((image) => {
|
|
765
|
+
return imagesListTemp[image?.image_id];
|
|
766
|
+
});
|
|
767
|
+
|
|
768
|
+
const attrForImgs = Object.values(images?.attrForImgs);
|
|
769
|
+
attrForImgs.pop();
|
|
770
|
+
const data = {
|
|
771
|
+
articleId: product?.id_article,
|
|
772
|
+
attrReqImgs: attrForImgs?.map((e) => ({
|
|
773
|
+
attrId: e[0]?.id,
|
|
774
|
+
value: e[0]?.value,
|
|
775
|
+
})),
|
|
776
|
+
articleData: imagesList?.filter((e) => !e.id),
|
|
777
|
+
updateImages: imagesList?.filter((e) => e.id),
|
|
778
|
+
};
|
|
779
|
+
if (product?.orderId) data["orderId"] = product?.orderId;
|
|
780
|
+
let valid =
|
|
781
|
+
data?.articleData?.length === 0
|
|
782
|
+
? true
|
|
783
|
+
: data?.articleData?.every((e, i) => {
|
|
784
|
+
if (e?.image_id && e?.packing_type && e?.image_type) {
|
|
785
|
+
return true;
|
|
786
|
+
}
|
|
787
|
+
return false;
|
|
788
|
+
});
|
|
789
|
+
if (valid && data?.updateImages?.length > 0 && duplicated?.length === 0) {
|
|
790
|
+
valid = data?.updateImages?.every((e, i) => {
|
|
791
|
+
if (e?.image_id && e?.packing_type && e?.image_type) {
|
|
792
|
+
return true;
|
|
793
|
+
}
|
|
794
|
+
return false;
|
|
795
|
+
});
|
|
796
|
+
}
|
|
797
|
+
if (valid && duplicated?.length === 0) {
|
|
798
|
+
setLoading(true);
|
|
799
|
+
try {
|
|
800
|
+
data?.articleData?.forEach((e) => {
|
|
801
|
+
e.uuid = uuidv4();
|
|
802
|
+
});
|
|
803
|
+
setDataImages(data);
|
|
804
|
+
if (data?.articleData?.length > 0) {
|
|
805
|
+
setImagesUploaded(false);
|
|
806
|
+
const promiseArray = [];
|
|
807
|
+
data?.articleData?.forEach((e) => {
|
|
808
|
+
const file = Buffer.from(
|
|
809
|
+
e.src.replace(/^data:image\/\w+;base64,/, ""),
|
|
810
|
+
"base64"
|
|
811
|
+
);
|
|
812
|
+
const params = {
|
|
813
|
+
ACL: "public-read",
|
|
814
|
+
Body: file,
|
|
815
|
+
Bucket: S3_BUCKET,
|
|
816
|
+
Key: `id-${data.articleId}/${version}/${e?.image_id}-${e?.uuid}.${e?.ext}`,
|
|
817
|
+
};
|
|
818
|
+
promiseArray.push(myBucket.putObject(params).promise());
|
|
819
|
+
});
|
|
820
|
+
await Promise.all(promiseArray);
|
|
821
|
+
setImagesUploaded(true);
|
|
822
|
+
} else {
|
|
823
|
+
setImagesUploaded(true);
|
|
824
|
+
}
|
|
825
|
+
} catch (err) {
|
|
826
|
+
console.log(err);
|
|
827
|
+
// setMainLoading(false);
|
|
828
|
+
}
|
|
829
|
+
} else {
|
|
830
|
+
// setMainLoading(false);
|
|
831
|
+
setMessage(
|
|
832
|
+
"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."
|
|
833
|
+
);
|
|
834
|
+
}
|
|
835
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
836
|
+
}, [images, imagesUploaded]);
|
|
837
|
+
|
|
838
|
+
useEffect(async () => {
|
|
839
|
+
if (imagesUploaded) {
|
|
840
|
+
dataImages.articleData = dataImages?.articleData.map((e) => {
|
|
841
|
+
delete e.src;
|
|
842
|
+
e.imageID = e.image_id;
|
|
843
|
+
e.packingType = e.packing_type;
|
|
844
|
+
e.imageType = e.image_type;
|
|
845
|
+
if (product?.orderId) e["orderId"] = product?.orderId;
|
|
846
|
+
return e;
|
|
847
|
+
});
|
|
848
|
+
try {
|
|
849
|
+
const res = await axios.put(
|
|
850
|
+
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
851
|
+
dataImages,
|
|
852
|
+
{
|
|
853
|
+
headers: {
|
|
854
|
+
Authorization: token,
|
|
855
|
+
},
|
|
856
|
+
}
|
|
857
|
+
);
|
|
858
|
+
if (res.data.statusCode === 200) {
|
|
859
|
+
setImages({});
|
|
860
|
+
setMessage("Imágenes guardadas con éxito");
|
|
861
|
+
sessionStorage.removeItem("imagesList");
|
|
862
|
+
await loadData();
|
|
863
|
+
}
|
|
864
|
+
} catch (error) {
|
|
865
|
+
console.log(error);
|
|
866
|
+
}
|
|
867
|
+
}
|
|
868
|
+
}, [dataImages, imagesUploaded]);
|
|
869
|
+
|
|
870
|
+
const getConcept = (tab) => {
|
|
871
|
+
switch (tab) {
|
|
872
|
+
case "Descripción":
|
|
873
|
+
return "description";
|
|
874
|
+
case "Ficha técnica":
|
|
875
|
+
return "datasheet";
|
|
876
|
+
case "Imágenes":
|
|
877
|
+
return "images";
|
|
878
|
+
}
|
|
879
|
+
};
|
|
880
|
+
|
|
881
|
+
const createComment = async (messages = [], retailerId) => {
|
|
882
|
+
const data = {
|
|
883
|
+
paramsBody: {
|
|
884
|
+
id: product.article.id_article || productEdit.ArticleId,
|
|
885
|
+
version: version,
|
|
886
|
+
items: messages,
|
|
887
|
+
retailerId: retailerId,
|
|
888
|
+
status: product.status || productEdit.product.status,
|
|
889
|
+
},
|
|
890
|
+
paramsHeader: { Authorization: token },
|
|
891
|
+
};
|
|
892
|
+
setMessage("");
|
|
893
|
+
return sendMessage(data);
|
|
894
|
+
};
|
|
895
|
+
|
|
896
|
+
useEffect(() => {
|
|
897
|
+
setComment(comments[activeTab]);
|
|
898
|
+
}, [activeTab]);
|
|
899
|
+
|
|
900
|
+
const commentRevised = async () => {
|
|
901
|
+
const data = {
|
|
902
|
+
commentId: comment.id,
|
|
903
|
+
};
|
|
904
|
+
await axios.put(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
905
|
+
headers: {
|
|
906
|
+
Authorization: token,
|
|
907
|
+
},
|
|
908
|
+
});
|
|
909
|
+
setCrossComment(false);
|
|
910
|
+
};
|
|
911
|
+
|
|
912
|
+
const setAssignation = async (assignationType, assignationId) => {
|
|
913
|
+
let concept = "";
|
|
914
|
+
switch (activeTab) {
|
|
915
|
+
case "Ficha técnica":
|
|
916
|
+
concept = "datasheet";
|
|
917
|
+
break;
|
|
918
|
+
case "Imágenes":
|
|
919
|
+
concept = "images";
|
|
920
|
+
break;
|
|
921
|
+
|
|
922
|
+
default:
|
|
923
|
+
concept = "description";
|
|
924
|
+
break;
|
|
925
|
+
}
|
|
926
|
+
const productTemp = product;
|
|
927
|
+
productTemp.article[`id_${concept}_${assignationType}`] = assignationId;
|
|
928
|
+
const data = {
|
|
929
|
+
articleList: [
|
|
930
|
+
{
|
|
931
|
+
orderId: product.orderId,
|
|
932
|
+
articleId: product?.id_article,
|
|
933
|
+
},
|
|
934
|
+
],
|
|
935
|
+
concept: concept,
|
|
936
|
+
userId: assignationId,
|
|
937
|
+
};
|
|
938
|
+
await axios({
|
|
939
|
+
method: "post",
|
|
940
|
+
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
941
|
+
data,
|
|
942
|
+
headers: {
|
|
943
|
+
Authorization: token,
|
|
944
|
+
},
|
|
945
|
+
});
|
|
946
|
+
loadAssignations(productTemp);
|
|
947
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
948
|
+
};
|
|
949
|
+
|
|
950
|
+
const downloadImages = () => {
|
|
951
|
+
selectedImages.length > 0
|
|
952
|
+
? selectedImages.forEach((e) => {
|
|
953
|
+
if (e.id) {
|
|
954
|
+
saveAs(
|
|
955
|
+
`https://${process.env.REACT_APP_IMAGES_BUCKET}.s3.amazonaws.com/${e.srcDB}`,
|
|
956
|
+
`${product.upc || product.article.upc}_${e.name}.${e.ext}`
|
|
957
|
+
);
|
|
958
|
+
}
|
|
959
|
+
})
|
|
960
|
+
: images?.values?.forEach((e) => {
|
|
961
|
+
if (e.id) {
|
|
962
|
+
saveAs(
|
|
963
|
+
`https://${process.env.REACT_APP_IMAGES_BUCKET}.s3.amazonaws.com/${e.srcDB}`,
|
|
964
|
+
`${product.upc || product.article.upc}_${e.name}.${e.ext}`
|
|
965
|
+
);
|
|
966
|
+
}
|
|
967
|
+
});
|
|
968
|
+
};
|
|
969
|
+
|
|
970
|
+
const deleteImages = () => {
|
|
971
|
+
setLoading(true);
|
|
972
|
+
const { values } = images;
|
|
973
|
+
const imgsInBack = [];
|
|
974
|
+
|
|
975
|
+
selectedImages.forEach((selectedImg) => {
|
|
976
|
+
if (selectedImg.id) imgsInBack.push(selectedImg);
|
|
977
|
+
});
|
|
978
|
+
|
|
979
|
+
const imgsLeft = values.filter(
|
|
980
|
+
(value) => selectedImages.indexOf(value) === -1
|
|
981
|
+
);
|
|
982
|
+
|
|
983
|
+
if (imgsInBack.length > 0) {
|
|
984
|
+
const data = {
|
|
985
|
+
articleId: product?.id_article || product?.article?.id_article,
|
|
986
|
+
deleteImages: imgsInBack,
|
|
987
|
+
};
|
|
988
|
+
try {
|
|
989
|
+
axios.put(
|
|
990
|
+
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
991
|
+
data,
|
|
992
|
+
{
|
|
993
|
+
headers: { Authorization: token },
|
|
994
|
+
}
|
|
995
|
+
);
|
|
996
|
+
} catch (err) {
|
|
997
|
+
console.log(err);
|
|
998
|
+
}
|
|
999
|
+
}
|
|
1000
|
+
|
|
1001
|
+
setImages({
|
|
1002
|
+
action: "deleteImage",
|
|
1003
|
+
selectedImages,
|
|
1004
|
+
});
|
|
1005
|
+
|
|
1006
|
+
setTimeout(() => {
|
|
1007
|
+
setLoading(false);
|
|
1008
|
+
}, 500);
|
|
1009
|
+
|
|
1010
|
+
setMessage("");
|
|
1011
|
+
setComponentsArray([]);
|
|
1012
|
+
};
|
|
1013
|
+
|
|
1014
|
+
const askToDeleteImages = () => {
|
|
1015
|
+
if (selectedImages.length > 0) {
|
|
1016
|
+
setMessage("¿Está seguro de eliminar las imágenes seleccionadas?");
|
|
1017
|
+
setComponentsArray([
|
|
1018
|
+
<ScreenHeader
|
|
1019
|
+
key={"1"}
|
|
1020
|
+
text={"¿Está seguro de eliminar las imágenes seleccionadas?"}
|
|
1021
|
+
headerType="retailer-name-header"
|
|
1022
|
+
color={"white"}
|
|
1023
|
+
/>,
|
|
1024
|
+
<Button
|
|
1025
|
+
key={"2"}
|
|
1026
|
+
buttonType="general-white-button"
|
|
1027
|
+
label={"Cancelar"}
|
|
1028
|
+
onClick={() => setMessage("")}
|
|
1029
|
+
/>,
|
|
1030
|
+
<Button
|
|
1031
|
+
key={"3"}
|
|
1032
|
+
buttonType="general-button-default"
|
|
1033
|
+
label={"Aceptar"}
|
|
1034
|
+
onClick={() => {
|
|
1035
|
+
setMessage("");
|
|
1036
|
+
deleteImages();
|
|
1037
|
+
}}
|
|
1038
|
+
/>,
|
|
1039
|
+
]);
|
|
1040
|
+
}
|
|
1041
|
+
};
|
|
1042
|
+
|
|
1043
|
+
const sendEvaluation = async (result) => {
|
|
1044
|
+
setLoading(true);
|
|
1045
|
+
const concept = getConcept(activeTab);
|
|
1046
|
+
const productTemp = product;
|
|
1047
|
+
const articleId = productTemp.id_article;
|
|
1048
|
+
const orderId = productTemp.id_order ?? productTemp.orderId;
|
|
1049
|
+
const sectionStatusKey = `${getConcept(activeTab)}_status`;
|
|
1050
|
+
const evalStatus = product[sectionStatusKey] || product?.version_status;
|
|
1051
|
+
let data = { articleId, orderId, concept, evalStatus };
|
|
1052
|
+
const retailerId = activeRetailer?.id;
|
|
1053
|
+
let res;
|
|
1054
|
+
try {
|
|
1055
|
+
const body = {
|
|
1056
|
+
orderArticleRetailers: [
|
|
1057
|
+
{ orderId, articleId, retailersIds: [activeRetailer.id] },
|
|
1058
|
+
],
|
|
1059
|
+
isAproved: false,
|
|
1060
|
+
service: concept,
|
|
1061
|
+
};
|
|
1062
|
+
if (result) {
|
|
1063
|
+
body.isAproved = result === "A";
|
|
1064
|
+
res = await axios.post(
|
|
1065
|
+
`${process.env.REACT_APP_EVALUATION_REFACTOR}`,
|
|
1066
|
+
body,
|
|
1067
|
+
{
|
|
1068
|
+
headers: {
|
|
1069
|
+
Authorization: token,
|
|
1070
|
+
},
|
|
1071
|
+
}
|
|
1072
|
+
);
|
|
1073
|
+
|
|
1074
|
+
const response = JSON.parse(res.data.body)?.successfulData;
|
|
1075
|
+
const newStatuses = response;
|
|
1076
|
+
const statusObject =
|
|
1077
|
+
response[`${orderId}-${articleId}-${activeRetailer.id}`];
|
|
1078
|
+
const orderStatus = statusObject["generalStatus"];
|
|
1079
|
+
const serviceStatus = newStatuses[`${getConcept(activeTab)}Status`];
|
|
1080
|
+
|
|
1081
|
+
const newProductEdit = productEdit;
|
|
1082
|
+
newProductEdit.product[sectionStatusKey] = serviceStatus;
|
|
1083
|
+
setProductEdit(newProductEdit);
|
|
1084
|
+
const showSurveyByProvider = !user.is_retailer && orderStatus === "AP";
|
|
1085
|
+
const showSurveyByRetailer = user.is_retailer && orderStatus === "ACA";
|
|
1086
|
+
showSurvey && showSurvey(showSurveyByProvider || showSurveyByRetailer);
|
|
1087
|
+
} else {
|
|
1088
|
+
res = await axios.post(
|
|
1089
|
+
`${process.env.REACT_APP_EVALUATION_REFACTOR}`,
|
|
1090
|
+
body,
|
|
1091
|
+
{
|
|
1092
|
+
headers: {
|
|
1093
|
+
Authorization: token,
|
|
1094
|
+
},
|
|
1095
|
+
}
|
|
1096
|
+
);
|
|
1097
|
+
}
|
|
1098
|
+
if (res.data.statusCode === 200) {
|
|
1099
|
+
const response = JSON.parse(res.data.body)?.successfulData;
|
|
1100
|
+
const statusObject =
|
|
1101
|
+
response[`${orderId}-${articleId}-${activeRetailer.id}`];
|
|
1102
|
+
productTemp.status = statusObject["generalStatus"];
|
|
1103
|
+
const retailerStatusCopy = { ...retailerStatus };
|
|
1104
|
+
retailerStatusCopy[activeRetailer.id][concept] =
|
|
1105
|
+
statusObject[`${concept}Status`];
|
|
1106
|
+
setRetailerStatus(retailerStatusCopy);
|
|
1107
|
+
productTemp.statusByRetailer = retailerStatusCopy;
|
|
1108
|
+
let status;
|
|
1109
|
+
status = statusObject[`${concept}Status`];
|
|
1110
|
+
productTemp[`${concept}_status`] = status;
|
|
1111
|
+
setProduct(productTemp);
|
|
1112
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1113
|
+
setOrigin((prev) => ({ ...prev, [concept]: status }));
|
|
1114
|
+
}
|
|
1115
|
+
} catch (err) {
|
|
1116
|
+
console.log(err);
|
|
1117
|
+
}
|
|
1118
|
+
loadData();
|
|
1119
|
+
};
|
|
1120
|
+
|
|
1121
|
+
const validateAll = async (result) => {
|
|
1122
|
+
try {
|
|
1123
|
+
setLoading(true);
|
|
1124
|
+
const evaluationArray = [];
|
|
1125
|
+
const conceptArray = ["description", "datasheet", "images"];
|
|
1126
|
+
const isAproved = result === "A";
|
|
1127
|
+
const retailersIds = [];
|
|
1128
|
+
servicesData?.forEach((ret) => {
|
|
1129
|
+
if (!retailersIds.includes(ret.id_retailer))
|
|
1130
|
+
retailersIds.push(ret.id_retailer);
|
|
1131
|
+
});
|
|
1132
|
+
const body = {
|
|
1133
|
+
orderArticleRetailers: [
|
|
1134
|
+
{
|
|
1135
|
+
orderId: product.id_order ?? product.orderId,
|
|
1136
|
+
articleId: product.article.id_article,
|
|
1137
|
+
retailersIds,
|
|
1138
|
+
},
|
|
1139
|
+
],
|
|
1140
|
+
isAproved,
|
|
1141
|
+
};
|
|
1142
|
+
conceptArray.forEach((concept) => {
|
|
1143
|
+
body.service = concept;
|
|
1144
|
+
evaluationArray.push(
|
|
1145
|
+
axios.post(`${process.env.REACT_APP_EVALUATION_REFACTOR}`, body, {
|
|
1146
|
+
headers: {
|
|
1147
|
+
Authorization: token,
|
|
1148
|
+
},
|
|
1149
|
+
})
|
|
1150
|
+
);
|
|
1151
|
+
});
|
|
1152
|
+
await Promise.all(evaluationArray);
|
|
1153
|
+
const userType = user.is_retailer === 1 ? "CA" : "P";
|
|
1154
|
+
|
|
1155
|
+
const productTemp = product;
|
|
1156
|
+
const status = `${result}${userType}`;
|
|
1157
|
+
productTemp.status = status;
|
|
1158
|
+
productTemp.datasheet_status =
|
|
1159
|
+
productTemp.datasheet_status === "NA" ? "NA" : status;
|
|
1160
|
+
productTemp.description_status =
|
|
1161
|
+
productTemp.description_status === "NA" ? "NA" : status;
|
|
1162
|
+
productTemp.images_status =
|
|
1163
|
+
productTemp.images_status === "NA" ? "NA" : status;
|
|
1164
|
+
|
|
1165
|
+
const retailerStatusCopy = { ...retailerStatus };
|
|
1166
|
+
Object.keys(retailerStatusCopy).forEach((key) => {
|
|
1167
|
+
conceptArray.forEach((concept) => {
|
|
1168
|
+
if (retailerStatusCopy[key][concept]) {
|
|
1169
|
+
retailerStatusCopy[key][concept] = status;
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1172
|
+
});
|
|
1173
|
+
setRetailerStatus(retailerStatusCopy);
|
|
1174
|
+
productTemp.statusByRetailer = retailerStatusCopy;
|
|
1175
|
+
setProduct(productTemp);
|
|
1176
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1177
|
+
setProductEdit({
|
|
1178
|
+
ArticleId: productTemp.id_article,
|
|
1179
|
+
idCategory: productTemp.article.id_category,
|
|
1180
|
+
product: productTemp,
|
|
1181
|
+
});
|
|
1182
|
+
sessionStorage.setItem(
|
|
1183
|
+
"productEdit",
|
|
1184
|
+
JSON.stringify({
|
|
1185
|
+
ArticleId: productTemp.id_article,
|
|
1186
|
+
idCategory: productTemp.article.id_category,
|
|
1187
|
+
product: productTemp,
|
|
1188
|
+
})
|
|
1189
|
+
);
|
|
1190
|
+
|
|
1191
|
+
await loadData();
|
|
1192
|
+
} catch (error) {
|
|
1193
|
+
console.log(error);
|
|
1194
|
+
}
|
|
1195
|
+
};
|
|
1196
|
+
|
|
1197
|
+
const evaluationToRetailer = async (result) => {
|
|
1198
|
+
const data = {
|
|
1199
|
+
articleId: product.id_article,
|
|
1200
|
+
companyId: user.is_retailer
|
|
1201
|
+
? product.provider_company_id
|
|
1202
|
+
: product.retailer_company_id,
|
|
1203
|
+
versionId: product.version,
|
|
1204
|
+
status: result,
|
|
1205
|
+
};
|
|
1206
|
+
await axios.put(`${process.env.REACT_APP_RETAILER_REQUEST}`, data, {
|
|
1207
|
+
headers: {
|
|
1208
|
+
Authorization: token,
|
|
1209
|
+
},
|
|
1210
|
+
});
|
|
1211
|
+
const prod = productEdit;
|
|
1212
|
+
const statusComplete = user.is_retailer ? `${result}CA` : `${result}P`;
|
|
1213
|
+
prod.product.datasheet_status = statusComplete;
|
|
1214
|
+
prod.product.description_status = statusComplete;
|
|
1215
|
+
prod.product.images_status = statusComplete;
|
|
1216
|
+
prod.product.article_status = statusComplete;
|
|
1217
|
+
prod.product.services_status = `["${statusComplete}","${statusComplete}","${statusComplete}"]`;
|
|
1218
|
+
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1219
|
+
setProduct(prod);
|
|
1220
|
+
showGlobalModal("generic");
|
|
1221
|
+
await loadData();
|
|
1222
|
+
};
|
|
1223
|
+
|
|
1224
|
+
const getSectionStatus = () => {
|
|
1225
|
+
const concept = getConcept(activeTab);
|
|
1226
|
+
return ["AA", "AP", "R", "CA", "RCA"].includes(
|
|
1227
|
+
productEdit.product[`${concept}_status`]
|
|
1228
|
+
);
|
|
1229
|
+
};
|
|
1230
|
+
|
|
1231
|
+
const enableActions = (versionStatus) => {
|
|
1232
|
+
try {
|
|
1233
|
+
if (user.is_retailer) return false;
|
|
1234
|
+
|
|
1235
|
+
if (versionStatus) {
|
|
1236
|
+
return ["AP", "ACA", "RCA", null].includes(versionStatus);
|
|
1237
|
+
}
|
|
1238
|
+
return true;
|
|
1239
|
+
} catch (err) {
|
|
1240
|
+
console.log(err, "Unable de check if user is retailer");
|
|
1241
|
+
return false;
|
|
1242
|
+
}
|
|
1243
|
+
};
|
|
1244
|
+
|
|
1245
|
+
useEffect(() => {
|
|
1246
|
+
setSaving(loading);
|
|
1247
|
+
}, [loading]);
|
|
1248
|
+
|
|
1249
|
+
const slidefront = [
|
|
1250
|
+
{
|
|
1251
|
+
slide: Slide1_1,
|
|
1252
|
+
description:
|
|
1253
|
+
"Creamos tu contenido, y todo lo que haga falta para tu producto, cada sección puedes socilitar contenido enriquecido, y nosotros lo haremos por ti.",
|
|
1254
|
+
},
|
|
1255
|
+
{
|
|
1256
|
+
slide: Slide1_2,
|
|
1257
|
+
description:
|
|
1258
|
+
"Puedes agregar solicitudes de contenido enriquecido a tu carrito de compra las veces que sean necesarias. Una vez completada tu lista con los servicios necesitados sigue el proceso de compra en checkout.",
|
|
1259
|
+
},
|
|
1260
|
+
{
|
|
1261
|
+
slide: Slide1_3,
|
|
1262
|
+
description:
|
|
1263
|
+
"Revisa el contenido que deseas solicilitar, valida y tambien puedes agregar contenido extra, traducciones, o simplemente completar el checkout.",
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
slide: Slide1_4,
|
|
1267
|
+
description:
|
|
1268
|
+
"Elige el tipo de entrega de tu producto, puedes ser recolección en el lugar o por el contrario puedes dejarlo en nuestras oficinas.",
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
slide: Slide1_5,
|
|
1272
|
+
title: "Bienvenido al modo Content-oh!",
|
|
1273
|
+
description:
|
|
1274
|
+
"Finalmente elige la forma de pago que más te guste, procede con el pago y listo.",
|
|
1275
|
+
},
|
|
1276
|
+
];
|
|
1277
|
+
const sendToEvaluation = (result) => {
|
|
1278
|
+
console.log({ result });
|
|
1279
|
+
if (result === "A") {
|
|
1280
|
+
if (
|
|
1281
|
+
origin[activeTab] === "RequestWithoutContentoh" &&
|
|
1282
|
+
!user.is_retailer &&
|
|
1283
|
+
(!product.id_order || !product.orderId)
|
|
1284
|
+
) {
|
|
1285
|
+
setDataGenericModal((prev) => ({
|
|
1286
|
+
...prev,
|
|
1287
|
+
button2: {
|
|
1288
|
+
name: "Continuar",
|
|
1289
|
+
action: () => evaluationToRetailer("A"),
|
|
1290
|
+
},
|
|
1291
|
+
}));
|
|
1292
|
+
showGlobalModal("generic");
|
|
1293
|
+
} else if (user.is_retailer) {
|
|
1294
|
+
if (product.id_order || product.orderId) {
|
|
1295
|
+
sendEvaluation("A");
|
|
1296
|
+
} else {
|
|
1297
|
+
setDataGenericModal((prev) => ({
|
|
1298
|
+
...prev,
|
|
1299
|
+
button2: {
|
|
1300
|
+
name: "Continuar",
|
|
1301
|
+
action: () => evaluationToRetailer("A"),
|
|
1302
|
+
},
|
|
1303
|
+
}));
|
|
1304
|
+
showGlobalModal("generic");
|
|
1305
|
+
}
|
|
1306
|
+
} else {
|
|
1307
|
+
sendEvaluation("A");
|
|
1308
|
+
}
|
|
1309
|
+
} else {
|
|
1310
|
+
if (
|
|
1311
|
+
origin === "RequestWithoutContentoh" &&
|
|
1312
|
+
!user.is_retailer &&
|
|
1313
|
+
(!product.id_order || !product.orderId)
|
|
1314
|
+
) {
|
|
1315
|
+
return;
|
|
1316
|
+
} else if (user.is_retailer) {
|
|
1317
|
+
if (product.id_order || product.orderId) {
|
|
1318
|
+
sendEvaluation("R");
|
|
1319
|
+
} else {
|
|
1320
|
+
setDataGenericModal((prev) => ({
|
|
1321
|
+
...prev,
|
|
1322
|
+
button2: {
|
|
1323
|
+
name: "Continuar",
|
|
1324
|
+
action: () => evaluationToRetailer("R"),
|
|
1325
|
+
},
|
|
1326
|
+
}));
|
|
1327
|
+
showGlobalModal("generic");
|
|
1328
|
+
}
|
|
1329
|
+
} else {
|
|
1330
|
+
sendEvaluation("R");
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
};
|
|
1334
|
+
|
|
1335
|
+
return (
|
|
1336
|
+
<Container headerTop={headerTop}>
|
|
1337
|
+
{/* <HeaderTopv2
|
|
1338
|
+
setHeaderTop={setHeaderTop}
|
|
1339
|
+
withChat={false}
|
|
1340
|
+
chatType={location?.state?.chatType}
|
|
1341
|
+
productSelected={productSelected}
|
|
1342
|
+
token={token}
|
|
1343
|
+
activeRetailer={activeRetailer}
|
|
1344
|
+
/> */}
|
|
1345
|
+
<div className="data-container">
|
|
1346
|
+
<div className="product-information">
|
|
1347
|
+
<div className="product-information-image">
|
|
1348
|
+
<div className="product-image">
|
|
1349
|
+
<FullProductNamev2
|
|
1350
|
+
headerData={product}
|
|
1351
|
+
setShowVersionSelector={setShowVersionSelector}
|
|
1352
|
+
percent={activePercentage}
|
|
1353
|
+
activeRetailer={activeRetailer}
|
|
1354
|
+
setActiveRetailer={setActiveRetailer}
|
|
1355
|
+
showValidationButtons={isRevision() && getSectionStatus()}
|
|
1356
|
+
servicesData={servicesData ? servicesData : null}
|
|
1357
|
+
showApproveRejectAll={isRevision() && getSectionStatus()}
|
|
1358
|
+
approveAll={() => {
|
|
1359
|
+
if (
|
|
1360
|
+
origin === "RequestWithoutContentoh" &&
|
|
1361
|
+
!user.is_retailer &&
|
|
1362
|
+
(!product.id_order || !product.orderId)
|
|
1363
|
+
) {
|
|
1364
|
+
setDataGenericModal((prev) => ({
|
|
1365
|
+
...prev,
|
|
1366
|
+
button2: {
|
|
1367
|
+
name: "Continuar",
|
|
1368
|
+
action: () => evaluationToRetailer("A"),
|
|
1369
|
+
},
|
|
1370
|
+
}));
|
|
1371
|
+
showGlobalModal("generic");
|
|
1372
|
+
} else if (user.is_retailer) {
|
|
1373
|
+
if (product.id_order || product.orderId) {
|
|
1374
|
+
validateAll("A");
|
|
1375
|
+
} else {
|
|
1376
|
+
setDataGenericModal((prev) => ({
|
|
1377
|
+
...prev,
|
|
1378
|
+
button2: {
|
|
1379
|
+
name: "Continuar",
|
|
1380
|
+
action: () => evaluationToRetailer("A"),
|
|
1381
|
+
},
|
|
1382
|
+
}));
|
|
1383
|
+
showGlobalModal("generic");
|
|
1384
|
+
}
|
|
1385
|
+
} else {
|
|
1386
|
+
validateAll("A");
|
|
1387
|
+
}
|
|
1388
|
+
}}
|
|
1389
|
+
rejectAll={() => {
|
|
1390
|
+
if (
|
|
1391
|
+
origin === "RequestWithoutContentoh" &&
|
|
1392
|
+
!user.is_retailer &&
|
|
1393
|
+
(!product.id_order || !product.orderId)
|
|
1394
|
+
) {
|
|
1395
|
+
return;
|
|
1396
|
+
} else if (user.is_retailer) {
|
|
1397
|
+
if (product.id_order || product.orderId) {
|
|
1398
|
+
setValidatedAll(true);
|
|
1399
|
+
setShowRejectModal(true);
|
|
1400
|
+
} else {
|
|
1401
|
+
setDataGenericModal((prev) => ({
|
|
1402
|
+
...prev,
|
|
1403
|
+
button2: {
|
|
1404
|
+
name: "Continuar",
|
|
1405
|
+
action: () => evaluationToRetailer("R"),
|
|
1406
|
+
},
|
|
1407
|
+
}));
|
|
1408
|
+
showGlobalModal("generic");
|
|
1409
|
+
}
|
|
1410
|
+
} else {
|
|
1411
|
+
setShowRejectModal(true);
|
|
1412
|
+
setValidatedAll(true);
|
|
1413
|
+
}
|
|
1414
|
+
}}
|
|
1415
|
+
approve={() => sendToEvaluation("A")}
|
|
1416
|
+
reject={() => {
|
|
1417
|
+
setShowRejectModal(true);
|
|
1418
|
+
}}
|
|
1419
|
+
version={version}
|
|
1420
|
+
/>
|
|
1421
|
+
<FullTabsMenuv2
|
|
1422
|
+
tabsSections={tabsSections}
|
|
1423
|
+
status={
|
|
1424
|
+
activeRetailer?.id &&
|
|
1425
|
+
retailerStatus &&
|
|
1426
|
+
retailerStatus[activeRetailer.id]
|
|
1427
|
+
? retailerStatus[activeRetailer?.id][getConcept(activeTab)] ||
|
|
1428
|
+
"NS"
|
|
1429
|
+
: "-"
|
|
1430
|
+
}
|
|
1431
|
+
activeTab={activeTab}
|
|
1432
|
+
setActiveTab={setActiveTab}
|
|
1433
|
+
setImageLayout={setImageLayout}
|
|
1434
|
+
downloadImages={downloadImages}
|
|
1435
|
+
askToDeleteImages={askToDeleteImages}
|
|
1436
|
+
assig={assig}
|
|
1437
|
+
setAssignation={setAssignation}
|
|
1438
|
+
isRetailer={isRetailer}
|
|
1439
|
+
showSaveButton={enableActions(product.version_status)}
|
|
1440
|
+
version={version}
|
|
1441
|
+
updatedDescriptions={updatedDescriptions}
|
|
1442
|
+
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
1443
|
+
updatedDatasheets={updatedDatasheets}
|
|
1444
|
+
setUpdatedDatasheets={setUpdatedDatasheets}
|
|
1445
|
+
images={images}
|
|
1446
|
+
setImages={setImages}
|
|
1447
|
+
selectedImages={selectedImages}
|
|
1448
|
+
setSelectedImages={setSelectedImages}
|
|
1449
|
+
setShowVersionSelector={setShowVersionSelector}
|
|
1450
|
+
headerData={product}
|
|
1451
|
+
activeRetailer={activeRetailer}
|
|
1452
|
+
setActiveRetailer={setActiveRetailer}
|
|
1453
|
+
servicesData={servicesData ? servicesData : null}
|
|
1454
|
+
percentRequired={activePercentage}
|
|
1455
|
+
withChat={location?.state?.withChat}
|
|
1456
|
+
chatType={location?.state?.chatType}
|
|
1457
|
+
productSelected={productSelected}
|
|
1458
|
+
token={token}
|
|
1459
|
+
/>
|
|
1460
|
+
</div>
|
|
1461
|
+
<div className="image-data-panel">
|
|
1462
|
+
<ImagePreviewerv2
|
|
1463
|
+
activeImage={images?.values ? images?.values[activeImage] : {}}
|
|
1464
|
+
imagesArray={images}
|
|
1465
|
+
setActiveImage={setActiveImage}
|
|
1466
|
+
setShowModal={setShowModal}
|
|
1467
|
+
showSelector={false}
|
|
1468
|
+
/>
|
|
1469
|
+
</div>
|
|
1470
|
+
</div>
|
|
1471
|
+
<div
|
|
1472
|
+
className={
|
|
1473
|
+
"services-information-container " +
|
|
1474
|
+
(imageLayout && activeTab === "Imágenes" ? "image-services" : "")
|
|
1475
|
+
}
|
|
1476
|
+
>
|
|
1477
|
+
{loading ? (
|
|
1478
|
+
<Loading />
|
|
1479
|
+
) : (
|
|
1480
|
+
<>
|
|
1481
|
+
{!imageLayout && activeTab === "Imágenes" && (
|
|
1482
|
+
<div className="container-imagesM">
|
|
1483
|
+
<div className="container-bars">
|
|
1484
|
+
<MandatoryBar maximas={imageRules.maxImg}
|
|
1485
|
+
minimas={imageRules.minImg}
|
|
1486
|
+
obligatorias={imageRules.requiredImg}></MandatoryBar>
|
|
1487
|
+
<RenameImagesBar></RenameImagesBar>
|
|
1488
|
+
</div>
|
|
1489
|
+
<GalleryHeaderv2
|
|
1490
|
+
setSelectedImages={setSelectedImages}
|
|
1491
|
+
checkAll={checkAll}
|
|
1492
|
+
setCheckAll={setCheckAll}
|
|
1493
|
+
/>
|
|
1494
|
+
</div>
|
|
1495
|
+
)}
|
|
1496
|
+
{activeTab === "Ficha técnica" &&
|
|
1497
|
+
(product?.datasheet_status !== "NS" ? (
|
|
1498
|
+
<div>
|
|
1499
|
+
{datasheets[0]?.data?.map((dataGroup, index) => (
|
|
1500
|
+
<InputGroupv2
|
|
1501
|
+
key={index + "-" + activeRetailer.name}
|
|
1502
|
+
articleId={product.id_article}
|
|
1503
|
+
version={version}
|
|
1504
|
+
activeSection={activeTab}
|
|
1505
|
+
inputGroup={dataGroup}
|
|
1506
|
+
dataInputs={datasheets[1]}
|
|
1507
|
+
updatedDatasheets={updatedDatasheets}
|
|
1508
|
+
setUpdatedDatasheets={setUpdatedDatasheets}
|
|
1509
|
+
isShowbox={true}
|
|
1510
|
+
activeRetailer={services[0][activeRetailer.id]}
|
|
1511
|
+
groupData={services[0][activeRetailer.id].data}
|
|
1512
|
+
setUpdatedBoxData={(e) => {
|
|
1513
|
+
setBoxData(e);
|
|
1514
|
+
}}
|
|
1515
|
+
index={index}
|
|
1516
|
+
//enableActions={enableActions(product.version_status)} ADD THIS VALIDATION
|
|
1517
|
+
/>
|
|
1518
|
+
))}
|
|
1519
|
+
</div>
|
|
1520
|
+
) : (
|
|
1521
|
+
<ScreenHeader
|
|
1522
|
+
text={"No cuentas con este servicio"}
|
|
1523
|
+
headerType={"input-name-header"}
|
|
1524
|
+
/>
|
|
1525
|
+
))}
|
|
1526
|
+
{activeTab === "Descripción" &&
|
|
1527
|
+
(product?.description_status !== "NS" ? (
|
|
1528
|
+
<InputGroupv2
|
|
1529
|
+
activeSection={activeTab}
|
|
1530
|
+
inputGroup={descriptions[0]}
|
|
1531
|
+
updatedDescriptions={updatedDescriptions}
|
|
1532
|
+
setUpdatedDescriptions={setUpdatedDescriptions}
|
|
1533
|
+
articleId={product?.id_article}
|
|
1534
|
+
version={version}
|
|
1535
|
+
isShowbox={false}
|
|
1536
|
+
dinamicHeight={true}
|
|
1537
|
+
showTooltip={true}
|
|
1538
|
+
showMissingChars={true}
|
|
1539
|
+
/>
|
|
1540
|
+
) : (
|
|
1541
|
+
<ScreenHeader
|
|
1542
|
+
text={"No cuentas con este servicio"}
|
|
1543
|
+
headerType={"input-name-header"}
|
|
1544
|
+
/>
|
|
1545
|
+
))}
|
|
1546
|
+
|
|
1547
|
+
{activeTab === "Imágenes" &&
|
|
1548
|
+
(product?.images_status !== "NS" ? (
|
|
1549
|
+
<section className="container">
|
|
1550
|
+
<div {...getRootProps({ className: "dropzone" })}>
|
|
1551
|
+
<input {...getInputProps()} />
|
|
1552
|
+
<aside>{thumbs()}</aside>
|
|
1553
|
+
</div>
|
|
1554
|
+
</section>
|
|
1555
|
+
) : (
|
|
1556
|
+
<ScreenHeader
|
|
1557
|
+
text={"No cuentas con este servicio"}
|
|
1558
|
+
headerType={"input-name-header"}
|
|
1559
|
+
/>
|
|
1560
|
+
))}
|
|
1561
|
+
</>
|
|
1562
|
+
)}
|
|
1563
|
+
</div>
|
|
1564
|
+
{!(isRevision() && getSectionStatus()) && !revision && (
|
|
1565
|
+
<div className="required-inputs-message">
|
|
1566
|
+
<div>
|
|
1567
|
+
<p>
|
|
1568
|
+
Los atributos son requeridos por las plataformas de las
|
|
1569
|
+
cadenas, es muy importante completar los campos requeridos ya
|
|
1570
|
+
que pueden rechazar el producto por falta de información.
|
|
1571
|
+
</p>
|
|
1572
|
+
</div>
|
|
1573
|
+
{inCart ? (
|
|
1574
|
+
<button type="button">
|
|
1575
|
+
<Link to="/checkout">
|
|
1576
|
+
<p>Articulo en carrito</p>
|
|
1577
|
+
<p>Ir a checkout</p>
|
|
1578
|
+
</Link>
|
|
1579
|
+
</button>
|
|
1580
|
+
) : (
|
|
1581
|
+
<>
|
|
1582
|
+
<SliderToolTip
|
|
1583
|
+
infoIcon={InfoIcon}
|
|
1584
|
+
slidefront={slidefront}
|
|
1585
|
+
iconSize={"big-image"}
|
|
1586
|
+
slidePosition={"top-slide"}
|
|
1587
|
+
/>
|
|
1588
|
+
<Button
|
|
1589
|
+
onClick={() => {
|
|
1590
|
+
setShowContentohRequestModal &&
|
|
1591
|
+
setShowContentohRequestModal(true);
|
|
1592
|
+
}}
|
|
1593
|
+
buttonType="general-default-button"
|
|
1594
|
+
label="Enviar a Content-oh!"
|
|
1595
|
+
/>
|
|
1596
|
+
</>
|
|
1597
|
+
)}
|
|
1598
|
+
</div>
|
|
1599
|
+
)}
|
|
1600
|
+
</div>
|
|
1601
|
+
</div>
|
|
1602
|
+
<CompleteServices
|
|
1603
|
+
headerData={product}
|
|
1604
|
+
activeRetailer={activeRetailer}
|
|
1605
|
+
setActiveRetailer={setActiveRetailer}
|
|
1606
|
+
showValidationButtons={isRevision() && getSectionStatus()}
|
|
1607
|
+
showApproveRejectAll={isRevision() && getSectionStatus()}
|
|
1608
|
+
approveAll={() => {
|
|
1609
|
+
if (
|
|
1610
|
+
origin === "RequestWithoutContentoh" &&
|
|
1611
|
+
!user.is_retailer &&
|
|
1612
|
+
(!product.id_order || !product.orderId)
|
|
1613
|
+
) {
|
|
1614
|
+
setDataGenericModal((prev) => ({
|
|
1615
|
+
...prev,
|
|
1616
|
+
button2: {
|
|
1617
|
+
name: "Continuar",
|
|
1618
|
+
action: () => evaluationToRetailer("A"),
|
|
1619
|
+
},
|
|
1620
|
+
}));
|
|
1621
|
+
showGlobalModal("generic");
|
|
1622
|
+
} else if (user.is_retailer) {
|
|
1623
|
+
if (product.id_order || product.orderId) {
|
|
1624
|
+
validateAll("A");
|
|
1625
|
+
} else {
|
|
1626
|
+
setDataGenericModal((prev) => ({
|
|
1627
|
+
...prev,
|
|
1628
|
+
button2: {
|
|
1629
|
+
name: "Continuar",
|
|
1630
|
+
action: () => evaluationToRetailer("A"),
|
|
1631
|
+
},
|
|
1632
|
+
}));
|
|
1633
|
+
showGlobalModal("generic");
|
|
1634
|
+
}
|
|
1635
|
+
} else {
|
|
1636
|
+
validateAll("A");
|
|
1637
|
+
}
|
|
1638
|
+
}}
|
|
1639
|
+
rejectAll={() => {
|
|
1640
|
+
if (
|
|
1641
|
+
origin === "RequestWithoutContentoh" &&
|
|
1642
|
+
!user.is_retailer &&
|
|
1643
|
+
(!product.id_order || !product.orderId)
|
|
1644
|
+
) {
|
|
1645
|
+
return;
|
|
1646
|
+
} else if (user.is_retailer) {
|
|
1647
|
+
if (product.id_order || product.orderId) {
|
|
1648
|
+
setValidatedAll(true);
|
|
1649
|
+
setShowRejectModal(true);
|
|
1650
|
+
} else {
|
|
1651
|
+
setDataGenericModal((prev) => ({
|
|
1652
|
+
...prev,
|
|
1653
|
+
button2: {
|
|
1654
|
+
name: "Continuar",
|
|
1655
|
+
action: () => evaluationToRetailer("R"),
|
|
1656
|
+
},
|
|
1657
|
+
}));
|
|
1658
|
+
showGlobalModal("generic");
|
|
1659
|
+
}
|
|
1660
|
+
} else {
|
|
1661
|
+
setShowRejectModal(true);
|
|
1662
|
+
setValidatedAll(true);
|
|
1663
|
+
}
|
|
1664
|
+
}}
|
|
1665
|
+
approve={() => sendToEvaluation("A")}
|
|
1666
|
+
reject={() => {
|
|
1667
|
+
setShowRejectModal(true);
|
|
1668
|
+
}}
|
|
1669
|
+
onClick={() => {
|
|
1670
|
+
setShowContentohRequestModal &&
|
|
1671
|
+
setShowContentohRequestModal(true);
|
|
1672
|
+
}}
|
|
1673
|
+
|
|
1674
|
+
></CompleteServices>
|
|
1675
|
+
{showModal && (
|
|
1676
|
+
<ProductImageModalv2
|
|
1677
|
+
images={images}
|
|
1678
|
+
setShowModal={setShowModal}
|
|
1679
|
+
approveRejectButtons={isRevision() && getSectionStatus()}
|
|
1680
|
+
sendToFacilitator={sendToEvaluation}
|
|
1681
|
+
/>
|
|
1682
|
+
)}
|
|
1683
|
+
{message.length > 0 && !showSurvey && (
|
|
1684
|
+
<GenericModal
|
|
1685
|
+
buttonType={componentsArray.length > 0 && "delete-product"}
|
|
1686
|
+
componentsArray={
|
|
1687
|
+
componentsArray.length > 0
|
|
1688
|
+
? componentsArray
|
|
1689
|
+
: [
|
|
1690
|
+
<img key="1" src={succes} alt="success icon" />,
|
|
1691
|
+
<ScreenHeader
|
|
1692
|
+
key="2"
|
|
1693
|
+
headerType={"retailer-name-header"}
|
|
1694
|
+
text={message}
|
|
1695
|
+
color={"white"}
|
|
1696
|
+
/>,
|
|
1697
|
+
]
|
|
1698
|
+
}
|
|
1699
|
+
onClick={() => setMessage("")}
|
|
1700
|
+
/>
|
|
1701
|
+
)}
|
|
1702
|
+
{globalModal && <GlobalModal close={closeGlobalModal} {...globalModal} />}
|
|
1703
|
+
{showVersionSelector && (
|
|
1704
|
+
<VersionSelectorv2
|
|
1705
|
+
modalId={"version-selector"}
|
|
1706
|
+
articleId={product.id_article}
|
|
1707
|
+
setVersion={setVersion}
|
|
1708
|
+
companyName={company.company_name}
|
|
1709
|
+
currentVersion={version}
|
|
1710
|
+
setShowVersionSelector={setShowVersionSelector}
|
|
1711
|
+
jwt={token}
|
|
1712
|
+
/>
|
|
1713
|
+
)}
|
|
1714
|
+
{showRejectModal && (
|
|
1715
|
+
<Modal
|
|
1716
|
+
title={"Agregar mensaje de rechazo"}
|
|
1717
|
+
show={showRejectModal}
|
|
1718
|
+
customComponent={
|
|
1719
|
+
<TagAndInputv2
|
|
1720
|
+
inputType={"textarea"}
|
|
1721
|
+
inputId={"modal-message-box"}
|
|
1722
|
+
index={0}
|
|
1723
|
+
color={"white"}
|
|
1724
|
+
/>
|
|
1725
|
+
}
|
|
1726
|
+
buttons={[
|
|
1727
|
+
<ButtonV2
|
|
1728
|
+
key={"btn-Cancelar"}
|
|
1729
|
+
type={"white"}
|
|
1730
|
+
label={"Cancelar"}
|
|
1731
|
+
size={12}
|
|
1732
|
+
onClick={() => {
|
|
1733
|
+
setShowRejectModal(false);
|
|
1734
|
+
}}
|
|
1735
|
+
/>,
|
|
1736
|
+
<ButtonV2
|
|
1737
|
+
key={"btn-Aceptar"}
|
|
1738
|
+
type={"pink"}
|
|
1739
|
+
label={"Aceptar"}
|
|
1740
|
+
size={12}
|
|
1741
|
+
onClick={async () => {
|
|
1742
|
+
const body = document.querySelector(
|
|
1743
|
+
"#modal-message-box .ql-container .ql-editor > p"
|
|
1744
|
+
).innerHTML;
|
|
1745
|
+
const messages = [
|
|
1746
|
+
{ type: "message", value: body?.replace(/<.*?\/?>/gm, "") },
|
|
1747
|
+
];
|
|
1748
|
+
await createComment(messages, activeRetailer.id);
|
|
1749
|
+
validatedAll ? validateAll("R") : sendToEvaluation("R");
|
|
1750
|
+
setShowRejectModal(false);
|
|
1751
|
+
}}
|
|
1752
|
+
/>,
|
|
1753
|
+
]}
|
|
1754
|
+
/>
|
|
1755
|
+
)}
|
|
1756
|
+
</Container>
|
|
1757
|
+
);
|
|
1758
|
+
};
|