contentoh-components-library 21.5.56 → 21.5.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/atoms/Commentary/index.js +3 -0
- package/dist/components/pages/ProviderProductEdition/index.js +44 -20
- package/dist/components/pages/RetailerProductEdition/index.js +37 -28
- package/package.json +1 -1
- package/src/components/atoms/Commentary/index.js +1 -1
- package/src/components/pages/ProviderProductEdition/index.js +40 -14
- package/src/components/pages/RetailerProductEdition/index.js +29 -11
|
@@ -15,6 +15,9 @@ var Commentary = function Commentary(_ref) {
|
|
|
15
15
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
|
|
16
16
|
reviewed: reviewed,
|
|
17
17
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
18
|
+
style: {
|
|
19
|
+
whiteSpace: "pre-wrap"
|
|
20
|
+
},
|
|
18
21
|
children: comment
|
|
19
22
|
})
|
|
20
23
|
});
|
|
@@ -917,7 +917,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
917
917
|
|
|
918
918
|
var loadData = /*#__PURE__*/function () {
|
|
919
919
|
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
920
|
-
var _ref7, _ref8, _product$categoryReta, _product$categoryReta2, _product$categoryReta3, _product$article, _product$article$cate, _product$article2, _product$article2$cat, _product$article3, _product$article4,
|
|
920
|
+
var _ref7, _ref8, _product$categoryReta, _product$categoryReta2, _product$categoryReta3, _product$article, _product$article$cate, _product$article2, _product$article2$cat, _product$article3, _product$article4, _product$article5, _services$, _services$$values, _product$article6;
|
|
921
921
|
|
|
922
922
|
var categoryRetailer, categoryName, categoryId, category_name, category_id, retailer_id, services, data, headers;
|
|
923
923
|
return _regenerator.default.wrap(function _callee8$(_context8) {
|
|
@@ -942,7 +942,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
942
942
|
|
|
943
943
|
category_name = categoryName !== null && categoryName !== void 0 ? categoryName : (product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.company_name) || (product === null || product === void 0 ? void 0 : product.categoryName);
|
|
944
944
|
category_id = categoryId !== null && categoryId !== void 0 ? categoryId : parseInt((product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_category) || (product === null || product === void 0 ? void 0 : product.id_category));
|
|
945
|
-
retailer_id = (
|
|
945
|
+
retailer_id = (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) || (categoryRetailer === null || categoryRetailer === void 0 ? void 0 : categoryRetailer.retailer_id) || (categoryRetailer === null || categoryRetailer === void 0 ? void 0 : categoryRetailer.id_retailer); // console.log({
|
|
946
946
|
// categoryName,
|
|
947
947
|
// categoryId,
|
|
948
948
|
// category_name,
|
|
@@ -2486,34 +2486,53 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2486
2486
|
label: "Aceptar",
|
|
2487
2487
|
size: 12,
|
|
2488
2488
|
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee21() {
|
|
2489
|
-
var
|
|
2489
|
+
var elements, brCounter, container, existingAlert, alert, fullMessage;
|
|
2490
2490
|
return _regenerator.default.wrap(function _callee21$(_context21) {
|
|
2491
2491
|
while (1) {
|
|
2492
2492
|
switch (_context21.prev = _context21.next) {
|
|
2493
2493
|
case 0:
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
}];
|
|
2499
|
-
|
|
2500
|
-
if (!(messages[0].value.length === 0 || !messages[0].value.trim())) {
|
|
2501
|
-
_context21.next = 13;
|
|
2494
|
+
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
2495
|
+
|
|
2496
|
+
if (!(!elements || elements.length === 0)) {
|
|
2497
|
+
_context21.next = 4;
|
|
2502
2498
|
break;
|
|
2503
2499
|
}
|
|
2504
2500
|
|
|
2505
|
-
|
|
2501
|
+
console.error("Elemento no encontrado");
|
|
2502
|
+
return _context21.abrupt("return");
|
|
2503
|
+
|
|
2504
|
+
case 4:
|
|
2505
|
+
brCounter = 0;
|
|
2506
|
+
elements.forEach(function (el) {
|
|
2507
|
+
var body = el.innerHTML;
|
|
2508
|
+
|
|
2509
|
+
if (typeof body !== "string") {
|
|
2510
|
+
console.log("El contenido de body no es una cadena", body);
|
|
2511
|
+
isMessageEmpty = true;
|
|
2512
|
+
return;
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
if (!body || body.replace(/<.*?\/?>/gm, "").trim() === "") {
|
|
2516
|
+
brCounter++;
|
|
2517
|
+
}
|
|
2518
|
+
});
|
|
2519
|
+
|
|
2520
|
+
if (!(brCounter === elements.length)) {
|
|
2521
|
+
_context21.next = 17;
|
|
2522
|
+
break;
|
|
2523
|
+
}
|
|
2506
2524
|
|
|
2525
|
+
container = document.querySelector(".container-customComponent");
|
|
2507
2526
|
existingAlert = container.querySelector(".alert-error");
|
|
2508
2527
|
|
|
2509
2528
|
if (!existingAlert) {
|
|
2510
|
-
_context21.next =
|
|
2529
|
+
_context21.next = 11;
|
|
2511
2530
|
break;
|
|
2512
2531
|
}
|
|
2513
2532
|
|
|
2514
2533
|
return _context21.abrupt("return");
|
|
2515
2534
|
|
|
2516
|
-
case
|
|
2535
|
+
case 11:
|
|
2517
2536
|
// Crear alerta con estilos
|
|
2518
2537
|
alert = document.createElement("div");
|
|
2519
2538
|
alert.className = "alert-error";
|
|
@@ -2522,16 +2541,21 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
|
|
|
2522
2541
|
container.appendChild(alert);
|
|
2523
2542
|
return _context21.abrupt("return");
|
|
2524
2543
|
|
|
2525
|
-
case
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2544
|
+
case 17:
|
|
2545
|
+
fullMessage = "";
|
|
2546
|
+
elements.forEach(function (element) {
|
|
2547
|
+
var body = element.innerHTML;
|
|
2548
|
+
fullMessage += body;
|
|
2549
|
+
});
|
|
2550
|
+
fullMessage = fullMessage.replace(/<br\s*\/?>/gi, "\n");
|
|
2551
|
+
_context21.next = 22;
|
|
2552
|
+
return createComment(fullMessage);
|
|
2529
2553
|
|
|
2530
|
-
case
|
|
2554
|
+
case 22:
|
|
2531
2555
|
validatedAll ? validateAll("R") : sendToEvaluation("R");
|
|
2532
2556
|
setShowRejectModal(false);
|
|
2533
2557
|
|
|
2534
|
-
case
|
|
2558
|
+
case 24:
|
|
2535
2559
|
case "end":
|
|
2536
2560
|
return _context21.stop();
|
|
2537
2561
|
}
|
|
@@ -295,7 +295,7 @@ var myBucket = new _awsSdk.default.S3({
|
|
|
295
295
|
});
|
|
296
296
|
|
|
297
297
|
var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
298
|
-
var _product$retailers, _location$state, _location$state2, _product$services2, _datasheets$, _datasheets$$data, _product$article22
|
|
298
|
+
var _product$retailers, _location$state, _location$state2, _product$services2, _datasheets$, _datasheets$$data, _product$article22;
|
|
299
299
|
|
|
300
300
|
var tabsSections = _ref3.tabsSections,
|
|
301
301
|
_ref3$productSelected = _ref3.productSelected,
|
|
@@ -2485,7 +2485,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2485
2485
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
2486
2486
|
className: "feedback-box",
|
|
2487
2487
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Commentary.Commentary, {
|
|
2488
|
-
comment: comment === null || comment === void 0 ? void 0 :
|
|
2488
|
+
comment: comment === null || comment === void 0 ? void 0 : comment.message,
|
|
2489
2489
|
reviewed: crossComment
|
|
2490
2490
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
2491
2491
|
buttonType: "circular-button accept-button",
|
|
@@ -2562,14 +2562,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2562
2562
|
size: 12,
|
|
2563
2563
|
onClick: /*#__PURE__*/function () {
|
|
2564
2564
|
var _ref28 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee23(e) {
|
|
2565
|
-
var
|
|
2565
|
+
var elements, brCounter, container, existingAlert, alert, fullMessage;
|
|
2566
2566
|
return _regenerator.default.wrap(function _callee23$(_context23) {
|
|
2567
2567
|
while (1) {
|
|
2568
2568
|
switch (_context23.prev = _context23.next) {
|
|
2569
2569
|
case 0:
|
|
2570
|
-
|
|
2570
|
+
elements = document.querySelectorAll("#modal-message-box .ql-container .ql-editor > p");
|
|
2571
2571
|
|
|
2572
|
-
if (
|
|
2572
|
+
if (!(!elements || elements.length === 0)) {
|
|
2573
2573
|
_context23.next = 4;
|
|
2574
2574
|
break;
|
|
2575
2575
|
}
|
|
@@ -2578,34 +2578,37 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2578
2578
|
return _context23.abrupt("return");
|
|
2579
2579
|
|
|
2580
2580
|
case 4:
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2581
|
+
brCounter = 0;
|
|
2582
|
+
elements.forEach(function (el) {
|
|
2583
|
+
var body = el.innerHTML;
|
|
2584
|
+
|
|
2585
|
+
if (typeof body !== "string") {
|
|
2586
|
+
console.log("El contenido de body no es una cadena", body);
|
|
2587
|
+
isMessageEmpty = true;
|
|
2588
|
+
return;
|
|
2589
|
+
}
|
|
2590
|
+
|
|
2591
|
+
if (!body || body.replace(/<.*?\/?>/gm, "").trim() === "") {
|
|
2592
|
+
brCounter++;
|
|
2593
|
+
}
|
|
2594
|
+
});
|
|
2595
|
+
|
|
2596
|
+
if (!(brCounter === elements.length)) {
|
|
2597
|
+
_context23.next = 17;
|
|
2594
2598
|
break;
|
|
2595
2599
|
}
|
|
2596
2600
|
|
|
2597
|
-
container = document.querySelector(".container-customComponent");
|
|
2598
|
-
|
|
2601
|
+
container = document.querySelector(".container-customComponent");
|
|
2599
2602
|
existingAlert = container.querySelector(".alert-error");
|
|
2600
2603
|
|
|
2601
2604
|
if (!existingAlert) {
|
|
2602
|
-
_context23.next =
|
|
2605
|
+
_context23.next = 11;
|
|
2603
2606
|
break;
|
|
2604
2607
|
}
|
|
2605
2608
|
|
|
2606
2609
|
return _context23.abrupt("return");
|
|
2607
2610
|
|
|
2608
|
-
case
|
|
2611
|
+
case 11:
|
|
2609
2612
|
// Crear alerta con estilos
|
|
2610
2613
|
alert = document.createElement("div");
|
|
2611
2614
|
alert.className = "alert-error";
|
|
@@ -2614,16 +2617,22 @@ var RetailerProductEdition = function RetailerProductEdition(_ref3) {
|
|
|
2614
2617
|
container.appendChild(alert);
|
|
2615
2618
|
return _context23.abrupt("return");
|
|
2616
2619
|
|
|
2617
|
-
case
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2620
|
+
case 17:
|
|
2621
|
+
fullMessage = "";
|
|
2622
|
+
elements.forEach(function (element) {
|
|
2623
|
+
var body = element.innerHTML;
|
|
2624
|
+
fullMessage += body;
|
|
2625
|
+
});
|
|
2626
|
+
fullMessage = fullMessage.replace(/<br\s*\/?>/gi, "\n");
|
|
2627
|
+
_context23.next = 22;
|
|
2628
|
+
return createComment(e, fullMessage, activeTab);
|
|
2629
|
+
|
|
2630
|
+
case 22:
|
|
2622
2631
|
valRejAll ? validateAll("R") : sendToFacilitator("R");
|
|
2623
2632
|
setMessage("Rechazado");
|
|
2624
2633
|
setShowRejectModal(false);
|
|
2625
2634
|
|
|
2626
|
-
case
|
|
2635
|
+
case 25:
|
|
2627
2636
|
case "end":
|
|
2628
2637
|
return _context23.stop();
|
|
2629
2638
|
}
|
package/package.json
CHANGED
|
@@ -522,7 +522,10 @@ export const ProviderProductEdition = ({
|
|
|
522
522
|
categoryId ??
|
|
523
523
|
parseInt(product?.article?.id_category || product?.id_category);
|
|
524
524
|
|
|
525
|
-
const retailer_id =
|
|
525
|
+
const retailer_id =
|
|
526
|
+
activeRetailer?.id ||
|
|
527
|
+
categoryRetailer?.retailer_id ||
|
|
528
|
+
categoryRetailer?.id_retailer;
|
|
526
529
|
|
|
527
530
|
// console.log({
|
|
528
531
|
// categoryName,
|
|
@@ -1864,22 +1867,36 @@ export const ProviderProductEdition = ({
|
|
|
1864
1867
|
label={"Aceptar"}
|
|
1865
1868
|
size={12}
|
|
1866
1869
|
onClick={async () => {
|
|
1867
|
-
const
|
|
1870
|
+
const elements = document.querySelectorAll(
|
|
1868
1871
|
"#modal-message-box .ql-container .ql-editor > p"
|
|
1869
|
-
)
|
|
1870
|
-
|
|
1871
|
-
|
|
1872
|
-
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1872
|
+
);
|
|
1873
|
+
|
|
1874
|
+
if (!elements || elements.length === 0) {
|
|
1875
|
+
console.error("Elemento no encontrado");
|
|
1876
|
+
return;
|
|
1877
|
+
}
|
|
1878
|
+
|
|
1879
|
+
let brCounter = 0;
|
|
1880
|
+
|
|
1881
|
+
elements.forEach((el) => {
|
|
1882
|
+
const body = el.innerHTML;
|
|
1883
|
+
|
|
1884
|
+
if (typeof body !== "string") {
|
|
1885
|
+
console.log("El contenido de body no es una cadena", body);
|
|
1886
|
+
isMessageEmpty = true;
|
|
1887
|
+
return;
|
|
1888
|
+
}
|
|
1889
|
+
|
|
1890
|
+
if (!body || body.replace(/<.*?\/?>/gm, "").trim() === "") {
|
|
1891
|
+
brCounter++;
|
|
1892
|
+
}
|
|
1893
|
+
});
|
|
1894
|
+
|
|
1895
|
+
if (brCounter === elements.length) {
|
|
1878
1896
|
const container = document.querySelector(
|
|
1879
1897
|
".container-customComponent"
|
|
1880
1898
|
);
|
|
1881
1899
|
|
|
1882
|
-
// Verificar si ya existe una alerta
|
|
1883
1900
|
const existingAlert = container.querySelector(".alert-error");
|
|
1884
1901
|
if (existingAlert) {
|
|
1885
1902
|
return; // Si ya existe, no crear otra
|
|
@@ -1910,8 +1927,17 @@ export const ProviderProductEdition = ({
|
|
|
1910
1927
|
container.appendChild(alert);
|
|
1911
1928
|
return;
|
|
1912
1929
|
}
|
|
1913
|
-
|
|
1914
|
-
|
|
1930
|
+
|
|
1931
|
+
let fullMessage = "";
|
|
1932
|
+
|
|
1933
|
+
elements.forEach((element) => {
|
|
1934
|
+
const body = element.innerHTML;
|
|
1935
|
+
|
|
1936
|
+
fullMessage += body;
|
|
1937
|
+
});
|
|
1938
|
+
|
|
1939
|
+
fullMessage = fullMessage.replace(/<br\s*\/?>/gi, "\n");
|
|
1940
|
+
await createComment(fullMessage);
|
|
1915
1941
|
validatedAll ? validateAll("R") : sendToEvaluation("R");
|
|
1916
1942
|
setShowRejectModal(false);
|
|
1917
1943
|
}}
|
|
@@ -1783,7 +1783,7 @@ export const RetailerProductEdition = ({
|
|
|
1783
1783
|
) : (
|
|
1784
1784
|
<div className="feedback-box">
|
|
1785
1785
|
<Commentary
|
|
1786
|
-
comment={comment?.message
|
|
1786
|
+
comment={comment?.message}
|
|
1787
1787
|
reviewed={crossComment}
|
|
1788
1788
|
/>
|
|
1789
1789
|
<Button
|
|
@@ -1880,28 +1880,36 @@ export const RetailerProductEdition = ({
|
|
|
1880
1880
|
label={"Aceptar"}
|
|
1881
1881
|
size={12}
|
|
1882
1882
|
onClick={async (e) => {
|
|
1883
|
-
const
|
|
1883
|
+
const elements = document.querySelectorAll(
|
|
1884
1884
|
"#modal-message-box .ql-container .ql-editor > p"
|
|
1885
1885
|
);
|
|
1886
1886
|
|
|
1887
|
-
if (!
|
|
1887
|
+
if (!elements || elements.length === 0) {
|
|
1888
1888
|
console.error("Elemento no encontrado");
|
|
1889
1889
|
return;
|
|
1890
1890
|
}
|
|
1891
1891
|
|
|
1892
|
-
|
|
1892
|
+
let brCounter = 0;
|
|
1893
1893
|
|
|
1894
|
-
|
|
1895
|
-
|
|
1896
|
-
|
|
1897
|
-
|
|
1894
|
+
elements.forEach((el) => {
|
|
1895
|
+
const body = el.innerHTML;
|
|
1896
|
+
|
|
1897
|
+
if (typeof body !== "string") {
|
|
1898
|
+
console.log("El contenido de body no es una cadena", body);
|
|
1899
|
+
isMessageEmpty = true;
|
|
1900
|
+
return;
|
|
1901
|
+
}
|
|
1902
|
+
|
|
1903
|
+
if (!body || body.replace(/<.*?\/?>/gm, "").trim() === "") {
|
|
1904
|
+
brCounter++;
|
|
1905
|
+
}
|
|
1906
|
+
});
|
|
1898
1907
|
|
|
1899
|
-
if (
|
|
1908
|
+
if (brCounter === elements.length) {
|
|
1900
1909
|
const container = document.querySelector(
|
|
1901
1910
|
".container-customComponent"
|
|
1902
1911
|
);
|
|
1903
1912
|
|
|
1904
|
-
// Verificar si ya existe una alerta
|
|
1905
1913
|
const existingAlert = container.querySelector(".alert-error");
|
|
1906
1914
|
if (existingAlert) {
|
|
1907
1915
|
return; // Si ya existe, no crear otra
|
|
@@ -1933,7 +1941,17 @@ export const RetailerProductEdition = ({
|
|
|
1933
1941
|
return;
|
|
1934
1942
|
}
|
|
1935
1943
|
|
|
1936
|
-
|
|
1944
|
+
let fullMessage = "";
|
|
1945
|
+
|
|
1946
|
+
elements.forEach((element) => {
|
|
1947
|
+
const body = element.innerHTML;
|
|
1948
|
+
|
|
1949
|
+
fullMessage += body;
|
|
1950
|
+
});
|
|
1951
|
+
|
|
1952
|
+
fullMessage = fullMessage.replace(/<br\s*\/?>/gi, "\n");
|
|
1953
|
+
|
|
1954
|
+
await createComment(e, fullMessage, activeTab);
|
|
1937
1955
|
valRejAll ? validateAll("R") : sendToFacilitator("R");
|
|
1938
1956
|
setMessage("Rechazado");
|
|
1939
1957
|
setShowRejectModal(false);
|