contentoh-components-library 21.1.29 → 21.1.32
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/styles.js +1 -1
- package/dist/components/atoms/GeneralInput/styles.js +3 -3
- package/dist/components/atoms/InputFormatter/styles.js +1 -1
- package/dist/components/atoms/SliderToolTip/index.js +14 -9
- package/dist/components/atoms/SliderToolTip/styles.js +1 -1
- package/dist/components/atoms/StatusTag/index.js +2 -17
- package/dist/components/atoms/StatusTag/styles.js +1 -1
- package/dist/components/atoms/ValidationPanel/index.js +4 -3
- package/dist/components/molecules/AvatarAndValidation/index.js +4 -0
- package/dist/components/organisms/FullProductNameHeader/index.js +6 -2
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +62 -74
- package/dist/components/pages/ProviderProductEdition/index.js +433 -323
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +107 -71
- package/dist/components/pages/RetailerProductEdition/index.js +314 -194
- package/dist/global-files/data.js +10 -9
- package/package.json +1 -1
- package/src/components/atoms/Commentary/styles.js +2 -2
- package/src/components/atoms/GeneralInput/styles.js +5 -5
- package/src/components/atoms/InputFormatter/styles.js +3 -3
- package/src/components/atoms/SliderToolTip/index.js +20 -13
- package/src/components/atoms/SliderToolTip/styles.js +21 -25
- package/src/components/atoms/StatusTag/index.js +2 -12
- package/src/components/atoms/StatusTag/styles.js +11 -11
- package/src/components/atoms/ValidationPanel/index.js +5 -4
- package/src/components/molecules/AvatarAndValidation/index.js +5 -1
- package/src/components/organisms/FullProductNameHeader/index.js +6 -2
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +63 -79
- package/src/components/pages/ProviderProductEdition/index.js +236 -168
- package/src/components/pages/ProviderProductEdition/styles.js +1 -1
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +108 -70
- package/src/components/pages/RetailerProductEdition/index.js +238 -166
- package/src/global-files/data.js +10 -9
- package/dist/assets/fonts/avenirnext/AvenirNextLTPro-Bold.otf +0 -0
- package/dist/assets/fonts/avenirnext/AvenirNextLTPro-It.otf +0 -0
- package/dist/assets/fonts/avenirnext/AvenirNextLTPro-Regular.otf +0 -0
- package/dist/assets/fonts/lato/Lato-Bold.ttf +0 -0
- package/dist/assets/fonts/lato/Lato-Italic.ttf +0 -0
- package/dist/assets/fonts/lato/Lato-Light.ttf +0 -0
- package/dist/assets/fonts/lato/Lato-Regular.ttf +0 -0
- package/dist/assets/fonts/lato/Lato-Thin.ttf +0 -0
- package/dist/assets/fonts/lato/OFL.txt +0 -93
- package/dist/assets/fonts/raleway/Raleway-Black.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-Bold.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-ExtraBold.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-Italic.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-Medium.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-Regular.ttf +0 -0
- package/dist/assets/fonts/raleway/Raleway-SemiBold.ttf +0 -0
- package/dist/assets/images/activedFilter/removeFilter.svg +0 -3
- package/dist/assets/images/arrow/arrowIcon.svg +0 -3
- package/dist/assets/images/arrow/polygon.svg +0 -3
- package/dist/assets/images/asignationOptions/availableIcon.svg +0 -3
- package/dist/assets/images/asignationOptions/removeAsigned.svg +0 -4
- package/dist/assets/images/asignationOptions/requestToProvider.svg +0 -3
- package/dist/assets/images/asignationOptions/requestToTeam.svg +0 -3
- package/dist/assets/images/card/masterCardIcon.svg +0 -5
- package/dist/assets/images/carouselImagesLogin/login2.svg +0 -117
- package/dist/assets/images/carouselImagesLogin/login3.svg +0 -147
- package/dist/assets/images/carouselImagesLogin/loginImage.svg +0 -301
- package/dist/assets/images/checkBox/checked.svg +0 -3
- package/dist/assets/images/checkBox/unchecked.svg +0 -3
- package/dist/assets/images/componentAssigned/assignedImage1.svg +0 -9
- package/dist/assets/images/componentAssigned/assignedImage2.svg +0 -9
- package/dist/assets/images/componentAssigned/clock.svg +0 -4
- package/dist/assets/images/componentAssigned/flag.svg +0 -3
- package/dist/assets/images/defaultImages/defaultProductImage.png +0 -0
- package/dist/assets/images/defaultImages/defaultProfileImage.svg +0 -13
- package/dist/assets/images/defaultImages/defaultUpdate.png +0 -0
- package/dist/assets/images/dropDownButton/dropDownArrowButton.svg +0 -3
- package/dist/assets/images/editField/editField.svg +0 -3
- package/dist/assets/images/editField/showPassword.png +0 -0
- package/dist/assets/images/flags/highPriority.svg +0 -3
- package/dist/assets/images/flags/lowPriority.svg +0 -3
- package/dist/assets/images/flags/mediumPriority.svg +0 -3
- package/dist/assets/images/flags/noPriority.svg +0 -3
- package/dist/assets/images/generalButton/acceptIcon.svg +0 -3
- package/dist/assets/images/generalButton/closeIcon.svg +0 -4
- package/dist/assets/images/generalButton/deleteIcon.svg +0 -13
- package/dist/assets/images/generalButton/deleteIconHover.svg +0 -13
- package/dist/assets/images/generalButton/downloadIcon.svg +0 -3
- package/dist/assets/images/generalButton/gridLayout.svg +0 -3
- package/dist/assets/images/generalButton/nullIcon.svg +0 -3
- package/dist/assets/images/generalButton/openModal.svg +0 -3
- package/dist/assets/images/generalButton/rejectIcon.svg +0 -3
- package/dist/assets/images/generalButton/rowLayout.svg +0 -3
- package/dist/assets/images/generalButton/saveIcon.svg +0 -3
- package/dist/assets/images/generalButton/saveIconHover.svg +0 -3
- package/dist/assets/images/generalImage/assigned.svg +0 -14
- package/dist/assets/images/generalImage/bags.svg +0 -25
- package/dist/assets/images/generalImage/clock.svg +0 -4
- package/dist/assets/images/generalImage/flag.svg +0 -3
- package/dist/assets/images/genericModal/closeWhite.svg +0 -3
- package/dist/assets/images/genericModal/errorModal.svg +0 -3
- package/dist/assets/images/genericModal/genericModalCheck.svg +0 -3
- package/dist/assets/images/genericModal/genericModalClose.svg +0 -3
- package/dist/assets/images/genericModal/genericModalDown.svg +0 -3
- package/dist/assets/images/genericModal/genericModalUp.svg +0 -3
- package/dist/assets/images/genericModal/genericModalWarning.svg +0 -12
- package/dist/assets/images/genericModal/yellowAlert.svg +0 -12
- package/dist/assets/images/logo/logoLogin.svg +0 -15
- package/dist/assets/images/menuNotification/menuNotificationComment.svg +0 -3
- package/dist/assets/images/menuNotification/menuNotificationProduct.svg +0 -3
- package/dist/assets/images/menuProfile/logOut.svg +0 -3
- package/dist/assets/images/menuProfile/myAccount.svg +0 -3
- package/dist/assets/images/menuProfile/settings.svg +0 -3
- package/dist/assets/images/modalsSVGs/attributesSent.svg +0 -208
- package/dist/assets/images/modalsSVGs/descriptionSent.svg +0 -237
- package/dist/assets/images/modalsSVGs/providerSent.svg +0 -445
- package/dist/assets/images/modalsSVGs/uploadingImages.svg +0 -148
- package/dist/assets/images/productImage/openModal.svg +0 -3
- package/dist/assets/images/productNotification/productNotification.svg +0 -3
- package/dist/assets/images/profileHeader/profilePicture.svg +0 -9
- package/dist/assets/images/providerAndCadena/Cadena.svg +0 -188
- package/dist/assets/images/providerAndCadena/LoginContentoh.svg +0 -15
- package/dist/assets/images/providerAndCadena/Proveedor.svg +0 -231
- package/dist/assets/images/sideMenuButton/contenoh.svg +0 -5
- package/dist/assets/images/sideMenuButton/dashboard.svg +0 -5
- package/dist/assets/images/sideMenuButton/products.svg +0 -10
- package/dist/assets/images/sideMenuButton/providers.svg +0 -10
- package/dist/assets/images/sideMenuButton/tasks.svg +0 -3
- package/dist/assets/images/sliderToolTip/infoIcon.svg +0 -4
- package/dist/assets/images/sliderToolTip/slide1.svg +0 -5
- package/dist/assets/images/sliderToolTip/slide2.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide21.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide22.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide23.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide3.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide4.svg +0 -9
- package/dist/assets/images/sliderToolTip/slide5.svg +0 -40
- package/dist/assets/images/verticalSideMenuMainPage/closeMenu.svg +0 -4
- package/dist/assets/images/verticalSideMenuMainPage/iconFAQS.svg +0 -12
- package/dist/assets/images/verticalSideMenuMainPage/iconGroup.svg +0 -3
- package/dist/assets/images/verticalSideMenuMainPage/iconLogo.svg +0 -12
- package/dist/assets/images/verticalSideMenuMainPage/iconLogoContentoh.svg +0 -15
- package/dist/assets/images/verticalSideMenuMainPage/iconProduct.svg +0 -3
- package/dist/assets/images/verticalSideMenuMainPage/iconSpeedometer.svg +0 -12
- package/dist/assets/images/verticalSideMenuMainPage/iconTask.svg +0 -10
- package/dist/assets/images/verticalSideMenuMainPage/openMenu.svg +0 -4
- package/dist/components/atoms/ListCommercialRetailers/ListCommercialRetailers.stories.js +0 -36
- package/dist/components/atoms/ListCommercialRetailers/index.js +0 -64
- package/dist/components/atoms/ListCommercialRetailers/styles.js +0 -20
- package/dist/components/atoms/MenuCommercialRetailers/MenuCommercialRetailers.stories.js +0 -37
- package/dist/components/atoms/MenuCommercialRetailers/index.js +0 -25
- package/dist/components/atoms/MenuCommercialRetailers/styles.js +0 -20
- package/dist/components/atoms/MenuProductImage/MenuProductImage.stories.js +0 -28
- package/dist/components/atoms/MenuProductImage/index.js +0 -88
- package/dist/components/atoms/MenuProductImage/styles.js +0 -20
- package/dist/components/molecules/ApproveRejetPanel/ApproveRejetPanel.stories.js +0 -25
- package/dist/components/molecules/ApproveRejetPanel/index.js +0 -49
- package/dist/components/molecules/ApproveRejetPanel/styles.js +0 -18
- package/dist/components/molecules/SignInLoginCreationApp/SignInLogin.stories.js +0 -28
- package/dist/components/molecules/SignInLoginCreationApp/index.js +0 -270
- package/dist/components/molecules/SignInLoginCreationApp/styles.js +0 -20
- package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +0 -37
- package/dist/components/pages/RegistrationLoginFirstStep/index.js +0 -269
- package/dist/components/pages/RegistrationLoginFirstStep/styles.js +0 -20
- package/dist/global-files/fonts.css +0 -45
- package/dist/global-files/global-styles.css +0 -40
|
@@ -29,7 +29,6 @@ import { GenericModal } from "../../atoms/GenericModal";
|
|
|
29
29
|
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
30
30
|
import { Loading } from "../../atoms/Loading";
|
|
31
31
|
import succes from "../../../assets/images/genericModal/genericModalCheck.svg";
|
|
32
|
-
import { getNewStatus } from "../../../global-files/data";
|
|
33
32
|
import errorModal from "../../../assets/images/genericModal/errorModal.svg";
|
|
34
33
|
|
|
35
34
|
const reducerImages = (state, action) => {
|
|
@@ -77,7 +76,6 @@ export const RetailerProductEdition = ({
|
|
|
77
76
|
tabsSections,
|
|
78
77
|
productSelected = {},
|
|
79
78
|
user = {},
|
|
80
|
-
location = {},
|
|
81
79
|
token,
|
|
82
80
|
}) => {
|
|
83
81
|
const [activeTab, setActiveTab] = useState("Descripción");
|
|
@@ -165,6 +163,7 @@ export const RetailerProductEdition = ({
|
|
|
165
163
|
const [socketType, setSocketType] = useState(null);
|
|
166
164
|
const [servicesStatus, setServicesStatus] = useState([]);
|
|
167
165
|
const [saving, setSaving] = useState(loading);
|
|
166
|
+
const isAuditor = user.id_role === 6;
|
|
168
167
|
|
|
169
168
|
useEffect(() => {
|
|
170
169
|
checkAll && setSelectedImages(images.values);
|
|
@@ -182,11 +181,8 @@ export const RetailerProductEdition = ({
|
|
|
182
181
|
setServices(services);
|
|
183
182
|
getServices();
|
|
184
183
|
|
|
185
|
-
//setActiveRetailer(product?.retailers[0]);
|
|
186
|
-
setImages({
|
|
187
|
-
action: "init",
|
|
188
|
-
init: services[2],
|
|
189
|
-
});
|
|
184
|
+
// setActiveRetailer(product?.retailers[0]);
|
|
185
|
+
setImages({ action: "init", init: services[2] });
|
|
190
186
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
191
187
|
|
|
192
188
|
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
@@ -204,24 +200,22 @@ export const RetailerProductEdition = ({
|
|
|
204
200
|
);
|
|
205
201
|
const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
|
|
206
202
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
203
|
+
const retailers = product.retailers || product.retailersAvailable;
|
|
204
|
+
const retailerResponse = parsedResponse?.map((srv) => srv.id_retailer);
|
|
205
|
+
const active = retailers?.find((retailer) =>
|
|
206
|
+
retailerResponse.includes(retailer.id)
|
|
207
|
+
);
|
|
211
208
|
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
212
209
|
setServicesData(parsedResponse);
|
|
213
210
|
};
|
|
214
211
|
|
|
215
212
|
const translateConcept = (concept) => {
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
translation = "Imágenes";
|
|
223
|
-
}
|
|
224
|
-
return translation;
|
|
213
|
+
const translation = {
|
|
214
|
+
datasheet: "Ficha técnica",
|
|
215
|
+
description: "Descripción",
|
|
216
|
+
images: "Imágenes",
|
|
217
|
+
};
|
|
218
|
+
return translation[concept];
|
|
225
219
|
};
|
|
226
220
|
|
|
227
221
|
const getComments = async (tab = "Descripción") => {
|
|
@@ -257,14 +251,14 @@ export const RetailerProductEdition = ({
|
|
|
257
251
|
switch (user.id_role) {
|
|
258
252
|
case 7:
|
|
259
253
|
case 8:
|
|
260
|
-
arr = ["
|
|
254
|
+
arr = ["CA", "RC", "RA"];
|
|
261
255
|
break;
|
|
262
256
|
case 4:
|
|
263
257
|
case 5:
|
|
264
|
-
arr = ["
|
|
258
|
+
arr = ["RC", "AC", "AA", "AP", "ACA"];
|
|
265
259
|
break;
|
|
266
260
|
case 6:
|
|
267
|
-
arr = ["RP", "
|
|
261
|
+
arr = ["RP", "RCA", "AC", "RA"];
|
|
268
262
|
break;
|
|
269
263
|
default:
|
|
270
264
|
arr = [];
|
|
@@ -390,13 +384,14 @@ export const RetailerProductEdition = ({
|
|
|
390
384
|
const saveDescriptions = async () => {
|
|
391
385
|
setLoading(true);
|
|
392
386
|
const productTemp = product;
|
|
387
|
+
const articleId = product?.article?.id_article;
|
|
393
388
|
const dataObject = {
|
|
394
|
-
articleId
|
|
389
|
+
articleId,
|
|
395
390
|
articleData: updatedDescriptions,
|
|
396
391
|
};
|
|
397
392
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
398
393
|
try {
|
|
399
|
-
await axios.put(
|
|
394
|
+
const res = await axios.put(
|
|
400
395
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
|
|
401
396
|
dataObject,
|
|
402
397
|
{
|
|
@@ -405,14 +400,16 @@ export const RetailerProductEdition = ({
|
|
|
405
400
|
},
|
|
406
401
|
}
|
|
407
402
|
);
|
|
408
|
-
if (
|
|
409
|
-
|
|
403
|
+
if (res.data.statusCode === 200) {
|
|
404
|
+
const { newStatus, newArticleStatus } = JSON.parse(res.data.body);
|
|
405
|
+
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
406
|
+
if (newStatus) productTemp.description_status = newStatus;
|
|
410
407
|
setProduct(productTemp);
|
|
411
408
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
412
|
-
}
|
|
413
409
|
|
|
414
|
-
|
|
415
|
-
|
|
410
|
+
setMessage("Descripciones guardadas con éxito");
|
|
411
|
+
await loadData();
|
|
412
|
+
}
|
|
416
413
|
} catch (error) {
|
|
417
414
|
console.log(error);
|
|
418
415
|
}
|
|
@@ -421,14 +418,14 @@ export const RetailerProductEdition = ({
|
|
|
421
418
|
const saveDatasheets = async () => {
|
|
422
419
|
setLoading(true);
|
|
423
420
|
const productTemp = product;
|
|
421
|
+
const articleId = product?.article?.id_article;
|
|
424
422
|
const dataObject = {
|
|
425
|
-
articleId
|
|
423
|
+
articleId,
|
|
426
424
|
articleData: updatedDatasheets,
|
|
427
425
|
};
|
|
428
|
-
console.log(updatedDatasheets, "updatedDatasheets");
|
|
429
426
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
430
427
|
try {
|
|
431
|
-
await axios.put(
|
|
428
|
+
const res = await axios.put(
|
|
432
429
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?datasheet=true&version=${version}`,
|
|
433
430
|
dataObject,
|
|
434
431
|
{
|
|
@@ -437,13 +434,16 @@ export const RetailerProductEdition = ({
|
|
|
437
434
|
},
|
|
438
435
|
}
|
|
439
436
|
);
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
productTemp.status =
|
|
437
|
+
if (res.data.statusCode === 200) {
|
|
438
|
+
const { newStatus, newArticleStatus } = JSON.parse(res.data.body);
|
|
439
|
+
if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
|
|
440
|
+
if (newStatus) productTemp.datasheet_status = newStatus;
|
|
443
441
|
setProduct(productTemp);
|
|
444
442
|
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
443
|
+
|
|
444
|
+
setMessage("Fichas técnicas guardadas");
|
|
445
|
+
await loadData();
|
|
445
446
|
}
|
|
446
|
-
loadData();
|
|
447
447
|
} catch (error) {
|
|
448
448
|
console.log(error);
|
|
449
449
|
}
|
|
@@ -527,15 +527,6 @@ export const RetailerProductEdition = ({
|
|
|
527
527
|
} else {
|
|
528
528
|
setImagesUploaded(true);
|
|
529
529
|
}
|
|
530
|
-
let productTemp = product;
|
|
531
|
-
if (productTemp.status === "ASSIGNED") {
|
|
532
|
-
productTemp.status = "IN_PROGRESS";
|
|
533
|
-
setProduct(productTemp);
|
|
534
|
-
sessionStorage.setItem(
|
|
535
|
-
"productSelected",
|
|
536
|
-
JSON.stringify(productTemp)
|
|
537
|
-
);
|
|
538
|
-
}
|
|
539
530
|
} catch (err) {
|
|
540
531
|
console.log(err);
|
|
541
532
|
// setMainLoading(false);
|
|
@@ -560,7 +551,7 @@ export const RetailerProductEdition = ({
|
|
|
560
551
|
return e;
|
|
561
552
|
});
|
|
562
553
|
try {
|
|
563
|
-
await axios.put(
|
|
554
|
+
const res = await axios.put(
|
|
564
555
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
565
556
|
dataImages,
|
|
566
557
|
{
|
|
@@ -569,9 +560,21 @@ export const RetailerProductEdition = ({
|
|
|
569
560
|
},
|
|
570
561
|
}
|
|
571
562
|
);
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
563
|
+
if (res.data.statusCode === 200) {
|
|
564
|
+
let productTemp = product;
|
|
565
|
+
const { newStatus, newArticleStatus } = JSON.parse(res.data.body);
|
|
566
|
+
if (newArticleStatus)
|
|
567
|
+
productTemp.status = newArticleStatus[articleId];
|
|
568
|
+
if (newStatus) productTemp.images_status = newStatus;
|
|
569
|
+
setProduct(productTemp);
|
|
570
|
+
sessionStorage.setItem(
|
|
571
|
+
"productSelected",
|
|
572
|
+
JSON.stringify(productTemp)
|
|
573
|
+
);
|
|
574
|
+
setMessage("Imágenes guardadas con éxito");
|
|
575
|
+
sessionStorage.removeItem("imagesList");
|
|
576
|
+
await loadData();
|
|
577
|
+
}
|
|
575
578
|
} catch (error) {
|
|
576
579
|
console.log(error);
|
|
577
580
|
}
|
|
@@ -580,24 +583,20 @@ export const RetailerProductEdition = ({
|
|
|
580
583
|
|
|
581
584
|
const evaluationFinished = (userId, tab, statusArray) => {
|
|
582
585
|
const srv = servicesData.filter((serv) => serv.service === getConcept(tab));
|
|
583
|
-
const
|
|
584
|
-
(serv) => serv.id_retailer === activeRetailer?.id
|
|
585
|
-
|
|
586
|
-
const
|
|
587
|
-
|
|
588
|
-
product[`${getConcept(tab)}_status`] === "IN_PROGRESS";
|
|
586
|
+
const srvActive = srv
|
|
587
|
+
.find((serv) => serv.id_retailer === activeRetailer?.id)
|
|
588
|
+
?.status?.replace(/.*\//, "");
|
|
589
|
+
const currStatus = product[`${getConcept(tab)}_status`].replace(/.*\//, "");
|
|
590
|
+
const unvalidated = ["IE", "CA"].includes(currStatus);
|
|
589
591
|
|
|
590
|
-
const auditorUnvalidated = !["RA", "AA", "
|
|
591
|
-
product[`${getConcept(tab)}_status`]
|
|
592
|
-
);
|
|
592
|
+
const auditorUnvalidated = !["RA", "AA", "ACA", "AP"].includes(currStatus);
|
|
593
593
|
|
|
594
594
|
switch (userId) {
|
|
595
595
|
case 7:
|
|
596
596
|
case 8:
|
|
597
597
|
return (
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
(statusArray.includes(product.status) &&
|
|
598
|
+
statusArray.includes(srvActive) &&
|
|
599
|
+
(["RA", "RC"].includes(product?.status) ||
|
|
601
600
|
srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
602
601
|
srv.length)
|
|
603
602
|
);
|
|
@@ -605,14 +604,16 @@ export const RetailerProductEdition = ({
|
|
|
605
604
|
case 5:
|
|
606
605
|
return (
|
|
607
606
|
unvalidated &&
|
|
608
|
-
["
|
|
607
|
+
["CA", "IE"].includes(product.status) && // "RC", "AC", "AA", "AP", "ACA"
|
|
609
608
|
srv.filter((serv) => statusArray.includes(serv.status)).length ===
|
|
610
609
|
srv.length
|
|
611
610
|
);
|
|
612
611
|
case 6:
|
|
613
612
|
return (
|
|
614
|
-
statusArray.includes(product.status) && //RP,
|
|
615
|
-
srv.every((serv) =>
|
|
613
|
+
statusArray.includes(product.status) && // RP, RCA, AC, RA true
|
|
614
|
+
srv.every((serv) =>
|
|
615
|
+
["RA", "AA", "AP", "ACA"].includes(serv.status)
|
|
616
|
+
) &&
|
|
616
617
|
auditorUnvalidated
|
|
617
618
|
);
|
|
618
619
|
default:
|
|
@@ -634,20 +635,20 @@ export const RetailerProductEdition = ({
|
|
|
634
635
|
const approveRejectButtons = (action) => {
|
|
635
636
|
let concept = getConcept(action || activeTab);
|
|
636
637
|
|
|
637
|
-
const
|
|
638
|
-
(
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
638
|
+
const retailerStatus = servicesData
|
|
639
|
+
.find(
|
|
640
|
+
(srv) =>
|
|
641
|
+
srv.id_retailer === activeRetailer?.id && srv.service === concept
|
|
642
|
+
)
|
|
643
|
+
?.status?.replace(/.*\//, "");
|
|
644
|
+
|
|
645
|
+
//sessionStorage product
|
|
646
|
+
const adminFacilitatorCanEvaluate =
|
|
647
|
+
retailerStatus === "IE" && [1, 4, 5].includes(user.id_role);
|
|
648
|
+
const adminAuditorCanEvaluate =
|
|
649
|
+
["AC", "RP", "RCA"].includes(retailerStatus) &&
|
|
650
|
+
[1, 6].includes(user.id_role);
|
|
651
|
+
return adminFacilitatorCanEvaluate || adminAuditorCanEvaluate;
|
|
651
652
|
};
|
|
652
653
|
|
|
653
654
|
const getSectionIcon = () => {
|
|
@@ -671,92 +672,57 @@ export const RetailerProductEdition = ({
|
|
|
671
672
|
try {
|
|
672
673
|
let concept = getConcept(activeTab);
|
|
673
674
|
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
675
|
+
const productTemp = { ...product };
|
|
676
|
+
const evalStatus = retailerStatus;
|
|
677
|
+
const articleId = product.article.id_article;
|
|
678
|
+
const orderId = product.orderId;
|
|
679
|
+
|
|
680
|
+
let data = {
|
|
681
|
+
articleId,
|
|
682
|
+
orderId,
|
|
683
|
+
concept,
|
|
684
|
+
evalStatus,
|
|
685
|
+
retailerId: activeRetailer.id,
|
|
686
|
+
};
|
|
687
|
+
let res;
|
|
678
688
|
if (result) {
|
|
679
|
-
data =
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
headers: {
|
|
690
|
-
Authorization: token,
|
|
691
|
-
},
|
|
692
|
-
});
|
|
689
|
+
data.result = result;
|
|
690
|
+
res = await axios.put(
|
|
691
|
+
`${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
692
|
+
data,
|
|
693
|
+
{
|
|
694
|
+
headers: {
|
|
695
|
+
Authorization: token,
|
|
696
|
+
},
|
|
697
|
+
}
|
|
698
|
+
);
|
|
693
699
|
getServices();
|
|
694
700
|
} else {
|
|
695
|
-
const specialistDone =
|
|
696
|
-
evalStatus === "RF" ||
|
|
697
|
-
evalStatus === "RA" ||
|
|
698
|
-
evalStatus === "IN_PROGRESS";
|
|
701
|
+
const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
|
|
699
702
|
|
|
703
|
+
let message;
|
|
700
704
|
if (specialistDone) {
|
|
701
|
-
|
|
702
|
-
getSectionIcon();
|
|
703
|
-
} else if (evalStatus === "QF") {
|
|
704
|
-
setMessage("Evaluación enviada");
|
|
705
|
-
getSectionIcon();
|
|
706
|
-
} else if (evalStatus === "AF") {
|
|
707
|
-
setMessage("Evaluación enviada");
|
|
708
|
-
getSectionIcon();
|
|
709
|
-
} else if (evalStatus === "RP") {
|
|
710
|
-
setMessage("Evaluación enviada");
|
|
705
|
+
message = `${activeTab} enviada a facilitador`;
|
|
711
706
|
getSectionIcon();
|
|
712
|
-
} else if (
|
|
713
|
-
|
|
707
|
+
} else if (["IE", "AC", "RP", "RCA"].includes(evalStatus)) {
|
|
708
|
+
message = "Evaluación enviada";
|
|
714
709
|
getSectionIcon();
|
|
715
710
|
}
|
|
716
|
-
|
|
717
|
-
servicesData.forEach((srv) => {
|
|
718
|
-
srv.service === concept && statusArr.push(srv.status);
|
|
719
|
-
});
|
|
720
|
-
|
|
721
|
-
productTemp[`${concept}_status`] = getNewStatus(statusArr);
|
|
722
|
-
|
|
723
|
-
let newStatus = getNewStatus([
|
|
724
|
-
productTemp.datasheet_status,
|
|
725
|
-
productTemp.description_status,
|
|
726
|
-
productTemp.images_status,
|
|
727
|
-
]);
|
|
728
|
-
|
|
729
|
-
productTemp.status = newStatus;
|
|
730
|
-
|
|
731
|
-
data = {
|
|
732
|
-
articleId: product.article.id_article,
|
|
733
|
-
orderId: product.orderId,
|
|
734
|
-
concept: concept,
|
|
735
|
-
evalStatus: evalStatus,
|
|
736
|
-
retailerId: activeRetailer.id,
|
|
737
|
-
};
|
|
738
|
-
|
|
739
|
-
switch (user.id_role) {
|
|
740
|
-
case 7:
|
|
741
|
-
case 8:
|
|
742
|
-
data.especialist = true;
|
|
743
|
-
break;
|
|
744
|
-
case 4:
|
|
745
|
-
case 5:
|
|
746
|
-
data.facilitator = true;
|
|
747
|
-
break;
|
|
748
|
-
default:
|
|
749
|
-
break;
|
|
750
|
-
}
|
|
751
|
-
await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
711
|
+
res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
752
712
|
headers: {
|
|
753
713
|
Authorization: token,
|
|
754
714
|
},
|
|
755
715
|
});
|
|
756
716
|
}
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
717
|
+
if (res.data.statusCode === 200) {
|
|
718
|
+
const { newStatus, newOrderStatus } = JSON.parse(res.data.body);
|
|
719
|
+
if (newOrderStatus) productTemp.status = newOrderStatus[orderId];
|
|
720
|
+
productTemp[`${concept}_status`] = newStatus;
|
|
721
|
+
await loadData();
|
|
722
|
+
if (message) setMessage(message);
|
|
723
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
724
|
+
setProduct(productTemp);
|
|
725
|
+
}
|
|
760
726
|
} catch (error) {
|
|
761
727
|
console.log(error);
|
|
762
728
|
}
|
|
@@ -942,12 +908,12 @@ export const RetailerProductEdition = ({
|
|
|
942
908
|
},
|
|
943
909
|
],
|
|
944
910
|
concept: concept,
|
|
945
|
-
|
|
911
|
+
userId: assignationId,
|
|
946
912
|
};
|
|
947
|
-
axios({
|
|
913
|
+
await axios({
|
|
948
914
|
method: "post",
|
|
949
915
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
950
|
-
data
|
|
916
|
+
data,
|
|
951
917
|
headers: {
|
|
952
918
|
Authorization: token,
|
|
953
919
|
},
|
|
@@ -1082,6 +1048,66 @@ export const RetailerProductEdition = ({
|
|
|
1082
1048
|
setSaving(loading);
|
|
1083
1049
|
}, [loading]);
|
|
1084
1050
|
|
|
1051
|
+
const validateAll = async (result) => {
|
|
1052
|
+
try {
|
|
1053
|
+
setLoading(true);
|
|
1054
|
+
const evaluationArray = [];
|
|
1055
|
+
const sendAll = [];
|
|
1056
|
+
const conceptArray = ["description", "datasheet", "images"];
|
|
1057
|
+
|
|
1058
|
+
servicesData?.forEach((ret) => {
|
|
1059
|
+
let data = {
|
|
1060
|
+
articleId: product.article.id_article,
|
|
1061
|
+
orderId: product.id_order ?? product.orderId,
|
|
1062
|
+
concept: ret.service,
|
|
1063
|
+
result: result,
|
|
1064
|
+
evalStatus: product[`${ret.service}_status`],
|
|
1065
|
+
retailerId: ret.id_retailer,
|
|
1066
|
+
};
|
|
1067
|
+
evaluationArray.push(
|
|
1068
|
+
axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
|
|
1069
|
+
headers: {
|
|
1070
|
+
Authorization: token,
|
|
1071
|
+
},
|
|
1072
|
+
})
|
|
1073
|
+
);
|
|
1074
|
+
});
|
|
1075
|
+
|
|
1076
|
+
await Promise.all(evaluationArray);
|
|
1077
|
+
|
|
1078
|
+
conceptArray?.forEach((concept) => {
|
|
1079
|
+
let data = {
|
|
1080
|
+
articleId: product.article.id_article,
|
|
1081
|
+
orderId: product.id_order ?? product.orderId,
|
|
1082
|
+
concept,
|
|
1083
|
+
evalStatus: product[`${concept}_status`],
|
|
1084
|
+
};
|
|
1085
|
+
sendAll.push(
|
|
1086
|
+
axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
1087
|
+
headers: {
|
|
1088
|
+
Authorization: token,
|
|
1089
|
+
},
|
|
1090
|
+
})
|
|
1091
|
+
);
|
|
1092
|
+
});
|
|
1093
|
+
await Promise.all(sendAll);
|
|
1094
|
+
const productTemp = product;
|
|
1095
|
+
productTemp.status = `${result}A`;
|
|
1096
|
+
productTemp.datasheet_status =
|
|
1097
|
+
productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
|
|
1098
|
+
productTemp.description_status =
|
|
1099
|
+
productTemp.description_status === "NA" ? "NA" : `${result}A`;
|
|
1100
|
+
productTemp.images_status =
|
|
1101
|
+
productTemp.images_status === "NA" ? "NA" : `${result}A`;
|
|
1102
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1103
|
+
setProduct(productTemp);
|
|
1104
|
+
|
|
1105
|
+
await loadData();
|
|
1106
|
+
} catch (error) {
|
|
1107
|
+
console.log(error);
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1085
1111
|
return (
|
|
1086
1112
|
<Container headerTop={headerTop}>
|
|
1087
1113
|
<HeaderTop setHeaderTop={setHeaderTop} />
|
|
@@ -1151,9 +1177,50 @@ export const RetailerProductEdition = ({
|
|
|
1151
1177
|
/>,
|
|
1152
1178
|
]);
|
|
1153
1179
|
}}
|
|
1180
|
+
showApproveRejectAll={
|
|
1181
|
+
isAuditor &&
|
|
1182
|
+
servicesData.every((serv) =>
|
|
1183
|
+
["RA", "AA", "AP", "ACA", "AC"].includes(serv.status)
|
|
1184
|
+
) &&
|
|
1185
|
+
approveRejectButtons() &&
|
|
1186
|
+
(auditorAssigned() || userAssigned())
|
|
1187
|
+
}
|
|
1154
1188
|
showValidationButtons={
|
|
1155
1189
|
approveRejectButtons() && (auditorAssigned() || userAssigned())
|
|
1156
1190
|
}
|
|
1191
|
+
approveAll={() => validateAll("A")}
|
|
1192
|
+
rejectAll={() => {
|
|
1193
|
+
validateAll("R");
|
|
1194
|
+
setMessage("Rechazado");
|
|
1195
|
+
setComponentsArray([
|
|
1196
|
+
<img src={errorModal} />,
|
|
1197
|
+
<ScreenHeader
|
|
1198
|
+
text={"Agrega tu comentarios para enviar el rechazo"}
|
|
1199
|
+
headerType={"input-name-header"}
|
|
1200
|
+
color={"white"}
|
|
1201
|
+
/>,
|
|
1202
|
+
<TagAndInput
|
|
1203
|
+
label={"Caja de Comentario"}
|
|
1204
|
+
inputType={"textarea"}
|
|
1205
|
+
inputId={"modal-commentary-box"}
|
|
1206
|
+
index={0}
|
|
1207
|
+
color={"white"}
|
|
1208
|
+
/>,
|
|
1209
|
+
<Button
|
|
1210
|
+
buttonType={"general-default-button"}
|
|
1211
|
+
label={"Enviar comentario"}
|
|
1212
|
+
onClick={(e) =>
|
|
1213
|
+
createComment(
|
|
1214
|
+
e,
|
|
1215
|
+
document.querySelector(
|
|
1216
|
+
"#modal-commentary-box .ql-container .ql-editor > p"
|
|
1217
|
+
).innerHTML,
|
|
1218
|
+
activeTab
|
|
1219
|
+
)
|
|
1220
|
+
}
|
|
1221
|
+
/>,
|
|
1222
|
+
]);
|
|
1223
|
+
}}
|
|
1157
1224
|
/>
|
|
1158
1225
|
<FullTabsMenu
|
|
1159
1226
|
tabsSections={tabsSections}
|
|
@@ -1306,16 +1373,21 @@ export const RetailerProductEdition = ({
|
|
|
1306
1373
|
/>
|
|
1307
1374
|
</div>
|
|
1308
1375
|
)}
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1376
|
+
{[7, 8].includes(user.id_role) && (
|
|
1377
|
+
<Button
|
|
1378
|
+
buttonType={
|
|
1379
|
+
evaluationFinished(
|
|
1380
|
+
user.id_role,
|
|
1381
|
+
activeTab,
|
|
1382
|
+
statusArray
|
|
1383
|
+
) && requiredNull[activeTab] === 0
|
|
1384
|
+
? "general-green-button"
|
|
1385
|
+
: "general-button-disabled"
|
|
1386
|
+
}
|
|
1387
|
+
label={"Enviar evaluación"}
|
|
1388
|
+
onClick={() => sendToFacilitator()}
|
|
1389
|
+
/>
|
|
1390
|
+
)}
|
|
1319
1391
|
</div>
|
|
1320
1392
|
)}
|
|
1321
1393
|
</div>
|
|
@@ -1349,4 +1421,4 @@ export const RetailerProductEdition = ({
|
|
|
1349
1421
|
)}
|
|
1350
1422
|
</Container>
|
|
1351
1423
|
);
|
|
1352
|
-
};
|
|
1424
|
+
};
|
package/src/global-files/data.js
CHANGED
|
@@ -195,18 +195,19 @@ export const fetchUsers = async (auth) => {
|
|
|
195
195
|
export const getNewStatus = (statusArray) => {
|
|
196
196
|
let lookupString = "";
|
|
197
197
|
statusArray.forEach((element) => (lookupString += element + "/"));
|
|
198
|
-
if (lookupString.includes("
|
|
198
|
+
if (lookupString.includes("RC")) return "RC";
|
|
199
199
|
if (lookupString.includes("RA")) return "RA";
|
|
200
200
|
if (lookupString.includes("RP")) return "RP";
|
|
201
|
-
if (lookupString.includes("
|
|
202
|
-
if (lookupString.includes("UNASSIGNED")) return "
|
|
203
|
-
if (lookupString.includes("
|
|
204
|
-
if (lookupString.includes("
|
|
205
|
-
if (lookupString.includes("
|
|
201
|
+
if (lookupString.includes("RCA")) return "RCA";
|
|
202
|
+
if (lookupString.includes("UNASSIGNED")) return "CA";
|
|
203
|
+
if (lookupString.includes("CA")) return "CA";
|
|
204
|
+
if (lookupString.includes("IE")) return "IE";
|
|
205
|
+
if (lookupString.includes("AC")) return "AC";
|
|
206
206
|
if (lookupString.includes("AA")) return "AA";
|
|
207
207
|
if (lookupString.includes("AP")) return "AP";
|
|
208
|
-
if (lookupString.includes("
|
|
209
|
-
if (lookupString.includes("
|
|
208
|
+
if (lookupString.includes("ACA")) return "ACA";
|
|
209
|
+
if (lookupString.includes("R")) return "R";
|
|
210
210
|
if (lookupString.includes("NA")) return "NA";
|
|
211
|
-
|
|
211
|
+
console.log("Status not found");
|
|
212
|
+
return "NA";
|
|
212
213
|
};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|