contentoh-components-library 21.5.95 → 21.5.96
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/GeneralInput/index.js +6 -2
- package/dist/components/molecules/TabsMenu/index.js +11 -0
- package/dist/components/molecules/TagAndInput/index.js +3 -0
- package/dist/components/pages/ProviderProductEdition/index.js +44 -27
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +31 -100
- package/dist/components/pages/RetailerProductEdition/index.js +52 -32
- package/dist/contexts/AiProductEdition.js +23 -11
- package/package.json +1 -1
- package/src/components/atoms/GeneralInput/index.js +6 -2
- package/src/components/molecules/TabsMenu/index.js +11 -0
- package/src/components/molecules/TagAndInput/index.js +8 -0
- package/src/components/pages/ProviderProductEdition/index.js +102 -63
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +32 -116
- package/src/components/pages/RetailerProductEdition/index.js +22 -3
- package/src/contexts/AiProductEdition.jsx +11 -3
|
@@ -87,6 +87,7 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
87
87
|
handleChangeSuggestion = _ref$handleChangeSugg === void 0 ? function () {} : _ref$handleChangeSugg;
|
|
88
88
|
|
|
89
89
|
var _useAiProductEdition = (0, _AiProductEdition.useAiProductEdition)(),
|
|
90
|
+
isCreators = _useAiProductEdition.isCreators,
|
|
90
91
|
suggestions = _useAiProductEdition.suggestions,
|
|
91
92
|
currentSuggestion = _useAiProductEdition.currentSuggestion,
|
|
92
93
|
setCurrentSuggestionValue = _useAiProductEdition.setCurrentSuggestionValue;
|
|
@@ -188,6 +189,7 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
188
189
|
(0, _react.useEffect)(function () {
|
|
189
190
|
var _suggestions$inputId;
|
|
190
191
|
|
|
192
|
+
if (!isCreators) return;
|
|
191
193
|
if (Object.keys(suggestions).length === 0) return;
|
|
192
194
|
if (currentSuggestion !== null && currentSuggestion !== void 0 && currentSuggestion[inputId]) return;
|
|
193
195
|
var firstSuggestion = suggestions === null || suggestions === void 0 ? void 0 : (_suggestions$inputId = suggestions[inputId]) === null || _suggestions$inputId === void 0 ? void 0 : _suggestions$inputId[0];
|
|
@@ -199,10 +201,12 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
199
201
|
});
|
|
200
202
|
}, [suggestions]);
|
|
201
203
|
(0, _react.useEffect)(function () {
|
|
202
|
-
if (!isAiActive) return;
|
|
204
|
+
if (!isAiActive || !isCreators) return;
|
|
203
205
|
setAiSuggestionAccepted(false);
|
|
204
206
|
}, [isAiActive]);
|
|
205
207
|
(0, _react.useEffect)(function () {
|
|
208
|
+
if (!isCreators) return;
|
|
209
|
+
|
|
206
210
|
if (!isAiActive && !aiSuggestionAccepted) {
|
|
207
211
|
setTextValue({
|
|
208
212
|
value: valueAccepted
|
|
@@ -224,7 +228,7 @@ var GeneralInput = function GeneralInput(_ref) {
|
|
|
224
228
|
//AI Generation
|
|
225
229
|
|
|
226
230
|
var handleAcceptSuggestion = function handleAcceptSuggestion(suggestionValue) {
|
|
227
|
-
if (!suggestionValue) return;
|
|
231
|
+
if (!suggestionValue || !isCreators) return;
|
|
228
232
|
setValueAccepted(suggestionValue);
|
|
229
233
|
setAiSuggestionAccepted(true);
|
|
230
234
|
setIsAiActive(false);
|
|
@@ -40,6 +40,17 @@ var TabsMenu = function TabsMenu(_ref) {
|
|
|
40
40
|
sections = _useState2[0],
|
|
41
41
|
setSections = _useState2[1];
|
|
42
42
|
|
|
43
|
+
(0, _react.useEffect)(function () {
|
|
44
|
+
if (!activeTab) return;
|
|
45
|
+
setSections(function (prev) {
|
|
46
|
+
var updated = {};
|
|
47
|
+
Object.keys(prev).forEach(function (key) {
|
|
48
|
+
updated[key] = key === activeTab;
|
|
49
|
+
});
|
|
50
|
+
return updated;
|
|
51
|
+
});
|
|
52
|
+
}, [activeTab]);
|
|
53
|
+
|
|
43
54
|
var _useState3 = (0, _react.useState)(false),
|
|
44
55
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
45
56
|
modal = _useState4[0],
|
|
@@ -371,6 +371,7 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
371
371
|
onChange && onChange(boxOnboardingList);
|
|
372
372
|
}, [boxOnboardingList]);
|
|
373
373
|
(0, _react.useEffect)(function () {
|
|
374
|
+
if (!isCreators) return;
|
|
374
375
|
var currentDescriptionUpdate = Array.isArray(updatedDescriptions) ? updatedDescriptions.find(function (desc) {
|
|
375
376
|
return (desc === null || desc === void 0 ? void 0 : desc.attributeId) === inputId;
|
|
376
377
|
}) : null;
|
|
@@ -398,9 +399,11 @@ var TagAndInput = function TagAndInput(_ref) {
|
|
|
398
399
|
(0, _react.useEffect)(function () {
|
|
399
400
|
var _inputsGeneratedWithA;
|
|
400
401
|
|
|
402
|
+
if (!isCreators) return;
|
|
401
403
|
setIsAiGenerated(!!((_inputsGeneratedWithA = inputsGeneratedWithAi["".concat(inputId, "-").concat(inputType, "-").concat(version)]) !== null && _inputsGeneratedWithA !== void 0 && _inputsGeneratedWithA.isAiGenerated));
|
|
402
404
|
}, [inputsGeneratedWithAi]);
|
|
403
405
|
(0, _react.useEffect)(function () {
|
|
406
|
+
if (!isCreators) return;
|
|
404
407
|
setInputsUsingAi(function (prev) {
|
|
405
408
|
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, prev), {}, (0, _defineProperty2.default)({}, "".concat(inputId, "-").concat(inputType, "-").concat(version), {
|
|
406
409
|
using: isAiActive
|
|
@@ -247,6 +247,12 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
247
247
|
type: "SET_ACTIVE_RETAILER",
|
|
248
248
|
payload: productNormalized.categoryRetailer[0]
|
|
249
249
|
});
|
|
250
|
+
var firstRetailerStatus = productNormalized.statusByRetailer[productNormalized.categoryRetailerInOrder[0].id_retailer];
|
|
251
|
+
var initialTab = firstRetailerStatus.description ? "Descripción" : firstRetailerStatus.datasheet ? "Ficha técnica" : firstRetailerStatus.images ? "Imágenes" : "Imágenes";
|
|
252
|
+
dispatch({
|
|
253
|
+
type: "SET_ACTIVE_TAB",
|
|
254
|
+
payload: initialTab
|
|
255
|
+
});
|
|
250
256
|
} catch (error) {
|
|
251
257
|
console.log("Error setting product data: ", error);
|
|
252
258
|
}
|
|
@@ -402,34 +408,43 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
402
408
|
|
|
403
409
|
var updateInputsActiveRetailer = function updateInputsActiveRetailer() {
|
|
404
410
|
if (!state.services) return;
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
411
|
+
|
|
412
|
+
if (state.services.datasheets) {
|
|
413
|
+
var retailerDatasheets = state.services.datasheets[state.active_retailer.id_retailer];
|
|
414
|
+
var datasheetsActiveRetailer = (0, _objectSpread4.default)((0, _objectSpread4.default)({}, retailerDatasheets), {}, {
|
|
415
|
+
data: Object.values(retailerDatasheets.data)
|
|
416
|
+
});
|
|
417
|
+
dispatch({
|
|
418
|
+
type: "SET_DATASHEETS_INPUTS",
|
|
419
|
+
payload: [datasheetsActiveRetailer, state.services.datasheets.inputs]
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
if (state.services.descriptions) {
|
|
424
|
+
var descriptionsActiveRetailer = state.services.descriptions.filter(function (item) {
|
|
425
|
+
return item.id === state.active_retailer.id_retailer;
|
|
426
|
+
});
|
|
427
|
+
dispatch({
|
|
428
|
+
type: "SET_DESCRIPTIONS_INPUTS",
|
|
429
|
+
payload: descriptionsActiveRetailer
|
|
430
|
+
});
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
if (state.services.images) {
|
|
434
|
+
var filteredValues = state.services.images.values.filter(function (value) {
|
|
435
|
+
return state.services.images.inputsByRetailer.some(function (retailerInput) {
|
|
436
|
+
return retailerInput.some(function (input) {
|
|
437
|
+
return input.id_retailer === state.active_retailer.id_retailer && input.id_image === value.image_id;
|
|
438
|
+
});
|
|
416
439
|
});
|
|
417
440
|
});
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
payload: descriptionsActiveRetailer
|
|
426
|
-
});
|
|
427
|
-
dispatch({
|
|
428
|
-
type: "SET_IMAGES_VALUES",
|
|
429
|
-
payload: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.services.images), {}, {
|
|
430
|
-
values: filteredValues
|
|
431
|
-
})
|
|
432
|
-
});
|
|
441
|
+
dispatch({
|
|
442
|
+
type: "SET_IMAGES_VALUES",
|
|
443
|
+
payload: (0, _objectSpread4.default)((0, _objectSpread4.default)({}, state.services.images), {}, {
|
|
444
|
+
values: filteredValues
|
|
445
|
+
})
|
|
446
|
+
});
|
|
447
|
+
}
|
|
433
448
|
};
|
|
434
449
|
|
|
435
450
|
updateInputsActiveRetailer();
|
|
@@ -1495,13 +1510,15 @@ var ProviderProductEditionView = function ProviderProductEditionView(_ref) {
|
|
|
1495
1510
|
headerType: "input-name-header"
|
|
1496
1511
|
})), state.active_tab === "Ficha técnica" && (((_state$product14 = state.product) === null || _state$product14 === void 0 ? void 0 : _state$product14.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
1497
1512
|
children: (_state$datasheets_inp = state.datasheets_inputs[0]) === null || _state$datasheets_inp === void 0 ? void 0 : (_state$datasheets_inp2 = _state$datasheets_inp.data) === null || _state$datasheets_inp2 === void 0 ? void 0 : _state$datasheets_inp2.map(function (dataGroup, index) {
|
|
1513
|
+
var _state$datasheets_inp3;
|
|
1514
|
+
|
|
1498
1515
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1499
1516
|
index: index,
|
|
1500
1517
|
articleId: state.product.id_article,
|
|
1501
1518
|
version: state.version,
|
|
1502
1519
|
activeSection: state.active_tab,
|
|
1503
1520
|
inputGroup: dataGroup,
|
|
1504
|
-
dataInputs: state.datasheets_inputs[1],
|
|
1521
|
+
dataInputs: (_state$datasheets_inp3 = state.datasheets_inputs[1]) !== null && _state$datasheets_inp3 !== void 0 ? _state$datasheets_inp3 : [],
|
|
1505
1522
|
activeRetailer: state.services.datasheets[state.active_retailer.id_retailer],
|
|
1506
1523
|
groupData: state.services.datasheets[state.active_retailer.id_retailer].data,
|
|
1507
1524
|
updatedDatasheets: state.updated_datasheets_inputs,
|
|
@@ -33,94 +33,49 @@ RetailerProductEditionDefault.args = {
|
|
|
33
33
|
},
|
|
34
34
|
token: "eyJraWQiOiJEV3owZnNieXg2MXNFcVduN3RCXC81bVhod3ZNbFZIOTgwUnZcL3RjT0lKdEk9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI4ZDAxMDIxNC01YmZhLTQzYzMtOTZmYi1jNTU2ZGMwNTc3NGIiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfbFN6UVo0WjdSIiwiY29nbml0bzp1c2VybmFtZSI6IjhkMDEwMjE0LTViZmEtNDNjMy05NmZiLWM1NTZkYzA1Nzc0YiIsImF1ZCI6IjUyZDlza2tkY2c4cWpwODhvb2sxdXNlNm1rIiwiZXZlbnRfaWQiOiI1MDgwMTVmMy1mZGVkLTQ2ODUtYTIxNy1mYzgyMTg0ZWRmNGMiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTc2ODI1MzE3NywibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTc2ODI1Njc3NywiaWF0IjoxNzY4MjUzMTc3LCJlbWFpbCI6ImthcmFmZTMyMThAbW9tMmtpZC5jb20ifQ.QiZiscuTvrur0g328Zmh2bI-kZyg7YO_T5jT63096JNuSxGnX9wpK87cVTV1dED4ruD-2NMsgLShUIMcklAg17FL6i5_vCuB1dSIDY0LaybvSpriFJaVVdMUIMGFi_1Q7bI9qqyXYkevcf-HO33vVPdU-_-4-u8YRd-QganUk35vPYPh9vFJWbC0Qtvv25ZR4L2xuRIXx4e7StlTvZXysnYL8A84jkK1zn6d77V-9GqQQW8exO6sBW7R6cGt55vnF80NIfG_9lAqCK0PcZH4o50aqrAVhtfV5edlEmXBHeGK5R3Sz5iTeKb51QF3TWVFZCYGvQJ7FShulUWHcm3X2Q",
|
|
35
35
|
productSelected: {
|
|
36
|
-
"articleId":
|
|
36
|
+
"articleId": 145188,
|
|
37
37
|
"services": {
|
|
38
38
|
"datasheets": 1,
|
|
39
39
|
"descriptions": 1,
|
|
40
40
|
"images": 1
|
|
41
41
|
},
|
|
42
|
-
"orderId":
|
|
42
|
+
"orderId": 10451,
|
|
43
43
|
"city": "CDMX, México",
|
|
44
|
-
"status": "
|
|
45
|
-
"datasheet_status": "
|
|
44
|
+
"status": "AS",
|
|
45
|
+
"datasheet_status": "AA",
|
|
46
46
|
"prio": "none",
|
|
47
47
|
"version": 3,
|
|
48
|
-
"description_status": "
|
|
49
|
-
"images_status": "
|
|
48
|
+
"description_status": "CA",
|
|
49
|
+
"images_status": "AA",
|
|
50
50
|
"statusByRetailer": [{
|
|
51
|
-
"
|
|
51
|
+
"retailer_id": 2,
|
|
52
52
|
"service": "datasheet",
|
|
53
|
-
"
|
|
54
|
-
"task_user_group_id":
|
|
53
|
+
"status": "AA",
|
|
54
|
+
"task_user_group_id": 2
|
|
55
55
|
}, {
|
|
56
|
-
"
|
|
56
|
+
"retailer_id": 2,
|
|
57
57
|
"service": "description",
|
|
58
|
-
"
|
|
59
|
-
"task_user_group_id":
|
|
58
|
+
"status": "CA",
|
|
59
|
+
"task_user_group_id": 2
|
|
60
60
|
}, {
|
|
61
|
-
"
|
|
61
|
+
"retailer_id": 2,
|
|
62
62
|
"service": "images",
|
|
63
|
-
"
|
|
64
|
-
"task_user_group_id":
|
|
65
|
-
}, {
|
|
66
|
-
"status": "AC",
|
|
67
|
-
"service": "datasheet",
|
|
68
|
-
"retailer_id": 29,
|
|
69
|
-
"task_user_group_id": 4
|
|
70
|
-
}, {
|
|
71
|
-
"status": "AC",
|
|
72
|
-
"service": "description",
|
|
73
|
-
"retailer_id": 29,
|
|
74
|
-
"task_user_group_id": 4
|
|
75
|
-
}, {
|
|
76
|
-
"status": "AC",
|
|
77
|
-
"service": "images",
|
|
78
|
-
"retailer_id": 29,
|
|
79
|
-
"task_user_group_id": 4
|
|
80
|
-
}, {
|
|
81
|
-
"status": "AC",
|
|
82
|
-
"service": "datasheet",
|
|
83
|
-
"retailer_id": 36,
|
|
84
|
-
"task_user_group_id": 4
|
|
85
|
-
}, {
|
|
86
|
-
"status": "AC",
|
|
87
|
-
"service": "description",
|
|
88
|
-
"retailer_id": 36,
|
|
89
|
-
"task_user_group_id": 4
|
|
90
|
-
}, {
|
|
91
|
-
"status": "AC",
|
|
92
|
-
"service": "images",
|
|
93
|
-
"retailer_id": 36,
|
|
94
|
-
"task_user_group_id": 4
|
|
95
|
-
}, {
|
|
96
|
-
"status": "AC",
|
|
97
|
-
"service": "datasheet",
|
|
98
|
-
"retailer_id": 70,
|
|
99
|
-
"task_user_group_id": 4
|
|
100
|
-
}, {
|
|
101
|
-
"status": "AC",
|
|
102
|
-
"service": "description",
|
|
103
|
-
"retailer_id": 70,
|
|
104
|
-
"task_user_group_id": 4
|
|
105
|
-
}, {
|
|
106
|
-
"status": "AC",
|
|
107
|
-
"service": "images",
|
|
108
|
-
"retailer_id": 70,
|
|
109
|
-
"task_user_group_id": 4
|
|
63
|
+
"status": "AA",
|
|
64
|
+
"task_user_group_id": 2
|
|
110
65
|
}],
|
|
111
66
|
"article": {
|
|
112
|
-
"id_article":
|
|
113
|
-
"id_category": "
|
|
114
|
-
"brand":
|
|
115
|
-
"name": "
|
|
116
|
-
"upc": "
|
|
117
|
-
"sku": "
|
|
118
|
-
"timestamp": "2026-
|
|
67
|
+
"id_article": 145188,
|
|
68
|
+
"id_category": "5739",
|
|
69
|
+
"brand": null,
|
|
70
|
+
"name": "Pantalla",
|
|
71
|
+
"upc": "91449",
|
|
72
|
+
"sku": "144",
|
|
73
|
+
"timestamp": "2026-04-24T16:09:39.000Z",
|
|
119
74
|
"active": 1,
|
|
120
75
|
"company_id": 291,
|
|
121
76
|
"company_name": "LATAM LOGISTICS",
|
|
122
77
|
"country": "México",
|
|
123
|
-
"id_order":
|
|
78
|
+
"id_order": 10451,
|
|
124
79
|
"id_datasheet_especialist": 426,
|
|
125
80
|
"id_datasheet_facilitator": null,
|
|
126
81
|
"id_description_especialist": 426,
|
|
@@ -129,44 +84,20 @@ RetailerProductEditionDefault.args = {
|
|
|
129
84
|
"id_images_facilitator": null,
|
|
130
85
|
"id_auditor": 425,
|
|
131
86
|
"id_recepcionist": null,
|
|
132
|
-
"category": "
|
|
87
|
+
"category": "Tecnología y Electrónica|Televisores|Pantallas",
|
|
133
88
|
"categoryRetailer": [{
|
|
134
|
-
"id_category":
|
|
135
|
-
"id_retailer":
|
|
136
|
-
"category_name": "
|
|
137
|
-
"retailer_name": "
|
|
138
|
-
}, {
|
|
139
|
-
"id_category": 4216,
|
|
140
|
-
"id_retailer": 70,
|
|
141
|
-
"category_name": "Limpieza|Cuarto de Lavado|Cuarto de Lavado",
|
|
142
|
-
"retailer_name": "Bodega Aurrera"
|
|
143
|
-
}, {
|
|
144
|
-
"id_category": 4874,
|
|
145
|
-
"id_retailer": 36,
|
|
146
|
-
"category_name": "Productos de Higiene Personal|Productos de Higiene Personal|Productos de Higiene Personal",
|
|
147
|
-
"retailer_name": "Oxxo"
|
|
148
|
-
}, {
|
|
149
|
-
"id_category": 4941,
|
|
150
|
-
"id_retailer": 13,
|
|
151
|
-
"category_name": "Supermercado Soriana|Supermercado|Supermercado",
|
|
152
|
-
"retailer_name": "Soriana"
|
|
89
|
+
"id_category": 5739,
|
|
90
|
+
"id_retailer": 2,
|
|
91
|
+
"category_name": "Tecnología y Electrónica|Televisores|Pantallas",
|
|
92
|
+
"retailer_name": "Walmart Mercancías Generales"
|
|
153
93
|
}]
|
|
154
94
|
},
|
|
155
95
|
"retailers": [{
|
|
156
|
-
"id":
|
|
157
|
-
"name": "
|
|
158
|
-
}, {
|
|
159
|
-
"id": 29,
|
|
160
|
-
"name": "Farmacias del Ahorro"
|
|
161
|
-
}, {
|
|
162
|
-
"id": 36,
|
|
163
|
-
"name": "Oxxo"
|
|
164
|
-
}, {
|
|
165
|
-
"id": 70,
|
|
166
|
-
"name": "Bodega Aurrera"
|
|
96
|
+
"id": 2,
|
|
97
|
+
"name": "Walmart Mercancías Generales"
|
|
167
98
|
}],
|
|
168
99
|
"country": "México",
|
|
169
|
-
"upc": "
|
|
100
|
+
"upc": "91449"
|
|
170
101
|
},
|
|
171
102
|
// location: {
|
|
172
103
|
// product: { articleId: 126855, versionId: 3 },
|
|
@@ -340,6 +340,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
340
340
|
_context2.prev = 0;
|
|
341
341
|
product = productSelected ? productSelected : JSON.parse(sessionStorage.getItem("productSelected"));
|
|
342
342
|
productNormalized = (0, _utils.normalizeProduct)(product);
|
|
343
|
+
console.log({
|
|
344
|
+
productNormalized: productNormalized
|
|
345
|
+
});
|
|
343
346
|
dispatch({
|
|
344
347
|
type: "SET_PRODUCT",
|
|
345
348
|
payload: productNormalized
|
|
@@ -352,10 +355,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
352
355
|
|
|
353
356
|
setStatusArray((0, _utils.getStatusArrayByRole)(user.id_role)); // Cargar usuarios y asignaciones
|
|
354
357
|
|
|
355
|
-
_context2.next =
|
|
358
|
+
_context2.next = 10;
|
|
356
359
|
return (0, _data.fetchUsers)(token);
|
|
357
360
|
|
|
358
|
-
case
|
|
361
|
+
case 10:
|
|
359
362
|
users = _context2.sent;
|
|
360
363
|
|
|
361
364
|
if (users.length > 0) {
|
|
@@ -368,20 +371,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
368
371
|
id_article = productNormalized.id_article;
|
|
369
372
|
|
|
370
373
|
if (!id_article) {
|
|
371
|
-
_context2.next =
|
|
374
|
+
_context2.next = 16;
|
|
372
375
|
break;
|
|
373
376
|
}
|
|
374
377
|
|
|
375
|
-
_context2.next =
|
|
378
|
+
_context2.next = 16;
|
|
376
379
|
return (0, _utils.getAuditVersion)(id_article, setAuditableVersion, token);
|
|
377
380
|
|
|
378
|
-
case
|
|
381
|
+
case 16:
|
|
379
382
|
if (!(id_article && productNormalized.id_order)) {
|
|
380
|
-
_context2.next =
|
|
383
|
+
_context2.next = 22;
|
|
381
384
|
break;
|
|
382
385
|
}
|
|
383
386
|
|
|
384
|
-
_context2.next =
|
|
387
|
+
_context2.next = 19;
|
|
385
388
|
return _axios.default.get(process.env.REACT_APP_READ_OBSERVATION, {
|
|
386
389
|
params: {
|
|
387
390
|
articleId: id_article,
|
|
@@ -392,26 +395,26 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
392
395
|
}
|
|
393
396
|
});
|
|
394
397
|
|
|
395
|
-
case
|
|
398
|
+
case 19:
|
|
396
399
|
response = _context2.sent;
|
|
397
400
|
parseData = JSON.parse(response.data.body).data[0];
|
|
398
401
|
setObservation(parseData.observations);
|
|
399
402
|
|
|
400
|
-
case
|
|
401
|
-
_context2.next =
|
|
403
|
+
case 22:
|
|
404
|
+
_context2.next = 27;
|
|
402
405
|
break;
|
|
403
406
|
|
|
404
|
-
case
|
|
405
|
-
_context2.prev =
|
|
407
|
+
case 24:
|
|
408
|
+
_context2.prev = 24;
|
|
406
409
|
_context2.t0 = _context2["catch"](0);
|
|
407
410
|
console.log("Error setting product data: ", _context2.t0);
|
|
408
411
|
|
|
409
|
-
case
|
|
412
|
+
case 27:
|
|
410
413
|
case "end":
|
|
411
414
|
return _context2.stop();
|
|
412
415
|
}
|
|
413
416
|
}
|
|
414
|
-
}, _callee2, null, [[0,
|
|
417
|
+
}, _callee2, null, [[0, 24]]);
|
|
415
418
|
}));
|
|
416
419
|
|
|
417
420
|
return function initializeProduct() {
|
|
@@ -989,7 +992,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
989
992
|
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
|
|
990
993
|
var _state$product$id_ord, _state$active_retaile3;
|
|
991
994
|
|
|
992
|
-
var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
|
|
995
|
+
var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, articleStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _state$services_data2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, _articleStatus, _updatedProduct, updatedServicesData, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
|
|
993
996
|
|
|
994
997
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
995
998
|
while (1) {
|
|
@@ -1024,7 +1027,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1024
1027
|
_context7.prev = 11;
|
|
1025
1028
|
|
|
1026
1029
|
if (!result) {
|
|
1027
|
-
_context7.next =
|
|
1030
|
+
_context7.next = 28;
|
|
1028
1031
|
break;
|
|
1029
1032
|
}
|
|
1030
1033
|
|
|
@@ -1040,7 +1043,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1040
1043
|
case 17:
|
|
1041
1044
|
res = _context7.sent;
|
|
1042
1045
|
newStatuses = JSON.parse(res.data.body);
|
|
1043
|
-
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
|
|
1046
|
+
serviceStatus = newStatuses.newServiceStatus[articleId]["".concat(concept, "Status")];
|
|
1047
|
+
articleStatus = newStatuses.newArticleStatus[articleId];
|
|
1048
|
+
console.log({
|
|
1049
|
+
newStatuses: newStatuses
|
|
1050
|
+
}); // Actualizar el producto con los nuevos estados
|
|
1044
1051
|
|
|
1045
1052
|
updatedStatusByRetailer = state.product.statusByRetailer.map(function (item) {
|
|
1046
1053
|
return item.retailer_id === retailerId && item.service === concept ? (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
|
|
@@ -1048,7 +1055,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1048
1055
|
}) : item;
|
|
1049
1056
|
});
|
|
1050
1057
|
updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, {
|
|
1051
|
-
statusByRetailer: updatedStatusByRetailer
|
|
1058
|
+
statusByRetailer: updatedStatusByRetailer // version_status: articleStatus,
|
|
1059
|
+
// status: articleStatus,
|
|
1060
|
+
// article_status: articleStatus
|
|
1061
|
+
|
|
1052
1062
|
});
|
|
1053
1063
|
dispatch({
|
|
1054
1064
|
type: "SET_PRODUCT",
|
|
@@ -1064,10 +1074,10 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1064
1074
|
image: _genericModalCheck.default
|
|
1065
1075
|
}
|
|
1066
1076
|
});
|
|
1067
|
-
_context7.next =
|
|
1077
|
+
_context7.next = 33;
|
|
1068
1078
|
break;
|
|
1069
1079
|
|
|
1070
|
-
case
|
|
1080
|
+
case 28:
|
|
1071
1081
|
//Caso del botón "Enviar evaluación"
|
|
1072
1082
|
//Se construye el mensaje y se actualiza el estatus
|
|
1073
1083
|
specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
|
|
@@ -1080,19 +1090,23 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1080
1090
|
icon = _genericModalCheck.default;
|
|
1081
1091
|
}
|
|
1082
1092
|
|
|
1083
|
-
_context7.next =
|
|
1093
|
+
_context7.next = 32;
|
|
1084
1094
|
return _axios.default.put("".concat(process.env.REACT_APP_SEND_EVAL), data, {
|
|
1085
1095
|
headers: {
|
|
1086
1096
|
Authorization: token
|
|
1087
1097
|
}
|
|
1088
1098
|
});
|
|
1089
1099
|
|
|
1090
|
-
case
|
|
1100
|
+
case 32:
|
|
1091
1101
|
res = _context7.sent;
|
|
1092
1102
|
|
|
1093
|
-
case
|
|
1103
|
+
case 33:
|
|
1094
1104
|
if (res.data.statusCode === 200) {
|
|
1095
|
-
_JSON$parse2 = JSON.parse(res.data.body), newStatus = _JSON$parse2.newStatus, newOrderStatus = _JSON$parse2.newOrderStatus, newArticleStatus = _JSON$parse2.newArticleStatus;
|
|
1105
|
+
_JSON$parse2 = JSON.parse(res.data.body), newStatus = _JSON$parse2.newStatus, newOrderStatus = _JSON$parse2.newOrderStatus, newArticleStatus = _JSON$parse2.newArticleStatus;
|
|
1106
|
+
_articleStatus = newArticleStatus[articleId];
|
|
1107
|
+
console.log({
|
|
1108
|
+
newArticleStatus: newArticleStatus
|
|
1109
|
+
}); // const retailers = state.product.categoryRetailer.map((r) => ({
|
|
1096
1110
|
// id: r.id_retailer,
|
|
1097
1111
|
// name: r.retailerName,
|
|
1098
1112
|
// }));
|
|
@@ -1168,11 +1182,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1168
1182
|
});
|
|
1169
1183
|
}
|
|
1170
1184
|
|
|
1171
|
-
_context7.next =
|
|
1185
|
+
_context7.next = 40;
|
|
1172
1186
|
break;
|
|
1173
1187
|
|
|
1174
|
-
case
|
|
1175
|
-
_context7.prev =
|
|
1188
|
+
case 36:
|
|
1189
|
+
_context7.prev = 36;
|
|
1176
1190
|
_context7.t0 = _context7["catch"](11);
|
|
1177
1191
|
console.error("Error sending evaluation:", _context7.t0);
|
|
1178
1192
|
dispatch({
|
|
@@ -1185,20 +1199,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1185
1199
|
}
|
|
1186
1200
|
});
|
|
1187
1201
|
|
|
1188
|
-
case
|
|
1189
|
-
_context7.prev =
|
|
1202
|
+
case 40:
|
|
1203
|
+
_context7.prev = 40;
|
|
1190
1204
|
dispatch({
|
|
1191
1205
|
type: "SET_SAVING",
|
|
1192
1206
|
payload: false
|
|
1193
1207
|
});
|
|
1194
|
-
return _context7.finish(
|
|
1208
|
+
return _context7.finish(40);
|
|
1195
1209
|
|
|
1196
|
-
case
|
|
1210
|
+
case 43:
|
|
1197
1211
|
case "end":
|
|
1198
1212
|
return _context7.stop();
|
|
1199
1213
|
}
|
|
1200
1214
|
}
|
|
1201
|
-
}, _callee7, null, [[11,
|
|
1215
|
+
}, _callee7, null, [[11, 36, 40, 43]]);
|
|
1202
1216
|
}));
|
|
1203
1217
|
|
|
1204
1218
|
return function sendSingleEvaluation(_x2) {
|
|
@@ -1540,6 +1554,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1540
1554
|
};
|
|
1541
1555
|
|
|
1542
1556
|
var handleOnChangeProductVersion = function handleOnChangeProductVersion(version) {
|
|
1557
|
+
console.log('se cambia la version');
|
|
1543
1558
|
dispatch({
|
|
1544
1559
|
type: "SET_PRODUCT_VERSION",
|
|
1545
1560
|
payload: version
|
|
@@ -1734,6 +1749,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
|
|
|
1734
1749
|
});
|
|
1735
1750
|
};
|
|
1736
1751
|
|
|
1752
|
+
(0, _react.useEffect)(function () {
|
|
1753
|
+
console.log({
|
|
1754
|
+
stateProduct: state.product
|
|
1755
|
+
});
|
|
1756
|
+
}, [state.product]);
|
|
1737
1757
|
if (state.loading || !state.services || !state.product) return /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
|
|
1738
1758
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ProductEditionSkeleton, {})
|
|
1739
1759
|
});
|