contentoh-components-library 21.5.87 → 21.5.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.
@@ -33,71 +33,120 @@ 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": 145186,
36
+ "articleId": 145199,
37
37
  "services": {
38
38
  "datasheets": 1,
39
39
  "descriptions": 1,
40
- "images": 1
40
+ "images": 0
41
41
  },
42
- "orderId": 10449,
42
+ "orderId": 10457,
43
43
  "city": "CDMX, México",
44
44
  "status": "AS",
45
- "datasheet_status": "AC",
45
+ "datasheet_status": "AS",
46
46
  "prio": "none",
47
47
  "version": 3,
48
48
  "description_status": "AS",
49
- "images_status": "AC",
49
+ "images_status": "NS",
50
50
  "statusByRetailer": [{
51
- "status": "AC",
51
+ "status": "AS",
52
+ "service": "datasheet",
53
+ "retailer_id": 9,
54
+ "task_user_group_id": 2
55
+ }, {
56
+ "status": "AS",
57
+ "service": "description",
58
+ "retailer_id": 9,
59
+ "task_user_group_id": 2
60
+ }, {
61
+ "status": "AS",
62
+ "service": "datasheet",
63
+ "retailer_id": 19,
64
+ "task_user_group_id": 2
65
+ }, {
66
+ "status": "AS",
67
+ "service": "description",
68
+ "retailer_id": 19,
69
+ "task_user_group_id": 2
70
+ }, {
71
+ "status": "AS",
52
72
  "service": "datasheet",
53
- "retailer_id": 70,
54
- "task_user_group_id": 4
73
+ "retailer_id": 24,
74
+ "task_user_group_id": 2
55
75
  }, {
56
76
  "status": "AS",
57
77
  "service": "description",
58
- "retailer_id": 70,
78
+ "retailer_id": 24,
59
79
  "task_user_group_id": 2
60
80
  }, {
61
- "status": "AC",
62
- "service": "images",
63
- "retailer_id": 70,
64
- "task_user_group_id": 4
81
+ "status": "AS",
82
+ "service": "datasheet",
83
+ "retailer_id": 1011,
84
+ "task_user_group_id": 2
85
+ }, {
86
+ "status": "AS",
87
+ "service": "description",
88
+ "retailer_id": 1011,
89
+ "task_user_group_id": 2
65
90
  }],
66
91
  "article": {
67
- "id_article": 145186,
68
- "id_category": "4007",
92
+ "id_article": 145199,
93
+ "id_category": "10001",
69
94
  "brand": null,
70
- "name": "Mayonesa",
71
- "upc": "098928",
72
- "sku": "899",
73
- "timestamp": "2026-04-23T16:02:14.000Z",
95
+ "name": "Serna Status Bug 4",
96
+ "upc": "14615181351",
97
+ "sku": "156845131",
98
+ "timestamp": "2026-05-05T15:08:54.000Z",
74
99
  "active": 1,
75
100
  "company_id": 291,
76
101
  "company_name": "LATAM LOGISTICS",
77
102
  "country": "México",
78
- "id_order": 10449,
103
+ "id_order": 10457,
79
104
  "id_datasheet_especialist": 426,
80
105
  "id_datasheet_facilitator": null,
81
106
  "id_description_especialist": 426,
82
107
  "id_description_facilitator": null,
83
- "id_images_especialist": 427,
108
+ "id_images_especialist": null,
84
109
  "id_images_facilitator": null,
85
110
  "id_auditor": 425,
86
111
  "id_recepcionist": null,
87
- "category": "Abarrotes Procesados|Abarrotes Básicos y Procesados|Abarrotes Básicos y Procesados",
112
+ "category": "Departamento Hanseatik|Categoría Hanseatik|Subcategoría Hanseatik",
88
113
  "categoryRetailer": [{
89
- "id_category": 4007,
90
- "id_retailer": 70,
91
- "category_name": "Abarrotes Procesados|Abarrotes Básicos y Procesados|Abarrotes Básicos y Procesados",
92
- "retailer_name": "Bodega Aurrera"
114
+ "id_category": 3432,
115
+ "id_retailer": 24,
116
+ "category_name": "Bebés Alsuper|Bebés|Bebés",
117
+ "retailer_name": "Alsuper"
118
+ }, {
119
+ "id_category": 3579,
120
+ "id_retailer": 1011,
121
+ "category_name": "Categoría Genérica Farmatodo|Categoría Genérica|Categoría Genérica",
122
+ "retailer_name": "Farmatodo"
123
+ }, {
124
+ "id_category": 6795,
125
+ "id_retailer": 19,
126
+ "category_name": "Categoría Generica Costco|Categoría Generica|Categoría Generica",
127
+ "retailer_name": "Costco"
128
+ }, {
129
+ "id_category": 10001,
130
+ "id_retailer": 9,
131
+ "category_name": "Departamento Hanseatik|Categoría Hanseatik|Subcategoría Hanseatik",
132
+ "retailer_name": "Amazon"
93
133
  }]
94
134
  },
95
135
  "retailers": [{
96
- "id": 70,
97
- "name": "Bodega Aurrera"
136
+ "id": 9,
137
+ "name": "Amazon"
138
+ }, {
139
+ "id": 19,
140
+ "name": "Costco"
141
+ }, {
142
+ "id": 24,
143
+ "name": "Alsuper"
144
+ }, {
145
+ "id": 1011,
146
+ "name": "Farmatodo"
98
147
  }],
99
148
  "country": "México",
100
- "upc": "098928"
149
+ "upc": "14615181351"
101
150
  },
102
151
  // location: {
103
152
  // product: { articleId: 126855, versionId: 3 },
@@ -107,41 +156,42 @@ RetailerProductEditionDefault.args = {
107
156
  // },
108
157
  // },
109
158
  // EDICION IMAGENES
110
- user: {
111
- "id_user": 427,
112
- "name": "Especialista Edición",
113
- "last_name": null,
114
- "email": "kikije1467@mtlcz.com",
115
- "position": "Tester",
116
- "telephone": null,
117
- "country": null,
118
- "id_company": 254,
119
- "id_cognito": "c7e5a6a4-2b3f-4d54-af98-9e09a4cbc01e",
120
- "birth_Date": null,
121
- "about_me": null,
122
- "zip_code": null,
123
- "address": null,
124
- "job": null,
125
- "id_stripe": null,
126
- "id_role": 8,
127
- "active": 1,
128
- "is_retailer": 0,
129
- "email_notify": null,
130
- "is_user_tech": null,
131
- "is_onboarding": 0,
132
- "membership": {
133
- "id": 750,
134
- "start_date": "2022-01-07T21:32:54.000Z",
135
- "end_date": "2023-01-07T21:32:54.000Z",
136
- "planID": 6,
137
- "plan": "prod_KvGd6YSTJyR3AP",
138
- "name": "Plan Small",
139
- "user_limit": "10",
140
- "products_limit": "1000",
141
- "type": "Enterprise"
142
- },
143
- "src": "https://content-management-profile-prod.s3.amazonaws.com/id-427/427.png?1775592220312"
144
- } //TEXTOS
159
+ // user: {
160
+ // "id_user": 427,
161
+ // "name": "Especialista Edición",
162
+ // "last_name": null,
163
+ // "email": "kikije1467@mtlcz.com",
164
+ // "position": "Tester",
165
+ // "telephone": null,
166
+ // "country": null,
167
+ // "id_company": 254,
168
+ // "id_cognito": "c7e5a6a4-2b3f-4d54-af98-9e09a4cbc01e",
169
+ // "birth_Date": null,
170
+ // "about_me": null,
171
+ // "zip_code": null,
172
+ // "address": null,
173
+ // "job": null,
174
+ // "id_stripe": null,
175
+ // "id_role": 8,
176
+ // "active": 1,
177
+ // "is_retailer": 0,
178
+ // "email_notify": null,
179
+ // "is_user_tech": null,
180
+ // "is_onboarding": 0,
181
+ // "membership": {
182
+ // "id": 750,
183
+ // "start_date": "2022-01-07T21:32:54.000Z",
184
+ // "end_date": "2023-01-07T21:32:54.000Z",
185
+ // "planID": 6,
186
+ // "plan": "prod_KvGd6YSTJyR3AP",
187
+ // "name": "Plan Small",
188
+ // "user_limit": "10",
189
+ // "products_limit": "1000",
190
+ // "type": "Enterprise"
191
+ // },
192
+ // "src": "https://content-management-profile-prod.s3.amazonaws.com/id-427/427.png?1775592220312"
193
+ // },
194
+ //TEXTOS
145
195
  // user: {
146
196
  // "id_user": 442,
147
197
  // "name": "Especialista",
@@ -213,5 +263,40 @@ RetailerProductEditionDefault.args = {
213
263
  // },
214
264
  // src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1768253179478",
215
265
  // },
216
-
266
+ // AUDITORES
267
+ user: {
268
+ "id_user": 423,
269
+ "name": "Facilitador Textos",
270
+ "last_name": null,
271
+ "email": "bayadi1538@mnqlm.com",
272
+ "position": "Tester",
273
+ "telephone": null,
274
+ "country": null,
275
+ "id_company": 254,
276
+ "id_cognito": "0b66a4a9-7790-4034-a30a-c00808962867",
277
+ "birth_Date": null,
278
+ "about_me": null,
279
+ "zip_code": null,
280
+ "address": null,
281
+ "job": null,
282
+ "id_stripe": null,
283
+ "id_role": 4,
284
+ "active": 1,
285
+ "is_retailer": 0,
286
+ "email_notify": null,
287
+ "is_user_tech": null,
288
+ "is_onboarding": 0,
289
+ "membership": {
290
+ "id": 750,
291
+ "start_date": "2022-01-07T21:32:54.000Z",
292
+ "end_date": "2023-01-07T21:32:54.000Z",
293
+ "planID": 6,
294
+ "plan": "prod_KvGd6YSTJyR3AP",
295
+ "name": "Plan Small",
296
+ "user_limit": "10",
297
+ "products_limit": "1000",
298
+ "type": "Enterprise"
299
+ },
300
+ "src": "https://content-management-profile-prod.s3.amazonaws.com/id-423/423.png?1778003423713"
301
+ }
217
302
  };
@@ -45,26 +45,28 @@ var productReducer = function productReducer(state, action) {
45
45
 
46
46
  case PRODUCT_ACTIONS.SET_RETAILER_STATUS:
47
47
  {
48
+ var _action$payload$find, _action$payload$find2, _action$payload$find3;
49
+
48
50
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
49
51
  product: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state.product), {}, {
50
52
  status: getMinorStatus(action.payload.map(function (status) {
51
53
  return status === null || status === void 0 ? void 0 : status.status;
52
54
  })),
53
- description_status: action.payload.find(function (status) {
55
+ description_status: ((_action$payload$find = action.payload.find(function (status) {
54
56
  var _state$active_retaile;
55
57
 
56
58
  return (status === null || status === void 0 ? void 0 : status.service) === "description" && (status === null || status === void 0 ? void 0 : status.retailer_id) === (state === null || state === void 0 ? void 0 : (_state$active_retaile = state.active_retailer) === null || _state$active_retaile === void 0 ? void 0 : _state$active_retaile.id_retailer);
57
- }).status || "NS",
58
- datasheet_status: action.payload.find(function (status) {
59
+ })) === null || _action$payload$find === void 0 ? void 0 : _action$payload$find.status) || "NS",
60
+ datasheet_status: ((_action$payload$find2 = action.payload.find(function (status) {
59
61
  var _state$active_retaile2;
60
62
 
61
63
  return (status === null || status === void 0 ? void 0 : status.service) === "datasheet" && (status === null || status === void 0 ? void 0 : status.retailer_id) === (state === null || state === void 0 ? void 0 : (_state$active_retaile2 = state.active_retailer) === null || _state$active_retaile2 === void 0 ? void 0 : _state$active_retaile2.id_retailer);
62
- }).status || "NS",
63
- images_status: action.payload.find(function (status) {
64
+ })) === null || _action$payload$find2 === void 0 ? void 0 : _action$payload$find2.status) || "NS",
65
+ images_status: ((_action$payload$find3 = action.payload.find(function (status) {
64
66
  var _state$active_retaile3;
65
67
 
66
68
  return (status === null || status === void 0 ? void 0 : status.service) === "images" && (status === null || status === void 0 ? void 0 : status.retailer_id) === (state === null || state === void 0 ? void 0 : (_state$active_retaile3 = state.active_retailer) === null || _state$active_retaile3 === void 0 ? void 0 : _state$active_retaile3.id_retailer);
67
- }).status || "NS",
69
+ })) === null || _action$payload$find3 === void 0 ? void 0 : _action$payload$find3.status) || "NS",
68
70
  statusByRetailer: action.payload
69
71
  })
70
72
  });
@@ -105,6 +107,8 @@ var productReducer = function productReducer(state, action) {
105
107
  exports.productReducer = productReducer;
106
108
 
107
109
  function getMinorStatus() {
110
+ var _STATUS_DICTIONARY$NS;
111
+
108
112
  var servicesStatus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
109
113
  if (!servicesStatus || servicesStatus.length === 0) return _statusDictionary.STATUS_DICTIONARY.NS.name;
110
114
  console.log({
@@ -117,5 +121,5 @@ function getMinorStatus() {
117
121
  if (!minorObj || typeof minorObj.weight === "undefined") return current;
118
122
  return currentObj.weight < minorObj.weight ? currentObj : minorObj;
119
123
  }, servicesStatus[0] || _statusDictionary.STATUS_DICTIONARY.NS);
120
- return (winner === null || winner === void 0 ? void 0 : winner.status) || _statusDictionary.STATUS_DICTIONARY.NS.status;
124
+ return (winner === null || winner === void 0 ? void 0 : winner.status) || ((_STATUS_DICTIONARY$NS = _statusDictionary.STATUS_DICTIONARY.NS) === null || _STATUS_DICTIONARY$NS === void 0 ? void 0 : _STATUS_DICTIONARY$NS.status);
121
125
  }
@@ -96,7 +96,7 @@ var _material = require("@mui/material");
96
96
  var _jsxRuntime = require("react/jsx-runtime");
97
97
 
98
98
  var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
99
- var _location$state, _location$state2, _state$active_retaile4, _state$active_retaile5, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product6, _state$active_retaile6, _state$active_retaile7, _state$active_retaile8, _state$active_retaile9, _state$product7, _state$product8, _state$product9, _state$datasheets_inp, _state$datasheets_inp2, _state$product10, _state$images_values12, _state$comment;
99
+ var _location$state, _location$state2, _state$active_retaile4, _state$active_retaile5, _state$images_values$2, _state$images_values10, _state$images_values11, _state$product8, _state$active_retaile6, _state$active_retaile7, _state$active_retaile8, _state$active_retaile9, _state$product9, _state$product10, _state$product11, _state$datasheets_inp, _state$datasheets_inp2, _state$product12, _state$images_values12, _state$comment;
100
100
 
101
101
  var tabsSections = _ref.tabsSections,
102
102
  _ref$productSelected = _ref.productSelected,
@@ -757,10 +757,14 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
757
757
  };
758
758
 
759
759
  var isAuditorAssigned = function isAuditorAssigned() {
760
- return state.product.id_auditor === user.id_user;
760
+ var _state$product5;
761
+
762
+ return ((_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.id_auditor) === (user === null || user === void 0 ? void 0 : user.id_user);
761
763
  };
762
764
 
763
765
  var isUserAssignedToService = function isUserAssignedToService(tab, rol) {
766
+ var _state$product6;
767
+
764
768
  var concept = (0, _utils.getConceptByTab)(state.active_tab);
765
769
  var allowedRoles = [1, 4, 5, 6, 7, 8];
766
770
  var validUser = allowedRoles.includes(user === null || user === void 0 ? void 0 : user.id_role); // Determinar rol por defecto si no se pasa
@@ -774,16 +778,16 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
774
778
  }
775
779
 
776
780
  var isAdmin = user.id_role === 1;
777
- var idUserAssigned = state.product["id_".concat(concept, "_").concat(rol)];
781
+ var idUserAssigned = (_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6["id_".concat(concept, "_").concat(rol)];
778
782
  var isAssigned = idUserAssigned === user.id_user;
779
783
  return isAdmin || isAssigned && validUser;
780
784
  };
781
785
 
782
786
  var canShowSingleEvaluationButtons = function canShowSingleEvaluationButtons(action) {
783
- var _state$services_data$, _state$services_data$2;
787
+ var _state$services_data, _state$services_data$, _state$services_data$2;
784
788
 
785
789
  var concept = (0, _utils.getConceptByTab)(action || state.active_tab);
786
- var retailerStatus = (_state$services_data$ = state.services_data.find(function (srv) {
790
+ var retailerStatus = (_state$services_data = state.services_data) === null || _state$services_data === void 0 ? void 0 : (_state$services_data$ = _state$services_data.find(function (srv) {
787
791
  var _state$active_retaile2;
788
792
 
789
793
  return srv.id_retailer === ((_state$active_retaile2 = state.active_retailer) === null || _state$active_retaile2 === void 0 ? void 0 : _state$active_retaile2.id_retailer) && srv.service === concept;
@@ -826,9 +830,9 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
826
830
  };
827
831
 
828
832
  var handleOnClickSaveImages = function handleOnClickSaveImages() {
829
- var _state$product5, _state$product5$servi;
833
+ var _state$product7, _state$product7$servi;
830
834
 
831
- if (((_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : (_state$product5$servi = _state$product5.services) === null || _state$product5$servi === void 0 ? void 0 : _state$product5$servi.images) === 1) {
835
+ if (((_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : (_state$product7$servi = _state$product7.services) === null || _state$product7$servi === void 0 ? void 0 : _state$product7$servi.images) === 1) {
832
836
  saveImageAttrs(token);
833
837
  }
834
838
  };
@@ -985,7 +989,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
985
989
  var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7(result) {
986
990
  var _state$product$id_ord, _state$active_retaile3;
987
991
 
988
- var concept, articleId, orderId, sectionStatusKey, evalStatus, retailerId, data, res, message, icon, activeTab, newStatuses, serviceStatus, updatedStatusByRetailer, updatedProduct, specialistDone, _objectSpread2, _JSON$parse2, newStatus, newOrderStatus, newArticleStatus, retailers, messageToChat, messageData, _updatedProduct, sessionProduct, _objectSpread3, productInSession, updatedProductInSession;
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;
989
993
 
990
994
  return _regenerator.default.wrap(function _callee7$(_context7) {
991
995
  while (1) {
@@ -1064,6 +1068,8 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1064
1068
  break;
1065
1069
 
1066
1070
  case 26:
1071
+ //Caso del botón "Enviar evaluación"
1072
+ //Se construye el mensaje y se actualiza el estatus
1067
1073
  specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
1068
1074
 
1069
1075
  if (specialistDone) {
@@ -1085,52 +1091,31 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1085
1091
  res = _context7.sent;
1086
1092
 
1087
1093
  case 31:
1088
- if (!(res.data.statusCode === 200)) {
1089
- _context7.next = 43;
1090
- break;
1091
- }
1092
-
1093
- _JSON$parse2 = JSON.parse(res.data.body), newStatus = _JSON$parse2.newStatus, newOrderStatus = _JSON$parse2.newOrderStatus, newArticleStatus = _JSON$parse2.newArticleStatus;
1094
- retailers = state.product.categoryRetailer.map(function (r) {
1095
- return {
1096
- id: r.id_retailer,
1097
- name: r.retailerName
1098
- };
1099
- });
1100
- messageToChat = (0, _utils.createMessage)(retailers, retailerId, evalStatus, newStatus, activeTab);
1101
- messageData = {
1102
- paramsBody: {
1103
- id: articleId,
1104
- version: state.product.version,
1105
- items: [{
1106
- type: "status",
1107
- value: messageToChat
1108
- }],
1109
- retailerId: retailerId,
1110
- status: state.product.status
1111
- },
1112
- paramsHeader: {
1113
- Authorization: token
1114
- }
1115
- };
1116
- _context7.next = 38;
1117
- return (0, _utils.sendMessage)(messageData);
1118
-
1119
- case 38:
1120
- _updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, (_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread2, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
1121
- if (item.retailer_id === retailerId && item.service === concept) {
1122
- return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
1123
- status: newStatus
1124
- });
1125
- }
1126
-
1127
- return item;
1128
- })), _objectSpread2));
1129
- sessionProduct = sessionStorage.getItem("productSelected");
1130
-
1131
- if (sessionProduct) {
1132
- productInSession = JSON.parse(sessionProduct);
1133
- updatedProductInSession = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, productInSession), {}, (_objectSpread3 = {}, (0, _defineProperty2.default)(_objectSpread3, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread3, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
1094
+ 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; // const retailers = state.product.categoryRetailer.map((r) => ({
1096
+ // id: r.id_retailer,
1097
+ // name: r.retailerName,
1098
+ // }));
1099
+ // const messageToChat = createMessage(
1100
+ // retailers,
1101
+ // retailerId,
1102
+ // evalStatus,
1103
+ // newStatus,
1104
+ // activeTab,
1105
+ // );
1106
+ // const messageData = {
1107
+ // paramsBody: {
1108
+ // id: articleId,
1109
+ // version: state.product.version,
1110
+ // items: [{ type: "status", value: messageToChat }],
1111
+ // retailerId: retailerId,
1112
+ // status: state.product.status,
1113
+ // },
1114
+ // paramsHeader: { Authorization: token },
1115
+ // };
1116
+ // await sendMessage(messageData);
1117
+
1118
+ _updatedProduct = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, state.product), {}, (_objectSpread2 = {}, (0, _defineProperty2.default)(_objectSpread2, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread2, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
1134
1119
  if (item.retailer_id === retailerId && item.service === concept) {
1135
1120
  return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
1136
1121
  status: newStatus
@@ -1138,33 +1123,56 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1138
1123
  }
1139
1124
 
1140
1125
  return item;
1141
- })), _objectSpread3));
1142
- sessionStorage.setItem("productSelected", JSON.stringify(updatedProductInSession));
1143
- }
1126
+ })), _objectSpread2)); //Actualizamos el services_data en el servicio específico del retailer actual
1127
+
1128
+ updatedServicesData = (_state$services_data2 = state.services_data) === null || _state$services_data2 === void 0 ? void 0 : _state$services_data2.map(function (service) {
1129
+ return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, service), {}, {
1130
+ status: (service === null || service === void 0 ? void 0 : service.id_retailer) === retailerId && (service === null || service === void 0 ? void 0 : service.service) === concept ? newStatus : service === null || service === void 0 ? void 0 : service.status
1131
+ });
1132
+ });
1133
+ sessionProduct = sessionStorage.getItem("productSelected");
1134
+
1135
+ if (sessionProduct) {
1136
+ productInSession = JSON.parse(sessionProduct);
1137
+ updatedProductInSession = (0, _objectSpread5.default)((0, _objectSpread5.default)({}, productInSession), {}, (_objectSpread3 = {}, (0, _defineProperty2.default)(_objectSpread3, "".concat(concept, "_status"), newStatus), (0, _defineProperty2.default)(_objectSpread3, "statusByRetailer", state.product.statusByRetailer.map(function (item) {
1138
+ if (item.retailer_id === retailerId && item.service === concept) {
1139
+ return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, item), {}, {
1140
+ status: newStatus
1141
+ });
1142
+ }
1143
+
1144
+ return item;
1145
+ })), _objectSpread3));
1146
+ sessionStorage.setItem("productSelected", JSON.stringify(updatedProductInSession));
1147
+ }
1148
+
1149
+ if (message) {
1150
+ dispatch({
1151
+ type: "SET_MODAL",
1152
+ payload: {
1153
+ show: true,
1154
+ title: "",
1155
+ message: message,
1156
+ image: _genericModalCheck.default
1157
+ }
1158
+ });
1159
+ }
1144
1160
 
1145
- if (message) {
1146
1161
  dispatch({
1147
- type: "SET_MODAL",
1148
- payload: {
1149
- show: true,
1150
- title: "",
1151
- message: message,
1152
- image: _genericModalCheck.default
1153
- }
1162
+ type: "SET_PRODUCT",
1163
+ payload: _updatedProduct
1164
+ });
1165
+ dispatch({
1166
+ type: "SET_SERVICES_DATA",
1167
+ payload: updatedServicesData
1154
1168
  });
1155
1169
  }
1156
1170
 
1157
- dispatch({
1158
- type: "SET_PRODUCT",
1159
- payload: _updatedProduct
1160
- });
1161
-
1162
- case 43:
1163
- _context7.next = 49;
1171
+ _context7.next = 38;
1164
1172
  break;
1165
1173
 
1166
- case 45:
1167
- _context7.prev = 45;
1174
+ case 34:
1175
+ _context7.prev = 34;
1168
1176
  _context7.t0 = _context7["catch"](11);
1169
1177
  console.error("Error sending evaluation:", _context7.t0);
1170
1178
  dispatch({
@@ -1177,20 +1185,20 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1177
1185
  }
1178
1186
  });
1179
1187
 
1180
- case 49:
1181
- _context7.prev = 49;
1188
+ case 38:
1189
+ _context7.prev = 38;
1182
1190
  dispatch({
1183
1191
  type: "SET_SAVING",
1184
1192
  payload: false
1185
1193
  });
1186
- return _context7.finish(49);
1194
+ return _context7.finish(38);
1187
1195
 
1188
- case 52:
1196
+ case 41:
1189
1197
  case "end":
1190
1198
  return _context7.stop();
1191
1199
  }
1192
1200
  }
1193
- }, _callee7, null, [[11, 45, 49, 52]]);
1201
+ }, _callee7, null, [[11, 34, 38, 41]]);
1194
1202
  }));
1195
1203
 
1196
1204
  return function sendSingleEvaluation(_x2) {
@@ -1227,7 +1235,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1227
1235
 
1228
1236
  var sendBulkEvaluation = /*#__PURE__*/function () {
1229
1237
  var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9(result) {
1230
- var _state$services_data, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, productInSession, updatedProductInSession;
1238
+ var _state$services_data3, evaluationArray, conceptArray, status, updatedStatusByRetailer, updatedProduct, productInSession, updatedProductInSession;
1231
1239
 
1232
1240
  return _regenerator.default.wrap(function _callee9$(_context9) {
1233
1241
  while (1) {
@@ -1241,7 +1249,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1241
1249
  evaluationArray = [];
1242
1250
  conceptArray = (0, _utils.getConceptsByRole)(user.id_role); // Crear todas las evaluaciones para cada servicio y retailer
1243
1251
 
1244
- (_state$services_data = state.services_data) === null || _state$services_data === void 0 ? void 0 : _state$services_data.forEach(function (ret) {
1252
+ (_state$services_data3 = state.services_data) === null || _state$services_data3 === void 0 ? void 0 : _state$services_data3.forEach(function (ret) {
1245
1253
  var service = ret.service,
1246
1254
  id_retailer = ret.id_retailer,
1247
1255
  status = ret.status;
@@ -1505,7 +1513,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1505
1513
  case 4:
1506
1514
  case 5:
1507
1515
  var filteredSrv45 = servicesByTab === null || servicesByTab === void 0 ? void 0 : servicesByTab.filter(function (serv) {
1508
- return statusArray.includes(serv.status);
1516
+ return statusArray.includes(serv === null || serv === void 0 ? void 0 : serv.status);
1509
1517
  });
1510
1518
  var condition45 = unvalidated && ["CA", "IE"].includes(product === null || product === void 0 ? void 0 : product.status) && (filteredSrv45 === null || filteredSrv45 === void 0 ? void 0 : filteredSrv45.length) === (servicesByTab === null || servicesByTab === void 0 ? void 0 : servicesByTab.length);
1511
1519
  return condition45;
@@ -1513,7 +1521,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1513
1521
  case 6:
1514
1522
  var statusInArray = statusArray.includes(product === null || product === void 0 ? void 0 : product.status);
1515
1523
  var allSrvValid = (_srv = srv) === null || _srv === void 0 ? void 0 : _srv.every(function (serv) {
1516
- return ["RA", "AA", "AP", "ACA"].includes(serv.status);
1524
+ return ["RA", "AA", "AP", "ACA"].includes(serv === null || serv === void 0 ? void 0 : serv.status);
1517
1525
  });
1518
1526
  var condition6 = statusInArray && allSrvValid && auditorUnvalidated;
1519
1527
  return condition6;
@@ -1882,7 +1890,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1882
1890
  lists: state.images_values || [],
1883
1891
  activeImage: (_state$images_values10 = state.images_values) !== null && _state$images_values10 !== void 0 && _state$images_values10.values ? (_state$images_values11 = state.images_values) === null || _state$images_values11 === void 0 ? void 0 : _state$images_values11.values[state.current_image] : {},
1884
1892
  assignationsImages: state.collaborator_assignations["Imágenes"],
1885
- imagesStatus: ((_state$product6 = state.product) === null || _state$product6 === void 0 ? void 0 : _state$product6.images_status) || "-",
1893
+ imagesStatus: ((_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.images_status) || "-",
1886
1894
  retailerSelected: (_state$active_retaile6 = state.active_retailer) === null || _state$active_retaile6 === void 0 ? void 0 : _state$active_retaile6.id_retailer,
1887
1895
  isRetailer: isRetailer,
1888
1896
  version: state.product.version,
@@ -1954,11 +1962,11 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1954
1962
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1955
1963
  className: "services-information-container " + (imageLayout && state.active_tab === "Imágenes" ? "image-services" : ""),
1956
1964
  children: state.saving ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1957
- children: [state.active_tab === "Descripción" && (((_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1965
+ children: [state.active_tab === "Descripción" && (((_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.description_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1958
1966
  activeSection: state.active_tab,
1959
1967
  inputGroup: state.descriptions_inputs[0],
1960
1968
  updatedDescriptions: state.updated_descriptions_inputs,
1961
- articleId: (_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.id_article,
1969
+ articleId: (_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.id_article,
1962
1970
  version: state.product.version,
1963
1971
  auditInputGroup: auditDescriptions[0],
1964
1972
  setUpdatedDescriptions: handleOnSetUpdatedDescriptions,
@@ -1967,7 +1975,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1967
1975
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1968
1976
  text: "No cuentas con este servicio",
1969
1977
  headerType: "input-name-header"
1970
- })), state.active_tab === "Ficha técnica" && (((_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
1978
+ })), state.active_tab === "Ficha técnica" && (((_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.datasheet_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {
1971
1979
  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) {
1972
1980
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
1973
1981
  articleId: state.product.id_article,
@@ -1984,7 +1992,7 @@ var RetailerProductEditionView = function RetailerProductEditionView(_ref) {
1984
1992
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
1985
1993
  text: "No cuentas con este servicio",
1986
1994
  headerType: "input-name-header"
1987
- })), state.active_tab === "Imágenes" && (((_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : _state$product10.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1995
+ })), state.active_tab === "Imágenes" && (((_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.images_status) !== "NS" ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1988
1996
  children: [!imageLayout && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1989
1997
  checkAll: state.all_image_checked // Determina si el checkbox "Seleccionar todo" está marcado
1990
1998
  ,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.5.87",
3
+ "version": "21.5.89",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -18,79 +18,139 @@ RetailerProductEditionDefault.args = {
18
18
  token:
19
19
  "eyJraWQiOiJEV3owZnNieXg2MXNFcVduN3RCXC81bVhod3ZNbFZIOTgwUnZcL3RjT0lKdEk9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI4ZDAxMDIxNC01YmZhLTQzYzMtOTZmYi1jNTU2ZGMwNTc3NGIiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfbFN6UVo0WjdSIiwiY29nbml0bzp1c2VybmFtZSI6IjhkMDEwMjE0LTViZmEtNDNjMy05NmZiLWM1NTZkYzA1Nzc0YiIsImF1ZCI6IjUyZDlza2tkY2c4cWpwODhvb2sxdXNlNm1rIiwiZXZlbnRfaWQiOiI1MDgwMTVmMy1mZGVkLTQ2ODUtYTIxNy1mYzgyMTg0ZWRmNGMiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTc2ODI1MzE3NywibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTc2ODI1Njc3NywiaWF0IjoxNzY4MjUzMTc3LCJlbWFpbCI6ImthcmFmZTMyMThAbW9tMmtpZC5jb20ifQ.QiZiscuTvrur0g328Zmh2bI-kZyg7YO_T5jT63096JNuSxGnX9wpK87cVTV1dED4ruD-2NMsgLShUIMcklAg17FL6i5_vCuB1dSIDY0LaybvSpriFJaVVdMUIMGFi_1Q7bI9qqyXYkevcf-HO33vVPdU-_-4-u8YRd-QganUk35vPYPh9vFJWbC0Qtvv25ZR4L2xuRIXx4e7StlTvZXysnYL8A84jkK1zn6d77V-9GqQQW8exO6sBW7R6cGt55vnF80NIfG_9lAqCK0PcZH4o50aqrAVhtfV5edlEmXBHeGK5R3Sz5iTeKb51QF3TWVFZCYGvQJ7FShulUWHcm3X2Q",
20
20
  productSelected: {
21
- "articleId": 145186,
21
+ "articleId": 145199,
22
22
  "services": {
23
23
  "datasheets": 1,
24
24
  "descriptions": 1,
25
- "images": 1
25
+ "images": 0
26
26
  },
27
- "orderId": 10449,
27
+ "orderId": 10457,
28
28
  "city": "CDMX, México",
29
29
  "status": "AS",
30
- "datasheet_status": "AC",
30
+ "datasheet_status": "AS",
31
31
  "prio": "none",
32
32
  "version": 3,
33
33
  "description_status": "AS",
34
- "images_status": "AC",
34
+ "images_status": "NS",
35
35
  "statusByRetailer": [
36
36
  {
37
- "status": "AC",
37
+ "status": "AS",
38
38
  "service": "datasheet",
39
- "retailer_id": 70,
40
- "task_user_group_id": 4
39
+ "retailer_id": 9,
40
+ "task_user_group_id": 2
41
41
  },
42
42
  {
43
43
  "status": "AS",
44
44
  "service": "description",
45
- "retailer_id": 70,
45
+ "retailer_id": 9,
46
+ "task_user_group_id": 2
47
+ },
48
+ {
49
+ "status": "AS",
50
+ "service": "datasheet",
51
+ "retailer_id": 19,
46
52
  "task_user_group_id": 2
47
53
  },
48
54
  {
49
- "status": "AC",
50
- "service": "images",
51
- "retailer_id": 70,
52
- "task_user_group_id": 4
55
+ "status": "AS",
56
+ "service": "description",
57
+ "retailer_id": 19,
58
+ "task_user_group_id": 2
59
+ },
60
+ {
61
+ "status": "AS",
62
+ "service": "datasheet",
63
+ "retailer_id": 24,
64
+ "task_user_group_id": 2
65
+ },
66
+ {
67
+ "status": "AS",
68
+ "service": "description",
69
+ "retailer_id": 24,
70
+ "task_user_group_id": 2
71
+ },
72
+ {
73
+ "status": "AS",
74
+ "service": "datasheet",
75
+ "retailer_id": 1011,
76
+ "task_user_group_id": 2
77
+ },
78
+ {
79
+ "status": "AS",
80
+ "service": "description",
81
+ "retailer_id": 1011,
82
+ "task_user_group_id": 2
53
83
  }
54
84
  ],
55
85
  "article": {
56
- "id_article": 145186,
57
- "id_category": "4007",
86
+ "id_article": 145199,
87
+ "id_category": "10001",
58
88
  "brand": null,
59
- "name": "Mayonesa",
60
- "upc": "098928",
61
- "sku": "899",
62
- "timestamp": "2026-04-23T16:02:14.000Z",
89
+ "name": "Serna Status Bug 4",
90
+ "upc": "14615181351",
91
+ "sku": "156845131",
92
+ "timestamp": "2026-05-05T15:08:54.000Z",
63
93
  "active": 1,
64
94
  "company_id": 291,
65
95
  "company_name": "LATAM LOGISTICS",
66
96
  "country": "México",
67
- "id_order": 10449,
97
+ "id_order": 10457,
68
98
  "id_datasheet_especialist": 426,
69
99
  "id_datasheet_facilitator": null,
70
100
  "id_description_especialist": 426,
71
101
  "id_description_facilitator": null,
72
- "id_images_especialist": 427,
102
+ "id_images_especialist": null,
73
103
  "id_images_facilitator": null,
74
104
  "id_auditor": 425,
75
105
  "id_recepcionist": null,
76
- "category": "Abarrotes Procesados|Abarrotes Básicos y Procesados|Abarrotes Básicos y Procesados",
106
+ "category": "Departamento Hanseatik|Categoría Hanseatik|Subcategoría Hanseatik",
77
107
  "categoryRetailer": [
78
108
  {
79
- "id_category": 4007,
80
- "id_retailer": 70,
81
- "category_name": "Abarrotes Procesados|Abarrotes Básicos y Procesados|Abarrotes Básicos y Procesados",
82
- "retailer_name": "Bodega Aurrera"
109
+ "id_category": 3432,
110
+ "id_retailer": 24,
111
+ "category_name": "Bebés Alsuper|Bebés|Bebés",
112
+ "retailer_name": "Alsuper"
113
+ },
114
+ {
115
+ "id_category": 3579,
116
+ "id_retailer": 1011,
117
+ "category_name": "Categoría Genérica Farmatodo|Categoría Genérica|Categoría Genérica",
118
+ "retailer_name": "Farmatodo"
119
+ },
120
+ {
121
+ "id_category": 6795,
122
+ "id_retailer": 19,
123
+ "category_name": "Categoría Generica Costco|Categoría Generica|Categoría Generica",
124
+ "retailer_name": "Costco"
125
+ },
126
+ {
127
+ "id_category": 10001,
128
+ "id_retailer": 9,
129
+ "category_name": "Departamento Hanseatik|Categoría Hanseatik|Subcategoría Hanseatik",
130
+ "retailer_name": "Amazon"
83
131
  }
84
132
  ]
85
133
  },
86
134
  "retailers": [
87
135
  {
88
- "id": 70,
89
- "name": "Bodega Aurrera"
136
+ "id": 9,
137
+ "name": "Amazon"
138
+ },
139
+ {
140
+ "id": 19,
141
+ "name": "Costco"
142
+ },
143
+ {
144
+ "id": 24,
145
+ "name": "Alsuper"
146
+ },
147
+ {
148
+ "id": 1011,
149
+ "name": "Farmatodo"
90
150
  }
91
151
  ],
92
152
  "country": "México",
93
- "upc": "098928"
153
+ "upc": "14615181351"
94
154
  },
95
155
 
96
156
  // location: {
@@ -103,41 +163,41 @@ RetailerProductEditionDefault.args = {
103
163
 
104
164
  // EDICION IMAGENES
105
165
 
106
- user: {
107
- "id_user": 427,
108
- "name": "Especialista Edición",
109
- "last_name": null,
110
- "email": "kikije1467@mtlcz.com",
111
- "position": "Tester",
112
- "telephone": null,
113
- "country": null,
114
- "id_company": 254,
115
- "id_cognito": "c7e5a6a4-2b3f-4d54-af98-9e09a4cbc01e",
116
- "birth_Date": null,
117
- "about_me": null,
118
- "zip_code": null,
119
- "address": null,
120
- "job": null,
121
- "id_stripe": null,
122
- "id_role": 8,
123
- "active": 1,
124
- "is_retailer": 0,
125
- "email_notify": null,
126
- "is_user_tech": null,
127
- "is_onboarding": 0,
128
- "membership": {
129
- "id": 750,
130
- "start_date": "2022-01-07T21:32:54.000Z",
131
- "end_date": "2023-01-07T21:32:54.000Z",
132
- "planID": 6,
133
- "plan": "prod_KvGd6YSTJyR3AP",
134
- "name": "Plan Small",
135
- "user_limit": "10",
136
- "products_limit": "1000",
137
- "type": "Enterprise"
138
- },
139
- "src": "https://content-management-profile-prod.s3.amazonaws.com/id-427/427.png?1775592220312"
140
- },
166
+ // user: {
167
+ // "id_user": 427,
168
+ // "name": "Especialista Edición",
169
+ // "last_name": null,
170
+ // "email": "kikije1467@mtlcz.com",
171
+ // "position": "Tester",
172
+ // "telephone": null,
173
+ // "country": null,
174
+ // "id_company": 254,
175
+ // "id_cognito": "c7e5a6a4-2b3f-4d54-af98-9e09a4cbc01e",
176
+ // "birth_Date": null,
177
+ // "about_me": null,
178
+ // "zip_code": null,
179
+ // "address": null,
180
+ // "job": null,
181
+ // "id_stripe": null,
182
+ // "id_role": 8,
183
+ // "active": 1,
184
+ // "is_retailer": 0,
185
+ // "email_notify": null,
186
+ // "is_user_tech": null,
187
+ // "is_onboarding": 0,
188
+ // "membership": {
189
+ // "id": 750,
190
+ // "start_date": "2022-01-07T21:32:54.000Z",
191
+ // "end_date": "2023-01-07T21:32:54.000Z",
192
+ // "planID": 6,
193
+ // "plan": "prod_KvGd6YSTJyR3AP",
194
+ // "name": "Plan Small",
195
+ // "user_limit": "10",
196
+ // "products_limit": "1000",
197
+ // "type": "Enterprise"
198
+ // },
199
+ // "src": "https://content-management-profile-prod.s3.amazonaws.com/id-427/427.png?1775592220312"
200
+ // },
141
201
 
142
202
  //TEXTOS
143
203
 
@@ -213,4 +273,43 @@ user: {
213
273
  // },
214
274
  // src: "https://content-management-profile-prod.s3.amazonaws.com/id-426/426.png?1768253179478",
215
275
  // },
276
+
277
+ // AUDITORES
278
+
279
+ user: {
280
+ "id_user": 423,
281
+ "name": "Facilitador Textos",
282
+ "last_name": null,
283
+ "email": "bayadi1538@mnqlm.com",
284
+ "position": "Tester",
285
+ "telephone": null,
286
+ "country": null,
287
+ "id_company": 254,
288
+ "id_cognito": "0b66a4a9-7790-4034-a30a-c00808962867",
289
+ "birth_Date": null,
290
+ "about_me": null,
291
+ "zip_code": null,
292
+ "address": null,
293
+ "job": null,
294
+ "id_stripe": null,
295
+ "id_role": 4,
296
+ "active": 1,
297
+ "is_retailer": 0,
298
+ "email_notify": null,
299
+ "is_user_tech": null,
300
+ "is_onboarding": 0,
301
+ "membership": {
302
+ "id": 750,
303
+ "start_date": "2022-01-07T21:32:54.000Z",
304
+ "end_date": "2023-01-07T21:32:54.000Z",
305
+ "planID": 6,
306
+ "plan": "prod_KvGd6YSTJyR3AP",
307
+ "name": "Plan Small",
308
+ "user_limit": "10",
309
+ "products_limit": "1000",
310
+ "type": "Enterprise"
311
+ },
312
+ "src": "https://content-management-profile-prod.s3.amazonaws.com/id-423/423.png?1778003423713"
313
+ }
314
+
216
315
  };
@@ -44,19 +44,19 @@ export const productReducer = (state, action) => {
44
44
  (status) =>
45
45
  status?.service === "description" &&
46
46
  status?.retailer_id === state?.active_retailer?.id_retailer,
47
- ).status || "NS",
47
+ )?.status || "NS",
48
48
  datasheet_status:
49
49
  action.payload.find(
50
50
  (status) =>
51
51
  status?.service === "datasheet" &&
52
52
  status?.retailer_id === state?.active_retailer?.id_retailer,
53
- ).status || "NS",
53
+ )?.status || "NS",
54
54
  images_status:
55
55
  action.payload.find(
56
56
  (status) =>
57
57
  status?.service === "images" &&
58
58
  status?.retailer_id === state?.active_retailer?.id_retailer,
59
- ).status || "NS",
59
+ )?.status || "NS",
60
60
  statusByRetailer: action.payload,
61
61
  },
62
62
  };
@@ -110,5 +110,5 @@ function getMinorStatus(servicesStatus = []) {
110
110
  return currentObj.weight < minorObj.weight ? currentObj : minorObj;
111
111
  }, servicesStatus[0] || STATUS_DICTIONARY.NS);
112
112
 
113
- return winner?.status || STATUS_DICTIONARY.NS.status;
113
+ return winner?.status || STATUS_DICTIONARY.NS?.status;
114
114
  }
@@ -526,7 +526,7 @@ const RetailerProductEditionView = ({
526
526
  };
527
527
 
528
528
  const isAuditorAssigned = () => {
529
- return state.product.id_auditor === user.id_user;
529
+ return state.product?.id_auditor === user?.id_user;
530
530
  };
531
531
 
532
532
  const isUserAssignedToService = (tab, rol) => {
@@ -545,7 +545,7 @@ const RetailerProductEditionView = ({
545
545
  }
546
546
 
547
547
  const isAdmin = user.id_role === 1;
548
- const idUserAssigned = state.product[`id_${concept}_${rol}`];
548
+ const idUserAssigned = state.product?.[`id_${concept}_${rol}`];
549
549
  const isAssigned = idUserAssigned === user.id_user;
550
550
 
551
551
  return isAdmin || (isAssigned && validUser);
@@ -555,7 +555,7 @@ const RetailerProductEditionView = ({
555
555
  let concept = getConceptByTab(action || state.active_tab);
556
556
 
557
557
  const retailerStatus = state.services_data
558
- .find(
558
+ ?.find(
559
559
  (srv) =>
560
560
  srv.id_retailer === state.active_retailer?.id_retailer &&
561
561
  srv.service === concept,
@@ -567,6 +567,7 @@ const RetailerProductEditionView = ({
567
567
  const adminAuditorCanEvaluate =
568
568
  ["AC", "RP", "RCA", "SAC"].includes(retailerStatus) &&
569
569
  [1, 6].includes(user.id_role);
570
+
570
571
  return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
571
572
  };
572
573
 
@@ -696,9 +697,11 @@ const RetailerProductEditionView = ({
696
697
 
697
698
  const sendSingleEvaluation = async (result) => {
698
699
  if (state.saving) return;
700
+
699
701
  dispatch({ type: "SET_SAVING", payload: true });
700
702
 
701
703
  const concept = getConceptByTab(state.active_tab);
704
+
702
705
  const articleId = state.product.id_article;
703
706
  const orderId = state.product.id_order ?? state.product.orderId;
704
707
  const sectionStatusKey = `${concept}_status`;
@@ -713,6 +716,7 @@ const RetailerProductEditionView = ({
713
716
  const activeTab = state.active_tab;
714
717
 
715
718
  try {
719
+ //Esto solo se ejecutará cuando se aprueba o rechaza desde el modal superior derecho
716
720
  if (result) {
717
721
  data.result = result;
718
722
  data.retailerId = retailerId;
@@ -757,7 +761,10 @@ const RetailerProductEditionView = ({
757
761
  image: successIcon,
758
762
  },
759
763
  });
760
- } else {
764
+ } else { //Caso del botón "Enviar evaluación"
765
+
766
+ //Se construye el mensaje y se actualiza el estatus
767
+
761
768
  const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
762
769
 
763
770
  if (specialistDone) {
@@ -772,39 +779,41 @@ const RetailerProductEditionView = ({
772
779
  message = "Evaluación enviada";
773
780
  icon = successIcon;
774
781
  }
782
+
775
783
  res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
776
784
  headers: {
777
785
  Authorization: token,
778
786
  },
779
787
  });
780
788
  }
789
+
781
790
  if (res.data.statusCode === 200) {
782
- const { newStatus, newOrderStatus, newArticleStatus } = JSON.parse(
783
- res.data.body,
784
- );
785
- const retailers = state.product.categoryRetailer.map((r) => ({
786
- id: r.id_retailer,
787
- name: r.retailerName,
788
- }));
789
- const messageToChat = createMessage(
790
- retailers,
791
- retailerId,
792
- evalStatus,
793
- newStatus,
794
- activeTab,
795
- );
796
791
 
797
- const messageData = {
798
- paramsBody: {
799
- id: articleId,
800
- version: state.product.version,
801
- items: [{ type: "status", value: messageToChat }],
802
- retailerId: retailerId,
803
- status: state.product.status,
804
- },
805
- paramsHeader: { Authorization: token },
806
- };
807
- await sendMessage(messageData);
792
+ const { newStatus, newOrderStatus, newArticleStatus } = JSON.parse( res.data.body );
793
+
794
+ // const retailers = state.product.categoryRetailer.map((r) => ({
795
+ // id: r.id_retailer,
796
+ // name: r.retailerName,
797
+ // }));
798
+ // const messageToChat = createMessage(
799
+ // retailers,
800
+ // retailerId,
801
+ // evalStatus,
802
+ // newStatus,
803
+ // activeTab,
804
+ // );
805
+
806
+ // const messageData = {
807
+ // paramsBody: {
808
+ // id: articleId,
809
+ // version: state.product.version,
810
+ // items: [{ type: "status", value: messageToChat }],
811
+ // retailerId: retailerId,
812
+ // status: state.product.status,
813
+ // },
814
+ // paramsHeader: { Authorization: token },
815
+ // };
816
+ // await sendMessage(messageData);
808
817
 
809
818
  const updatedProduct = {
810
819
  ...state.product,
@@ -818,7 +827,15 @@ const RetailerProductEditionView = ({
818
827
  }),
819
828
  };
820
829
 
830
+ //Actualizamos el services_data en el servicio específico del retailer actual
831
+
832
+ const updatedServicesData = state.services_data?.map(service => ({
833
+ ...service,
834
+ status: service?.id_retailer === retailerId && service?.service === concept ? newStatus : service?.status
835
+ }));
836
+
821
837
  const sessionProduct = sessionStorage.getItem("productSelected");
838
+
822
839
  if (sessionProduct) {
823
840
  const productInSession = JSON.parse(sessionProduct);
824
841
  const updatedProductInSession = {
@@ -850,6 +867,7 @@ const RetailerProductEditionView = ({
850
867
  }
851
868
 
852
869
  dispatch({ type: "SET_PRODUCT", payload: updatedProduct });
870
+ dispatch({ type: "SET_SERVICES_DATA", payload: updatedServicesData });
853
871
  }
854
872
  } catch (error) {
855
873
  console.error("Error sending evaluation:", error);
@@ -1097,6 +1115,7 @@ const RetailerProductEditionView = ({
1097
1115
  switch (id_rol) {
1098
1116
  case 7:
1099
1117
  case 8:
1118
+
1100
1119
  const conditionOne = statusArray.includes(statusByActiveService);
1101
1120
  const conditionTwo = statusArray.includes(product?.status);
1102
1121
  const conditionThree =
@@ -1105,10 +1124,11 @@ const RetailerProductEditionView = ({
1105
1124
  ).length === servicesByTab.length;
1106
1125
 
1107
1126
  return (conditionOne && conditionTwo) || conditionThree;
1127
+
1108
1128
  case 4:
1109
1129
  case 5:
1110
1130
  const filteredSrv45 = servicesByTab?.filter((serv) =>
1111
- statusArray.includes(serv.status),
1131
+ statusArray.includes(serv?.status),
1112
1132
  );
1113
1133
  const condition45 =
1114
1134
  unvalidated &&
@@ -1118,7 +1138,7 @@ const RetailerProductEditionView = ({
1118
1138
  case 6:
1119
1139
  const statusInArray = statusArray.includes(product?.status);
1120
1140
  const allSrvValid = srv?.every((serv) =>
1121
- ["RA", "AA", "AP", "ACA"].includes(serv.status),
1141
+ ["RA", "AA", "AP", "ACA"].includes(serv?.status),
1122
1142
  );
1123
1143
  const condition6 = statusInArray && allSrvValid && auditorUnvalidated;
1124
1144
  return condition6;