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
|
@@ -216,6 +216,7 @@ export const ProviderProductEdition = ({
|
|
|
216
216
|
const loadData = async () => {
|
|
217
217
|
const services = await getRetailerServices(
|
|
218
218
|
product?.id_article || product?.article?.id_article,
|
|
219
|
+
product?.article?.company_name || product?.categoryName,
|
|
219
220
|
parseInt(product?.article?.id_category || product?.id_category),
|
|
220
221
|
product?.version
|
|
221
222
|
);
|
|
@@ -232,11 +233,8 @@ export const ProviderProductEdition = ({
|
|
|
232
233
|
);
|
|
233
234
|
}
|
|
234
235
|
|
|
235
|
-
//setActiveRetailer(product?.retailers[0]);
|
|
236
|
-
setImages({
|
|
237
|
-
action: "init",
|
|
238
|
-
init: services[2],
|
|
239
|
-
});
|
|
236
|
+
// setActiveRetailer(product?.retailers[0]);
|
|
237
|
+
setImages({ action: "init", init: services[2] });
|
|
240
238
|
if (services[2]?.values?.length > 0) setActiveImage(0);
|
|
241
239
|
|
|
242
240
|
getPercentage({ data: [product] }).then((res) => setPercentages(res));
|
|
@@ -255,10 +253,11 @@ export const ProviderProductEdition = ({
|
|
|
255
253
|
}&end=true`
|
|
256
254
|
);
|
|
257
255
|
const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
|
|
256
|
+
const retailerResponse = parsedResponse?.map((srv) => srv.id_retailer);
|
|
258
257
|
let retailers = product.retailers || product.retailersAvailable;
|
|
259
|
-
let active = retailers?.
|
|
260
|
-
|
|
261
|
-
)
|
|
258
|
+
let active = retailers?.find((retailer) =>
|
|
259
|
+
retailerResponse.includes(retailer.id)
|
|
260
|
+
);
|
|
262
261
|
!activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
|
|
263
262
|
setServicesData(parsedResponse);
|
|
264
263
|
}
|
|
@@ -279,15 +278,15 @@ export const ProviderProductEdition = ({
|
|
|
279
278
|
if (revision && currentService === "AP") return true;
|
|
280
279
|
} else {
|
|
281
280
|
const { product } = productEdit;
|
|
282
|
-
|
|
283
|
-
orgn === "
|
|
284
|
-
(["
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
)
|
|
281
|
+
const isRequestWithoutContentoh =
|
|
282
|
+
orgn === "RequestWithoutContentoh" &&
|
|
283
|
+
(["R", "CA"].includes(currentService) ||
|
|
284
|
+
(currentService === "RCA" &&
|
|
285
|
+
(!product.id_order || !product.orderId)));
|
|
286
|
+
const isRequestWithContentoh =
|
|
287
|
+
orgn === "RequestWithContentoh" && currentService === "AA";
|
|
288
|
+
const isContentoh = orgn === "Contentoh" && currentService === "AA";
|
|
289
|
+
if (isContentoh || isRequestWithoutContentoh || isRequestWithContentoh)
|
|
291
290
|
return true;
|
|
292
291
|
}
|
|
293
292
|
}
|
|
@@ -304,26 +303,26 @@ export const ProviderProductEdition = ({
|
|
|
304
303
|
setInCart(arr.some((e) => e.articleId === product.id_article));
|
|
305
304
|
};
|
|
306
305
|
|
|
307
|
-
useEffect(
|
|
306
|
+
useEffect(() => {
|
|
308
307
|
sessionStorage.setItem("user", JSON.stringify(user));
|
|
309
308
|
loadData();
|
|
310
309
|
getCart();
|
|
311
|
-
|
|
310
|
+
fetchUsers(token).then((res) => setUserGroups(res));
|
|
312
311
|
let arr = [];
|
|
312
|
+
// ?? Que sentido tiene verificar los roles de colaborador en la app de proveedor
|
|
313
313
|
switch (user.id_role) {
|
|
314
314
|
case 7:
|
|
315
315
|
case 8:
|
|
316
|
-
arr = ["
|
|
316
|
+
arr = ["CA", "RC", "RA"];
|
|
317
317
|
break;
|
|
318
318
|
case 4:
|
|
319
319
|
case 5:
|
|
320
|
-
arr = ["
|
|
320
|
+
arr = ["RC", "AC", "AA", "AP", "ACA"];
|
|
321
321
|
break;
|
|
322
322
|
case 6:
|
|
323
|
-
arr = ["RP", "
|
|
323
|
+
arr = ["RP", "RCA", "AC"];
|
|
324
324
|
break;
|
|
325
325
|
default:
|
|
326
|
-
arr = [];
|
|
327
326
|
break;
|
|
328
327
|
}
|
|
329
328
|
setStatusArray(arr);
|
|
@@ -341,9 +340,9 @@ export const ProviderProductEdition = ({
|
|
|
341
340
|
const productTemp = product;
|
|
342
341
|
const retailers = productTemp?.retailersAvailable || productTemp?.retailers;
|
|
343
342
|
retailers?.forEach((retailer) => {
|
|
344
|
-
retailer["percentage"] = percentages?.
|
|
343
|
+
retailer["percentage"] = percentages?.find(
|
|
345
344
|
(percent) => retailer?.id === percent?.id_retailer
|
|
346
|
-
)
|
|
345
|
+
)?.percentage;
|
|
347
346
|
});
|
|
348
347
|
|
|
349
348
|
setProduct(productTemp);
|
|
@@ -419,7 +418,7 @@ export const ProviderProductEdition = ({
|
|
|
419
418
|
};
|
|
420
419
|
if (product?.orderId) dataObject["orderId"] = product?.orderId;
|
|
421
420
|
try {
|
|
422
|
-
await axios.put(
|
|
421
|
+
const res = await axios.put(
|
|
423
422
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
|
|
424
423
|
dataObject,
|
|
425
424
|
{
|
|
@@ -428,8 +427,10 @@ export const ProviderProductEdition = ({
|
|
|
428
427
|
},
|
|
429
428
|
}
|
|
430
429
|
);
|
|
431
|
-
|
|
432
|
-
|
|
430
|
+
if (res.data.statusCode === 200) {
|
|
431
|
+
setMessage("Descripciones guardadas con éxito");
|
|
432
|
+
await loadData();
|
|
433
|
+
}
|
|
433
434
|
} catch (error) {
|
|
434
435
|
console.log(error);
|
|
435
436
|
}
|
|
@@ -452,8 +453,10 @@ export const ProviderProductEdition = ({
|
|
|
452
453
|
},
|
|
453
454
|
}
|
|
454
455
|
);
|
|
455
|
-
|
|
456
|
-
|
|
456
|
+
if (res.data.statusCode === 200) {
|
|
457
|
+
setMessage("Fichas técnicas guardadas");
|
|
458
|
+
await loadData();
|
|
459
|
+
}
|
|
457
460
|
} catch (error) {
|
|
458
461
|
console.log(error);
|
|
459
462
|
}
|
|
@@ -551,7 +554,7 @@ export const ProviderProductEdition = ({
|
|
|
551
554
|
return e;
|
|
552
555
|
});
|
|
553
556
|
try {
|
|
554
|
-
await axios.put(
|
|
557
|
+
const res = await axios.put(
|
|
555
558
|
`${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
|
|
556
559
|
dataImages,
|
|
557
560
|
{
|
|
@@ -560,9 +563,11 @@ export const ProviderProductEdition = ({
|
|
|
560
563
|
},
|
|
561
564
|
}
|
|
562
565
|
);
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
+
if (res.data.statusCode === 200) {
|
|
567
|
+
setMessage("Imágenes guardadas con éxito");
|
|
568
|
+
sessionStorage.removeItem("imagesList");
|
|
569
|
+
await loadData();
|
|
570
|
+
}
|
|
566
571
|
} catch (error) {
|
|
567
572
|
console.log(error);
|
|
568
573
|
}
|
|
@@ -664,12 +669,12 @@ export const ProviderProductEdition = ({
|
|
|
664
669
|
},
|
|
665
670
|
],
|
|
666
671
|
concept: concept,
|
|
667
|
-
|
|
672
|
+
userId: assignationId,
|
|
668
673
|
};
|
|
669
|
-
axios({
|
|
674
|
+
await axios({
|
|
670
675
|
method: "post",
|
|
671
676
|
url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
|
|
672
|
-
data
|
|
677
|
+
data,
|
|
673
678
|
headers: {
|
|
674
679
|
Authorization: token,
|
|
675
680
|
},
|
|
@@ -687,7 +692,7 @@ export const ProviderProductEdition = ({
|
|
|
687
692
|
serv = serv.filter((f) => f.id_retailer === activeRetailer.id);
|
|
688
693
|
}
|
|
689
694
|
const statusArray =
|
|
690
|
-
user.is_retailer === 1 ? ["
|
|
695
|
+
user.is_retailer === 1 ? ["ACA", "RCA"] : ["AP", "RP", "ACA"];
|
|
691
696
|
return (
|
|
692
697
|
serv.length > 0 && serv.every((item) => statusArray.includes(item.status))
|
|
693
698
|
);
|
|
@@ -790,7 +795,7 @@ export const ProviderProductEdition = ({
|
|
|
790
795
|
const { datasheet_status, description_status, images_status } = product;
|
|
791
796
|
const completionStates =
|
|
792
797
|
user.is_retailer === 1
|
|
793
|
-
? ["
|
|
798
|
+
? ["ACA", "Evaluated", "NS"]
|
|
794
799
|
: ["AP", "Evaluated", "NS"];
|
|
795
800
|
const dsEvaluated = completionStates.includes(datasheet_status);
|
|
796
801
|
const descsEvaluated = completionStates.includes(description_status);
|
|
@@ -803,61 +808,61 @@ export const ProviderProductEdition = ({
|
|
|
803
808
|
|
|
804
809
|
const sendEvaluation = async (result) => {
|
|
805
810
|
setLoading(true);
|
|
806
|
-
|
|
811
|
+
const concept = getConcept(activeTab);
|
|
812
|
+
const productTemp = product;
|
|
813
|
+
const articleId = productTemp.id_article;
|
|
814
|
+
const orderId = productTemp.id_order ?? productTemp.orderId;
|
|
815
|
+
const evalStatus =
|
|
816
|
+
product[`${getConcept(activeTab)}_status`] || product?.version_status;
|
|
817
|
+
let data = { articleId, orderId, concept, evalStatus };
|
|
807
818
|
const retailerId = activeRetailer?.id;
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
setProduct(productTemp);
|
|
836
|
-
setProductEdit({
|
|
837
|
-
ArticleId: productTemp.id_article,
|
|
838
|
-
idCategory: productTemp.article.id_category,
|
|
839
|
-
product: productTemp,
|
|
840
|
-
});
|
|
841
|
-
sessionStorage.setItem(
|
|
842
|
-
"productEdit",
|
|
843
|
-
JSON.stringify({
|
|
844
|
-
ArticleId: productTemp.id_article,
|
|
819
|
+
let res;
|
|
820
|
+
try {
|
|
821
|
+
if (result) {
|
|
822
|
+
data.result = result;
|
|
823
|
+
data.retailerId = retailerId;
|
|
824
|
+
res = await axios.put(
|
|
825
|
+
`${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
826
|
+
data,
|
|
827
|
+
{
|
|
828
|
+
headers: {
|
|
829
|
+
Authorization: token,
|
|
830
|
+
},
|
|
831
|
+
}
|
|
832
|
+
);
|
|
833
|
+
} else {
|
|
834
|
+
res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
|
|
835
|
+
headers: {
|
|
836
|
+
Authorization: token,
|
|
837
|
+
},
|
|
838
|
+
});
|
|
839
|
+
}
|
|
840
|
+
if (res.data.statusCode === 200) {
|
|
841
|
+
productTemp[`${concept}_status`] = "Evaluated";
|
|
842
|
+
setProduct(productTemp);
|
|
843
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
844
|
+
const newProductEdit = {
|
|
845
|
+
ArticleId: articleId,
|
|
845
846
|
idCategory: productTemp.article.id_category,
|
|
846
847
|
product: productTemp,
|
|
847
|
-
}
|
|
848
|
-
|
|
849
|
-
|
|
848
|
+
};
|
|
849
|
+
setProductEdit(newProductEdit);
|
|
850
|
+
sessionStorage.setItem("productEdit", JSON.stringify(newProductEdit));
|
|
851
|
+
setOrigin((prev) => ({ ...prev, [concept]: "Evaluated" }));
|
|
852
|
+
await loadData();
|
|
853
|
+
showSurvey && showSurvey(confirmStatusComplete());
|
|
854
|
+
}
|
|
855
|
+
} catch (err) {
|
|
856
|
+
console.log(err);
|
|
850
857
|
}
|
|
851
|
-
loadData();
|
|
852
|
-
showSurvey && showSurvey(confirmStatusComplete());
|
|
853
858
|
};
|
|
854
859
|
|
|
855
860
|
const validateAll = async (result) => {
|
|
856
861
|
try {
|
|
862
|
+
setLoading(true);
|
|
857
863
|
const evaluationArray = [];
|
|
858
864
|
const sendAll = [];
|
|
859
865
|
const conceptArray = ["description", "datasheet", "images"];
|
|
860
|
-
console.log(servicesData);
|
|
861
866
|
|
|
862
867
|
servicesData?.forEach((ret) => {
|
|
863
868
|
let data = {
|
|
@@ -876,7 +881,9 @@ export const ProviderProductEdition = ({
|
|
|
876
881
|
);
|
|
877
882
|
});
|
|
878
883
|
|
|
879
|
-
|
|
884
|
+
await Promise.all(evaluationArray);
|
|
885
|
+
|
|
886
|
+
conceptArray?.forEach((concept) => {
|
|
880
887
|
let data = {
|
|
881
888
|
articleId: product.id_article,
|
|
882
889
|
orderId: product.id_order ?? product.orderId,
|
|
@@ -891,8 +898,32 @@ export const ProviderProductEdition = ({
|
|
|
891
898
|
);
|
|
892
899
|
});
|
|
893
900
|
|
|
894
|
-
Promise.all(
|
|
895
|
-
|
|
901
|
+
await Promise.all(sendAll);
|
|
902
|
+
const productTemp = product;
|
|
903
|
+
productTemp.article_status = `${result}CA`;
|
|
904
|
+
productTemp.datasheet_status =
|
|
905
|
+
productTemp.datasheet_status === "NA" ? "NA" : `${result}CA`;
|
|
906
|
+
productTemp.description_status =
|
|
907
|
+
productTemp.description_status === "NA" ? "NA" : `${result}CA`;
|
|
908
|
+
productTemp.images_status =
|
|
909
|
+
productTemp.images_status === "NA" ? "NA" : `${result}CA`;
|
|
910
|
+
setProduct(productTemp);
|
|
911
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
912
|
+
setProductEdit({
|
|
913
|
+
ArticleId: productTemp.id_article,
|
|
914
|
+
idCategory: productTemp.article.id_category,
|
|
915
|
+
product: productTemp,
|
|
916
|
+
});
|
|
917
|
+
sessionStorage.setItem(
|
|
918
|
+
"productEdit",
|
|
919
|
+
JSON.stringify({
|
|
920
|
+
ArticleId: productTemp.id_article,
|
|
921
|
+
idCategory: productTemp.article.id_category,
|
|
922
|
+
product: productTemp,
|
|
923
|
+
})
|
|
924
|
+
);
|
|
925
|
+
|
|
926
|
+
await loadData();
|
|
896
927
|
} catch (error) {
|
|
897
928
|
console.log(error);
|
|
898
929
|
}
|
|
@@ -913,7 +944,7 @@ export const ProviderProductEdition = ({
|
|
|
913
944
|
},
|
|
914
945
|
});
|
|
915
946
|
const prod = productEdit;
|
|
916
|
-
const statusComplete = user.is_retailer ? `${result}
|
|
947
|
+
const statusComplete = user.is_retailer ? `${result}CA` : `${result}P`;
|
|
917
948
|
prod.product.datasheet_status = statusComplete;
|
|
918
949
|
prod.product.description_status = statusComplete;
|
|
919
950
|
prod.product.images_status = statusComplete;
|
|
@@ -922,24 +953,22 @@ export const ProviderProductEdition = ({
|
|
|
922
953
|
sessionStorage.setItem("productEdit", JSON.stringify(prod));
|
|
923
954
|
setProduct(prod);
|
|
924
955
|
setShowGenericModal && setShowGenericModal(false);
|
|
925
|
-
loadData();
|
|
956
|
+
await loadData();
|
|
926
957
|
};
|
|
927
958
|
|
|
928
959
|
const getSectionStatus = () => {
|
|
929
960
|
const concept = getConcept(activeTab);
|
|
930
|
-
return ["AA", "AP", "
|
|
961
|
+
return ["AA", "AP", "R", "CA", "RCA"].includes(
|
|
931
962
|
productEdit.product[`${concept}_status`]
|
|
932
963
|
);
|
|
933
964
|
};
|
|
934
965
|
|
|
935
966
|
const enableActions = (versionStatus) => {
|
|
936
967
|
try {
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
if (userIsRetailer) return false;
|
|
968
|
+
if (user.is_retailer) return false;
|
|
940
969
|
|
|
941
970
|
if (versionStatus) {
|
|
942
|
-
return ["AP", "
|
|
971
|
+
return ["AP", "ACA", "RCA", null].includes(versionStatus);
|
|
943
972
|
}
|
|
944
973
|
return true;
|
|
945
974
|
} catch (err) {
|
|
@@ -948,6 +977,10 @@ export const ProviderProductEdition = ({
|
|
|
948
977
|
}
|
|
949
978
|
};
|
|
950
979
|
|
|
980
|
+
useEffect(() => {
|
|
981
|
+
setSaving(loading);
|
|
982
|
+
}, [loading]);
|
|
983
|
+
|
|
951
984
|
const slidefront = [
|
|
952
985
|
{
|
|
953
986
|
slide: Slide1_1,
|
|
@@ -977,18 +1010,6 @@ export const ProviderProductEdition = ({
|
|
|
977
1010
|
},
|
|
978
1011
|
];
|
|
979
1012
|
|
|
980
|
-
useEffect(() => {
|
|
981
|
-
setSaving(loading);
|
|
982
|
-
}, [loading]);
|
|
983
|
-
|
|
984
|
-
console.log(
|
|
985
|
-
user.is_retailer === 1,
|
|
986
|
-
product.id_order || product.orderId,
|
|
987
|
-
isRevision(),
|
|
988
|
-
getSectionStatus(),
|
|
989
|
-
"XD"
|
|
990
|
-
);
|
|
991
|
-
|
|
992
1013
|
return (
|
|
993
1014
|
<Container headerTop={headerTop}>
|
|
994
1015
|
<HeaderTop setHeaderTop={setHeaderTop} />
|
|
@@ -1022,17 +1043,10 @@ export const ProviderProductEdition = ({
|
|
|
1022
1043
|
setActiveRetailer={setActiveRetailer}
|
|
1023
1044
|
showValidationButtons={isRevision() && getSectionStatus()}
|
|
1024
1045
|
servicesData={servicesData ? servicesData : null}
|
|
1025
|
-
showApproveRejectAll={
|
|
1026
|
-
|
|
1027
|
-
(product.id_order || product.orderId) &&
|
|
1028
|
-
isRevision() &&
|
|
1029
|
-
getSectionStatus()
|
|
1030
|
-
}
|
|
1031
|
-
approveAll={() => validateAll("A")}
|
|
1032
|
-
rejectAll={() => validateAll("R")}
|
|
1033
|
-
approve={() => {
|
|
1046
|
+
showApproveRejectAll={isRevision() && getSectionStatus()}
|
|
1047
|
+
approveAll={() => {
|
|
1034
1048
|
if (
|
|
1035
|
-
|
|
1049
|
+
originProp === "RequestWithoutContentoh" &&
|
|
1036
1050
|
!user.is_retailer &&
|
|
1037
1051
|
(!product.id_order || !product.orderId)
|
|
1038
1052
|
) {
|
|
@@ -1044,23 +1058,78 @@ export const ProviderProductEdition = ({
|
|
|
1044
1058
|
},
|
|
1045
1059
|
}));
|
|
1046
1060
|
setShowGenericModal(true);
|
|
1061
|
+
} else if (user.is_retailer) {
|
|
1062
|
+
if (product.id_order || product.orderId) {
|
|
1063
|
+
validateAll("A");
|
|
1064
|
+
} else {
|
|
1065
|
+
setDataGenericModal((prev) => ({
|
|
1066
|
+
...prev,
|
|
1067
|
+
button2: {
|
|
1068
|
+
name: "Continuar",
|
|
1069
|
+
action: () => evaluationToRetailer("A"),
|
|
1070
|
+
},
|
|
1071
|
+
}));
|
|
1072
|
+
setShowGenericModal(true);
|
|
1073
|
+
}
|
|
1047
1074
|
} else {
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1075
|
+
validateAll("A");
|
|
1076
|
+
}
|
|
1077
|
+
}}
|
|
1078
|
+
rejectAll={() => {
|
|
1079
|
+
if (
|
|
1080
|
+
originProp === "RequestWithoutContentoh" &&
|
|
1081
|
+
!user.is_retailer &&
|
|
1082
|
+
(!product.id_order || !product.orderId)
|
|
1083
|
+
) {
|
|
1084
|
+
return;
|
|
1085
|
+
} else if (user.is_retailer) {
|
|
1086
|
+
if (product.id_order || product.orderId) {
|
|
1087
|
+
validateAll("R");
|
|
1088
|
+
setModalViewError(true);
|
|
1061
1089
|
} else {
|
|
1090
|
+
setDataGenericModal((prev) => ({
|
|
1091
|
+
...prev,
|
|
1092
|
+
button2: {
|
|
1093
|
+
name: "Continuar",
|
|
1094
|
+
action: () => evaluationToRetailer("R"),
|
|
1095
|
+
},
|
|
1096
|
+
}));
|
|
1097
|
+
setShowGenericModal(true);
|
|
1098
|
+
}
|
|
1099
|
+
} else {
|
|
1100
|
+
validateAll("R");
|
|
1101
|
+
setModalViewError(true);
|
|
1102
|
+
}
|
|
1103
|
+
}}
|
|
1104
|
+
approve={() => {
|
|
1105
|
+
if (
|
|
1106
|
+
origin[activeTab] === "RequestWithoutContentoh" &&
|
|
1107
|
+
!user.is_retailer &&
|
|
1108
|
+
(!product.id_order || !product.orderId)
|
|
1109
|
+
) {
|
|
1110
|
+
setDataGenericModal((prev) => ({
|
|
1111
|
+
...prev,
|
|
1112
|
+
button2: {
|
|
1113
|
+
name: "Continuar",
|
|
1114
|
+
action: () => evaluationToRetailer("A"),
|
|
1115
|
+
},
|
|
1116
|
+
}));
|
|
1117
|
+
setShowGenericModal(true);
|
|
1118
|
+
} else if (user.is_retailer) {
|
|
1119
|
+
if (product.id_order || product.orderId) {
|
|
1062
1120
|
sendEvaluation("A");
|
|
1121
|
+
} else {
|
|
1122
|
+
setDataGenericModal((prev) => ({
|
|
1123
|
+
...prev,
|
|
1124
|
+
button2: {
|
|
1125
|
+
name: "Continuar",
|
|
1126
|
+
action: () => evaluationToRetailer("A"),
|
|
1127
|
+
},
|
|
1128
|
+
}));
|
|
1129
|
+
setShowGenericModal(true);
|
|
1063
1130
|
}
|
|
1131
|
+
} else {
|
|
1132
|
+
sendEvaluation("A");
|
|
1064
1133
|
}
|
|
1065
1134
|
}}
|
|
1066
1135
|
reject={() => {
|
|
@@ -1070,25 +1139,23 @@ export const ProviderProductEdition = ({
|
|
|
1070
1139
|
(!product.id_order || !product.orderId)
|
|
1071
1140
|
) {
|
|
1072
1141
|
return;
|
|
1073
|
-
} else {
|
|
1074
|
-
if (
|
|
1075
|
-
if (product.id_order || product.orderId) {
|
|
1076
|
-
sendEvaluation("R");
|
|
1077
|
-
setModalViewError(true);
|
|
1078
|
-
} else {
|
|
1079
|
-
setDataGenericModal((prev) => ({
|
|
1080
|
-
...prev,
|
|
1081
|
-
button2: {
|
|
1082
|
-
name: "Continuar",
|
|
1083
|
-
action: () => evaluationToRetailer("R"),
|
|
1084
|
-
},
|
|
1085
|
-
}));
|
|
1086
|
-
setShowGenericModal(true);
|
|
1087
|
-
}
|
|
1088
|
-
} else {
|
|
1142
|
+
} else if (user.is_retailer) {
|
|
1143
|
+
if (product.id_order || product.orderId) {
|
|
1089
1144
|
sendEvaluation("R");
|
|
1090
1145
|
setModalViewError(true);
|
|
1146
|
+
} else {
|
|
1147
|
+
setDataGenericModal((prev) => ({
|
|
1148
|
+
...prev,
|
|
1149
|
+
button2: {
|
|
1150
|
+
name: "Continuar",
|
|
1151
|
+
action: () => evaluationToRetailer("R"),
|
|
1152
|
+
},
|
|
1153
|
+
}));
|
|
1154
|
+
setShowGenericModal(true);
|
|
1091
1155
|
}
|
|
1156
|
+
} else {
|
|
1157
|
+
sendEvaluation("R");
|
|
1158
|
+
setModalViewError(true);
|
|
1092
1159
|
}
|
|
1093
1160
|
}}
|
|
1094
1161
|
/>
|
|
@@ -1239,20 +1306,21 @@ export const ProviderProductEdition = ({
|
|
|
1239
1306
|
/>
|
|
1240
1307
|
</div>
|
|
1241
1308
|
)}
|
|
1242
|
-
<Button
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1309
|
+
{/* <Button
|
|
1310
|
+
buttonType={
|
|
1311
|
+
evaluationComplete(activeTab) &&
|
|
1312
|
+
(productEdit.product.id_order ||
|
|
1313
|
+
productEdit.product.orderId)
|
|
1314
|
+
? "general-green-button"
|
|
1315
|
+
: "general-button-disabled"
|
|
1316
|
+
}
|
|
1317
|
+
label={"Enviar evaluación"}
|
|
1318
|
+
onClick={() => {
|
|
1319
|
+
//setModalSent(true);
|
|
1320
|
+
sendEvaluation();
|
|
1321
|
+
setMessage(`¡Evaluación de ${activeTab} completada!`);
|
|
1322
|
+
}}
|
|
1323
|
+
/> */}
|
|
1256
1324
|
</div>
|
|
1257
1325
|
) : revision ? null : (
|
|
1258
1326
|
<div className="required-inputs-message">
|
|
@@ -1272,20 +1340,20 @@ export const ProviderProductEdition = ({
|
|
|
1272
1340
|
</button>
|
|
1273
1341
|
) : (
|
|
1274
1342
|
<>
|
|
1275
|
-
|
|
1343
|
+
<SliderToolTip
|
|
1276
1344
|
infoIcon={InfoIcon}
|
|
1277
1345
|
slidefront={slidefront}
|
|
1278
1346
|
iconSize={"big-image"}
|
|
1279
1347
|
slidePosition={"top-slide"}
|
|
1280
1348
|
></SliderToolTip>
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1349
|
+
<Button
|
|
1350
|
+
onClick={() => {
|
|
1351
|
+
setShowContentohRequestModal &&
|
|
1352
|
+
setShowContentohRequestModal(true);
|
|
1353
|
+
}}
|
|
1354
|
+
buttonType="general-default-button"
|
|
1355
|
+
label="Enviar a Content-oh!"
|
|
1356
|
+
/>
|
|
1289
1357
|
</>
|
|
1290
1358
|
)}
|
|
1291
1359
|
</div>
|
|
@@ -1367,4 +1435,4 @@ export const ProviderProductEdition = ({
|
|
|
1367
1435
|
)}
|
|
1368
1436
|
</Container>
|
|
1369
1437
|
);
|
|
1370
|
-
};
|
|
1438
|
+
};
|