contentoh-components-library 21.5.19 → 21.5.21
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/UserSelector/UserSelector.stories.js +1 -1
- package/dist/components/atoms/UserSelector/index.js +4 -2
- package/dist/components/molecules/RowItem/styles.js +1 -1
- package/dist/components/molecules/StatusAsignationInfo/FinancedCompanies.js +1 -1
- package/dist/components/organisms/GridProducts/GridProducts.stories.js +102 -615
- package/dist/components/organisms/GridProducts/index.js +2 -2
- package/dist/components/organisms/InputGroup/index.js +30 -30
- package/dist/components/organisms/Table/styles.js +1 -1
- package/dist/components/pages/MultipleEdition/MultipleEdition.stories.js +1 -1
- package/dist/components/pages/MultipleEdition/saveData.js +19 -9
- package/dist/components/pages/MultipleEdition/styles.js +1 -1
- package/dist/components/pages/MultipleEdition/utils.js +153 -61
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +75 -72
- package/dist/components/pages/RetailerProductEdition/index.js +63 -19
- package/package.json +1 -1
- package/src/components/atoms/UserSelector/UserSelector.stories.js +1 -1
- package/src/components/atoms/UserSelector/index.js +7 -1
- package/src/components/molecules/RowItem/styles.js +1 -0
- package/src/components/molecules/StatusAsignationInfo/FinancedCompanies.js +43 -501
- package/src/components/molecules/StatusAsignationInfo/index.js +2 -3
- package/src/components/organisms/GridProducts/GridProducts.stories.js +107 -682
- package/src/components/organisms/GridProducts/index.js +2 -2
- package/src/components/organisms/InputGroup/index.js +47 -62
- package/src/components/organisms/Table/styles.js +5 -1
- package/src/components/pages/MultipleEdition/MultipleEdition.stories.js +1 -1
- package/src/components/pages/MultipleEdition/saveData.js +6 -7
- package/src/components/pages/MultipleEdition/styles.js +1 -7
- package/src/components/pages/MultipleEdition/utils.js +24 -47
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +79 -72
- package/src/components/pages/RetailerProductEdition/index.js +93 -29
|
@@ -8,6 +8,7 @@ import { InputGroup } from "../../organisms/InputGroup";
|
|
|
8
8
|
import { useEffect, useReducer, useState, useCallback } from "react";
|
|
9
9
|
import { GalleryElement } from "../../molecules/GalleryElement";
|
|
10
10
|
import { saveAs } from "file-saver";
|
|
11
|
+
import { Commentary } from "../../atoms/Commentary";
|
|
11
12
|
import {
|
|
12
13
|
getRetailerServices,
|
|
13
14
|
getPercentage,
|
|
@@ -93,18 +94,21 @@ const reducerImages = (state, action) => {
|
|
|
93
94
|
inputsByRetailer[action.retailerId]?.filter((input) => {
|
|
94
95
|
imageIdArray.push(input.id_image);
|
|
95
96
|
valuesInitial.forEach(async (value) => {
|
|
96
|
-
if(value.ext=="mp4"){
|
|
97
|
-
convertirVideoABase64(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
97
|
+
if (value.ext == "mp4") {
|
|
98
|
+
convertirVideoABase64(
|
|
99
|
+
"https://" +
|
|
100
|
+
process.env.REACT_APP_IMAGES_BUCKET +
|
|
101
|
+
".s3.amazonaws.com/" +
|
|
102
|
+
value.srcDB
|
|
103
|
+
)
|
|
104
|
+
.then(async (base64) => {
|
|
105
|
+
const videoSrc =
|
|
106
|
+
"data:video/mp4;base64," + base64.split(",")[1]; // Añade el tipo MIME adecuado
|
|
107
|
+
value.src = await generateThumbnail(videoSrc, 2);
|
|
108
|
+
})
|
|
109
|
+
.catch((error) => {
|
|
110
|
+
console.error("Error:", error);
|
|
111
|
+
});
|
|
108
112
|
}
|
|
109
113
|
if (value.image_id === input.id_image) orderedImages.push(value);
|
|
110
114
|
});
|
|
@@ -129,22 +133,22 @@ const REGION = "us-east-1";
|
|
|
129
133
|
function convertirVideoABase64(url) {
|
|
130
134
|
return new Promise((resolve, reject) => {
|
|
131
135
|
const xhr = new XMLHttpRequest();
|
|
132
|
-
xhr.open(
|
|
133
|
-
xhr.responseType =
|
|
134
|
-
xhr.onload = function() {
|
|
136
|
+
xhr.open("GET", url, true);
|
|
137
|
+
xhr.responseType = "blob";
|
|
138
|
+
xhr.onload = function () {
|
|
135
139
|
if (xhr.status === 200) {
|
|
136
140
|
const blob = xhr.response;
|
|
137
141
|
const reader = new FileReader();
|
|
138
|
-
reader.onloadend = function() {
|
|
142
|
+
reader.onloadend = function () {
|
|
139
143
|
resolve(reader.result);
|
|
140
144
|
};
|
|
141
145
|
reader.readAsDataURL(blob);
|
|
142
146
|
} else {
|
|
143
|
-
reject(new Error(
|
|
147
|
+
reject(new Error("Error al cargar el video"));
|
|
144
148
|
}
|
|
145
149
|
};
|
|
146
|
-
xhr.onerror = function() {
|
|
147
|
-
reject(new Error(
|
|
150
|
+
xhr.onerror = function () {
|
|
151
|
+
reject(new Error("Error de red al cargar el video"));
|
|
148
152
|
};
|
|
149
153
|
xhr.send();
|
|
150
154
|
});
|
|
@@ -152,16 +156,15 @@ function convertirVideoABase64(url) {
|
|
|
152
156
|
|
|
153
157
|
function obtenerDuracionVideoBase64(base64Data) {
|
|
154
158
|
return new Promise((resolve, reject) => {
|
|
155
|
-
const video = document.createElement(
|
|
159
|
+
const video = document.createElement("video");
|
|
156
160
|
video.src = base64Data;
|
|
157
|
-
video.addEventListener(
|
|
161
|
+
video.addEventListener("loadedmetadata", () => {
|
|
158
162
|
resolve(video.duration);
|
|
159
163
|
});
|
|
160
|
-
video.addEventListener(
|
|
164
|
+
video.addEventListener("error", reject);
|
|
161
165
|
});
|
|
162
166
|
}
|
|
163
167
|
|
|
164
|
-
|
|
165
168
|
AWS.config.update({
|
|
166
169
|
accessKeyId: process.env.REACT_APP_KUTS3,
|
|
167
170
|
secretAccessKey: process.env.REACT_APP_AKUTS3,
|
|
@@ -312,7 +315,7 @@ export const RetailerProductEdition = ({
|
|
|
312
315
|
const [auditDescriptions, setAuditDescriptions] = useState([]);
|
|
313
316
|
const [auditImages, setAuditImages] = useState([]);
|
|
314
317
|
const [compare, setCompare] = useState(false);
|
|
315
|
-
const [observation,setObservation] = useState();
|
|
318
|
+
const [observation, setObservation] = useState();
|
|
316
319
|
const [valRejAll, setValRejAll] = useState(false);
|
|
317
320
|
const [modalAlert, setModalAlert] = useState({
|
|
318
321
|
show: false,
|
|
@@ -761,14 +764,13 @@ export const RetailerProductEdition = ({
|
|
|
761
764
|
const promiseArray = [];
|
|
762
765
|
data?.articleData?.forEach((e) => {
|
|
763
766
|
let file;
|
|
764
|
-
if(e.ext=="mp4"){
|
|
767
|
+
if (e.ext == "mp4") {
|
|
765
768
|
file = Buffer.from(
|
|
766
769
|
e.video_src.replace(/^data:video\/\w+;base64,/, ""),
|
|
767
770
|
"base64"
|
|
768
771
|
);
|
|
769
|
-
e.video_src="";
|
|
770
|
-
}
|
|
771
|
-
else{
|
|
772
|
+
e.video_src = "";
|
|
773
|
+
} else {
|
|
772
774
|
file = Buffer.from(
|
|
773
775
|
e.src.replace(/^data:image\/\w+;base64,/, ""),
|
|
774
776
|
"base64"
|
|
@@ -1494,7 +1496,7 @@ export const RetailerProductEdition = ({
|
|
|
1494
1496
|
isObservationVisible={isObservationVisible}
|
|
1495
1497
|
toggleObservation={toggleObservation}
|
|
1496
1498
|
// handleClickOutside={handleClickOutside}
|
|
1497
|
-
|
|
1499
|
+
hideObservation={hideObservation}
|
|
1498
1500
|
/>
|
|
1499
1501
|
<FullTabsMenu
|
|
1500
1502
|
tabsSections={tabsSections}
|
|
@@ -1626,9 +1628,71 @@ export const RetailerProductEdition = ({
|
|
|
1626
1628
|
</>
|
|
1627
1629
|
)}
|
|
1628
1630
|
</div>
|
|
1631
|
+
{/* {(userAssigned(activeTab) || auditorAssigned()) &&
|
|
1632
|
+
product[`${getConcept(activeTab)}_status`] !== "NS" && (
|
|
1633
|
+
<div className="commentary-box">
|
|
1634
|
+
{[7, 8].includes(user.id_role) && (
|
|
1635
|
+
<Button
|
|
1636
|
+
buttonType={
|
|
1637
|
+
evaluationFinished(
|
|
1638
|
+
user.id_role,
|
|
1639
|
+
activeTab,
|
|
1640
|
+
statusArray
|
|
1641
|
+
) && requiredNull[activeTab] === 0
|
|
1642
|
+
? "general-green-button"
|
|
1643
|
+
: "general-button-disabled"
|
|
1644
|
+
}
|
|
1645
|
+
label={"Enviar evaluación"}
|
|
1646
|
+
onClick={() => sendToFacilitator()}
|
|
1647
|
+
/>
|
|
1648
|
+
)}
|
|
1649
|
+
</div>
|
|
1650
|
+
)} */}
|
|
1651
|
+
|
|
1629
1652
|
{(userAssigned(activeTab) || auditorAssigned()) &&
|
|
1630
1653
|
product[`${getConcept(activeTab)}_status`] !== "NS" && (
|
|
1631
1654
|
<div className="commentary-box">
|
|
1655
|
+
{!comment ? (
|
|
1656
|
+
<div className="commentary">
|
|
1657
|
+
<TagAndInput
|
|
1658
|
+
label={"Caja de Comentario"}
|
|
1659
|
+
inputType={"textarea"}
|
|
1660
|
+
inputCols={80}
|
|
1661
|
+
inputRows={4}
|
|
1662
|
+
inputId={"commentary-box"}
|
|
1663
|
+
index={0}
|
|
1664
|
+
/>
|
|
1665
|
+
<div className="buttons-box">
|
|
1666
|
+
<Button
|
|
1667
|
+
buttonType={"general-transparent-button"}
|
|
1668
|
+
label={"Enviar comentario"}
|
|
1669
|
+
onClick={(e) =>
|
|
1670
|
+
createComment(
|
|
1671
|
+
e,
|
|
1672
|
+
document.querySelector(
|
|
1673
|
+
"#commentary-box .ql-container .ql-editor > p"
|
|
1674
|
+
).innerHTML,
|
|
1675
|
+
activeTab
|
|
1676
|
+
)
|
|
1677
|
+
}
|
|
1678
|
+
/>
|
|
1679
|
+
</div>
|
|
1680
|
+
</div>
|
|
1681
|
+
) : (
|
|
1682
|
+
<div className="feedback-box">
|
|
1683
|
+
<Commentary
|
|
1684
|
+
comment={comment?.message?.replace(/<.*?\/?>/gm, "")}
|
|
1685
|
+
reviewed={crossComment}
|
|
1686
|
+
/>
|
|
1687
|
+
<Button
|
|
1688
|
+
buttonType={"circular-button accept-button"}
|
|
1689
|
+
onClick={async () => {
|
|
1690
|
+
setCrossComment(true);
|
|
1691
|
+
commentRevised();
|
|
1692
|
+
}}
|
|
1693
|
+
/>
|
|
1694
|
+
</div>
|
|
1695
|
+
)}
|
|
1632
1696
|
{[7, 8].includes(user.id_role) && (
|
|
1633
1697
|
<Button
|
|
1634
1698
|
buttonType={
|