contentoh-components-library 21.3.54 → 21.3.56
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/.env.development +0 -2
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +11 -68
- package/dist/components/organisms/Chat/Chat.stories.js +1 -21
- package/dist/components/organisms/Chat/ContainerItems/index.js +3 -19
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +191 -343
- package/dist/components/organisms/Chat/Footer/index.js +39 -48
- package/dist/components/organisms/Chat/index.js +3 -48
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- package/dist/components/pages/Dashboard/Dashboard.stories.js +41 -34
- package/dist/components/pages/Dashboard/index.js +2 -2
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +127 -172
- package/dist/components/pages/ProviderProductEdition/index.js +129 -188
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +78 -75
- package/dist/components/pages/RetailerProductEdition/index.js +296 -287
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
- package/package.json +1 -1
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/HeaderTop/index.js +6 -52
- package/src/components/organisms/Chat/Chat.stories.js +0 -21
- package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
- package/src/components/organisms/Chat/ContainerItems/styles.js +2 -10
- package/src/components/organisms/Chat/ContentChat/index.js +6 -81
- package/src/components/organisms/Chat/Footer/index.js +0 -11
- package/src/components/organisms/Chat/index.js +3 -47
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/OrderDetail/index.js +0 -1
- package/src/components/pages/Dashboard/Dashboard.stories.js +43 -34
- package/src/components/pages/Dashboard/index.js +2 -2
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +130 -177
- package/src/components/pages/ProviderProductEdition/index.js +55 -105
- package/src/components/pages/ProviderProductEdition/styles.js +1 -5
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +74 -69
- package/src/components/pages/RetailerProductEdition/index.js +157 -129
- package/src/components/pages/RetailerProductEdition/styles.js +0 -4
- package/src/components/pages/RetailerProductEdition/utils.js +0 -37
|
@@ -24,20 +24,15 @@ import descriptionSent from "../../../assets/images/modalsSVGs/descriptionSent.s
|
|
|
24
24
|
import imagesSent from "../../../assets/images/modalsSVGs/uploadingImages.svg";
|
|
25
25
|
import { TagAndInput } from "../../molecules/TagAndInput/index";
|
|
26
26
|
import { Button } from "../../atoms/GeneralButton";
|
|
27
|
+
import { Commentary } from "../../atoms/Commentary";
|
|
27
28
|
import { GenericModal } from "../../atoms/GenericModal";
|
|
28
29
|
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
29
30
|
import { Loading } from "../../atoms/Loading";
|
|
30
31
|
import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
|
|
32
|
+
import errorModal from "../../../assets/images/genericModal/errorModal.svg";
|
|
31
33
|
import { VersionSelector } from "../../organisms/VersionSelector";
|
|
32
34
|
import { useCloseModal } from "../../../global-files/customHooks";
|
|
33
|
-
import {
|
|
34
|
-
getAuditVersion,
|
|
35
|
-
getInputsData,
|
|
36
|
-
createMessage,
|
|
37
|
-
sendMessage,
|
|
38
|
-
} from "./utils";
|
|
39
|
-
import { Modal } from "../../organisms/Modal";
|
|
40
|
-
import { ButtonV2 } from "../../atoms/ButtonV2";
|
|
35
|
+
import { getAuditVersion, getInputsData } from "./utils";
|
|
41
36
|
|
|
42
37
|
const reducerImages = (state, action) => {
|
|
43
38
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -137,7 +132,6 @@ export const RetailerProductEdition = ({
|
|
|
137
132
|
const [datasheets, setDatasheets] = useState([]);
|
|
138
133
|
const [images, setImages] = useReducer(reducerImages, {});
|
|
139
134
|
const [showModal, setShowModal] = useState(false);
|
|
140
|
-
const [showRejectModal, setShowRejectModal] = useState(false);
|
|
141
135
|
const { getRootProps, getInputProps } = useDropzone({
|
|
142
136
|
accept: "image/*",
|
|
143
137
|
noKeyboard: true,
|
|
@@ -224,7 +218,6 @@ export const RetailerProductEdition = ({
|
|
|
224
218
|
const [auditDescriptions, setAuditDescriptions] = useState([]);
|
|
225
219
|
const [auditImages, setAuditImages] = useState([]);
|
|
226
220
|
const [compare, setCompare] = useState(false);
|
|
227
|
-
const [valRejAll, setValRejAll] = useState(false);
|
|
228
221
|
|
|
229
222
|
useEffect(async () => {
|
|
230
223
|
const { id_article } = product?.article || {};
|
|
@@ -862,25 +855,6 @@ export const RetailerProductEdition = ({
|
|
|
862
855
|
const { newStatus, newOrderStatus, newArticleStatus } = JSON.parse(
|
|
863
856
|
res.data.body
|
|
864
857
|
);
|
|
865
|
-
const messageToChat = createMessage(
|
|
866
|
-
product.retailers,
|
|
867
|
-
activeRetailer.id,
|
|
868
|
-
evalStatus,
|
|
869
|
-
newStatus,
|
|
870
|
-
activeTab
|
|
871
|
-
);
|
|
872
|
-
|
|
873
|
-
const data = {
|
|
874
|
-
paramsBody: {
|
|
875
|
-
id: product.article.id_article,
|
|
876
|
-
version: version,
|
|
877
|
-
items: [{ type: "status", value: messageToChat }],
|
|
878
|
-
retailerId: activeRetailer.id,
|
|
879
|
-
status: product.status,
|
|
880
|
-
},
|
|
881
|
-
paramsHeader: { Authorization: token },
|
|
882
|
-
};
|
|
883
|
-
await sendMessage(data);
|
|
884
858
|
if (newOrderStatus) productTemp.status = newArticleStatus[articleId];
|
|
885
859
|
productTemp[`${concept}_status`] = newStatus;
|
|
886
860
|
await loadData();
|
|
@@ -923,19 +897,35 @@ export const RetailerProductEdition = ({
|
|
|
923
897
|
return product?.article[`id_auditor`] === user.id_user;
|
|
924
898
|
};
|
|
925
899
|
|
|
926
|
-
const createComment = async (
|
|
900
|
+
const createComment = async (e, body, tab) => {
|
|
901
|
+
let concept = "";
|
|
902
|
+
switch (activeTab) {
|
|
903
|
+
case "Ficha técnica":
|
|
904
|
+
concept = "datasheet";
|
|
905
|
+
break;
|
|
906
|
+
case "Imágenes":
|
|
907
|
+
concept = "images";
|
|
908
|
+
break;
|
|
909
|
+
|
|
910
|
+
default:
|
|
911
|
+
concept = "description";
|
|
912
|
+
break;
|
|
913
|
+
}
|
|
927
914
|
const data = {
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
status: product.status,
|
|
934
|
-
},
|
|
935
|
-
paramsHeader: { Authorization: token },
|
|
915
|
+
articleId: product?.article?.id_article,
|
|
916
|
+
orderId: product?.orderId,
|
|
917
|
+
message: body?.replace(/<.*?\/?>/gm, ""),
|
|
918
|
+
concept: concept,
|
|
919
|
+
version: version,
|
|
936
920
|
};
|
|
921
|
+
await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
922
|
+
headers: {
|
|
923
|
+
Authorization: token,
|
|
924
|
+
},
|
|
925
|
+
});
|
|
926
|
+
await getComments(tab);
|
|
937
927
|
setMessage("");
|
|
938
|
-
|
|
928
|
+
setComponentsArray([]);
|
|
939
929
|
};
|
|
940
930
|
|
|
941
931
|
const getRequired = (services) => {
|
|
@@ -1218,42 +1208,29 @@ export const RetailerProductEdition = ({
|
|
|
1218
1208
|
break;
|
|
1219
1209
|
}
|
|
1220
1210
|
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
servicesData?.forEach((ret) => {
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
ret.id_retailer
|
|
1245
|
-
)
|
|
1246
|
-
);
|
|
1247
|
-
}
|
|
1248
|
-
evaluationArray.push(
|
|
1249
|
-
axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
1250
|
-
headers: {
|
|
1251
|
-
Authorization: token,
|
|
1252
|
-
},
|
|
1253
|
-
})
|
|
1254
|
-
);
|
|
1255
|
-
}
|
|
1256
|
-
});
|
|
1211
|
+
//We comment this part of the code because it does not match with the correct flow
|
|
1212
|
+
|
|
1213
|
+
// servicesData?.forEach((ret) => {
|
|
1214
|
+
// if (conceptArray.includes(ret.service)) {
|
|
1215
|
+
// let data = {
|
|
1216
|
+
// articleId: product.article.id_article,
|
|
1217
|
+
// orderId: product.id_order ?? product.orderId,
|
|
1218
|
+
// concept: ret.service,
|
|
1219
|
+
// result: result,
|
|
1220
|
+
// evalStatus: product[`${ret.service}_status`],
|
|
1221
|
+
// retailerId: ret.id_retailer,
|
|
1222
|
+
// };
|
|
1223
|
+
// evaluationArray.push(
|
|
1224
|
+
// axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
1225
|
+
// headers: {
|
|
1226
|
+
// Authorization: token,
|
|
1227
|
+
// },
|
|
1228
|
+
// })
|
|
1229
|
+
// );
|
|
1230
|
+
// }
|
|
1231
|
+
// });
|
|
1232
|
+
|
|
1233
|
+
// await Promise.all(evaluationArray);
|
|
1257
1234
|
|
|
1258
1235
|
conceptArray?.forEach((concept) => {
|
|
1259
1236
|
let data = {
|
|
@@ -1274,14 +1251,13 @@ export const RetailerProductEdition = ({
|
|
|
1274
1251
|
const productTemp = product;
|
|
1275
1252
|
productTemp.status = `${result}A`;
|
|
1276
1253
|
productTemp.datasheet_status =
|
|
1277
|
-
productTemp.datasheet_status === "
|
|
1254
|
+
productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
|
|
1278
1255
|
productTemp.description_status =
|
|
1279
|
-
productTemp.description_status === "
|
|
1256
|
+
productTemp.description_status === "NA" ? "NA" : `${result}A`;
|
|
1280
1257
|
productTemp.images_status =
|
|
1281
|
-
productTemp.images_status === "
|
|
1258
|
+
productTemp.images_status === "NA" ? "NA" : `${result}A`;
|
|
1282
1259
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1283
1260
|
setProduct(productTemp);
|
|
1284
|
-
const messagesResponse = await Promise.all(messages);
|
|
1285
1261
|
|
|
1286
1262
|
await loadData();
|
|
1287
1263
|
} catch (error) {
|
|
@@ -1297,10 +1273,8 @@ export const RetailerProductEdition = ({
|
|
|
1297
1273
|
setCompare={setCompare}
|
|
1298
1274
|
isAuditor={[1, 6].includes(user.id_role)}
|
|
1299
1275
|
withChat={location?.state?.withChat}
|
|
1300
|
-
|
|
1301
|
-
productSelected={product}
|
|
1276
|
+
productSelected={productSelected}
|
|
1302
1277
|
token={token}
|
|
1303
|
-
activeRetailer={activeRetailer}
|
|
1304
1278
|
/>
|
|
1305
1279
|
<div className="data-container">
|
|
1306
1280
|
<div className="image-data-panel">
|
|
@@ -1340,7 +1314,36 @@ export const RetailerProductEdition = ({
|
|
|
1340
1314
|
sendToFacilitator("A");
|
|
1341
1315
|
}}
|
|
1342
1316
|
reject={() => {
|
|
1343
|
-
|
|
1317
|
+
sendToFacilitator("R");
|
|
1318
|
+
setMessage("Rechazado");
|
|
1319
|
+
setComponentsArray([
|
|
1320
|
+
<img src={errorModal} />,
|
|
1321
|
+
<ScreenHeader
|
|
1322
|
+
text={"Agrega tu comentarios para enviar el rechazo"}
|
|
1323
|
+
headerType={"input-name-header"}
|
|
1324
|
+
color={"white"}
|
|
1325
|
+
/>,
|
|
1326
|
+
<TagAndInput
|
|
1327
|
+
label={"Caja de Comentario"}
|
|
1328
|
+
inputType={"textarea"}
|
|
1329
|
+
inputId={"modal-commentary-box"}
|
|
1330
|
+
index={0}
|
|
1331
|
+
color={"white"}
|
|
1332
|
+
/>,
|
|
1333
|
+
<Button
|
|
1334
|
+
buttonType={"general-default-button"}
|
|
1335
|
+
label={"Enviar comentario"}
|
|
1336
|
+
onClick={(e) =>
|
|
1337
|
+
createComment(
|
|
1338
|
+
e,
|
|
1339
|
+
document.querySelector(
|
|
1340
|
+
"#modal-commentary-box .ql-container .ql-editor > p"
|
|
1341
|
+
).innerHTML,
|
|
1342
|
+
activeTab
|
|
1343
|
+
)
|
|
1344
|
+
}
|
|
1345
|
+
/>,
|
|
1346
|
+
]);
|
|
1344
1347
|
}}
|
|
1345
1348
|
showApproveRejectAll={
|
|
1346
1349
|
approveRejectAllButtons() && (auditorAssigned() || userAssigned())
|
|
@@ -1350,8 +1353,36 @@ export const RetailerProductEdition = ({
|
|
|
1350
1353
|
}
|
|
1351
1354
|
approveAll={() => validateAll("A")}
|
|
1352
1355
|
rejectAll={() => {
|
|
1353
|
-
|
|
1354
|
-
|
|
1356
|
+
validateAll("R");
|
|
1357
|
+
setMessage("Rechazado");
|
|
1358
|
+
setComponentsArray([
|
|
1359
|
+
<img src={errorModal} />,
|
|
1360
|
+
<ScreenHeader
|
|
1361
|
+
text={"Agrega tu comentarios para enviar el rechazo"}
|
|
1362
|
+
headerType={"input-name-header"}
|
|
1363
|
+
color={"white"}
|
|
1364
|
+
/>,
|
|
1365
|
+
<TagAndInput
|
|
1366
|
+
label={"Caja de Comentario"}
|
|
1367
|
+
inputType={"textarea"}
|
|
1368
|
+
inputId={"modal-commentary-box"}
|
|
1369
|
+
index={0}
|
|
1370
|
+
color={"white"}
|
|
1371
|
+
/>,
|
|
1372
|
+
<Button
|
|
1373
|
+
buttonType={"general-default-button"}
|
|
1374
|
+
label={"Enviar comentario"}
|
|
1375
|
+
onClick={(e) =>
|
|
1376
|
+
createComment(
|
|
1377
|
+
e,
|
|
1378
|
+
document.querySelector(
|
|
1379
|
+
"#modal-commentary-box .ql-container .ql-editor > p"
|
|
1380
|
+
).innerHTML,
|
|
1381
|
+
activeTab
|
|
1382
|
+
)
|
|
1383
|
+
}
|
|
1384
|
+
/>,
|
|
1385
|
+
]);
|
|
1355
1386
|
}}
|
|
1356
1387
|
/>
|
|
1357
1388
|
<FullTabsMenu
|
|
@@ -1472,6 +1503,47 @@ export const RetailerProductEdition = ({
|
|
|
1472
1503
|
{(userAssigned(activeTab) || auditorAssigned()) &&
|
|
1473
1504
|
product[`${getConcept(activeTab)}_status`] !== "NS" && (
|
|
1474
1505
|
<div className="commentary-box">
|
|
1506
|
+
{!comment ? (
|
|
1507
|
+
<div className="commentary">
|
|
1508
|
+
<TagAndInput
|
|
1509
|
+
label={"Caja de Comentario"}
|
|
1510
|
+
inputType={"textarea"}
|
|
1511
|
+
inputCols={80}
|
|
1512
|
+
inputRows={4}
|
|
1513
|
+
inputId={"commentary-box"}
|
|
1514
|
+
index={0}
|
|
1515
|
+
/>
|
|
1516
|
+
<div className="buttons-box">
|
|
1517
|
+
<Button
|
|
1518
|
+
buttonType={"general-transparent-button"}
|
|
1519
|
+
label={"Enviar comentario"}
|
|
1520
|
+
onClick={(e) =>
|
|
1521
|
+
createComment(
|
|
1522
|
+
e,
|
|
1523
|
+
document.querySelector(
|
|
1524
|
+
"#commentary-box .ql-container .ql-editor > p"
|
|
1525
|
+
).innerHTML,
|
|
1526
|
+
activeTab
|
|
1527
|
+
)
|
|
1528
|
+
}
|
|
1529
|
+
/>
|
|
1530
|
+
</div>
|
|
1531
|
+
</div>
|
|
1532
|
+
) : (
|
|
1533
|
+
<div className="feedback-box">
|
|
1534
|
+
<Commentary
|
|
1535
|
+
comment={comment?.message?.replace(/<.*?\/?>/gm, "")}
|
|
1536
|
+
reviewed={crossComment}
|
|
1537
|
+
/>
|
|
1538
|
+
<Button
|
|
1539
|
+
buttonType={"circular-button accept-button"}
|
|
1540
|
+
onClick={async () => {
|
|
1541
|
+
setCrossComment(true);
|
|
1542
|
+
commentRevised();
|
|
1543
|
+
}}
|
|
1544
|
+
/>
|
|
1545
|
+
</div>
|
|
1546
|
+
)}
|
|
1475
1547
|
{[7, 8].includes(user.id_role) && (
|
|
1476
1548
|
<Button
|
|
1477
1549
|
buttonType={
|
|
@@ -1529,50 +1601,6 @@ export const RetailerProductEdition = ({
|
|
|
1529
1601
|
jwt={token}
|
|
1530
1602
|
/>
|
|
1531
1603
|
)}
|
|
1532
|
-
{showRejectModal && (
|
|
1533
|
-
<Modal
|
|
1534
|
-
title={"Agregar mensaje de rechazo"}
|
|
1535
|
-
show={showRejectModal}
|
|
1536
|
-
customComponent={
|
|
1537
|
-
<TagAndInput
|
|
1538
|
-
label={"Caja de Comentario"}
|
|
1539
|
-
inputType={"textarea"}
|
|
1540
|
-
inputId={"modal-message-box"}
|
|
1541
|
-
index={0}
|
|
1542
|
-
color={"white"}
|
|
1543
|
-
/>
|
|
1544
|
-
}
|
|
1545
|
-
buttons={[
|
|
1546
|
-
<ButtonV2
|
|
1547
|
-
key={"btn-Cancelar"}
|
|
1548
|
-
type={"white"}
|
|
1549
|
-
label={"Cancelar"}
|
|
1550
|
-
size={12}
|
|
1551
|
-
onClick={() => {
|
|
1552
|
-
setShowRejectModal(false);
|
|
1553
|
-
}}
|
|
1554
|
-
/>,
|
|
1555
|
-
<ButtonV2
|
|
1556
|
-
key={"btn-Aceptar"}
|
|
1557
|
-
type={"pink"}
|
|
1558
|
-
label={"Aceptar"}
|
|
1559
|
-
size={12}
|
|
1560
|
-
onClick={async () => {
|
|
1561
|
-
const body = document.querySelector(
|
|
1562
|
-
"#modal-message-box .ql-container .ql-editor > p"
|
|
1563
|
-
).innerHTML;
|
|
1564
|
-
const messages = [
|
|
1565
|
-
{ type: "message", value: body?.replace(/<.*?\/?>/gm, "") },
|
|
1566
|
-
];
|
|
1567
|
-
await createComment(messages, activeRetailer.id);
|
|
1568
|
-
valRejAll ? validateAll("R") : sendToFacilitator("R");
|
|
1569
|
-
setMessage("Rechazado");
|
|
1570
|
-
setShowRejectModal(false);
|
|
1571
|
-
}}
|
|
1572
|
-
/>,
|
|
1573
|
-
]}
|
|
1574
|
-
/>
|
|
1575
|
-
)}
|
|
1576
1604
|
</Container>
|
|
1577
1605
|
);
|
|
1578
1606
|
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
-
import { fetchPOST } from "../../../global-files/handle_http";
|
|
3
2
|
|
|
4
3
|
export const getAuditVersion = async (articleId, setState, token) => {
|
|
5
4
|
const auditResponse = await axios.get(
|
|
@@ -33,39 +32,3 @@ export const getInputsData = (
|
|
|
33
32
|
setDescriptionState(descriptions);
|
|
34
33
|
}
|
|
35
34
|
};
|
|
36
|
-
|
|
37
|
-
export const translateService = (tab) => {
|
|
38
|
-
switch (tab) {
|
|
39
|
-
case "description":
|
|
40
|
-
case "Descripción":
|
|
41
|
-
return "Descripciones";
|
|
42
|
-
case "datasheet":
|
|
43
|
-
case "Ficha técnica":
|
|
44
|
-
return "Fichas técnicas";
|
|
45
|
-
case "images":
|
|
46
|
-
case "Imágenes":
|
|
47
|
-
return "Imágenes";
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
|
|
51
|
-
export const createMessage = (
|
|
52
|
-
retailers,
|
|
53
|
-
idRetailer,
|
|
54
|
-
oldStatus,
|
|
55
|
-
newStatus,
|
|
56
|
-
service
|
|
57
|
-
) => {
|
|
58
|
-
const [retailer] = retailers?.filter((ret) => ret.id === idRetailer) || [];
|
|
59
|
-
return `${translateService(service)} de ${
|
|
60
|
-
retailer.name
|
|
61
|
-
} |${oldStatus}| a |${newStatus}`;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
export const sendMessage = async (data) => {
|
|
65
|
-
const { paramsBody, paramsHeader } = data;
|
|
66
|
-
return fetchPOST(
|
|
67
|
-
process.env.REACT_APP_CREATE_MESSAGES,
|
|
68
|
-
paramsBody,
|
|
69
|
-
paramsHeader
|
|
70
|
-
);
|
|
71
|
-
};
|