contentoh-components-library 21.0.96 → 21.0.97

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.
@@ -102,6 +102,14 @@ var reducerImages = function reducerImages(state, action) {
102
102
  values: values
103
103
  });
104
104
 
105
+ case "deleteImage":
106
+ values = values.filter(function (value) {
107
+ return action.selectedImages.indexOf(value) === -1;
108
+ });
109
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
110
+ values: values
111
+ });
112
+
105
113
  default:
106
114
  return state;
107
115
  }
@@ -356,6 +364,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
356
364
  socketType = _useState66[0],
357
365
  setSocketType = _useState66[1];
358
366
 
367
+ var _useState67 = (0, _react.useState)([]),
368
+ _useState68 = (0, _slicedToArray2.default)(_useState67, 2),
369
+ servicesStatus = _useState68[0],
370
+ setServicesStatus = _useState68[1];
371
+
372
+ var _useState69 = (0, _react.useState)(loading),
373
+ _useState70 = (0, _slicedToArray2.default)(_useState69, 2),
374
+ saving = _useState70[0],
375
+ setSaving = _useState70[1];
376
+
359
377
  (0, _react.useEffect)(function () {
360
378
  checkAll && setSelectedImages(images.values);
361
379
  }, [checkAll]);
@@ -375,14 +393,14 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
375
393
  case 2:
376
394
  services = _context.sent;
377
395
  //Converts the data inside the datasheets object to array
378
- setServices(services); //setActiveRetailer(product?.retailers[0]);
396
+ setServices(services);
397
+ getServices(); //setActiveRetailer(product?.retailers[0]);
379
398
 
380
399
  setImages({
381
400
  action: "init",
382
- init: JSON.parse(sessionStorage.getItem("imagesList")) || services[2]
401
+ init: services[2]
383
402
  });
384
403
  if (((_services$ = services[2]) === null || _services$ === void 0 ? void 0 : (_services$$values = _services$.values) === null || _services$$values === void 0 ? void 0 : _services$$values.length) > 0) setActiveImage(0);
385
- setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
386
404
  (0, _data2.getPercentage)({
387
405
  data: [product]
388
406
  }).then(function (res) {
@@ -497,7 +515,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
497
515
  // setPercentages(res)
498
516
  // );
499
517
 
500
- getServices();
518
+ setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
501
519
  getComments();
502
520
  _context4.t0 = setUserGroups;
503
521
  _context4.next = 6;
@@ -832,18 +850,19 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
832
850
  }
833
851
 
834
852
  if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
835
- _context7.next = 30;
853
+ _context7.next = 31;
836
854
  break;
837
855
  }
838
856
 
839
- _context7.prev = 10;
857
+ setLoading(true);
858
+ _context7.prev = 11;
840
859
  data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
841
860
  e.uuid = (0, _uuid.v4)();
842
861
  });
843
862
  setDataImages(data);
844
863
 
845
864
  if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
846
- _context7.next = 22;
865
+ _context7.next = 23;
847
866
  break;
848
867
  }
849
868
 
@@ -859,40 +878,40 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
859
878
  };
860
879
  promiseArray.push(myBucket.putObject(params).promise());
861
880
  });
862
- _context7.next = 19;
881
+ _context7.next = 20;
863
882
  return Promise.all(promiseArray);
864
883
 
865
- case 19:
884
+ case 20:
866
885
  setImagesUploaded(true);
867
- _context7.next = 23;
886
+ _context7.next = 24;
868
887
  break;
869
888
 
870
- case 22:
889
+ case 23:
871
890
  setImagesUploaded(true);
872
891
 
873
- case 23:
874
- _context7.next = 28;
892
+ case 24:
893
+ _context7.next = 29;
875
894
  break;
876
895
 
877
- case 25:
878
- _context7.prev = 25;
879
- _context7.t0 = _context7["catch"](10);
896
+ case 26:
897
+ _context7.prev = 26;
898
+ _context7.t0 = _context7["catch"](11);
880
899
  console.log(_context7.t0); // setMainLoading(false);
881
900
 
882
- case 28:
883
- _context7.next = 31;
901
+ case 29:
902
+ _context7.next = 32;
884
903
  break;
885
904
 
886
- case 30:
905
+ case 31:
887
906
  // setMainLoading(false);
888
907
  setMessage("Completa los campos que solicita cada una de la imágenes o hay imágenes con el mismo tipo de toma.\nRecuerda hay campos obligatorios y no podras avanzar si no estan completos.");
889
908
 
890
- case 31:
909
+ case 32:
891
910
  case "end":
892
911
  return _context7.stop();
893
912
  }
894
913
  }
895
- }, _callee7, null, [[10, 25]]);
914
+ }, _callee7, null, [[11, 26]]);
896
915
  })), [images, imagesUploaded]);
897
916
  (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
898
917
  return _regenerator.default.wrap(function _callee8$(_context8) {
@@ -900,11 +919,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
900
919
  switch (_context8.prev = _context8.next) {
901
920
  case 0:
902
921
  if (!imagesUploaded) {
903
- _context8.next = 14;
922
+ _context8.next = 13;
904
923
  break;
905
924
  }
906
925
 
907
- setLoading(true);
908
926
  dataImages.articleData = dataImages === null || dataImages === void 0 ? void 0 : dataImages.articleData.map(function (e) {
909
927
  delete e.src;
910
928
  e.imageID = e.image_id;
@@ -913,32 +931,32 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
913
931
  if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
914
932
  return e;
915
933
  });
916
- _context8.prev = 3;
917
- _context8.next = 6;
934
+ _context8.prev = 2;
935
+ _context8.next = 5;
918
936
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
919
937
  headers: {
920
938
  Authorization: token
921
939
  }
922
940
  });
923
941
 
924
- case 6:
942
+ case 5:
925
943
  setMessage("Imágenes guardadas con éxito");
926
944
  sessionStorage.removeItem("imagesList");
927
945
  loadData();
928
- _context8.next = 14;
946
+ _context8.next = 13;
929
947
  break;
930
948
 
931
- case 11:
932
- _context8.prev = 11;
933
- _context8.t0 = _context8["catch"](3);
949
+ case 10:
950
+ _context8.prev = 10;
951
+ _context8.t0 = _context8["catch"](2);
934
952
  console.log(_context8.t0);
935
953
 
936
- case 14:
954
+ case 13:
937
955
  case "end":
938
956
  return _context8.stop();
939
957
  }
940
958
  }
941
- }, _callee8, null, [[3, 11]]);
959
+ }, _callee8, null, [[2, 10]]);
942
960
  })), [dataImages, imagesUploaded]);
943
961
 
944
962
  var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {
@@ -1234,7 +1252,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1234
1252
  }();
1235
1253
 
1236
1254
  var getRequired = function getRequired(services) {
1237
- var _services$4, _services$4$inputs;
1255
+ var _services$4, _services$4$retailerM, _services$5, _services$5$inputs;
1238
1256
 
1239
1257
  var objetcTemp = {};
1240
1258
  var datasheetServicesArray = Object.values(services[0]);
@@ -1268,8 +1286,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1268
1286
  });
1269
1287
  });
1270
1288
  objetcTemp["Descripción"] = desInputsRequired;
1271
- var requiredImages = (_services$4 = services[2]) === null || _services$4 === void 0 ? void 0 : (_services$4$inputs = _services$4.inputs) === null || _services$4$inputs === void 0 ? void 0 : _services$4$inputs.filter(function (e) {
1272
- return e.required;
1289
+ var retailersRequested = [];
1290
+ (_services$4 = services[2]) === null || _services$4 === void 0 ? void 0 : (_services$4$retailerM = _services$4.retailerMandatories) === null || _services$4$retailerM === void 0 ? void 0 : _services$4$retailerM.forEach(function (retMan) {
1291
+ return retMan.forEach(function (rm) {
1292
+ return retailersRequested.push(rm);
1293
+ });
1294
+ });
1295
+ var requiredImages = (_services$5 = services[2]) === null || _services$5 === void 0 ? void 0 : (_services$5$inputs = _services$5.inputs) === null || _services$5$inputs === void 0 ? void 0 : _services$5$inputs.filter(function (e) {
1296
+ return e.required === 1 && retailersRequested.filter(function (ret) {
1297
+ return ret.id_image === e.id && servicesData.filter(function (srv) {
1298
+ return srv.id_retailer === ret.id_retailer;
1299
+ }).length > 0;
1300
+ }).length > 0;
1273
1301
  });
1274
1302
  var requiredCounter = 0;
1275
1303
  requiredImages === null || requiredImages === void 0 ? void 0 : requiredImages.forEach(function (req) {
@@ -1444,7 +1472,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1444
1472
 
1445
1473
  var deleteImages = function deleteImages() {
1446
1474
  setLoading(true);
1447
- var imagesTemp = images;
1448
1475
  var values = images.values;
1449
1476
  var imgsInBack = [];
1450
1477
  selectedImages.forEach(function (selectedImg) {
@@ -1453,12 +1480,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1453
1480
  var imgsLeft = values.filter(function (value) {
1454
1481
  return selectedImages.indexOf(value) === -1;
1455
1482
  });
1456
- imagesTemp.values = imgsLeft;
1457
1483
 
1458
1484
  if (imgsInBack.length > 0) {
1459
1485
  var data = {
1460
1486
  articleId: product.article.id_article,
1461
- deleteImages: selectedImages
1487
+ deleteImages: imgsInBack
1462
1488
  };
1463
1489
 
1464
1490
  try {
@@ -1472,8 +1498,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1472
1498
  }
1473
1499
  }
1474
1500
 
1475
- sessionStorage.setItem("imagesList", JSON.stringify(imagesTemp));
1476
- loadData();
1501
+ setImages({
1502
+ action: "deleteImage",
1503
+ selectedImages: selectedImages
1504
+ });
1505
+ getRequired([services[0], services[1], (0, _objectSpread2.default)((0, _objectSpread2.default)({}, services[2]), {}, {
1506
+ values: imgsLeft
1507
+ })]);
1508
+ setTimeout(function () {
1509
+ setLoading(false);
1510
+ }, 500);
1477
1511
  setMessage("");
1478
1512
  setComponentsArray([]);
1479
1513
  };
@@ -1544,6 +1578,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1544
1578
  (0, _react.useEffect)(function () {
1545
1579
  services.length > 0 && getRequired(services);
1546
1580
  }, [services, servicesData, activeTab]);
1581
+ (0, _react.useEffect)(function () {
1582
+ setSaving(loading);
1583
+ }, [loading]);
1547
1584
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1548
1585
  headerTop: headerTop,
1549
1586
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
@@ -1578,6 +1615,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1578
1615
  headerData: product,
1579
1616
  percent: activePercentage,
1580
1617
  activeRetailer: activeRetailer,
1618
+ servicesData: servicesData,
1581
1619
  setActiveRetailer: setActiveRetailer,
1582
1620
  sendToFacilitator: sendToFacilitator,
1583
1621
  approve: function approve() {
@@ -1598,19 +1636,19 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1598
1636
  assig: assig[activeTab],
1599
1637
  setAssignation: setAssignation,
1600
1638
  isRetailer: isRetailer,
1601
- showSaveButton: true,
1639
+ showSaveButton: userAssigned(),
1602
1640
  onClickSave: function onClickSave() {
1603
1641
  switch (activeTab) {
1604
1642
  case "Descripción":
1605
- (product === null || product === void 0 ? void 0 : product.description_status) !== "NS" && saveDescriptions();
1643
+ !saving && (product === null || product === void 0 ? void 0 : product.description_status) !== "NS" && saveDescriptions();
1606
1644
  break;
1607
1645
 
1608
1646
  case "Ficha técnica":
1609
- (product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" && saveDatasheets();
1647
+ !saving && (product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" && saveDatasheets();
1610
1648
  break;
1611
1649
 
1612
1650
  case "Imágenes":
1613
- (product === null || product === void 0 ? void 0 : product.images_status) !== "NS" && updateImages();
1651
+ !saving && (product === null || product === void 0 ? void 0 : product.images_status) !== "NS" && updateImages();
1614
1652
  break;
1615
1653
 
1616
1654
  default:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.0.96",
3
+ "version": "21.0.97",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -5,6 +5,8 @@ import removeAsigned from "../../../assets/images/asignationOptions/removeAsigne
5
5
  import requesToProvider from "../../../assets/images/asignationOptions/requestToProvider.svg";
6
6
  import requestToTeam from "../../../assets/images/asignationOptions/requestToTeam.svg";
7
7
  import availableIcon from "../../../assets/images/asignationOptions/availableIcon.svg";
8
+ import { getNewStatus } from "../../../global-files/data";
9
+ import { StatusTag } from "../StatusTag";
8
10
 
9
11
  export const AsignationOption = ({
10
12
  profileImage,
@@ -15,7 +17,21 @@ export const AsignationOption = ({
15
17
  onClick,
16
18
  btnOnClick,
17
19
  active,
20
+ services,
18
21
  }) => {
22
+ const getStatus = () => {
23
+ let servCad = "";
24
+ services.forEach((srv) => (servCad += srv));
25
+ switch (servCad) {
26
+ case "NANANA":
27
+ return "NA";
28
+ case "RECEIVEDRECEIVEDRECEIVED":
29
+ return "RECEIVED";
30
+ default:
31
+ return getNewStatus(services);
32
+ }
33
+ };
34
+
19
35
  const iconsAsignation = {
20
36
  assigned: (
21
37
  <button onClick={btnOnClick}>
@@ -39,6 +55,11 @@ export const AsignationOption = ({
39
55
  <p className="team-label">{team}</p>
40
56
  </div>
41
57
  {asignationType && iconsAsignation[asignationType]}
58
+ {services && (
59
+ <div className="status-container">
60
+ <StatusTag statusType={getStatus()} />
61
+ </div>
62
+ )}
42
63
  {active && <div className="green-circle"></div>}
43
64
  </Container>
44
65
  );
@@ -40,6 +40,12 @@ export const Container = styled.div`
40
40
  }
41
41
  }
42
42
 
43
+ .status-container {
44
+ & + * {
45
+ margin-left: 10px;
46
+ }
47
+ }
48
+
43
49
  .green-circle {
44
50
  background-color: ${GlobalColors.exported};
45
51
  width: 20px;
@@ -24,7 +24,8 @@ export const Container = styled.div`
24
24
  }
25
25
 
26
26
  &.status-Pr,
27
- &.status-Rr {
27
+ &.status-Rr,
28
+ &.status-Rc {
28
29
  background-color: ${GlobalColors.reception};
29
30
  }
30
31
 
@@ -8,6 +8,7 @@ export const RetailerSelector = ({
8
8
  retailers,
9
9
  activeRetailer,
10
10
  setActiveRetailer,
11
+ showStatus,
11
12
  }) => {
12
13
  const [retailersPanel, setRetailersPanel] = useState(false);
13
14
 
@@ -47,6 +48,7 @@ export const RetailerSelector = ({
47
48
  asignationType={null}
48
49
  name={retailer?.name}
49
50
  team={retailer?.team}
51
+ services={retailer?.services}
50
52
  onClick={() => {
51
53
  setActiveRetailer(retailer);
52
54
  document.removeEventListener(
@@ -57,6 +59,7 @@ export const RetailerSelector = ({
57
59
  setRetailersPanel(false);
58
60
  }}
59
61
  active={retailer.id === activeRetailer.id}
62
+ showStatus={showStatus}
60
63
  />
61
64
  ))}
62
65
  </div>
@@ -49,12 +49,14 @@ export const StatusAsignationInfo = ({
49
49
  )}
50
50
  {imagesSection && (
51
51
  <div className="images-buttons">
52
- <Button
53
- buttonType={"circular-button delete-button"}
54
- onClick={() => {
55
- askToDeleteImages && askToDeleteImages();
56
- }}
57
- />
52
+ {showSaveButton && (
53
+ <Button
54
+ buttonType={"circular-button delete-button"}
55
+ onClick={() => {
56
+ askToDeleteImages && askToDeleteImages();
57
+ }}
58
+ />
59
+ )}
58
60
  <Button
59
61
  buttonType={"circular-button download-button"}
60
62
  onClick={() => {
@@ -2,6 +2,8 @@ import { Container } from "./styles";
2
2
  import { ProductNameHeader } from "../../molecules/ProductNameHeader";
3
3
  import { FeaturesBar } from "../../molecules/FeaturesBar";
4
4
  import { AvatarAndValidation } from "../../molecules/AvatarAndValidation";
5
+ import { useState } from "react";
6
+ import { useEffect } from "react";
5
7
 
6
8
  export const FullProductNameHeader = ({
7
9
  headerData,
@@ -11,7 +13,23 @@ export const FullProductNameHeader = ({
11
13
  showValidationButtons,
12
14
  approve,
13
15
  reject,
16
+ servicesData,
14
17
  }) => {
18
+ const [retailers, setRetailers] = useState([]);
19
+ useEffect(() => {
20
+ const rtls = headerData?.retailers || headerData?.retailersAvailable;
21
+ servicesData &&
22
+ rtls.forEach((rt) => {
23
+ const element = [];
24
+ servicesData.forEach((sd) => {
25
+ if (sd.id_retailer === rt.id) {
26
+ element.push(sd.status ? sd.status : "RECEIVED");
27
+ } else element.push("NA");
28
+ rt["services"] = element;
29
+ });
30
+ });
31
+ setRetailers(rtls);
32
+ }, [servicesData]);
15
33
  return (
16
34
  <Container>
17
35
  <ProductNameHeader
@@ -41,7 +59,7 @@ export const FullProductNameHeader = ({
41
59
  ]}
42
60
  />
43
61
  <AvatarAndValidation
44
- retailers={headerData?.retailers || headerData?.retailersAvailable}
62
+ retailers={retailers}
45
63
  avatarData={headerData?.avatarData}
46
64
  validation={headerData?.validation}
47
65
  activeRetailer={activeRetailer}
@@ -48,6 +48,11 @@ const reducerImages = (state, action) => {
48
48
  case "changeAttrValue":
49
49
  attrForImgs[action.retailer][action.index].value = action.value;
50
50
  return { ...state, attrForImgs, values };
51
+ case "deleteImage":
52
+ values = values.filter(
53
+ (value) => action.selectedImages.indexOf(value) === -1
54
+ );
55
+ return { ...state, values };
51
56
  default:
52
57
  return state;
53
58
  }
@@ -195,6 +200,7 @@ export const ProviderProductEdition = ({
195
200
  });
196
201
  const [modalViewTextArea, setModalViewTextArea] = useState(false);
197
202
  const [socketType, setSocketType] = useState(null);
203
+ const [saving, setSaving] = useState(loading);
198
204
 
199
205
  useEffect(() => {
200
206
  checkAll && setSelectedImages(images.values);
@@ -213,7 +219,7 @@ export const ProviderProductEdition = ({
213
219
  //setActiveRetailer(product?.retailers[0]);
214
220
  setImages({
215
221
  action: "init",
216
- init: JSON.parse(sessionStorage.getItem("imagesList")) || services[2],
222
+ init: services[2],
217
223
  });
218
224
  if (services[2]?.values?.length > 0) setActiveImage(0);
219
225
 
@@ -500,6 +506,7 @@ export const ProviderProductEdition = ({
500
506
  });
501
507
  }
502
508
  if (valid && duplicated?.length === 0) {
509
+ setLoading(true);
503
510
  try {
504
511
  data?.articleData?.forEach((e) => {
505
512
  e.uuid = uuidv4();
@@ -541,7 +548,6 @@ export const ProviderProductEdition = ({
541
548
 
542
549
  useEffect(async () => {
543
550
  if (imagesUploaded) {
544
- setLoading(true);
545
551
  dataImages.articleData = dataImages?.articleData.map((e) => {
546
552
  delete e.src;
547
553
  e.imageID = e.image_id;
@@ -858,7 +864,21 @@ export const ProviderProductEdition = ({
858
864
  });
859
865
 
860
866
  objetcTemp["Descripción"] = desInputsRequired;
861
- const requiredImages = services[2]?.inputs?.filter((e) => e.required);
867
+ const retailersRequested = [];
868
+ services[2]?.retailerMandatories?.forEach((retMan) =>
869
+ retMan.forEach((rm) => retailersRequested.push(rm))
870
+ );
871
+ const requiredImages = services[2]?.inputs?.filter(
872
+ (e) =>
873
+ e.required === 1 &&
874
+ retailersRequested.filter(
875
+ (ret) =>
876
+ ret.id_image === e.id &&
877
+ servicesData.filter((srv) => srv.id_retailer === ret.id_retailer)
878
+ .length > 0
879
+ ).length > 0
880
+ );
881
+
862
882
  let requiredCounter = 0;
863
883
  requiredImages?.forEach(
864
884
  (req) =>
@@ -955,7 +975,6 @@ export const ProviderProductEdition = ({
955
975
 
956
976
  const deleteImages = () => {
957
977
  setLoading(true);
958
- const imagesTemp = images;
959
978
  const { values } = images;
960
979
  const imgsInBack = [];
961
980
 
@@ -967,12 +986,10 @@ export const ProviderProductEdition = ({
967
986
  (value) => selectedImages.indexOf(value) === -1
968
987
  );
969
988
 
970
- imagesTemp.values = imgsLeft;
971
-
972
989
  if (imgsInBack.length > 0) {
973
990
  const data = {
974
- articleId: product.article.id_article,
975
- deleteImages: selectedImages,
991
+ articleId: product?.id_article || product?.article?.id_article,
992
+ deleteImages: imgsInBack,
976
993
  };
977
994
  try {
978
995
  axios.put(
@@ -986,8 +1003,16 @@ export const ProviderProductEdition = ({
986
1003
  console.log(err);
987
1004
  }
988
1005
  }
989
- sessionStorage.setItem("imagesList", JSON.stringify(imagesTemp));
990
- loadData();
1006
+
1007
+ setImages({
1008
+ action: "deleteImage",
1009
+ selectedImages,
1010
+ });
1011
+
1012
+ setTimeout(() => {
1013
+ setLoading(false);
1014
+ }, 500);
1015
+
991
1016
  setMessage("");
992
1017
  setComponentsArray([]);
993
1018
  };
@@ -1166,6 +1191,10 @@ export const ProviderProductEdition = ({
1166
1191
  return true;
1167
1192
  };
1168
1193
 
1194
+ useEffect(() => {
1195
+ setSaving(loading);
1196
+ }, [loading]);
1197
+
1169
1198
  return (
1170
1199
  <Container headerTop={headerTop}>
1171
1200
  <HeaderTop setHeaderTop={setHeaderTop} />
@@ -1278,13 +1307,13 @@ export const ProviderProductEdition = ({
1278
1307
  onClickSave={() => {
1279
1308
  switch (activeTab) {
1280
1309
  case "Descripción":
1281
- saveDescriptions();
1310
+ !saving && saveDescriptions();
1282
1311
  break;
1283
1312
  case "Ficha técnica":
1284
- saveDatasheets();
1313
+ !saving && saveDatasheets();
1285
1314
  break;
1286
1315
  case "Imágenes":
1287
- updateImages();
1316
+ !saving && updateImages();
1288
1317
  break;
1289
1318
  default:
1290
1319
  break;
@@ -1301,15 +1330,13 @@ export const ProviderProductEdition = ({
1301
1330
  <Loading />
1302
1331
  ) : (
1303
1332
  <>
1304
- {!imageLayout &&
1305
- activeTab === "Imágenes" &&
1306
- product?.services?.images === 1 && (
1307
- <GalleryHeader
1308
- setSelectedImages={setSelectedImages}
1309
- checkAll={checkAll}
1310
- setCheckAll={setCheckAll}
1311
- />
1312
- )}
1333
+ {!imageLayout && activeTab === "Imágenes" && (
1334
+ <GalleryHeader
1335
+ setSelectedImages={setSelectedImages}
1336
+ checkAll={checkAll}
1337
+ setCheckAll={setCheckAll}
1338
+ />
1339
+ )}
1313
1340
  {activeTab === "Ficha técnica" &&
1314
1341
  (product?.datasheet_status !== "NS" ? (
1315
1342
  datasheets[0]?.data?.map((dataGroup, index) => (