contentoh-components-library 21.3.60 → 21.3.61

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.
Files changed (40) hide show
  1. package/.env.development +0 -2
  2. package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
  3. package/dist/components/molecules/HeaderTop/index.js +11 -68
  4. package/dist/components/organisms/Chat/Chat.stories.js +1 -21
  5. package/dist/components/organisms/Chat/ContainerItems/index.js +3 -19
  6. package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
  7. package/dist/components/organisms/Chat/ContentChat/index.js +191 -343
  8. package/dist/components/organisms/Chat/Footer/index.js +39 -48
  9. package/dist/components/organisms/Chat/index.js +3 -48
  10. package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
  11. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +127 -172
  12. package/dist/components/pages/ProviderProductEdition/index.js +129 -188
  13. package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
  14. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +28 -40
  15. package/dist/components/pages/RetailerProductEdition/index.js +281 -292
  16. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  17. package/dist/components/pages/RetailerProductEdition/utils.js +2 -61
  18. package/package.json +1 -1
  19. package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
  20. package/src/components/molecules/HeaderTop/index.js +6 -52
  21. package/src/components/organisms/Chat/Chat.stories.js +0 -21
  22. package/src/components/organisms/Chat/ContainerItems/index.js +2 -18
  23. package/src/components/organisms/Chat/ContainerItems/styles.js +2 -10
  24. package/src/components/organisms/Chat/ContentChat/index.js +6 -81
  25. package/src/components/organisms/Chat/Footer/index.js +0 -11
  26. package/src/components/organisms/Chat/index.js +3 -47
  27. package/src/components/organisms/FullProductNameHeader/index.js +1 -1
  28. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +130 -177
  29. package/src/components/pages/ProviderProductEdition/index.js +55 -105
  30. package/src/components/pages/ProviderProductEdition/styles.js +1 -5
  31. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +26 -38
  32. package/src/components/pages/RetailerProductEdition/index.js +135 -130
  33. package/src/components/pages/RetailerProductEdition/styles.js +0 -4
  34. package/src/components/pages/RetailerProductEdition/utils.js +0 -37
  35. package/dist/components/organisms/SideModal/SideModal.stories.js +0 -42
  36. package/dist/components/organisms/SideModal/index.js +0 -61
  37. package/dist/components/organisms/SideModal/styles.js +0 -18
  38. package/src/components/organisms/SideModal/SideModal.stories.js +0 -23
  39. package/src/components/organisms/SideModal/index.js +0 -41
  40. package/src/components/organisms/SideModal/styles.js +0 -21
@@ -16,41 +16,26 @@ RetailerProductEditionDefault.args = {
16
16
  Imágenes: false,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI5OGE0NzYxMy04ZGIyLTRlZjUtYjA0Mi01ZDU3MWRkZjIwMWIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4Mzg3NTIyNiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY4Mzg3ODgyNiwiaWF0IjoxNjgzODc1MjI2LCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.EtgmT_THMx-Zy_zB5yZK4gz6TXNTVVJEKFt5X0JK2UkGVrp_q_92YCEuejS4n976fyTez0jkwOee6IkVHLV71uZWRBDFt-3Yw4ZxfsZYPNJWhoHXGNxhMU8MCkSntfu597esBTk-VsUpstT5R7L-WJfN8viE7R-qVo-42RlPTG0TFrWA9q0oTcqjv8vbxLpOBUjiEpjmqRhg4blJZwgkGNta6MOlw1vfmisOVbo9wMvqwnCZ9xx9KMKoH9U4uNObK_JomjbvPmTmkcUXsE-wGSD7XcoSwtuhBngLC7-jiu1u8MvL_ff5Z0Qp70sSpLdUglcSS8d1Xf7j_fcZuJ5jKA",
19
+ "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJhNmM0ZDNkNi0yNGE0LTQxZDQtYWQwZi1kMDg3NDM4YWI1YjYiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6ImE2YzRkM2Q2LTI0YTQtNDFkNC1hZDBmLWQwODc0MzhhYjViNiIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIyYjU3MjZlMy04MjM2LTRmYzMtODBkMi05NWVmYmU4ODdjOTYiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4MjAxNjI5MSwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY4MjAxOTg5MSwiaWF0IjoxNjgyMDE2MjkxLCJlbWFpbCI6ImV0Y0Bjb250ZW50b2guY29tIn0.SCj_yp1NkGCED59JHoDSdFAOakIOvZVeC0yLwt9z0BtenDXlU0m5cUofQQonnWPM8Q70yMFEkyMGI9kQs_fz1gxrmrSc2FGefn3B_1Vymq3pQ_S1JrY_syYf88m_GtJKOywEnE6--Ef9lZhFBFKGtqRJ4H8JBa9Xb96uCjAKyEMCSURDlw37pk2RQdULlZPj17Zb6Xrqi2lwrhpI1ByptX3__UoTiZklnTXwIxM4JdU7yuhXLznaEH8NOSd2Jw-CV6FCUbYBHlnRYBQg7B5mwyVKtDQm6QpRgBTBPCvljJJpFjRKUcnon8WZiFXx1qVbkWPt2vCT1TZqqoSLdlP6lA",
20
20
  productSelected: {
21
- orderId: 14606,
22
- status: "RA",
23
- datasheet_status: "RA",
21
+ orderId: 15160,
22
+ status: "SAC",
23
+ datasheet_status: "SAC",
24
24
  prio: "none",
25
- version: 3,
26
- description_status: "RA",
27
- images_status: "RA",
28
- statusByRetailer: {
29
- 4: {
30
- datasheet: "RA/AC",
31
- description: "RA/AC",
32
- images: "RA/AC",
33
- },
34
- 5: {
35
- datasheet: "RA/AC",
36
- description: "RA/AC",
37
- images: "RA/AC",
38
- },
39
- 6: {
40
- description: "RA/AC",
41
- images: "RA/AC",
42
- datasheet: "RA/AC",
43
- },
44
- 12: {
45
- datasheet: "RA/AC",
46
- description: "RA/AC",
47
- images: "RA/AC",
48
- },
49
- 17: {
50
- datasheet: "RA/AC",
51
- description: "RA/AC",
52
- images: "RA/AC",
53
- },
25
+ version: 7,
26
+ description_status: "SAC",
27
+ images_status: "SAC",
28
+ brand: null,
29
+ retailerOrder: 1,
30
+ missing: {
31
+ datasheet: null,
32
+ descriptions: null,
33
+ images: null,
34
+ },
35
+ services: {
36
+ datasheets: 1,
37
+ descriptions: 1,
38
+ images: 1,
54
39
  },
55
40
  article: {
56
41
  category: "Puertas y Ventanas|Molduras|Molduras Madera Blanda",
@@ -80,13 +65,16 @@ RetailerProductEditionDefault.args = {
80
65
  name: "The Home Depot Merchants",
81
66
  },
82
67
  ],
68
+ statusByRetailer: {
69
+ 58: {
70
+ datasheet: "SAC",
71
+ description: "SAC",
72
+ images: "SAC",
73
+ },
74
+ },
83
75
  },
84
76
  location: {
85
- product: { articleId: 354, versionId: 3 },
86
- state: {
87
- withChat: true,
88
- chatType: "product_status",
89
- },
77
+ product: { articleId: 39290, versionId: 7 },
90
78
  },
91
79
  user: {
92
80
  id_user: 51,
@@ -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 (messages = [], retailerId) => {
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
- paramsBody: {
929
- id: product.article.id_article,
930
- version: version,
931
- items: messages,
932
- retailerId: retailerId,
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
- return sendMessage(data);
928
+ setComponentsArray([]);
939
929
  };
940
930
 
941
931
  const getRequired = (services) => {
@@ -1203,7 +1193,6 @@ export const RetailerProductEdition = ({
1203
1193
  try {
1204
1194
  setLoading(true);
1205
1195
  const evaluationArray = [];
1206
- const sendAll = [];
1207
1196
  let conceptArray = [];
1208
1197
  switch (user.id_role) {
1209
1198
  case 4:
@@ -1218,8 +1207,6 @@ export const RetailerProductEdition = ({
1218
1207
  break;
1219
1208
  }
1220
1209
 
1221
- const messages = [];
1222
-
1223
1210
  servicesData?.forEach((ret) => {
1224
1211
  if (conceptArray.includes(ret.service)) {
1225
1212
  let data = {
@@ -1230,21 +1217,6 @@ export const RetailerProductEdition = ({
1230
1217
  evalStatus: ret.status,
1231
1218
  retailerId: ret.id_retailer,
1232
1219
  };
1233
- if (product[`${ret.service}_status`] !== "NS") {
1234
- const message = createMessage(
1235
- product.retailers,
1236
- ret.id_retailer,
1237
- product[`${ret.service}_status`],
1238
- `${result}A`,
1239
- ret.service
1240
- );
1241
- messages.push(
1242
- createComment(
1243
- [{ type: "status", value: message }],
1244
- ret.id_retailer
1245
- )
1246
- );
1247
- }
1248
1220
  evaluationArray.push(
1249
1221
  axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
1250
1222
  headers: {
@@ -1254,38 +1226,19 @@ export const RetailerProductEdition = ({
1254
1226
  );
1255
1227
  }
1256
1228
  });
1257
- await Promise.all(evaluationArray);
1258
1229
 
1259
- //We comment this part of the code because it does not match with the correct flow
1260
-
1261
- // conceptArray?.forEach((concept) => {
1262
- // let data = {
1263
- // articleId: product.article.id_article,
1264
- // orderId: product.id_order ?? product.orderId,
1265
- // concept,
1266
- // evalStatus: product[`${concept}_status`],
1267
- // };
1268
- // sendAll.push(
1269
- // axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
1270
- // headers: {
1271
- // Authorization: token,
1272
- // },
1273
- // })
1274
- // );
1275
- // });
1276
- // await Promise.all(sendAll);
1230
+ await Promise.all(evaluationArray);
1277
1231
 
1278
1232
  const productTemp = product;
1279
1233
  productTemp.status = `${result}A`;
1280
1234
  productTemp.datasheet_status =
1281
- productTemp.datasheet_status === "NS" ? "NS" : `${result}A`;
1235
+ productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
1282
1236
  productTemp.description_status =
1283
- productTemp.description_status === "NS" ? "NS" : `${result}A`;
1237
+ productTemp.description_status === "NA" ? "NA" : `${result}A`;
1284
1238
  productTemp.images_status =
1285
- productTemp.images_status === "NS" ? "NS" : `${result}A`;
1239
+ productTemp.images_status === "NA" ? "NA" : `${result}A`;
1286
1240
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
1287
1241
  setProduct(productTemp);
1288
- const messagesResponse = await Promise.all(messages);
1289
1242
 
1290
1243
  await loadData();
1291
1244
  } catch (error) {
@@ -1301,10 +1254,8 @@ export const RetailerProductEdition = ({
1301
1254
  setCompare={setCompare}
1302
1255
  isAuditor={[1, 6].includes(user.id_role)}
1303
1256
  withChat={location?.state?.withChat}
1304
- chatType={location?.state?.chatType}
1305
- productSelected={product}
1257
+ productSelected={productSelected}
1306
1258
  token={token}
1307
- activeRetailer={activeRetailer}
1308
1259
  />
1309
1260
  <div className="data-container">
1310
1261
  <div className="image-data-panel">
@@ -1344,7 +1295,36 @@ export const RetailerProductEdition = ({
1344
1295
  sendToFacilitator("A");
1345
1296
  }}
1346
1297
  reject={() => {
1347
- setShowRejectModal(true);
1298
+ sendToFacilitator("R");
1299
+ setMessage("Rechazado");
1300
+ setComponentsArray([
1301
+ <img src={errorModal} />,
1302
+ <ScreenHeader
1303
+ text={"Agrega tu comentarios para enviar el rechazo"}
1304
+ headerType={"input-name-header"}
1305
+ color={"white"}
1306
+ />,
1307
+ <TagAndInput
1308
+ label={"Caja de Comentario"}
1309
+ inputType={"textarea"}
1310
+ inputId={"modal-commentary-box"}
1311
+ index={0}
1312
+ color={"white"}
1313
+ />,
1314
+ <Button
1315
+ buttonType={"general-default-button"}
1316
+ label={"Enviar comentario"}
1317
+ onClick={(e) =>
1318
+ createComment(
1319
+ e,
1320
+ document.querySelector(
1321
+ "#modal-commentary-box .ql-container .ql-editor > p"
1322
+ ).innerHTML,
1323
+ activeTab
1324
+ )
1325
+ }
1326
+ />,
1327
+ ]);
1348
1328
  }}
1349
1329
  showApproveRejectAll={
1350
1330
  approveRejectAllButtons() && (auditorAssigned() || userAssigned())
@@ -1354,8 +1334,36 @@ export const RetailerProductEdition = ({
1354
1334
  }
1355
1335
  approveAll={() => validateAll("A")}
1356
1336
  rejectAll={() => {
1357
- setShowRejectModal(true);
1358
- setValRejAll(true);
1337
+ validateAll("R");
1338
+ setMessage("Rechazado");
1339
+ setComponentsArray([
1340
+ <img src={errorModal} />,
1341
+ <ScreenHeader
1342
+ text={"Agrega tu comentarios para enviar el rechazo"}
1343
+ headerType={"input-name-header"}
1344
+ color={"white"}
1345
+ />,
1346
+ <TagAndInput
1347
+ label={"Caja de Comentario"}
1348
+ inputType={"textarea"}
1349
+ inputId={"modal-commentary-box"}
1350
+ index={0}
1351
+ color={"white"}
1352
+ />,
1353
+ <Button
1354
+ buttonType={"general-default-button"}
1355
+ label={"Enviar comentario"}
1356
+ onClick={(e) =>
1357
+ createComment(
1358
+ e,
1359
+ document.querySelector(
1360
+ "#modal-commentary-box .ql-container .ql-editor > p"
1361
+ ).innerHTML,
1362
+ activeTab
1363
+ )
1364
+ }
1365
+ />,
1366
+ ]);
1359
1367
  }}
1360
1368
  />
1361
1369
  <FullTabsMenu
@@ -1476,6 +1484,47 @@ export const RetailerProductEdition = ({
1476
1484
  {(userAssigned(activeTab) || auditorAssigned()) &&
1477
1485
  product[`${getConcept(activeTab)}_status`] !== "NS" && (
1478
1486
  <div className="commentary-box">
1487
+ {!comment ? (
1488
+ <div className="commentary">
1489
+ <TagAndInput
1490
+ label={"Caja de Comentario"}
1491
+ inputType={"textarea"}
1492
+ inputCols={80}
1493
+ inputRows={4}
1494
+ inputId={"commentary-box"}
1495
+ index={0}
1496
+ />
1497
+ <div className="buttons-box">
1498
+ <Button
1499
+ buttonType={"general-transparent-button"}
1500
+ label={"Enviar comentario"}
1501
+ onClick={(e) =>
1502
+ createComment(
1503
+ e,
1504
+ document.querySelector(
1505
+ "#commentary-box .ql-container .ql-editor > p"
1506
+ ).innerHTML,
1507
+ activeTab
1508
+ )
1509
+ }
1510
+ />
1511
+ </div>
1512
+ </div>
1513
+ ) : (
1514
+ <div className="feedback-box">
1515
+ <Commentary
1516
+ comment={comment?.message?.replace(/<.*?\/?>/gm, "")}
1517
+ reviewed={crossComment}
1518
+ />
1519
+ <Button
1520
+ buttonType={"circular-button accept-button"}
1521
+ onClick={async () => {
1522
+ setCrossComment(true);
1523
+ commentRevised();
1524
+ }}
1525
+ />
1526
+ </div>
1527
+ )}
1479
1528
  {[7, 8].includes(user.id_role) && (
1480
1529
  <Button
1481
1530
  buttonType={
@@ -1533,50 +1582,6 @@ export const RetailerProductEdition = ({
1533
1582
  jwt={token}
1534
1583
  />
1535
1584
  )}
1536
- {showRejectModal && (
1537
- <Modal
1538
- title={"Agregar mensaje de rechazo"}
1539
- show={showRejectModal}
1540
- customComponent={
1541
- <TagAndInput
1542
- label={"Caja de Comentario"}
1543
- inputType={"textarea"}
1544
- inputId={"modal-message-box"}
1545
- index={0}
1546
- color={"white"}
1547
- />
1548
- }
1549
- buttons={[
1550
- <ButtonV2
1551
- key={"btn-Cancelar"}
1552
- type={"white"}
1553
- label={"Cancelar"}
1554
- size={12}
1555
- onClick={() => {
1556
- setShowRejectModal(false);
1557
- }}
1558
- />,
1559
- <ButtonV2
1560
- key={"btn-Aceptar"}
1561
- type={"pink"}
1562
- label={"Aceptar"}
1563
- size={12}
1564
- onClick={async () => {
1565
- const body = document.querySelector(
1566
- "#modal-message-box .ql-container .ql-editor > p"
1567
- ).innerHTML;
1568
- const messages = [
1569
- { type: "message", value: body?.replace(/<.*?\/?>/gm, "") },
1570
- ];
1571
- await createComment(messages, activeRetailer.id);
1572
- valRejAll ? validateAll("R") : sendToFacilitator("R");
1573
- setMessage("Rechazado");
1574
- setShowRejectModal(false);
1575
- }}
1576
- />,
1577
- ]}
1578
- />
1579
- )}
1580
1585
  </Container>
1581
1586
  );
1582
1587
  };
@@ -89,10 +89,6 @@ export const Container = styled.div`
89
89
  }
90
90
  }
91
91
  }
92
- #modal-message-box {
93
- width: 400px;
94
- height: 100px;
95
- }
96
92
  .container {
97
93
  width: 100%;
98
94
  height: 100%;
@@ -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
- };
@@ -1,42 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.default = exports.DefaultSideModal = void 0;
9
-
10
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
-
12
- var _ = require(".");
13
-
14
- var _ButtonV = require("../../atoms/ButtonV2");
15
-
16
- var _jsxRuntime = require("react/jsx-runtime");
17
-
18
- var _default = {
19
- title: "Components/organisms/SideModal",
20
- component: _.SideModal
21
- };
22
- exports.default = _default;
23
-
24
- var Template = function Template(args) {
25
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.SideModal, (0, _objectSpread2.default)({}, args));
26
- };
27
-
28
- var DefaultSideModal = Template.bind({});
29
- exports.DefaultSideModal = DefaultSideModal;
30
- DefaultSideModal.args = {
31
- show: false,
32
- header: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
33
- className: "title-container",
34
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {})
35
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
36
- label: "Ir al Checkout"
37
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
38
- label: "X"
39
- })],
40
- body: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {}),
41
- footer: /*#__PURE__*/(0, _jsxRuntime.jsx)(_jsxRuntime.Fragment, {})
42
- };
@@ -1,61 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.SideModal = void 0;
7
-
8
- var _react = require("react");
9
-
10
- var _styles = require("./styles");
11
-
12
- var _jsxRuntime = require("react/jsx-runtime");
13
-
14
- var SideModal = function SideModal(_ref) {
15
- var header = _ref.header,
16
- body = _ref.body,
17
- footer = _ref.footer,
18
- show = _ref.show,
19
- setShow = _ref.setShow,
20
- _ref$id = _ref.id,
21
- id = _ref$id === void 0 ? "side-modal" : _ref$id;
22
- var modal = (0, _react.useRef)();
23
-
24
- var closeModal = function closeModal(e) {
25
- if (!e.target.closest("#".concat(id)) && show) {
26
- var _modal$current, _modal$current$classL;
27
-
28
- document.removeEventListener("click", closeModal, false);
29
- modal === null || modal === void 0 ? void 0 : (_modal$current = modal.current) === null || _modal$current === void 0 ? void 0 : (_modal$current$classL = _modal$current.classList) === null || _modal$current$classL === void 0 ? void 0 : _modal$current$classL.remove("shown");
30
- setShow && setShow(false);
31
- }
32
- };
33
-
34
- (0, _react.useEffect)(function () {
35
- if (show && modal.current) {
36
- var _modal$current2, _modal$current2$class;
37
-
38
- document.addEventListener("click", closeModal, false);
39
- modal === null || modal === void 0 ? void 0 : (_modal$current2 = modal.current) === null || _modal$current2 === void 0 ? void 0 : (_modal$current2$class = _modal$current2.classList) === null || _modal$current2$class === void 0 ? void 0 : _modal$current2$class.add("shown");
40
- }
41
- }, [show]);
42
- return show && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
43
- children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
44
- id: id,
45
- ref: modal,
46
- className: "modal-container",
47
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
48
- className: "modal-header",
49
- children: header
50
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
51
- className: "modal-body",
52
- children: body
53
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
54
- className: "modal-footer",
55
- children: footer
56
- })]
57
- })
58
- });
59
- };
60
-
61
- exports.SideModal = SideModal;
@@ -1,18 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports.Container = void 0;
9
-
10
- var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
-
12
- var _styledComponents = _interopRequireDefault(require("styled-components"));
13
-
14
- var _templateObject;
15
-
16
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: 100vw;\n height: 100vh;\n position: fixed;\n z-index: 9999999;\n background-color: transparent;\n\n .modal-container {\n width: 600px;\n height: 100%;\n position: absolute;\n right: -600px;\n background-color: #fff;\n\n &.shown {\n right: 0;\n }\n }\n"])));
17
-
18
- exports.Container = Container;
@@ -1,23 +0,0 @@
1
- import { SideModal } from ".";
2
- import { ButtonV2 } from "../../atoms/ButtonV2";
3
-
4
- export default {
5
- title: "Components/organisms/SideModal",
6
- component: SideModal,
7
- };
8
-
9
- const Template = (args) => <SideModal {...args} />;
10
-
11
- export const DefaultSideModal = Template.bind({});
12
- DefaultSideModal.args = {
13
- show: false,
14
- header: [
15
- <div className="title-container">
16
- <h2></h2>
17
- </div>,
18
- <ButtonV2 label="Ir al Checkout" />,
19
- <ButtonV2 label="X" />,
20
- ],
21
- body: <></>,
22
- footer: <></>,
23
- };