contentoh-components-library 21.4.61 → 21.4.63

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 (28) hide show
  1. package/dist/assets/fonts/roboto/LICENSE.txt +202 -0
  2. package/dist/components/molecules/BoxAttribute/styles.js +1 -1
  3. package/dist/components/molecules/BoxButtons/index.js +1 -0
  4. package/dist/components/molecules/TagAndInput/index.js +64 -3
  5. package/dist/components/organisms/InputGroup/index.js +153 -48
  6. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +82 -146
  7. package/dist/components/pages/ProviderProductEdition/index.js +173 -138
  8. package/dist/components/pages/RetailerProductEdition/index.js +5 -5
  9. package/package.json +1 -1
  10. package/src/assets/images/Icons/info.svg +8 -0
  11. package/src/components/atoms/TabSection/styles.js +1 -1
  12. package/src/components/molecules/BoxAttribute/BoxAttribute.stories.js +16 -0
  13. package/src/components/molecules/BoxAttribute/index.js +71 -0
  14. package/src/components/molecules/BoxAttribute/styles.js +38 -0
  15. package/src/components/molecules/BoxButtons/BoxButtons.stories.js +15 -0
  16. package/src/components/molecules/BoxButtons/index.js +28 -0
  17. package/src/components/molecules/BoxButtons/styles.js +43 -0
  18. package/src/components/molecules/TagAndInput/index.js +52 -8
  19. package/src/components/organisms/Box/Box.stories.js +17 -0
  20. package/src/components/organisms/Box/index.js +103 -0
  21. package/src/components/organisms/Box/styles.js +48 -0
  22. package/src/components/organisms/BoxOnboarding/BoxOnboarding.stories.js +17 -0
  23. package/src/components/organisms/BoxOnboarding/index.js +60 -0
  24. package/src/components/organisms/BoxOnboarding/styles.js +44 -0
  25. package/src/components/organisms/InputGroup/index.js +233 -87
  26. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +86 -175
  27. package/src/components/pages/ProviderProductEdition/index.js +43 -16
  28. package/src/components/pages/RetailerProductEdition/index.js +7 -5
@@ -140,6 +140,7 @@ export const ProviderProductEdition = ({
140
140
  const [datasheets, setDatasheets] = useState([]);
141
141
  const [images, setImages] = useReducer(reducerImages, {});
142
142
  const [showModal, setShowModal] = useState(false);
143
+ const [boxData, setBoxData] = useState();
143
144
  const { getRootProps, getInputProps } = useDropzone({
144
145
  accept: "image/*",
145
146
  noKeyboard: true,
@@ -695,11 +696,27 @@ export const ProviderProductEdition = ({
695
696
  };
696
697
 
697
698
  const saveDatasheets = async () => {
698
- setLoading(true);
699
+ const parseBoxData = [];
700
+ Object.entries(boxData).forEach(([, box], index) => {
701
+ const { value } = box;
702
+ const attributesIds = Object.keys(value);
703
+ attributesIds.forEach((attributeId) => {
704
+ const boxId = index + 1;
705
+ const valueOfAtribute = value[attributeId];
706
+ parseBoxData.push({
707
+ attributeId,
708
+ value: valueOfAtribute,
709
+ boxId,
710
+ })
711
+ });
712
+ });
713
+
699
714
  const dataObject = {
700
715
  articleId: product?.id_article,
701
716
  articleData: updatedDatasheets,
702
- };
717
+ ...(parseBoxData.length > 0 && { boxData: parseBoxData }),
718
+ };
719
+
703
720
  if (product?.orderId) dataObject["orderId"] = product?.orderId;
704
721
  try {
705
722
  const res = await axios.put(
@@ -718,7 +735,8 @@ export const ProviderProductEdition = ({
718
735
  }
719
736
  } catch (error) {
720
737
  console.log(error);
721
- }
738
+ }
739
+ console.log(dataObject)
722
740
  };
723
741
 
724
742
  const updateImages = useCallback(async () => {
@@ -1476,19 +1494,28 @@ export const ProviderProductEdition = ({
1476
1494
  )}
1477
1495
  {activeTab === "Ficha técnica" &&
1478
1496
  (product?.datasheet_status !== "NS" ? (
1479
- datasheets[0]?.data?.map((dataGroup, index) => (
1480
- <InputGroup
1481
- key={index + "-" + activeRetailer.name}
1482
- articleId={product.id_article}
1483
- version={version}
1484
- activeSection={activeTab}
1485
- inputGroup={dataGroup}
1486
- dataInputs={datasheets[1]}
1487
- updatedDatasheets={updatedDatasheets}
1488
- setUpdatedDatasheets={setUpdatedDatasheets}
1489
- //enableActions={enableActions(product.version_status)} ADD THIS VALIDATION
1490
- />
1491
- ))
1497
+ <div>
1498
+ {datasheets[0]?.data?.map((dataGroup, index) => (
1499
+ <InputGroup
1500
+ key={index + "-" + activeRetailer.name}
1501
+ articleId={product.id_article}
1502
+ version={version}
1503
+ activeSection={activeTab}
1504
+ inputGroup={dataGroup}
1505
+ dataInputs={datasheets[1]}
1506
+ updatedDatasheets={updatedDatasheets}
1507
+ setUpdatedDatasheets={setUpdatedDatasheets}
1508
+ isShowbox={true}
1509
+ activeRetailer={services[0][activeRetailer.id]}
1510
+ groupData={services[0][activeRetailer.id].data}
1511
+ setUpdatedBoxData={(e) => {
1512
+ setBoxData(e);
1513
+ }}
1514
+ index={index}
1515
+ //enableActions={enableActions(product.version_status)} ADD THIS VALIDATION
1516
+ ></InputGroup>
1517
+ ))}
1518
+ </div>
1492
1519
  ) : (
1493
1520
  <ScreenHeader
1494
1521
  text={"No cuentas con este servicio"}
@@ -231,7 +231,8 @@ export const RetailerProductEdition = ({
231
231
  product?.article?.id_article,
232
232
  product?.article?.category,
233
233
  parseInt(product?.article?.id_category),
234
- auditableVersion.version
234
+ auditableVersion.version,
235
+ token
235
236
  );
236
237
  getInputsData(
237
238
  auditServices,
@@ -260,7 +261,8 @@ export const RetailerProductEdition = ({
260
261
  product?.article?.id_article,
261
262
  product?.article?.category,
262
263
  parseInt(product?.article?.id_category),
263
- version
264
+ version,
265
+ token
264
266
  );
265
267
  if (auditableVersion) {
266
268
  loadAuditableData();
@@ -827,7 +829,7 @@ export const RetailerProductEdition = ({
827
829
  let message;
828
830
  if (result) {
829
831
  body.isAproved = result === "A";
830
- res = await axios.post(
832
+ res = await axios.put(
831
833
  `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
832
834
  body,
833
835
  {
@@ -848,7 +850,7 @@ export const RetailerProductEdition = ({
848
850
  message = "Evaluación enviada";
849
851
  getSectionIcon();
850
852
  }
851
- res = await axios.post(
853
+ res = await axios.put(
852
854
  `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
853
855
  body,
854
856
  {
@@ -1233,7 +1235,7 @@ export const RetailerProductEdition = ({
1233
1235
  conceptArray.forEach((concept) => {
1234
1236
  body.service = concept;
1235
1237
  evaluationArray.push(
1236
- axios.post(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, body, {
1238
+ axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, body, {
1237
1239
  headers: {
1238
1240
  Authorization: token,
1239
1241
  },