contentoh-components-library 21.5.48 → 21.5.50
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/index.js +32 -4
- package/dist/components/pages/RetailerProductEdition/index.js +52 -46
- package/package.json +1 -1
- package/src/components/pages/ProviderProductEdition/index.js +41 -0
- package/src/components/pages/RetailerProductEdition/index.js +67 -56
|
@@ -2481,7 +2481,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2481
2481
|
label: "Aceptar",
|
|
2482
2482
|
size: 12,
|
|
2483
2483
|
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
2484
|
-
var body, messages;
|
|
2484
|
+
var body, messages, container, existingAlert, alert;
|
|
2485
2485
|
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
2486
2486
|
while (1) {
|
|
2487
2487
|
switch (_context21.prev = _context21.next) {
|
|
@@ -2491,14 +2491,42 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2491
2491
|
type: "message",
|
|
2492
2492
|
value: body === null || body === void 0 ? void 0 : body.replace(/<.*?\/?>/gm, "")
|
|
2493
2493
|
}];
|
|
2494
|
-
|
|
2494
|
+
|
|
2495
|
+
if (!(messages[0].value.length === 0 || !messages[0].value.trim())) {
|
|
2496
|
+
_context21.next = 13;
|
|
2497
|
+
break;
|
|
2498
|
+
}
|
|
2499
|
+
|
|
2500
|
+
container = document.querySelector(".container-customComponent"); // Verificar si ya existe una alerta
|
|
2501
|
+
|
|
2502
|
+
existingAlert = container.querySelector(".alert-error");
|
|
2503
|
+
|
|
2504
|
+
if (!existingAlert) {
|
|
2505
|
+
_context21.next = 7;
|
|
2506
|
+
break;
|
|
2507
|
+
}
|
|
2508
|
+
|
|
2509
|
+
return _context21.abrupt("return");
|
|
2510
|
+
|
|
2511
|
+
case 7:
|
|
2512
|
+
// Crear alerta con estilos
|
|
2513
|
+
alert = document.createElement("div");
|
|
2514
|
+
alert.className = "alert-error";
|
|
2515
|
+
alert.style.cssText = "\n color: #d32f2f;\n background-color: #ffebee;\n border: 1px solid #ef5350;\n border-radius: 4px;\n padding: 12px 16px;\n margin-top: 10px;\n font-size: 14px;\n display: flex;\n align-items: center;\n gap: 8px;\n font-family: 'Roboto', sans-serif;\n text-align: center;\n ";
|
|
2516
|
+
alert.innerHTML = "\n <span>El mensaje no puede estar vac\xEDo.</span>\n ";
|
|
2517
|
+
container.appendChild(alert);
|
|
2518
|
+
return _context21.abrupt("return");
|
|
2519
|
+
|
|
2520
|
+
case 13:
|
|
2521
|
+
console.log("Mensaje de rechazo:", messages);
|
|
2522
|
+
_context21.next = 16;
|
|
2495
2523
|
return createComment(messages[0].value);
|
|
2496
2524
|
|
|
2497
|
-
case
|
|
2525
|
+
case 16:
|
|
2498
2526
|
validatedAll ? validateAll("R") : sendToEvaluation("R");
|
|
2499
2527
|
setShowRejectModal(false);
|
|
2500
2528
|
|
|
2501
|
-
case
|
|
2529
|
+
case 18:
|
|
2502
2530
|
case "end":
|
|
2503
2531
|
return _context21.stop();
|
|
2504
2532
|
}
|
|
@@ -796,39 +796,48 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
796
796
|
|
|
797
797
|
var loadData = /*#__PURE__*/function () {
|
|
798
798
|
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
799
|
-
var _product$article$cate, _product$article4, _product$article4$cat, _product$article5, _product$article5$cat, _product$article6, _product$article7, _activeRetailer$id, _product$article8, _services$, _services$$values, _product$article9, categoryRetailer, categoryName, categoryId, category_name, category_id, retailer_id, _services, generalServices, data, headers;
|
|
799
|
+
var _ref10, _product$statusByReta, _product$statusByReta2, _product$statusByReta3, _ref11, _product$article$cate, _product$article4, _product$article4$cat, _product$article5, _product$article5$cat, _categoryRetailer$, _categoryRetailer$2, _product$article6, _product$article7, _activeRetailer$id, _product$article8, _services$, _services$$values, _product$article9, ids, uniqueIds, categoryRetailer, categoryName, categoryId, category_name, category_id, retailer_id, _services, generalServices, data, headers;
|
|
800
800
|
|
|
801
801
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
802
802
|
while (1) {
|
|
803
803
|
switch (_context7.prev = _context7.next) {
|
|
804
804
|
case 0:
|
|
805
805
|
_context7.prev = 0;
|
|
806
|
-
|
|
807
|
-
return
|
|
808
|
-
})) !== null && _product$
|
|
809
|
-
return
|
|
806
|
+
ids = (_ref10 = (_product$statusByReta = product === null || product === void 0 ? void 0 : (_product$statusByReta2 = product.statusByRetailer) === null || _product$statusByReta2 === void 0 ? void 0 : _product$statusByReta2.map(function (item) {
|
|
807
|
+
return item.retailer_id;
|
|
808
|
+
})) !== null && _product$statusByReta !== void 0 ? _product$statusByReta : product === null || product === void 0 ? void 0 : (_product$statusByReta3 = product.statusByRetailer) === null || _product$statusByReta3 === void 0 ? void 0 : _product$statusByReta3.map(function (item) {
|
|
809
|
+
return item.id_retailer;
|
|
810
|
+
})) !== null && _ref10 !== void 0 ? _ref10 : [];
|
|
811
|
+
uniqueIds = (0, _toConsumableArray2.default)(new Set(ids));
|
|
812
|
+
categoryRetailer = (_ref11 = (_product$article$cate = product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : (_product$article4$cat = _product$article4.categoryRetailer) === null || _product$article4$cat === void 0 ? void 0 : _product$article4$cat.filter(function (item) {
|
|
813
|
+
return uniqueIds.includes(item.id_retailer) && item.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
|
|
814
|
+
})) !== null && _product$article$cate !== void 0 ? _product$article$cate : product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : (_product$article5$cat = _product$article5.categoryRetailer) === null || _product$article5$cat === void 0 ? void 0 : _product$article5$cat.filter(function (item) {
|
|
815
|
+
return uniqueIds.includes(item.retailer_id) && item.retailer_id === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
|
|
816
|
+
})) !== null && _ref11 !== void 0 ? _ref11 : [];
|
|
817
|
+
console.log({
|
|
818
|
+
categoryRetailer: categoryRetailer
|
|
810
819
|
});
|
|
811
|
-
categoryName = categoryRetailer === null ||
|
|
812
|
-
categoryId = categoryRetailer === null ||
|
|
820
|
+
categoryName = (_categoryRetailer$ = categoryRetailer[0]) === null || _categoryRetailer$ === void 0 ? void 0 : _categoryRetailer$.category_name;
|
|
821
|
+
categoryId = (_categoryRetailer$2 = categoryRetailer[0]) === null || _categoryRetailer$2 === void 0 ? void 0 : _categoryRetailer$2.id_category;
|
|
813
822
|
category_name = categoryName !== null && categoryName !== void 0 ? categoryName : (product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.company_name) || (product === null || product === void 0 ? void 0 : product.categoryName);
|
|
814
823
|
category_id = categoryId !== null && categoryId !== void 0 ? categoryId : parseInt((product === null || product === void 0 ? void 0 : (_product$article7 = product.article) === null || _product$article7 === void 0 ? void 0 : _product$article7.id_category) || (product === null || product === void 0 ? void 0 : product.id_category));
|
|
815
824
|
retailer_id = (_activeRetailer$id = activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) !== null && _activeRetailer$id !== void 0 ? _activeRetailer$id : categoryRetailer === null || categoryRetailer === void 0 ? void 0 : categoryRetailer.id_retailer;
|
|
816
|
-
_context7.next =
|
|
825
|
+
_context7.next = 12;
|
|
817
826
|
return (0, _data2.getRetailerServices)((product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article8 = product.article) === null || _product$article8 === void 0 ? void 0 : _product$article8.id_article), category_name, category_id, version, token, retailer_id);
|
|
818
827
|
|
|
819
|
-
case
|
|
828
|
+
case 12:
|
|
820
829
|
_services = _context7.sent;
|
|
821
830
|
|
|
822
|
-
if (auditableVersion) {
|
|
831
|
+
if (auditableVersion && activeRetailer.id) {
|
|
823
832
|
loadAuditableData();
|
|
824
833
|
} //Converts the data inside the datasheets object to array
|
|
825
834
|
|
|
826
835
|
|
|
827
836
|
setServices(_services);
|
|
828
|
-
_context7.next =
|
|
837
|
+
_context7.next = 17;
|
|
829
838
|
return getServices();
|
|
830
839
|
|
|
831
|
-
case
|
|
840
|
+
case 17:
|
|
832
841
|
generalServices = _context7.sent;
|
|
833
842
|
setImages({
|
|
834
843
|
action: "init",
|
|
@@ -865,21 +874,21 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
865
874
|
setPercentages(JSON.parse(res === null || res === void 0 ? void 0 : (_res$ = res[0]) === null || _res$ === void 0 ? void 0 : _res$.body));
|
|
866
875
|
});
|
|
867
876
|
setLoading(false);
|
|
868
|
-
_context7.next =
|
|
877
|
+
_context7.next = 30;
|
|
869
878
|
break;
|
|
870
879
|
|
|
871
|
-
case
|
|
872
|
-
_context7.prev =
|
|
880
|
+
case 26:
|
|
881
|
+
_context7.prev = 26;
|
|
873
882
|
_context7.t0 = _context7["catch"](0);
|
|
874
883
|
setLoading(false);
|
|
875
884
|
console.log(_context7.t0);
|
|
876
885
|
|
|
877
|
-
case
|
|
886
|
+
case 30:
|
|
878
887
|
case "end":
|
|
879
888
|
return _context7.stop();
|
|
880
889
|
}
|
|
881
890
|
}
|
|
882
|
-
}, _callee7, null, [[0,
|
|
891
|
+
}, _callee7, null, [[0, 26]]);
|
|
883
892
|
}));
|
|
884
893
|
|
|
885
894
|
return function loadData() {
|
|
@@ -893,7 +902,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
893
902
|
}, [activeRetailer]);
|
|
894
903
|
|
|
895
904
|
var getServices = /*#__PURE__*/function () {
|
|
896
|
-
var
|
|
905
|
+
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
897
906
|
var _product$article10, _product$article11, _servicesResponse$dat;
|
|
898
907
|
|
|
899
908
|
var servicesResponse, parsedResponse, retailers, retailerResponse, active;
|
|
@@ -926,7 +935,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
926
935
|
}));
|
|
927
936
|
|
|
928
937
|
return function getServices() {
|
|
929
|
-
return
|
|
938
|
+
return _ref12.apply(this, arguments);
|
|
930
939
|
};
|
|
931
940
|
}();
|
|
932
941
|
|
|
@@ -940,7 +949,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
940
949
|
};
|
|
941
950
|
|
|
942
951
|
var getComments = /*#__PURE__*/function () {
|
|
943
|
-
var
|
|
952
|
+
var _ref13 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
|
|
944
953
|
var _product$article12, _product$article13, _product$article14;
|
|
945
954
|
|
|
946
955
|
var tab,
|
|
@@ -975,7 +984,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
975
984
|
}));
|
|
976
985
|
|
|
977
986
|
return function getComments() {
|
|
978
|
-
return
|
|
987
|
+
return _ref13.apply(this, arguments);
|
|
979
988
|
};
|
|
980
989
|
}();
|
|
981
990
|
|
|
@@ -1150,7 +1159,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1150
1159
|
};
|
|
1151
1160
|
|
|
1152
1161
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
1153
|
-
var
|
|
1162
|
+
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11() {
|
|
1154
1163
|
var dataClean, _product$article15, productTemp, articleId, dataObject, res, _JSON$parse2, newStatus, newArticleStatus;
|
|
1155
1164
|
|
|
1156
1165
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
@@ -1223,12 +1232,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1223
1232
|
}));
|
|
1224
1233
|
|
|
1225
1234
|
return function saveDescriptions() {
|
|
1226
|
-
return
|
|
1235
|
+
return _ref15.apply(this, arguments);
|
|
1227
1236
|
};
|
|
1228
1237
|
}();
|
|
1229
1238
|
|
|
1230
1239
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
1231
|
-
var
|
|
1240
|
+
var _ref16 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee12() {
|
|
1232
1241
|
var dataClean, _product$article16, productTemp, articleId, dataObject, res, _JSON$parse3, newStatus, newArticleStatus;
|
|
1233
1242
|
|
|
1234
1243
|
return _regenerator.default.wrap(function _callee12$(_context12) {
|
|
@@ -1301,7 +1310,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1301
1310
|
}));
|
|
1302
1311
|
|
|
1303
1312
|
return function saveDatasheets() {
|
|
1304
|
-
return
|
|
1313
|
+
return _ref16.apply(this, arguments);
|
|
1305
1314
|
};
|
|
1306
1315
|
}();
|
|
1307
1316
|
|
|
@@ -1601,8 +1610,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1601
1610
|
break;
|
|
1602
1611
|
}
|
|
1603
1612
|
|
|
1604
|
-
var services = servicesData.filter(function (
|
|
1605
|
-
var service =
|
|
1613
|
+
var services = servicesData.filter(function (_ref19) {
|
|
1614
|
+
var service = _ref19.service;
|
|
1606
1615
|
return concepts.includes(service);
|
|
1607
1616
|
});
|
|
1608
1617
|
var adminFacilitatorCanEvaluate = services.every(function (srv) {
|
|
@@ -1639,7 +1648,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1639
1648
|
};
|
|
1640
1649
|
|
|
1641
1650
|
var sendToFacilitator = /*#__PURE__*/function () {
|
|
1642
|
-
var
|
|
1651
|
+
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
|
|
1643
1652
|
var concept, productTemp, evalStatus, articleId, orderId, data, res, _message, specialistDone, _JSON$parse5, newStatus, newOrderStatus, newArticleStatus, messageToChat, _data;
|
|
1644
1653
|
|
|
1645
1654
|
return _regenerator.default.wrap(function _callee15$(_context15) {
|
|
@@ -1757,7 +1766,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1757
1766
|
}));
|
|
1758
1767
|
|
|
1759
1768
|
return function sendToFacilitator(_x5) {
|
|
1760
|
-
return
|
|
1769
|
+
return _ref20.apply(this, arguments);
|
|
1761
1770
|
};
|
|
1762
1771
|
}();
|
|
1763
1772
|
|
|
@@ -1788,7 +1797,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1788
1797
|
};
|
|
1789
1798
|
|
|
1790
1799
|
var createComment = /*#__PURE__*/function () {
|
|
1791
|
-
var
|
|
1800
|
+
var _ref21 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16(e, body, tab) {
|
|
1792
1801
|
var _product$article19;
|
|
1793
1802
|
|
|
1794
1803
|
var concept, data;
|
|
@@ -1845,7 +1854,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1845
1854
|
}));
|
|
1846
1855
|
|
|
1847
1856
|
return function createComment(_x6, _x7, _x8) {
|
|
1848
|
-
return
|
|
1857
|
+
return _ref21.apply(this, arguments);
|
|
1849
1858
|
};
|
|
1850
1859
|
}();
|
|
1851
1860
|
|
|
@@ -1914,9 +1923,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1914
1923
|
}).length === 0 && requiredCounter++;
|
|
1915
1924
|
});
|
|
1916
1925
|
objetcTemp["Imágenes"] = requiredCounter;
|
|
1917
|
-
console.log({
|
|
1918
|
-
requiredCounter: requiredCounter
|
|
1919
|
-
});
|
|
1920
1926
|
setRequiredNull(objetcTemp);
|
|
1921
1927
|
} catch (error) {
|
|
1922
1928
|
console.log(error);
|
|
@@ -1928,7 +1934,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1928
1934
|
}, [activeTab]);
|
|
1929
1935
|
|
|
1930
1936
|
var commentRevised = /*#__PURE__*/function () {
|
|
1931
|
-
var
|
|
1937
|
+
var _ref22 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
1932
1938
|
var data;
|
|
1933
1939
|
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
1934
1940
|
while (1) {
|
|
@@ -1958,12 +1964,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
1958
1964
|
}));
|
|
1959
1965
|
|
|
1960
1966
|
return function commentRevised() {
|
|
1961
|
-
return
|
|
1967
|
+
return _ref22.apply(this, arguments);
|
|
1962
1968
|
};
|
|
1963
1969
|
}();
|
|
1964
1970
|
|
|
1965
1971
|
var setAssignation = /*#__PURE__*/function () {
|
|
1966
|
-
var
|
|
1972
|
+
var _ref23 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee18(assignationType, assignationId) {
|
|
1967
1973
|
var _product$article20;
|
|
1968
1974
|
|
|
1969
1975
|
var concept, productTemp, data;
|
|
@@ -2022,7 +2028,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2022
2028
|
}));
|
|
2023
2029
|
|
|
2024
2030
|
return function setAssignation(_x9, _x10) {
|
|
2025
|
-
return
|
|
2031
|
+
return _ref23.apply(this, arguments);
|
|
2026
2032
|
};
|
|
2027
2033
|
}();
|
|
2028
2034
|
|
|
@@ -2041,7 +2047,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2041
2047
|
};
|
|
2042
2048
|
|
|
2043
2049
|
var deleteImages = /*#__PURE__*/function () {
|
|
2044
|
-
var
|
|
2050
|
+
var _ref24 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee19() {
|
|
2045
2051
|
var values, imgsInBack, imgsLeft, data;
|
|
2046
2052
|
return _regenerator.default.wrap(function _callee19$(_context19) {
|
|
2047
2053
|
while (1) {
|
|
@@ -2105,7 +2111,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2105
2111
|
}));
|
|
2106
2112
|
|
|
2107
2113
|
return function deleteImages() {
|
|
2108
|
-
return
|
|
2114
|
+
return _ref24.apply(this, arguments);
|
|
2109
2115
|
};
|
|
2110
2116
|
}();
|
|
2111
2117
|
|
|
@@ -2160,7 +2166,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2160
2166
|
}, [loading]);
|
|
2161
2167
|
|
|
2162
2168
|
var validateAll = /*#__PURE__*/function () {
|
|
2163
|
-
var
|
|
2169
|
+
var _ref25 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee20(result) {
|
|
2164
2170
|
var evaluationArray, conceptArray, messages, productTemp, messagesResponse;
|
|
2165
2171
|
return _regenerator.default.wrap(function _callee20$(_context20) {
|
|
2166
2172
|
while (1) {
|
|
@@ -2249,12 +2255,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2249
2255
|
}));
|
|
2250
2256
|
|
|
2251
2257
|
return function validateAll(_x11) {
|
|
2252
|
-
return
|
|
2258
|
+
return _ref25.apply(this, arguments);
|
|
2253
2259
|
};
|
|
2254
2260
|
}();
|
|
2255
2261
|
|
|
2256
2262
|
var getObservation = /*#__PURE__*/function () {
|
|
2257
|
-
var
|
|
2263
|
+
var _ref26 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
2258
2264
|
var response, parseData;
|
|
2259
2265
|
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
2260
2266
|
while (1) {
|
|
@@ -2281,7 +2287,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2281
2287
|
}));
|
|
2282
2288
|
|
|
2283
2289
|
return function getObservation() {
|
|
2284
|
-
return
|
|
2290
|
+
return _ref26.apply(this, arguments);
|
|
2285
2291
|
};
|
|
2286
2292
|
}();
|
|
2287
2293
|
|
|
@@ -2552,7 +2558,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2552
2558
|
label: "Aceptar",
|
|
2553
2559
|
size: 12,
|
|
2554
2560
|
onClick: /*#__PURE__*/function () {
|
|
2555
|
-
var
|
|
2561
|
+
var _ref28 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(e) {
|
|
2556
2562
|
var element, body;
|
|
2557
2563
|
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
2558
2564
|
while (1) {
|
|
@@ -2597,7 +2603,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2597
2603
|
}));
|
|
2598
2604
|
|
|
2599
2605
|
return function (_x12) {
|
|
2600
|
-
return
|
|
2606
|
+
return _ref28.apply(this, arguments);
|
|
2601
2607
|
};
|
|
2602
2608
|
}()
|
|
2603
2609
|
}, "btn-Aceptar")]
|
package/package.json
CHANGED
|
@@ -1861,6 +1861,47 @@ export const ProviderProductEdition = ({
|
|
|
1861
1861
|
const messages = [
|
|
1862
1862
|
{ type: "message", value: body?.replace(/<.*?\/?>/gm, "") },
|
|
1863
1863
|
];
|
|
1864
|
+
|
|
1865
|
+
if (
|
|
1866
|
+
messages[0].value.length === 0 ||
|
|
1867
|
+
!messages[0].value.trim()
|
|
1868
|
+
) {
|
|
1869
|
+
const container = document.querySelector(
|
|
1870
|
+
".container-customComponent"
|
|
1871
|
+
);
|
|
1872
|
+
|
|
1873
|
+
// Verificar si ya existe una alerta
|
|
1874
|
+
const existingAlert = container.querySelector(".alert-error");
|
|
1875
|
+
if (existingAlert) {
|
|
1876
|
+
return; // Si ya existe, no crear otra
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
// Crear alerta con estilos
|
|
1880
|
+
const alert = document.createElement("div");
|
|
1881
|
+
alert.className = "alert-error";
|
|
1882
|
+
alert.style.cssText = `
|
|
1883
|
+
color: #d32f2f;
|
|
1884
|
+
background-color: #ffebee;
|
|
1885
|
+
border: 1px solid #ef5350;
|
|
1886
|
+
border-radius: 4px;
|
|
1887
|
+
padding: 12px 16px;
|
|
1888
|
+
margin-top: 10px;
|
|
1889
|
+
font-size: 14px;
|
|
1890
|
+
display: flex;
|
|
1891
|
+
align-items: center;
|
|
1892
|
+
gap: 8px;
|
|
1893
|
+
font-family: 'Roboto', sans-serif;
|
|
1894
|
+
text-align: center;
|
|
1895
|
+
`;
|
|
1896
|
+
|
|
1897
|
+
alert.innerHTML = `
|
|
1898
|
+
<span>El mensaje no puede estar vacío.</span>
|
|
1899
|
+
`;
|
|
1900
|
+
|
|
1901
|
+
container.appendChild(alert);
|
|
1902
|
+
return;
|
|
1903
|
+
}
|
|
1904
|
+
console.log("Mensaje de rechazo:", messages);
|
|
1864
1905
|
await createComment(messages[0].value);
|
|
1865
1906
|
validatedAll ? validateAll("R") : sendToEvaluation("R");
|
|
1866
1907
|
setShowRejectModal(false);
|
|
@@ -361,7 +361,7 @@ export const RetailerProductEdition = ({
|
|
|
361
361
|
).innerHTML;
|
|
362
362
|
createComment(e, commentText, activeTab);
|
|
363
363
|
};
|
|
364
|
-
|
|
364
|
+
|
|
365
365
|
|
|
366
366
|
useEffect(async () => {
|
|
367
367
|
const { id_article } = product?.article || {};
|
|
@@ -400,20 +400,33 @@ export const RetailerProductEdition = ({
|
|
|
400
400
|
}, [checkAll]);
|
|
401
401
|
|
|
402
402
|
const loadData = async () => {
|
|
403
|
-
|
|
404
403
|
try {
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
product?.
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
404
|
+
const ids =
|
|
405
|
+
product?.statusByRetailer?.map((item) => item.retailer_id) ??
|
|
406
|
+
product?.statusByRetailer?.map((item) => item.id_retailer) ??
|
|
407
|
+
[];
|
|
408
|
+
const uniqueIds = [...new Set(ids)];
|
|
409
|
+
|
|
410
|
+
const categoryRetailer =
|
|
411
|
+
product?.article?.categoryRetailer?.filter((item) =>
|
|
412
|
+
uniqueIds.includes(item.id_retailer) && item.id_retailer === activeRetailer?.id
|
|
413
|
+
) ??
|
|
414
|
+
product?.article?.categoryRetailer?.filter((item) =>
|
|
415
|
+
uniqueIds.includes(item.retailer_id) && item.retailer_id === activeRetailer?.id
|
|
416
|
+
) ??
|
|
417
|
+
[];
|
|
418
|
+
|
|
419
|
+
console.log({ categoryRetailer });
|
|
420
|
+
|
|
421
|
+
const categoryName = categoryRetailer[0]?.category_name;
|
|
422
|
+
const categoryId = categoryRetailer[0]?.id_category;
|
|
423
|
+
|
|
424
|
+
const category_name =
|
|
425
|
+
categoryName ??
|
|
426
|
+
(product?.article?.company_name || product?.categoryName);
|
|
427
|
+
const category_id =
|
|
428
|
+
categoryId ??
|
|
429
|
+
parseInt(product?.article?.id_category || product?.id_category);
|
|
417
430
|
|
|
418
431
|
const retailer_id = activeRetailer?.id ?? categoryRetailer?.id_retailer;
|
|
419
432
|
|
|
@@ -426,7 +439,7 @@ export const RetailerProductEdition = ({
|
|
|
426
439
|
retailer_id
|
|
427
440
|
);
|
|
428
441
|
|
|
429
|
-
if (auditableVersion) {
|
|
442
|
+
if (auditableVersion && activeRetailer.id) {
|
|
430
443
|
loadAuditableData();
|
|
431
444
|
}
|
|
432
445
|
|
|
@@ -449,14 +462,18 @@ export const RetailerProductEdition = ({
|
|
|
449
462
|
// },
|
|
450
463
|
// ];
|
|
451
464
|
|
|
452
|
-
const data = [
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
465
|
+
const data = [
|
|
466
|
+
{
|
|
467
|
+
id_article: product?.article?.id_article,
|
|
468
|
+
relations: [
|
|
469
|
+
{
|
|
470
|
+
id_retailer: retailer_id,
|
|
471
|
+
id_category: category_id,
|
|
472
|
+
},
|
|
473
|
+
],
|
|
474
|
+
version: product.version,
|
|
475
|
+
},
|
|
476
|
+
];
|
|
460
477
|
|
|
461
478
|
const headers = { Authorization: token };
|
|
462
479
|
getPercentage({ data, headers }).then((res) => {
|
|
@@ -611,8 +628,8 @@ export const RetailerProductEdition = ({
|
|
|
611
628
|
}, [userGroups]);
|
|
612
629
|
|
|
613
630
|
useEffect(() => {
|
|
614
|
-
|
|
615
|
-
|
|
631
|
+
const retailerPercentages =
|
|
632
|
+
percentages?.[0]?.relations?.[0]?.percentagesGeneral;
|
|
616
633
|
|
|
617
634
|
const requiredPercentage = retailerPercentages?.required;
|
|
618
635
|
|
|
@@ -636,7 +653,8 @@ export const RetailerProductEdition = ({
|
|
|
636
653
|
getInputsData(services, activeRetailer, setDatasheets, setDescriptions);
|
|
637
654
|
auditableVersion && loadAuditableData();
|
|
638
655
|
setActivePercentage(Math.round(activeRetailer?.percentage, 0));
|
|
639
|
-
activeRetailer?.id &&
|
|
656
|
+
activeRetailer?.id &&
|
|
657
|
+
setImages({ action: "orderImages", retailerId: activeRetailer.id });
|
|
640
658
|
}, [activeRetailer, services]);
|
|
641
659
|
|
|
642
660
|
const thumbs = () => {
|
|
@@ -1031,7 +1049,7 @@ export const RetailerProductEdition = ({
|
|
|
1031
1049
|
};
|
|
1032
1050
|
|
|
1033
1051
|
const sendToFacilitator = async (result) => {
|
|
1034
|
-
if(!loading) setLoading(true);
|
|
1052
|
+
if (!loading) setLoading(true);
|
|
1035
1053
|
try {
|
|
1036
1054
|
let concept = getConcept(activeTab);
|
|
1037
1055
|
|
|
@@ -1184,36 +1202,33 @@ export const RetailerProductEdition = ({
|
|
|
1184
1202
|
|
|
1185
1203
|
let desInputsRequired = 0;
|
|
1186
1204
|
datasheetServicesArray?.forEach((datasheet) => {
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
srv.id_retailer === datasheet.retailer.id &&
|
|
1205
|
+
const [requested] = servicesData?.filter(
|
|
1206
|
+
(srv) =>
|
|
1207
|
+
srv.id_retailer === datasheet.retailer.id &&
|
|
1208
|
+
srv.service === getConcept(activeTab)
|
|
1190
1209
|
);
|
|
1191
1210
|
|
|
1192
|
-
requested &&
|
|
1211
|
+
requested &&
|
|
1212
|
+
datasheet?.data &&
|
|
1193
1213
|
Object.values(datasheet?.data).forEach((dataGroup) => {
|
|
1194
1214
|
dsInputsRequired.push(
|
|
1195
|
-
...dataGroup.inputs.filter(
|
|
1196
|
-
(
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
)
|
|
1206
|
-
|
|
1207
|
-
}
|
|
1208
|
-
);
|
|
1215
|
+
...dataGroup.inputs.filter((input) => {
|
|
1216
|
+
return (
|
|
1217
|
+
allDatasheetInputs[input].required &&
|
|
1218
|
+
allDatasheetInputs[input].id_retailer === activeRetailer.id &&
|
|
1219
|
+
(allDatasheetInputs[input].value === undefined ||
|
|
1220
|
+
!allDatasheetInputs[input].value)
|
|
1221
|
+
);
|
|
1222
|
+
})
|
|
1223
|
+
);
|
|
1224
|
+
});
|
|
1209
1225
|
});
|
|
1210
1226
|
|
|
1211
1227
|
objetcTemp["Ficha técnica"] = dsInputsRequired.length;
|
|
1212
1228
|
|
|
1213
1229
|
const regex = /(<\/?p>)|(<\/?strong>)|(<br>)/gm;
|
|
1214
1230
|
descriptionsServicesArray.forEach((description) => {
|
|
1215
|
-
|
|
1216
|
-
if(description.id != activeRetailer.id) return;
|
|
1231
|
+
if (description.id != activeRetailer.id) return;
|
|
1217
1232
|
|
|
1218
1233
|
const [requested] = servicesData.filter(
|
|
1219
1234
|
(srv) =>
|
|
@@ -1223,7 +1238,6 @@ export const RetailerProductEdition = ({
|
|
|
1223
1238
|
|
|
1224
1239
|
if (requested) {
|
|
1225
1240
|
description.inputs.forEach((input) => {
|
|
1226
|
-
|
|
1227
1241
|
if (
|
|
1228
1242
|
input.required &&
|
|
1229
1243
|
(!input.value || input.value?.replace(regex, "") === "")
|
|
@@ -1256,16 +1270,13 @@ export const RetailerProductEdition = ({
|
|
|
1256
1270
|
);
|
|
1257
1271
|
|
|
1258
1272
|
let requiredCounter = 0;
|
|
1259
|
-
requiredImages?.forEach(
|
|
1260
|
-
(
|
|
1261
|
-
|
|
1262
|
-
return services[2].values.filter((img) => img.image_id === req.id).length ===
|
|
1273
|
+
requiredImages?.forEach((req) => {
|
|
1274
|
+
return (
|
|
1275
|
+
services[2].values.filter((img) => img.image_id === req.id).length ===
|
|
1263
1276
|
0 && requiredCounter++
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
);
|
|
1277
|
+
);
|
|
1278
|
+
});
|
|
1267
1279
|
objetcTemp["Imágenes"] = requiredCounter;
|
|
1268
|
-
console.log({requiredCounter})
|
|
1269
1280
|
setRequiredNull(objetcTemp);
|
|
1270
1281
|
} catch (error) {
|
|
1271
1282
|
console.log(error);
|