contentoh-components-library 21.1.74 → 21.1.77

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 (46) hide show
  1. package/dist/components/atoms/AsignationOption/index.js +2 -2
  2. package/dist/components/atoms/ProductPercentCard/Percent.stories.js +1 -1
  3. package/dist/components/atoms/ProductPercentCard/styles.js +1 -1
  4. package/dist/components/atoms/ProgressBar/styles.js +1 -1
  5. package/dist/components/atoms/Status/Status.stories.js +31 -0
  6. package/dist/components/atoms/Status/index.js +23 -0
  7. package/dist/components/atoms/Status/styles.js +20 -0
  8. package/dist/components/molecules/AssignedWork/AssignedWork.stories.js +1 -1
  9. package/dist/components/molecules/AssignedWork/styles.js +1 -1
  10. package/dist/components/molecules/ProductNameHeader/index.js +2 -2
  11. package/dist/components/molecules/StatusAsignationInfo/index.js +3 -3
  12. package/dist/components/organisms/FullProductNameHeader/index.js +1 -1
  13. package/dist/components/organisms/VersionSelector/index.js +16 -8
  14. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +2 -6
  15. package/dist/components/pages/ProviderProductEdition/index.js +433 -433
  16. package/dist/components/pages/RetailerProductEdition/index.js +217 -200
  17. package/dist/global-files/customHooks.js +8 -14
  18. package/dist/global-files/data.js +8 -8
  19. package/dist/index.js +1 -14
  20. package/package.json +1 -1
  21. package/src/components/atoms/AsignationOption/index.js +2 -2
  22. package/src/components/atoms/ProductPercentCard/Percent.stories.js +11 -12
  23. package/src/components/atoms/ProductPercentCard/styles.js +9 -9
  24. package/src/components/atoms/ProgressBar/styles.js +7 -8
  25. package/src/components/atoms/Status/Status.stories.js +14 -0
  26. package/src/components/atoms/Status/index.js +13 -0
  27. package/src/components/atoms/{StatusTag → Status}/styles.js +7 -10
  28. package/src/components/molecules/AssignedWork/AssignedWork.stories.js +8 -8
  29. package/src/components/molecules/AssignedWork/styles.js +9 -10
  30. package/src/components/molecules/ProductNameHeader/index.js +2 -2
  31. package/src/components/molecules/StatusAsignationInfo/index.js +1 -1
  32. package/src/components/organisms/FullProductNameHeader/index.js +2 -2
  33. package/src/components/organisms/VersionSelector/index.js +3 -8
  34. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +2 -3
  35. package/src/components/pages/ProviderProductEdition/index.js +233 -250
  36. package/src/components/pages/RetailerProductEdition/index.js +149 -173
  37. package/src/global-files/customHooks.js +13 -11
  38. package/src/global-files/data.js +8 -8
  39. package/src/index.js +1 -2
  40. package/dist/components/atoms/StatusTag/StatusTag.stories.js +0 -48
  41. package/dist/components/atoms/StatusTag/index.js +0 -58
  42. package/dist/components/atoms/StatusTag/styles.js +0 -20
  43. package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +0 -37
  44. package/dist/components/pages/RegistrationLoginFirstStep/index.js +0 -269
  45. package/dist/components/pages/RegistrationLoginFirstStep/styles.js +0 -20
  46. package/src/components/atoms/StatusTag/index.js +0 -37
@@ -164,14 +164,9 @@ export const ProviderProductEdition = ({
164
164
  : productToEdit
165
165
  );
166
166
  const [icon, setIcon] = useState(null);
167
- const [version, setVersion] = useState(product?.version);
168
- const [comments, setComments] = useState({});
167
+ const [version] = useState(product?.version);
168
+ const [comments] = useState({});
169
169
  const [comment, setComment] = useState("");
170
- const [requiredNull, setRequiredNull] = useState({
171
- "Ficha técnica": 0,
172
- Descripción: 0,
173
- Imágenes: 0,
174
- });
175
170
  const [crossComment, setCrossComment] = useState(false);
176
171
  const [userGroups, setUserGroups] = useState([]);
177
172
  const [assig, setAssig] = useState({});
@@ -180,7 +175,6 @@ export const ProviderProductEdition = ({
180
175
  const [checkAll, setCheckAll] = useState(false);
181
176
  const isRetailer = user?.is_retailer;
182
177
  const [loading, setLoading] = useState(true);
183
- const [statusArray, setStatusArray] = useState([]);
184
178
 
185
179
  const originProp = location?.state?.origin;
186
180
  const [origin, setOrigin] = useState({
@@ -212,6 +206,9 @@ export const ProviderProductEdition = ({
212
206
  const [modalViewTextArea, setModalViewTextArea] = useState(false);
213
207
  const [socketType, setSocketType] = useState(null);
214
208
  const [saving, setSaving] = useState(loading);
209
+ const [retailerStatus, setRetailerStatus] = useState(
210
+ product.statusByRetailer
211
+ );
215
212
  const [showCreateVersion, setShowCreateVersion] = useState(false);
216
213
  const [showVersionSelector, setShowVersionSelector] =
217
214
  closeModals("version-selector");
@@ -240,11 +237,8 @@ export const ProviderProductEdition = ({
240
237
  );
241
238
  }
242
239
 
243
- //setActiveRetailer(product?.retailers[0]);
244
- setImages({
245
- action: "init",
246
- init: services[2],
247
- });
240
+ // setActiveRetailer(product?.retailers[0]);
241
+ setImages({ action: "init", init: services[2] });
248
242
  if (services[2]?.values?.length > 0) setActiveImage(0);
249
243
 
250
244
  getPercentage({ data: [product] }).then((res) => setPercentages(res));
@@ -263,10 +257,11 @@ export const ProviderProductEdition = ({
263
257
  }&end=true`
264
258
  );
265
259
  const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
260
+ const retailerResponse = parsedResponse?.map((srv) => srv.id_retailer);
266
261
  let retailers = product.retailers || product.retailersAvailable;
267
- let active = retailers?.filter((retailer) =>
268
- parsedResponse?.map((srv) => srv.id_retailer).includes(retailer.id)
269
- )[0];
262
+ let active = retailers?.find((retailer) =>
263
+ retailerResponse.includes(retailer.id)
264
+ );
270
265
  !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
271
266
  setServicesData(parsedResponse);
272
267
  }
@@ -287,15 +282,15 @@ export const ProviderProductEdition = ({
287
282
  if (revision && currentService === "AP") return true;
288
283
  } else {
289
284
  const { product } = productEdit;
290
- if (
291
- orgn === "Contentoh" ||
292
- (["RECEIVED", "IN_PROGRESS"].includes(currentService) &&
293
- orgn === "RequestWithoutContentoh") ||
294
- (currentService === "AA" && orgn === "RequestWithContentoh") ||
295
- (currentService === "RC" &&
296
- orgn === "RequestWithoutContentoh" &&
297
- (!product.id_order || !product.orderId))
298
- )
285
+ const isRequestWithoutContentoh =
286
+ orgn === "RequestWithoutContentoh" &&
287
+ (["R", "CA"].includes(currentService) ||
288
+ (currentService === "RCA" &&
289
+ (!product.id_order || !product.orderId)));
290
+ const isRequestWithContentoh =
291
+ orgn === "RequestWithContentoh" && currentService === "AA";
292
+ const isContentoh = orgn === "Contentoh" && currentService === "AA";
293
+ if (isContentoh || isRequestWithoutContentoh || isRequestWithContentoh)
299
294
  return true;
300
295
  }
301
296
  }
@@ -312,31 +307,12 @@ export const ProviderProductEdition = ({
312
307
  setInCart(arr.some((e) => e.articleId === product.id_article));
313
308
  };
314
309
 
315
- useEffect(async () => {
316
- setLoading(true);
310
+ useEffect(() => {
317
311
  sessionStorage.setItem("user", JSON.stringify(user));
318
312
  loadData();
319
313
  getCart();
320
- setUserGroups(await fetchUsers(token));
321
- let arr = [];
322
- switch (user.id_role) {
323
- case 7:
324
- case 8:
325
- arr = ["IN_PROGRESS", "RF", "RA"];
326
- break;
327
- case 4:
328
- case 5:
329
- arr = ["RF", "AF", "AA", "AP", "AC"];
330
- break;
331
- case 6:
332
- arr = ["RP", "RC", "AF"];
333
- break;
334
- default:
335
- arr = [];
336
- break;
337
- }
338
- setStatusArray(arr);
339
- }, [product, version]);
314
+ fetchUsers(token).then((res) => setUserGroups(res));
315
+ }, [product]);
340
316
 
341
317
  const loadAssignations = (currentProduct) => {
342
318
  setAssig(product?.asignations);
@@ -350,9 +326,9 @@ export const ProviderProductEdition = ({
350
326
  const productTemp = product;
351
327
  const retailers = productTemp?.retailersAvailable || productTemp?.retailers;
352
328
  retailers?.forEach((retailer) => {
353
- retailer["percentage"] = percentages?.filter(
329
+ retailer["percentage"] = percentages?.find(
354
330
  (percent) => retailer?.id === percent?.id_retailer
355
- )[0]?.percentage;
331
+ )?.percentage;
356
332
  });
357
333
 
358
334
  setProduct(productTemp);
@@ -428,7 +404,7 @@ export const ProviderProductEdition = ({
428
404
  };
429
405
  if (product?.orderId) dataObject["orderId"] = product?.orderId;
430
406
  try {
431
- await axios.put(
407
+ const res = await axios.put(
432
408
  `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
433
409
  dataObject,
434
410
  {
@@ -437,8 +413,10 @@ export const ProviderProductEdition = ({
437
413
  },
438
414
  }
439
415
  );
440
- setMessage("Descripciones guardadas con éxito");
441
- loadData();
416
+ if (res.data.statusCode === 200) {
417
+ setMessage("Descripciones guardadas con éxito");
418
+ await loadData();
419
+ }
442
420
  } catch (error) {
443
421
  console.log(error);
444
422
  }
@@ -461,8 +439,10 @@ export const ProviderProductEdition = ({
461
439
  },
462
440
  }
463
441
  );
464
- setMessage("Fichas técnicas guardadas");
465
- loadData();
442
+ if (res.data.statusCode === 200) {
443
+ setMessage("Fichas técnicas guardadas");
444
+ await loadData();
445
+ }
466
446
  } catch (error) {
467
447
  console.log(error);
468
448
  }
@@ -560,7 +540,7 @@ export const ProviderProductEdition = ({
560
540
  return e;
561
541
  });
562
542
  try {
563
- await axios.put(
543
+ const res = await axios.put(
564
544
  `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
565
545
  dataImages,
566
546
  {
@@ -569,9 +549,11 @@ export const ProviderProductEdition = ({
569
549
  },
570
550
  }
571
551
  );
572
- setMessage("Imágenes guardadas con éxito");
573
- sessionStorage.removeItem("imagesList");
574
- loadData();
552
+ if (res.data.statusCode === 200) {
553
+ setMessage("Imágenes guardadas con éxito");
554
+ sessionStorage.removeItem("imagesList");
555
+ await loadData();
556
+ }
575
557
  } catch (error) {
576
558
  console.log(error);
577
559
  }
@@ -673,12 +655,12 @@ export const ProviderProductEdition = ({
673
655
  },
674
656
  ],
675
657
  concept: concept,
676
- [`${assignationType}Id`]: assignationId,
658
+ userId: assignationId,
677
659
  };
678
- axios({
660
+ await axios({
679
661
  method: "post",
680
662
  url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
681
- data: data,
663
+ data,
682
664
  headers: {
683
665
  Authorization: token,
684
666
  },
@@ -696,7 +678,7 @@ export const ProviderProductEdition = ({
696
678
  serv = serv.filter((f) => f.id_retailer === activeRetailer.id);
697
679
  }
698
680
  const statusArray =
699
- user.is_retailer === 1 ? ["AC", "RC"] : ["AP", "RP", "AC"];
681
+ user.is_retailer === 1 ? ["ACA", "RCA"] : ["AP", "RP", "ACA"];
700
682
  return (
701
683
  serv.length > 0 && serv.every((item) => statusArray.includes(item.status))
702
684
  );
@@ -799,7 +781,7 @@ export const ProviderProductEdition = ({
799
781
  const { datasheet_status, description_status, images_status } = product;
800
782
  const completionStates =
801
783
  user.is_retailer === 1
802
- ? ["AC", "Evaluated", "NS"]
784
+ ? ["ACA", "Evaluated", "NS"]
803
785
  : ["AP", "Evaluated", "NS"];
804
786
  const dsEvaluated = completionStates.includes(datasheet_status);
805
787
  const descsEvaluated = completionStates.includes(description_status);
@@ -812,54 +794,69 @@ export const ProviderProductEdition = ({
812
794
 
813
795
  const sendEvaluation = async (result) => {
814
796
  setLoading(true);
815
- let data = {};
797
+ const concept = getConcept(activeTab);
798
+ const productTemp = product;
799
+ const articleId = productTemp.id_article;
800
+ const orderId = productTemp.id_order ?? productTemp.orderId;
801
+ const sectionStatusKey = `${getConcept(activeTab)}_status`;
802
+ const evalStatus = product[sectionStatusKey] || product?.version_status;
803
+ let data = { articleId, orderId, concept, evalStatus };
816
804
  const retailerId = activeRetailer?.id;
817
- if (result) {
818
- data = {
819
- articleId: product.id_article,
820
- orderId: product.id_order ?? product.orderId,
821
- concept: getConcept(activeTab),
822
- result: result,
823
- retailerId,
824
- };
825
- await axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
826
- headers: {
827
- Authorization: token,
828
- },
829
- });
830
- } else {
831
- const productTemp = product;
832
- const concept = getConcept(activeTab);
833
- productTemp[`${concept}_status`] = "Evaluated";
834
- data = {
835
- articleId: product.id_article,
836
- orderId: product.id_order ?? product.orderId,
837
- concept,
838
- };
839
- axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
840
- headers: {
841
- Authorization: token,
842
- },
843
- });
844
- setProduct(productTemp);
845
- sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
846
- setProductEdit({
847
- ArticleId: productTemp.id_article,
848
- idCategory: productTemp.article.id_category,
849
- product: productTemp,
850
- });
851
- sessionStorage.setItem(
852
- "productEdit",
853
- JSON.stringify({
854
- ArticleId: productTemp.id_article,
855
- idCategory: productTemp.article.id_category,
856
- product: productTemp,
857
- })
858
- );
859
- setOrigin((prev) => ({ ...prev, [concept]: "Evaluated" }));
805
+ let res;
806
+ try {
807
+ if (result) {
808
+ data.result = result;
809
+ data.retailerId = retailerId;
810
+ res = await axios.put(
811
+ `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
812
+ data,
813
+ {
814
+ headers: {
815
+ Authorization: token,
816
+ },
817
+ }
818
+ );
819
+ const newStatuses = JSON.parse(res.data.body);
820
+ const orderStatus = newStatuses.newOrderStatus;
821
+ const serviceStatus =
822
+ newStatuses.newServiceStatus[articleId][
823
+ `${getConcept(activeTab)}Status`
824
+ ];
825
+
826
+ const newProductEdit = productEdit;
827
+ newProductEdit.product[sectionStatusKey] = serviceStatus;
828
+ setProductEdit(newProductEdit);
829
+ showSurvey &&
830
+ showSurvey(!user.is_retailer && orderStatus[orderId] === "AP");
831
+ } else {
832
+ res = await axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
833
+ headers: {
834
+ Authorization: token,
835
+ },
836
+ });
837
+ }
838
+ if (res.data.statusCode === 200) {
839
+ const { newArticleStatus, newServiceStatus, newStatus } = JSON.parse(
840
+ res.data.body
841
+ );
842
+ if (newArticleStatus) productTemp.status = newArticleStatus[articleId];
843
+ const retailerStatusCopy = { ...retailerStatus };
844
+ retailerStatusCopy[activeRetailer.id][concept] = newStatus;
845
+ setRetailerStatus(retailerStatusCopy);
846
+ productTemp.statusByRetailer = retailerStatusCopy;
847
+ let status;
848
+ if (newServiceStatus) {
849
+ status = newServiceStatus[articleId][`${concept}Status`];
850
+ productTemp[`${concept}_status`] = status;
851
+ }
852
+ setProduct(productTemp);
853
+ sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
854
+ setOrigin((prev) => ({ ...prev, [concept]: status }));
855
+ }
856
+ } catch (err) {
857
+ console.log(err);
860
858
  }
861
859
  loadData();
862
- showSurvey && showSurvey(confirmStatusComplete());
863
860
  };
864
861
 
865
862
  const validateAll = async (result) => {
@@ -868,14 +865,18 @@ export const ProviderProductEdition = ({
868
865
  const evaluationArray = [];
869
866
  const sendAll = [];
870
867
  const conceptArray = ["description", "datasheet", "images"];
871
-
868
+ const dataGeneral = {
869
+ articleId: product.id_article,
870
+ orderId: product.id_order ?? product.orderId,
871
+ result,
872
+ };
872
873
  servicesData?.forEach((ret) => {
873
- let data = {
874
- articleId: product.id_article,
875
- orderId: product.id_order ?? product.orderId,
876
- concept: ret.service,
877
- result: result,
878
- retailerId: ret.id_retailer,
874
+ const { service, id_retailer } = ret;
875
+ const data = {
876
+ ...dataGeneral,
877
+ concept: service,
878
+ retailerId: id_retailer,
879
+ evalStatus: retailerStatus[id_retailer][service],
879
880
  };
880
881
  evaluationArray.push(
881
882
  axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
@@ -884,16 +885,6 @@ export const ProviderProductEdition = ({
884
885
  },
885
886
  })
886
887
  );
887
- });
888
-
889
- await Promise.all(evaluationArray);
890
-
891
- conceptArray?.forEach((concept) => {
892
- let data = {
893
- articleId: product.id_article,
894
- orderId: product.id_order ?? product.orderId,
895
- concept,
896
- };
897
888
  sendAll.push(
898
889
  axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
899
890
  headers: {
@@ -903,15 +894,27 @@ export const ProviderProductEdition = ({
903
894
  );
904
895
  });
905
896
 
906
- await Promise.all(sendAll);
897
+ await Promise.all([...evaluationArray, ...sendAll]);
898
+
907
899
  const productTemp = product;
908
- productTemp.article_status = `${result}C`;
900
+ productTemp.article_status = `${result}CA`;
909
901
  productTemp.datasheet_status =
910
- productTemp.datasheet_status === "NA" ? "NA" : `${result}C`;
902
+ productTemp.datasheet_status === "NA" ? "NA" : `${result}CA`;
911
903
  productTemp.description_status =
912
- productTemp.description_status === "NA" ? "NA" : `${result}C`;
904
+ productTemp.description_status === "NA" ? "NA" : `${result}CA`;
913
905
  productTemp.images_status =
914
- productTemp.images_status === "NA" ? "NA" : `${result}C`;
906
+ productTemp.images_status === "NA" ? "NA" : `${result}CA`;
907
+
908
+ const retailerStatusCopy = { ...retailerStatus };
909
+ Object.keys(retailerStatusCopy).forEach((key) => {
910
+ conceptArray.forEach((concept) => {
911
+ if (retailerStatusCopy[key][concept]) {
912
+ retailerStatusCopy[key][concept] = `${result}CA`;
913
+ }
914
+ });
915
+ });
916
+ setRetailerStatus(retailerStatusCopy);
917
+ productTemp.statusByRetailer = retailerStatusCopy;
915
918
  setProduct(productTemp);
916
919
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
917
920
  setProductEdit({
@@ -928,7 +931,7 @@ export const ProviderProductEdition = ({
928
931
  })
929
932
  );
930
933
 
931
- loadData();
934
+ await loadData();
932
935
  } catch (error) {
933
936
  console.log(error);
934
937
  }
@@ -949,7 +952,7 @@ export const ProviderProductEdition = ({
949
952
  },
950
953
  });
951
954
  const prod = productEdit;
952
- const statusComplete = user.is_retailer ? `${result}C` : `${result}P`;
955
+ const statusComplete = user.is_retailer ? `${result}CA` : `${result}P`;
953
956
  prod.product.datasheet_status = statusComplete;
954
957
  prod.product.description_status = statusComplete;
955
958
  prod.product.images_status = statusComplete;
@@ -958,24 +961,22 @@ export const ProviderProductEdition = ({
958
961
  sessionStorage.setItem("productEdit", JSON.stringify(prod));
959
962
  setProduct(prod);
960
963
  setShowGenericModal && setShowGenericModal(false);
961
- loadData();
964
+ await loadData();
962
965
  };
963
966
 
964
967
  const getSectionStatus = () => {
965
968
  const concept = getConcept(activeTab);
966
- return ["AA", "AP", "RECEIVED", "IN_PROGRESS", "RC"].includes(
969
+ return ["AA", "AP", "R", "CA", "RCA"].includes(
967
970
  productEdit.product[`${concept}_status`]
968
971
  );
969
972
  };
970
973
 
971
974
  const enableActions = (versionStatus) => {
972
975
  try {
973
- const userIsRetailer = user.is_retailer;
974
-
975
- if (userIsRetailer) return false;
976
+ if (user.is_retailer) return false;
976
977
 
977
978
  if (versionStatus) {
978
- return ["AP", "AC", "RC", null].includes(versionStatus);
979
+ return ["AP", "ACA", "RCA", null].includes(versionStatus);
979
980
  }
980
981
  return true;
981
982
  } catch (err) {
@@ -1065,23 +1066,21 @@ export const ProviderProductEdition = ({
1065
1066
  },
1066
1067
  }));
1067
1068
  setShowGenericModal(true);
1068
- } else {
1069
- if (user.is_retailer) {
1070
- if (product.id_order || product.orderId) {
1071
- validateAll("A");
1072
- } else {
1073
- setDataGenericModal((prev) => ({
1074
- ...prev,
1075
- button2: {
1076
- name: "Continuar",
1077
- action: () => evaluationToRetailer("A"),
1078
- },
1079
- }));
1080
- setShowGenericModal(true);
1081
- }
1082
- } else {
1069
+ } else if (user.is_retailer) {
1070
+ if (product.id_order || product.orderId) {
1083
1071
  validateAll("A");
1072
+ } else {
1073
+ setDataGenericModal((prev) => ({
1074
+ ...prev,
1075
+ button2: {
1076
+ name: "Continuar",
1077
+ action: () => evaluationToRetailer("A"),
1078
+ },
1079
+ }));
1080
+ setShowGenericModal(true);
1084
1081
  }
1082
+ } else {
1083
+ validateAll("A");
1085
1084
  }
1086
1085
  }}
1087
1086
  rejectAll={() => {
@@ -1091,25 +1090,23 @@ export const ProviderProductEdition = ({
1091
1090
  (!product.id_order || !product.orderId)
1092
1091
  ) {
1093
1092
  return;
1094
- } else {
1095
- if (user.is_retailer) {
1096
- if (product.id_order || product.orderId) {
1097
- validateAll("R");
1098
- setModalViewError(true);
1099
- } else {
1100
- setDataGenericModal((prev) => ({
1101
- ...prev,
1102
- button2: {
1103
- name: "Continuar",
1104
- action: () => evaluationToRetailer("R"),
1105
- },
1106
- }));
1107
- setShowGenericModal(true);
1108
- }
1109
- } else {
1093
+ } else if (user.is_retailer) {
1094
+ if (product.id_order || product.orderId) {
1110
1095
  validateAll("R");
1111
1096
  setModalViewError(true);
1097
+ } else {
1098
+ setDataGenericModal((prev) => ({
1099
+ ...prev,
1100
+ button2: {
1101
+ name: "Continuar",
1102
+ action: () => evaluationToRetailer("R"),
1103
+ },
1104
+ }));
1105
+ setShowGenericModal(true);
1112
1106
  }
1107
+ } else {
1108
+ validateAll("R");
1109
+ setModalViewError(true);
1113
1110
  }
1114
1111
  }}
1115
1112
  approve={() => {
@@ -1126,23 +1123,21 @@ export const ProviderProductEdition = ({
1126
1123
  },
1127
1124
  }));
1128
1125
  setShowGenericModal(true);
1129
- } else {
1130
- if (user.is_retailer) {
1131
- if (product.id_order || product.orderId) {
1132
- sendEvaluation("A");
1133
- } else {
1134
- setDataGenericModal((prev) => ({
1135
- ...prev,
1136
- button2: {
1137
- name: "Continuar",
1138
- action: () => evaluationToRetailer("A"),
1139
- },
1140
- }));
1141
- setShowGenericModal(true);
1142
- }
1143
- } else {
1126
+ } else if (user.is_retailer) {
1127
+ if (product.id_order || product.orderId) {
1144
1128
  sendEvaluation("A");
1129
+ } else {
1130
+ setDataGenericModal((prev) => ({
1131
+ ...prev,
1132
+ button2: {
1133
+ name: "Continuar",
1134
+ action: () => evaluationToRetailer("A"),
1135
+ },
1136
+ }));
1137
+ setShowGenericModal(true);
1145
1138
  }
1139
+ } else {
1140
+ sendEvaluation("A");
1146
1141
  }
1147
1142
  }}
1148
1143
  reject={() => {
@@ -1152,33 +1147,33 @@ export const ProviderProductEdition = ({
1152
1147
  (!product.id_order || !product.orderId)
1153
1148
  ) {
1154
1149
  return;
1155
- } else {
1156
- if (user.is_retailer) {
1157
- if (product.id_order || product.orderId) {
1158
- sendEvaluation("R");
1159
- setModalViewError(true);
1160
- } else {
1161
- setDataGenericModal((prev) => ({
1162
- ...prev,
1163
- button2: {
1164
- name: "Continuar",
1165
- action: () => evaluationToRetailer("R"),
1166
- },
1167
- }));
1168
- setShowGenericModal(true);
1169
- }
1170
- } else {
1150
+ } else if (user.is_retailer) {
1151
+ if (product.id_order || product.orderId) {
1171
1152
  sendEvaluation("R");
1172
1153
  setModalViewError(true);
1154
+ } else {
1155
+ setDataGenericModal((prev) => ({
1156
+ ...prev,
1157
+ button2: {
1158
+ name: "Continuar",
1159
+ action: () => evaluationToRetailer("R"),
1160
+ },
1161
+ }));
1162
+ setShowGenericModal(true);
1173
1163
  }
1164
+ } else {
1165
+ sendEvaluation("R");
1166
+ setModalViewError(true);
1174
1167
  }
1175
1168
  }}
1176
1169
  />
1177
1170
  <FullTabsMenu
1178
1171
  tabsSections={tabsSections}
1179
1172
  status={
1180
- product[`${getConcept(activeTab)}_status`] ||
1181
- product?.version_status
1173
+ activeRetailer.id && retailerStatus
1174
+ ? retailerStatus[activeRetailer?.id][getConcept(activeTab)] ||
1175
+ "NS"
1176
+ : "-"
1182
1177
  }
1183
1178
  activeTab={activeTab}
1184
1179
  setActiveTab={setActiveTab}
@@ -1323,56 +1318,44 @@ export const ProviderProductEdition = ({
1323
1318
  />
1324
1319
  </div>
1325
1320
  )}
1326
- <Button
1327
- buttonType={
1328
- evaluationComplete(activeTab) &&
1329
- (productEdit.product.id_order || productEdit.product.orderId)
1330
- ? "general-green-button"
1331
- : "general-button-disabled"
1332
- }
1333
- label={"Enviar evaluación"}
1334
- onClick={() => {
1335
- //setModalSent(true);
1336
- sendEvaluation();
1337
- setMessage(`¡Evaluación de ${activeTab} completada!`);
1338
- }}
1339
- />
1340
1321
  </div>
1341
- ) : revision ? null : (
1342
- <div className="required-inputs-message">
1343
- <div>
1344
- <p>
1345
- Los atributos son requeridos por las plataformas de las
1346
- cadenas, es muy importante completar los campos requeridos ya
1347
- que pueden rechazar el producto por falta de información.
1348
- </p>
1322
+ ) : (
1323
+ !revision && (
1324
+ <div className="required-inputs-message">
1325
+ <div>
1326
+ <p>
1327
+ Los atributos son requeridos por las plataformas de las
1328
+ cadenas, es muy importante completar los campos requeridos
1329
+ ya que pueden rechazar el producto por falta de información.
1330
+ </p>
1331
+ </div>
1332
+ {inCart ? (
1333
+ <button type="button">
1334
+ <Link to="/checkout">
1335
+ <p>Articulo en carrito</p>
1336
+ <p>Ir a checkout</p>
1337
+ </Link>
1338
+ </button>
1339
+ ) : (
1340
+ <>
1341
+ <SliderToolTip
1342
+ infoIcon={InfoIcon}
1343
+ slidefront={slidefront}
1344
+ iconSize={"big-image"}
1345
+ slidePosition={"top-slide"}
1346
+ />
1347
+ <Button
1348
+ onClick={() => {
1349
+ setShowContentohRequestModal &&
1350
+ setShowContentohRequestModal(true);
1351
+ }}
1352
+ buttonType="general-default-button"
1353
+ label="Enviar a Content-oh!"
1354
+ />
1355
+ </>
1356
+ )}
1349
1357
  </div>
1350
- {inCart ? (
1351
- <button type="button">
1352
- <Link to="/checkout">
1353
- <p>Articulo en carrito</p>
1354
- <p>Ir a checkout</p>
1355
- </Link>
1356
- </button>
1357
- ) : (
1358
- <>
1359
- <SliderToolTip
1360
- infoIcon={InfoIcon}
1361
- slidefront={slidefront}
1362
- iconSize={"big-image"}
1363
- slidePosition={"top-slide"}
1364
- ></SliderToolTip>
1365
- <Button
1366
- onClick={() => {
1367
- setShowContentohRequestModal &&
1368
- setShowContentohRequestModal(true);
1369
- }}
1370
- buttonType="general-default-button"
1371
- label="Enviar a Content-oh!"
1372
- />
1373
- </>
1374
- )}
1375
- </div>
1358
+ )
1376
1359
  )}
1377
1360
  </div>
1378
1361
  </div>