contentoh-components-library 21.3.15 → 21.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.development +5 -0
- package/dist/assets/images/generalButton/closeIcon.svg +2 -2
- package/dist/components/atoms/ProgressBar/index.js +36 -6
- package/dist/components/atoms/ProgressBar/styles.js +11 -3
- package/dist/components/molecules/CustomSelect/CustomSelect.stories.js +21 -22
- package/dist/components/molecules/CustomSelect/SelectItem.js +10 -1
- package/dist/components/molecules/HeaderTop/index.js +23 -6
- package/dist/components/molecules/HeaderTop/styles.js +1 -1
- package/dist/components/molecules/ProductNameHeader/index.js +6 -4
- package/dist/components/organisms/FullProductNameHeader/index.js +1 -0
- package/dist/components/organisms/RangeCalendar/index.js +4 -3
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +65 -50
- package/dist/components/pages/ProviderProductEdition/index.js +15 -11
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +36 -44
- package/dist/components/pages/RetailerProductEdition/index.js +53 -44
- package/dist/global-files/data.js +18 -23
- package/dist/global-files/fonts.css +6 -0
- package/dist/global-files/utils.js +22 -2
- package/dist/global-files/variables.js +2 -0
- package/dist/index.js +267 -46
- package/package.json +12 -1
- package/src/assets/images/customSelect/starIcon.svg +14 -0
- package/src/assets/images/defaultImages/Spinner.gif +0 -0
- package/src/assets/images/defaultImages/notFound.svg +124 -0
- package/src/assets/images/generalButton/closeIcon.svg +2 -2
- package/src/components/atoms/ButtonFileChooser/ButtonFileChooser.stories.js +47 -0
- package/src/components/atoms/ButtonFileChooser/index.js +68 -0
- package/src/components/atoms/ButtonFileChooser/styles.js +4 -0
- package/src/components/atoms/ButtonV2/ButtonV2.stories.js +53 -0
- package/src/components/atoms/ButtonV2/index.js +85 -0
- package/src/components/atoms/ButtonV2/styles.js +217 -0
- package/src/components/atoms/CustomIcon/CustomIcon.stories.js +36 -0
- package/src/components/atoms/CustomIcon/index.js +41 -0
- package/src/components/atoms/CustomIcon/styles.js +85 -0
- package/src/components/atoms/IconFile/IconFile.stories.js +35 -0
- package/src/components/atoms/IconFile/index.js +119 -0
- package/src/components/atoms/IconFile/styles.js +67 -0
- package/src/components/atoms/Image/Image.stories.js +51 -0
- package/src/components/atoms/Image/index.js +55 -0
- package/src/components/atoms/Image/styles.js +34 -0
- package/src/components/atoms/ImageLink/ImageLink.stories.js +43 -0
- package/src/components/atoms/ImageLink/index.js +57 -0
- package/src/components/atoms/ImageLink/styles.js +30 -0
- package/src/components/atoms/ImagePreview/ImagePreview.stories.js +52 -0
- package/src/components/atoms/ImagePreview/index.js +178 -0
- package/src/components/atoms/ImagePreview/styles.js +77 -0
- package/src/components/atoms/InputText/InputText.stories.js +39 -0
- package/src/components/atoms/InputText/index.js +61 -0
- package/src/components/atoms/InputText/styles.js +89 -0
- package/src/components/atoms/NotFound/NotFound.stories.js +19 -0
- package/src/components/atoms/NotFound/index.js +52 -0
- package/src/components/atoms/NotFound/styles.js +55 -0
- package/src/components/atoms/ProgressBar/index.js +40 -5
- package/src/components/atoms/ProgressBar/styles.js +24 -0
- package/src/components/atoms/SelectItemV2/SelectItemV2.stories.js +26 -0
- package/src/components/atoms/SelectItemV2/index.js +61 -0
- package/src/components/atoms/SelectItemV2/styles.js +90 -0
- package/src/components/atoms/Tooltip/Tooltip.stories.js +51 -0
- package/src/components/atoms/Tooltip/index.js +59 -0
- package/src/components/atoms/Tooltip/styles.js +42 -0
- package/src/components/molecules/ButtonDownloadFile/DownloadFile.stories.js +54 -0
- package/src/components/molecules/ButtonDownloadFile/index.js +109 -0
- package/src/components/molecules/ButtonDownloadFile/styles.js +66 -0
- package/src/components/molecules/CustomSelect/CustomSelect.stories.js +20 -12
- package/src/components/molecules/CustomSelect/SelectItem.js +7 -0
- package/src/components/molecules/Dropdown/Dropdown.stories.js +103 -0
- package/src/components/molecules/Dropdown/index.js +150 -0
- package/src/components/molecules/Dropdown/styles.js +75 -0
- package/src/components/molecules/HeaderTop/index.js +29 -8
- package/src/components/molecules/HeaderTop/styles.js +4 -0
- package/src/components/molecules/ImageTooltip/ImageTooltip.stories.js +68 -0
- package/src/components/molecules/ImageTooltip/index.js +63 -0
- package/src/components/molecules/ImageTooltip/styles.js +18 -0
- package/src/components/molecules/ProductNameHeader/index.js +7 -2
- package/src/components/molecules/SelectV2/SelectV2.stories.js +115 -0
- package/src/components/molecules/SelectV2/index.js +357 -0
- package/src/components/molecules/SelectV2/styles.js +105 -0
- package/src/components/molecules/SelectV2/test.js +61 -0
- package/src/components/molecules/SelectV2/test.stories.js +10 -0
- package/src/components/organisms/Chat/Chat.stories.js +147 -0
- package/src/components/organisms/Chat/ChatLists/ChatLists.stories.js +65 -0
- package/src/components/organisms/Chat/ChatLists/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ChatLists/THD.png +0 -0
- package/src/components/organisms/Chat/ChatLists/index.js +141 -0
- package/src/components/organisms/Chat/ChatLists/styles.js +162 -0
- package/src/components/organisms/Chat/ContainerItems/ContainerItems.stories.js +142 -0
- package/src/components/organisms/Chat/ContainerItems/index.js +512 -0
- package/src/components/organisms/Chat/ContainerItems/styles.js +328 -0
- package/src/components/organisms/Chat/ContentChat/ContentChat.stories.js +102 -0
- package/src/components/organisms/Chat/ContentChat/Rotoplas.jpeg +0 -0
- package/src/components/organisms/Chat/ContentChat/THD.png +0 -0
- package/src/components/organisms/Chat/ContentChat/index.js +897 -0
- package/src/components/organisms/Chat/ContentChat/styles.js +41 -0
- package/src/components/organisms/Chat/Footer/Footer.stories.js +22 -0
- package/src/components/organisms/Chat/Footer/index.js +661 -0
- package/src/components/organisms/Chat/Footer/styles.js +286 -0
- package/src/components/organisms/Chat/Header/Header.stories.js +66 -0
- package/src/components/organisms/Chat/Header/index.js +94 -0
- package/src/components/organisms/Chat/Header/styles.js +49 -0
- package/src/components/organisms/Chat/index.js +235 -0
- package/src/components/organisms/Chat/styles.js +42 -0
- package/src/components/organisms/FullProductNameHeader/index.js +1 -0
- package/src/components/organisms/Modal/Modal.stories.js +55 -0
- package/src/components/organisms/Modal/index.js +97 -0
- package/src/components/organisms/Modal/styles.js +103 -0
- package/src/components/organisms/RangeCalendar/RangeCalendar.stories.js +16 -0
- package/src/components/organisms/RangeCalendar/index.js +121 -0
- package/src/components/organisms/RangeCalendar/styles.js +883 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +67 -49
- package/src/components/pages/ProviderProductEdition/index.js +16 -9
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +36 -46
- package/src/components/pages/RetailerProductEdition/index.js +20 -14
- package/src/global-files/data.js +18 -23
- package/src/global-files/fonts.css +6 -0
- package/src/global-files/handle_http.js +225 -0
- package/src/global-files/handle_userTech.js +7 -0
- package/src/global-files/utils.js +330 -0
- package/src/global-files/variables.js +2 -0
- package/src/index.js +17 -0
|
@@ -28,53 +28,48 @@ exports.RetailerProductEditionDefault = RetailerProductEditionDefault;
|
|
|
28
28
|
RetailerProductEditionDefault.args = {
|
|
29
29
|
tabsSections: {
|
|
30
30
|
Descripción: true,
|
|
31
|
-
"Ficha técnica":
|
|
32
|
-
Imágenes:
|
|
31
|
+
"Ficha técnica": true,
|
|
32
|
+
Imágenes: true
|
|
33
33
|
},
|
|
34
|
-
token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
34
|
+
token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI1ODg0YWUzNC01OWQ2LTQ0NTQtYjk4ZS04MjE1MThiY2MzYTciLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6IjU4ODRhZTM0LTU5ZDYtNDQ1NC1iOThlLTgyMTUxOGJjYzNhNyIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiJmMzY2YTdjYi02YjA0LTRiMzAtOTJmYy1iMzY0MmY3ZjEzNmEiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY3MTc0MzE0OSwibmFtZSI6IkNhZGVuYSBJc21hZWwiLCJwaG9uZV9udW1iZXIiOiIrNTIzMTExMzY2MzM2IiwiZXhwIjoxNjcxNzQ2NzQ5LCJpYXQiOjE2NzE3NDMxNDksImVtYWlsIjoiY2FkZW5hLmlzbWFlbEBhbGxmcmVlbWFpbC5uZXQifQ.J8kTv1sEotxoicaRclaK1r0tjVbwHPDxIzdDfxYo9J4XwBYYfS180__KYYE0Dh1AfUK_K0mrk2_78_rhTNxCQT85W7XS3ZEcxIOUekqoxaKFl8LSVN_eWz3SlsGG0yRflhJGt6d4gBVByXZbdNiyp1rkjgMln6fhwlRUnuGRbG1WKQvdAPli3qfH8mLzgoTz-6HWs1Jf2Ujheavf3ipGMNtj-OSUdQsh04Ov7jehDWdnPNn2s2DAl4eubgjdXrwIiBPCRkbuFeYZZJpzj1wy__a0nCM7bzly5uTZ2aWujgEJvf9bJb-Y4gkS8TxyJaggJ01ZsMki36aEpIt8J1tJag",
|
|
35
35
|
productSelected: {
|
|
36
36
|
services: {
|
|
37
37
|
datasheets: 1,
|
|
38
38
|
descriptions: 1,
|
|
39
39
|
images: 1
|
|
40
40
|
},
|
|
41
|
-
orderId:
|
|
42
|
-
status: "
|
|
43
|
-
datasheet_status: "
|
|
41
|
+
orderId: 194,
|
|
42
|
+
status: "AC",
|
|
43
|
+
datasheet_status: "AC",
|
|
44
44
|
prio: "none",
|
|
45
45
|
version: 3,
|
|
46
|
-
description_status: "
|
|
47
|
-
images_status: "
|
|
46
|
+
description_status: "AC",
|
|
47
|
+
images_status: "AC",
|
|
48
48
|
statusByRetailer: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
49
|
+
40: {
|
|
50
|
+
description: "AC",
|
|
51
|
+
images: "AC",
|
|
52
|
+
datasheet: "AC"
|
|
53
53
|
},
|
|
54
|
-
|
|
55
|
-
datasheet: "
|
|
56
|
-
description: "
|
|
57
|
-
images: "
|
|
58
|
-
},
|
|
59
|
-
6: {
|
|
60
|
-
datasheet: "PA",
|
|
61
|
-
description: "PA",
|
|
62
|
-
images: "PA"
|
|
54
|
+
43: {
|
|
55
|
+
datasheet: "AC",
|
|
56
|
+
description: "AC",
|
|
57
|
+
images: "AC"
|
|
63
58
|
}
|
|
64
59
|
},
|
|
65
60
|
article: {
|
|
66
|
-
id_article:
|
|
67
|
-
id_category: "
|
|
68
|
-
name: "
|
|
69
|
-
upc: "
|
|
70
|
-
timestamp: "
|
|
61
|
+
id_article: 354,
|
|
62
|
+
id_category: "684",
|
|
63
|
+
name: "Enjuague Bucal ",
|
|
64
|
+
upc: "22342342",
|
|
65
|
+
timestamp: "2023-01-03T16:19:49.000Z",
|
|
71
66
|
id_user: 28,
|
|
72
67
|
status: "NULL",
|
|
73
68
|
active: 1,
|
|
74
69
|
company_id: 1,
|
|
75
70
|
company_name: "GRUPO BRAHMA",
|
|
76
71
|
country: "México",
|
|
77
|
-
id_order:
|
|
72
|
+
id_order: 194,
|
|
78
73
|
id_datasheet_especialist: 54,
|
|
79
74
|
id_datasheet_facilitator: 52,
|
|
80
75
|
id_description_especialist: 54,
|
|
@@ -83,40 +78,37 @@ RetailerProductEditionDefault.args = {
|
|
|
83
78
|
id_images_facilitator: 53,
|
|
84
79
|
id_auditor: 37,
|
|
85
80
|
id_recepcionist: null,
|
|
86
|
-
category: "Salud y Belleza|Cuidado
|
|
81
|
+
category: "Salud y Belleza|Cuidado Bucal|Pastas Dentales y Aseo Bucal",
|
|
87
82
|
missingAttributes: 0,
|
|
88
83
|
missingDescriptions: 0,
|
|
89
84
|
missingImages: 0
|
|
90
85
|
},
|
|
91
86
|
retailers: [{
|
|
92
|
-
id:
|
|
93
|
-
name: "
|
|
94
|
-
}, {
|
|
95
|
-
id: 5,
|
|
96
|
-
name: "Chedraui"
|
|
87
|
+
id: 40,
|
|
88
|
+
name: "Nadro"
|
|
97
89
|
}, {
|
|
98
|
-
id:
|
|
99
|
-
name: "
|
|
90
|
+
id: 43,
|
|
91
|
+
name: "City Club"
|
|
100
92
|
}],
|
|
101
93
|
country: "México",
|
|
102
|
-
upc: "
|
|
94
|
+
upc: "22342342"
|
|
103
95
|
},
|
|
104
96
|
location: {
|
|
105
97
|
product: {
|
|
106
|
-
articleId:
|
|
98
|
+
articleId: 354,
|
|
107
99
|
versionId: 3
|
|
108
100
|
}
|
|
109
101
|
},
|
|
110
102
|
user: {
|
|
111
|
-
id_user:
|
|
112
|
-
name: "
|
|
113
|
-
last_name: "",
|
|
114
|
-
email: "
|
|
103
|
+
id_user: 65,
|
|
104
|
+
name: "Oscar Alberto",
|
|
105
|
+
last_name: "Arenas",
|
|
106
|
+
email: "oarenas@contentoh.com",
|
|
115
107
|
position: "",
|
|
116
108
|
telephone: "",
|
|
117
109
|
country: "",
|
|
118
110
|
id_company: 2,
|
|
119
|
-
id_cognito: "
|
|
111
|
+
id_cognito: "73cc8d40-c841-422a-a2f2-e69d7fe26ebf",
|
|
120
112
|
birth_Date: null,
|
|
121
113
|
about_me: "",
|
|
122
114
|
zip_code: "",
|
|
@@ -127,7 +119,7 @@ RetailerProductEditionDefault.args = {
|
|
|
127
119
|
active: 1,
|
|
128
120
|
is_retailer: 0,
|
|
129
121
|
email_notify: 1,
|
|
130
|
-
is_user_tech:
|
|
122
|
+
is_user_tech: "AS",
|
|
131
123
|
membership: {
|
|
132
124
|
id: 2,
|
|
133
125
|
start_date: "2021-11-05T02:35:12.000Z",
|
|
@@ -139,6 +131,6 @@ RetailerProductEditionDefault.args = {
|
|
|
139
131
|
products_limit: "3",
|
|
140
132
|
type: "PyMES"
|
|
141
133
|
},
|
|
142
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
134
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-65/65.png?1675063399869"
|
|
143
135
|
}
|
|
144
136
|
};
|
|
@@ -318,7 +318,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
318
318
|
})),
|
|
319
319
|
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
320
320
|
percentages = _useState24[0],
|
|
321
|
-
setPercentages = _useState24[1];
|
|
321
|
+
setPercentages = _useState24[1]; // const [percentages, setPercentages] = useState([{ retailers: {} }]);
|
|
322
|
+
|
|
322
323
|
|
|
323
324
|
var _useState25 = (0, _react.useState)(0),
|
|
324
325
|
_useState26 = (0, _slicedToArray2.default)(_useState25, 2),
|
|
@@ -462,8 +463,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
462
463
|
_services = _context.sent;
|
|
463
464
|
//Converts the data inside the datasheets object to array
|
|
464
465
|
setServices(_services);
|
|
465
|
-
getServices();
|
|
466
|
-
|
|
466
|
+
getServices();
|
|
467
467
|
setImages({
|
|
468
468
|
action: "init",
|
|
469
469
|
init: _services[2]
|
|
@@ -472,7 +472,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
472
472
|
(0, _data.getPercentage)({
|
|
473
473
|
data: [product]
|
|
474
474
|
}).then(function (res) {
|
|
475
|
-
return setPercentages(res);
|
|
475
|
+
return setPercentages(res[0]);
|
|
476
476
|
});
|
|
477
477
|
setLoading(false);
|
|
478
478
|
_context.next = 15;
|
|
@@ -681,16 +681,17 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
681
681
|
loadAssignations(product);
|
|
682
682
|
}, [userGroups]);
|
|
683
683
|
(0, _react.useEffect)(function () {
|
|
684
|
-
var
|
|
684
|
+
var _Object$keys, _percentages$product$, _retailers$;
|
|
685
685
|
|
|
686
|
-
product === null || product === void 0 ? void 0 :
|
|
687
|
-
var _percentages$filter$;
|
|
686
|
+
var retailers = (product === null || product === void 0 ? void 0 : product.retailersAvailable) || (product === null || product === void 0 ? void 0 : product.retailers);
|
|
688
687
|
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
688
|
+
if (((_Object$keys = Object.keys((_percentages$product$ = percentages[product.article.id_article]) !== null && _percentages$product$ !== void 0 ? _percentages$product$ : {})) === null || _Object$keys === void 0 ? void 0 : _Object$keys.length) > 0) {
|
|
689
|
+
retailers === null || retailers === void 0 ? void 0 : retailers.forEach(function (retailer, index) {
|
|
690
|
+
retailer["percentage"] = Number(percentages[product.article.id_article][retailer.id].percentageRequired);
|
|
691
|
+
});
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
|
|
694
695
|
}, [percentages]);
|
|
695
696
|
(0, _react.useEffect)(function () {
|
|
696
697
|
if (services.length > 0) {
|
|
@@ -759,14 +760,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
759
760
|
|
|
760
761
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
761
762
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
762
|
-
var _product$article9, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
|
|
763
|
+
var dataClean, _product$article9, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
|
|
763
764
|
|
|
764
765
|
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
765
766
|
while (1) {
|
|
766
767
|
switch (_context5.prev = _context5.next) {
|
|
767
768
|
case 0:
|
|
768
|
-
|
|
769
|
-
|
|
769
|
+
dataClean = updatedDescriptions.filter(function (f) {
|
|
770
|
+
return f.value !== '';
|
|
771
|
+
});
|
|
772
|
+
|
|
773
|
+
if (!(dataClean.length > 0)) {
|
|
774
|
+
_context5.next = 25;
|
|
770
775
|
break;
|
|
771
776
|
}
|
|
772
777
|
|
|
@@ -775,22 +780,22 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
775
780
|
articleId = product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article;
|
|
776
781
|
dataObject = {
|
|
777
782
|
articleId: articleId,
|
|
778
|
-
articleData:
|
|
783
|
+
articleData: dataClean
|
|
779
784
|
};
|
|
780
785
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
781
|
-
_context5.prev =
|
|
782
|
-
_context5.next =
|
|
786
|
+
_context5.prev = 7;
|
|
787
|
+
_context5.next = 10;
|
|
783
788
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
784
789
|
headers: {
|
|
785
790
|
Authorization: token
|
|
786
791
|
}
|
|
787
792
|
});
|
|
788
793
|
|
|
789
|
-
case
|
|
794
|
+
case 10:
|
|
790
795
|
res = _context5.sent;
|
|
791
796
|
|
|
792
797
|
if (!(res.data.statusCode === 200)) {
|
|
793
|
-
_context5.next =
|
|
798
|
+
_context5.next = 20;
|
|
794
799
|
break;
|
|
795
800
|
}
|
|
796
801
|
|
|
@@ -800,24 +805,24 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
800
805
|
setProduct(productTemp);
|
|
801
806
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
802
807
|
setMessage("Descripciones guardadas con éxito");
|
|
803
|
-
_context5.next =
|
|
808
|
+
_context5.next = 20;
|
|
804
809
|
return loadData();
|
|
805
810
|
|
|
806
|
-
case
|
|
807
|
-
_context5.next =
|
|
811
|
+
case 20:
|
|
812
|
+
_context5.next = 25;
|
|
808
813
|
break;
|
|
809
814
|
|
|
810
|
-
case
|
|
811
|
-
_context5.prev =
|
|
812
|
-
_context5.t0 = _context5["catch"](
|
|
815
|
+
case 22:
|
|
816
|
+
_context5.prev = 22;
|
|
817
|
+
_context5.t0 = _context5["catch"](7);
|
|
813
818
|
console.log(_context5.t0);
|
|
814
819
|
|
|
815
|
-
case
|
|
820
|
+
case 25:
|
|
816
821
|
case "end":
|
|
817
822
|
return _context5.stop();
|
|
818
823
|
}
|
|
819
824
|
}
|
|
820
|
-
}, _callee5, null, [[
|
|
825
|
+
}, _callee5, null, [[7, 22]]);
|
|
821
826
|
}));
|
|
822
827
|
|
|
823
828
|
return function saveDescriptions() {
|
|
@@ -827,14 +832,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
827
832
|
|
|
828
833
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
829
834
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
830
|
-
var _product$article10, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
|
|
835
|
+
var dataClean, _product$article10, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
|
|
831
836
|
|
|
832
837
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
833
838
|
while (1) {
|
|
834
839
|
switch (_context6.prev = _context6.next) {
|
|
835
840
|
case 0:
|
|
836
|
-
|
|
837
|
-
|
|
841
|
+
dataClean = updatedDatasheets.filter(function (f) {
|
|
842
|
+
return f.value !== '';
|
|
843
|
+
});
|
|
844
|
+
|
|
845
|
+
if (!(dataClean.length > 0)) {
|
|
846
|
+
_context6.next = 25;
|
|
838
847
|
break;
|
|
839
848
|
}
|
|
840
849
|
|
|
@@ -843,22 +852,22 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
843
852
|
articleId = product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article;
|
|
844
853
|
dataObject = {
|
|
845
854
|
articleId: articleId,
|
|
846
|
-
articleData:
|
|
855
|
+
articleData: dataClean
|
|
847
856
|
};
|
|
848
857
|
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
849
|
-
_context6.prev =
|
|
850
|
-
_context6.next =
|
|
858
|
+
_context6.prev = 7;
|
|
859
|
+
_context6.next = 10;
|
|
851
860
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
852
861
|
headers: {
|
|
853
862
|
Authorization: token
|
|
854
863
|
}
|
|
855
864
|
});
|
|
856
865
|
|
|
857
|
-
case
|
|
866
|
+
case 10:
|
|
858
867
|
res = _context6.sent;
|
|
859
868
|
|
|
860
869
|
if (!(res.data.statusCode === 200)) {
|
|
861
|
-
_context6.next =
|
|
870
|
+
_context6.next = 20;
|
|
862
871
|
break;
|
|
863
872
|
}
|
|
864
873
|
|
|
@@ -868,24 +877,24 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
868
877
|
setProduct(productTemp);
|
|
869
878
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
870
879
|
setMessage("Fichas técnicas guardadas");
|
|
871
|
-
_context6.next =
|
|
880
|
+
_context6.next = 20;
|
|
872
881
|
return loadData();
|
|
873
882
|
|
|
874
|
-
case
|
|
875
|
-
_context6.next =
|
|
883
|
+
case 20:
|
|
884
|
+
_context6.next = 25;
|
|
876
885
|
break;
|
|
877
886
|
|
|
878
|
-
case
|
|
879
|
-
_context6.prev =
|
|
880
|
-
_context6.t0 = _context6["catch"](
|
|
887
|
+
case 22:
|
|
888
|
+
_context6.prev = 22;
|
|
889
|
+
_context6.t0 = _context6["catch"](7);
|
|
881
890
|
console.log(_context6.t0);
|
|
882
891
|
|
|
883
|
-
case
|
|
892
|
+
case 25:
|
|
884
893
|
case "end":
|
|
885
894
|
return _context6.stop();
|
|
886
895
|
}
|
|
887
896
|
}
|
|
888
|
-
}, _callee6, null, [[
|
|
897
|
+
}, _callee6, null, [[7, 22]]);
|
|
889
898
|
}));
|
|
890
899
|
|
|
891
900
|
return function saveDatasheets() {
|
|
@@ -122,35 +122,30 @@ var getPercentage = /*#__PURE__*/function () {
|
|
|
122
122
|
|
|
123
123
|
func = /*#__PURE__*/function () {
|
|
124
124
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
125
|
-
var dataToSend, retailers;
|
|
125
|
+
var dataToSend, arrayRetailers, retailers;
|
|
126
126
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
127
127
|
while (1) {
|
|
128
128
|
switch (_context2.prev = _context2.next) {
|
|
129
129
|
case 0:
|
|
130
130
|
dataToSend = [];
|
|
131
|
+
arrayRetailers = [];
|
|
131
132
|
retailers = params.data[0].retailers || params.data[0].retailersAvailable;
|
|
132
|
-
params.data.forEach(function (product) {
|
|
133
|
+
params.data.forEach(function (product, i) {
|
|
134
|
+
dataToSend.push(product.article ? {
|
|
135
|
+
id_article: product.article.id_article,
|
|
136
|
+
id_category: product.article.id_category,
|
|
137
|
+
version: product.version
|
|
138
|
+
} : {
|
|
139
|
+
id_article: product.id_article,
|
|
140
|
+
id_category: product.id_category,
|
|
141
|
+
version: product.version
|
|
142
|
+
});
|
|
133
143
|
retailers.forEach(function (retailer) {
|
|
134
|
-
|
|
135
|
-
id_article: product.article.id_article,
|
|
136
|
-
id_category: product.article.id_category,
|
|
137
|
-
id_retailer: retailer.id,
|
|
138
|
-
version: product.version,
|
|
139
|
-
upc: product.article.upc,
|
|
140
|
-
name: product.article.name,
|
|
141
|
-
retailerName: retailer.name
|
|
142
|
-
} : {
|
|
143
|
-
id_article: product.id_article,
|
|
144
|
-
id_category: product.id_category,
|
|
145
|
-
id_retailer: retailer.id,
|
|
146
|
-
version: product.version,
|
|
147
|
-
upc: product.upc,
|
|
148
|
-
name: product.name,
|
|
149
|
-
retailerName: retailer.name
|
|
150
|
-
});
|
|
144
|
+
arrayRetailers.push(retailer.id);
|
|
151
145
|
});
|
|
146
|
+
dataToSend[i].id_retailer_array = arrayRetailers;
|
|
152
147
|
});
|
|
153
|
-
_context2.next =
|
|
148
|
+
_context2.next = 6;
|
|
154
149
|
return _axios.default.post(process.env.REACT_APP_VALID_EXPORT_ENDPOINT, {
|
|
155
150
|
data: dataToSend
|
|
156
151
|
}, {
|
|
@@ -158,15 +153,15 @@ var getPercentage = /*#__PURE__*/function () {
|
|
|
158
153
|
Authorization: sessionStorage.getItem("jwt")
|
|
159
154
|
}
|
|
160
155
|
}).then(function (response) {
|
|
161
|
-
return response.data;
|
|
156
|
+
return [response.data];
|
|
162
157
|
}).catch(function (err) {
|
|
163
158
|
return console.log(err, "Errror");
|
|
164
159
|
});
|
|
165
160
|
|
|
166
|
-
case
|
|
161
|
+
case 6:
|
|
167
162
|
return _context2.abrupt("return", _context2.sent);
|
|
168
163
|
|
|
169
|
-
case
|
|
164
|
+
case 7:
|
|
170
165
|
case "end":
|
|
171
166
|
return _context2.stop();
|
|
172
167
|
}
|
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.isValidNaturalNumber = exports.isStringEmpty = exports.isObject = exports.isArrayEmpty = exports.getTime = exports.getResizeImgHeight = exports.getImageURL = exports.getImageSize = exports.getFullDate = exports.getFileName = exports.getFileExtension = exports.getDataBuffer = exports.getDataBase64 = exports.getCustomDate = exports.getBase64 = exports.encodeUriJson = exports.decodeJSON = void 0;
|
|
8
|
+
exports.isValidNaturalNumber = exports.isStringEmpty = exports.isObject = exports.isArrayEmpty = exports.getTime = exports.getResizeImgHeight = exports.getImageURL = exports.getImageSize = exports.getFullDate = exports.getFormatedDate = exports.getFileName = exports.getFileExtension = exports.getDataBuffer = exports.getDataBase64 = exports.getCustomDate = exports.getBase64 = exports.encodeUriJson = exports.decodeJSON = void 0;
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
@@ -342,6 +342,26 @@ var getFullDate = function getFullDate() {
|
|
|
342
342
|
/*------------------------
|
|
343
343
|
Obtener una fecha a partir de
|
|
344
344
|
un objeto Date() en formato:
|
|
345
|
+
'aaaa-MM-dd'
|
|
346
|
+
ejemplo: '2022-12-25'
|
|
347
|
+
--------------------------*/
|
|
348
|
+
|
|
349
|
+
|
|
350
|
+
exports.getFullDate = getFullDate;
|
|
351
|
+
|
|
352
|
+
var getFormatedDate = function getFormatedDate() {
|
|
353
|
+
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
|
|
354
|
+
var separator = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "/";
|
|
355
|
+
if (isNaN(date)) return undefined;
|
|
356
|
+
var dateString = "";
|
|
357
|
+
dateString += date.getFullYear() + separator;
|
|
358
|
+
dateString += date.getMonth() + 1 + separator;
|
|
359
|
+
dateString += date.getDate();
|
|
360
|
+
return dateString;
|
|
361
|
+
};
|
|
362
|
+
/*------------------------
|
|
363
|
+
Obtener una fecha a partir de
|
|
364
|
+
un objeto Date() en formato:
|
|
345
365
|
'dd de MMMM del aaaa'
|
|
346
366
|
ejemplo: '12 de octubre del 2022'
|
|
347
367
|
=> si es la fecha del dia actual:
|
|
@@ -353,7 +373,7 @@ devolvera '12 de octubre'
|
|
|
353
373
|
--------------------------*/
|
|
354
374
|
|
|
355
375
|
|
|
356
|
-
exports.
|
|
376
|
+
exports.getFormatedDate = getFormatedDate;
|
|
357
377
|
|
|
358
378
|
var getCustomDate = function getCustomDate() {
|
|
359
379
|
var date = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : new Date();
|