contentoh-components-library 21.1.76 → 21.1.79

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 (48) 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/StatusTag/StatusTag.stories.js +48 -0
  6. package/dist/components/atoms/StatusTag/index.js +58 -0
  7. package/dist/components/atoms/StatusTag/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 +13 -17
  14. package/dist/components/organisms/VersionSelector/styles.js +1 -1
  15. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +6 -2
  16. package/dist/components/pages/ProviderProductEdition/index.js +433 -433
  17. package/dist/components/pages/RegistrationLoginFirstStep/RegistrationLoginFirstStep.stories.js +37 -0
  18. package/dist/components/pages/RegistrationLoginFirstStep/index.js +269 -0
  19. package/dist/components/pages/RegistrationLoginFirstStep/styles.js +20 -0
  20. package/dist/components/pages/RetailerProductEdition/index.js +206 -222
  21. package/dist/global-files/customHooks.js +19 -11
  22. package/dist/global-files/data.js +8 -8
  23. package/dist/index.js +14 -1
  24. package/package.json +1 -1
  25. package/src/components/atoms/AsignationOption/index.js +2 -2
  26. package/src/components/atoms/ProductPercentCard/Percent.stories.js +12 -11
  27. package/src/components/atoms/ProductPercentCard/styles.js +9 -9
  28. package/src/components/atoms/ProgressBar/styles.js +8 -7
  29. package/src/components/atoms/StatusTag/index.js +37 -0
  30. package/src/components/atoms/{Status → StatusTag}/styles.js +10 -7
  31. package/src/components/molecules/AssignedWork/AssignedWork.stories.js +8 -8
  32. package/src/components/molecules/AssignedWork/styles.js +10 -9
  33. package/src/components/molecules/ProductNameHeader/index.js +2 -2
  34. package/src/components/molecules/StatusAsignationInfo/index.js +1 -1
  35. package/src/components/organisms/FullProductNameHeader/index.js +2 -2
  36. package/src/components/organisms/VersionSelector/index.js +10 -3
  37. package/src/components/organisms/VersionSelector/styles.js +1 -0
  38. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +3 -2
  39. package/src/components/pages/ProviderProductEdition/index.js +250 -233
  40. package/src/components/pages/RetailerProductEdition/index.js +176 -151
  41. package/src/global-files/customHooks.js +14 -14
  42. package/src/global-files/data.js +8 -8
  43. package/src/index.js +2 -1
  44. package/dist/components/atoms/Status/Status.stories.js +0 -31
  45. package/dist/components/atoms/Status/index.js +0 -23
  46. package/dist/components/atoms/Status/styles.js +0 -20
  47. package/src/components/atoms/Status/Status.stories.js +0 -14
  48. package/src/components/atoms/Status/index.js +0 -9
@@ -164,9 +164,14 @@ export const ProviderProductEdition = ({
164
164
  : productToEdit
165
165
  );
166
166
  const [icon, setIcon] = useState(null);
167
- const [version] = useState(product?.version);
168
- const [comments] = useState({});
167
+ const [version, setVersion] = useState(product?.version);
168
+ const [comments, setComments] = 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
+ });
170
175
  const [crossComment, setCrossComment] = useState(false);
171
176
  const [userGroups, setUserGroups] = useState([]);
172
177
  const [assig, setAssig] = useState({});
@@ -175,6 +180,7 @@ export const ProviderProductEdition = ({
175
180
  const [checkAll, setCheckAll] = useState(false);
176
181
  const isRetailer = user?.is_retailer;
177
182
  const [loading, setLoading] = useState(true);
183
+ const [statusArray, setStatusArray] = useState([]);
178
184
 
179
185
  const originProp = location?.state?.origin;
180
186
  const [origin, setOrigin] = useState({
@@ -206,9 +212,6 @@ export const ProviderProductEdition = ({
206
212
  const [modalViewTextArea, setModalViewTextArea] = useState(false);
207
213
  const [socketType, setSocketType] = useState(null);
208
214
  const [saving, setSaving] = useState(loading);
209
- const [retailerStatus, setRetailerStatus] = useState(
210
- product.statusByRetailer
211
- );
212
215
  const [showCreateVersion, setShowCreateVersion] = useState(false);
213
216
  const [showVersionSelector, setShowVersionSelector] =
214
217
  closeModals("version-selector");
@@ -237,8 +240,11 @@ export const ProviderProductEdition = ({
237
240
  );
238
241
  }
239
242
 
240
- // setActiveRetailer(product?.retailers[0]);
241
- setImages({ action: "init", init: services[2] });
243
+ //setActiveRetailer(product?.retailers[0]);
244
+ setImages({
245
+ action: "init",
246
+ init: services[2],
247
+ });
242
248
  if (services[2]?.values?.length > 0) setActiveImage(0);
243
249
 
244
250
  getPercentage({ data: [product] }).then((res) => setPercentages(res));
@@ -257,11 +263,10 @@ export const ProviderProductEdition = ({
257
263
  }&end=true`
258
264
  );
259
265
  const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
260
- const retailerResponse = parsedResponse?.map((srv) => srv.id_retailer);
261
266
  let retailers = product.retailers || product.retailersAvailable;
262
- let active = retailers?.find((retailer) =>
263
- retailerResponse.includes(retailer.id)
264
- );
267
+ let active = retailers?.filter((retailer) =>
268
+ parsedResponse?.map((srv) => srv.id_retailer).includes(retailer.id)
269
+ )[0];
265
270
  !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
266
271
  setServicesData(parsedResponse);
267
272
  }
@@ -282,15 +287,15 @@ export const ProviderProductEdition = ({
282
287
  if (revision && currentService === "AP") return true;
283
288
  } else {
284
289
  const { product } = productEdit;
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)
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
+ )
294
299
  return true;
295
300
  }
296
301
  }
@@ -307,12 +312,31 @@ export const ProviderProductEdition = ({
307
312
  setInCart(arr.some((e) => e.articleId === product.id_article));
308
313
  };
309
314
 
310
- useEffect(() => {
315
+ useEffect(async () => {
316
+ setLoading(true);
311
317
  sessionStorage.setItem("user", JSON.stringify(user));
312
318
  loadData();
313
319
  getCart();
314
- fetchUsers(token).then((res) => setUserGroups(res));
315
- }, [product]);
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]);
316
340
 
317
341
  const loadAssignations = (currentProduct) => {
318
342
  setAssig(product?.asignations);
@@ -326,9 +350,9 @@ export const ProviderProductEdition = ({
326
350
  const productTemp = product;
327
351
  const retailers = productTemp?.retailersAvailable || productTemp?.retailers;
328
352
  retailers?.forEach((retailer) => {
329
- retailer["percentage"] = percentages?.find(
353
+ retailer["percentage"] = percentages?.filter(
330
354
  (percent) => retailer?.id === percent?.id_retailer
331
- )?.percentage;
355
+ )[0]?.percentage;
332
356
  });
333
357
 
334
358
  setProduct(productTemp);
@@ -404,7 +428,7 @@ export const ProviderProductEdition = ({
404
428
  };
405
429
  if (product?.orderId) dataObject["orderId"] = product?.orderId;
406
430
  try {
407
- const res = await axios.put(
431
+ await axios.put(
408
432
  `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?description=true&version=${version}`,
409
433
  dataObject,
410
434
  {
@@ -413,10 +437,8 @@ export const ProviderProductEdition = ({
413
437
  },
414
438
  }
415
439
  );
416
- if (res.data.statusCode === 200) {
417
- setMessage("Descripciones guardadas con éxito");
418
- await loadData();
419
- }
440
+ setMessage("Descripciones guardadas con éxito");
441
+ loadData();
420
442
  } catch (error) {
421
443
  console.log(error);
422
444
  }
@@ -439,10 +461,8 @@ export const ProviderProductEdition = ({
439
461
  },
440
462
  }
441
463
  );
442
- if (res.data.statusCode === 200) {
443
- setMessage("Fichas técnicas guardadas");
444
- await loadData();
445
- }
464
+ setMessage("Fichas técnicas guardadas");
465
+ loadData();
446
466
  } catch (error) {
447
467
  console.log(error);
448
468
  }
@@ -540,7 +560,7 @@ export const ProviderProductEdition = ({
540
560
  return e;
541
561
  });
542
562
  try {
543
- const res = await axios.put(
563
+ await axios.put(
544
564
  `${process.env.REACT_APP_ARTICLE_DATA_ENDPOINT}?image=true&version=${version}`,
545
565
  dataImages,
546
566
  {
@@ -549,11 +569,9 @@ export const ProviderProductEdition = ({
549
569
  },
550
570
  }
551
571
  );
552
- if (res.data.statusCode === 200) {
553
- setMessage("Imágenes guardadas con éxito");
554
- sessionStorage.removeItem("imagesList");
555
- await loadData();
556
- }
572
+ setMessage("Imágenes guardadas con éxito");
573
+ sessionStorage.removeItem("imagesList");
574
+ loadData();
557
575
  } catch (error) {
558
576
  console.log(error);
559
577
  }
@@ -655,12 +673,12 @@ export const ProviderProductEdition = ({
655
673
  },
656
674
  ],
657
675
  concept: concept,
658
- userId: assignationId,
676
+ [`${assignationType}Id`]: assignationId,
659
677
  };
660
- await axios({
678
+ axios({
661
679
  method: "post",
662
680
  url: process.env.REACT_APP_ASSIGNATIONS_ENDPOINT,
663
- data,
681
+ data: data,
664
682
  headers: {
665
683
  Authorization: token,
666
684
  },
@@ -678,7 +696,7 @@ export const ProviderProductEdition = ({
678
696
  serv = serv.filter((f) => f.id_retailer === activeRetailer.id);
679
697
  }
680
698
  const statusArray =
681
- user.is_retailer === 1 ? ["ACA", "RCA"] : ["AP", "RP", "ACA"];
699
+ user.is_retailer === 1 ? ["AC", "RC"] : ["AP", "RP", "AC"];
682
700
  return (
683
701
  serv.length > 0 && serv.every((item) => statusArray.includes(item.status))
684
702
  );
@@ -781,7 +799,7 @@ export const ProviderProductEdition = ({
781
799
  const { datasheet_status, description_status, images_status } = product;
782
800
  const completionStates =
783
801
  user.is_retailer === 1
784
- ? ["ACA", "Evaluated", "NS"]
802
+ ? ["AC", "Evaluated", "NS"]
785
803
  : ["AP", "Evaluated", "NS"];
786
804
  const dsEvaluated = completionStates.includes(datasheet_status);
787
805
  const descsEvaluated = completionStates.includes(description_status);
@@ -794,69 +812,54 @@ export const ProviderProductEdition = ({
794
812
 
795
813
  const sendEvaluation = async (result) => {
796
814
  setLoading(true);
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 };
815
+ let data = {};
804
816
  const retailerId = activeRetailer?.id;
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);
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" }));
858
860
  }
859
861
  loadData();
862
+ showSurvey && showSurvey(confirmStatusComplete());
860
863
  };
861
864
 
862
865
  const validateAll = async (result) => {
@@ -865,18 +868,14 @@ export const ProviderProductEdition = ({
865
868
  const evaluationArray = [];
866
869
  const sendAll = [];
867
870
  const conceptArray = ["description", "datasheet", "images"];
868
- const dataGeneral = {
869
- articleId: product.id_article,
870
- orderId: product.id_order ?? product.orderId,
871
- result,
872
- };
871
+
873
872
  servicesData?.forEach((ret) => {
874
- const { service, id_retailer } = ret;
875
- const data = {
876
- ...dataGeneral,
877
- concept: service,
878
- retailerId: id_retailer,
879
- evalStatus: retailerStatus[id_retailer][service],
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,
880
879
  };
881
880
  evaluationArray.push(
882
881
  axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, data, {
@@ -885,6 +884,16 @@ export const ProviderProductEdition = ({
885
884
  },
886
885
  })
887
886
  );
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
+ };
888
897
  sendAll.push(
889
898
  axios.put(`${process.env.REACT_APP_SEND_EVAL}`, data, {
890
899
  headers: {
@@ -894,27 +903,15 @@ export const ProviderProductEdition = ({
894
903
  );
895
904
  });
896
905
 
897
- await Promise.all([...evaluationArray, ...sendAll]);
898
-
906
+ await Promise.all(sendAll);
899
907
  const productTemp = product;
900
- productTemp.article_status = `${result}CA`;
908
+ productTemp.article_status = `${result}C`;
901
909
  productTemp.datasheet_status =
902
- productTemp.datasheet_status === "NA" ? "NA" : `${result}CA`;
910
+ productTemp.datasheet_status === "NA" ? "NA" : `${result}C`;
903
911
  productTemp.description_status =
904
- productTemp.description_status === "NA" ? "NA" : `${result}CA`;
912
+ productTemp.description_status === "NA" ? "NA" : `${result}C`;
905
913
  productTemp.images_status =
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;
914
+ productTemp.images_status === "NA" ? "NA" : `${result}C`;
918
915
  setProduct(productTemp);
919
916
  sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
920
917
  setProductEdit({
@@ -931,7 +928,7 @@ export const ProviderProductEdition = ({
931
928
  })
932
929
  );
933
930
 
934
- await loadData();
931
+ loadData();
935
932
  } catch (error) {
936
933
  console.log(error);
937
934
  }
@@ -952,7 +949,7 @@ export const ProviderProductEdition = ({
952
949
  },
953
950
  });
954
951
  const prod = productEdit;
955
- const statusComplete = user.is_retailer ? `${result}CA` : `${result}P`;
952
+ const statusComplete = user.is_retailer ? `${result}C` : `${result}P`;
956
953
  prod.product.datasheet_status = statusComplete;
957
954
  prod.product.description_status = statusComplete;
958
955
  prod.product.images_status = statusComplete;
@@ -961,22 +958,24 @@ export const ProviderProductEdition = ({
961
958
  sessionStorage.setItem("productEdit", JSON.stringify(prod));
962
959
  setProduct(prod);
963
960
  setShowGenericModal && setShowGenericModal(false);
964
- await loadData();
961
+ loadData();
965
962
  };
966
963
 
967
964
  const getSectionStatus = () => {
968
965
  const concept = getConcept(activeTab);
969
- return ["AA", "AP", "R", "CA", "RCA"].includes(
966
+ return ["AA", "AP", "RECEIVED", "IN_PROGRESS", "RC"].includes(
970
967
  productEdit.product[`${concept}_status`]
971
968
  );
972
969
  };
973
970
 
974
971
  const enableActions = (versionStatus) => {
975
972
  try {
976
- if (user.is_retailer) return false;
973
+ const userIsRetailer = user.is_retailer;
974
+
975
+ if (userIsRetailer) return false;
977
976
 
978
977
  if (versionStatus) {
979
- return ["AP", "ACA", "RCA", null].includes(versionStatus);
978
+ return ["AP", "AC", "RC", null].includes(versionStatus);
980
979
  }
981
980
  return true;
982
981
  } catch (err) {
@@ -1066,21 +1065,23 @@ export const ProviderProductEdition = ({
1066
1065
  },
1067
1066
  }));
1068
1067
  setShowGenericModal(true);
1069
- } else if (user.is_retailer) {
1070
- if (product.id_order || product.orderId) {
1071
- validateAll("A");
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
+ }
1072
1082
  } else {
1073
- setDataGenericModal((prev) => ({
1074
- ...prev,
1075
- button2: {
1076
- name: "Continuar",
1077
- action: () => evaluationToRetailer("A"),
1078
- },
1079
- }));
1080
- setShowGenericModal(true);
1083
+ validateAll("A");
1081
1084
  }
1082
- } else {
1083
- validateAll("A");
1084
1085
  }
1085
1086
  }}
1086
1087
  rejectAll={() => {
@@ -1090,23 +1091,25 @@ export const ProviderProductEdition = ({
1090
1091
  (!product.id_order || !product.orderId)
1091
1092
  ) {
1092
1093
  return;
1093
- } else if (user.is_retailer) {
1094
- if (product.id_order || product.orderId) {
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 {
1095
1110
  validateAll("R");
1096
1111
  setModalViewError(true);
1097
- } else {
1098
- setDataGenericModal((prev) => ({
1099
- ...prev,
1100
- button2: {
1101
- name: "Continuar",
1102
- action: () => evaluationToRetailer("R"),
1103
- },
1104
- }));
1105
- setShowGenericModal(true);
1106
1112
  }
1107
- } else {
1108
- validateAll("R");
1109
- setModalViewError(true);
1110
1113
  }
1111
1114
  }}
1112
1115
  approve={() => {
@@ -1123,21 +1126,23 @@ export const ProviderProductEdition = ({
1123
1126
  },
1124
1127
  }));
1125
1128
  setShowGenericModal(true);
1126
- } else if (user.is_retailer) {
1127
- if (product.id_order || product.orderId) {
1128
- sendEvaluation("A");
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
+ }
1129
1143
  } else {
1130
- setDataGenericModal((prev) => ({
1131
- ...prev,
1132
- button2: {
1133
- name: "Continuar",
1134
- action: () => evaluationToRetailer("A"),
1135
- },
1136
- }));
1137
- setShowGenericModal(true);
1144
+ sendEvaluation("A");
1138
1145
  }
1139
- } else {
1140
- sendEvaluation("A");
1141
1146
  }
1142
1147
  }}
1143
1148
  reject={() => {
@@ -1147,33 +1152,33 @@ export const ProviderProductEdition = ({
1147
1152
  (!product.id_order || !product.orderId)
1148
1153
  ) {
1149
1154
  return;
1150
- } else if (user.is_retailer) {
1151
- if (product.id_order || product.orderId) {
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 {
1152
1171
  sendEvaluation("R");
1153
1172
  setModalViewError(true);
1154
- } else {
1155
- setDataGenericModal((prev) => ({
1156
- ...prev,
1157
- button2: {
1158
- name: "Continuar",
1159
- action: () => evaluationToRetailer("R"),
1160
- },
1161
- }));
1162
- setShowGenericModal(true);
1163
1173
  }
1164
- } else {
1165
- sendEvaluation("R");
1166
- setModalViewError(true);
1167
1174
  }
1168
1175
  }}
1169
1176
  />
1170
1177
  <FullTabsMenu
1171
1178
  tabsSections={tabsSections}
1172
1179
  status={
1173
- activeRetailer.id
1174
- ? retailerStatus[activeRetailer?.id][getConcept(activeTab)] ||
1175
- "NS"
1176
- : "-"
1180
+ product[`${getConcept(activeTab)}_status`] ||
1181
+ product?.version_status
1177
1182
  }
1178
1183
  activeTab={activeTab}
1179
1184
  setActiveTab={setActiveTab}
@@ -1318,44 +1323,56 @@ export const ProviderProductEdition = ({
1318
1323
  />
1319
1324
  </div>
1320
1325
  )}
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
+ />
1321
1340
  </div>
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
- )}
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>
1357
1349
  </div>
1358
- )
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>
1359
1376
  )}
1360
1377
  </div>
1361
1378
  </div>