contentoh-components-library 21.1.88 → 21.1.91
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/InputFormatter/index.js +4 -3
- package/dist/components/atoms/Select/index.js +1 -1
- package/dist/components/molecules/TableHeader/index.js +6 -2
- package/dist/components/organisms/ImageDataTable/index.js +6 -2
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +120 -71
- package/dist/components/pages/ProviderProductEdition/index.js +61 -7
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +30 -30
- package/dist/components/pages/RetailerProductEdition/index.js +61 -11
- package/package.json +1 -1
- package/src/components/atoms/InputFormatter/index.js +4 -7
- package/src/components/atoms/Select/index.js +1 -1
- package/src/components/molecules/TableHeader/index.js +4 -0
- package/src/components/organisms/ImageDataTable/index.js +4 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +144 -87
- package/src/components/pages/ProviderProductEdition/index.js +46 -5
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +30 -31
- package/src/components/pages/RetailerProductEdition/index.js +40 -4
|
@@ -13,10 +13,10 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
13
13
|
|
|
14
14
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
15
15
|
|
|
16
|
-
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
17
|
-
|
|
18
16
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
19
17
|
|
|
18
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
19
|
+
|
|
20
20
|
var _styles = require("./styles");
|
|
21
21
|
|
|
22
22
|
var _HeaderTop = require("../../molecules/HeaderTop");
|
|
@@ -82,12 +82,27 @@ var _CreateVersion = require("../../organisms/CreateVersion");
|
|
|
82
82
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
83
83
|
|
|
84
84
|
var reducerImages = function reducerImages(state, action) {
|
|
85
|
+
var _action$init, _action$init$inputsBy;
|
|
86
|
+
|
|
85
87
|
var values = state.values,
|
|
86
|
-
attrForImgs = state.attrForImgs
|
|
88
|
+
attrForImgs = state.attrForImgs,
|
|
89
|
+
inputsByRetailer = state.inputsByRetailer;
|
|
87
90
|
|
|
88
91
|
switch (action.action) {
|
|
89
92
|
case "init":
|
|
90
|
-
|
|
93
|
+
var newInputsByRetailer = {};
|
|
94
|
+
action === null || action === void 0 ? void 0 : (_action$init = action.init) === null || _action$init === void 0 ? void 0 : (_action$init$inputsBy = _action$init.inputsByRetailer) === null || _action$init$inputsBy === void 0 ? void 0 : _action$init$inputsBy.forEach(function (inputs) {
|
|
95
|
+
inputs === null || inputs === void 0 ? void 0 : inputs.forEach(function (input) {
|
|
96
|
+
if (!newInputsByRetailer["".concat(input.id_retailer)]) newInputsByRetailer["".concat(input.id_retailer)] = [];
|
|
97
|
+
newInputsByRetailer["".concat(input.id_retailer)].push(input);
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
inputsByRetailer = newInputsByRetailer;
|
|
101
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, action.init), {}, {
|
|
102
|
+
inputsByRetailer: inputsByRetailer,
|
|
103
|
+
valuesInitial: action.init.values,
|
|
104
|
+
inputsInitial: action.init.inputs
|
|
105
|
+
});
|
|
91
106
|
|
|
92
107
|
case "addImg":
|
|
93
108
|
values = [].concat((0, _toConsumableArray2.default)(values), [action.img]);
|
|
@@ -123,6 +138,32 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
123
138
|
values: values
|
|
124
139
|
});
|
|
125
140
|
|
|
141
|
+
case "orderImages":
|
|
142
|
+
{
|
|
143
|
+
var _inputsByRetailer$act;
|
|
144
|
+
|
|
145
|
+
var _inputsByRetailer = state.inputsByRetailer,
|
|
146
|
+
valuesInitial = state.valuesInitial,
|
|
147
|
+
inputsInitial = state.inputsInitial,
|
|
148
|
+
inputs = state.inputs;
|
|
149
|
+
var orderedImages = [];
|
|
150
|
+
var imageIdArray = [];
|
|
151
|
+
action.retailerId && ((_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
|
|
152
|
+
imageIdArray.push(input.id_image);
|
|
153
|
+
valuesInitial.forEach(function (value) {
|
|
154
|
+
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
155
|
+
});
|
|
156
|
+
}));
|
|
157
|
+
inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
|
|
158
|
+
return imageIdArray.includes(input.id);
|
|
159
|
+
});
|
|
160
|
+
values = orderedImages.length > 0 ? orderedImages : valuesInitial;
|
|
161
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
|
|
162
|
+
values: values,
|
|
163
|
+
inputs: inputs
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
|
|
126
167
|
default:
|
|
127
168
|
return state;
|
|
128
169
|
}
|
|
@@ -663,6 +704,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
663
704
|
setDatasheets([datagroups, inputs]);
|
|
664
705
|
setDescriptions(_descriptions);
|
|
665
706
|
}
|
|
707
|
+
|
|
708
|
+
setImages({
|
|
709
|
+
action: "orderImages",
|
|
710
|
+
retailerId: activeRetailer.id
|
|
711
|
+
});
|
|
666
712
|
}, [activeRetailer, services]);
|
|
667
713
|
|
|
668
714
|
var thumbs = function thumbs() {
|
|
@@ -696,7 +742,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
696
742
|
changeImage: setImages,
|
|
697
743
|
selectedImages: selectedImages,
|
|
698
744
|
setSelectedImages: setSelectedImages
|
|
699
|
-
}, index);
|
|
745
|
+
}, index + "-" + imageType.name);
|
|
700
746
|
});
|
|
701
747
|
};
|
|
702
748
|
|
|
@@ -834,11 +880,13 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
834
880
|
var _images$inputs;
|
|
835
881
|
|
|
836
882
|
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) {
|
|
883
|
+
var _images$values2;
|
|
884
|
+
|
|
837
885
|
return {
|
|
838
886
|
value: e === null || e === void 0 ? void 0 : e.id,
|
|
839
887
|
name: e === null || e === void 0 ? void 0 : e.name,
|
|
840
888
|
required: e === null || e === void 0 ? void 0 : e.required,
|
|
841
|
-
active: images === null || images === void 0 ? void 0 : images.values.some(function (value) {
|
|
889
|
+
active: images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.some(function (value) {
|
|
842
890
|
return (value === null || value === void 0 ? void 0 : value.image_id) === (e === null || e === void 0 ? void 0 : e.id);
|
|
843
891
|
})
|
|
844
892
|
};
|
|
@@ -846,7 +894,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
846
894
|
setSocketType(imageInputs);
|
|
847
895
|
}, [images]);
|
|
848
896
|
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
849
|
-
var _images$
|
|
897
|
+
var _images$values3, _product$article11, _data$articleData, _data$articleData2, _data$updateImages;
|
|
850
898
|
|
|
851
899
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
852
900
|
|
|
@@ -854,7 +902,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
854
902
|
while (1) {
|
|
855
903
|
switch (_context7.prev = _context7.next) {
|
|
856
904
|
case 0:
|
|
857
|
-
imagesList = images === null || images === void 0 ? void 0 : (_images$
|
|
905
|
+
imagesList = images === null || images === void 0 ? void 0 : (_images$values3 = images.values) === null || _images$values3 === void 0 ? void 0 : _images$values3.slice();
|
|
858
906
|
imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
|
|
859
907
|
acc[image === null || image === void 0 ? void 0 : image.image_id] = ++acc[image === null || image === void 0 ? void 0 : image.image_id] || 0;
|
|
860
908
|
return acc;
|
|
@@ -1476,13 +1524,13 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1476
1524
|
}();
|
|
1477
1525
|
|
|
1478
1526
|
var downloadImages = function downloadImages() {
|
|
1479
|
-
var _images$
|
|
1527
|
+
var _images$values4;
|
|
1480
1528
|
|
|
1481
1529
|
selectedImages.length > 0 ? selectedImages.forEach(function (e) {
|
|
1482
1530
|
if (e.id) {
|
|
1483
1531
|
(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));
|
|
1484
1532
|
}
|
|
1485
|
-
}) : images === null || images === void 0 ? void 0 : (_images$
|
|
1533
|
+
}) : images === null || images === void 0 ? void 0 : (_images$values4 = images.values) === null || _images$values4 === void 0 ? void 0 : _images$values4.forEach(function (e) {
|
|
1486
1534
|
if (e.id) {
|
|
1487
1535
|
(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));
|
|
1488
1536
|
}
|
|
@@ -1693,7 +1741,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1693
1741
|
|
|
1694
1742
|
return (product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.images) === 1 && updateImages();
|
|
1695
1743
|
},
|
|
1696
|
-
showSaveButton: auditorAssigned() || userAssigned()
|
|
1744
|
+
showSaveButton: auditorAssigned() || userAssigned(),
|
|
1745
|
+
setShowVersionSelector: setShowVersionSelector,
|
|
1746
|
+
version: version
|
|
1697
1747
|
})]
|
|
1698
1748
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1699
1749
|
className: "product-information",
|
package/package.json
CHANGED
|
@@ -22,10 +22,8 @@ export const InputFormatter = ({
|
|
|
22
22
|
const maxLength = maxChar ? maxChar : 999;
|
|
23
23
|
|
|
24
24
|
const getValue = (value) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
.replace(/&/gm, "&")
|
|
28
|
-
.replace(/ /gm, " ");
|
|
25
|
+
console.log(value);
|
|
26
|
+
let temp = value.replace(/\n/gm, "<br>").replace(/\&(nbsp;|amp;)/gm, " ");
|
|
29
27
|
return temp;
|
|
30
28
|
};
|
|
31
29
|
|
|
@@ -40,8 +38,7 @@ export const InputFormatter = ({
|
|
|
40
38
|
return value
|
|
41
39
|
.replace(/<\/p><p>/gm, "\n")
|
|
42
40
|
.replace(/<\/?br>|<\/?p>/gm, "")
|
|
43
|
-
.replace(
|
|
44
|
-
.replace(/ /gm, " ");
|
|
41
|
+
.replace(/\&(nbsp;|amp;)/gm, " ");
|
|
45
42
|
};
|
|
46
43
|
|
|
47
44
|
const onChange = (valueInput, delta, user, h) => {
|
|
@@ -53,7 +50,7 @@ export const InputFormatter = ({
|
|
|
53
50
|
.replace(/<\/li>/gm, "\n")
|
|
54
51
|
.replace(/<\/p><p>/gm, "\n")
|
|
55
52
|
.replaceAll(/<\/?(?!\/?strong).*?>/gm, "")
|
|
56
|
-
.replace(
|
|
53
|
+
.replace(/\&(nbsp;|amp;)/gm, " ");
|
|
57
54
|
setInputValue(valueInput);
|
|
58
55
|
value = unformattedText;
|
|
59
56
|
} else {
|
|
@@ -7,7 +7,7 @@ export default function Select(props) {
|
|
|
7
7
|
id={props.id}
|
|
8
8
|
width={props.width}
|
|
9
9
|
onChange={props.onChange}
|
|
10
|
-
|
|
10
|
+
value={props.valueSelected ? props.valueSelected : ""}
|
|
11
11
|
className={props.className}
|
|
12
12
|
>
|
|
13
13
|
<option value="" disabled>
|
|
@@ -11,6 +11,8 @@ export const TableHeader = ({
|
|
|
11
11
|
isRetailer,
|
|
12
12
|
onClickSave,
|
|
13
13
|
showSaveButton,
|
|
14
|
+
version,
|
|
15
|
+
setShowVersionSelector,
|
|
14
16
|
}) => {
|
|
15
17
|
return (
|
|
16
18
|
<Container>
|
|
@@ -26,6 +28,8 @@ export const TableHeader = ({
|
|
|
26
28
|
isRetailer={isRetailer}
|
|
27
29
|
onClickSave={onClickSave}
|
|
28
30
|
showSaveButton={showSaveButton}
|
|
31
|
+
version={version}
|
|
32
|
+
setShowVersionSelector={setShowVersionSelector}
|
|
29
33
|
/>
|
|
30
34
|
</Container>
|
|
31
35
|
);
|
|
@@ -16,6 +16,8 @@ export const ImageDataTable = ({
|
|
|
16
16
|
isRetailer,
|
|
17
17
|
onClickSave,
|
|
18
18
|
showSaveButton,
|
|
19
|
+
version,
|
|
20
|
+
setShowVersionSelector,
|
|
19
21
|
}) => {
|
|
20
22
|
return (
|
|
21
23
|
<Container darkMode={darkMode}>
|
|
@@ -27,6 +29,8 @@ export const ImageDataTable = ({
|
|
|
27
29
|
isRetailer={isRetailer}
|
|
28
30
|
showSaveButton={showSaveButton}
|
|
29
31
|
onClickSave={onClickSave}
|
|
32
|
+
version={version}
|
|
33
|
+
setShowVersionSelector={setShowVersionSelector}
|
|
30
34
|
/>
|
|
31
35
|
<Row>
|
|
32
36
|
<ScreenHeader headerType={"table-row-text"} text="Tipo de toma" />
|
|
@@ -16,98 +16,133 @@ ProviderProductEditionDefault.args = {
|
|
|
16
16
|
Imágenes: true,
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
19
|
-
"eyJraWQiOiJEV3owZnNieXg2MXNFcVduN3RCXC81bVhod3ZNbFZIOTgwUnZcL3RjT0lKdEk9IiwiYWxnIjoiUlMyNTYifQ.
|
|
19
|
+
"eyJraWQiOiJEV3owZnNieXg2MXNFcVduN3RCXC81bVhod3ZNbFZIOTgwUnZcL3RjT0lKdEk9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJhYmUxODhlMi0yNWIxLTRhMTktODY3Mi0wZDRiYzExYTliZjIiLCJjb2duaXRvOmdyb3VwcyI6WyJ1c3VhcmlvX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfbFN6UVo0WjdSIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjpmYWxzZSwiY29nbml0bzp1c2VybmFtZSI6ImFiZTE4OGUyLTI1YjEtNGExOS04NjcyLTBkNGJjMTFhOWJmMiIsImF1ZCI6IjUyZDlza2tkY2c4cWpwODhvb2sxdXNlNm1rIiwiZXZlbnRfaWQiOiJiZTE5OWE0ZS1lYTYwLTQwYTktODIwNC02ODZlOWI1ODczMGQiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1OTUzOTczMiwibmFtZSI6IlJldGFpbGVyIEFjYyIsInBob25lX251bWJlciI6Iis1MjMxMTExMTExMTEiLCJleHAiOjE2NTk1NDMzMzIsImlhdCI6MTY1OTUzOTczMiwiZW1haWwiOiJyZXRhaWxlclRoZEBBbGxGcmVlTWFpbC5uZXQifQ.HSIFFKD5jkoRPzh9uxNUnXkkp6IX7iKeOqRePrzin-XlG7KauuoHvv7M-dWGJB_xRg-C1uGIG7gKOFP7oM3BGuVqrlIzs-z3uKNSBz0raq3-tRUHRMKo30HGwdh9Q8X8F9RAEZ0-lpIoTCoMS4ua6OJVG_qPRGJHVF2_mzAxof81oHHj5tv-SC6lrJYc5UqDj97y_e-rGakVyVV7VXeKAJlnmw4y52_WDlbOq3W2e_wI8NuNiiEBYXgWSm5j_rzB4-BuF3nUNheKpimZEn1wTULHLo-Izj_WPdPS1l5yTi9oF09QZht_Te0o3SZliBPKgVcH8cycReoACukbY2BPPQ",
|
|
20
20
|
articleId: 238,
|
|
21
21
|
category: 846,
|
|
22
22
|
version: 2,
|
|
23
23
|
productSelected: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
categoryName:
|
|
31
|
-
"Salud y Belleza|Cuidado Facial|Cremas, Mascarillas y Tratamientos",
|
|
32
|
-
asignations: [],
|
|
24
|
+
orderId: 1936,
|
|
25
|
+
article_status: "AP",
|
|
26
|
+
datasheet_status: "NS",
|
|
27
|
+
description_status: "NS",
|
|
28
|
+
images_status: "AP",
|
|
29
|
+
prio: "none",
|
|
33
30
|
version: 3,
|
|
34
|
-
|
|
31
|
+
brand: null,
|
|
32
|
+
article: {
|
|
33
|
+
category: "Herramientas|Herramientas Manuales|Espátulas y Llanas",
|
|
34
|
+
company_name: "TRUPER SA DE CV",
|
|
35
|
+
id_company: 301,
|
|
36
|
+
country: null,
|
|
37
|
+
id_category: "2125",
|
|
38
|
+
id_article: 28099,
|
|
39
|
+
name: 'Espátula flexible, mango de madera, 6"',
|
|
40
|
+
upc: "90364",
|
|
41
|
+
},
|
|
42
|
+
retailers: [
|
|
43
|
+
{
|
|
44
|
+
id: 58,
|
|
45
|
+
name: "The Home Depot Golden",
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
id: 59,
|
|
49
|
+
name: "The Home Depot Platinum",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
services: {
|
|
53
|
+
datasheets: 0,
|
|
54
|
+
descriptions: 0,
|
|
55
|
+
images: 1,
|
|
56
|
+
},
|
|
57
|
+
statusByRetailer: {
|
|
58
|
+
59: {
|
|
59
|
+
images: "AP",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
retailersWithService: ["59"],
|
|
63
|
+
checked: false,
|
|
64
|
+
id_article: 28099,
|
|
35
65
|
retailersAvailable: [
|
|
36
66
|
{
|
|
37
|
-
id:
|
|
38
|
-
name: "
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
67
|
+
id: 58,
|
|
68
|
+
name: "The Home Depot Golden",
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 59,
|
|
72
|
+
name: "The Home Depot Platinum",
|
|
42
73
|
},
|
|
43
74
|
],
|
|
44
|
-
missing: {},
|
|
45
75
|
},
|
|
46
76
|
productToEdit: {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
product:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
77
|
+
ArticleId: 28099,
|
|
78
|
+
idCategory: "2125",
|
|
79
|
+
product: {
|
|
80
|
+
orderId: 1936,
|
|
81
|
+
article_status: "AP",
|
|
82
|
+
datasheet_status: "NS",
|
|
83
|
+
description_status: "NS",
|
|
84
|
+
images_status: "AP",
|
|
85
|
+
prio: "none",
|
|
86
|
+
version: 3,
|
|
87
|
+
brand: null,
|
|
88
|
+
article: {
|
|
89
|
+
category: "Herramientas|Herramientas Manuales|Espátulas y Llanas",
|
|
90
|
+
company_name: "TRUPER SA DE CV",
|
|
91
|
+
id_company: 301,
|
|
92
|
+
country: null,
|
|
93
|
+
id_category: "2125",
|
|
94
|
+
id_article: 28099,
|
|
95
|
+
name: 'Espátula flexible, mango de madera, 6"',
|
|
96
|
+
upc: "90364",
|
|
97
|
+
},
|
|
98
|
+
retailers: [
|
|
99
|
+
{
|
|
100
|
+
id: 58,
|
|
101
|
+
name: "The Home Depot Golden",
|
|
64
102
|
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
id_category: "2999",
|
|
69
|
-
id_article: 69031,
|
|
70
|
-
name: "RESIZING",
|
|
71
|
-
timestamp: "2022-06-23T15:53:54.000Z",
|
|
72
|
-
upc: "130994",
|
|
103
|
+
{
|
|
104
|
+
id: 59,
|
|
105
|
+
name: "The Home Depot Platinum",
|
|
73
106
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
images: 1,
|
|
107
|
+
],
|
|
108
|
+
services: {
|
|
109
|
+
datasheets: 0,
|
|
110
|
+
descriptions: 0,
|
|
111
|
+
images: 1,
|
|
112
|
+
},
|
|
113
|
+
statusByRetailer: {
|
|
114
|
+
59: {
|
|
115
|
+
images: "AP",
|
|
84
116
|
},
|
|
85
|
-
checked: false,
|
|
86
|
-
retailersAvailable: [
|
|
87
|
-
{
|
|
88
|
-
id: 60,
|
|
89
|
-
name: "The Home Depot Resizing",
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
id_article: 69031,
|
|
93
|
-
categoryName: "RESIZING|RESIZING|RESIZING",
|
|
94
|
-
version_status: "AC",
|
|
95
117
|
},
|
|
96
|
-
|
|
118
|
+
retailersWithService: ["59"],
|
|
119
|
+
checked: false,
|
|
120
|
+
id_article: 28099,
|
|
121
|
+
retailersAvailable: [
|
|
122
|
+
{
|
|
123
|
+
id: 58,
|
|
124
|
+
name: "The Home Depot Golden",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: 59,
|
|
128
|
+
name: "The Home Depot Platinum",
|
|
129
|
+
},
|
|
130
|
+
],
|
|
131
|
+
},
|
|
97
132
|
},
|
|
98
133
|
location: {
|
|
99
134
|
state: { origin: "Contentoh" },
|
|
100
135
|
},
|
|
101
136
|
user: {
|
|
102
|
-
id_user:
|
|
103
|
-
name: "
|
|
104
|
-
last_name: "
|
|
105
|
-
email: "
|
|
106
|
-
position: "
|
|
107
|
-
telephone: "+
|
|
137
|
+
id_user: 1237,
|
|
138
|
+
name: "The Home",
|
|
139
|
+
last_name: "Depot",
|
|
140
|
+
email: "retailerThd@AllFreeMail.net",
|
|
141
|
+
position: "Retailer",
|
|
142
|
+
telephone: "+523111111111",
|
|
108
143
|
country: "México",
|
|
109
|
-
id_company:
|
|
110
|
-
id_cognito: "
|
|
144
|
+
id_company: 817,
|
|
145
|
+
id_cognito: "abe188e2-25b1-4a19-8672-0d4bc11a9bf2",
|
|
111
146
|
birth_Date: null,
|
|
112
147
|
about_me: null,
|
|
113
148
|
zip_code: null,
|
|
@@ -116,12 +151,12 @@ ProviderProductEditionDefault.args = {
|
|
|
116
151
|
id_stripe: null,
|
|
117
152
|
id_role: 0,
|
|
118
153
|
active: 1,
|
|
119
|
-
is_retailer:
|
|
154
|
+
is_retailer: 1,
|
|
120
155
|
email_notify: 1,
|
|
121
156
|
membership: {
|
|
122
|
-
id:
|
|
123
|
-
start_date: "2022-06-
|
|
124
|
-
end_date: "2023-06-
|
|
157
|
+
id: 798,
|
|
158
|
+
start_date: "2022-06-19T04:25:07.000Z",
|
|
159
|
+
end_date: "2023-06-19T04:25:07.000Z",
|
|
125
160
|
planID: 6,
|
|
126
161
|
plan: "prod_KvGd6YSTJyR3AP",
|
|
127
162
|
name: "Plan Small",
|
|
@@ -129,20 +164,42 @@ ProviderProductEditionDefault.args = {
|
|
|
129
164
|
products_limit: "1000",
|
|
130
165
|
type: "Enterprise",
|
|
131
166
|
},
|
|
132
|
-
src: "https://content-management-profile-prod.s3.amazonaws.com/id-
|
|
167
|
+
src: "https://content-management-profile-prod.s3.amazonaws.com/id-1237/1237.png?1659539733360",
|
|
133
168
|
},
|
|
134
169
|
company: {
|
|
135
|
-
id_company:
|
|
136
|
-
trade_name: "
|
|
137
|
-
company_name: "
|
|
138
|
-
rfc:
|
|
139
|
-
adress: "",
|
|
140
|
-
about_company:
|
|
141
|
-
telephone:
|
|
142
|
-
web_site:
|
|
143
|
-
zip_code:
|
|
170
|
+
id_company: 817,
|
|
171
|
+
trade_name: "Retailer acc",
|
|
172
|
+
company_name: "Retailer acc",
|
|
173
|
+
rfc: "ASER12345",
|
|
174
|
+
adress: "Av. Insurgentes",
|
|
175
|
+
about_company: null,
|
|
176
|
+
telephone: null,
|
|
177
|
+
web_site: null,
|
|
178
|
+
zip_code: null,
|
|
144
179
|
email: null,
|
|
145
|
-
social_link:
|
|
146
|
-
is_retailer:
|
|
180
|
+
social_link: null,
|
|
181
|
+
is_retailer: 1,
|
|
182
|
+
retailers: [
|
|
183
|
+
{
|
|
184
|
+
id: 58,
|
|
185
|
+
name: "The Home Depot Golden",
|
|
186
|
+
country: "México",
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
id: 59,
|
|
190
|
+
name: "The Home Depot Platinum",
|
|
191
|
+
country: "México",
|
|
192
|
+
},
|
|
193
|
+
{
|
|
194
|
+
id: 60,
|
|
195
|
+
name: "The Home Depot Resizing",
|
|
196
|
+
country: "México",
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
id: 61,
|
|
200
|
+
name: "Home Depot TAB",
|
|
201
|
+
country: "México",
|
|
202
|
+
},
|
|
203
|
+
],
|
|
147
204
|
},
|
|
148
205
|
};
|
|
@@ -45,10 +45,24 @@ import { useCloseModal } from "../../../global-files/customHooks";
|
|
|
45
45
|
import { CreateVersion } from "../../organisms/CreateVersion";
|
|
46
46
|
|
|
47
47
|
const reducerImages = (state, action) => {
|
|
48
|
-
let { values, attrForImgs } = state;
|
|
48
|
+
let { values, attrForImgs, inputsByRetailer } = state;
|
|
49
49
|
switch (action.action) {
|
|
50
50
|
case "init":
|
|
51
|
-
|
|
51
|
+
const newInputsByRetailer = {};
|
|
52
|
+
action?.init?.inputsByRetailer?.forEach((inputs) => {
|
|
53
|
+
inputs?.forEach((input) => {
|
|
54
|
+
if (!newInputsByRetailer[`${input.id_retailer}`])
|
|
55
|
+
newInputsByRetailer[`${input.id_retailer}`] = [];
|
|
56
|
+
newInputsByRetailer[`${input.id_retailer}`].push(input);
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
inputsByRetailer = newInputsByRetailer;
|
|
60
|
+
return {
|
|
61
|
+
...action.init,
|
|
62
|
+
inputsByRetailer,
|
|
63
|
+
valuesInitial: action.init.values,
|
|
64
|
+
inputsInitial: action.init.inputs,
|
|
65
|
+
};
|
|
52
66
|
case "addImg":
|
|
53
67
|
values = [...values, action.img];
|
|
54
68
|
return { ...state, values };
|
|
@@ -56,18 +70,40 @@ const reducerImages = (state, action) => {
|
|
|
56
70
|
values[action.index][action.attribute] = action.value;
|
|
57
71
|
return { ...state, values };
|
|
58
72
|
case "changeAttrValue":
|
|
59
|
-
attrForImgs
|
|
73
|
+
const index = attrForImgs.general.findIndex((f) => (f.id = action.id));
|
|
74
|
+
if (index !== -1) {
|
|
75
|
+
attrForImgs.general[index].value = action.value;
|
|
76
|
+
}
|
|
77
|
+
|
|
60
78
|
return { ...state, attrForImgs, values };
|
|
61
79
|
case "deleteImage":
|
|
62
80
|
values = values.filter(
|
|
63
81
|
(value) => action.selectedImages.indexOf(value) === -1
|
|
64
82
|
);
|
|
65
83
|
return { ...state, values };
|
|
84
|
+
case "orderImages": {
|
|
85
|
+
let { inputsByRetailer, valuesInitial, inputsInitial, inputs } = state;
|
|
86
|
+
const orderedImages = [];
|
|
87
|
+
const imageIdArray = [];
|
|
88
|
+
action.retailerId &&
|
|
89
|
+
inputsByRetailer[action.retailerId]?.filter((input) => {
|
|
90
|
+
imageIdArray.push(input.id_image);
|
|
91
|
+
valuesInitial.forEach((value) => {
|
|
92
|
+
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
inputs = inputsInitial?.filter((input) =>
|
|
97
|
+
imageIdArray.includes(input.id)
|
|
98
|
+
);
|
|
99
|
+
|
|
100
|
+
values = orderedImages.length > 0 ? orderedImages : valuesInitial;
|
|
101
|
+
return { ...state, values, inputs };
|
|
102
|
+
}
|
|
66
103
|
default:
|
|
67
104
|
return state;
|
|
68
105
|
}
|
|
69
106
|
};
|
|
70
|
-
|
|
71
107
|
const S3_BUCKET = process.env.REACT_APP_IMAGES_BUCKET;
|
|
72
108
|
const REGION = "us-east-1";
|
|
73
109
|
|
|
@@ -355,6 +391,7 @@ export const ProviderProductEdition = ({
|
|
|
355
391
|
|
|
356
392
|
useEffect(() => {
|
|
357
393
|
loadInputs();
|
|
394
|
+
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
358
395
|
}, [servicesData, activeRetailer, services]);
|
|
359
396
|
|
|
360
397
|
const thumbs = () => {
|
|
@@ -1041,6 +1078,8 @@ export const ProviderProductEdition = ({
|
|
|
1041
1078
|
onClickSave={() =>
|
|
1042
1079
|
product?.services?.images === 1 && updateImages()
|
|
1043
1080
|
}
|
|
1081
|
+
setShowVersionSelector={setShowVersionSelector}
|
|
1082
|
+
version={version}
|
|
1044
1083
|
/>
|
|
1045
1084
|
</div>
|
|
1046
1085
|
<div className="product-information">
|
|
@@ -1170,7 +1209,9 @@ export const ProviderProductEdition = ({
|
|
|
1170
1209
|
<FullTabsMenu
|
|
1171
1210
|
tabsSections={tabsSections}
|
|
1172
1211
|
status={
|
|
1173
|
-
activeRetailer
|
|
1212
|
+
activeRetailer?.id &&
|
|
1213
|
+
retailerStatus &&
|
|
1214
|
+
retailerStatus[activeRetailer.id]
|
|
1174
1215
|
? retailerStatus[activeRetailer?.id][getConcept(activeTab)] ||
|
|
1175
1216
|
"NS"
|
|
1176
1217
|
: "-"
|