contentoh-components-library 21.0.62 → 21.0.63
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.
|
@@ -82,10 +82,9 @@ var InputFormatter = function InputFormatter(_ref) {
|
|
|
82
82
|
|
|
83
83
|
try {
|
|
84
84
|
if (h.getLength() - 1 <= maxLength) {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
value = valueInput;
|
|
85
|
+
var unformattedText = valueInput.replace(/<li.*?>/gm, " - ").replace(/<\/li>/gm, "\n").replace(/<\/p><p>/gm, "\n").replaceAll(/<\/?(?!\/?strong).*?>/gm, "");
|
|
86
|
+
setInputValue(valueInput);
|
|
87
|
+
value = unformattedText;
|
|
89
88
|
} else {
|
|
90
89
|
quillState.deleteText(maxLength, quillState.getLength());
|
|
91
90
|
setInputValue(function (val) {
|
|
@@ -41,26 +41,26 @@ RetailerProductEditionDefault.args = {
|
|
|
41
41
|
descriptions: 1,
|
|
42
42
|
images: 1
|
|
43
43
|
},
|
|
44
|
-
orderId:
|
|
45
|
-
status: "
|
|
46
|
-
datasheet_status: "
|
|
44
|
+
orderId: 152,
|
|
45
|
+
status: "ASSIGNED",
|
|
46
|
+
datasheet_status: "IN_PROGRESS",
|
|
47
47
|
prio: "none",
|
|
48
|
-
version:
|
|
49
|
-
description_status: "
|
|
50
|
-
images_status: "
|
|
48
|
+
version: 3,
|
|
49
|
+
description_status: "IN_PROGRESS",
|
|
50
|
+
images_status: "IN_PROGRESS",
|
|
51
51
|
article: {
|
|
52
|
-
id_article:
|
|
53
|
-
id_category: "
|
|
54
|
-
name: "
|
|
55
|
-
upc: "
|
|
56
|
-
timestamp: "2022-
|
|
52
|
+
id_article: 343,
|
|
53
|
+
id_category: "2898",
|
|
54
|
+
name: "Producto prueba dos ",
|
|
55
|
+
upc: "2004202212",
|
|
56
|
+
timestamp: "2022-04-20T17:01:17.000Z",
|
|
57
57
|
id_user: 28,
|
|
58
58
|
status: "NULL",
|
|
59
59
|
active: 1,
|
|
60
60
|
company_id: 1,
|
|
61
61
|
company_name: "COMPANY DEV",
|
|
62
|
-
country: "
|
|
63
|
-
id_order:
|
|
62
|
+
country: "México",
|
|
63
|
+
id_order: 152,
|
|
64
64
|
id_datasheet_especialist: 54,
|
|
65
65
|
id_datasheet_facilitator: 52,
|
|
66
66
|
id_description_especialist: 54,
|
|
@@ -69,62 +69,44 @@ RetailerProductEditionDefault.args = {
|
|
|
69
69
|
id_images_facilitator: 53,
|
|
70
70
|
id_auditor: 30,
|
|
71
71
|
id_recepcionist: null,
|
|
72
|
-
category: "
|
|
73
|
-
missingAttributes:
|
|
74
|
-
missingDescriptions:
|
|
75
|
-
missingImages:
|
|
72
|
+
category: "HALLOWEN|DECORACIÓN E INFLABLES|DECORACIÓN E INFLABLES",
|
|
73
|
+
missingAttributes: null,
|
|
74
|
+
missingDescriptions: null,
|
|
75
|
+
missingImages: null
|
|
76
76
|
},
|
|
77
77
|
retailers: [{
|
|
78
|
-
id:
|
|
79
|
-
name: "
|
|
80
|
-
country: "México",
|
|
81
|
-
id_region: 1,
|
|
82
|
-
active: 1
|
|
83
|
-
}, {
|
|
84
|
-
id: 5,
|
|
85
|
-
name: "Chedraui",
|
|
86
|
-
country: "México",
|
|
87
|
-
id_region: 1,
|
|
88
|
-
active: 1
|
|
89
|
-
}, {
|
|
90
|
-
id: 9,
|
|
91
|
-
name: "Amazon",
|
|
92
|
-
country: "México",
|
|
93
|
-
id_region: 1,
|
|
94
|
-
active: 1
|
|
95
|
-
}, {
|
|
96
|
-
id: 12,
|
|
97
|
-
name: "La Comer",
|
|
98
|
-
country: "México",
|
|
99
|
-
id_region: 1,
|
|
100
|
-
active: 1
|
|
101
|
-
}, {
|
|
102
|
-
id: 20,
|
|
103
|
-
name: "Cornershop",
|
|
78
|
+
id: 58,
|
|
79
|
+
name: "The Home Depot",
|
|
104
80
|
country: "México",
|
|
105
81
|
id_region: 1,
|
|
106
82
|
active: 1
|
|
107
83
|
}],
|
|
108
|
-
country: "
|
|
109
|
-
upc: "
|
|
84
|
+
country: "México",
|
|
85
|
+
upc: "2004202212"
|
|
86
|
+
},
|
|
87
|
+
location: {
|
|
88
|
+
product: {
|
|
89
|
+
articleId: 109485,
|
|
90
|
+
versionId: 3
|
|
91
|
+
}
|
|
110
92
|
},
|
|
111
93
|
user: {
|
|
112
|
-
id_user:
|
|
113
|
-
name: "
|
|
114
|
-
last_name: "
|
|
115
|
-
email: "
|
|
116
|
-
position:
|
|
94
|
+
id_user: 54,
|
|
95
|
+
name: "ESPECIALISTA TXTS PRUEBA",
|
|
96
|
+
last_name: "",
|
|
97
|
+
email: "rlegorreta@contentoh.com",
|
|
98
|
+
position: null,
|
|
117
99
|
telephone: null,
|
|
118
|
-
country:
|
|
100
|
+
country: null,
|
|
119
101
|
id_company: 2,
|
|
120
|
-
id_cognito: "
|
|
102
|
+
id_cognito: "ca1d24ab-e992-4c19-b4e1-2fe6f720c16b",
|
|
121
103
|
birth_Date: null,
|
|
122
104
|
about_me: null,
|
|
123
105
|
zip_code: null,
|
|
124
106
|
address: null,
|
|
125
107
|
job: null,
|
|
126
108
|
id_stripe: null,
|
|
127
|
-
id_role:
|
|
109
|
+
id_role: 7,
|
|
128
110
|
active: 1,
|
|
129
111
|
is_retailer: 0,
|
|
130
112
|
membership: {
|
|
@@ -138,6 +120,6 @@ RetailerProductEditionDefault.args = {
|
|
|
138
120
|
products_limit: "3",
|
|
139
121
|
type: "PyMES"
|
|
140
122
|
},
|
|
141
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
123
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-54/54.png?1653425316222"
|
|
142
124
|
}
|
|
143
125
|
};
|
|
@@ -123,13 +123,15 @@ var myBucket = new _awsSdk.default.S3({
|
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
126
|
-
var
|
|
126
|
+
var _product$retailers, _product$services5, _datasheets$, _datasheets$$data, _product$article13;
|
|
127
127
|
|
|
128
128
|
var tabsSections = _ref.tabsSections,
|
|
129
129
|
_ref$productSelected = _ref.productSelected,
|
|
130
130
|
productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
|
|
131
131
|
_ref$user = _ref.user,
|
|
132
132
|
user = _ref$user === void 0 ? {} : _ref$user,
|
|
133
|
+
_ref$location = _ref.location,
|
|
134
|
+
location = _ref$location === void 0 ? {} : _ref$location,
|
|
133
135
|
token = _ref.token;
|
|
134
136
|
|
|
135
137
|
var _useState = (0, _react.useState)("Descripción"),
|
|
@@ -252,7 +254,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
252
254
|
dataImages = _useState22[0],
|
|
253
255
|
setDataImages = _useState22[1];
|
|
254
256
|
|
|
255
|
-
var _useState23 = (0, _react.useState)(new Array(
|
|
257
|
+
var _useState23 = (0, _react.useState)(new Array(product === null || product === void 0 ? void 0 : (_product$retailers = product.retailers) === null || _product$retailers === void 0 ? void 0 : _product$retailers.length).fill({
|
|
256
258
|
percentage: 0
|
|
257
259
|
})),
|
|
258
260
|
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
@@ -264,7 +266,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
264
266
|
activePercentage = _useState26[0],
|
|
265
267
|
setActivePercentage = _useState26[1];
|
|
266
268
|
|
|
267
|
-
var _useState27 = (0, _react.useState)(
|
|
269
|
+
var _useState27 = (0, _react.useState)({}),
|
|
268
270
|
_useState28 = (0, _slicedToArray2.default)(_useState27, 2),
|
|
269
271
|
activeRetailer = _useState28[0],
|
|
270
272
|
setActiveRetailer = _useState28[1];
|
|
@@ -294,7 +296,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
294
296
|
icon = _useState38[0],
|
|
295
297
|
setIcon = _useState38[1];
|
|
296
298
|
|
|
297
|
-
var _useState39 = (0, _react.useState)(
|
|
299
|
+
var _useState39 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
|
|
298
300
|
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
299
301
|
version = _useState40[0],
|
|
300
302
|
setVersion = _useState40[1];
|
|
@@ -371,7 +373,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
371
373
|
|
|
372
374
|
var loadData = /*#__PURE__*/function () {
|
|
373
375
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
374
|
-
var
|
|
376
|
+
var _product$article, _product$article2, _services$, _services$$values;
|
|
375
377
|
|
|
376
378
|
var services;
|
|
377
379
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
@@ -379,26 +381,27 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
379
381
|
switch (_context2.prev = _context2.next) {
|
|
380
382
|
case 0:
|
|
381
383
|
_context2.next = 2;
|
|
382
|
-
return (0, _data2.getRetailerServices)(
|
|
384
|
+
return (0, _data2.getRetailerServices)(product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article, parseInt(product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.id_category), product === null || product === void 0 ? void 0 : product.version);
|
|
383
385
|
|
|
384
386
|
case 2:
|
|
385
387
|
services = _context2.sent;
|
|
386
388
|
//Converts the data inside the datasheets object to array
|
|
387
|
-
setServices(services); //setActiveRetailer(
|
|
389
|
+
setServices(services); //setActiveRetailer(product?.retailers[0]);
|
|
388
390
|
|
|
389
391
|
setImages({
|
|
390
392
|
action: "init",
|
|
391
393
|
init: services[2]
|
|
392
394
|
});
|
|
393
395
|
if (((_services$ = services[2]) === null || _services$ === void 0 ? void 0 : (_services$$values = _services$.values) === null || _services$$values === void 0 ? void 0 : _services$$values.length) > 0) setActiveImage(0);
|
|
396
|
+
setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
|
|
394
397
|
(0, _data2.getPercentage)({
|
|
395
|
-
data: [
|
|
398
|
+
data: [product]
|
|
396
399
|
}).then(function (res) {
|
|
397
400
|
return setPercentages(res);
|
|
398
401
|
});
|
|
399
402
|
setLoading(false);
|
|
400
403
|
|
|
401
|
-
case
|
|
404
|
+
case 9:
|
|
402
405
|
case "end":
|
|
403
406
|
return _context2.stop();
|
|
404
407
|
}
|
|
@@ -413,7 +416,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
413
416
|
|
|
414
417
|
var getServices = /*#__PURE__*/function () {
|
|
415
418
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
416
|
-
var _product$
|
|
419
|
+
var _product$article3, _product$article4, _servicesResponse$dat;
|
|
417
420
|
|
|
418
421
|
var servicesResponse, parsedResponse;
|
|
419
422
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
@@ -421,7 +424,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
421
424
|
switch (_context3.prev = _context3.next) {
|
|
422
425
|
case 0:
|
|
423
426
|
_context3.next = 2;
|
|
424
|
-
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$
|
|
427
|
+
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_article, "&orderId=").concat(product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_order, "&end=true"));
|
|
425
428
|
|
|
426
429
|
case 2:
|
|
427
430
|
servicesResponse = _context3.sent;
|
|
@@ -457,7 +460,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
457
460
|
|
|
458
461
|
var getComments = /*#__PURE__*/function () {
|
|
459
462
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
460
|
-
var
|
|
463
|
+
var _product$article5, _product$article6, _product$article7;
|
|
461
464
|
|
|
462
465
|
var tab,
|
|
463
466
|
commentsResponse,
|
|
@@ -469,7 +472,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
469
472
|
case 0:
|
|
470
473
|
tab = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "Descripción";
|
|
471
474
|
_context4.next = 3;
|
|
472
|
-
return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(
|
|
475
|
+
return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.id_article, "&concept=description&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_article, "&concept=datasheet&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article7 = product.article) === null || _product$article7 === void 0 ? void 0 : _product$article7.id_article, "&concept=images&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version))]);
|
|
473
476
|
|
|
474
477
|
case 3:
|
|
475
478
|
commentsResponse = _context4.sent;
|
|
@@ -501,7 +504,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
501
504
|
while (1) {
|
|
502
505
|
switch (_context5.prev = _context5.next) {
|
|
503
506
|
case 0:
|
|
504
|
-
loadData(); // getPercentage({ data: [
|
|
507
|
+
loadData(); // getPercentage({ data: [product] }).then((res) =>
|
|
505
508
|
// setPercentages(res)
|
|
506
509
|
// );
|
|
507
510
|
|
|
@@ -544,7 +547,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
544
547
|
}
|
|
545
548
|
}
|
|
546
549
|
}, _callee5);
|
|
547
|
-
})), []);
|
|
550
|
+
})), [product]);
|
|
548
551
|
|
|
549
552
|
var loadAssignations = function loadAssignations(currentProduct) {
|
|
550
553
|
var _currentProduct$artic, _currentProduct$artic2, _currentProduct$artic3, _currentProduct$artic4, _currentProduct$artic5, _currentProduct$artic6;
|
|
@@ -593,25 +596,25 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
593
596
|
};
|
|
594
597
|
|
|
595
598
|
(0, _react.useEffect)(function () {
|
|
596
|
-
loadAssignations(
|
|
599
|
+
loadAssignations(product);
|
|
597
600
|
}, [userGroups]);
|
|
598
601
|
(0, _react.useEffect)(function () {
|
|
599
|
-
var
|
|
602
|
+
var _product$retailers2, _product$retailers$;
|
|
600
603
|
|
|
601
|
-
|
|
604
|
+
product === null || product === void 0 ? void 0 : (_product$retailers2 = product.retailers) === null || _product$retailers2 === void 0 ? void 0 : _product$retailers2.forEach(function (retailer) {
|
|
602
605
|
var _percentages$filter$;
|
|
603
606
|
|
|
604
607
|
retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$filter$ = percentages.filter(function (percent) {
|
|
605
608
|
return (retailer === null || retailer === void 0 ? void 0 : retailer.id) === (percent === null || percent === void 0 ? void 0 : percent.id_retailer);
|
|
606
609
|
})[0]) === null || _percentages$filter$ === void 0 ? void 0 : _percentages$filter$.percentage;
|
|
607
610
|
});
|
|
608
|
-
setActivePercentage(
|
|
611
|
+
setActivePercentage(product === null || product === void 0 ? void 0 : (_product$retailers$ = product.retailers[0]) === null || _product$retailers$ === void 0 ? void 0 : _product$retailers$.percentage);
|
|
609
612
|
}, [percentages]);
|
|
610
613
|
(0, _react.useEffect)(function () {
|
|
611
614
|
if (services.length > 0) {
|
|
612
|
-
var _services$2, _services$3;
|
|
615
|
+
var _services$0$activeRet, _services$2, _services$3;
|
|
613
616
|
|
|
614
|
-
if (services[0][activeRetailer.id].data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
|
|
617
|
+
if ((_services$0$activeRet = services[0][activeRetailer.id]) !== null && _services$0$activeRet !== void 0 && _services$0$activeRet.data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
|
|
615
618
|
setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
|
|
616
619
|
var datagroups = services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id];
|
|
617
620
|
var inputs = (_services$2 = services[0]) === null || _services$2 === void 0 ? void 0 : _services$2.inputs;
|
|
@@ -666,44 +669,51 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
666
669
|
|
|
667
670
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
668
671
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
669
|
-
var
|
|
672
|
+
var _product$article8;
|
|
670
673
|
|
|
671
|
-
var dataObject;
|
|
674
|
+
var productTemp, dataObject;
|
|
672
675
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
673
676
|
while (1) {
|
|
674
677
|
switch (_context6.prev = _context6.next) {
|
|
675
678
|
case 0:
|
|
676
679
|
setLoading(true);
|
|
680
|
+
productTemp = product;
|
|
677
681
|
dataObject = {
|
|
678
|
-
articleId:
|
|
682
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article8 = product.article) === null || _product$article8 === void 0 ? void 0 : _product$article8.id_article,
|
|
679
683
|
articleData: updatedDescriptions
|
|
680
684
|
};
|
|
681
|
-
if (
|
|
682
|
-
_context6.prev =
|
|
683
|
-
_context6.next =
|
|
685
|
+
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
686
|
+
_context6.prev = 4;
|
|
687
|
+
_context6.next = 7;
|
|
684
688
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
685
689
|
headers: {
|
|
686
690
|
Authorization: token
|
|
687
691
|
}
|
|
688
692
|
});
|
|
689
693
|
|
|
690
|
-
case
|
|
694
|
+
case 7:
|
|
695
|
+
if (productTemp.status === "ASSIGNED") {
|
|
696
|
+
productTemp.status = "IN_PROGRESS";
|
|
697
|
+
setProduct(productTemp);
|
|
698
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
699
|
+
}
|
|
700
|
+
|
|
691
701
|
setMessage("Descripciones guardadas con éxito");
|
|
692
702
|
loadData();
|
|
693
|
-
_context6.next =
|
|
703
|
+
_context6.next = 15;
|
|
694
704
|
break;
|
|
695
705
|
|
|
696
|
-
case
|
|
697
|
-
_context6.prev =
|
|
698
|
-
_context6.t0 = _context6["catch"](
|
|
706
|
+
case 12:
|
|
707
|
+
_context6.prev = 12;
|
|
708
|
+
_context6.t0 = _context6["catch"](4);
|
|
699
709
|
console.log(_context6.t0);
|
|
700
710
|
|
|
701
|
-
case
|
|
711
|
+
case 15:
|
|
702
712
|
case "end":
|
|
703
713
|
return _context6.stop();
|
|
704
714
|
}
|
|
705
715
|
}
|
|
706
|
-
}, _callee6, null, [[
|
|
716
|
+
}, _callee6, null, [[4, 12]]);
|
|
707
717
|
}));
|
|
708
718
|
|
|
709
719
|
return function saveDescriptions() {
|
|
@@ -713,7 +723,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
713
723
|
|
|
714
724
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
715
725
|
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
716
|
-
var
|
|
726
|
+
var _product$article9;
|
|
717
727
|
|
|
718
728
|
var dataObject;
|
|
719
729
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
@@ -722,10 +732,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
722
732
|
case 0:
|
|
723
733
|
setLoading(true);
|
|
724
734
|
dataObject = {
|
|
725
|
-
articleId:
|
|
735
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article,
|
|
726
736
|
articleData: updatedDatasheets
|
|
727
737
|
};
|
|
728
|
-
if (
|
|
738
|
+
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
729
739
|
_context7.prev = 3;
|
|
730
740
|
_context7.next = 6;
|
|
731
741
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
@@ -736,21 +746,28 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
736
746
|
|
|
737
747
|
case 6:
|
|
738
748
|
setMessage("Fichas técnicas guardadas");
|
|
749
|
+
|
|
750
|
+
if (productTemp.status === "ASSIGNED") {
|
|
751
|
+
productTemp.status = "IN_PROGRESS";
|
|
752
|
+
setProduct(productTemp);
|
|
753
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
754
|
+
}
|
|
755
|
+
|
|
739
756
|
loadData();
|
|
740
|
-
_context7.next =
|
|
757
|
+
_context7.next = 14;
|
|
741
758
|
break;
|
|
742
759
|
|
|
743
|
-
case
|
|
744
|
-
_context7.prev =
|
|
760
|
+
case 11:
|
|
761
|
+
_context7.prev = 11;
|
|
745
762
|
_context7.t0 = _context7["catch"](3);
|
|
746
763
|
console.log(_context7.t0);
|
|
747
764
|
|
|
748
|
-
case
|
|
765
|
+
case 14:
|
|
749
766
|
case "end":
|
|
750
767
|
return _context7.stop();
|
|
751
768
|
}
|
|
752
769
|
}
|
|
753
|
-
}, _callee7, null, [[3,
|
|
770
|
+
}, _callee7, null, [[3, 11]]);
|
|
754
771
|
}));
|
|
755
772
|
|
|
756
773
|
return function saveDatasheets() {
|
|
@@ -759,7 +776,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
759
776
|
}();
|
|
760
777
|
|
|
761
778
|
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
762
|
-
var _images$values2, _product$
|
|
779
|
+
var _images$values2, _product$article10, _data$articleData, _data$articleData2, _data$updateImages;
|
|
763
780
|
|
|
764
781
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
765
782
|
|
|
@@ -778,7 +795,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
778
795
|
attrForImgs = Object.values(images === null || images === void 0 ? void 0 : images.attrForImgs);
|
|
779
796
|
attrForImgs.pop();
|
|
780
797
|
data = {
|
|
781
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
798
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article,
|
|
782
799
|
attrReqImgs: attrForImgs === null || attrForImgs === void 0 ? void 0 : attrForImgs.map(function (e) {
|
|
783
800
|
var _e$, _e$2;
|
|
784
801
|
|
|
@@ -794,7 +811,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
794
811
|
return e.id;
|
|
795
812
|
})
|
|
796
813
|
};
|
|
797
|
-
if (
|
|
814
|
+
if (product !== null && product !== void 0 && product.orderId) data["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
798
815
|
valid = (data === null || data === void 0 ? void 0 : (_data$articleData = data.articleData) === null || _data$articleData === void 0 ? void 0 : _data$articleData.length) === 0 ? true : data === null || data === void 0 ? void 0 : (_data$articleData2 = data.articleData) === null || _data$articleData2 === void 0 ? void 0 : _data$articleData2.every(function (e, i) {
|
|
799
816
|
if (e !== null && e !== void 0 && e.image_id && e !== null && e !== void 0 && e.packing_type && e !== null && e !== void 0 && e.image_type) {
|
|
800
817
|
return true;
|
|
@@ -892,7 +909,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
892
909
|
e.imageID = e.image_id;
|
|
893
910
|
e.packingType = e.packing_type;
|
|
894
911
|
e.imageType = e.image_type;
|
|
895
|
-
if (
|
|
912
|
+
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
896
913
|
return e;
|
|
897
914
|
});
|
|
898
915
|
_context9.prev = 3;
|
|
@@ -928,7 +945,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
928
945
|
});
|
|
929
946
|
|
|
930
947
|
var _srv$filter = srv.filter(function (serv) {
|
|
931
|
-
return serv.id_retailer === activeRetailer.id;
|
|
948
|
+
return serv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
|
|
932
949
|
}),
|
|
933
950
|
_srv$filter2 = (0, _slicedToArray2.default)(_srv$filter, 1),
|
|
934
951
|
srvActive = _srv$filter2[0];
|
|
@@ -976,12 +993,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
976
993
|
concept = action ? action : concept;
|
|
977
994
|
|
|
978
995
|
var _servicesData$filter = servicesData.filter(function (srv) {
|
|
979
|
-
return srv.id_retailer === activeRetailer.id && srv.service === concept;
|
|
996
|
+
return srv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && srv.service === concept;
|
|
980
997
|
}),
|
|
981
998
|
_servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
|
|
982
999
|
retailerStatus = _servicesData$filter2[0];
|
|
983
1000
|
|
|
984
|
-
return (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "AF" && ( //sessionStorage
|
|
1001
|
+
return (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "AF" && ( //sessionStorage product
|
|
985
1002
|
user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RP" && (user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RC" && (user.id_role === 1 || user.id_role === 6);
|
|
986
1003
|
};
|
|
987
1004
|
|
|
@@ -1006,7 +1023,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1006
1023
|
|
|
1007
1024
|
var sendToFacilitator = /*#__PURE__*/function () {
|
|
1008
1025
|
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee10(result) {
|
|
1009
|
-
var concept,
|
|
1026
|
+
var concept, _productTemp, evalStatus, data, specialistDone, statusArr, newStatus;
|
|
1027
|
+
|
|
1010
1028
|
return _regenerator.default.wrap(function _callee10$(_context10) {
|
|
1011
1029
|
while (1) {
|
|
1012
1030
|
switch (_context10.prev = _context10.next) {
|
|
@@ -1014,7 +1032,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1014
1032
|
setLoading(true);
|
|
1015
1033
|
_context10.prev = 1;
|
|
1016
1034
|
concept = getConcept(activeTab);
|
|
1017
|
-
|
|
1035
|
+
_productTemp = (0, _objectSpread2.default)({}, product);
|
|
1018
1036
|
evalStatus = product["".concat(concept, "_status")];
|
|
1019
1037
|
data = {};
|
|
1020
1038
|
|
|
@@ -1068,9 +1086,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1068
1086
|
servicesData.forEach(function (srv) {
|
|
1069
1087
|
srv.service === concept && statusArr.push(srv.status);
|
|
1070
1088
|
});
|
|
1071
|
-
|
|
1072
|
-
newStatus = (0, _data2.getNewStatus)([
|
|
1073
|
-
|
|
1089
|
+
_productTemp["".concat(concept, "_status")] = (0, _data2.getNewStatus)(statusArr);
|
|
1090
|
+
newStatus = (0, _data2.getNewStatus)([_productTemp.datasheet_status, _productTemp.description_status, _productTemp.images_status]);
|
|
1091
|
+
_productTemp.status = newStatus;
|
|
1074
1092
|
data = {
|
|
1075
1093
|
articleId: product.article.id_article,
|
|
1076
1094
|
orderId: product.orderId,
|
|
@@ -1105,8 +1123,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1105
1123
|
getServices();
|
|
1106
1124
|
|
|
1107
1125
|
case 32:
|
|
1108
|
-
sessionStorage.setItem("productSelected", JSON.stringify(
|
|
1109
|
-
setProduct(
|
|
1126
|
+
sessionStorage.setItem("productSelected", JSON.stringify(_productTemp));
|
|
1127
|
+
setProduct(_productTemp);
|
|
1110
1128
|
_context10.next = 39;
|
|
1111
1129
|
break;
|
|
1112
1130
|
|
|
@@ -1165,16 +1183,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1165
1183
|
}
|
|
1166
1184
|
}
|
|
1167
1185
|
|
|
1168
|
-
return
|
|
1186
|
+
return product.article["id_".concat(concept, "_").concat(rol)] === user.id_user && validUser;
|
|
1169
1187
|
};
|
|
1170
1188
|
|
|
1171
1189
|
var auditorAssigned = function auditorAssigned() {
|
|
1172
|
-
return (
|
|
1190
|
+
return (product === null || product === void 0 ? void 0 : product.article["id_auditor"]) === user.id_user;
|
|
1173
1191
|
};
|
|
1174
1192
|
|
|
1175
1193
|
var createComment = /*#__PURE__*/function () {
|
|
1176
1194
|
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e, body, tab) {
|
|
1177
|
-
var _product$
|
|
1195
|
+
var _product$article11;
|
|
1178
1196
|
|
|
1179
1197
|
var concept, data;
|
|
1180
1198
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
@@ -1200,7 +1218,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1200
1218
|
|
|
1201
1219
|
case 10:
|
|
1202
1220
|
data = {
|
|
1203
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
1221
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article11 = product.article) === null || _product$article11 === void 0 ? void 0 : _product$article11.id_article,
|
|
1204
1222
|
orderId: product === null || product === void 0 ? void 0 : product.orderId,
|
|
1205
1223
|
message: body,
|
|
1206
1224
|
concept: concept,
|
|
@@ -1319,7 +1337,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1319
1337
|
|
|
1320
1338
|
var setAssignation = /*#__PURE__*/function () {
|
|
1321
1339
|
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(assignationType, assignationId) {
|
|
1322
|
-
var _product$
|
|
1340
|
+
var _product$article12;
|
|
1323
1341
|
|
|
1324
1342
|
var concept, productTemp, data;
|
|
1325
1343
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
@@ -1344,12 +1362,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1344
1362
|
return _context13.abrupt("break", 10);
|
|
1345
1363
|
|
|
1346
1364
|
case 10:
|
|
1347
|
-
productTemp =
|
|
1365
|
+
productTemp = product;
|
|
1348
1366
|
productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
|
|
1349
1367
|
data = (0, _defineProperty2.default)({
|
|
1350
1368
|
articleList: [{
|
|
1351
1369
|
orderId: product.orderId,
|
|
1352
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
1370
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article12 = product.article) === null || _product$article12 === void 0 ? void 0 : _product$article12.id_article
|
|
1353
1371
|
}],
|
|
1354
1372
|
concept: concept
|
|
1355
1373
|
}, "".concat(assignationType, "Id"), assignationId);
|
|
@@ -1509,7 +1527,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1509
1527
|
var retailerService = {};
|
|
1510
1528
|
|
|
1511
1529
|
var _arr$filter = arr === null || arr === void 0 ? void 0 : arr.filter(function (service) {
|
|
1512
|
-
return service.id_retailer === activeRetailer.id && service.service === concept;
|
|
1530
|
+
return service.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && service.service === concept;
|
|
1513
1531
|
});
|
|
1514
1532
|
|
|
1515
1533
|
var _arr$filter2 = (0, _slicedToArray2.default)(_arr$filter, 1);
|
|
@@ -1541,10 +1559,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1541
1559
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable, {
|
|
1542
1560
|
lists: images,
|
|
1543
1561
|
activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
|
|
1544
|
-
retailerSelected: activeRetailer.id,
|
|
1562
|
+
retailerSelected: activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id,
|
|
1545
1563
|
setImages: setImages,
|
|
1546
1564
|
assignationsImages: assig["Imágenes"],
|
|
1547
|
-
imagesStatus:
|
|
1565
|
+
imagesStatus: product === null || product === void 0 ? void 0 : product.images_status,
|
|
1548
1566
|
setAssignation: setAssignation,
|
|
1549
1567
|
isRetailer: isRetailer,
|
|
1550
1568
|
onClickSave: function onClickSave() {
|
|
@@ -1606,7 +1624,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1606
1624
|
setCheckAll: setCheckAll
|
|
1607
1625
|
}), activeTab === "Ficha técnica" && ((product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" ? (_datasheets$ = datasheets[0]) === null || _datasheets$ === void 0 ? void 0 : (_datasheets$$data = _datasheets$.data) === null || _datasheets$$data === void 0 ? void 0 : _datasheets$$data.map(function (dataGroup, index) {
|
|
1608
1626
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1609
|
-
articleId:
|
|
1627
|
+
articleId: product.article.id_article,
|
|
1610
1628
|
version: version,
|
|
1611
1629
|
activeSection: activeTab,
|
|
1612
1630
|
inputGroup: dataGroup,
|
|
@@ -1622,7 +1640,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1622
1640
|
inputGroup: descriptions[0],
|
|
1623
1641
|
updatedDescriptions: updatedDescriptions,
|
|
1624
1642
|
setUpdatedDescriptions: setUpdatedDescriptions,
|
|
1625
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
1643
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article,
|
|
1626
1644
|
version: version,
|
|
1627
1645
|
dinamicHeight: true
|
|
1628
1646
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|