contentoh-components-library 21.4.73 → 21.4.74
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/pages/ProviderProductEdition/ProviderProductEdition.stories.js +34 -38
- package/dist/components/pages/ProviderProductEdition/index.js +71 -53
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +48 -53
- package/dist/components/pages/RetailerProductEdition/index.js +41 -28
- package/dist/global-files/data.js +11 -26
- package/package.json +1 -1
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +110 -83
- package/src/components/pages/ProviderProductEdition/index.js +34 -21
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +48 -52
- package/src/components/pages/RetailerProductEdition/index.js +14 -2
- package/src/global-files/data.js +8 -36
|
@@ -548,7 +548,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
548
548
|
|
|
549
549
|
var loadData = /*#__PURE__*/function () {
|
|
550
550
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
551
|
-
var _product$article4, _product$article5, _product$article6, _services$, _services$$values, _services;
|
|
551
|
+
var _product$article4, _product$article5, _product$article6, _services$, _services$$values, _product$retailersAva, _services, data, headers;
|
|
552
552
|
|
|
553
553
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
554
554
|
while (1) {
|
|
@@ -573,26 +573,39 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
573
573
|
init: _services[2]
|
|
574
574
|
});
|
|
575
575
|
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);
|
|
576
|
+
data = [{
|
|
577
|
+
id_article: product.article.id_article,
|
|
578
|
+
id_category: product.article.id_category,
|
|
579
|
+
version: product.version,
|
|
580
|
+
id_retailer_array: ((_product$retailersAva = product.retailersAvailable) !== null && _product$retailersAva !== void 0 ? _product$retailersAva : product.retailers).map(function (_ref6) {
|
|
581
|
+
var id = _ref6.id;
|
|
582
|
+
return id;
|
|
583
|
+
})
|
|
584
|
+
}];
|
|
585
|
+
headers = {
|
|
586
|
+
Authorization: token
|
|
587
|
+
};
|
|
576
588
|
(0, _data.getPercentage)({
|
|
577
|
-
data:
|
|
589
|
+
data: data,
|
|
590
|
+
headers: headers
|
|
578
591
|
}).then(function (res) {
|
|
579
|
-
|
|
592
|
+
setPercentages(res[0]);
|
|
580
593
|
});
|
|
581
594
|
setLoading(false);
|
|
582
|
-
_context3.next =
|
|
595
|
+
_context3.next = 18;
|
|
583
596
|
break;
|
|
584
597
|
|
|
585
|
-
case
|
|
586
|
-
_context3.prev =
|
|
598
|
+
case 15:
|
|
599
|
+
_context3.prev = 15;
|
|
587
600
|
_context3.t0 = _context3["catch"](0);
|
|
588
601
|
console.log(_context3.t0);
|
|
589
602
|
|
|
590
|
-
case
|
|
603
|
+
case 18:
|
|
591
604
|
case "end":
|
|
592
605
|
return _context3.stop();
|
|
593
606
|
}
|
|
594
607
|
}
|
|
595
|
-
}, _callee3, null, [[0,
|
|
608
|
+
}, _callee3, null, [[0, 15]]);
|
|
596
609
|
}));
|
|
597
610
|
|
|
598
611
|
return function loadData() {
|
|
@@ -601,7 +614,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
601
614
|
}();
|
|
602
615
|
|
|
603
616
|
var getServices = /*#__PURE__*/function () {
|
|
604
|
-
var
|
|
617
|
+
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
605
618
|
var _product$article7, _product$article8, _servicesResponse$dat;
|
|
606
619
|
|
|
607
620
|
var servicesResponse, parsedResponse, retailers, retailerResponse, active;
|
|
@@ -634,7 +647,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
634
647
|
}));
|
|
635
648
|
|
|
636
649
|
return function getServices() {
|
|
637
|
-
return
|
|
650
|
+
return _ref7.apply(this, arguments);
|
|
638
651
|
};
|
|
639
652
|
}();
|
|
640
653
|
|
|
@@ -648,7 +661,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
648
661
|
};
|
|
649
662
|
|
|
650
663
|
var getComments = /*#__PURE__*/function () {
|
|
651
|
-
var
|
|
664
|
+
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5() {
|
|
652
665
|
var _product$article9, _product$article10, _product$article11;
|
|
653
666
|
|
|
654
667
|
var tab,
|
|
@@ -683,7 +696,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
683
696
|
}));
|
|
684
697
|
|
|
685
698
|
return function getComments() {
|
|
686
|
-
return
|
|
699
|
+
return _ref8.apply(this, arguments);
|
|
687
700
|
};
|
|
688
701
|
}();
|
|
689
702
|
|
|
@@ -854,7 +867,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
854
867
|
};
|
|
855
868
|
|
|
856
869
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
857
|
-
var
|
|
870
|
+
var _ref10 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
858
871
|
var dataClean, _product$article12, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
|
|
859
872
|
|
|
860
873
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
@@ -922,12 +935,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
922
935
|
}));
|
|
923
936
|
|
|
924
937
|
return function saveDescriptions() {
|
|
925
|
-
return
|
|
938
|
+
return _ref10.apply(this, arguments);
|
|
926
939
|
};
|
|
927
940
|
}();
|
|
928
941
|
|
|
929
942
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
930
|
-
var
|
|
943
|
+
var _ref11 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
931
944
|
var dataClean, _product$article13, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
|
|
932
945
|
|
|
933
946
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
@@ -995,7 +1008,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
995
1008
|
}));
|
|
996
1009
|
|
|
997
1010
|
return function saveDatasheets() {
|
|
998
|
-
return
|
|
1011
|
+
return _ref11.apply(this, arguments);
|
|
999
1012
|
};
|
|
1000
1013
|
}();
|
|
1001
1014
|
|
|
@@ -1282,8 +1295,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1282
1295
|
break;
|
|
1283
1296
|
}
|
|
1284
1297
|
|
|
1285
|
-
var services = servicesData.filter(function (
|
|
1286
|
-
var service =
|
|
1298
|
+
var services = servicesData.filter(function (_ref14) {
|
|
1299
|
+
var service = _ref14.service;
|
|
1287
1300
|
return concepts.includes(service);
|
|
1288
1301
|
});
|
|
1289
1302
|
var adminFacilitatorCanEvaluate = services.every(function (srv) {
|
|
@@ -1393,7 +1406,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1393
1406
|
|
|
1394
1407
|
|
|
1395
1408
|
var sendToFacilitator = /*#__PURE__*/function () {
|
|
1396
|
-
var
|
|
1409
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
|
|
1397
1410
|
var concept, productTemp, evalStatus, articleId, orderId, data, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus;
|
|
1398
1411
|
|
|
1399
1412
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
@@ -1493,7 +1506,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1493
1506
|
}));
|
|
1494
1507
|
|
|
1495
1508
|
return function sendToFacilitator(_x) {
|
|
1496
|
-
return
|
|
1509
|
+
return _ref15.apply(this, arguments);
|
|
1497
1510
|
};
|
|
1498
1511
|
}();
|
|
1499
1512
|
|
|
@@ -1524,7 +1537,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1524
1537
|
};
|
|
1525
1538
|
|
|
1526
1539
|
var createComment = /*#__PURE__*/function () {
|
|
1527
|
-
var
|
|
1540
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12(e, body, tab) {
|
|
1528
1541
|
var _product$article16;
|
|
1529
1542
|
|
|
1530
1543
|
var concept, data;
|
|
@@ -1581,7 +1594,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1581
1594
|
}));
|
|
1582
1595
|
|
|
1583
1596
|
return function createComment(_x2, _x3, _x4) {
|
|
1584
|
-
return
|
|
1597
|
+
return _ref16.apply(this, arguments);
|
|
1585
1598
|
};
|
|
1586
1599
|
}();
|
|
1587
1600
|
|
|
@@ -1659,7 +1672,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1659
1672
|
}, [activeTab]);
|
|
1660
1673
|
|
|
1661
1674
|
var commentRevised = /*#__PURE__*/function () {
|
|
1662
|
-
var
|
|
1675
|
+
var _ref17 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13() {
|
|
1663
1676
|
var data;
|
|
1664
1677
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
1665
1678
|
while (1) {
|
|
@@ -1689,12 +1702,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1689
1702
|
}));
|
|
1690
1703
|
|
|
1691
1704
|
return function commentRevised() {
|
|
1692
|
-
return
|
|
1705
|
+
return _ref17.apply(this, arguments);
|
|
1693
1706
|
};
|
|
1694
1707
|
}();
|
|
1695
1708
|
|
|
1696
1709
|
var setAssignation = /*#__PURE__*/function () {
|
|
1697
|
-
var
|
|
1710
|
+
var _ref18 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee14(assignationType, assignationId) {
|
|
1698
1711
|
var _product$article17;
|
|
1699
1712
|
|
|
1700
1713
|
var concept, productTemp, data;
|
|
@@ -1753,7 +1766,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1753
1766
|
}));
|
|
1754
1767
|
|
|
1755
1768
|
return function setAssignation(_x5, _x6) {
|
|
1756
|
-
return
|
|
1769
|
+
return _ref18.apply(this, arguments);
|
|
1757
1770
|
};
|
|
1758
1771
|
}();
|
|
1759
1772
|
|
|
@@ -1922,7 +1935,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1922
1935
|
// };
|
|
1923
1936
|
|
|
1924
1937
|
var validateAll = /*#__PURE__*/function () {
|
|
1925
|
-
var
|
|
1938
|
+
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
|
|
1926
1939
|
var evaluationArray, conceptArray, productTemp;
|
|
1927
1940
|
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
1928
1941
|
while (1) {
|
|
@@ -2000,7 +2013,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2000
2013
|
}));
|
|
2001
2014
|
|
|
2002
2015
|
return function validateAll(_x7) {
|
|
2003
|
-
return
|
|
2016
|
+
return _ref19.apply(this, arguments);
|
|
2004
2017
|
};
|
|
2005
2018
|
}();
|
|
2006
2019
|
|
|
@@ -126,46 +126,31 @@ var getPercentage = /*#__PURE__*/function () {
|
|
|
126
126
|
|
|
127
127
|
func = /*#__PURE__*/function () {
|
|
128
128
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
129
|
-
var
|
|
129
|
+
var _params$headers$Autho, _params$headers;
|
|
130
|
+
|
|
131
|
+
var headers;
|
|
130
132
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
131
133
|
while (1) {
|
|
132
134
|
switch (_context2.prev = _context2.next) {
|
|
133
135
|
case 0:
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
dataToSend.push(product.article ? {
|
|
139
|
-
id_article: product.article.id_article,
|
|
140
|
-
id_category: product.article.id_category,
|
|
141
|
-
version: product.version
|
|
142
|
-
} : {
|
|
143
|
-
id_article: product.id_article,
|
|
144
|
-
id_category: product.id_category,
|
|
145
|
-
version: product.version
|
|
146
|
-
});
|
|
147
|
-
retailers.forEach(function (retailer) {
|
|
148
|
-
arrayRetailers.push(retailer.id);
|
|
149
|
-
});
|
|
150
|
-
dataToSend[i].id_retailer_array = arrayRetailers;
|
|
151
|
-
});
|
|
152
|
-
_context2.next = 6;
|
|
136
|
+
headers = {
|
|
137
|
+
Authorization: (_params$headers$Autho = params === null || params === void 0 ? void 0 : (_params$headers = params.headers) === null || _params$headers === void 0 ? void 0 : _params$headers.Authorization) !== null && _params$headers$Autho !== void 0 ? _params$headers$Autho : sessionStorage.getItem("jwt")
|
|
138
|
+
};
|
|
139
|
+
_context2.next = 3;
|
|
153
140
|
return _axios.default.post(process.env.REACT_APP_VALID_EXPORT_ENDPOINT, {
|
|
154
|
-
data:
|
|
141
|
+
data: params.data
|
|
155
142
|
}, {
|
|
156
|
-
headers:
|
|
157
|
-
Authorization: sessionStorage.getItem("jwt")
|
|
158
|
-
}
|
|
143
|
+
headers: headers
|
|
159
144
|
}).then(function (response) {
|
|
160
145
|
return [response.data];
|
|
161
146
|
}).catch(function (err) {
|
|
162
147
|
return console.log(err, "Errror");
|
|
163
148
|
});
|
|
164
149
|
|
|
165
|
-
case
|
|
150
|
+
case 3:
|
|
166
151
|
return _context2.abrupt("return", _context2.sent);
|
|
167
152
|
|
|
168
|
-
case
|
|
153
|
+
case 4:
|
|
169
154
|
case "end":
|
|
170
155
|
return _context2.stop();
|
|
171
156
|
}
|
package/package.json
CHANGED
|
@@ -21,39 +21,57 @@ ProviderProductEditionDefault.args = {
|
|
|
21
21
|
category: 287,
|
|
22
22
|
version: 1,
|
|
23
23
|
productSelected: {
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
{
|
|
34
|
-
|
|
35
|
-
|
|
24
|
+
category: "Accesorios Decorativos|Accesorios Decorativos",
|
|
25
|
+
company_name: "Demo",
|
|
26
|
+
company_id: 923,
|
|
27
|
+
id_category: "2028",
|
|
28
|
+
id_article: 118465,
|
|
29
|
+
name: "VELA AROMA 18 OZ MAN/CAN",
|
|
30
|
+
upc: "Modelo6",
|
|
31
|
+
isVisible: 1,
|
|
32
|
+
retailers: [
|
|
33
|
+
{
|
|
34
|
+
id: 68,
|
|
35
|
+
name: "The Home Depot Onboarding",
|
|
36
|
+
},
|
|
37
|
+
],
|
|
38
|
+
version: 1,
|
|
39
|
+
retailersAvailable: [
|
|
40
|
+
{
|
|
41
|
+
id: 68,
|
|
42
|
+
name: "The Home Depot Onboarding",
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
36
46
|
productToEdit: {
|
|
37
|
-
idCategory:
|
|
38
|
-
ArticleId:
|
|
39
|
-
product:[
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
47
|
+
idCategory: "2028",
|
|
48
|
+
ArticleId: 118465,
|
|
49
|
+
product: [
|
|
50
|
+
{
|
|
51
|
+
category: "Accesorios Decorativos|Accesorios Decorativos",
|
|
52
|
+
company_name: "Demo",
|
|
53
|
+
company_id: 923,
|
|
54
|
+
id_category: "2028",
|
|
55
|
+
id_article: 118465,
|
|
56
|
+
name: "VELA AROMA 18 OZ MAN/CAN",
|
|
57
|
+
upc: "Modelo6",
|
|
58
|
+
isVisible: 1,
|
|
59
|
+
retailers: [
|
|
60
|
+
{
|
|
61
|
+
id: 68,
|
|
62
|
+
name: "The Home Depot Onboarding",
|
|
63
|
+
},
|
|
64
|
+
],
|
|
65
|
+
version: 1,
|
|
66
|
+
retailersAvailable: [
|
|
67
|
+
{
|
|
68
|
+
id: 68,
|
|
69
|
+
name: "The Home Depot Onboarding",
|
|
70
|
+
},
|
|
71
|
+
],
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
},
|
|
57
75
|
location: {
|
|
58
76
|
pathname: "/EditProducts",
|
|
59
77
|
search: "",
|
|
@@ -66,57 +84,66 @@ ProviderProductEditionDefault.args = {
|
|
|
66
84
|
key: "24vwut",
|
|
67
85
|
},
|
|
68
86
|
user: {
|
|
69
|
-
id_user:191,
|
|
70
|
-
name:"Demo",
|
|
71
|
-
last_name:"Demo",
|
|
72
|
-
email:"merchants24feb@allfreemail.net",
|
|
73
|
-
position:"Test",
|
|
74
|
-
telephone:"+52123456789",
|
|
75
|
-
country:"México",
|
|
76
|
-
id_company:923,
|
|
77
|
-
id_cognito:"c3cd160c-76c2-497c-9357-5ef949307e1e",
|
|
78
|
-
birth_Date:null,
|
|
79
|
-
about_me:null,
|
|
80
|
-
zip_code:null,
|
|
81
|
-
address:null,
|
|
82
|
-
job:null,
|
|
83
|
-
id_stripe:null,
|
|
84
|
-
id_role:0,
|
|
85
|
-
active:1,
|
|
86
|
-
is_retailer:0,
|
|
87
|
-
email_notify:1,
|
|
88
|
-
is_user_tech:null,
|
|
89
|
-
membership:
|
|
90
|
-
|
|
91
|
-
start_date:"2023-02-24T18:14:43.000Z",
|
|
92
|
-
end_date:"2024-02-24T18:14:43.000Z",
|
|
93
|
-
planID:8,
|
|
94
|
-
plan:"prod_KtlhECVSFG2iro",
|
|
95
|
-
name:"Plan Pro",
|
|
96
|
-
user_limit:"50",
|
|
97
|
-
products_limit:"5000",
|
|
98
|
-
type:"Enterprise"
|
|
99
|
-
|
|
87
|
+
id_user: 191,
|
|
88
|
+
name: "Demo",
|
|
89
|
+
last_name: "Demo",
|
|
90
|
+
email: "merchants24feb@allfreemail.net",
|
|
91
|
+
position: "Test",
|
|
92
|
+
telephone: "+52123456789",
|
|
93
|
+
country: "México",
|
|
94
|
+
id_company: 923,
|
|
95
|
+
id_cognito: "c3cd160c-76c2-497c-9357-5ef949307e1e",
|
|
96
|
+
birth_Date: null,
|
|
97
|
+
about_me: null,
|
|
98
|
+
zip_code: null,
|
|
99
|
+
address: null,
|
|
100
|
+
job: null,
|
|
101
|
+
id_stripe: null,
|
|
102
|
+
id_role: 0,
|
|
103
|
+
active: 1,
|
|
104
|
+
is_retailer: 0,
|
|
105
|
+
email_notify: 1,
|
|
106
|
+
is_user_tech: null,
|
|
107
|
+
membership: {
|
|
108
|
+
id: 114,
|
|
109
|
+
start_date: "2023-02-24T18:14:43.000Z",
|
|
110
|
+
end_date: "2024-02-24T18:14:43.000Z",
|
|
111
|
+
planID: 8,
|
|
112
|
+
plan: "prod_KtlhECVSFG2iro",
|
|
113
|
+
name: "Plan Pro",
|
|
114
|
+
user_limit: "50",
|
|
115
|
+
products_limit: "5000",
|
|
116
|
+
type: "Enterprise",
|
|
117
|
+
},
|
|
118
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-191/191.png?1701729602068",
|
|
119
|
+
},
|
|
100
120
|
company: {
|
|
101
|
-
id_company:923,
|
|
102
|
-
trade_name:"Demo",
|
|
103
|
-
company_name:"Demo",
|
|
104
|
-
rfc:"Demo",
|
|
105
|
-
adress:"Demo",
|
|
106
|
-
about_company:null,
|
|
107
|
-
telephone:null,
|
|
108
|
-
web_site:null,
|
|
109
|
-
zip_code:null,
|
|
110
|
-
email:null,
|
|
111
|
-
social_link:null,
|
|
112
|
-
is_retailer:0,
|
|
113
|
-
financedRetailers:
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
+
id_company: 923,
|
|
122
|
+
trade_name: "Demo",
|
|
123
|
+
company_name: "Demo",
|
|
124
|
+
rfc: "Demo",
|
|
125
|
+
adress: "Demo",
|
|
126
|
+
about_company: null,
|
|
127
|
+
telephone: null,
|
|
128
|
+
web_site: null,
|
|
129
|
+
zip_code: null,
|
|
130
|
+
email: null,
|
|
131
|
+
social_link: null,
|
|
132
|
+
is_retailer: 0,
|
|
133
|
+
financedRetailers: [
|
|
134
|
+
{
|
|
135
|
+
id: 68,
|
|
136
|
+
name: "The Home Depot Onboarding",
|
|
137
|
+
country: "México",
|
|
138
|
+
},
|
|
139
|
+
],
|
|
140
|
+
retailers: [
|
|
141
|
+
{
|
|
142
|
+
id: 68,
|
|
143
|
+
name: "The Home Depot Onboarding",
|
|
144
|
+
country: "México",
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
},
|
|
121
148
|
showSurvey: (v) => v && alert("se muestra"),
|
|
122
149
|
};
|
|
@@ -78,19 +78,26 @@ const reducerImages = (state, action) => {
|
|
|
78
78
|
);
|
|
79
79
|
return { ...state, values };
|
|
80
80
|
case "orderImages": {
|
|
81
|
-
let {
|
|
81
|
+
let {
|
|
82
|
+
inputsByRetailer = {},
|
|
83
|
+
valuesInitial,
|
|
84
|
+
inputsInitial,
|
|
85
|
+
inputs,
|
|
86
|
+
} = state;
|
|
82
87
|
try {
|
|
83
88
|
const orderedImages = [];
|
|
84
89
|
const imageIdArray = [];
|
|
85
|
-
if (action?.retailerId && !inputsByRetailer[action.retailerId])
|
|
90
|
+
if (action?.retailerId && !inputsByRetailer[action.retailerId]) {
|
|
86
91
|
inputsByRetailer[action.retailerId] = [];
|
|
87
|
-
|
|
92
|
+
}
|
|
93
|
+
if (action.retailerId) {
|
|
88
94
|
inputsByRetailer[action.retailerId]?.filter((input) => {
|
|
89
95
|
imageIdArray.push(input.id_image);
|
|
90
96
|
valuesInitial.forEach((value) => {
|
|
91
97
|
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
92
98
|
});
|
|
93
99
|
});
|
|
100
|
+
}
|
|
94
101
|
|
|
95
102
|
inputs = inputsInitial?.filter((input) =>
|
|
96
103
|
imageIdArray.includes(input.id)
|
|
@@ -98,7 +105,7 @@ const reducerImages = (state, action) => {
|
|
|
98
105
|
|
|
99
106
|
values = orderedImages.length > 0 ? orderedImages : [];
|
|
100
107
|
} catch (error) {
|
|
101
|
-
console.log(error);
|
|
108
|
+
console.log(action.action, error);
|
|
102
109
|
}
|
|
103
110
|
return { ...state, values, inputs };
|
|
104
111
|
}
|
|
@@ -502,7 +509,20 @@ export const ProviderProductEdition = ({
|
|
|
502
509
|
|
|
503
510
|
setImages({ action: "init", init: services[2] });
|
|
504
511
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
505
|
-
|
|
512
|
+
const data = [
|
|
513
|
+
{
|
|
514
|
+
id_article: product.id_article,
|
|
515
|
+
id_category: product.id_category,
|
|
516
|
+
version: product.version,
|
|
517
|
+
id_retailer_array: (
|
|
518
|
+
product.retailersAvailable ?? product.retailers
|
|
519
|
+
).map(({ id }) => id),
|
|
520
|
+
},
|
|
521
|
+
];
|
|
522
|
+
const headers = { Authorization: token };
|
|
523
|
+
getPercentage({ data, headers }).then((res) => {
|
|
524
|
+
setPercentages(res[0]);
|
|
525
|
+
});
|
|
506
526
|
setLoading(false);
|
|
507
527
|
};
|
|
508
528
|
|
|
@@ -560,12 +580,14 @@ export const ProviderProductEdition = ({
|
|
|
560
580
|
};
|
|
561
581
|
|
|
562
582
|
const getCart = async () => {
|
|
563
|
-
const res = await axios.get(process.env.REACT_APP_CART
|
|
583
|
+
const res = await axios.get(`${process.env.REACT_APP_CART}/general/`, {
|
|
564
584
|
headers: {
|
|
565
585
|
Authorization: token,
|
|
566
586
|
},
|
|
567
587
|
});
|
|
568
|
-
const arr = JSON.parse(res.data.body).data
|
|
588
|
+
const arr = Object.values(JSON.parse(res.data.body).data)
|
|
589
|
+
?.map((e) => e.article_id)
|
|
590
|
+
.filter(Boolean);
|
|
569
591
|
setInCart(arr.some((e) => e.articleId === product.id_article));
|
|
570
592
|
};
|
|
571
593
|
|
|
@@ -663,7 +685,7 @@ export const ProviderProductEdition = ({
|
|
|
663
685
|
value: e?.id,
|
|
664
686
|
name: e?.name,
|
|
665
687
|
required: e?.required,
|
|
666
|
-
active: images?.values
|
|
688
|
+
active: images?.values?.some((value) => value?.image_id === e?.id),
|
|
667
689
|
}));
|
|
668
690
|
setSocketType(imageInputs);
|
|
669
691
|
}, [images]);
|
|
@@ -707,7 +729,7 @@ export const ProviderProductEdition = ({
|
|
|
707
729
|
attributeId,
|
|
708
730
|
value: valueOfAtribute,
|
|
709
731
|
boxId,
|
|
710
|
-
})
|
|
732
|
+
});
|
|
711
733
|
});
|
|
712
734
|
});
|
|
713
735
|
|
|
@@ -715,8 +737,8 @@ export const ProviderProductEdition = ({
|
|
|
715
737
|
articleId: product?.id_article,
|
|
716
738
|
articleData: updatedDatasheets,
|
|
717
739
|
...(parseBoxData.length > 0 && { boxData: parseBoxData }),
|
|
718
|
-
};
|
|
719
|
-
|
|
740
|
+
};
|
|
741
|
+
|
|
720
742
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
721
743
|
try {
|
|
722
744
|
const res = await axios.put(
|
|
@@ -735,8 +757,7 @@ export const ProviderProductEdition = ({
|
|
|
735
757
|
}
|
|
736
758
|
} catch (error) {
|
|
737
759
|
console.log(error);
|
|
738
|
-
}
|
|
739
|
-
console.log(dataObject)
|
|
760
|
+
}
|
|
740
761
|
};
|
|
741
762
|
|
|
742
763
|
const updateImages = useCallback(async () => {
|
|
@@ -1181,13 +1202,6 @@ export const ProviderProductEdition = ({
|
|
|
1181
1202
|
}
|
|
1182
1203
|
};
|
|
1183
1204
|
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
1205
|
const evaluationToRetailer = async (result) => {
|
|
1192
1206
|
const data = {
|
|
1193
1207
|
articleId: product.id_article,
|
|
@@ -1269,7 +1283,6 @@ export const ProviderProductEdition = ({
|
|
|
1269
1283
|
},
|
|
1270
1284
|
];
|
|
1271
1285
|
const sendToEvaluation = (result) => {
|
|
1272
|
-
console.log({ result });
|
|
1273
1286
|
if (result === "A") {
|
|
1274
1287
|
if (
|
|
1275
1288
|
origin[activeTab] === "RequestWithoutContentoh" &&
|