contentoh-components-library 21.0.71 → 21.0.74
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 -5
- package/.env.production +18 -3
- package/CHANGELOG.md +31 -33
- 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/modalsSVGs/attributesSent.svg +208 -0
- package/dist/assets/images/modalsSVGs/descriptionSent.svg +237 -0
- package/dist/assets/images/modalsSVGs/providerSent.svg +445 -0
- package/dist/assets/images/modalsSVGs/uploadingImages.svg +148 -0
- package/dist/components/atoms/AsignationOption/index.js +9 -5
- package/dist/components/atoms/AsignationOption/styles.js +1 -1
- package/dist/components/{molecules/SignInLogin/SignInLogin.stories.js → atoms/CharCounter/CharCounter.stories.js} +10 -7
- package/dist/components/atoms/CharCounter/index.js +22 -0
- package/dist/components/{molecules/LogoLoading → atoms/CharCounter}/styles.js +3 -1
- package/dist/components/atoms/CheckBox/index.js +4 -2
- package/dist/components/atoms/Commentary/Commentary.stories.js +1 -0
- package/dist/components/atoms/Commentary/index.js +23 -0
- package/dist/components/{organisms/ChangePassword → atoms/Commentary}/styles.js +6 -1
- package/dist/components/atoms/GeneralButton/index.js +5 -0
- package/dist/components/atoms/GeneralButton/styles.js +4 -2
- package/dist/components/atoms/GeneralInput/index.js +72 -25
- package/dist/components/atoms/GeneralInput/styles.js +7 -1
- package/dist/components/atoms/GenericModal/index.js +4 -2
- package/dist/components/atoms/GenericModal/styles.js +1 -1
- package/dist/components/atoms/GradientPanel/styles.js +1 -1
- package/dist/components/atoms/Input/index.js +26 -0
- package/dist/components/atoms/Input/style.js +26 -0
- package/dist/components/{organisms/ChangePassword/ChangePassword.stories.js → atoms/InputFormatter/Wysiwyg.stories.js} +9 -7
- package/dist/components/atoms/InputFormatter/index.js +184 -0
- package/dist/components/atoms/InputFormatter/styles.js +33 -0
- package/dist/components/atoms/LabelToInput/index.js +53 -0
- package/dist/components/atoms/LabelToInput/style.js +22 -0
- package/dist/components/atoms/Loading/index.js +0 -1
- package/dist/components/atoms/LogoImage/index.js +0 -1
- package/dist/components/atoms/Percent/Percent.stories.js +39 -0
- package/dist/components/atoms/Percent/index.js +39 -0
- package/dist/components/atoms/Percent/styles.js +20 -0
- package/dist/components/atoms/PriorityFlag/index.js +1 -1
- package/dist/components/atoms/ProductImage/styles.js +1 -1
- package/dist/components/atoms/ProgressBar/index.js +2 -2
- package/dist/components/atoms/ProgressBar/styles.js +3 -5
- package/dist/components/atoms/ScreenHeader/index.js +1 -1
- package/dist/components/atoms/ScreenHeader/styles.js +1 -1
- package/dist/components/atoms/Select/index.js +39 -0
- package/dist/components/atoms/Select/style.js +32 -0
- package/dist/components/atoms/StatusTag/index.js +37 -2
- package/dist/components/atoms/StatusTag/styles.js +1 -1
- package/dist/components/atoms/ValidationPanel/index.js +5 -3
- package/dist/components/molecules/AvatarAndValidation/index.js +17 -7
- package/dist/components/molecules/AvatarAndValidation/styles.js +1 -1
- package/dist/components/molecules/CarouselImagesLogin/index.js +42 -40
- package/dist/components/molecules/FeaturesBar/index.js +1 -1
- package/dist/components/molecules/GalleryElement/index.js +80 -21
- package/dist/components/molecules/GalleryElement/styles.js +1 -1
- package/dist/components/molecules/GalleryHeader/index.js +28 -6
- package/dist/components/molecules/GalleryHeader/styles.js +1 -1
- package/dist/components/molecules/ImageSelector/index.js +2 -4
- package/dist/components/molecules/LoginPasswordStrength/index.js +9 -9
- package/dist/components/molecules/LoginPasswordStrength/styles.js +1 -1
- package/dist/components/molecules/ProductNameHeader/index.js +1 -2
- package/dist/components/molecules/RetailerSelector/RetailerSelector.stories.js +48 -0
- package/dist/components/molecules/RetailerSelector/index.js +74 -0
- package/dist/components/{atoms/MenuCommercialRetailers → molecules/RetailerSelector}/styles.js +1 -1
- package/dist/components/molecules/StatusAsignationInfo/index.js +46 -28
- package/dist/components/molecules/StatusAsignationInfo/styles.js +1 -1
- package/dist/components/molecules/TableHeader/index.js +12 -5
- package/dist/components/molecules/TableHeader/styles.js +1 -1
- package/dist/components/molecules/TagAndInput/index.js +24 -2
- package/dist/components/molecules/TextAndGradient/TextAndGradient.stories.js +31 -0
- package/dist/components/molecules/TextAndGradient/index.js +36 -0
- package/dist/components/molecules/TextAndGradient/styles.js +18 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +31 -9
- package/dist/components/organisms/FullTabsMenu/index.js +18 -5
- package/dist/components/organisms/GlobalModal/index.js +73 -0
- package/dist/components/organisms/GlobalModal/styles.js +66 -0
- package/dist/components/organisms/ImageDataTable/index.js +90 -14
- package/dist/components/organisms/InputGroup/index.js +34 -13
- package/dist/components/organisms/InputGroup/styles.js +1 -1
- package/dist/components/organisms/ProductImageModal/index.js +13 -10
- package/dist/components/organisms/ProductImageModal/styles.js +1 -1
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +135 -0
- package/dist/components/pages/ProviderProductEdition/index.js +1979 -0
- package/dist/components/pages/ProviderProductEdition/styles.js +23 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +91 -347
- package/dist/components/pages/RetailerProductEdition/index.js +1610 -60
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/global-files/data.js +213 -53
- package/dist/global-files/global-styles.css +1 -0
- package/dist/global-files/variables.js +1 -0
- package/dist/index.js +34 -268
- package/package.json +17 -18
- 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/modalsSVGs/attributesSent.svg +208 -0
- package/src/assets/images/modalsSVGs/descriptionSent.svg +237 -0
- package/src/assets/images/modalsSVGs/providerSent.svg +445 -0
- package/src/assets/images/modalsSVGs/uploadingImages.svg +148 -0
- package/src/components/atoms/AsignationOption/index.js +7 -5
- package/src/components/atoms/AsignationOption/styles.js +9 -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/Commentary.stories.js +0 -0
- package/src/components/atoms/Commentary/index.js +9 -0
- package/src/components/atoms/Commentary/styles.js +16 -0
- package/src/components/atoms/GeneralButton/index.js +9 -2
- package/src/components/atoms/GeneralButton/styles.js +23 -0
- package/src/components/atoms/GeneralInput/index.js +71 -23
- package/src/components/atoms/GeneralInput/styles.js +11 -1
- package/src/components/atoms/GenericModal/index.js +2 -2
- package/src/components/atoms/GenericModal/styles.js +10 -2
- package/src/components/atoms/GradientPanel/styles.js +0 -1
- package/src/components/atoms/Input/index.js +15 -0
- package/src/components/atoms/Input/style.js +31 -0
- package/src/components/atoms/InputFormatter/Wysiwyg.stories.js +12 -0
- package/src/components/atoms/InputFormatter/index.js +144 -0
- package/src/components/atoms/InputFormatter/styles.js +40 -0
- package/src/components/atoms/LabelToInput/index.js +26 -0
- package/src/components/atoms/LabelToInput/style.js +41 -0
- package/src/components/atoms/Loading/index.js +2 -3
- package/src/components/atoms/LogoImage/index.js +1 -1
- package/src/components/atoms/PriorityFlag/index.js +1 -1
- package/src/components/atoms/ProductImage/styles.js +1 -1
- package/src/components/atoms/ProgressBar/index.js +2 -2
- package/src/components/atoms/ProgressBar/styles.js +54 -3
- package/src/components/atoms/ScreenHeader/index.js +7 -3
- package/src/components/atoms/ScreenHeader/styles.js +9 -2
- package/src/components/atoms/Select/index.js +35 -0
- package/src/components/atoms/Select/style.js +76 -0
- package/src/components/atoms/StatusTag/index.js +30 -2
- package/src/components/atoms/StatusTag/styles.js +15 -3
- package/src/components/atoms/ValidationPanel/index.js +4 -3
- package/src/components/molecules/AvatarAndValidation/index.js +23 -6
- package/src/components/molecules/AvatarAndValidation/styles.js +1 -1
- package/src/components/molecules/CarouselImagesLogin/index.js +37 -34
- package/src/components/molecules/FeaturesBar/index.js +10 -7
- package/src/components/molecules/GalleryElement/index.js +75 -36
- package/src/components/molecules/GalleryElement/styles.js +38 -11
- package/src/components/molecules/GalleryHeader/index.js +14 -8
- package/src/components/molecules/GalleryHeader/styles.js +16 -0
- package/src/components/molecules/ImageSelector/index.js +2 -3
- package/src/components/molecules/LoginPasswordStrength/index.js +6 -11
- package/src/components/molecules/LoginPasswordStrength/styles.js +1 -5
- package/src/components/molecules/ProductNameHeader/index.js +1 -2
- package/src/components/molecules/RetailerSelector/RetailerSelector.stories.js +35 -0
- package/src/components/molecules/RetailerSelector/index.js +63 -0
- package/src/components/molecules/RetailerSelector/styles.js +18 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +64 -39
- package/src/components/molecules/StatusAsignationInfo/styles.js +12 -2
- package/src/components/molecules/TableHeader/index.js +16 -3
- package/src/components/molecules/TableHeader/styles.js +5 -0
- package/src/components/molecules/TagAndInput/index.js +24 -2
- package/src/components/organisms/FullProductNameHeader/index.js +38 -8
- package/src/components/organisms/FullTabsMenu/index.js +15 -3
- 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 +89 -11
- package/src/components/organisms/InputGroup/index.js +46 -11
- package/src/components/organisms/InputGroup/styles.js +3 -0
- package/src/components/organisms/ProductImageModal/index.js +19 -12
- package/src/components/organisms/ProductImageModal/styles.js +3 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +123 -0
- package/src/components/pages/ProviderProductEdition/index.js +1493 -0
- package/src/components/pages/ProviderProductEdition/styles.js +118 -0
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +91 -343
- package/src/components/pages/RetailerProductEdition/index.js +1245 -48
- package/src/components/pages/RetailerProductEdition/styles.js +67 -4
- package/src/global-files/data.js +158 -57
- package/src/global-files/global-styles.css +1 -0
- package/src/global-files/variables.js +1 -0
- package/src/index.js +2 -20
- package/dist/assets/images/editField/showPassword.png +0 -0
- package/dist/assets/images/sliderToolTip/infoIcon.svg +0 -4
- package/dist/assets/images/sliderToolTip/slide1.svg +0 -5
- package/dist/assets/images/sliderToolTip/slide2.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide3.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide4.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide5.svg +0 -40
- package/dist/components/atoms/ListCommercialRetailers/ListCommercialRetailers.stories.js +0 -36
- package/dist/components/atoms/ListCommercialRetailers/index.js +0 -64
- package/dist/components/atoms/ListCommercialRetailers/styles.js +0 -20
- package/dist/components/atoms/Loading/Loading.stories.js +0 -28
- package/dist/components/atoms/MenuCommercialRetailers/MenuCommercialRetailers.stories.js +0 -37
- package/dist/components/atoms/MenuCommercialRetailers/index.js +0 -25
- package/dist/components/atoms/MenuProductImage/MenuProductImage.stories.js +0 -28
- package/dist/components/atoms/MenuProductImage/index.js +0 -88
- package/dist/components/atoms/MenuProductImage/styles.js +0 -20
- package/dist/components/atoms/SliderToolTip/SliderToolTip.stories.js +0 -47
- package/dist/components/atoms/SliderToolTip/index.js +0 -200
- package/dist/components/atoms/SliderToolTip/styles.js +0 -24
- package/dist/components/atoms/VerticalSideMenuMainPage/VerticalSideMenuMainPage.stories.js +0 -28
- package/dist/components/atoms/VerticalSideMenuMainPage/index.js +0 -94
- package/dist/components/atoms/VerticalSideMenuMainPage/styles.js +0 -24
- package/dist/components/molecules/ApproveRejetPanel/ApproveRejetPanel.stories.js +0 -25
- package/dist/components/molecules/ApproveRejetPanel/index.js +0 -49
- package/dist/components/molecules/ApproveRejetPanel/styles.js +0 -18
- package/dist/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +0 -28
- package/dist/components/molecules/EmailResetPasswordLogin/index.js +0 -153
- package/dist/components/molecules/EmailResetPasswordLogin/styles.js +0 -20
- package/dist/components/molecules/LogoLoading/Loading.stories.js +0 -28
- package/dist/components/molecules/LogoLoading/index.js +0 -22
- package/dist/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +0 -28
- package/dist/components/molecules/RegistrationFirstStep/index.js +0 -308
- package/dist/components/molecules/RegistrationFirstStep/styles.js +0 -20
- package/dist/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +0 -28
- package/dist/components/molecules/RegistrationSecondStep/index.js +0 -173
- package/dist/components/molecules/RegistrationSecondStep/styles.js +0 -20
- package/dist/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +0 -28
- package/dist/components/molecules/RegistrationThirdStep/index.js +0 -155
- package/dist/components/molecules/RegistrationThirdStep/styles.js +0 -20
- package/dist/components/molecules/SignInLogin/index.js +0 -315
- package/dist/components/molecules/SignInLogin/styles.js +0 -20
- package/dist/components/molecules/SignInLoginCreationApp/SignInLogin.stories.js +0 -28
- package/dist/components/molecules/SignInLoginCreationApp/index.js +0 -270
- package/dist/components/molecules/SignInLoginCreationApp/styles.js +0 -20
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +0 -28
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/index.js +0 -211
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/styles.js +0 -20
- package/dist/components/molecules/VerificationCodeResetPasswordLogin/utils.js +0 -69
- package/dist/components/organisms/ChangePassword/index.js +0 -124
- package/src/assets/images/editField/showPassword.png +0 -0
- package/src/assets/images/sliderToolTip/infoIcon.svg +0 -4
- package/src/assets/images/sliderToolTip/slide1.svg +0 -5
- package/src/assets/images/sliderToolTip/slide2.svg +0 -9
- package/src/assets/images/sliderToolTip/slide3.svg +0 -9
- package/src/assets/images/sliderToolTip/slide4.svg +0 -9
- package/src/assets/images/sliderToolTip/slide5.svg +0 -40
- package/src/assets/images/verticalSideMenuMainPage/closeMenu.svg +0 -4
- package/src/assets/images/verticalSideMenuMainPage/iconFAQS.svg +0 -12
- package/src/assets/images/verticalSideMenuMainPage/iconGroup.svg +0 -3
- package/src/assets/images/verticalSideMenuMainPage/iconLogo.svg +0 -12
- package/src/assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg +0 -15
- package/src/assets/images/verticalSideMenuMainPage/iconProduct.svg +0 -3
- package/src/assets/images/verticalSideMenuMainPage/iconSpeedometer.svg +0 -12
- package/src/assets/images/verticalSideMenuMainPage/iconTask.svg +0 -10
- package/src/assets/images/verticalSideMenuMainPage/openMenu.svg +0 -4
- package/src/components/atoms/Loading/Loading.stories.js +0 -10
- package/src/components/atoms/SliderToolTip/SliderToolTip.stories.js +0 -23
- package/src/components/atoms/SliderToolTip/index.js +0 -182
- package/src/components/atoms/SliderToolTip/styles.js +0 -168
- package/src/components/atoms/VerticalSideMenuMainPage/VerticalSideMenuMainPage.stories.js +0 -12
- package/src/components/atoms/VerticalSideMenuMainPage/index.js +0 -51
- package/src/components/atoms/VerticalSideMenuMainPage/styles.js +0 -44
- package/src/components/molecules/EmailResetPasswordLogin/EmailResetPasswordLogin.stories.js +0 -11
- package/src/components/molecules/EmailResetPasswordLogin/index.js +0 -85
- package/src/components/molecules/EmailResetPasswordLogin/styles.js +0 -23
- package/src/components/molecules/LogoLoading/Loading.stories.js +0 -10
- package/src/components/molecules/LogoLoading/index.js +0 -12
- package/src/components/molecules/LogoLoading/styles.js +0 -16
- package/src/components/molecules/RegistrationFirstStep/RegistrationFirstStep.stories.js +0 -11
- package/src/components/molecules/RegistrationFirstStep/index.js +0 -227
- package/src/components/molecules/RegistrationFirstStep/styles.js +0 -87
- package/src/components/molecules/RegistrationSecondStep/RegistrationSecondStep.stories.js +0 -11
- package/src/components/molecules/RegistrationSecondStep/index.js +0 -136
- package/src/components/molecules/RegistrationSecondStep/styles.js +0 -64
- package/src/components/molecules/RegistrationThirdStep/RegistrationThirdStep.stories.js +0 -11
- package/src/components/molecules/RegistrationThirdStep/index.js +0 -130
- package/src/components/molecules/RegistrationThirdStep/styles.js +0 -44
- package/src/components/molecules/SignInLogin/SignInLogin.stories.js +0 -11
- package/src/components/molecules/SignInLogin/index.js +0 -226
- package/src/components/molecules/SignInLogin/styles.js +0 -120
- package/src/components/molecules/VerificationCodeResetPasswordLogin/VerificationCodeResetPasswordLogin.stories.js +0 -11
- package/src/components/molecules/VerificationCodeResetPasswordLogin/index.js +0 -171
- package/src/components/molecules/VerificationCodeResetPasswordLogin/styles.js +0 -54
- package/src/components/molecules/VerificationCodeResetPasswordLogin/utils.js +0 -54
- package/src/components/organisms/ChangePassword/ChangePassword.stories.js +0 -11
- package/src/components/organisms/ChangePassword/index.js +0 -77
- package/src/components/organisms/ChangePassword/styles.js +0 -13
|
@@ -0,0 +1,1979 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ProviderProductEdition = void 0;
|
|
9
|
+
|
|
10
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
|
+
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
15
|
+
|
|
16
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
17
|
+
|
|
18
|
+
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
19
|
+
|
|
20
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
21
|
+
|
|
22
|
+
var _styles = require("./styles");
|
|
23
|
+
|
|
24
|
+
var _HeaderTop = require("../../molecules/HeaderTop");
|
|
25
|
+
|
|
26
|
+
var _ImagePreviewer = require("../../organisms/ImagePreviewer");
|
|
27
|
+
|
|
28
|
+
var _ImageDataTable = require("../../organisms/ImageDataTable");
|
|
29
|
+
|
|
30
|
+
var _FullProductNameHeader = require("../../organisms/FullProductNameHeader");
|
|
31
|
+
|
|
32
|
+
var _FullTabsMenu = require("../../organisms/FullTabsMenu");
|
|
33
|
+
|
|
34
|
+
var _InputGroup = require("../../organisms/InputGroup");
|
|
35
|
+
|
|
36
|
+
var _react = require("react");
|
|
37
|
+
|
|
38
|
+
var _GalleryElement = require("../../molecules/GalleryElement");
|
|
39
|
+
|
|
40
|
+
var _fileSaver = require("file-saver");
|
|
41
|
+
|
|
42
|
+
var _data2 = require("../../../global-files/data");
|
|
43
|
+
|
|
44
|
+
var _GalleryHeader = require("../../molecules/GalleryHeader");
|
|
45
|
+
|
|
46
|
+
var _ProductImageModal = require("../../organisms/ProductImageModal");
|
|
47
|
+
|
|
48
|
+
var _reactDropzone = require("react-dropzone");
|
|
49
|
+
|
|
50
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
51
|
+
|
|
52
|
+
var _uuid = require("uuid");
|
|
53
|
+
|
|
54
|
+
var _awsSdk = _interopRequireDefault(require("aws-sdk"));
|
|
55
|
+
|
|
56
|
+
var _attributesSent = _interopRequireDefault(require("../../../assets/images/modalsSVGs/attributesSent.svg"));
|
|
57
|
+
|
|
58
|
+
var _descriptionSent = _interopRequireDefault(require("../../../assets/images/modalsSVGs/descriptionSent.svg"));
|
|
59
|
+
|
|
60
|
+
var _uploadingImages = _interopRequireDefault(require("../../../assets/images/modalsSVGs/uploadingImages.svg"));
|
|
61
|
+
|
|
62
|
+
var _index = require("../../molecules/TagAndInput/index");
|
|
63
|
+
|
|
64
|
+
var _GeneralButton = require("../../atoms/GeneralButton");
|
|
65
|
+
|
|
66
|
+
var _Commentary = require("../../atoms/Commentary");
|
|
67
|
+
|
|
68
|
+
var _GenericModal = require("../../atoms/GenericModal");
|
|
69
|
+
|
|
70
|
+
var _ScreenHeader = require("../../atoms/ScreenHeader");
|
|
71
|
+
|
|
72
|
+
var _Loading = require("../../atoms/Loading");
|
|
73
|
+
|
|
74
|
+
var _genericModalCheck = _interopRequireDefault(require("../../../assets/images/genericModal/genericModalCheck.svg"));
|
|
75
|
+
|
|
76
|
+
var _reactRouterDom = require("react-router-dom");
|
|
77
|
+
|
|
78
|
+
var _defaultProfileImage = _interopRequireDefault(require("../../../assets/images/defaultImages/defaultProfileImage.svg"));
|
|
79
|
+
|
|
80
|
+
var _errorModal = _interopRequireDefault(require("../../../assets/images/genericModal/errorModal.svg"));
|
|
81
|
+
|
|
82
|
+
var _index2 = require("../../organisms/GlobalModal/index");
|
|
83
|
+
|
|
84
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
85
|
+
|
|
86
|
+
var reducerImages = function reducerImages(state, action) {
|
|
87
|
+
var values = state.values,
|
|
88
|
+
attrForImgs = state.attrForImgs;
|
|
89
|
+
|
|
90
|
+
switch (action.action) {
|
|
91
|
+
case "init":
|
|
92
|
+
return action.init;
|
|
93
|
+
|
|
94
|
+
case "addImg":
|
|
95
|
+
values = [].concat((0, _toConsumableArray2.default)(values), [action.img]);
|
|
96
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
|
|
97
|
+
values: values
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
case "changeImageInfo":
|
|
101
|
+
values[action.index][action.attribute] = action.value;
|
|
102
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
|
|
103
|
+
values: values
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
case "changeAttrValue":
|
|
107
|
+
attrForImgs[action.retailer][action.index].value = action.value;
|
|
108
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
|
|
109
|
+
attrForImgs: attrForImgs,
|
|
110
|
+
values: values
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
default:
|
|
114
|
+
return state;
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
var S3_BUCKET = process.env.REACT_APP_IMAGES_BUCKET;
|
|
119
|
+
var REGION = "us-east-1";
|
|
120
|
+
|
|
121
|
+
_awsSdk.default.config.update({
|
|
122
|
+
accessKeyId: process.env.REACT_APP_KEY_UPLOAD_TO_S3,
|
|
123
|
+
secretAccessKey: process.env.REACT_APP_ACCESS_KEY_UPLOAD_TO_S3
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
var myBucket = new _awsSdk.default.S3({
|
|
127
|
+
params: {
|
|
128
|
+
Bucket: S3_BUCKET
|
|
129
|
+
},
|
|
130
|
+
region: REGION
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
134
|
+
var _product$retailers, _product$retailersAva, _location$state, _product$services2, _datasheets$, _datasheets$$data;
|
|
135
|
+
|
|
136
|
+
var tabsSections = _ref.tabsSections,
|
|
137
|
+
_ref$productSelected = _ref.productSelected,
|
|
138
|
+
productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
|
|
139
|
+
productToEdit = _ref.productToEdit,
|
|
140
|
+
_ref$user = _ref.user,
|
|
141
|
+
user = _ref$user === void 0 ? {} : _ref$user,
|
|
142
|
+
_ref$location = _ref.location,
|
|
143
|
+
location = _ref$location === void 0 ? {} : _ref$location,
|
|
144
|
+
token = _ref.token,
|
|
145
|
+
_ref$revision = _ref.revision,
|
|
146
|
+
revision = _ref$revision === void 0 ? false : _ref$revision,
|
|
147
|
+
setShowContentohRequestModal = _ref.setShowContentohRequestModal,
|
|
148
|
+
showSurvey = _ref.showSurvey;
|
|
149
|
+
|
|
150
|
+
var _useState = (0, _react.useState)("Descripción"),
|
|
151
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
152
|
+
activeTab = _useState2[0],
|
|
153
|
+
setActiveTab = _useState2[1];
|
|
154
|
+
|
|
155
|
+
var _useState3 = (0, _react.useState)(),
|
|
156
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
157
|
+
activeImage = _useState4[0],
|
|
158
|
+
setActiveImage = _useState4[1];
|
|
159
|
+
|
|
160
|
+
var _useState5 = (0, _react.useState)(false),
|
|
161
|
+
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
162
|
+
imageLayout = _useState6[0],
|
|
163
|
+
setImageLayout = _useState6[1];
|
|
164
|
+
|
|
165
|
+
var _useState7 = (0, _react.useState)(0),
|
|
166
|
+
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
167
|
+
headerTop = _useState8[0],
|
|
168
|
+
setHeaderTop = _useState8[1];
|
|
169
|
+
|
|
170
|
+
var _useState9 = (0, _react.useState)([]),
|
|
171
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
172
|
+
descriptions = _useState10[0],
|
|
173
|
+
setDescriptions = _useState10[1];
|
|
174
|
+
|
|
175
|
+
var _useState11 = (0, _react.useState)([]),
|
|
176
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
177
|
+
datasheets = _useState12[0],
|
|
178
|
+
setDatasheets = _useState12[1];
|
|
179
|
+
|
|
180
|
+
var _useReducer = (0, _react.useReducer)(reducerImages, {}),
|
|
181
|
+
_useReducer2 = (0, _slicedToArray2.default)(_useReducer, 2),
|
|
182
|
+
images = _useReducer2[0],
|
|
183
|
+
setImages = _useReducer2[1];
|
|
184
|
+
|
|
185
|
+
var _useState13 = (0, _react.useState)(false),
|
|
186
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
187
|
+
showModal = _useState14[0],
|
|
188
|
+
setShowModal = _useState14[1];
|
|
189
|
+
|
|
190
|
+
var _useDropzone = (0, _reactDropzone.useDropzone)({
|
|
191
|
+
accept: "image/*",
|
|
192
|
+
noKeyboard: true,
|
|
193
|
+
multiple: true,
|
|
194
|
+
noClick: true,
|
|
195
|
+
onDrop: function onDrop(acceptedFiles) {
|
|
196
|
+
var newImages = [];
|
|
197
|
+
acceptedFiles.map(function (file) {
|
|
198
|
+
var reader = new FileReader();
|
|
199
|
+
reader.fileName = file.name;
|
|
200
|
+
|
|
201
|
+
reader.onload = /*#__PURE__*/function () {
|
|
202
|
+
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(e) {
|
|
203
|
+
var ext, img, width, height, newImg;
|
|
204
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
205
|
+
while (1) {
|
|
206
|
+
switch (_context.prev = _context.next) {
|
|
207
|
+
case 0:
|
|
208
|
+
ext = e.srcElement.fileName.split(".");
|
|
209
|
+
img = new Image();
|
|
210
|
+
img.src = e.target.result;
|
|
211
|
+
width = img.width;
|
|
212
|
+
height = img.height;
|
|
213
|
+
newImg = {
|
|
214
|
+
action: "addImg",
|
|
215
|
+
img: {
|
|
216
|
+
src: e.target.result,
|
|
217
|
+
name: e.target.fileName,
|
|
218
|
+
ext: ext[ext.length - 1],
|
|
219
|
+
width: width,
|
|
220
|
+
height: width
|
|
221
|
+
}
|
|
222
|
+
};
|
|
223
|
+
setImages(newImg);
|
|
224
|
+
|
|
225
|
+
case 7:
|
|
226
|
+
case "end":
|
|
227
|
+
return _context.stop();
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
}, _callee);
|
|
231
|
+
}));
|
|
232
|
+
|
|
233
|
+
return function (_x) {
|
|
234
|
+
return _ref2.apply(this, arguments);
|
|
235
|
+
};
|
|
236
|
+
}();
|
|
237
|
+
|
|
238
|
+
reader.onerror = function (error) {
|
|
239
|
+
console.log("dropzoneError: ", error);
|
|
240
|
+
};
|
|
241
|
+
|
|
242
|
+
reader.readAsDataURL(file);
|
|
243
|
+
return file;
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
}),
|
|
247
|
+
getRootProps = _useDropzone.getRootProps,
|
|
248
|
+
getInputProps = _useDropzone.getInputProps;
|
|
249
|
+
|
|
250
|
+
var _useState15 = (0, _react.useState)([]),
|
|
251
|
+
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
252
|
+
updatedDatasheets = _useState16[0],
|
|
253
|
+
setUpdatedDatasheets = _useState16[1];
|
|
254
|
+
|
|
255
|
+
var _useState17 = (0, _react.useState)([]),
|
|
256
|
+
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
257
|
+
updatedDescriptions = _useState18[0],
|
|
258
|
+
setUpdatedDescriptions = _useState18[1];
|
|
259
|
+
|
|
260
|
+
var _useState19 = (0, _react.useState)(false),
|
|
261
|
+
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
262
|
+
imagesUploaded = _useState20[0],
|
|
263
|
+
setImagesUploaded = _useState20[1];
|
|
264
|
+
|
|
265
|
+
var _useState21 = (0, _react.useState)(),
|
|
266
|
+
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
267
|
+
dataImages = _useState22[0],
|
|
268
|
+
setDataImages = _useState22[1];
|
|
269
|
+
|
|
270
|
+
var _useState23 = (0, _react.useState)(product !== null && product !== void 0 && product.retailers ? new Array(product === null || product === void 0 ? void 0 : (_product$retailers = product.retailers) === null || _product$retailers === void 0 ? void 0 : _product$retailers.length).fill({
|
|
271
|
+
percentage: 0
|
|
272
|
+
}) : new Array(product === null || product === void 0 ? void 0 : (_product$retailersAva = product.retailersAvailable) === null || _product$retailersAva === void 0 ? void 0 : _product$retailersAva.length).fill({
|
|
273
|
+
percentage: 0
|
|
274
|
+
})),
|
|
275
|
+
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
276
|
+
percentages = _useState24[0],
|
|
277
|
+
setPercentages = _useState24[1];
|
|
278
|
+
|
|
279
|
+
var _useState25 = (0, _react.useState)(0),
|
|
280
|
+
_useState26 = (0, _slicedToArray2.default)(_useState25, 2),
|
|
281
|
+
activePercentage = _useState26[0],
|
|
282
|
+
setActivePercentage = _useState26[1];
|
|
283
|
+
|
|
284
|
+
var _useState27 = (0, _react.useState)({}),
|
|
285
|
+
_useState28 = (0, _slicedToArray2.default)(_useState27, 2),
|
|
286
|
+
activeRetailer = _useState28[0],
|
|
287
|
+
setActiveRetailer = _useState28[1];
|
|
288
|
+
|
|
289
|
+
var _useState29 = (0, _react.useState)([]),
|
|
290
|
+
_useState30 = (0, _slicedToArray2.default)(_useState29, 2),
|
|
291
|
+
services = _useState30[0],
|
|
292
|
+
setServices = _useState30[1];
|
|
293
|
+
|
|
294
|
+
var _useState31 = (0, _react.useState)([]),
|
|
295
|
+
_useState32 = (0, _slicedToArray2.default)(_useState31, 2),
|
|
296
|
+
servicesData = _useState32[0],
|
|
297
|
+
setServicesData = _useState32[1];
|
|
298
|
+
|
|
299
|
+
var _useState33 = (0, _react.useState)(""),
|
|
300
|
+
_useState34 = (0, _slicedToArray2.default)(_useState33, 2),
|
|
301
|
+
message = _useState34[0],
|
|
302
|
+
setMessage = _useState34[1];
|
|
303
|
+
|
|
304
|
+
var _useState35 = (0, _react.useState)(JSON.parse(sessionStorage.getItem("productSelected")) ? JSON.parse(sessionStorage.getItem("productSelected")) : productSelected),
|
|
305
|
+
_useState36 = (0, _slicedToArray2.default)(_useState35, 2),
|
|
306
|
+
product = _useState36[0],
|
|
307
|
+
setProduct = _useState36[1];
|
|
308
|
+
|
|
309
|
+
var _useState37 = (0, _react.useState)(JSON.parse(sessionStorage.getItem("productEdit")) ? JSON.parse(sessionStorage.getItem("productEdit")) : productToEdit),
|
|
310
|
+
_useState38 = (0, _slicedToArray2.default)(_useState37, 2),
|
|
311
|
+
productEdit = _useState38[0],
|
|
312
|
+
setProductEdit = _useState38[1];
|
|
313
|
+
|
|
314
|
+
var _useState39 = (0, _react.useState)(null),
|
|
315
|
+
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
316
|
+
icon = _useState40[0],
|
|
317
|
+
setIcon = _useState40[1];
|
|
318
|
+
|
|
319
|
+
var _useState41 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
|
|
320
|
+
_useState42 = (0, _slicedToArray2.default)(_useState41, 2),
|
|
321
|
+
version = _useState42[0],
|
|
322
|
+
setVersion = _useState42[1];
|
|
323
|
+
|
|
324
|
+
var _useState43 = (0, _react.useState)({}),
|
|
325
|
+
_useState44 = (0, _slicedToArray2.default)(_useState43, 2),
|
|
326
|
+
comments = _useState44[0],
|
|
327
|
+
setComments = _useState44[1];
|
|
328
|
+
|
|
329
|
+
var _useState45 = (0, _react.useState)(""),
|
|
330
|
+
_useState46 = (0, _slicedToArray2.default)(_useState45, 2),
|
|
331
|
+
comment = _useState46[0],
|
|
332
|
+
setComment = _useState46[1];
|
|
333
|
+
|
|
334
|
+
var _useState47 = (0, _react.useState)({
|
|
335
|
+
"Ficha técnica": 0,
|
|
336
|
+
Descripción: 0,
|
|
337
|
+
Imágenes: 0
|
|
338
|
+
}),
|
|
339
|
+
_useState48 = (0, _slicedToArray2.default)(_useState47, 2),
|
|
340
|
+
requiredNull = _useState48[0],
|
|
341
|
+
setRequiredNull = _useState48[1];
|
|
342
|
+
|
|
343
|
+
var _useState49 = (0, _react.useState)(false),
|
|
344
|
+
_useState50 = (0, _slicedToArray2.default)(_useState49, 2),
|
|
345
|
+
crossComment = _useState50[0],
|
|
346
|
+
setCrossComment = _useState50[1];
|
|
347
|
+
|
|
348
|
+
var _useState51 = (0, _react.useState)([]),
|
|
349
|
+
_useState52 = (0, _slicedToArray2.default)(_useState51, 2),
|
|
350
|
+
userGroups = _useState52[0],
|
|
351
|
+
setUserGroups = _useState52[1];
|
|
352
|
+
|
|
353
|
+
var _useState53 = (0, _react.useState)({}),
|
|
354
|
+
_useState54 = (0, _slicedToArray2.default)(_useState53, 2),
|
|
355
|
+
assig = _useState54[0],
|
|
356
|
+
setAssig = _useState54[1];
|
|
357
|
+
|
|
358
|
+
var _useState55 = (0, _react.useState)([]),
|
|
359
|
+
_useState56 = (0, _slicedToArray2.default)(_useState55, 2),
|
|
360
|
+
selectedImages = _useState56[0],
|
|
361
|
+
setSelectedImages = _useState56[1];
|
|
362
|
+
|
|
363
|
+
var _useState57 = (0, _react.useState)([]),
|
|
364
|
+
_useState58 = (0, _slicedToArray2.default)(_useState57, 2),
|
|
365
|
+
componentsArray = _useState58[0],
|
|
366
|
+
setComponentsArray = _useState58[1];
|
|
367
|
+
|
|
368
|
+
var _useState59 = (0, _react.useState)(false),
|
|
369
|
+
_useState60 = (0, _slicedToArray2.default)(_useState59, 2),
|
|
370
|
+
checkAll = _useState60[0],
|
|
371
|
+
setCheckAll = _useState60[1];
|
|
372
|
+
|
|
373
|
+
var isRetailer = user === null || user === void 0 ? void 0 : user.is_retailer;
|
|
374
|
+
|
|
375
|
+
var _useState61 = (0, _react.useState)(true),
|
|
376
|
+
_useState62 = (0, _slicedToArray2.default)(_useState61, 2),
|
|
377
|
+
loading = _useState62[0],
|
|
378
|
+
setLoading = _useState62[1];
|
|
379
|
+
|
|
380
|
+
var _useState63 = (0, _react.useState)([]),
|
|
381
|
+
_useState64 = (0, _slicedToArray2.default)(_useState63, 2),
|
|
382
|
+
statusArray = _useState64[0],
|
|
383
|
+
setStatusArray = _useState64[1];
|
|
384
|
+
|
|
385
|
+
var originProp = location === null || location === void 0 ? void 0 : (_location$state = location.state) === null || _location$state === void 0 ? void 0 : _location$state.origin;
|
|
386
|
+
|
|
387
|
+
var _useState65 = (0, _react.useState)({
|
|
388
|
+
"Ficha técnica": originProp,
|
|
389
|
+
Descripción: originProp,
|
|
390
|
+
Imágenes: originProp
|
|
391
|
+
}),
|
|
392
|
+
_useState66 = (0, _slicedToArray2.default)(_useState65, 2),
|
|
393
|
+
origin = _useState66[0],
|
|
394
|
+
setOrigin = _useState66[1];
|
|
395
|
+
|
|
396
|
+
var _useState67 = (0, _react.useState)(false),
|
|
397
|
+
_useState68 = (0, _slicedToArray2.default)(_useState67, 2),
|
|
398
|
+
inCart = _useState68[0],
|
|
399
|
+
setInCart = _useState68[1];
|
|
400
|
+
|
|
401
|
+
var _useState69 = (0, _react.useState)(false),
|
|
402
|
+
_useState70 = (0, _slicedToArray2.default)(_useState69, 2),
|
|
403
|
+
modalSent = _useState70[0],
|
|
404
|
+
setModalSent = _useState70[1];
|
|
405
|
+
|
|
406
|
+
var _useState71 = (0, _react.useState)(false),
|
|
407
|
+
_useState72 = (0, _slicedToArray2.default)(_useState71, 2),
|
|
408
|
+
modalViewError = _useState72[0],
|
|
409
|
+
setModalViewError = _useState72[1];
|
|
410
|
+
|
|
411
|
+
var _useState73 = (0, _react.useState)(false),
|
|
412
|
+
_useState74 = (0, _slicedToArray2.default)(_useState73, 2),
|
|
413
|
+
showGenericModal = _useState74[0],
|
|
414
|
+
setShowGenericModal = _useState74[1];
|
|
415
|
+
|
|
416
|
+
var _useState75 = (0, _react.useState)({
|
|
417
|
+
message: "¿Estás seguro de continuar?",
|
|
418
|
+
detail: " ".concat(user.is_retailer ? "Asegurate de haber revisado las tres secciones" : "Envíar el producto a la cadena"),
|
|
419
|
+
button1: {
|
|
420
|
+
name: "Cerrar",
|
|
421
|
+
action: function action() {
|
|
422
|
+
return setModalViewTextArea(false);
|
|
423
|
+
}
|
|
424
|
+
},
|
|
425
|
+
button2: {
|
|
426
|
+
name: "Continuar",
|
|
427
|
+
action: function action() {
|
|
428
|
+
return evaluationToRetailer(false);
|
|
429
|
+
}
|
|
430
|
+
},
|
|
431
|
+
img: _defaultProfileImage.default
|
|
432
|
+
}),
|
|
433
|
+
_useState76 = (0, _slicedToArray2.default)(_useState75, 2),
|
|
434
|
+
dataGenericModal = _useState76[0],
|
|
435
|
+
setDataGenericModal = _useState76[1];
|
|
436
|
+
|
|
437
|
+
var _useState77 = (0, _react.useState)(false),
|
|
438
|
+
_useState78 = (0, _slicedToArray2.default)(_useState77, 2),
|
|
439
|
+
modalViewTextArea = _useState78[0],
|
|
440
|
+
setModalViewTextArea = _useState78[1];
|
|
441
|
+
|
|
442
|
+
(0, _react.useEffect)(function () {
|
|
443
|
+
checkAll && setSelectedImages(images.values);
|
|
444
|
+
}, [checkAll]);
|
|
445
|
+
|
|
446
|
+
var loadData = /*#__PURE__*/function () {
|
|
447
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
448
|
+
var _product$article, _product$article2, _services$, _services$$values;
|
|
449
|
+
|
|
450
|
+
var services;
|
|
451
|
+
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
452
|
+
while (1) {
|
|
453
|
+
switch (_context2.prev = _context2.next) {
|
|
454
|
+
case 0:
|
|
455
|
+
_context2.next = 2;
|
|
456
|
+
return (0, _data2.getRetailerServices)((product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article), parseInt((product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.id_category) || (product === null || product === void 0 ? void 0 : product.id_category)), product === null || product === void 0 ? void 0 : product.version);
|
|
457
|
+
|
|
458
|
+
case 2:
|
|
459
|
+
services = _context2.sent;
|
|
460
|
+
//Converts the data inside the datasheets object to array
|
|
461
|
+
setServices(services); //setActiveRetailer(product?.retailers[0]);
|
|
462
|
+
|
|
463
|
+
setImages({
|
|
464
|
+
action: "init",
|
|
465
|
+
init: services[2]
|
|
466
|
+
});
|
|
467
|
+
if (((_services$ = services[2]) === null || _services$ === void 0 ? void 0 : (_services$$values = _services$.values) === null || _services$$values === void 0 ? void 0 : _services$$values.length) > 0) setActiveImage(0);
|
|
468
|
+
setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
|
|
469
|
+
(0, _data2.getPercentage)({
|
|
470
|
+
data: [product]
|
|
471
|
+
}).then(function (res) {
|
|
472
|
+
return setPercentages(res);
|
|
473
|
+
});
|
|
474
|
+
setLoading(false);
|
|
475
|
+
|
|
476
|
+
case 9:
|
|
477
|
+
case "end":
|
|
478
|
+
return _context2.stop();
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}, _callee2);
|
|
482
|
+
}));
|
|
483
|
+
|
|
484
|
+
return function loadData() {
|
|
485
|
+
return _ref3.apply(this, arguments);
|
|
486
|
+
};
|
|
487
|
+
}();
|
|
488
|
+
|
|
489
|
+
var getServices = /*#__PURE__*/function () {
|
|
490
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
491
|
+
var productInOrder, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse;
|
|
492
|
+
|
|
493
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
494
|
+
while (1) {
|
|
495
|
+
switch (_context3.prev = _context3.next) {
|
|
496
|
+
case 0:
|
|
497
|
+
productInOrder = product.id_order || product.orderId;
|
|
498
|
+
|
|
499
|
+
if (!(isRevision() || productInOrder)) {
|
|
500
|
+
_context3.next = 7;
|
|
501
|
+
break;
|
|
502
|
+
}
|
|
503
|
+
|
|
504
|
+
_context3.next = 4;
|
|
505
|
+
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : product.id_article, "&orderId=").concat((_product$id_order = product === null || product === void 0 ? void 0 : product.id_order) !== null && _product$id_order !== void 0 ? _product$id_order : product.orderId, "&end=true"));
|
|
506
|
+
|
|
507
|
+
case 4:
|
|
508
|
+
servicesResponse = _context3.sent;
|
|
509
|
+
parsedResponse = JSON.parse(servicesResponse === null || servicesResponse === void 0 ? void 0 : (_servicesResponse$dat = servicesResponse.data) === null || _servicesResponse$dat === void 0 ? void 0 : _servicesResponse$dat.body).data;
|
|
510
|
+
setServicesData(parsedResponse);
|
|
511
|
+
|
|
512
|
+
case 7:
|
|
513
|
+
case "end":
|
|
514
|
+
return _context3.stop();
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}, _callee3);
|
|
518
|
+
}));
|
|
519
|
+
|
|
520
|
+
return function getServices() {
|
|
521
|
+
return _ref4.apply(this, arguments);
|
|
522
|
+
};
|
|
523
|
+
}();
|
|
524
|
+
|
|
525
|
+
var translateConcept = function translateConcept(concept) {
|
|
526
|
+
var translation = "";
|
|
527
|
+
|
|
528
|
+
if (concept === "datasheet") {
|
|
529
|
+
translation = "Ficha técnica";
|
|
530
|
+
} else if (concept === "description") {
|
|
531
|
+
translation = "Descripción";
|
|
532
|
+
} else if (concept === "images") {
|
|
533
|
+
translation = "Imágenes";
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
return translation;
|
|
537
|
+
};
|
|
538
|
+
|
|
539
|
+
var isRevision = function isRevision() {
|
|
540
|
+
if (productEdit) {
|
|
541
|
+
var concept = getConcept(activeTab);
|
|
542
|
+
var _isRetailer = user.is_retailer;
|
|
543
|
+
var currentService = productEdit === null || productEdit === void 0 ? void 0 : productEdit.product["".concat(concept, "_status")];
|
|
544
|
+
var orgn = origin[activeTab];
|
|
545
|
+
|
|
546
|
+
var _revision = ["RequestWithContentoh", "RequestWithoutContentoh", "Contentoh"].includes(orgn);
|
|
547
|
+
|
|
548
|
+
if (_isRetailer) {
|
|
549
|
+
if (_revision && currentService === "AP") return true;
|
|
550
|
+
} else {
|
|
551
|
+
var _product = productEdit.product;
|
|
552
|
+
if (orgn === "Contentoh" || ["RECEIVED", "IN_PROGRESS"].includes(currentService) && orgn === "RequestWithoutContentoh" || currentService === "AA" && orgn === "RequestWithContentoh" || currentService === "RC" && orgn === "RequestWithoutContentoh" && (!_product.id_order || !_product.orderId)) return true;
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
return false;
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
var getCart = /*#__PURE__*/function () {
|
|
560
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
561
|
+
var res, arr;
|
|
562
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
563
|
+
while (1) {
|
|
564
|
+
switch (_context4.prev = _context4.next) {
|
|
565
|
+
case 0:
|
|
566
|
+
_context4.next = 2;
|
|
567
|
+
return _axios.default.get(process.env.REACT_APP_CART, {
|
|
568
|
+
headers: {
|
|
569
|
+
Authorization: token
|
|
570
|
+
}
|
|
571
|
+
});
|
|
572
|
+
|
|
573
|
+
case 2:
|
|
574
|
+
res = _context4.sent;
|
|
575
|
+
arr = JSON.parse(res.data.body).data.map(function (e) {
|
|
576
|
+
return e.article_id;
|
|
577
|
+
});
|
|
578
|
+
setInCart(arr.some(function (e) {
|
|
579
|
+
return e.articleId === product.id_article;
|
|
580
|
+
}));
|
|
581
|
+
|
|
582
|
+
case 5:
|
|
583
|
+
case "end":
|
|
584
|
+
return _context4.stop();
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
}, _callee4);
|
|
588
|
+
}));
|
|
589
|
+
|
|
590
|
+
return function getCart() {
|
|
591
|
+
return _ref5.apply(this, arguments);
|
|
592
|
+
};
|
|
593
|
+
}();
|
|
594
|
+
|
|
595
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
596
|
+
var arr;
|
|
597
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
598
|
+
while (1) {
|
|
599
|
+
switch (_context5.prev = _context5.next) {
|
|
600
|
+
case 0:
|
|
601
|
+
loadData(); // getPercentage({ data: [product] }).then((res) =>
|
|
602
|
+
// setPercentages(res)
|
|
603
|
+
// );
|
|
604
|
+
|
|
605
|
+
getCart();
|
|
606
|
+
getServices();
|
|
607
|
+
_context5.t0 = setUserGroups;
|
|
608
|
+
_context5.next = 6;
|
|
609
|
+
return (0, _data2.fetchUsers)(token);
|
|
610
|
+
|
|
611
|
+
case 6:
|
|
612
|
+
_context5.t1 = _context5.sent;
|
|
613
|
+
(0, _context5.t0)(_context5.t1);
|
|
614
|
+
arr = [];
|
|
615
|
+
_context5.t2 = user.id_role;
|
|
616
|
+
_context5.next = _context5.t2 === 7 ? 12 : _context5.t2 === 8 ? 12 : _context5.t2 === 4 ? 14 : _context5.t2 === 5 ? 14 : _context5.t2 === 6 ? 16 : 18;
|
|
617
|
+
break;
|
|
618
|
+
|
|
619
|
+
case 12:
|
|
620
|
+
arr = ["IN_PROGRESS", "RF", "RA"];
|
|
621
|
+
return _context5.abrupt("break", 20);
|
|
622
|
+
|
|
623
|
+
case 14:
|
|
624
|
+
arr = ["RF", "AF", "AA", "AP", "AC"];
|
|
625
|
+
return _context5.abrupt("break", 20);
|
|
626
|
+
|
|
627
|
+
case 16:
|
|
628
|
+
arr = ["RP", "RC", "AF"];
|
|
629
|
+
return _context5.abrupt("break", 20);
|
|
630
|
+
|
|
631
|
+
case 18:
|
|
632
|
+
arr = [];
|
|
633
|
+
return _context5.abrupt("break", 20);
|
|
634
|
+
|
|
635
|
+
case 20:
|
|
636
|
+
setStatusArray(arr);
|
|
637
|
+
|
|
638
|
+
case 21:
|
|
639
|
+
case "end":
|
|
640
|
+
return _context5.stop();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}, _callee5);
|
|
644
|
+
})), [product]);
|
|
645
|
+
|
|
646
|
+
var loadAssignations = function loadAssignations(currentProduct) {
|
|
647
|
+
setAssig(product === null || product === void 0 ? void 0 : product.asignations);
|
|
648
|
+
};
|
|
649
|
+
|
|
650
|
+
(0, _react.useEffect)(function () {
|
|
651
|
+
loadAssignations(product);
|
|
652
|
+
}, [userGroups]);
|
|
653
|
+
(0, _react.useEffect)(function () {
|
|
654
|
+
var _retailers$;
|
|
655
|
+
|
|
656
|
+
var productTemp = product;
|
|
657
|
+
var retailers = (productTemp === null || productTemp === void 0 ? void 0 : productTemp.retailersAvailable) || (productTemp === null || productTemp === void 0 ? void 0 : productTemp.retailers);
|
|
658
|
+
retailers === null || retailers === void 0 ? void 0 : retailers.forEach(function (retailer) {
|
|
659
|
+
var _percentages$filter$;
|
|
660
|
+
|
|
661
|
+
retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$filter$ = percentages.filter(function (percent) {
|
|
662
|
+
return (retailer === null || retailer === void 0 ? void 0 : retailer.id) === (percent === null || percent === void 0 ? void 0 : percent.id_retailer);
|
|
663
|
+
})[0]) === null || _percentages$filter$ === void 0 ? void 0 : _percentages$filter$.percentage;
|
|
664
|
+
});
|
|
665
|
+
setProduct(productTemp);
|
|
666
|
+
setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
|
|
667
|
+
}, [percentages]);
|
|
668
|
+
(0, _react.useEffect)(function () {
|
|
669
|
+
if (services.length > 0) {
|
|
670
|
+
var _services$0$activeRet, _services$2, _services$3;
|
|
671
|
+
|
|
672
|
+
if ((_services$0$activeRet = services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id]) !== null && _services$0$activeRet !== void 0 && _services$0$activeRet.data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
|
|
673
|
+
setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
|
|
674
|
+
var datagroups = services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id];
|
|
675
|
+
var inputs = (_services$2 = services[0]) === null || _services$2 === void 0 ? void 0 : _services$2.inputs;
|
|
676
|
+
|
|
677
|
+
var _descriptions = (_services$3 = services[1]) === null || _services$3 === void 0 ? void 0 : _services$3.filter(function (service) {
|
|
678
|
+
return (service === null || service === void 0 ? void 0 : service.id) === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
|
|
679
|
+
});
|
|
680
|
+
|
|
681
|
+
setDatasheets([datagroups, inputs]);
|
|
682
|
+
setDescriptions(_descriptions);
|
|
683
|
+
}
|
|
684
|
+
}, [activeRetailer, services]);
|
|
685
|
+
|
|
686
|
+
var thumbs = function thumbs() {
|
|
687
|
+
var _images$inputs, _images$imageType, _images$imagePackagin, _images$values;
|
|
688
|
+
|
|
689
|
+
var imageInputs = images === null || images === void 0 ? void 0 : (_images$inputs = images.inputs) === null || _images$inputs === void 0 ? void 0 : _images$inputs.map(function (e) {
|
|
690
|
+
return {
|
|
691
|
+
value: e === null || e === void 0 ? void 0 : e.id,
|
|
692
|
+
name: e === null || e === void 0 ? void 0 : e.name,
|
|
693
|
+
required: e === null || e === void 0 ? void 0 : e.required
|
|
694
|
+
};
|
|
695
|
+
});
|
|
696
|
+
var imageType = images === null || images === void 0 ? void 0 : (_images$imageType = images.imageType) === null || _images$imageType === void 0 ? void 0 : _images$imageType.map(function (e) {
|
|
697
|
+
return {
|
|
698
|
+
value: e === null || e === void 0 ? void 0 : e.id,
|
|
699
|
+
name: e === null || e === void 0 ? void 0 : e.name
|
|
700
|
+
};
|
|
701
|
+
});
|
|
702
|
+
var imagePackagingType = images === null || images === void 0 ? void 0 : (_images$imagePackagin = images.imagePackagingType) === null || _images$imagePackagin === void 0 ? void 0 : _images$imagePackagin.map(function (e) {
|
|
703
|
+
return {
|
|
704
|
+
value: e === null || e === void 0 ? void 0 : e.id,
|
|
705
|
+
name: e === null || e === void 0 ? void 0 : e.name
|
|
706
|
+
};
|
|
707
|
+
});
|
|
708
|
+
return images === null || images === void 0 ? void 0 : (_images$values = images.values) === null || _images$values === void 0 ? void 0 : _images$values.map(function (image, index) {
|
|
709
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryElement.GalleryElement, {
|
|
710
|
+
setCheckAll: setCheckAll,
|
|
711
|
+
image: image,
|
|
712
|
+
gridLayout: imageLayout,
|
|
713
|
+
id: "gallery-element-" + index,
|
|
714
|
+
index: index,
|
|
715
|
+
imageType: imageType,
|
|
716
|
+
imagePackagingType: imagePackagingType,
|
|
717
|
+
imageInputs: imageInputs,
|
|
718
|
+
changeImage: setImages,
|
|
719
|
+
selectedImages: selectedImages,
|
|
720
|
+
setSelectedImages: setSelectedImages
|
|
721
|
+
}, index);
|
|
722
|
+
});
|
|
723
|
+
};
|
|
724
|
+
|
|
725
|
+
var saveDescriptions = /*#__PURE__*/function () {
|
|
726
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
727
|
+
var productTemp, dataObject;
|
|
728
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
729
|
+
while (1) {
|
|
730
|
+
switch (_context6.prev = _context6.next) {
|
|
731
|
+
case 0:
|
|
732
|
+
setLoading(true);
|
|
733
|
+
productTemp = product;
|
|
734
|
+
dataObject = {
|
|
735
|
+
articleId: product === null || product === void 0 ? void 0 : product.id_article,
|
|
736
|
+
articleData: updatedDescriptions
|
|
737
|
+
};
|
|
738
|
+
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
739
|
+
_context6.prev = 4;
|
|
740
|
+
_context6.next = 7;
|
|
741
|
+
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
742
|
+
headers: {
|
|
743
|
+
Authorization: token
|
|
744
|
+
}
|
|
745
|
+
});
|
|
746
|
+
|
|
747
|
+
case 7:
|
|
748
|
+
if (productTemp.status === "ASSIGNED") {
|
|
749
|
+
productTemp.status = "IN_PROGRESS";
|
|
750
|
+
setProduct(productTemp);
|
|
751
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
setMessage("Descripciones guardadas con éxito");
|
|
755
|
+
loadData();
|
|
756
|
+
_context6.next = 15;
|
|
757
|
+
break;
|
|
758
|
+
|
|
759
|
+
case 12:
|
|
760
|
+
_context6.prev = 12;
|
|
761
|
+
_context6.t0 = _context6["catch"](4);
|
|
762
|
+
console.log(_context6.t0);
|
|
763
|
+
|
|
764
|
+
case 15:
|
|
765
|
+
case "end":
|
|
766
|
+
return _context6.stop();
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
}, _callee6, null, [[4, 12]]);
|
|
770
|
+
}));
|
|
771
|
+
|
|
772
|
+
return function saveDescriptions() {
|
|
773
|
+
return _ref7.apply(this, arguments);
|
|
774
|
+
};
|
|
775
|
+
}();
|
|
776
|
+
|
|
777
|
+
var saveDatasheets = /*#__PURE__*/function () {
|
|
778
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
779
|
+
var dataObject;
|
|
780
|
+
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
781
|
+
while (1) {
|
|
782
|
+
switch (_context7.prev = _context7.next) {
|
|
783
|
+
case 0:
|
|
784
|
+
setLoading(true);
|
|
785
|
+
dataObject = {
|
|
786
|
+
articleId: product === null || product === void 0 ? void 0 : product.id_article,
|
|
787
|
+
articleData: updatedDatasheets
|
|
788
|
+
};
|
|
789
|
+
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
790
|
+
_context7.prev = 3;
|
|
791
|
+
_context7.next = 6;
|
|
792
|
+
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
793
|
+
headers: {
|
|
794
|
+
Authorization: token
|
|
795
|
+
}
|
|
796
|
+
});
|
|
797
|
+
|
|
798
|
+
case 6:
|
|
799
|
+
setMessage("Fichas técnicas guardadas");
|
|
800
|
+
|
|
801
|
+
if (productTemp.status === "ASSIGNED") {
|
|
802
|
+
productTemp.status = "IN_PROGRESS";
|
|
803
|
+
setProduct(productTemp);
|
|
804
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
805
|
+
}
|
|
806
|
+
|
|
807
|
+
loadData();
|
|
808
|
+
_context7.next = 14;
|
|
809
|
+
break;
|
|
810
|
+
|
|
811
|
+
case 11:
|
|
812
|
+
_context7.prev = 11;
|
|
813
|
+
_context7.t0 = _context7["catch"](3);
|
|
814
|
+
console.log(_context7.t0);
|
|
815
|
+
|
|
816
|
+
case 14:
|
|
817
|
+
case "end":
|
|
818
|
+
return _context7.stop();
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}, _callee7, null, [[3, 11]]);
|
|
822
|
+
}));
|
|
823
|
+
|
|
824
|
+
return function saveDatasheets() {
|
|
825
|
+
return _ref8.apply(this, arguments);
|
|
826
|
+
};
|
|
827
|
+
}();
|
|
828
|
+
|
|
829
|
+
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
830
|
+
var _images$values2, _data$articleData, _data$articleData2, _data$updateImages;
|
|
831
|
+
|
|
832
|
+
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
833
|
+
|
|
834
|
+
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
835
|
+
while (1) {
|
|
836
|
+
switch (_context8.prev = _context8.next) {
|
|
837
|
+
case 0:
|
|
838
|
+
imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
|
|
839
|
+
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
840
|
+
acc[image === null || image === void 0 ? void 0 : image.image_id] = ++acc[image === null || image === void 0 ? void 0 : image.image_id] || 0;
|
|
841
|
+
return acc;
|
|
842
|
+
}, {});
|
|
843
|
+
duplicated = imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (image) {
|
|
844
|
+
return imagesListTemp[image === null || image === void 0 ? void 0 : image.image_id];
|
|
845
|
+
});
|
|
846
|
+
attrForImgs = Object.values(images === null || images === void 0 ? void 0 : images.attrForImgs);
|
|
847
|
+
attrForImgs.pop();
|
|
848
|
+
data = {
|
|
849
|
+
articleId: product === null || product === void 0 ? void 0 : product.id_article,
|
|
850
|
+
attrReqImgs: attrForImgs === null || attrForImgs === void 0 ? void 0 : attrForImgs.map(function (e) {
|
|
851
|
+
var _e$, _e$2;
|
|
852
|
+
|
|
853
|
+
return {
|
|
854
|
+
attrId: (_e$ = e[0]) === null || _e$ === void 0 ? void 0 : _e$.id,
|
|
855
|
+
value: (_e$2 = e[0]) === null || _e$2 === void 0 ? void 0 : _e$2.value
|
|
856
|
+
};
|
|
857
|
+
}),
|
|
858
|
+
articleData: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
|
|
859
|
+
return !e.id;
|
|
860
|
+
}),
|
|
861
|
+
updateImages: imagesList === null || imagesList === void 0 ? void 0 : imagesList.filter(function (e) {
|
|
862
|
+
return e.id;
|
|
863
|
+
})
|
|
864
|
+
};
|
|
865
|
+
if (product !== null && product !== void 0 && product.orderId) data["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
866
|
+
valid = (data === null || data === void 0 ? void 0 : (_data$articleData = data.articleData) === null || _data$articleData === void 0 ? void 0 : _data$articleData.length) === 0 ? true : data === null || data === void 0 ? void 0 : (_data$articleData2 = data.articleData) === null || _data$articleData2 === void 0 ? void 0 : _data$articleData2.every(function (e, i) {
|
|
867
|
+
if (e !== null && e !== void 0 && e.image_id && e !== null && e !== void 0 && e.packing_type && e !== null && e !== void 0 && e.image_type) {
|
|
868
|
+
return true;
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
return false;
|
|
872
|
+
});
|
|
873
|
+
|
|
874
|
+
if (valid && (data === null || data === void 0 ? void 0 : (_data$updateImages = data.updateImages) === null || _data$updateImages === void 0 ? void 0 : _data$updateImages.length) > 0 && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0) {
|
|
875
|
+
valid = data === null || data === void 0 ? void 0 : (_data$updateImages2 = data.updateImages) === null || _data$updateImages2 === void 0 ? void 0 : _data$updateImages2.every(function (e, i) {
|
|
876
|
+
if (e !== null && e !== void 0 && e.image_id && e !== null && e !== void 0 && e.packing_type && e !== null && e !== void 0 && e.image_type) {
|
|
877
|
+
return true;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
return false;
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
885
|
+
_context8.next = 30;
|
|
886
|
+
break;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
_context8.prev = 10;
|
|
890
|
+
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
891
|
+
e.uuid = (0, _uuid.v4)();
|
|
892
|
+
});
|
|
893
|
+
setDataImages(data);
|
|
894
|
+
|
|
895
|
+
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
896
|
+
_context8.next = 22;
|
|
897
|
+
break;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
setImagesUploaded(false);
|
|
901
|
+
promiseArray = [];
|
|
902
|
+
data === null || data === void 0 ? void 0 : (_data$articleData5 = data.articleData) === null || _data$articleData5 === void 0 ? void 0 : _data$articleData5.forEach(function (e) {
|
|
903
|
+
var file = Buffer.from(e.src.replace(/^data:image\/\w+;base64,/, ""), "base64");
|
|
904
|
+
var params = {
|
|
905
|
+
ACL: "public-read",
|
|
906
|
+
Body: file,
|
|
907
|
+
Bucket: S3_BUCKET,
|
|
908
|
+
Key: "id-".concat(data.articleId, "/").concat(version, "/").concat(e === null || e === void 0 ? void 0 : e.image_id, "-").concat(e === null || e === void 0 ? void 0 : e.uuid, ".").concat(e === null || e === void 0 ? void 0 : e.ext)
|
|
909
|
+
};
|
|
910
|
+
promiseArray.push(myBucket.putObject(params).promise());
|
|
911
|
+
});
|
|
912
|
+
_context8.next = 19;
|
|
913
|
+
return Promise.all(promiseArray);
|
|
914
|
+
|
|
915
|
+
case 19:
|
|
916
|
+
setImagesUploaded(true);
|
|
917
|
+
_context8.next = 23;
|
|
918
|
+
break;
|
|
919
|
+
|
|
920
|
+
case 22:
|
|
921
|
+
setImagesUploaded(true);
|
|
922
|
+
|
|
923
|
+
case 23:
|
|
924
|
+
_context8.next = 28;
|
|
925
|
+
break;
|
|
926
|
+
|
|
927
|
+
case 25:
|
|
928
|
+
_context8.prev = 25;
|
|
929
|
+
_context8.t0 = _context8["catch"](10);
|
|
930
|
+
console.log(_context8.t0); // setMainLoading(false);
|
|
931
|
+
|
|
932
|
+
case 28:
|
|
933
|
+
_context8.next = 31;
|
|
934
|
+
break;
|
|
935
|
+
|
|
936
|
+
case 30:
|
|
937
|
+
// setMainLoading(false);
|
|
938
|
+
setMessage("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.");
|
|
939
|
+
|
|
940
|
+
case 31:
|
|
941
|
+
case "end":
|
|
942
|
+
return _context8.stop();
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
}, _callee8, null, [[10, 25]]);
|
|
946
|
+
})), [images, imagesUploaded]);
|
|
947
|
+
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
948
|
+
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
949
|
+
while (1) {
|
|
950
|
+
switch (_context9.prev = _context9.next) {
|
|
951
|
+
case 0:
|
|
952
|
+
if (!imagesUploaded) {
|
|
953
|
+
_context9.next = 13;
|
|
954
|
+
break;
|
|
955
|
+
}
|
|
956
|
+
|
|
957
|
+
setLoading(true);
|
|
958
|
+
dataImages.articleData = dataImages === null || dataImages === void 0 ? void 0 : dataImages.articleData.map(function (e) {
|
|
959
|
+
delete e.src;
|
|
960
|
+
e.imageID = e.image_id;
|
|
961
|
+
e.packingType = e.packing_type;
|
|
962
|
+
e.imageType = e.image_type;
|
|
963
|
+
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
964
|
+
return e;
|
|
965
|
+
});
|
|
966
|
+
_context9.prev = 3;
|
|
967
|
+
_context9.next = 6;
|
|
968
|
+
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
969
|
+
headers: {
|
|
970
|
+
Authorization: token
|
|
971
|
+
}
|
|
972
|
+
});
|
|
973
|
+
|
|
974
|
+
case 6:
|
|
975
|
+
setMessage("Imágenes guardadas con éxito");
|
|
976
|
+
loadData();
|
|
977
|
+
_context9.next = 13;
|
|
978
|
+
break;
|
|
979
|
+
|
|
980
|
+
case 10:
|
|
981
|
+
_context9.prev = 10;
|
|
982
|
+
_context9.t0 = _context9["catch"](3);
|
|
983
|
+
console.log(_context9.t0);
|
|
984
|
+
|
|
985
|
+
case 13:
|
|
986
|
+
case "end":
|
|
987
|
+
return _context9.stop();
|
|
988
|
+
}
|
|
989
|
+
}
|
|
990
|
+
}, _callee9, null, [[3, 10]]);
|
|
991
|
+
})), [dataImages, imagesUploaded]);
|
|
992
|
+
|
|
993
|
+
var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {// const srv = servicesData.filter((serv) => serv.service === getConcept(tab));
|
|
994
|
+
// const [srvActive] = srv.filter(
|
|
995
|
+
// (serv) => serv.id_retailer === activeRetailer?.id
|
|
996
|
+
// );
|
|
997
|
+
// const unvalidated =
|
|
998
|
+
// product[`${getConcept(tab)}_status`] === "QF" ||
|
|
999
|
+
// product[`${getConcept(tab)}_status`] === "IN_PROGRESS";
|
|
1000
|
+
// switch (userId) {
|
|
1001
|
+
// case 7:
|
|
1002
|
+
// case 8:
|
|
1003
|
+
// return (
|
|
1004
|
+
// (["RA", "RF"].includes(product?.status) &&
|
|
1005
|
+
// statusArray.includes(srvActive?.status)) ||
|
|
1006
|
+
// (statusArray.includes(product.status) &&
|
|
1007
|
+
// srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
1008
|
+
// srv.length)
|
|
1009
|
+
// );
|
|
1010
|
+
// case 4:
|
|
1011
|
+
// case 5:
|
|
1012
|
+
// return (
|
|
1013
|
+
// unvalidated &&
|
|
1014
|
+
// ["IN_PROGRESS", "QF"].includes(product.status) &&
|
|
1015
|
+
// srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
1016
|
+
// srv.length
|
|
1017
|
+
// );
|
|
1018
|
+
// case 6:
|
|
1019
|
+
// return (
|
|
1020
|
+
// statusArray.includes(product.status) &&
|
|
1021
|
+
// servicesData.every((serv) => ["RA", "AA"].includes(serv.status))
|
|
1022
|
+
// );
|
|
1023
|
+
// default:
|
|
1024
|
+
// break;
|
|
1025
|
+
// }
|
|
1026
|
+
};
|
|
1027
|
+
|
|
1028
|
+
var getConcept = function getConcept(tab) {
|
|
1029
|
+
switch (tab) {
|
|
1030
|
+
case "Descripción":
|
|
1031
|
+
return "description";
|
|
1032
|
+
|
|
1033
|
+
case "Ficha técnica":
|
|
1034
|
+
return "datasheet";
|
|
1035
|
+
|
|
1036
|
+
case "Imágenes":
|
|
1037
|
+
return "images";
|
|
1038
|
+
}
|
|
1039
|
+
}; // const approveRejectButtons = (action) => {
|
|
1040
|
+
// let concept = getConcept(activeTab);
|
|
1041
|
+
// concept = action ? action : concept;
|
|
1042
|
+
// const [retailerStatus] = servicesData.filter(
|
|
1043
|
+
// (srv) => srv.id_retailer === activeRetailer?.id && srv.service === concept
|
|
1044
|
+
// );
|
|
1045
|
+
// return (
|
|
1046
|
+
// (retailerStatus?.status === "QF" &&
|
|
1047
|
+
// (user.id_role === 1 || user.id_role === 4 || user.id_role === 5)) ||
|
|
1048
|
+
// (retailerStatus?.status === "AF" && //sessionStorage product
|
|
1049
|
+
// (user.id_role === 1 || user.id_role === 6)) ||
|
|
1050
|
+
// (retailerStatus?.status === "RP" &&
|
|
1051
|
+
// (user.id_role === 1 || user.id_role === 6)) ||
|
|
1052
|
+
// (retailerStatus?.status === "RC" &&
|
|
1053
|
+
// (user.id_role === 1 || user.id_role === 6))
|
|
1054
|
+
// );
|
|
1055
|
+
// };
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
var getSectionIcon = function getSectionIcon() {
|
|
1059
|
+
switch (activeTab) {
|
|
1060
|
+
case "Ficha técnica":
|
|
1061
|
+
setIcon(_attributesSent.default);
|
|
1062
|
+
break;
|
|
1063
|
+
|
|
1064
|
+
case "Descripción":
|
|
1065
|
+
setIcon(_descriptionSent.default);
|
|
1066
|
+
break;
|
|
1067
|
+
|
|
1068
|
+
case "Imágenes0,,":
|
|
1069
|
+
setIcon(_uploadingImages.default);
|
|
1070
|
+
break;
|
|
1071
|
+
|
|
1072
|
+
default:
|
|
1073
|
+
break;
|
|
1074
|
+
}
|
|
1075
|
+
}; // const sendToFacilitator = async (result) => {
|
|
1076
|
+
// setLoading(true);
|
|
1077
|
+
// try {
|
|
1078
|
+
// let concept = getConcept(activeTab);
|
|
1079
|
+
// let productTemp = { ...product };
|
|
1080
|
+
// let evalStatus = product[`${concept}_status`];
|
|
1081
|
+
// let data = {};
|
|
1082
|
+
// if (result) {
|
|
1083
|
+
// //updateCompaniesList(evalStatus, result, activeRetailer.id, concept);
|
|
1084
|
+
// data = {
|
|
1085
|
+
// articleId: product.id_article,
|
|
1086
|
+
// orderId: product.orderId,
|
|
1087
|
+
// concept: concept,
|
|
1088
|
+
// result: result,
|
|
1089
|
+
// evalStatus: evalStatus,
|
|
1090
|
+
// retailerId: activeRetailer.id,
|
|
1091
|
+
// };
|
|
1092
|
+
// await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
1093
|
+
// headers: {
|
|
1094
|
+
// Authorization: token,
|
|
1095
|
+
// },
|
|
1096
|
+
// });
|
|
1097
|
+
// getServices();
|
|
1098
|
+
// } else {
|
|
1099
|
+
// const specialistDone =
|
|
1100
|
+
// evalStatus === "RF" ||
|
|
1101
|
+
// evalStatus === "RA" ||
|
|
1102
|
+
// evalStatus === "IN_PROGRESS";
|
|
1103
|
+
// if (specialistDone) {
|
|
1104
|
+
// setMessage(`${activeTab} enviada a facilitador`);
|
|
1105
|
+
// getSectionIcon();
|
|
1106
|
+
// } else if (evalStatus === "QF") {
|
|
1107
|
+
// setMessage("Evaluación enviada");
|
|
1108
|
+
// getSectionIcon();
|
|
1109
|
+
// } else if (evalStatus === "AF") {
|
|
1110
|
+
// setMessage("Evaluación enviada");
|
|
1111
|
+
// getSectionIcon();
|
|
1112
|
+
// } else if (evalStatus === "RP") {
|
|
1113
|
+
// setMessage("Evaluación enviada");
|
|
1114
|
+
// getSectionIcon();
|
|
1115
|
+
// } else if (evalStatus === "RC") {
|
|
1116
|
+
// setMessage("Evaluación enviada");
|
|
1117
|
+
// getSectionIcon();
|
|
1118
|
+
// }
|
|
1119
|
+
// let statusArr = [];
|
|
1120
|
+
// servicesData.forEach((srv) => {
|
|
1121
|
+
// srv.service === concept && statusArr.push(srv.status);
|
|
1122
|
+
// });
|
|
1123
|
+
// productTemp[`${concept}_status`] = getNewStatus(statusArr);
|
|
1124
|
+
// let newStatus = getNewStatus([
|
|
1125
|
+
// productTemp.datasheet_status,
|
|
1126
|
+
// productTemp.description_status,
|
|
1127
|
+
// productTemp.images_status,
|
|
1128
|
+
// ]);
|
|
1129
|
+
// productTemp.status = newStatus;
|
|
1130
|
+
// data = {
|
|
1131
|
+
// articleId: product.id_article,
|
|
1132
|
+
// orderId: product.orderId,
|
|
1133
|
+
// concept: concept,
|
|
1134
|
+
// evalStatus: evalStatus,
|
|
1135
|
+
// retailerId: activeRetailer.id,
|
|
1136
|
+
// };
|
|
1137
|
+
// switch (user.id_role) {
|
|
1138
|
+
// case 7:
|
|
1139
|
+
// case 8:
|
|
1140
|
+
// data.especialist = true;
|
|
1141
|
+
// break;
|
|
1142
|
+
// case 4:
|
|
1143
|
+
// case 5:
|
|
1144
|
+
// data.facilitator = true;
|
|
1145
|
+
// break;
|
|
1146
|
+
// default:
|
|
1147
|
+
// break;
|
|
1148
|
+
// }
|
|
1149
|
+
// await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
1150
|
+
// headers: {
|
|
1151
|
+
// Authorization: token,
|
|
1152
|
+
// },
|
|
1153
|
+
// });
|
|
1154
|
+
// getServices();
|
|
1155
|
+
// }
|
|
1156
|
+
// sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1157
|
+
// setProduct(productTemp);
|
|
1158
|
+
// } catch (error) {
|
|
1159
|
+
// console.log(error);
|
|
1160
|
+
// }
|
|
1161
|
+
// setLoading(false);
|
|
1162
|
+
// };
|
|
1163
|
+
|
|
1164
|
+
|
|
1165
|
+
var userAssigned = function userAssigned(tab, rol) {
|
|
1166
|
+
var concept = "";
|
|
1167
|
+
|
|
1168
|
+
switch (tab) {
|
|
1169
|
+
case "Ficha técnica":
|
|
1170
|
+
concept = "datasheet";
|
|
1171
|
+
break;
|
|
1172
|
+
|
|
1173
|
+
case "Imágenes":
|
|
1174
|
+
concept = "images";
|
|
1175
|
+
break;
|
|
1176
|
+
|
|
1177
|
+
default:
|
|
1178
|
+
concept = "description";
|
|
1179
|
+
break;
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
var allowedRoles = [1, 4, 5, 6, 7, 8];
|
|
1183
|
+
var validUser = allowedRoles.indexOf(user === null || user === void 0 ? void 0 : user.id_role) !== -1;
|
|
1184
|
+
|
|
1185
|
+
if (!rol) {
|
|
1186
|
+
switch (user.id_role) {
|
|
1187
|
+
case 4:
|
|
1188
|
+
case 5:
|
|
1189
|
+
rol = "facilitator";
|
|
1190
|
+
break;
|
|
1191
|
+
|
|
1192
|
+
case 7:
|
|
1193
|
+
case 8:
|
|
1194
|
+
rol = "especialist";
|
|
1195
|
+
break;
|
|
1196
|
+
}
|
|
1197
|
+
}
|
|
1198
|
+
|
|
1199
|
+
return true;
|
|
1200
|
+
};
|
|
1201
|
+
|
|
1202
|
+
var createComment = /*#__PURE__*/function () {
|
|
1203
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(e, body, tab) {
|
|
1204
|
+
var concept, data;
|
|
1205
|
+
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1206
|
+
while (1) {
|
|
1207
|
+
switch (_context10.prev = _context10.next) {
|
|
1208
|
+
case 0:
|
|
1209
|
+
concept = "";
|
|
1210
|
+
_context10.t0 = activeTab;
|
|
1211
|
+
_context10.next = _context10.t0 === "Ficha técnica" ? 4 : _context10.t0 === "Imágenes" ? 6 : 8;
|
|
1212
|
+
break;
|
|
1213
|
+
|
|
1214
|
+
case 4:
|
|
1215
|
+
concept = "datasheet";
|
|
1216
|
+
return _context10.abrupt("break", 10);
|
|
1217
|
+
|
|
1218
|
+
case 6:
|
|
1219
|
+
concept = "images";
|
|
1220
|
+
return _context10.abrupt("break", 10);
|
|
1221
|
+
|
|
1222
|
+
case 8:
|
|
1223
|
+
concept = "description";
|
|
1224
|
+
return _context10.abrupt("break", 10);
|
|
1225
|
+
|
|
1226
|
+
case 10:
|
|
1227
|
+
data = {
|
|
1228
|
+
articleId: product === null || product === void 0 ? void 0 : product.id_article,
|
|
1229
|
+
orderId: product === null || product === void 0 ? void 0 : product.orderId,
|
|
1230
|
+
message: body,
|
|
1231
|
+
concept: concept,
|
|
1232
|
+
version: version
|
|
1233
|
+
};
|
|
1234
|
+
_context10.next = 13;
|
|
1235
|
+
return _axios.default.post("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1236
|
+
headers: {
|
|
1237
|
+
Authorization: token
|
|
1238
|
+
}
|
|
1239
|
+
});
|
|
1240
|
+
|
|
1241
|
+
case 13:
|
|
1242
|
+
case "end":
|
|
1243
|
+
return _context10.stop();
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
}, _callee10);
|
|
1247
|
+
}));
|
|
1248
|
+
|
|
1249
|
+
return function createComment(_x2, _x3, _x4) {
|
|
1250
|
+
return _ref11.apply(this, arguments);
|
|
1251
|
+
};
|
|
1252
|
+
}();
|
|
1253
|
+
|
|
1254
|
+
var getRequired = function getRequired(services) {
|
|
1255
|
+
var _services$4, _services$4$inputs;
|
|
1256
|
+
|
|
1257
|
+
var objetcTemp = {};
|
|
1258
|
+
var datasheetServicesArray = Object.values(services[0]);
|
|
1259
|
+
var dsInputs = datasheetServicesArray.pop();
|
|
1260
|
+
var descriptionsServicesArray = services[1];
|
|
1261
|
+
var dsInputsRequired = [];
|
|
1262
|
+
var desInputsRequired = 0;
|
|
1263
|
+
datasheetServicesArray.forEach(function (datasheet) {
|
|
1264
|
+
var _servicesData$filter = servicesData.filter(function (srv) {
|
|
1265
|
+
return srv.id_retailer === datasheet.retailer.id && srv.service === getConcept(activeTab);
|
|
1266
|
+
}),
|
|
1267
|
+
_servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
|
|
1268
|
+
requested = _servicesData$filter2[0];
|
|
1269
|
+
|
|
1270
|
+
requested && Object.values(datasheet === null || datasheet === void 0 ? void 0 : datasheet.data).forEach(function (dataGroup) {
|
|
1271
|
+
return dsInputsRequired.push.apply(dsInputsRequired, (0, _toConsumableArray2.default)(dataGroup.inputs.filter(function (input) {
|
|
1272
|
+
return dsInputs[input].required && (dsInputs[input].value === undefined || !dsInputs[input].value);
|
|
1273
|
+
})));
|
|
1274
|
+
});
|
|
1275
|
+
});
|
|
1276
|
+
objetcTemp["Ficha técnica"] = dsInputsRequired.length;
|
|
1277
|
+
descriptionsServicesArray.forEach(function (description) {
|
|
1278
|
+
var _servicesData$filter3 = servicesData.filter(function (srv) {
|
|
1279
|
+
return srv.id_retailer === description.id && srv.service === getConcept(activeTab);
|
|
1280
|
+
}),
|
|
1281
|
+
_servicesData$filter4 = (0, _slicedToArray2.default)(_servicesData$filter3, 1),
|
|
1282
|
+
requested = _servicesData$filter4[0];
|
|
1283
|
+
|
|
1284
|
+
requested && description.inputs.forEach(function (input) {
|
|
1285
|
+
return input.required && (!input.value || input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") === "") && desInputsRequired++;
|
|
1286
|
+
});
|
|
1287
|
+
});
|
|
1288
|
+
objetcTemp["Descripción"] = desInputsRequired;
|
|
1289
|
+
var requiredImages = (_services$4 = services[2]) === null || _services$4 === void 0 ? void 0 : (_services$4$inputs = _services$4.inputs) === null || _services$4$inputs === void 0 ? void 0 : _services$4$inputs.filter(function (e) {
|
|
1290
|
+
return e.required;
|
|
1291
|
+
});
|
|
1292
|
+
var requiredCounter = 0;
|
|
1293
|
+
requiredImages === null || requiredImages === void 0 ? void 0 : requiredImages.forEach(function (req) {
|
|
1294
|
+
return services[2].values.filter(function (img) {
|
|
1295
|
+
return img.image_id === req.id;
|
|
1296
|
+
}).length === 0 && requiredCounter++;
|
|
1297
|
+
});
|
|
1298
|
+
objetcTemp["Imágenes"] = requiredCounter;
|
|
1299
|
+
setRequiredNull(objetcTemp);
|
|
1300
|
+
};
|
|
1301
|
+
|
|
1302
|
+
(0, _react.useEffect)(function () {
|
|
1303
|
+
setComment(comments[activeTab]);
|
|
1304
|
+
}, [activeTab]);
|
|
1305
|
+
|
|
1306
|
+
var commentRevised = /*#__PURE__*/function () {
|
|
1307
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1308
|
+
var data;
|
|
1309
|
+
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
1310
|
+
while (1) {
|
|
1311
|
+
switch (_context11.prev = _context11.next) {
|
|
1312
|
+
case 0:
|
|
1313
|
+
data = {
|
|
1314
|
+
commentId: comment.id
|
|
1315
|
+
};
|
|
1316
|
+
_context11.next = 3;
|
|
1317
|
+
return _axios.default.put("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT), data, {
|
|
1318
|
+
headers: {
|
|
1319
|
+
Authorization: token
|
|
1320
|
+
}
|
|
1321
|
+
});
|
|
1322
|
+
|
|
1323
|
+
case 3:
|
|
1324
|
+
setCrossComment(false);
|
|
1325
|
+
|
|
1326
|
+
case 4:
|
|
1327
|
+
case "end":
|
|
1328
|
+
return _context11.stop();
|
|
1329
|
+
}
|
|
1330
|
+
}
|
|
1331
|
+
}, _callee11);
|
|
1332
|
+
}));
|
|
1333
|
+
|
|
1334
|
+
return function commentRevised() {
|
|
1335
|
+
return _ref12.apply(this, arguments);
|
|
1336
|
+
};
|
|
1337
|
+
}();
|
|
1338
|
+
|
|
1339
|
+
var setAssignation = /*#__PURE__*/function () {
|
|
1340
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(assignationType, assignationId) {
|
|
1341
|
+
var concept, productTemp, data;
|
|
1342
|
+
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
1343
|
+
while (1) {
|
|
1344
|
+
switch (_context12.prev = _context12.next) {
|
|
1345
|
+
case 0:
|
|
1346
|
+
concept = "";
|
|
1347
|
+
_context12.t0 = activeTab;
|
|
1348
|
+
_context12.next = _context12.t0 === "Ficha técnica" ? 4 : _context12.t0 === "Imágenes" ? 6 : 8;
|
|
1349
|
+
break;
|
|
1350
|
+
|
|
1351
|
+
case 4:
|
|
1352
|
+
concept = "datasheet";
|
|
1353
|
+
return _context12.abrupt("break", 10);
|
|
1354
|
+
|
|
1355
|
+
case 6:
|
|
1356
|
+
concept = "images";
|
|
1357
|
+
return _context12.abrupt("break", 10);
|
|
1358
|
+
|
|
1359
|
+
case 8:
|
|
1360
|
+
concept = "description";
|
|
1361
|
+
return _context12.abrupt("break", 10);
|
|
1362
|
+
|
|
1363
|
+
case 10:
|
|
1364
|
+
productTemp = product;
|
|
1365
|
+
productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
|
|
1366
|
+
data = (0, _defineProperty2.default)({
|
|
1367
|
+
articleList: [{
|
|
1368
|
+
orderId: product.orderId,
|
|
1369
|
+
articleId: product === null || product === void 0 ? void 0 : product.id_article
|
|
1370
|
+
}],
|
|
1371
|
+
concept: concept
|
|
1372
|
+
}, "".concat(assignationType, "Id"), assignationId);
|
|
1373
|
+
(0, _axios.default)({
|
|
1374
|
+
method: "post",
|
|
1375
|
+
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
1376
|
+
data: data,
|
|
1377
|
+
headers: {
|
|
1378
|
+
Authorization: token
|
|
1379
|
+
}
|
|
1380
|
+
});
|
|
1381
|
+
loadAssignations(productTemp);
|
|
1382
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1383
|
+
|
|
1384
|
+
case 16:
|
|
1385
|
+
case "end":
|
|
1386
|
+
return _context12.stop();
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
}, _callee12);
|
|
1390
|
+
}));
|
|
1391
|
+
|
|
1392
|
+
return function setAssignation(_x5, _x6) {
|
|
1393
|
+
return _ref13.apply(this, arguments);
|
|
1394
|
+
};
|
|
1395
|
+
}();
|
|
1396
|
+
|
|
1397
|
+
var evaluationComplete = function evaluationComplete() {
|
|
1398
|
+
var concept = getConcept(activeTab);
|
|
1399
|
+
var serv = servicesData.filter(function (item) {
|
|
1400
|
+
return item.service === concept;
|
|
1401
|
+
});
|
|
1402
|
+
|
|
1403
|
+
if (["RequestWithContentoh", "RequestWithoutContentoh"].includes(origin[concept])) {
|
|
1404
|
+
serv = serv.filter(function (f) {
|
|
1405
|
+
return f.id_retailer === product.retailer_id;
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
var approved = user.is_retailer ? "AC" : "AP";
|
|
1410
|
+
var rejected = user.is_retailer ? "RC" : "RP";
|
|
1411
|
+
return serv.filter(function (item) {
|
|
1412
|
+
return item.status === approved || item.status === rejected;
|
|
1413
|
+
}).length === serv.length;
|
|
1414
|
+
};
|
|
1415
|
+
|
|
1416
|
+
var downloadImages = function downloadImages() {
|
|
1417
|
+
selectedImages.forEach(function (e) {
|
|
1418
|
+
if (e.id) {
|
|
1419
|
+
(0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.article.upc, "_").concat(e.name, ".").concat(e.ext));
|
|
1420
|
+
}
|
|
1421
|
+
});
|
|
1422
|
+
};
|
|
1423
|
+
|
|
1424
|
+
var deleteImages = function deleteImages() {
|
|
1425
|
+
var data = {
|
|
1426
|
+
articleId: product.id_article,
|
|
1427
|
+
deleteImages: selectedImages
|
|
1428
|
+
};
|
|
1429
|
+
|
|
1430
|
+
try {
|
|
1431
|
+
_axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), data, {
|
|
1432
|
+
headers: {
|
|
1433
|
+
Authorization: token
|
|
1434
|
+
}
|
|
1435
|
+
});
|
|
1436
|
+
|
|
1437
|
+
loadData();
|
|
1438
|
+
} catch (err) {
|
|
1439
|
+
console.log(err);
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
setMessage("");
|
|
1443
|
+
};
|
|
1444
|
+
|
|
1445
|
+
var askToDeleteImages = function askToDeleteImages() {
|
|
1446
|
+
if (selectedImages.length > 0) {
|
|
1447
|
+
setMessage("¿Está seguro de eliminar las imágenes seleccionadas?");
|
|
1448
|
+
setComponentsArray([/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1449
|
+
text: "¿Está seguro de eliminar las imágenes seleccionadas?",
|
|
1450
|
+
headerType: "retailer-name-header",
|
|
1451
|
+
color: "white"
|
|
1452
|
+
}, "1"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1453
|
+
buttonType: "general-white-button",
|
|
1454
|
+
label: "Cancelar",
|
|
1455
|
+
onClick: function onClick() {
|
|
1456
|
+
return setMessage("");
|
|
1457
|
+
}
|
|
1458
|
+
}, "2"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1459
|
+
buttonType: "general-button-default",
|
|
1460
|
+
label: "Aceptar",
|
|
1461
|
+
onClick: function onClick() {
|
|
1462
|
+
return deleteImages();
|
|
1463
|
+
}
|
|
1464
|
+
}, "3")]);
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
|
|
1468
|
+
var specialistValid = function specialistValid(tab) {
|
|
1469
|
+
var concept = "";
|
|
1470
|
+
|
|
1471
|
+
switch (tab) {
|
|
1472
|
+
case "Ficha técnica":
|
|
1473
|
+
concept = "datasheet";
|
|
1474
|
+
break;
|
|
1475
|
+
|
|
1476
|
+
case "Imágenes":
|
|
1477
|
+
concept = "images";
|
|
1478
|
+
break;
|
|
1479
|
+
|
|
1480
|
+
case "Descripción":
|
|
1481
|
+
concept = "description";
|
|
1482
|
+
break;
|
|
1483
|
+
}
|
|
1484
|
+
|
|
1485
|
+
return product["".concat(concept, "_status")] === "IN_PROGRESS" || product["".concat(concept, "_status")] === "RF" || product["".concat(concept, "_status")] === "RA";
|
|
1486
|
+
}; // const getRetailerStatus = (servicesData, tab) => {
|
|
1487
|
+
// const arr = servicesData?.slice();
|
|
1488
|
+
// let concept = getConcept(tab);
|
|
1489
|
+
// let retailerService = {};
|
|
1490
|
+
// [retailerService] = arr?.filter(
|
|
1491
|
+
// (service) =>
|
|
1492
|
+
// service.id_retailer === activeRetailer?.id &&
|
|
1493
|
+
// service.service === concept
|
|
1494
|
+
// );
|
|
1495
|
+
// return retailerService ? retailerService.status : "NA";
|
|
1496
|
+
// };
|
|
1497
|
+
// useEffect(() => {
|
|
1498
|
+
// let status = getRetailerStatus(servicesData, activeTab);
|
|
1499
|
+
// setRetailerStatus(status);
|
|
1500
|
+
// }, [activeTab, servicesData, activeRetailer]);
|
|
1501
|
+
// useEffect(() => {
|
|
1502
|
+
// services.length > 0 && getRequired(services);
|
|
1503
|
+
// }, [services, servicesData, activeTab]);
|
|
1504
|
+
|
|
1505
|
+
|
|
1506
|
+
var confirmStatusComplete = function confirmStatusComplete() {
|
|
1507
|
+
var datasheet_status = product.datasheet_status,
|
|
1508
|
+
description_status = product.description_status,
|
|
1509
|
+
images_status = product.images_status;
|
|
1510
|
+
var completionStates = ["AP", "Evaluated", "NS"];
|
|
1511
|
+
var dsEvaluated = completionStates.includes(datasheet_status);
|
|
1512
|
+
var descsEvaluated = completionStates.includes(description_status);
|
|
1513
|
+
var imgsEvaluated = completionStates.includes(images_status);
|
|
1514
|
+
var AllEvaluated = dsEvaluated && descsEvaluated && imgsEvaluated;
|
|
1515
|
+
return AllEvaluated;
|
|
1516
|
+
};
|
|
1517
|
+
|
|
1518
|
+
var sendEvaluation = /*#__PURE__*/function () {
|
|
1519
|
+
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(result) {
|
|
1520
|
+
var data, retailerId, _product$id_order2, _product$id_order3, concept, _productTemp;
|
|
1521
|
+
|
|
1522
|
+
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1523
|
+
while (1) {
|
|
1524
|
+
switch (_context13.prev = _context13.next) {
|
|
1525
|
+
case 0:
|
|
1526
|
+
data = {};
|
|
1527
|
+
retailerId = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id;
|
|
1528
|
+
|
|
1529
|
+
if (!result) {
|
|
1530
|
+
_context13.next = 8;
|
|
1531
|
+
break;
|
|
1532
|
+
}
|
|
1533
|
+
|
|
1534
|
+
data = {
|
|
1535
|
+
articleId: product.id_article,
|
|
1536
|
+
orderId: (_product$id_order2 = product.id_order) !== null && _product$id_order2 !== void 0 ? _product$id_order2 : product.orderId,
|
|
1537
|
+
concept: getConcept(activeTab),
|
|
1538
|
+
result: result,
|
|
1539
|
+
retailerId: retailerId
|
|
1540
|
+
};
|
|
1541
|
+
_context13.next = 6;
|
|
1542
|
+
return _axios.default.put("".concat(process.env.REACT_APP_EVALUATION_ENDPOINT), data, {
|
|
1543
|
+
headers: {
|
|
1544
|
+
Authorization: token
|
|
1545
|
+
}
|
|
1546
|
+
});
|
|
1547
|
+
|
|
1548
|
+
case 6:
|
|
1549
|
+
_context13.next = 17;
|
|
1550
|
+
break;
|
|
1551
|
+
|
|
1552
|
+
case 8:
|
|
1553
|
+
concept = getConcept(activeTab);
|
|
1554
|
+
_productTemp = product;
|
|
1555
|
+
_productTemp["".concat(concept, "_status")] = "Evaluated";
|
|
1556
|
+
data = {
|
|
1557
|
+
articleId: product.id_article,
|
|
1558
|
+
orderId: (_product$id_order3 = product.id_order) !== null && _product$id_order3 !== void 0 ? _product$id_order3 : product.orderId,
|
|
1559
|
+
concept: concept,
|
|
1560
|
+
retailerId: retailerId
|
|
1561
|
+
};
|
|
1562
|
+
|
|
1563
|
+
_axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1564
|
+
headers: {
|
|
1565
|
+
Authorization: token
|
|
1566
|
+
}
|
|
1567
|
+
});
|
|
1568
|
+
|
|
1569
|
+
setProduct(_productTemp);
|
|
1570
|
+
setProductEdit({
|
|
1571
|
+
ArticleId: _productTemp.id_article,
|
|
1572
|
+
idCategory: _productTemp.article.id_category,
|
|
1573
|
+
product: _productTemp
|
|
1574
|
+
});
|
|
1575
|
+
sessionStorage.setItem("productEdit", JSON.stringify({
|
|
1576
|
+
ArticleId: _productTemp.id_article,
|
|
1577
|
+
idCategory: _productTemp.article.id_category,
|
|
1578
|
+
product: _productTemp
|
|
1579
|
+
}));
|
|
1580
|
+
setOrigin(function (prev) {
|
|
1581
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, (0, _defineProperty2.default)({}, concept, "Evaluated"));
|
|
1582
|
+
});
|
|
1583
|
+
|
|
1584
|
+
case 17:
|
|
1585
|
+
loadData();
|
|
1586
|
+
showSurvey && showSurvey(confirmStatusComplete());
|
|
1587
|
+
|
|
1588
|
+
case 19:
|
|
1589
|
+
case "end":
|
|
1590
|
+
return _context13.stop();
|
|
1591
|
+
}
|
|
1592
|
+
}
|
|
1593
|
+
}, _callee13);
|
|
1594
|
+
}));
|
|
1595
|
+
|
|
1596
|
+
return function sendEvaluation(_x7) {
|
|
1597
|
+
return _ref14.apply(this, arguments);
|
|
1598
|
+
};
|
|
1599
|
+
}();
|
|
1600
|
+
|
|
1601
|
+
var evaluationToRetailer = /*#__PURE__*/function () {
|
|
1602
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(result) {
|
|
1603
|
+
var data, prod, statusComplete;
|
|
1604
|
+
return _regenerator.default.wrap(function _callee14$(_context14) {
|
|
1605
|
+
while (1) {
|
|
1606
|
+
switch (_context14.prev = _context14.next) {
|
|
1607
|
+
case 0:
|
|
1608
|
+
data = {
|
|
1609
|
+
articleId: product.id_article,
|
|
1610
|
+
companyId: user.is_retailer ? product.provider_company_id : product.retailer_company_id,
|
|
1611
|
+
versionId: product.version,
|
|
1612
|
+
status: result
|
|
1613
|
+
};
|
|
1614
|
+
_context14.next = 3;
|
|
1615
|
+
return _axios.default.put("".concat(process.env.REACT_APP_RETAILER_REQUEST), data, {
|
|
1616
|
+
headers: {
|
|
1617
|
+
Authorization: token
|
|
1618
|
+
}
|
|
1619
|
+
});
|
|
1620
|
+
|
|
1621
|
+
case 3:
|
|
1622
|
+
prod = productEdit;
|
|
1623
|
+
statusComplete = user.is_retailer ? "".concat(result, "C") : "".concat(result, "P");
|
|
1624
|
+
prod.product.datasheet_status = statusComplete;
|
|
1625
|
+
prod.product.description_status = statusComplete;
|
|
1626
|
+
prod.product.images_status = statusComplete;
|
|
1627
|
+
prod.product.article_status = statusComplete;
|
|
1628
|
+
prod.product.services_status = "[\"".concat(statusComplete, "\",\"").concat(statusComplete, "\",\"").concat(statusComplete, "\"]");
|
|
1629
|
+
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
1630
|
+
setProduct(prod);
|
|
1631
|
+
setShowGenericModal && setShowGenericModal(false);
|
|
1632
|
+
|
|
1633
|
+
case 13:
|
|
1634
|
+
case "end":
|
|
1635
|
+
return _context14.stop();
|
|
1636
|
+
}
|
|
1637
|
+
}
|
|
1638
|
+
}, _callee14);
|
|
1639
|
+
}));
|
|
1640
|
+
|
|
1641
|
+
return function evaluationToRetailer(_x8) {
|
|
1642
|
+
return _ref15.apply(this, arguments);
|
|
1643
|
+
};
|
|
1644
|
+
}();
|
|
1645
|
+
|
|
1646
|
+
var getSectionStatus = function getSectionStatus() {
|
|
1647
|
+
var concept = getConcept(activeTab);
|
|
1648
|
+
return ["AA", "AP", "RECEIVED", "IN_PROGRESS", "RC"].includes(productEdit.product["".concat(concept, "_status")]);
|
|
1649
|
+
};
|
|
1650
|
+
|
|
1651
|
+
var enableActions = function enableActions(versionStatus) {
|
|
1652
|
+
if (versionStatus) {
|
|
1653
|
+
return ["AP", "AC", "RC"].includes(versionStatus);
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
return true;
|
|
1657
|
+
};
|
|
1658
|
+
|
|
1659
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1660
|
+
headerTop: headerTop,
|
|
1661
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
1662
|
+
setHeaderTop: setHeaderTop
|
|
1663
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1664
|
+
className: "data-container",
|
|
1665
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1666
|
+
className: "image-data-panel",
|
|
1667
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImagePreviewer.ImagePreviewer, {
|
|
1668
|
+
activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
|
|
1669
|
+
imagesArray: images,
|
|
1670
|
+
setActiveImage: setActiveImage,
|
|
1671
|
+
setShowModal: setShowModal
|
|
1672
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable, {
|
|
1673
|
+
lists: images,
|
|
1674
|
+
activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
|
|
1675
|
+
retailerSelected: activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id,
|
|
1676
|
+
setImages: setImages,
|
|
1677
|
+
assignationsImages: assig,
|
|
1678
|
+
imagesStatus: product === null || product === void 0 ? void 0 : product.images_status,
|
|
1679
|
+
setAssignation: setAssignation,
|
|
1680
|
+
isRetailer: isRetailer,
|
|
1681
|
+
onClickSave: function onClickSave() {
|
|
1682
|
+
var _product$services;
|
|
1683
|
+
|
|
1684
|
+
return (product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.images) === 1 && updateImages();
|
|
1685
|
+
}
|
|
1686
|
+
})]
|
|
1687
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1688
|
+
className: "product-information",
|
|
1689
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
|
|
1690
|
+
headerData: product,
|
|
1691
|
+
percent: activePercentage,
|
|
1692
|
+
activeRetailer: activeRetailer,
|
|
1693
|
+
setActiveRetailer: setActiveRetailer,
|
|
1694
|
+
showValidationButtons: isRevision() && getSectionStatus(),
|
|
1695
|
+
approve: function approve() {
|
|
1696
|
+
if (origin[getConcept(activeTab)] === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
|
|
1697
|
+
setDataGenericModal(function (prev) {
|
|
1698
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1699
|
+
button2: {
|
|
1700
|
+
name: "Continuar",
|
|
1701
|
+
action: function action() {
|
|
1702
|
+
return evaluationToRetailer("A");
|
|
1703
|
+
}
|
|
1704
|
+
}
|
|
1705
|
+
});
|
|
1706
|
+
});
|
|
1707
|
+
setShowGenericModal(true);
|
|
1708
|
+
} else {
|
|
1709
|
+
if (user.is_retailer) {
|
|
1710
|
+
if (product.id_order || product.orderId) {
|
|
1711
|
+
sendEvaluation("A");
|
|
1712
|
+
} else {
|
|
1713
|
+
setDataGenericModal(function (prev) {
|
|
1714
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1715
|
+
button2: {
|
|
1716
|
+
name: "Continuar",
|
|
1717
|
+
action: function action() {
|
|
1718
|
+
return evaluationToRetailer("A");
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
});
|
|
1722
|
+
});
|
|
1723
|
+
setShowGenericModal(true);
|
|
1724
|
+
}
|
|
1725
|
+
} else {
|
|
1726
|
+
sendEvaluation("A");
|
|
1727
|
+
}
|
|
1728
|
+
}
|
|
1729
|
+
},
|
|
1730
|
+
reject: function reject() {
|
|
1731
|
+
if (origin[getConcept(activeTab)] === "RequestWithoutContentoh" && !user.is_retailer && (!product.id_order || !product.orderId)) {
|
|
1732
|
+
return;
|
|
1733
|
+
} else {
|
|
1734
|
+
if (user.is_retailer) {
|
|
1735
|
+
if (product.id_order || product.orderId) {
|
|
1736
|
+
sendEvaluation("R");
|
|
1737
|
+
setModalViewError(true);
|
|
1738
|
+
} else {
|
|
1739
|
+
setDataGenericModal(function (prev) {
|
|
1740
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, prev), {}, {
|
|
1741
|
+
button2: {
|
|
1742
|
+
name: "Continuar",
|
|
1743
|
+
action: function action() {
|
|
1744
|
+
return evaluationToRetailer("R");
|
|
1745
|
+
}
|
|
1746
|
+
}
|
|
1747
|
+
});
|
|
1748
|
+
});
|
|
1749
|
+
setShowGenericModal(true);
|
|
1750
|
+
}
|
|
1751
|
+
} else {
|
|
1752
|
+
sendEvaluation("R");
|
|
1753
|
+
setModalViewError(true);
|
|
1754
|
+
}
|
|
1755
|
+
}
|
|
1756
|
+
}
|
|
1757
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
1758
|
+
tabsSections: tabsSections,
|
|
1759
|
+
status: product === null || product === void 0 ? void 0 : product.version_status,
|
|
1760
|
+
activeTab: activeTab,
|
|
1761
|
+
setActiveTab: setActiveTab,
|
|
1762
|
+
setImageLayout: setImageLayout,
|
|
1763
|
+
downloadImages: downloadImages,
|
|
1764
|
+
askToDeleteImages: askToDeleteImages,
|
|
1765
|
+
assig: assig,
|
|
1766
|
+
setAssignation: setAssignation,
|
|
1767
|
+
isRetailer: isRetailer,
|
|
1768
|
+
onClickSave: function onClickSave() {
|
|
1769
|
+
switch (activeTab) {
|
|
1770
|
+
case "Descripción":
|
|
1771
|
+
saveDescriptions();
|
|
1772
|
+
break;
|
|
1773
|
+
|
|
1774
|
+
case "Ficha técnica":
|
|
1775
|
+
saveDatasheets();
|
|
1776
|
+
break;
|
|
1777
|
+
|
|
1778
|
+
case "Imágenes":
|
|
1779
|
+
updateImages();
|
|
1780
|
+
break;
|
|
1781
|
+
|
|
1782
|
+
default:
|
|
1783
|
+
break;
|
|
1784
|
+
}
|
|
1785
|
+
}
|
|
1786
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1787
|
+
className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
|
|
1788
|
+
children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1789
|
+
children: [!imageLayout && activeTab === "Imágenes" && (product === null || product === void 0 ? void 0 : (_product$services2 = product.services) === null || _product$services2 === void 0 ? void 0 : _product$services2.images) === 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
|
|
1790
|
+
setSelectedImages: setSelectedImages,
|
|
1791
|
+
checkAll: checkAll,
|
|
1792
|
+
setCheckAll: setCheckAll
|
|
1793
|
+
}), activeTab === "Ficha técnica" && ((product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" ? (_datasheets$ = datasheets[0]) === null || _datasheets$ === void 0 ? void 0 : (_datasheets$$data = _datasheets$.data) === null || _datasheets$$data === void 0 ? void 0 : _datasheets$$data.map(function (dataGroup, index) {
|
|
1794
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1795
|
+
articleId: product.id_article,
|
|
1796
|
+
version: version,
|
|
1797
|
+
activeSection: activeTab,
|
|
1798
|
+
inputGroup: dataGroup,
|
|
1799
|
+
dataInputs: datasheets[1],
|
|
1800
|
+
updatedDatasheets: updatedDatasheets,
|
|
1801
|
+
setUpdatedDatasheets: setUpdatedDatasheets //enableActions={enableActions(product.version_status)} ADD THIS VALIDATION
|
|
1802
|
+
|
|
1803
|
+
}, index + "-" + activeRetailer.name);
|
|
1804
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1805
|
+
text: "No cuentas con este servicio",
|
|
1806
|
+
headerType: "input-name-header"
|
|
1807
|
+
})), activeTab === "Descripción" && ((product === null || product === void 0 ? void 0 : product.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1808
|
+
activeSection: activeTab,
|
|
1809
|
+
inputGroup: descriptions[0],
|
|
1810
|
+
updatedDescriptions: updatedDescriptions,
|
|
1811
|
+
setUpdatedDescriptions: setUpdatedDescriptions,
|
|
1812
|
+
articleId: product === null || product === void 0 ? void 0 : product.id_article,
|
|
1813
|
+
version: version,
|
|
1814
|
+
dinamicHeight: true
|
|
1815
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1816
|
+
text: "No cuentas con este servicio",
|
|
1817
|
+
headerType: "input-name-header"
|
|
1818
|
+
})), activeTab === "Imágenes" && ((product === null || product === void 0 ? void 0 : product.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)("section", {
|
|
1819
|
+
className: "container",
|
|
1820
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", (0, _objectSpread3.default)((0, _objectSpread3.default)({}, getRootProps({
|
|
1821
|
+
className: "dropzone"
|
|
1822
|
+
})), {}, {
|
|
1823
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", (0, _objectSpread3.default)({}, getInputProps())), /*#__PURE__*/(0, _jsxRuntime.jsx)("aside", {
|
|
1824
|
+
children: thumbs()
|
|
1825
|
+
})]
|
|
1826
|
+
}))
|
|
1827
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1828
|
+
text: "No cuentas con este servicio",
|
|
1829
|
+
headerType: "input-name-header"
|
|
1830
|
+
}))]
|
|
1831
|
+
})
|
|
1832
|
+
}), isRevision() && getSectionStatus() ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1833
|
+
className: "commentary-box",
|
|
1834
|
+
children: [!comment ? /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1835
|
+
className: "commentary",
|
|
1836
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.TagAndInput, {
|
|
1837
|
+
label: "Caja de Comentario",
|
|
1838
|
+
inputType: "textarea",
|
|
1839
|
+
inputCols: 80,
|
|
1840
|
+
inputRows: 4,
|
|
1841
|
+
inputId: "commentary-box",
|
|
1842
|
+
index: 0
|
|
1843
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1844
|
+
className: "buttons-box",
|
|
1845
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1846
|
+
buttonType: "general-transparent-button",
|
|
1847
|
+
label: "Enviar comentario",
|
|
1848
|
+
onClick: function onClick(e) {
|
|
1849
|
+
return createComment(e, document.querySelector("#description-commentary-box-0 .ql-container .ql-editor > p").innerHTML, activeTab);
|
|
1850
|
+
}
|
|
1851
|
+
})
|
|
1852
|
+
})]
|
|
1853
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1854
|
+
className: "feedback-box",
|
|
1855
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Commentary.Commentary, {
|
|
1856
|
+
comment: comment.message,
|
|
1857
|
+
reviewed: crossComment
|
|
1858
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1859
|
+
buttonType: "circular-button accept-button",
|
|
1860
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15() {
|
|
1861
|
+
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1862
|
+
while (1) {
|
|
1863
|
+
switch (_context15.prev = _context15.next) {
|
|
1864
|
+
case 0:
|
|
1865
|
+
setCrossComment(true);
|
|
1866
|
+
commentRevised();
|
|
1867
|
+
|
|
1868
|
+
case 2:
|
|
1869
|
+
case "end":
|
|
1870
|
+
return _context15.stop();
|
|
1871
|
+
}
|
|
1872
|
+
}
|
|
1873
|
+
}, _callee15);
|
|
1874
|
+
}))
|
|
1875
|
+
})]
|
|
1876
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1877
|
+
buttonType: evaluationComplete() && (productEdit.product.id_order || productEdit.product.orderId) ? "general-green-button" : "general-button-disabled",
|
|
1878
|
+
label: "Enviar evaluación",
|
|
1879
|
+
onClick: function onClick() {
|
|
1880
|
+
setModalSent(true);
|
|
1881
|
+
sendEvaluation();
|
|
1882
|
+
setMessage("\xA1Evaluaci\xF3n de ".concat(translateConcept(), " completada!"));
|
|
1883
|
+
}
|
|
1884
|
+
})]
|
|
1885
|
+
}) : revision ? null : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1886
|
+
className: "required-inputs-message",
|
|
1887
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1888
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1889
|
+
children: "Los atributos son requeridos por las plataformas de las cadenas, es muy importante completar los campos requeridos ya que pueden rechazar el producto por falta de informaci\xF3n."
|
|
1890
|
+
})
|
|
1891
|
+
}), inCart ? /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
1892
|
+
type: "button",
|
|
1893
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactRouterDom.Link, {
|
|
1894
|
+
to: "/checkout",
|
|
1895
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1896
|
+
children: "Articulo en carrito"
|
|
1897
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
1898
|
+
children: "Ir a checkout"
|
|
1899
|
+
})]
|
|
1900
|
+
})
|
|
1901
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
1902
|
+
onClick: function onClick() {
|
|
1903
|
+
setShowContentohRequestModal && setShowContentohRequestModal(true);
|
|
1904
|
+
},
|
|
1905
|
+
buttonType: "general-default-button",
|
|
1906
|
+
label: "Enviar a Content-oh!"
|
|
1907
|
+
})]
|
|
1908
|
+
})]
|
|
1909
|
+
})]
|
|
1910
|
+
}), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductImageModal.ProductImageModal, {
|
|
1911
|
+
images: images,
|
|
1912
|
+
setShowModal: setShowModal
|
|
1913
|
+
}), message.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GenericModal.GenericModal, {
|
|
1914
|
+
buttonType: componentsArray.length > 0 && "delete-product",
|
|
1915
|
+
componentsArray: componentsArray.length > 0 ? componentsArray : [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
1916
|
+
src: _genericModalCheck.default,
|
|
1917
|
+
alt: "success icon"
|
|
1918
|
+
}, "1"), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
1919
|
+
headerType: "retailer-name-header",
|
|
1920
|
+
text: message,
|
|
1921
|
+
color: "white"
|
|
1922
|
+
}, "2")],
|
|
1923
|
+
onClick: function onClick() {
|
|
1924
|
+
return setMessage("");
|
|
1925
|
+
}
|
|
1926
|
+
}), modalSent && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, {
|
|
1927
|
+
close: function close() {
|
|
1928
|
+
return setModalSent(false);
|
|
1929
|
+
},
|
|
1930
|
+
message: message,
|
|
1931
|
+
detail: detail,
|
|
1932
|
+
bold: !evaluationComplete() && "Aprueba / Rechaza",
|
|
1933
|
+
widthImg: !evaluationComplete() ? "160px" : "354px",
|
|
1934
|
+
heightImg: !evaluationComplete() ? "84px" : "354px",
|
|
1935
|
+
img: getSectionIcon()
|
|
1936
|
+
}), modalViewError && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, {
|
|
1937
|
+
close: function close() {
|
|
1938
|
+
return setModalViewError(false);
|
|
1939
|
+
},
|
|
1940
|
+
message: "".concat(activeTab, " rechazada"),
|
|
1941
|
+
detail: "Agrega tu comentarios para enviar el rechazo",
|
|
1942
|
+
button1: {
|
|
1943
|
+
name: "Enviar",
|
|
1944
|
+
action: function action(e) {
|
|
1945
|
+
createComment(e, document.querySelector("#area").value);
|
|
1946
|
+
setModalViewError(false);
|
|
1947
|
+
setModalViewTextArea(true);
|
|
1948
|
+
}
|
|
1949
|
+
},
|
|
1950
|
+
img: _errorModal.default,
|
|
1951
|
+
textArea: true
|
|
1952
|
+
}), showGenericModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, {
|
|
1953
|
+
close: function close() {
|
|
1954
|
+
return setShowGenericModal(false);
|
|
1955
|
+
},
|
|
1956
|
+
message: dataGenericModal.message,
|
|
1957
|
+
detail: dataGenericModal.detail,
|
|
1958
|
+
button1: dataGenericModal.button1,
|
|
1959
|
+
button2: dataGenericModal.button2,
|
|
1960
|
+
img: dataGenericModal.img
|
|
1961
|
+
}), modalViewTextArea && /*#__PURE__*/(0, _jsxRuntime.jsx)(_index2.GlobalModal, {
|
|
1962
|
+
close: function close() {
|
|
1963
|
+
return setModalViewTextArea(false);
|
|
1964
|
+
},
|
|
1965
|
+
message: "Gracias, tus comentarios fueron entregados.",
|
|
1966
|
+
detail: "Trabajaremos en conjunto para resolverlo.",
|
|
1967
|
+
button1: {
|
|
1968
|
+
name: "Cerrar",
|
|
1969
|
+
action: function action() {
|
|
1970
|
+
return setModalViewTextArea(false);
|
|
1971
|
+
}
|
|
1972
|
+
},
|
|
1973
|
+
img: _defaultProfileImage.default,
|
|
1974
|
+
textArea: false
|
|
1975
|
+
})]
|
|
1976
|
+
});
|
|
1977
|
+
};
|
|
1978
|
+
|
|
1979
|
+
exports.ProviderProductEdition = ProviderProductEdition;
|