contentoh-components-library 21.1.86 → 21.1.89
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 +1 -1
- package/dist/components/atoms/Select/index.js +1 -1
- package/dist/components/atoms/Status/index.js +1 -1
- package/dist/components/molecules/StatusAsignationInfo/index.js +0 -1
- package/dist/components/molecules/TableHeader/index.js +6 -2
- package/dist/components/organisms/ImageDataTable/index.js +6 -2
- package/dist/components/pages/ProviderProductEdition/index.js +61 -7
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +58 -25
- package/dist/components/pages/RetailerProductEdition/index.js +61 -11
- package/dist/global-files/data.js +1 -0
- package/package.json +1 -1
- package/src/components/atoms/AsignationOption/index.js +1 -1
- package/src/components/atoms/Select/index.js +1 -1
- package/src/components/atoms/Status/index.js +1 -1
- package/src/components/molecules/StatusAsignationInfo/index.js +0 -1
- package/src/components/molecules/TableHeader/index.js +4 -0
- package/src/components/organisms/ImageDataTable/index.js +4 -0
- package/src/components/pages/ProviderProductEdition/index.js +44 -5
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +70 -25
- package/src/components/pages/RetailerProductEdition/index.js +40 -4
- package/src/global-files/data.js +1 -0
|
@@ -21,7 +21,7 @@ var _availableIcon = _interopRequireDefault(require("../../../assets/images/asig
|
|
|
21
21
|
|
|
22
22
|
var _data = require("../../../global-files/data");
|
|
23
23
|
|
|
24
|
-
var _Status = require("
|
|
24
|
+
var _Status = require("../../atoms/Status");
|
|
25
25
|
|
|
26
26
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
27
27
|
|
|
@@ -16,7 +16,7 @@ function Select(props) {
|
|
|
16
16
|
id: props.id,
|
|
17
17
|
width: props.width,
|
|
18
18
|
onChange: props.onChange,
|
|
19
|
-
|
|
19
|
+
value: props.valueSelected ? props.valueSelected : "",
|
|
20
20
|
className: props.className,
|
|
21
21
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
22
22
|
value: "",
|
|
@@ -15,7 +15,7 @@ var Status = function Status(_ref) {
|
|
|
15
15
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
|
|
16
16
|
className: "status-".concat(statusType === null || statusType === void 0 ? void 0 : statusType.replace(/\/.*/, ""), " ").concat(ovalForm && "oval-form"),
|
|
17
17
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
18
|
-
children: statusType !== null && statusType !== void 0 ? statusType :
|
|
18
|
+
children: statusType !== null && statusType !== void 0 ? statusType : "NS"
|
|
19
19
|
})
|
|
20
20
|
});
|
|
21
21
|
};
|
|
@@ -149,7 +149,6 @@ var StatusAsignationInfo = function StatusAsignationInfo(_ref) {
|
|
|
149
149
|
onClick: function onClick(e) {
|
|
150
150
|
e.preventDefault();
|
|
151
151
|
e.stopPropagation();
|
|
152
|
-
console.log(e.target);
|
|
153
152
|
setShowAsignationPanel(true);
|
|
154
153
|
setAssignationType(assignation === null || assignation === void 0 ? void 0 : assignation.collaboratorType);
|
|
155
154
|
}
|
|
@@ -22,7 +22,9 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
22
22
|
setAssignation = _ref.setAssignation,
|
|
23
23
|
isRetailer = _ref.isRetailer,
|
|
24
24
|
onClickSave = _ref.onClickSave,
|
|
25
|
-
showSaveButton = _ref.showSaveButton
|
|
25
|
+
showSaveButton = _ref.showSaveButton,
|
|
26
|
+
version = _ref.version,
|
|
27
|
+
setShowVersionSelector = _ref.setShowVersionSelector;
|
|
26
28
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
27
29
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
28
30
|
text: (activeImage === null || activeImage === void 0 ? void 0 : activeImage.name) || "-",
|
|
@@ -34,7 +36,9 @@ var TableHeader = function TableHeader(_ref) {
|
|
|
34
36
|
setAssignation: setAssignation,
|
|
35
37
|
isRetailer: isRetailer,
|
|
36
38
|
onClickSave: onClickSave,
|
|
37
|
-
showSaveButton: showSaveButton
|
|
39
|
+
showSaveButton: showSaveButton,
|
|
40
|
+
version: version,
|
|
41
|
+
setShowVersionSelector: setShowVersionSelector
|
|
38
42
|
})]
|
|
39
43
|
});
|
|
40
44
|
};
|
|
@@ -32,7 +32,9 @@ var ImageDataTable = function ImageDataTable(_ref) {
|
|
|
32
32
|
setAssignation = _ref.setAssignation,
|
|
33
33
|
isRetailer = _ref.isRetailer,
|
|
34
34
|
onClickSave = _ref.onClickSave,
|
|
35
|
-
showSaveButton = _ref.showSaveButton
|
|
35
|
+
showSaveButton = _ref.showSaveButton,
|
|
36
|
+
version = _ref.version,
|
|
37
|
+
setShowVersionSelector = _ref.setShowVersionSelector;
|
|
36
38
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
37
39
|
darkMode: darkMode,
|
|
38
40
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TableHeader.TableHeader, {
|
|
@@ -42,7 +44,9 @@ var ImageDataTable = function ImageDataTable(_ref) {
|
|
|
42
44
|
setAssignation: setAssignation,
|
|
43
45
|
isRetailer: isRetailer,
|
|
44
46
|
showSaveButton: showSaveButton,
|
|
45
|
-
onClickSave: onClickSave
|
|
47
|
+
onClickSave: onClickSave,
|
|
48
|
+
version: version,
|
|
49
|
+
setShowVersionSelector: setShowVersionSelector
|
|
46
50
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles2.Container, {
|
|
47
51
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
48
52
|
headerType: "table-row-text",
|
|
@@ -15,10 +15,10 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
|
|
|
15
15
|
|
|
16
16
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
17
17
|
|
|
18
|
-
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
19
|
-
|
|
20
18
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
21
19
|
|
|
20
|
+
var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
21
|
+
|
|
22
22
|
var _styles = require("./styles");
|
|
23
23
|
|
|
24
24
|
var _HeaderTop = require("../../molecules/HeaderTop");
|
|
@@ -104,12 +104,27 @@ var _CreateVersion = require("../../organisms/CreateVersion");
|
|
|
104
104
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
105
105
|
|
|
106
106
|
var reducerImages = function reducerImages(state, action) {
|
|
107
|
+
var _action$init, _action$init$inputsBy;
|
|
108
|
+
|
|
107
109
|
var values = state.values,
|
|
108
|
-
attrForImgs = state.attrForImgs
|
|
110
|
+
attrForImgs = state.attrForImgs,
|
|
111
|
+
inputsByRetailer = state.inputsByRetailer;
|
|
109
112
|
|
|
110
113
|
switch (action.action) {
|
|
111
114
|
case "init":
|
|
112
|
-
|
|
115
|
+
var newInputsByRetailer = {};
|
|
116
|
+
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) {
|
|
117
|
+
inputs === null || inputs === void 0 ? void 0 : inputs.forEach(function (input) {
|
|
118
|
+
if (!newInputsByRetailer["".concat(input.id_retailer)]) newInputsByRetailer["".concat(input.id_retailer)] = [];
|
|
119
|
+
newInputsByRetailer["".concat(input.id_retailer)].push(input);
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
inputsByRetailer = newInputsByRetailer;
|
|
123
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, action.init), {}, {
|
|
124
|
+
inputsByRetailer: inputsByRetailer,
|
|
125
|
+
valuesInitial: action.init.values,
|
|
126
|
+
inputsInitial: action.init.inputs
|
|
127
|
+
});
|
|
113
128
|
|
|
114
129
|
case "addImg":
|
|
115
130
|
values = [].concat((0, _toConsumableArray2.default)(values), [action.img]);
|
|
@@ -124,7 +139,14 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
124
139
|
});
|
|
125
140
|
|
|
126
141
|
case "changeAttrValue":
|
|
127
|
-
attrForImgs
|
|
142
|
+
var index = attrForImgs.general.findIndex(function (f) {
|
|
143
|
+
return f.id = action.id;
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
if (index !== -1) {
|
|
147
|
+
attrForImgs.general[index].value = action.value;
|
|
148
|
+
}
|
|
149
|
+
|
|
128
150
|
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
|
|
129
151
|
attrForImgs: attrForImgs,
|
|
130
152
|
values: values
|
|
@@ -138,6 +160,32 @@ var reducerImages = function reducerImages(state, action) {
|
|
|
138
160
|
values: values
|
|
139
161
|
});
|
|
140
162
|
|
|
163
|
+
case "orderImages":
|
|
164
|
+
{
|
|
165
|
+
var _inputsByRetailer$act;
|
|
166
|
+
|
|
167
|
+
var _inputsByRetailer = state.inputsByRetailer,
|
|
168
|
+
valuesInitial = state.valuesInitial,
|
|
169
|
+
inputsInitial = state.inputsInitial,
|
|
170
|
+
inputs = state.inputs;
|
|
171
|
+
var orderedImages = [];
|
|
172
|
+
var imageIdArray = [];
|
|
173
|
+
action.retailerId && ((_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
|
|
174
|
+
imageIdArray.push(input.id_image);
|
|
175
|
+
valuesInitial.forEach(function (value) {
|
|
176
|
+
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
177
|
+
});
|
|
178
|
+
}));
|
|
179
|
+
inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
|
|
180
|
+
return imageIdArray.includes(input.id);
|
|
181
|
+
});
|
|
182
|
+
values = orderedImages.length > 0 ? orderedImages : valuesInitial;
|
|
183
|
+
return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
|
|
184
|
+
values: values,
|
|
185
|
+
inputs: inputs
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
|
|
141
189
|
default:
|
|
142
190
|
return state;
|
|
143
191
|
}
|
|
@@ -692,6 +740,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
692
740
|
|
|
693
741
|
(0, _react.useEffect)(function () {
|
|
694
742
|
loadInputs();
|
|
743
|
+
setImages({
|
|
744
|
+
action: "orderImages",
|
|
745
|
+
retailerId: activeRetailer.id
|
|
746
|
+
});
|
|
695
747
|
}, [servicesData, activeRetailer, services]);
|
|
696
748
|
|
|
697
749
|
var thumbs = function thumbs() {
|
|
@@ -1636,7 +1688,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1636
1688
|
var _product$services;
|
|
1637
1689
|
|
|
1638
1690
|
return (product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.images) === 1 && updateImages();
|
|
1639
|
-
}
|
|
1691
|
+
},
|
|
1692
|
+
setShowVersionSelector: setShowVersionSelector,
|
|
1693
|
+
version: version
|
|
1640
1694
|
})]
|
|
1641
1695
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
1642
1696
|
className: "product-information",
|
|
@@ -1766,7 +1820,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
1766
1820
|
}
|
|
1767
1821
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_FullTabsMenu.FullTabsMenu, {
|
|
1768
1822
|
tabsSections: tabsSections,
|
|
1769
|
-
status: activeRetailer.id ? retailerStatus[activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id][getConcept(activeTab)] || "NS" : "-",
|
|
1823
|
+
status: activeRetailer.id && retailerStatus ? retailerStatus[activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id][getConcept(activeTab)] || "NS" : "-",
|
|
1770
1824
|
activeTab: activeTab,
|
|
1771
1825
|
setActiveTab: setActiveTab,
|
|
1772
1826
|
setImageLayout: setImageLayout,
|
|
@@ -31,33 +31,33 @@ RetailerProductEditionDefault.args = {
|
|
|
31
31
|
"Ficha técnica": false,
|
|
32
32
|
Imágenes: false
|
|
33
33
|
},
|
|
34
|
-
token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
34
|
+
token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJjOTRhNzMwNS05MzY1LTQ2ZmYtYTQyMy00YjRiYzNiOGIxODAiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjp0cnVlLCJjb2duaXRvOnVzZXJuYW1lIjoiYzk0YTczMDUtOTM2NS00NmZmLWE0MjMtNGI0YmMzYjhiMTgwIiwiY29nbml0bzpyb2xlcyI6WyJhcm46YXdzOmlhbTo6ODk4NjcwMjMyODA3OnJvbGVcL2NvbnRlbnRvaC1kZXYtdXMtZWFzdC0xLWxhbWJkYVJvbGUiXSwiYXVkIjoiNWFjOHRwZ3M2Z2JzcTEzZnJ2cnBpZWVwNDAiLCJldmVudF9pZCI6IjFmODVjYTI2LTFiZTItNGRmOC04ZDVlLWNkYzdlYzhhNWY5MyIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjU5NDk3MDMyLCJuYW1lIjoiQ29sYWJvcmFkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIxMTExIiwiZXhwIjoxNjU5NTAwNjMyLCJpYXQiOjE2NTk0OTcwMzIsImVtYWlsIjoic2FsbWVyb24uNUBob3RtYWlsLmNvbSJ9.YMnbVYuC12JcOT0E1FRioMGyUol_eyu9RCfwa0fwB-K9oGTkrOSLbz8jK4sNI4QRgkr5eGqwF2KASmo1DGxOUwgV2s_-BM_tJpKHEcVuQ7z0X46C5EPahSxNPLuzs22WUnf97uoGYj9IrToWfoxV_6zi1Z1jshXwZ-1Kc9zeZvlFnyGeVyLS6uavMxcD06KNLKdWenQVFGcj6LZRjB-Oy-APMF29M1oggGqrsVdY3N8E9otUkws2yYA35dpHd1zHZNEbsX6cgOemGxog7h2f6NQmNXPrnmH4ZQTLS8sLtD_UOEu9_HAdsXLZizBDKQ95cC6be2p4w_sXj22AUw5BKg",
|
|
35
35
|
productSelected: {
|
|
36
36
|
services: {
|
|
37
|
-
datasheets:
|
|
38
|
-
descriptions:
|
|
37
|
+
datasheets: 0,
|
|
38
|
+
descriptions: 0,
|
|
39
39
|
images: 1
|
|
40
40
|
},
|
|
41
|
-
orderId:
|
|
41
|
+
orderId: 82,
|
|
42
42
|
status: "AA",
|
|
43
|
-
datasheet_status: "
|
|
43
|
+
datasheet_status: "NS",
|
|
44
44
|
prio: "none",
|
|
45
45
|
version: 2,
|
|
46
|
-
description_status: "
|
|
46
|
+
description_status: "NS",
|
|
47
47
|
images_status: "AA",
|
|
48
48
|
article: {
|
|
49
|
-
id_article:
|
|
50
|
-
id_category: "
|
|
51
|
-
name: "
|
|
52
|
-
upc: "
|
|
53
|
-
timestamp: "2022-
|
|
54
|
-
id_user:
|
|
49
|
+
id_article: 55147,
|
|
50
|
+
id_category: "157",
|
|
51
|
+
name: "Lavatrastes Axion ",
|
|
52
|
+
upc: "977358",
|
|
53
|
+
timestamp: "2022-06-21T17:37:05.000Z",
|
|
54
|
+
id_user: 28,
|
|
55
55
|
status: "NULL",
|
|
56
56
|
active: 1,
|
|
57
|
-
company_id:
|
|
58
|
-
company_name: "
|
|
57
|
+
company_id: 1,
|
|
58
|
+
company_name: "COMPANY DEV",
|
|
59
59
|
country: "México",
|
|
60
|
-
id_order:
|
|
60
|
+
id_order: 82,
|
|
61
61
|
id_datasheet_especialist: 54,
|
|
62
62
|
id_datasheet_facilitator: 52,
|
|
63
63
|
id_description_especialist: 54,
|
|
@@ -66,17 +66,50 @@ RetailerProductEditionDefault.args = {
|
|
|
66
66
|
id_images_facilitator: 53,
|
|
67
67
|
id_auditor: 30,
|
|
68
68
|
id_recepcionist: null,
|
|
69
|
-
category: "
|
|
69
|
+
category: "Consumibles|Productos de Limpieza y Lavandería|Jabones y Lavatrastes",
|
|
70
70
|
missingAttributes: 0,
|
|
71
71
|
missingDescriptions: 0,
|
|
72
72
|
missingImages: 0
|
|
73
73
|
},
|
|
74
74
|
retailers: [{
|
|
75
|
+
id: 3,
|
|
76
|
+
name: "Sam´s Club"
|
|
77
|
+
}, {
|
|
78
|
+
id: 4,
|
|
79
|
+
name: "Walmart Super y Superama"
|
|
80
|
+
}, {
|
|
81
|
+
id: 5,
|
|
82
|
+
name: "Chedraui"
|
|
83
|
+
}, {
|
|
84
|
+
id: 6,
|
|
85
|
+
name: "HEB"
|
|
86
|
+
}, {
|
|
87
|
+
id: 12,
|
|
88
|
+
name: "La Comer"
|
|
89
|
+
}, {
|
|
75
90
|
id: 13,
|
|
76
91
|
name: "Soriana"
|
|
92
|
+
}, {
|
|
93
|
+
id: 17,
|
|
94
|
+
name: "Genérico"
|
|
95
|
+
}, {
|
|
96
|
+
id: 20,
|
|
97
|
+
name: "Cornershop"
|
|
98
|
+
}, {
|
|
99
|
+
id: 26,
|
|
100
|
+
name: "Mercado Libre"
|
|
101
|
+
}, {
|
|
102
|
+
id: 34,
|
|
103
|
+
name: "San Pablo"
|
|
104
|
+
}, {
|
|
105
|
+
id: 38,
|
|
106
|
+
name: "Del Sol"
|
|
107
|
+
}, {
|
|
108
|
+
id: 64,
|
|
109
|
+
name: "Cali"
|
|
77
110
|
}],
|
|
78
111
|
country: "México",
|
|
79
|
-
upc: "
|
|
112
|
+
upc: "977358"
|
|
80
113
|
},
|
|
81
114
|
location: {
|
|
82
115
|
product: {
|
|
@@ -85,15 +118,15 @@ RetailerProductEditionDefault.args = {
|
|
|
85
118
|
}
|
|
86
119
|
},
|
|
87
120
|
user: {
|
|
88
|
-
id_user:
|
|
89
|
-
name: "
|
|
90
|
-
last_name: "",
|
|
91
|
-
email: "
|
|
92
|
-
position:
|
|
121
|
+
id_user: 30,
|
|
122
|
+
name: "Admin",
|
|
123
|
+
last_name: "Ulises",
|
|
124
|
+
email: "salmeron.5@hotmail.com",
|
|
125
|
+
position: "Admin",
|
|
93
126
|
telephone: null,
|
|
94
|
-
country:
|
|
127
|
+
country: "México",
|
|
95
128
|
id_company: 2,
|
|
96
|
-
id_cognito: "
|
|
129
|
+
id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
|
|
97
130
|
birth_Date: null,
|
|
98
131
|
about_me: null,
|
|
99
132
|
zip_code: null,
|
|
@@ -115,6 +148,6 @@ RetailerProductEditionDefault.args = {
|
|
|
115
148
|
products_limit: "3",
|
|
116
149
|
type: "PyMES"
|
|
117
150
|
},
|
|
118
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
151
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1659497033479"
|
|
119
152
|
}
|
|
120
153
|
};
|
|
@@ -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",
|
|
@@ -280,6 +280,7 @@ var getNewStatus = function getNewStatus(statusArray) {
|
|
|
280
280
|
statusArray.forEach(function (element) {
|
|
281
281
|
return lookupString += element + "/";
|
|
282
282
|
});
|
|
283
|
+
if (lookupString.includes("AS")) return "AS";
|
|
283
284
|
if (lookupString.includes("RCA")) return "RCA";
|
|
284
285
|
if (lookupString.includes("RC")) return "RC";
|
|
285
286
|
if (lookupString.includes("RA")) return "RA";
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@ import requesToProvider from "../../../assets/images/asignationOptions/requestTo
|
|
|
6
6
|
import requestToTeam from "../../../assets/images/asignationOptions/requestToTeam.svg";
|
|
7
7
|
import availableIcon from "../../../assets/images/asignationOptions/availableIcon.svg";
|
|
8
8
|
import { getNewStatus } from "../../../global-files/data";
|
|
9
|
-
import { Status } from "
|
|
9
|
+
import { Status } from "../../atoms/Status";
|
|
10
10
|
|
|
11
11
|
export const AsignationOption = ({
|
|
12
12
|
profileImage,
|
|
@@ -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" />
|
|
@@ -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,7 @@ export const ProviderProductEdition = ({
|
|
|
1170
1209
|
<FullTabsMenu
|
|
1171
1210
|
tabsSections={tabsSections}
|
|
1172
1211
|
status={
|
|
1173
|
-
activeRetailer.id
|
|
1212
|
+
activeRetailer.id && retailerStatus
|
|
1174
1213
|
? retailerStatus[activeRetailer?.id][getConcept(activeTab)] ||
|
|
1175
1214
|
"NS"
|
|
1176
1215
|
: "-"
|
|
@@ -16,33 +16,33 @@ RetailerProductEditionDefault.args = {
|
|
|
16
16
|
Imágenes: false,
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
19
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
19
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJjOTRhNzMwNS05MzY1LTQ2ZmYtYTQyMy00YjRiYzNiOGIxODAiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwicGhvbmVfbnVtYmVyX3ZlcmlmaWVkIjp0cnVlLCJjb2duaXRvOnVzZXJuYW1lIjoiYzk0YTczMDUtOTM2NS00NmZmLWE0MjMtNGI0YmMzYjhiMTgwIiwiY29nbml0bzpyb2xlcyI6WyJhcm46YXdzOmlhbTo6ODk4NjcwMjMyODA3OnJvbGVcL2NvbnRlbnRvaC1kZXYtdXMtZWFzdC0xLWxhbWJkYVJvbGUiXSwiYXVkIjoiNWFjOHRwZ3M2Z2JzcTEzZnJ2cnBpZWVwNDAiLCJldmVudF9pZCI6IjFmODVjYTI2LTFiZTItNGRmOC04ZDVlLWNkYzdlYzhhNWY5MyIsInRva2VuX3VzZSI6ImlkIiwiYXV0aF90aW1lIjoxNjU5NDk3MDMyLCJuYW1lIjoiQ29sYWJvcmFkb3IiLCJwaG9uZV9udW1iZXIiOiIrNTIxMTExIiwiZXhwIjoxNjU5NTAwNjMyLCJpYXQiOjE2NTk0OTcwMzIsImVtYWlsIjoic2FsbWVyb24uNUBob3RtYWlsLmNvbSJ9.YMnbVYuC12JcOT0E1FRioMGyUol_eyu9RCfwa0fwB-K9oGTkrOSLbz8jK4sNI4QRgkr5eGqwF2KASmo1DGxOUwgV2s_-BM_tJpKHEcVuQ7z0X46C5EPahSxNPLuzs22WUnf97uoGYj9IrToWfoxV_6zi1Z1jshXwZ-1Kc9zeZvlFnyGeVyLS6uavMxcD06KNLKdWenQVFGcj6LZRjB-Oy-APMF29M1oggGqrsVdY3N8E9otUkws2yYA35dpHd1zHZNEbsX6cgOemGxog7h2f6NQmNXPrnmH4ZQTLS8sLtD_UOEu9_HAdsXLZizBDKQ95cC6be2p4w_sXj22AUw5BKg",
|
|
20
20
|
productSelected: {
|
|
21
21
|
services: {
|
|
22
|
-
datasheets:
|
|
23
|
-
descriptions:
|
|
22
|
+
datasheets: 0,
|
|
23
|
+
descriptions: 0,
|
|
24
24
|
images: 1,
|
|
25
25
|
},
|
|
26
|
-
orderId:
|
|
26
|
+
orderId: 82,
|
|
27
27
|
status: "AA",
|
|
28
|
-
datasheet_status: "
|
|
28
|
+
datasheet_status: "NS",
|
|
29
29
|
prio: "none",
|
|
30
30
|
version: 2,
|
|
31
|
-
description_status: "
|
|
31
|
+
description_status: "NS",
|
|
32
32
|
images_status: "AA",
|
|
33
33
|
article: {
|
|
34
|
-
id_article:
|
|
35
|
-
id_category: "
|
|
36
|
-
name: "
|
|
37
|
-
upc: "
|
|
38
|
-
timestamp: "2022-
|
|
39
|
-
id_user:
|
|
34
|
+
id_article: 55147,
|
|
35
|
+
id_category: "157",
|
|
36
|
+
name: "Lavatrastes Axion ",
|
|
37
|
+
upc: "977358",
|
|
38
|
+
timestamp: "2022-06-21T17:37:05.000Z",
|
|
39
|
+
id_user: 28,
|
|
40
40
|
status: "NULL",
|
|
41
41
|
active: 1,
|
|
42
|
-
company_id:
|
|
43
|
-
company_name: "
|
|
42
|
+
company_id: 1,
|
|
43
|
+
company_name: "COMPANY DEV",
|
|
44
44
|
country: "México",
|
|
45
|
-
id_order:
|
|
45
|
+
id_order: 82,
|
|
46
46
|
id_datasheet_especialist: 54,
|
|
47
47
|
id_datasheet_facilitator: 52,
|
|
48
48
|
id_description_especialist: 54,
|
|
@@ -51,33 +51,78 @@ RetailerProductEditionDefault.args = {
|
|
|
51
51
|
id_images_facilitator: 53,
|
|
52
52
|
id_auditor: 30,
|
|
53
53
|
id_recepcionist: null,
|
|
54
|
-
category:
|
|
54
|
+
category:
|
|
55
|
+
"Consumibles|Productos de Limpieza y Lavandería|Jabones y Lavatrastes",
|
|
55
56
|
missingAttributes: 0,
|
|
56
57
|
missingDescriptions: 0,
|
|
57
58
|
missingImages: 0,
|
|
58
59
|
},
|
|
59
60
|
retailers: [
|
|
61
|
+
{
|
|
62
|
+
id: 3,
|
|
63
|
+
name: "Sam´s Club",
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
id: 4,
|
|
67
|
+
name: "Walmart Super y Superama",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 5,
|
|
71
|
+
name: "Chedraui",
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: 6,
|
|
75
|
+
name: "HEB",
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
id: 12,
|
|
79
|
+
name: "La Comer",
|
|
80
|
+
},
|
|
60
81
|
{
|
|
61
82
|
id: 13,
|
|
62
83
|
name: "Soriana",
|
|
63
84
|
},
|
|
85
|
+
{
|
|
86
|
+
id: 17,
|
|
87
|
+
name: "Genérico",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
id: 20,
|
|
91
|
+
name: "Cornershop",
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
id: 26,
|
|
95
|
+
name: "Mercado Libre",
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 34,
|
|
99
|
+
name: "San Pablo",
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
id: 38,
|
|
103
|
+
name: "Del Sol",
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
id: 64,
|
|
107
|
+
name: "Cali",
|
|
108
|
+
},
|
|
64
109
|
],
|
|
65
110
|
country: "México",
|
|
66
|
-
upc: "
|
|
111
|
+
upc: "977358",
|
|
67
112
|
},
|
|
68
113
|
location: {
|
|
69
114
|
product: { articleId: 109485, versionId: 3 },
|
|
70
115
|
},
|
|
71
116
|
user: {
|
|
72
|
-
id_user:
|
|
73
|
-
name: "
|
|
74
|
-
last_name: "",
|
|
75
|
-
email: "
|
|
76
|
-
position:
|
|
117
|
+
id_user: 30,
|
|
118
|
+
name: "Admin",
|
|
119
|
+
last_name: "Ulises",
|
|
120
|
+
email: "salmeron.5@hotmail.com",
|
|
121
|
+
position: "Admin",
|
|
77
122
|
telephone: null,
|
|
78
|
-
country:
|
|
123
|
+
country: "México",
|
|
79
124
|
id_company: 2,
|
|
80
|
-
id_cognito: "
|
|
125
|
+
id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
|
|
81
126
|
birth_Date: null,
|
|
82
127
|
about_me: null,
|
|
83
128
|
zip_code: null,
|
|
@@ -99,6 +144,6 @@ RetailerProductEditionDefault.args = {
|
|
|
99
144
|
products_limit: "3",
|
|
100
145
|
type: "PyMES",
|
|
101
146
|
},
|
|
102
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
147
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1659497033479",
|
|
103
148
|
},
|
|
104
149
|
};
|
|
@@ -35,10 +35,24 @@ import { useCloseModal } from "../../../global-files/customHooks";
|
|
|
35
35
|
import { CreateVersion } from "../../organisms/CreateVersion";
|
|
36
36
|
|
|
37
37
|
const reducerImages = (state, action) => {
|
|
38
|
-
let { values, attrForImgs } = state;
|
|
38
|
+
let { values, attrForImgs, inputsByRetailer } = state;
|
|
39
39
|
switch (action.action) {
|
|
40
40
|
case "init":
|
|
41
|
-
|
|
41
|
+
const newInputsByRetailer = {};
|
|
42
|
+
action?.init?.inputsByRetailer?.forEach((inputs) => {
|
|
43
|
+
inputs?.forEach((input) => {
|
|
44
|
+
if (!newInputsByRetailer[`${input.id_retailer}`])
|
|
45
|
+
newInputsByRetailer[`${input.id_retailer}`] = [];
|
|
46
|
+
newInputsByRetailer[`${input.id_retailer}`].push(input);
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
inputsByRetailer = newInputsByRetailer;
|
|
50
|
+
return {
|
|
51
|
+
...action.init,
|
|
52
|
+
inputsByRetailer,
|
|
53
|
+
valuesInitial: action.init.values,
|
|
54
|
+
inputsInitial: action.init.inputs,
|
|
55
|
+
};
|
|
42
56
|
case "addImg":
|
|
43
57
|
values = [...values, action.img];
|
|
44
58
|
return { ...state, values };
|
|
@@ -57,6 +71,25 @@ const reducerImages = (state, action) => {
|
|
|
57
71
|
(value) => action.selectedImages.indexOf(value) === -1
|
|
58
72
|
);
|
|
59
73
|
return { ...state, values };
|
|
74
|
+
case "orderImages": {
|
|
75
|
+
let { inputsByRetailer, valuesInitial, inputsInitial, inputs } = state;
|
|
76
|
+
const orderedImages = [];
|
|
77
|
+
const imageIdArray = [];
|
|
78
|
+
action.retailerId &&
|
|
79
|
+
inputsByRetailer[action.retailerId]?.filter((input) => {
|
|
80
|
+
imageIdArray.push(input.id_image);
|
|
81
|
+
valuesInitial.forEach((value) => {
|
|
82
|
+
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
inputs = inputsInitial?.filter((input) =>
|
|
87
|
+
imageIdArray.includes(input.id)
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
values = orderedImages.length > 0 ? orderedImages : valuesInitial;
|
|
91
|
+
return { ...state, values, inputs };
|
|
92
|
+
}
|
|
60
93
|
default:
|
|
61
94
|
return state;
|
|
62
95
|
}
|
|
@@ -356,6 +389,7 @@ export const RetailerProductEdition = ({
|
|
|
356
389
|
setDatasheets([datagroups, inputs]);
|
|
357
390
|
setDescriptions(descriptions);
|
|
358
391
|
}
|
|
392
|
+
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
359
393
|
}, [activeRetailer, services]);
|
|
360
394
|
|
|
361
395
|
const thumbs = () => {
|
|
@@ -371,7 +405,7 @@ export const RetailerProductEdition = ({
|
|
|
371
405
|
return images?.values?.map((image, index) => (
|
|
372
406
|
<GalleryElement
|
|
373
407
|
setCheckAll={setCheckAll}
|
|
374
|
-
key={index}
|
|
408
|
+
key={index + "-" + imageType.name}
|
|
375
409
|
image={image}
|
|
376
410
|
gridLayout={imageLayout}
|
|
377
411
|
id={"gallery-element-" + index}
|
|
@@ -461,7 +495,7 @@ export const RetailerProductEdition = ({
|
|
|
461
495
|
value: e?.id,
|
|
462
496
|
name: e?.name,
|
|
463
497
|
required: e?.required,
|
|
464
|
-
active: images?.values
|
|
498
|
+
active: images?.values?.some((value) => value?.image_id === e?.id),
|
|
465
499
|
}));
|
|
466
500
|
setSocketType(imageInputs);
|
|
467
501
|
}, [images]);
|
|
@@ -1143,6 +1177,8 @@ export const RetailerProductEdition = ({
|
|
|
1143
1177
|
product?.services?.images === 1 && updateImages()
|
|
1144
1178
|
}
|
|
1145
1179
|
showSaveButton={auditorAssigned() || userAssigned()}
|
|
1180
|
+
setShowVersionSelector={setShowVersionSelector}
|
|
1181
|
+
version={version}
|
|
1146
1182
|
/>
|
|
1147
1183
|
</div>
|
|
1148
1184
|
<div className="product-information">
|
package/src/global-files/data.js
CHANGED
|
@@ -195,6 +195,7 @@ export const fetchUsers = async (auth) => {
|
|
|
195
195
|
export const getNewStatus = (statusArray) => {
|
|
196
196
|
let lookupString = "";
|
|
197
197
|
statusArray.forEach((element) => (lookupString += element + "/"));
|
|
198
|
+
if (lookupString.includes("AS")) return "AS";
|
|
198
199
|
if (lookupString.includes("RCA")) return "RCA";
|
|
199
200
|
if (lookupString.includes("RC")) return "RC";
|
|
200
201
|
if (lookupString.includes("RA")) return "RA";
|