contentoh-components-library 21.0.92 → 21.0.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/atoms/AsignationOption/index.js +31 -2
- package/dist/components/atoms/AsignationOption/styles.js +1 -1
- package/dist/components/atoms/InputFormatter/index.js +1 -1
- package/dist/components/atoms/StatusTag/styles.js +1 -1
- package/dist/components/molecules/RetailerSelector/index.js +5 -2
- package/dist/components/molecules/StatusAsignationInfo/index.js +1 -1
- package/dist/components/organisms/FullProductNameHeader/index.js +29 -2
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +44 -114
- package/dist/components/pages/ProviderProductEdition/index.js +75 -44
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +44 -44
- package/dist/components/pages/RetailerProductEdition/index.js +83 -45
- package/package.json +1 -1
- package/src/components/atoms/AsignationOption/index.js +21 -0
- package/src/components/atoms/AsignationOption/styles.js +6 -0
- package/src/components/atoms/InputFormatter/index.js +1 -1
- package/src/components/atoms/StatusTag/styles.js +2 -1
- package/src/components/molecules/RetailerSelector/index.js +3 -0
- package/src/components/molecules/StatusAsignationInfo/index.js +8 -6
- package/src/components/organisms/FullProductNameHeader/index.js +19 -1
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +48 -133
- package/src/components/pages/ProviderProductEdition/index.js +50 -23
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +44 -44
- package/src/components/pages/RetailerProductEdition/index.js +60 -19
|
@@ -19,6 +19,10 @@ var _requestToTeam = _interopRequireDefault(require("../../../assets/images/asig
|
|
|
19
19
|
|
|
20
20
|
var _availableIcon = _interopRequireDefault(require("../../../assets/images/asignationOptions/availableIcon.svg"));
|
|
21
21
|
|
|
22
|
+
var _data = require("../../../global-files/data");
|
|
23
|
+
|
|
24
|
+
var _StatusTag = require("../StatusTag");
|
|
25
|
+
|
|
22
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
27
|
|
|
24
28
|
var AsignationOption = function AsignationOption(_ref) {
|
|
@@ -31,7 +35,27 @@ var AsignationOption = function AsignationOption(_ref) {
|
|
|
31
35
|
team = _ref.team,
|
|
32
36
|
onClick = _ref.onClick,
|
|
33
37
|
btnOnClick = _ref.btnOnClick,
|
|
34
|
-
active = _ref.active
|
|
38
|
+
active = _ref.active,
|
|
39
|
+
services = _ref.services;
|
|
40
|
+
|
|
41
|
+
var getStatus = function getStatus() {
|
|
42
|
+
var servCad = "";
|
|
43
|
+
services.forEach(function (srv) {
|
|
44
|
+
return servCad += srv;
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
switch (servCad) {
|
|
48
|
+
case "NANANA":
|
|
49
|
+
return "NA";
|
|
50
|
+
|
|
51
|
+
case "RECEIVEDRECEIVEDRECEIVED":
|
|
52
|
+
return "RECEIVED";
|
|
53
|
+
|
|
54
|
+
default:
|
|
55
|
+
return (0, _data.getNewStatus)(services);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
35
59
|
var iconsAsignation = {
|
|
36
60
|
assigned: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
37
61
|
onClick: btnOnClick,
|
|
@@ -68,7 +92,12 @@ var AsignationOption = function AsignationOption(_ref) {
|
|
|
68
92
|
className: "team-label",
|
|
69
93
|
children: team
|
|
70
94
|
})]
|
|
71
|
-
}), asignationType && iconsAsignation[asignationType],
|
|
95
|
+
}), asignationType && iconsAsignation[asignationType], services && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
96
|
+
className: "status-container",
|
|
97
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StatusTag.StatusTag, {
|
|
98
|
+
statusType: getStatus()
|
|
99
|
+
})
|
|
100
|
+
}), active && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
72
101
|
className: "green-circle"
|
|
73
102
|
})]
|
|
74
103
|
});
|
|
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
|
|
|
15
15
|
|
|
16
16
|
var _templateObject;
|
|
17
17
|
|
|
18
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n cursor: pointer;\n border-radius: 3px;\n padding: 5px;\n\n .profile-image,\n .medium-image {\n & + * {\n margin-left: 15px;\n }\n }\n\n .labels-container {\n font-family: ", ";\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n\n .name-label,\n .team-label {\n inline-size: 100px;\n overflow: hidden;\n }\n\n .name-label {\n color: ", ";\n }\n\n .team-label {\n color: ", ";\n }\n\n & + * {\n margin-left: 11px;\n }\n }\n\n .green-circle {\n background-color: ", ";\n width: 20px;\n height: 20px;\n border-radius: 50%;\n }\n\n button {\n background-color: transparent;\n cursor: pointer;\n border: none;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n & + * {\n margin-top: 10px;\n }\n"])), _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.s3);
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n cursor: pointer;\n border-radius: 3px;\n padding: 5px;\n\n .profile-image,\n .medium-image {\n & + * {\n margin-left: 15px;\n }\n }\n\n .labels-container {\n font-family: ", ";\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n\n .name-label,\n .team-label {\n inline-size: 100px;\n overflow: hidden;\n }\n\n .name-label {\n color: ", ";\n }\n\n .team-label {\n color: ", ";\n }\n\n & + * {\n margin-left: 11px;\n }\n }\n\n .status-container {\n & + * {\n margin-left: 10px;\n }\n }\n\n .green-circle {\n background-color: ", ";\n width: 20px;\n height: 20px;\n border-radius: 50%;\n }\n\n button {\n background-color: transparent;\n cursor: pointer;\n border: none;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n & + * {\n margin-top: 10px;\n }\n"])), _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.s3);
|
|
19
19
|
|
|
20
20
|
exports.Container = Container;
|
|
@@ -99,7 +99,7 @@ var InputFormatter = function InputFormatter(_ref) {
|
|
|
99
99
|
setCharsCounter(h.getLength() - 1);
|
|
100
100
|
value = valueFormater(value);
|
|
101
101
|
var idInput = inputId;
|
|
102
|
-
var dataSave = updatedDescriptions.slice();
|
|
102
|
+
var dataSave = updatedDescriptions === null || updatedDescriptions === void 0 ? void 0 : updatedDescriptions.slice();
|
|
103
103
|
|
|
104
104
|
if (dataSave.length > 0) {
|
|
105
105
|
if (dataSave.filter(function (e) {
|
|
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
|
|
|
15
15
|
|
|
16
16
|
var _templateObject;
|
|
17
17
|
|
|
18
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n padding: 0 10px;\n height: 20px;\n background-color: ", ";\n border-radius: 3px;\n\n p {\n text-align: center;\n color: ", ";\n font-family: ", ";\n font-size: 12px;\n line-height: 20px;\n }\n\n &.status-As,\n &.status-P,\n &.status-IN_PROGRESS,\n &.status-QF {\n background-color: ", ";\n }\n\n &.status-Pr,\n &.status-Rr {\n background-color: ", ";\n }\n\n &.status-AA,\n &.status-AP,\n &.status-AC,\n &.status-AF {\n background-color: ", ";\n }\n\n &.status-RA,\n &.status-RF,\n &.status-RP,\n &.status-RC {\n background-color: ", ";\n }\n\n &.status-Dat,\n &.status-Dsc,\n &.status-Imgs {\n background-color: ", ";\n }\n\n &.status-Ex {\n background-color: ", ";\n }\n\n &.status-DDI {\n background-color: ", ";\n }\n\n &.status-GLD {\n background-color: ", ";\n }\n\n &.status-TAB {\n background-color: ", ";\n }\n\n &.status-Pt {\n background-color: ", ";\n color: ", ";\n }\n\n &.oval-form {\n border-radius: 10px;\n }\n"])), _variables.GlobalColors.s3, _variables.GlobalColors.white, _variables.FontFamily.Lato, _variables.GlobalColors.in_progress, _variables.GlobalColors.reception, _variables.GlobalColors.finished, _variables.GlobalColors.rejected_status, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.original_purpura, _variables.GlobalColors.in_progress, _variables.GlobalColors.deep_gray, _variables.GlobalColors.s2, _variables.GlobalColors.s4);
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n padding: 0 10px;\n height: 20px;\n background-color: ", ";\n border-radius: 3px;\n\n p {\n text-align: center;\n color: ", ";\n font-family: ", ";\n font-size: 12px;\n line-height: 20px;\n }\n\n &.status-As,\n &.status-P,\n &.status-IN_PROGRESS,\n &.status-QF {\n background-color: ", ";\n }\n\n &.status-Pr,\n &.status-Rr,\n &.status-Rc {\n background-color: ", ";\n }\n\n &.status-AA,\n &.status-AP,\n &.status-AC,\n &.status-AF {\n background-color: ", ";\n }\n\n &.status-RA,\n &.status-RF,\n &.status-RP,\n &.status-RC {\n background-color: ", ";\n }\n\n &.status-Dat,\n &.status-Dsc,\n &.status-Imgs {\n background-color: ", ";\n }\n\n &.status-Ex {\n background-color: ", ";\n }\n\n &.status-DDI {\n background-color: ", ";\n }\n\n &.status-GLD {\n background-color: ", ";\n }\n\n &.status-TAB {\n background-color: ", ";\n }\n\n &.status-Pt {\n background-color: ", ";\n color: ", ";\n }\n\n &.oval-form {\n border-radius: 10px;\n }\n"])), _variables.GlobalColors.s3, _variables.GlobalColors.white, _variables.FontFamily.Lato, _variables.GlobalColors.in_progress, _variables.GlobalColors.reception, _variables.GlobalColors.finished, _variables.GlobalColors.rejected_status, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.original_purpura, _variables.GlobalColors.in_progress, _variables.GlobalColors.deep_gray, _variables.GlobalColors.s2, _variables.GlobalColors.s4);
|
|
19
19
|
|
|
20
20
|
exports.Container = Container;
|
|
@@ -24,7 +24,8 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
24
24
|
var RetailerSelector = function RetailerSelector(_ref) {
|
|
25
25
|
var retailers = _ref.retailers,
|
|
26
26
|
activeRetailer = _ref.activeRetailer,
|
|
27
|
-
setActiveRetailer = _ref.setActiveRetailer
|
|
27
|
+
setActiveRetailer = _ref.setActiveRetailer,
|
|
28
|
+
showStatus = _ref.showStatus;
|
|
28
29
|
|
|
29
30
|
var _useState = (0, _react.useState)(false),
|
|
30
31
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -64,12 +65,14 @@ var RetailerSelector = function RetailerSelector(_ref) {
|
|
|
64
65
|
asignationType: null,
|
|
65
66
|
name: retailer === null || retailer === void 0 ? void 0 : retailer.name,
|
|
66
67
|
team: retailer === null || retailer === void 0 ? void 0 : retailer.team,
|
|
68
|
+
services: retailer === null || retailer === void 0 ? void 0 : retailer.services,
|
|
67
69
|
onClick: function onClick() {
|
|
68
70
|
setActiveRetailer(retailer);
|
|
69
71
|
document.removeEventListener("click", closeRetailersPanel, false);
|
|
70
72
|
setRetailersPanel(false);
|
|
71
73
|
},
|
|
72
|
-
active: retailer.id === activeRetailer.id
|
|
74
|
+
active: retailer.id === activeRetailer.id,
|
|
75
|
+
showStatus: showStatus
|
|
73
76
|
}, "".concat(index, "-").concat(retailer === null || retailer === void 0 ? void 0 : retailer.name));
|
|
74
77
|
})
|
|
75
78
|
})]
|
|
@@ -83,7 +83,7 @@ var StatusAsignationInfo = function StatusAsignationInfo(_ref) {
|
|
|
83
83
|
onClick: onClickSave
|
|
84
84
|
}), imagesSection && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
85
85
|
className: "images-buttons",
|
|
86
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
86
|
+
children: [showSaveButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
87
87
|
buttonType: "circular-button delete-button",
|
|
88
88
|
onClick: function onClick() {
|
|
89
89
|
askToDeleteImages && askToDeleteImages();
|
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
8
|
exports.FullProductNameHeader = void 0;
|
|
7
9
|
|
|
10
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
11
|
+
|
|
8
12
|
var _styles = require("./styles");
|
|
9
13
|
|
|
10
14
|
var _ProductNameHeader = require("../../molecules/ProductNameHeader");
|
|
@@ -13,6 +17,8 @@ var _FeaturesBar = require("../../molecules/FeaturesBar");
|
|
|
13
17
|
|
|
14
18
|
var _AvatarAndValidation = require("../../molecules/AvatarAndValidation");
|
|
15
19
|
|
|
20
|
+
var _react = require("react");
|
|
21
|
+
|
|
16
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
23
|
|
|
18
24
|
var FullProductNameHeader = function FullProductNameHeader(_ref) {
|
|
@@ -24,7 +30,28 @@ var FullProductNameHeader = function FullProductNameHeader(_ref) {
|
|
|
24
30
|
setActiveRetailer = _ref.setActiveRetailer,
|
|
25
31
|
showValidationButtons = _ref.showValidationButtons,
|
|
26
32
|
approve = _ref.approve,
|
|
27
|
-
reject = _ref.reject
|
|
33
|
+
reject = _ref.reject,
|
|
34
|
+
servicesData = _ref.servicesData;
|
|
35
|
+
|
|
36
|
+
var _useState = (0, _react.useState)([]),
|
|
37
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
38
|
+
retailers = _useState2[0],
|
|
39
|
+
setRetailers = _useState2[1];
|
|
40
|
+
|
|
41
|
+
(0, _react.useEffect)(function () {
|
|
42
|
+
var rtls = (headerData === null || headerData === void 0 ? void 0 : headerData.retailers) || (headerData === null || headerData === void 0 ? void 0 : headerData.retailersAvailable);
|
|
43
|
+
servicesData && rtls.forEach(function (rt) {
|
|
44
|
+
var element = [];
|
|
45
|
+
servicesData.forEach(function (sd) {
|
|
46
|
+
if (sd.id_retailer === rt.id) {
|
|
47
|
+
element.push(sd.status ? sd.status : "RECEIVED");
|
|
48
|
+
} else element.push("NA");
|
|
49
|
+
|
|
50
|
+
rt["services"] = element;
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
setRetailers(rtls);
|
|
54
|
+
}, [servicesData]);
|
|
28
55
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
29
56
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductNameHeader.ProductNameHeader, {
|
|
30
57
|
productName: (headerData === null || headerData === void 0 ? void 0 : (_headerData$article = headerData.article) === null || _headerData$article === void 0 ? void 0 : _headerData$article.name) || (headerData === null || headerData === void 0 ? void 0 : headerData.name),
|
|
@@ -46,7 +73,7 @@ var FullProductNameHeader = function FullProductNameHeader(_ref) {
|
|
|
46
73
|
value: (headerData === null || headerData === void 0 ? void 0 : (_headerData$article5 = headerData.article) === null || _headerData$article5 === void 0 ? void 0 : _headerData$article5.upc) || (headerData === null || headerData === void 0 ? void 0 : headerData.upc)
|
|
47
74
|
}]
|
|
48
75
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AvatarAndValidation.AvatarAndValidation, {
|
|
49
|
-
retailers:
|
|
76
|
+
retailers: retailers,
|
|
50
77
|
avatarData: headerData === null || headerData === void 0 ? void 0 : headerData.avatarData,
|
|
51
78
|
validation: headerData === null || headerData === void 0 ? void 0 : headerData.validation,
|
|
52
79
|
activeRetailer: activeRetailer,
|
|
@@ -36,126 +36,56 @@ ProviderProductEditionDefault.args = {
|
|
|
36
36
|
category: 846,
|
|
37
37
|
version: 2,
|
|
38
38
|
productSelected: {
|
|
39
|
-
|
|
40
|
-
id_category: "
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
datasheet: 33,
|
|
50
|
-
descriptions: 14,
|
|
51
|
-
images: 3
|
|
52
|
-
},
|
|
53
|
-
article: {
|
|
54
|
-
category: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
|
|
55
|
-
company_name: "COMPANY DEV",
|
|
56
|
-
id_category: "684",
|
|
57
|
-
id_article: 33249,
|
|
58
|
-
name: "Crema dental ",
|
|
59
|
-
timestamp: "2022-06-14T23:24:08.000Z",
|
|
60
|
-
upc: "232435"
|
|
61
|
-
},
|
|
62
|
-
retailers: [{
|
|
63
|
-
id: 4,
|
|
64
|
-
name: "Walmart Super y Superama"
|
|
65
|
-
}, {
|
|
66
|
-
id: 9,
|
|
67
|
-
name: "Amazon"
|
|
68
|
-
}, {
|
|
69
|
-
id: 1013,
|
|
70
|
-
name: "Cencosud Colombia"
|
|
71
|
-
}, {
|
|
72
|
-
id: 2005,
|
|
73
|
-
name: "ClubCo"
|
|
74
|
-
}],
|
|
75
|
-
services: {
|
|
76
|
-
datasheets: 1,
|
|
77
|
-
descriptions: 1,
|
|
78
|
-
images: 1
|
|
79
|
-
},
|
|
39
|
+
id_article: 35319,
|
|
40
|
+
id_category: "2146",
|
|
41
|
+
name: "FOCO LED A19 (60W) LUZ AMARILLA",
|
|
42
|
+
upc: "120873",
|
|
43
|
+
timestamp: "2022-06-14T15:31:50.000Z",
|
|
44
|
+
status: "NULL",
|
|
45
|
+
categoryName: "ILUMINACIÓN|FOCOS|LEDS",
|
|
46
|
+
asignations: [],
|
|
47
|
+
version: 2,
|
|
48
|
+
version_status: "AA",
|
|
80
49
|
retailersAvailable: [{
|
|
81
|
-
id:
|
|
82
|
-
name: "
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}, {
|
|
87
|
-
id: 1013,
|
|
88
|
-
name: "Cencosud Colombia"
|
|
89
|
-
}, {
|
|
90
|
-
id: 2005,
|
|
91
|
-
name: "ClubCo"
|
|
50
|
+
id: 58,
|
|
51
|
+
name: "The Home Depot Golden",
|
|
52
|
+
country: "México",
|
|
53
|
+
id_region: 1,
|
|
54
|
+
active: 1
|
|
92
55
|
}],
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
56
|
+
missing: {
|
|
57
|
+
datasheet: 33,
|
|
58
|
+
description: 0,
|
|
59
|
+
image: 23
|
|
60
|
+
}
|
|
96
61
|
},
|
|
97
62
|
productToEdit: {
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
product: {
|
|
101
|
-
|
|
102
|
-
id_category: "
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
datasheet: 33,
|
|
112
|
-
descriptions: 14,
|
|
113
|
-
images: 3
|
|
114
|
-
},
|
|
115
|
-
article: {
|
|
116
|
-
category: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
|
|
117
|
-
company_name: "COMPANY DEV",
|
|
118
|
-
id_category: "684",
|
|
119
|
-
id_article: 33249,
|
|
120
|
-
name: "Crema dental ",
|
|
121
|
-
timestamp: "2022-06-14T23:24:08.000Z",
|
|
122
|
-
upc: "232435"
|
|
123
|
-
},
|
|
124
|
-
retailers: [{
|
|
125
|
-
id: 4,
|
|
126
|
-
name: "Walmart Super y Superama"
|
|
127
|
-
}, {
|
|
128
|
-
id: 9,
|
|
129
|
-
name: "Amazon"
|
|
130
|
-
}, {
|
|
131
|
-
id: 1013,
|
|
132
|
-
name: "Cencosud Colombia"
|
|
133
|
-
}, {
|
|
134
|
-
id: 2005,
|
|
135
|
-
name: "ClubCo"
|
|
136
|
-
}],
|
|
137
|
-
services: {
|
|
138
|
-
datasheets: 1,
|
|
139
|
-
descriptions: 1,
|
|
140
|
-
images: 1
|
|
141
|
-
},
|
|
63
|
+
idCategory: "2146",
|
|
64
|
+
ArticleId: 35319,
|
|
65
|
+
product: [{
|
|
66
|
+
id_article: 35319,
|
|
67
|
+
id_category: "2146",
|
|
68
|
+
name: "FOCO LED A19 (60W) LUZ AMARILLA",
|
|
69
|
+
upc: "120873",
|
|
70
|
+
timestamp: "2022-06-14T15:31:50.000Z",
|
|
71
|
+
status: "NULL",
|
|
72
|
+
categoryName: "ILUMINACIÓN|FOCOS|LEDS",
|
|
73
|
+
asignations: [],
|
|
74
|
+
version: 2,
|
|
75
|
+
version_status: "AA",
|
|
142
76
|
retailersAvailable: [{
|
|
143
|
-
id:
|
|
144
|
-
name: "
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
}, {
|
|
149
|
-
id: 1013,
|
|
150
|
-
name: "Cencosud Colombia"
|
|
151
|
-
}, {
|
|
152
|
-
id: 2005,
|
|
153
|
-
name: "ClubCo"
|
|
77
|
+
id: 58,
|
|
78
|
+
name: "The Home Depot Golden",
|
|
79
|
+
country: "México",
|
|
80
|
+
id_region: 1,
|
|
81
|
+
active: 1
|
|
154
82
|
}],
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
83
|
+
missing: {
|
|
84
|
+
datasheet: 33,
|
|
85
|
+
description: 0,
|
|
86
|
+
image: 23
|
|
87
|
+
}
|
|
88
|
+
}]
|
|
159
89
|
},
|
|
160
90
|
location: {
|
|
161
91
|
product: {
|
|
@@ -110,6 +110,14 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
110
110
|
values: values
|
|
111
111
|
});
|
|
112
112
|
|
|
113
|
+
case "deleteImage":
|
|
114
|
+
values = values.filter(function (value) {
|
|
115
|
+
return action.selectedImages.indexOf(value) === -1;
|
|
116
|
+
});
|
|
117
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
|
|
118
|
+
values: values
|
|
119
|
+
});
|
|
120
|
+
|
|
113
121
|
default:
|
|
114
122
|
return state;
|
|
115
123
|
}
|
|
@@ -131,7 +139,7 @@ var myBucket = new _awsSdk.default.S3({
|
|
|
131
139
|
});
|
|
132
140
|
|
|
133
141
|
var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
134
|
-
var _product$retailers, _product$retailersAva, _location$state,
|
|
142
|
+
var _product$retailers, _product$retailersAva, _location$state, _datasheets$, _datasheets$$data;
|
|
135
143
|
|
|
136
144
|
var tabsSections = _ref.tabsSections,
|
|
137
145
|
_ref$productSelected = _ref.productSelected,
|
|
@@ -446,6 +454,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
446
454
|
socketType = _useState80[0],
|
|
447
455
|
setSocketType = _useState80[1];
|
|
448
456
|
|
|
457
|
+
var _useState81 = (0, _react.useState)(loading),
|
|
458
|
+
_useState82 = (0, _slicedToArray2.default)(_useState81, 2),
|
|
459
|
+
saving = _useState82[0],
|
|
460
|
+
setSaving = _useState82[1];
|
|
461
|
+
|
|
449
462
|
(0, _react.useEffect)(function () {
|
|
450
463
|
checkAll && setSelectedImages(images.values);
|
|
451
464
|
}, [checkAll]);
|
|
@@ -469,7 +482,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
469
482
|
|
|
470
483
|
setImages({
|
|
471
484
|
action: "init",
|
|
472
|
-
init:
|
|
485
|
+
init: services[2]
|
|
473
486
|
});
|
|
474
487
|
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);
|
|
475
488
|
setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
|
|
@@ -696,7 +709,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
696
709
|
var thumbs = function thumbs() {
|
|
697
710
|
var _images$imageType, _images$imagePackagin, _images$values;
|
|
698
711
|
|
|
699
|
-
var imageInputs = socketType.slice();
|
|
712
|
+
var imageInputs = socketType === null || socketType === void 0 ? void 0 : socketType.slice();
|
|
700
713
|
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) {
|
|
701
714
|
return {
|
|
702
715
|
value: e === null || e === void 0 ? void 0 : e.id,
|
|
@@ -903,18 +916,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
903
916
|
}
|
|
904
917
|
|
|
905
918
|
if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
|
|
906
|
-
_context8.next =
|
|
919
|
+
_context8.next = 31;
|
|
907
920
|
break;
|
|
908
921
|
}
|
|
909
922
|
|
|
910
|
-
|
|
923
|
+
setLoading(true);
|
|
924
|
+
_context8.prev = 11;
|
|
911
925
|
data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
|
|
912
926
|
e.uuid = (0, _uuid.v4)();
|
|
913
927
|
});
|
|
914
928
|
setDataImages(data);
|
|
915
929
|
|
|
916
930
|
if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
|
|
917
|
-
_context8.next =
|
|
931
|
+
_context8.next = 23;
|
|
918
932
|
break;
|
|
919
933
|
}
|
|
920
934
|
|
|
@@ -930,40 +944,40 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
930
944
|
};
|
|
931
945
|
promiseArray.push(myBucket.putObject(params).promise());
|
|
932
946
|
});
|
|
933
|
-
_context8.next =
|
|
947
|
+
_context8.next = 20;
|
|
934
948
|
return Promise.all(promiseArray);
|
|
935
949
|
|
|
936
|
-
case
|
|
950
|
+
case 20:
|
|
937
951
|
setImagesUploaded(true);
|
|
938
|
-
_context8.next =
|
|
952
|
+
_context8.next = 24;
|
|
939
953
|
break;
|
|
940
954
|
|
|
941
|
-
case
|
|
955
|
+
case 23:
|
|
942
956
|
setImagesUploaded(true);
|
|
943
957
|
|
|
944
|
-
case
|
|
945
|
-
_context8.next =
|
|
958
|
+
case 24:
|
|
959
|
+
_context8.next = 29;
|
|
946
960
|
break;
|
|
947
961
|
|
|
948
|
-
case
|
|
949
|
-
_context8.prev =
|
|
950
|
-
_context8.t0 = _context8["catch"](
|
|
962
|
+
case 26:
|
|
963
|
+
_context8.prev = 26;
|
|
964
|
+
_context8.t0 = _context8["catch"](11);
|
|
951
965
|
console.log(_context8.t0); // setMainLoading(false);
|
|
952
966
|
|
|
953
|
-
case
|
|
954
|
-
_context8.next =
|
|
967
|
+
case 29:
|
|
968
|
+
_context8.next = 32;
|
|
955
969
|
break;
|
|
956
970
|
|
|
957
|
-
case
|
|
971
|
+
case 31:
|
|
958
972
|
// setMainLoading(false);
|
|
959
973
|
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.");
|
|
960
974
|
|
|
961
|
-
case
|
|
975
|
+
case 32:
|
|
962
976
|
case "end":
|
|
963
977
|
return _context8.stop();
|
|
964
978
|
}
|
|
965
979
|
}
|
|
966
|
-
}, _callee8, null, [[
|
|
980
|
+
}, _callee8, null, [[11, 26]]);
|
|
967
981
|
})), [images, imagesUploaded]);
|
|
968
982
|
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
969
983
|
return _regenerator.default.wrap(function _callee9$(_context9) {
|
|
@@ -971,11 +985,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
971
985
|
switch (_context9.prev = _context9.next) {
|
|
972
986
|
case 0:
|
|
973
987
|
if (!imagesUploaded) {
|
|
974
|
-
_context9.next =
|
|
988
|
+
_context9.next = 13;
|
|
975
989
|
break;
|
|
976
990
|
}
|
|
977
991
|
|
|
978
|
-
setLoading(true);
|
|
979
992
|
dataImages.articleData = dataImages === null || dataImages === void 0 ? void 0 : dataImages.articleData.map(function (e) {
|
|
980
993
|
delete e.src;
|
|
981
994
|
e.imageID = e.image_id;
|
|
@@ -984,32 +997,32 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
984
997
|
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
985
998
|
return e;
|
|
986
999
|
});
|
|
987
|
-
_context9.prev =
|
|
988
|
-
_context9.next =
|
|
1000
|
+
_context9.prev = 2;
|
|
1001
|
+
_context9.next = 5;
|
|
989
1002
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
|
|
990
1003
|
headers: {
|
|
991
1004
|
Authorization: token
|
|
992
1005
|
}
|
|
993
1006
|
});
|
|
994
1007
|
|
|
995
|
-
case
|
|
1008
|
+
case 5:
|
|
996
1009
|
setMessage("Imágenes guardadas con éxito");
|
|
997
1010
|
sessionStorage.removeItem("imagesList");
|
|
998
1011
|
loadData();
|
|
999
|
-
_context9.next =
|
|
1012
|
+
_context9.next = 13;
|
|
1000
1013
|
break;
|
|
1001
1014
|
|
|
1002
|
-
case
|
|
1003
|
-
_context9.prev =
|
|
1004
|
-
_context9.t0 = _context9["catch"](
|
|
1015
|
+
case 10:
|
|
1016
|
+
_context9.prev = 10;
|
|
1017
|
+
_context9.t0 = _context9["catch"](2);
|
|
1005
1018
|
console.log(_context9.t0);
|
|
1006
1019
|
|
|
1007
|
-
case
|
|
1020
|
+
case 13:
|
|
1008
1021
|
case "end":
|
|
1009
1022
|
return _context9.stop();
|
|
1010
1023
|
}
|
|
1011
1024
|
}
|
|
1012
|
-
}, _callee9, null, [[
|
|
1025
|
+
}, _callee9, null, [[2, 10]]);
|
|
1013
1026
|
})), [dataImages, imagesUploaded]);
|
|
1014
1027
|
|
|
1015
1028
|
var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {// const srv = servicesData.filter((serv) => serv.service === getConcept(tab));
|
|
@@ -1274,7 +1287,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1274
1287
|
}();
|
|
1275
1288
|
|
|
1276
1289
|
var getRequired = function getRequired(services) {
|
|
1277
|
-
var _services$4, _services$4$inputs;
|
|
1290
|
+
var _services$4, _services$4$retailerM, _services$5, _services$5$inputs;
|
|
1278
1291
|
|
|
1279
1292
|
var objetcTemp = {};
|
|
1280
1293
|
var datasheetServicesArray = Object.values(services[0]);
|
|
@@ -1308,8 +1321,18 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1308
1321
|
});
|
|
1309
1322
|
});
|
|
1310
1323
|
objetcTemp["Descripción"] = desInputsRequired;
|
|
1311
|
-
var
|
|
1312
|
-
|
|
1324
|
+
var retailersRequested = [];
|
|
1325
|
+
(_services$4 = services[2]) === null || _services$4 === void 0 ? void 0 : (_services$4$retailerM = _services$4.retailerMandatories) === null || _services$4$retailerM === void 0 ? void 0 : _services$4$retailerM.forEach(function (retMan) {
|
|
1326
|
+
return retMan.forEach(function (rm) {
|
|
1327
|
+
return retailersRequested.push(rm);
|
|
1328
|
+
});
|
|
1329
|
+
});
|
|
1330
|
+
var requiredImages = (_services$5 = services[2]) === null || _services$5 === void 0 ? void 0 : (_services$5$inputs = _services$5.inputs) === null || _services$5$inputs === void 0 ? void 0 : _services$5$inputs.filter(function (e) {
|
|
1331
|
+
return e.required === 1 && retailersRequested.filter(function (ret) {
|
|
1332
|
+
return ret.id_image === e.id && servicesData.filter(function (srv) {
|
|
1333
|
+
return srv.id_retailer === ret.id_retailer;
|
|
1334
|
+
}).length > 0;
|
|
1335
|
+
}).length > 0;
|
|
1313
1336
|
});
|
|
1314
1337
|
var requiredCounter = 0;
|
|
1315
1338
|
requiredImages === null || requiredImages === void 0 ? void 0 : requiredImages.forEach(function (req) {
|
|
@@ -1445,7 +1468,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1445
1468
|
|
|
1446
1469
|
var deleteImages = function deleteImages() {
|
|
1447
1470
|
setLoading(true);
|
|
1448
|
-
var imagesTemp = images;
|
|
1449
1471
|
var values = images.values;
|
|
1450
1472
|
var imgsInBack = [];
|
|
1451
1473
|
selectedImages.forEach(function (selectedImg) {
|
|
@@ -1454,12 +1476,13 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1454
1476
|
var imgsLeft = values.filter(function (value) {
|
|
1455
1477
|
return selectedImages.indexOf(value) === -1;
|
|
1456
1478
|
});
|
|
1457
|
-
imagesTemp.values = imgsLeft;
|
|
1458
1479
|
|
|
1459
1480
|
if (imgsInBack.length > 0) {
|
|
1481
|
+
var _product$article4;
|
|
1482
|
+
|
|
1460
1483
|
var data = {
|
|
1461
|
-
articleId: product.article.id_article,
|
|
1462
|
-
deleteImages:
|
|
1484
|
+
articleId: (product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article),
|
|
1485
|
+
deleteImages: imgsInBack
|
|
1463
1486
|
};
|
|
1464
1487
|
|
|
1465
1488
|
try {
|
|
@@ -1473,8 +1496,13 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1473
1496
|
}
|
|
1474
1497
|
}
|
|
1475
1498
|
|
|
1476
|
-
|
|
1477
|
-
|
|
1499
|
+
setImages({
|
|
1500
|
+
action: "deleteImage",
|
|
1501
|
+
selectedImages: selectedImages
|
|
1502
|
+
});
|
|
1503
|
+
setTimeout(function () {
|
|
1504
|
+
setLoading(false);
|
|
1505
|
+
}, 500);
|
|
1478
1506
|
setMessage("");
|
|
1479
1507
|
setComponentsArray([]);
|
|
1480
1508
|
};
|
|
@@ -1695,6 +1723,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1695
1723
|
return true;
|
|
1696
1724
|
};
|
|
1697
1725
|
|
|
1726
|
+
(0, _react.useEffect)(function () {
|
|
1727
|
+
setSaving(loading);
|
|
1728
|
+
}, [loading]);
|
|
1698
1729
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
1699
1730
|
headerTop: headerTop,
|
|
1700
1731
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
@@ -1808,15 +1839,15 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1808
1839
|
onClickSave: function onClickSave() {
|
|
1809
1840
|
switch (activeTab) {
|
|
1810
1841
|
case "Descripción":
|
|
1811
|
-
saveDescriptions();
|
|
1842
|
+
!saving && saveDescriptions();
|
|
1812
1843
|
break;
|
|
1813
1844
|
|
|
1814
1845
|
case "Ficha técnica":
|
|
1815
|
-
saveDatasheets();
|
|
1846
|
+
!saving && saveDatasheets();
|
|
1816
1847
|
break;
|
|
1817
1848
|
|
|
1818
1849
|
case "Imágenes":
|
|
1819
|
-
updateImages();
|
|
1850
|
+
!saving && updateImages();
|
|
1820
1851
|
break;
|
|
1821
1852
|
|
|
1822
1853
|
default:
|
|
@@ -1826,7 +1857,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1826
1857
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
1827
1858
|
className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
|
|
1828
1859
|
children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1829
|
-
children: [!imageLayout && activeTab === "Imágenes" &&
|
|
1860
|
+
children: [!imageLayout && activeTab === "Imágenes" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
|
|
1830
1861
|
setSelectedImages: setSelectedImages,
|
|
1831
1862
|
checkAll: checkAll,
|
|
1832
1863
|
setCheckAll: setCheckAll
|