contentoh-components-library 21.3.58 → 21.3.60
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 +2 -0
- package/dist/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/dist/components/molecules/HeaderTop/index.js +68 -11
- package/dist/components/organisms/Chat/Chat.stories.js +21 -1
- package/dist/components/organisms/Chat/ContainerItems/index.js +19 -3
- package/dist/components/organisms/Chat/ContainerItems/styles.js +1 -1
- package/dist/components/organisms/Chat/ContentChat/index.js +343 -191
- package/dist/components/organisms/Chat/Footer/index.js +48 -39
- package/dist/components/organisms/Chat/index.js +48 -3
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -2
- package/dist/components/organisms/SideModal/SideModal.stories.js +42 -0
- package/dist/components/organisms/SideModal/index.js +61 -0
- package/dist/components/organisms/SideModal/styles.js +18 -0
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +172 -127
- package/dist/components/pages/ProviderProductEdition/index.js +188 -129
- package/dist/components/pages/ProviderProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +61 -71
- package/dist/components/pages/RetailerProductEdition/index.js +267 -274
- package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/utils.js +61 -2
- package/package.json +1 -1
- package/src/components/molecules/CarouselImagesLogin/index.js +1 -1
- package/src/components/molecules/HeaderTop/index.js +52 -6
- package/src/components/organisms/Chat/Chat.stories.js +21 -0
- package/src/components/organisms/Chat/ContainerItems/index.js +18 -2
- package/src/components/organisms/Chat/ContainerItems/styles.js +10 -2
- package/src/components/organisms/Chat/ContentChat/index.js +81 -6
- package/src/components/organisms/Chat/Footer/index.js +11 -0
- package/src/components/organisms/Chat/index.js +47 -3
- package/src/components/organisms/FullProductNameHeader/index.js +1 -1
- package/src/components/organisms/SideModal/SideModal.stories.js +23 -0
- package/src/components/organisms/SideModal/index.js +41 -0
- package/src/components/organisms/SideModal/styles.js +21 -0
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +177 -130
- package/src/components/pages/ProviderProductEdition/index.js +105 -55
- package/src/components/pages/ProviderProductEdition/styles.js +5 -1
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +6 -23
- package/src/components/pages/RetailerProductEdition/index.js +111 -135
- package/src/components/pages/RetailerProductEdition/styles.js +4 -0
- package/src/components/pages/RetailerProductEdition/utils.js +37 -0
|
@@ -107,6 +107,10 @@ export const Container = styled.div`
|
|
|
107
107
|
}
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
+
#modal-message-box {
|
|
111
|
+
width: 400px;
|
|
112
|
+
height: 100px;
|
|
113
|
+
}
|
|
110
114
|
.container {
|
|
111
115
|
width: 100%;
|
|
112
116
|
height: 100%;
|
|
@@ -115,4 +119,4 @@ export const Container = styled.div`
|
|
|
115
119
|
width: 100%;
|
|
116
120
|
}
|
|
117
121
|
}
|
|
118
|
-
`;
|
|
122
|
+
`;
|
|
@@ -16,22 +16,8 @@ RetailerProductEditionDefault.args = {
|
|
|
16
16
|
Imágenes: false,
|
|
17
17
|
},
|
|
18
18
|
token:
|
|
19
|
-
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.
|
|
19
|
+
"eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI5YTIxMzEyOC02NDgyLTRjMTYtYTRiNi02ZTY0ZjIyNWIxYmQiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjlhMjEzMTI4LTY0ODItNGMxNi1hNGI2LTZlNjRmMjI1YjFiZCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI5OGE0NzYxMy04ZGIyLTRlZjUtYjA0Mi01ZDU3MWRkZjIwMWIiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY4Mzg3NTIyNiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY4Mzg3ODgyNiwiaWF0IjoxNjgzODc1MjI2LCJlbWFpbCI6ImlzbWFlbDk3bG9wZXpAZ21haWwuY29tIn0.EtgmT_THMx-Zy_zB5yZK4gz6TXNTVVJEKFt5X0JK2UkGVrp_q_92YCEuejS4n976fyTez0jkwOee6IkVHLV71uZWRBDFt-3Yw4ZxfsZYPNJWhoHXGNxhMU8MCkSntfu597esBTk-VsUpstT5R7L-WJfN8viE7R-qVo-42RlPTG0TFrWA9q0oTcqjv8vbxLpOBUjiEpjmqRhg4blJZwgkGNta6MOlw1vfmisOVbo9wMvqwnCZ9xx9KMKoH9U4uNObK_JomjbvPmTmkcUXsE-wGSD7XcoSwtuhBngLC7-jiu1u8MvL_ff5Z0Qp70sSpLdUglcSS8d1Xf7j_fcZuJ5jKA",
|
|
20
20
|
productSelected: {
|
|
21
|
-
orderId: 15160,
|
|
22
|
-
status: "RA",
|
|
23
|
-
datasheet_status: "RA",
|
|
24
|
-
prio: "none",
|
|
25
|
-
version: 7,
|
|
26
|
-
description_status: "RA",
|
|
27
|
-
images_status: "RA",
|
|
28
|
-
brand: null,
|
|
29
|
-
retailerOrder: 1,
|
|
30
|
-
missing: {
|
|
31
|
-
datasheet: null,
|
|
32
|
-
descriptions: null,
|
|
33
|
-
images: null,
|
|
34
|
-
},
|
|
35
21
|
orderId: 14606,
|
|
36
22
|
status: "RA",
|
|
37
23
|
datasheet_status: "RA",
|
|
@@ -94,16 +80,13 @@ RetailerProductEditionDefault.args = {
|
|
|
94
80
|
name: "The Home Depot Merchants",
|
|
95
81
|
},
|
|
96
82
|
],
|
|
97
|
-
statusByRetailer: {
|
|
98
|
-
58: {
|
|
99
|
-
datasheet: "RA",
|
|
100
|
-
description: "RA",
|
|
101
|
-
images: "RA",
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
83
|
},
|
|
105
84
|
location: {
|
|
106
|
-
product: { articleId:
|
|
85
|
+
product: { articleId: 354, versionId: 3 },
|
|
86
|
+
state: {
|
|
87
|
+
withChat: true,
|
|
88
|
+
chatType: "product_status",
|
|
89
|
+
},
|
|
107
90
|
},
|
|
108
91
|
user: {
|
|
109
92
|
id_user: 51,
|
|
@@ -24,15 +24,20 @@ 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";
|
|
28
27
|
import { GenericModal } from "../../atoms/GenericModal";
|
|
29
28
|
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
30
29
|
import { Loading } from "../../atoms/Loading";
|
|
31
30
|
import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
|
|
32
|
-
import errorModal from "../../../assets/images/genericModal/errorModal.svg";
|
|
33
31
|
import { VersionSelector } from "../../organisms/VersionSelector";
|
|
34
32
|
import { useCloseModal } from "../../../global-files/customHooks";
|
|
35
|
-
import {
|
|
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";
|
|
36
41
|
|
|
37
42
|
const reducerImages = (state, action) => {
|
|
38
43
|
let { values, attrForImgs, inputsByRetailer } = state;
|
|
@@ -132,6 +137,7 @@ export const RetailerProductEdition = ({
|
|
|
132
137
|
const [datasheets, setDatasheets] = useState([]);
|
|
133
138
|
const [images, setImages] = useReducer(reducerImages, {});
|
|
134
139
|
const [showModal, setShowModal] = useState(false);
|
|
140
|
+
const [showRejectModal, setShowRejectModal] = useState(false);
|
|
135
141
|
const { getRootProps, getInputProps } = useDropzone({
|
|
136
142
|
accept: "image/*",
|
|
137
143
|
noKeyboard: true,
|
|
@@ -218,6 +224,7 @@ export const RetailerProductEdition = ({
|
|
|
218
224
|
const [auditDescriptions, setAuditDescriptions] = useState([]);
|
|
219
225
|
const [auditImages, setAuditImages] = useState([]);
|
|
220
226
|
const [compare, setCompare] = useState(false);
|
|
227
|
+
const [valRejAll, setValRejAll] = useState(false);
|
|
221
228
|
|
|
222
229
|
useEffect(async () => {
|
|
223
230
|
const { id_article } = product?.article || {};
|
|
@@ -855,6 +862,25 @@ export const RetailerProductEdition = ({
|
|
|
855
862
|
const { newStatus, newOrderStatus, newArticleStatus } = JSON.parse(
|
|
856
863
|
res.data.body
|
|
857
864
|
);
|
|
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);
|
|
858
884
|
if (newOrderStatus) productTemp.status = newArticleStatus[articleId];
|
|
859
885
|
productTemp[`${concept}_status`] = newStatus;
|
|
860
886
|
await loadData();
|
|
@@ -897,35 +923,19 @@ export const RetailerProductEdition = ({
|
|
|
897
923
|
return product?.article[`id_auditor`] === user.id_user;
|
|
898
924
|
};
|
|
899
925
|
|
|
900
|
-
const createComment = async (
|
|
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
|
-
}
|
|
926
|
+
const createComment = async (messages = [], retailerId) => {
|
|
914
927
|
const data = {
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
await axios.post(`${process.env.REACT_APP_COMMENTS_ENDPOINT}`, data, {
|
|
922
|
-
headers: {
|
|
923
|
-
Authorization: token,
|
|
928
|
+
paramsBody: {
|
|
929
|
+
id: product.article.id_article,
|
|
930
|
+
version: version,
|
|
931
|
+
items: messages,
|
|
932
|
+
retailerId: retailerId,
|
|
933
|
+
status: product.status,
|
|
924
934
|
},
|
|
925
|
-
|
|
926
|
-
|
|
935
|
+
paramsHeader: { Authorization: token },
|
|
936
|
+
};
|
|
927
937
|
setMessage("");
|
|
928
|
-
|
|
938
|
+
return sendMessage(data);
|
|
929
939
|
};
|
|
930
940
|
|
|
931
941
|
const getRequired = (services) => {
|
|
@@ -1208,6 +1218,8 @@ export const RetailerProductEdition = ({
|
|
|
1208
1218
|
break;
|
|
1209
1219
|
}
|
|
1210
1220
|
|
|
1221
|
+
const messages = [];
|
|
1222
|
+
|
|
1211
1223
|
servicesData?.forEach((ret) => {
|
|
1212
1224
|
if (conceptArray.includes(ret.service)) {
|
|
1213
1225
|
let data = {
|
|
@@ -1215,9 +1227,24 @@ export const RetailerProductEdition = ({
|
|
|
1215
1227
|
orderId: product.id_order ?? product.orderId,
|
|
1216
1228
|
concept: ret.service,
|
|
1217
1229
|
result: result,
|
|
1218
|
-
evalStatus:
|
|
1230
|
+
evalStatus: ret.status,
|
|
1219
1231
|
retailerId: ret.id_retailer,
|
|
1220
1232
|
};
|
|
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
|
+
}
|
|
1221
1248
|
evaluationArray.push(
|
|
1222
1249
|
axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
1223
1250
|
headers: {
|
|
@@ -1251,13 +1278,14 @@ export const RetailerProductEdition = ({
|
|
|
1251
1278
|
const productTemp = product;
|
|
1252
1279
|
productTemp.status = `${result}A`;
|
|
1253
1280
|
productTemp.datasheet_status =
|
|
1254
|
-
productTemp.datasheet_status === "
|
|
1281
|
+
productTemp.datasheet_status === "NS" ? "NS" : `${result}A`;
|
|
1255
1282
|
productTemp.description_status =
|
|
1256
|
-
productTemp.description_status === "
|
|
1283
|
+
productTemp.description_status === "NS" ? "NS" : `${result}A`;
|
|
1257
1284
|
productTemp.images_status =
|
|
1258
|
-
productTemp.images_status === "
|
|
1285
|
+
productTemp.images_status === "NS" ? "NS" : `${result}A`;
|
|
1259
1286
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1260
1287
|
setProduct(productTemp);
|
|
1288
|
+
const messagesResponse = await Promise.all(messages);
|
|
1261
1289
|
|
|
1262
1290
|
await loadData();
|
|
1263
1291
|
} catch (error) {
|
|
@@ -1273,8 +1301,10 @@ export const RetailerProductEdition = ({
|
|
|
1273
1301
|
setCompare={setCompare}
|
|
1274
1302
|
isAuditor={[1, 6].includes(user.id_role)}
|
|
1275
1303
|
withChat={location?.state?.withChat}
|
|
1276
|
-
|
|
1304
|
+
chatType={location?.state?.chatType}
|
|
1305
|
+
productSelected={product}
|
|
1277
1306
|
token={token}
|
|
1307
|
+
activeRetailer={activeRetailer}
|
|
1278
1308
|
/>
|
|
1279
1309
|
<div className="data-container">
|
|
1280
1310
|
<div className="image-data-panel">
|
|
@@ -1314,36 +1344,7 @@ export const RetailerProductEdition = ({
|
|
|
1314
1344
|
sendToFacilitator("A");
|
|
1315
1345
|
}}
|
|
1316
1346
|
reject={() => {
|
|
1317
|
-
|
|
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
|
-
]);
|
|
1347
|
+
setShowRejectModal(true);
|
|
1347
1348
|
}}
|
|
1348
1349
|
showApproveRejectAll={
|
|
1349
1350
|
approveRejectAllButtons() && (auditorAssigned() || userAssigned())
|
|
@@ -1353,36 +1354,8 @@ export const RetailerProductEdition = ({
|
|
|
1353
1354
|
}
|
|
1354
1355
|
approveAll={() => validateAll("A")}
|
|
1355
1356
|
rejectAll={() => {
|
|
1356
|
-
|
|
1357
|
-
|
|
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
|
-
]);
|
|
1357
|
+
setShowRejectModal(true);
|
|
1358
|
+
setValRejAll(true);
|
|
1386
1359
|
}}
|
|
1387
1360
|
/>
|
|
1388
1361
|
<FullTabsMenu
|
|
@@ -1503,47 +1476,6 @@ export const RetailerProductEdition = ({
|
|
|
1503
1476
|
{(userAssigned(activeTab) || auditorAssigned()) &&
|
|
1504
1477
|
product[`${getConcept(activeTab)}_status`] !== "NS" && (
|
|
1505
1478
|
<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
|
-
)}
|
|
1547
1479
|
{[7, 8].includes(user.id_role) && (
|
|
1548
1480
|
<Button
|
|
1549
1481
|
buttonType={
|
|
@@ -1601,6 +1533,50 @@ export const RetailerProductEdition = ({
|
|
|
1601
1533
|
jwt={token}
|
|
1602
1534
|
/>
|
|
1603
1535
|
)}
|
|
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
|
+
)}
|
|
1604
1580
|
</Container>
|
|
1605
1581
|
);
|
|
1606
1582
|
};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import axios from "axios";
|
|
2
|
+
import { fetchPOST } from "../../../global-files/handle_http";
|
|
2
3
|
|
|
3
4
|
export const getAuditVersion = async (articleId, setState, token) => {
|
|
4
5
|
const auditResponse = await axios.get(
|
|
@@ -32,3 +33,39 @@ export const getInputsData = (
|
|
|
32
33
|
setDescriptionState(descriptions);
|
|
33
34
|
}
|
|
34
35
|
};
|
|
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
|
+
};
|