contentoh-components-library 21.0.94 → 21.0.98

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 (25) hide show
  1. package/dist/components/atoms/AsignationOption/index.js +21 -2
  2. package/dist/components/atoms/AsignationOption/styles.js +1 -1
  3. package/dist/components/atoms/InputFormatter/index.js +1 -1
  4. package/dist/components/atoms/StatusTag/styles.js +1 -1
  5. package/dist/components/molecules/RetailerSelector/index.js +5 -2
  6. package/dist/components/molecules/StatusAsignationInfo/index.js +1 -1
  7. package/dist/components/organisms/FullProductNameHeader/index.js +29 -2
  8. package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +41 -100
  9. package/dist/components/pages/ProviderProductEdition/index.js +74 -43
  10. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +44 -32
  11. package/dist/components/pages/RetailerProductEdition/index.js +82 -44
  12. package/dist/global-files/data.js +2 -0
  13. package/package.json +1 -1
  14. package/src/components/atoms/AsignationOption/index.js +15 -0
  15. package/src/components/atoms/AsignationOption/styles.js +6 -0
  16. package/src/components/atoms/InputFormatter/index.js +1 -1
  17. package/src/components/atoms/StatusTag/styles.js +2 -1
  18. package/src/components/molecules/RetailerSelector/index.js +3 -0
  19. package/src/components/molecules/StatusAsignationInfo/index.js +8 -6
  20. package/src/components/organisms/FullProductNameHeader/index.js +19 -1
  21. package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +45 -117
  22. package/src/components/pages/ProviderProductEdition/index.js +49 -22
  23. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +46 -32
  24. package/src/components/pages/RetailerProductEdition/index.js +59 -18
  25. package/src/global-files/data.js +2 -0
@@ -19,6 +19,10 @@ var _requestToTeam = _interopRequireDefault(require("../../../assets/images/asig
19
19
 
20
20
  var _availableIcon = _interopRequireDefault(require("../../../assets/images/asignationOptions/availableIcon.svg"));
21
21
 
22
+ var _data = require("../../../global-files/data");
23
+
24
+ var _StatusTag = require("../StatusTag");
25
+
22
26
  var _jsxRuntime = require("react/jsx-runtime");
23
27
 
24
28
  var AsignationOption = function AsignationOption(_ref) {
@@ -31,7 +35,17 @@ var AsignationOption = function AsignationOption(_ref) {
31
35
  team = _ref.team,
32
36
  onClick = _ref.onClick,
33
37
  btnOnClick = _ref.btnOnClick,
34
- active = _ref.active;
38
+ active = _ref.active,
39
+ services = _ref.services;
40
+
41
+ var getStatus = function getStatus() {
42
+ var servCad = "";
43
+ services.forEach(function (srv) {
44
+ return servCad += srv;
45
+ });
46
+ return (0, _data.getNewStatus)(services);
47
+ };
48
+
35
49
  var iconsAsignation = {
36
50
  assigned: /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
37
51
  onClick: btnOnClick,
@@ -68,7 +82,12 @@ var AsignationOption = function AsignationOption(_ref) {
68
82
  className: "team-label",
69
83
  children: team
70
84
  })]
71
- }), asignationType && iconsAsignation[asignationType], active && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
85
+ }), asignationType && iconsAsignation[asignationType], services && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
86
+ className: "status-container",
87
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_StatusTag.StatusTag, {
88
+ statusType: getStatus()
89
+ })
90
+ }), active && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
72
91
  className: "green-circle"
73
92
  })]
74
93
  });
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n cursor: pointer;\n border-radius: 3px;\n padding: 5px;\n\n .profile-image,\n .medium-image {\n & + * {\n margin-left: 15px;\n }\n }\n\n .labels-container {\n font-family: ", ";\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n\n .name-label,\n .team-label {\n inline-size: 100px;\n overflow: hidden;\n }\n\n .name-label {\n color: ", ";\n }\n\n .team-label {\n color: ", ";\n }\n\n & + * {\n margin-left: 11px;\n }\n }\n\n .green-circle {\n background-color: ", ";\n width: 20px;\n height: 20px;\n border-radius: 50%;\n }\n\n button {\n background-color: transparent;\n cursor: pointer;\n border: none;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n & + * {\n margin-top: 10px;\n }\n"])), _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.s3);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n cursor: pointer;\n border-radius: 3px;\n padding: 5px;\n\n .profile-image,\n .medium-image {\n & + * {\n margin-left: 15px;\n }\n }\n\n .labels-container {\n font-family: ", ";\n font-weight: 500;\n font-size: 14px;\n line-height: 16px;\n\n .name-label,\n .team-label {\n inline-size: 100px;\n overflow: hidden;\n }\n\n .name-label {\n color: ", ";\n }\n\n .team-label {\n color: ", ";\n }\n\n & + * {\n margin-left: 11px;\n }\n }\n\n .status-container {\n & + * {\n margin-left: 10px;\n }\n }\n\n .green-circle {\n background-color: ", ";\n width: 20px;\n height: 20px;\n border-radius: 50%;\n }\n\n button {\n background-color: transparent;\n cursor: pointer;\n border: none;\n }\n\n &:hover {\n background-color: ", ";\n }\n\n & + * {\n margin-top: 10px;\n }\n"])), _variables.FontFamily.AvenirNext, _variables.GlobalColors.s5, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.s3);
19
19
 
20
20
  exports.Container = Container;
@@ -99,7 +99,7 @@ var InputFormatter = function InputFormatter(_ref) {
99
99
  setCharsCounter(h.getLength() - 1);
100
100
  value = valueFormater(value);
101
101
  var idInput = inputId;
102
- var dataSave = updatedDescriptions.slice();
102
+ var dataSave = updatedDescriptions === null || updatedDescriptions === void 0 ? void 0 : updatedDescriptions.slice();
103
103
 
104
104
  if (dataSave.length > 0) {
105
105
  if (dataSave.filter(function (e) {
@@ -15,6 +15,6 @@ var _variables = require("../../../global-files/variables");
15
15
 
16
16
  var _templateObject;
17
17
 
18
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n padding: 0 10px;\n height: 20px;\n background-color: ", ";\n border-radius: 3px;\n\n p {\n text-align: center;\n color: ", ";\n font-family: ", ";\n font-size: 12px;\n line-height: 20px;\n }\n\n &.status-As,\n &.status-P,\n &.status-IN_PROGRESS,\n &.status-QF {\n background-color: ", ";\n }\n\n &.status-Pr,\n &.status-Rr {\n background-color: ", ";\n }\n\n &.status-AA,\n &.status-AP,\n &.status-AC,\n &.status-AF {\n background-color: ", ";\n }\n\n &.status-RA,\n &.status-RF,\n &.status-RP,\n &.status-RC {\n background-color: ", ";\n }\n\n &.status-Dat,\n &.status-Dsc,\n &.status-Imgs {\n background-color: ", ";\n }\n\n &.status-Ex {\n background-color: ", ";\n }\n\n &.status-DDI {\n background-color: ", ";\n }\n\n &.status-GLD {\n background-color: ", ";\n }\n\n &.status-TAB {\n background-color: ", ";\n }\n\n &.status-Pt {\n background-color: ", ";\n color: ", ";\n }\n\n &.oval-form {\n border-radius: 10px;\n }\n"])), _variables.GlobalColors.s3, _variables.GlobalColors.white, _variables.FontFamily.Lato, _variables.GlobalColors.in_progress, _variables.GlobalColors.reception, _variables.GlobalColors.finished, _variables.GlobalColors.rejected_status, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.original_purpura, _variables.GlobalColors.in_progress, _variables.GlobalColors.deep_gray, _variables.GlobalColors.s2, _variables.GlobalColors.s4);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n width: fit-content;\n padding: 0 10px;\n height: 20px;\n background-color: ", ";\n border-radius: 3px;\n\n p {\n text-align: center;\n color: ", ";\n font-family: ", ";\n font-size: 12px;\n line-height: 20px;\n }\n\n &.status-As,\n &.status-P,\n &.status-IN_PROGRESS,\n &.status-QF {\n background-color: ", ";\n }\n\n &.status-Pr,\n &.status-Rr,\n &.status-Rc {\n background-color: ", ";\n }\n\n &.status-AA,\n &.status-AP,\n &.status-AC,\n &.status-AF {\n background-color: ", ";\n }\n\n &.status-RA,\n &.status-RF,\n &.status-RP,\n &.status-RC {\n background-color: ", ";\n }\n\n &.status-Dat,\n &.status-Dsc,\n &.status-Imgs {\n background-color: ", ";\n }\n\n &.status-Ex {\n background-color: ", ";\n }\n\n &.status-DDI {\n background-color: ", ";\n }\n\n &.status-GLD {\n background-color: ", ";\n }\n\n &.status-TAB {\n background-color: ", ";\n }\n\n &.status-Pt {\n background-color: ", ";\n color: ", ";\n }\n\n &.oval-form {\n border-radius: 10px;\n }\n"])), _variables.GlobalColors.s3, _variables.GlobalColors.white, _variables.FontFamily.Lato, _variables.GlobalColors.in_progress, _variables.GlobalColors.reception, _variables.GlobalColors.finished, _variables.GlobalColors.rejected_status, _variables.GlobalColors.s4, _variables.GlobalColors.exported, _variables.GlobalColors.original_purpura, _variables.GlobalColors.in_progress, _variables.GlobalColors.deep_gray, _variables.GlobalColors.s2, _variables.GlobalColors.s4);
19
19
 
20
20
  exports.Container = Container;
@@ -24,7 +24,8 @@ var _jsxRuntime = require("react/jsx-runtime");
24
24
  var RetailerSelector = function RetailerSelector(_ref) {
25
25
  var retailers = _ref.retailers,
26
26
  activeRetailer = _ref.activeRetailer,
27
- setActiveRetailer = _ref.setActiveRetailer;
27
+ setActiveRetailer = _ref.setActiveRetailer,
28
+ showStatus = _ref.showStatus;
28
29
 
29
30
  var _useState = (0, _react.useState)(false),
30
31
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -64,12 +65,14 @@ var RetailerSelector = function RetailerSelector(_ref) {
64
65
  asignationType: null,
65
66
  name: retailer === null || retailer === void 0 ? void 0 : retailer.name,
66
67
  team: retailer === null || retailer === void 0 ? void 0 : retailer.team,
68
+ services: retailer === null || retailer === void 0 ? void 0 : retailer.services,
67
69
  onClick: function onClick() {
68
70
  setActiveRetailer(retailer);
69
71
  document.removeEventListener("click", closeRetailersPanel, false);
70
72
  setRetailersPanel(false);
71
73
  },
72
- active: retailer.id === activeRetailer.id
74
+ active: retailer.id === activeRetailer.id,
75
+ showStatus: showStatus
73
76
  }, "".concat(index, "-").concat(retailer === null || retailer === void 0 ? void 0 : retailer.name));
74
77
  })
75
78
  })]
@@ -83,7 +83,7 @@ var StatusAsignationInfo = function StatusAsignationInfo(_ref) {
83
83
  onClick: onClickSave
84
84
  }), imagesSection && /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
85
85
  className: "images-buttons",
86
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
86
+ children: [showSaveButton && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
87
87
  buttonType: "circular-button delete-button",
88
88
  onClick: function onClick() {
89
89
  askToDeleteImages && askToDeleteImages();
@@ -1,10 +1,14 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
3
5
  Object.defineProperty(exports, "__esModule", {
4
6
  value: true
5
7
  });
6
8
  exports.FullProductNameHeader = void 0;
7
9
 
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
11
+
8
12
  var _styles = require("./styles");
9
13
 
10
14
  var _ProductNameHeader = require("../../molecules/ProductNameHeader");
@@ -13,6 +17,8 @@ var _FeaturesBar = require("../../molecules/FeaturesBar");
13
17
 
14
18
  var _AvatarAndValidation = require("../../molecules/AvatarAndValidation");
15
19
 
20
+ var _react = require("react");
21
+
16
22
  var _jsxRuntime = require("react/jsx-runtime");
17
23
 
18
24
  var FullProductNameHeader = function FullProductNameHeader(_ref) {
@@ -24,7 +30,28 @@ var FullProductNameHeader = function FullProductNameHeader(_ref) {
24
30
  setActiveRetailer = _ref.setActiveRetailer,
25
31
  showValidationButtons = _ref.showValidationButtons,
26
32
  approve = _ref.approve,
27
- reject = _ref.reject;
33
+ reject = _ref.reject,
34
+ servicesData = _ref.servicesData;
35
+
36
+ var _useState = (0, _react.useState)([]),
37
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
38
+ retailers = _useState2[0],
39
+ setRetailers = _useState2[1];
40
+
41
+ (0, _react.useEffect)(function () {
42
+ var rtls = (headerData === null || headerData === void 0 ? void 0 : headerData.retailers) || (headerData === null || headerData === void 0 ? void 0 : headerData.retailersAvailable);
43
+ servicesData && rtls.forEach(function (rt) {
44
+ var element = [];
45
+ servicesData.forEach(function (sd) {
46
+ if (sd.id_retailer === rt.id) {
47
+ element.push(sd.status ? sd.status : "RECEIVED");
48
+ } else element.push("NA");
49
+
50
+ rt["services"] = element;
51
+ });
52
+ });
53
+ setRetailers(rtls);
54
+ }, [servicesData]);
28
55
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
29
56
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ProductNameHeader.ProductNameHeader, {
30
57
  productName: (headerData === null || headerData === void 0 ? void 0 : (_headerData$article = headerData.article) === null || _headerData$article === void 0 ? void 0 : _headerData$article.name) || (headerData === null || headerData === void 0 ? void 0 : headerData.name),
@@ -46,7 +73,7 @@ var FullProductNameHeader = function FullProductNameHeader(_ref) {
46
73
  value: (headerData === null || headerData === void 0 ? void 0 : (_headerData$article5 = headerData.article) === null || _headerData$article5 === void 0 ? void 0 : _headerData$article5.upc) || (headerData === null || headerData === void 0 ? void 0 : headerData.upc)
47
74
  }]
48
75
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_AvatarAndValidation.AvatarAndValidation, {
49
- retailers: (headerData === null || headerData === void 0 ? void 0 : headerData.retailers) || (headerData === null || headerData === void 0 ? void 0 : headerData.retailersAvailable),
76
+ retailers: retailers,
50
77
  avatarData: headerData === null || headerData === void 0 ? void 0 : headerData.avatarData,
51
78
  validation: headerData === null || headerData === void 0 ? void 0 : headerData.validation,
52
79
  activeRetailer: activeRetailer,
@@ -36,115 +36,56 @@ ProviderProductEditionDefault.args = {
36
36
  category: 846,
37
37
  version: 2,
38
38
  productSelected: {
39
- version: 1,
40
- brand: null,
41
- missing: {
42
- datasheet: null,
43
- descriptions: null,
44
- images: null
45
- },
46
- article: {
47
- category: "ORGANIZADORES Y CLOSETS|ACCESORIOS DE LAVANDERÍA|BURROS DE PLANCHAR",
48
- company_name: "BROOKLITE MEXICO S DE RL DE CV",
49
- company_id: 409,
50
- id_category: "2520",
51
- id_article: 1,
52
- name: "SOPORTE PLANCHA-BURRO EN PUERTA",
53
- upc: "339"
54
- },
55
- asignations: [62],
56
- retailers: [{
57
- id: 61,
58
- name: "Home Depot TAB",
59
- country: "México",
60
- id_region: 1,
61
- active: 1
62
- }],
63
- percentage: 0,
39
+ id_article: 35319,
40
+ id_category: "2146",
41
+ name: "FOCO LED A19 (60W) LUZ AMARILLA",
42
+ upc: "120873",
43
+ timestamp: "2022-06-14T15:31:50.000Z",
44
+ status: "NULL",
45
+ categoryName: "ILUMINACIÓN|FOCOS|LEDS",
46
+ asignations: [],
47
+ version: 2,
48
+ version_status: "AA",
64
49
  retailersAvailable: [{
65
- id: 61,
66
- name: "Home Depot TAB",
50
+ id: 58,
51
+ name: "The Home Depot Golden",
67
52
  country: "México",
68
53
  id_region: 1,
69
54
  active: 1
70
55
  }],
71
- upc: "339",
72
- name: "SOPORTE PLANCHA-BURRO EN PUERTA",
73
- categoryName: "ORGANIZADORES Y CLOSETS|ACCESORIOS DE LAVANDERÍA|BURROS DE PLANCHAR",
74
- id_category: "2520",
75
- id_article: 1,
76
- services: [{
77
- id_article: 1,
78
- service: "datasheet",
79
- quantity: 1,
80
- price: 0,
81
- id_user: 59,
82
- datasheet_common: null,
83
- discount: null
84
- }]
56
+ missing: {
57
+ datasheet: 33,
58
+ description: 0,
59
+ image: 23
60
+ }
85
61
  },
86
62
  productToEdit: {
87
- ArticleId: 33249,
88
- idCategory: "684",
89
- product: {
90
- orderId: 7,
91
- id_category: "684",
92
- status: "RECEPTION",
93
- datasheet_status: null,
94
- prio: "none",
95
- version: 4,
96
- description_status: null,
97
- images_status: null,
98
- brand: null,
99
- missing: {
100
- datasheet: 33,
101
- descriptions: 14,
102
- images: 3
103
- },
104
- article: {
105
- category: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
106
- company_name: "COMPANY DEV",
107
- id_category: "684",
108
- id_article: 33249,
109
- name: "Crema dental ",
110
- timestamp: "2022-06-14T23:24:08.000Z",
111
- upc: "232435"
112
- },
113
- retailers: [{
114
- id: 4,
115
- name: "Walmart Super y Superama"
116
- }, {
117
- id: 9,
118
- name: "Amazon"
119
- }, {
120
- id: 1013,
121
- name: "Cencosud Colombia"
122
- }, {
123
- id: 2005,
124
- name: "ClubCo"
125
- }],
126
- services: {
127
- datasheets: 1,
128
- descriptions: 1,
129
- images: 1
130
- },
63
+ idCategory: "2146",
64
+ ArticleId: 35319,
65
+ product: [{
66
+ id_article: 35319,
67
+ id_category: "2146",
68
+ name: "FOCO LED A19 (60W) LUZ AMARILLA",
69
+ upc: "120873",
70
+ timestamp: "2022-06-14T15:31:50.000Z",
71
+ status: "NULL",
72
+ categoryName: "ILUMINACIÓN|FOCOS|LEDS",
73
+ asignations: [],
74
+ version: 2,
75
+ version_status: "AA",
131
76
  retailersAvailable: [{
132
- id: 4,
133
- name: "Walmart Super y Superama"
134
- }, {
135
- id: 9,
136
- name: "Amazon"
137
- }, {
138
- id: 1013,
139
- name: "Cencosud Colombia"
140
- }, {
141
- id: 2005,
142
- name: "ClubCo"
77
+ id: 58,
78
+ name: "The Home Depot Golden",
79
+ country: "México",
80
+ id_region: 1,
81
+ active: 1
143
82
  }],
144
- id_article: 33249,
145
- categoryName: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
146
- version_status: "RECEPTION"
147
- }
83
+ missing: {
84
+ datasheet: 33,
85
+ description: 0,
86
+ image: 23
87
+ }
88
+ }]
148
89
  },
149
90
  location: {
150
91
  product: {
@@ -110,6 +110,14 @@ var reducerImages = function reducerImages(state, action) {
110
110
  values: values
111
111
  });
112
112
 
113
+ case "deleteImage":
114
+ values = values.filter(function (value) {
115
+ return action.selectedImages.indexOf(value) === -1;
116
+ });
117
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
118
+ values: values
119
+ });
120
+
113
121
  default:
114
122
  return state;
115
123
  }
@@ -131,7 +139,7 @@ var myBucket = new _awsSdk.default.S3({
131
139
  });
132
140
 
133
141
  var ProviderProductEdition = function ProviderProductEdition(_ref) {
134
- var _product$retailers, _product$retailersAva, _location$state, _product$services2, _datasheets$, _datasheets$$data;
142
+ var _product$retailers, _product$retailersAva, _location$state, _datasheets$, _datasheets$$data;
135
143
 
136
144
  var tabsSections = _ref.tabsSections,
137
145
  _ref$productSelected = _ref.productSelected,
@@ -446,6 +454,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
446
454
  socketType = _useState80[0],
447
455
  setSocketType = _useState80[1];
448
456
 
457
+ var _useState81 = (0, _react.useState)(loading),
458
+ _useState82 = (0, _slicedToArray2.default)(_useState81, 2),
459
+ saving = _useState82[0],
460
+ setSaving = _useState82[1];
461
+
449
462
  (0, _react.useEffect)(function () {
450
463
  checkAll && setSelectedImages(images.values);
451
464
  }, [checkAll]);
@@ -469,7 +482,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
469
482
 
470
483
  setImages({
471
484
  action: "init",
472
- init: JSON.parse(sessionStorage.getItem("imagesList")) || services[2]
485
+ init: services[2]
473
486
  });
474
487
  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);
475
488
  setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
@@ -903,18 +916,19 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
903
916
  }
904
917
 
905
918
  if (!(valid && (duplicated === null || duplicated === void 0 ? void 0 : duplicated.length) === 0)) {
906
- _context8.next = 30;
919
+ _context8.next = 31;
907
920
  break;
908
921
  }
909
922
 
910
- _context8.prev = 10;
923
+ setLoading(true);
924
+ _context8.prev = 11;
911
925
  data === null || data === void 0 ? void 0 : (_data$articleData3 = data.articleData) === null || _data$articleData3 === void 0 ? void 0 : _data$articleData3.forEach(function (e) {
912
926
  e.uuid = (0, _uuid.v4)();
913
927
  });
914
928
  setDataImages(data);
915
929
 
916
930
  if (!((data === null || data === void 0 ? void 0 : (_data$articleData4 = data.articleData) === null || _data$articleData4 === void 0 ? void 0 : _data$articleData4.length) > 0)) {
917
- _context8.next = 22;
931
+ _context8.next = 23;
918
932
  break;
919
933
  }
920
934
 
@@ -930,40 +944,40 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
930
944
  };
931
945
  promiseArray.push(myBucket.putObject(params).promise());
932
946
  });
933
- _context8.next = 19;
947
+ _context8.next = 20;
934
948
  return Promise.all(promiseArray);
935
949
 
936
- case 19:
950
+ case 20:
937
951
  setImagesUploaded(true);
938
- _context8.next = 23;
952
+ _context8.next = 24;
939
953
  break;
940
954
 
941
- case 22:
955
+ case 23:
942
956
  setImagesUploaded(true);
943
957
 
944
- case 23:
945
- _context8.next = 28;
958
+ case 24:
959
+ _context8.next = 29;
946
960
  break;
947
961
 
948
- case 25:
949
- _context8.prev = 25;
950
- _context8.t0 = _context8["catch"](10);
962
+ case 26:
963
+ _context8.prev = 26;
964
+ _context8.t0 = _context8["catch"](11);
951
965
  console.log(_context8.t0); // setMainLoading(false);
952
966
 
953
- case 28:
954
- _context8.next = 31;
967
+ case 29:
968
+ _context8.next = 32;
955
969
  break;
956
970
 
957
- case 30:
971
+ case 31:
958
972
  // setMainLoading(false);
959
973
  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.");
960
974
 
961
- case 31:
975
+ case 32:
962
976
  case "end":
963
977
  return _context8.stop();
964
978
  }
965
979
  }
966
- }, _callee8, null, [[10, 25]]);
980
+ }, _callee8, null, [[11, 26]]);
967
981
  })), [images, imagesUploaded]);
968
982
  (0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee9() {
969
983
  return _regenerator.default.wrap(function _callee9$(_context9) {
@@ -971,11 +985,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
971
985
  switch (_context9.prev = _context9.next) {
972
986
  case 0:
973
987
  if (!imagesUploaded) {
974
- _context9.next = 14;
988
+ _context9.next = 13;
975
989
  break;
976
990
  }
977
991
 
978
- setLoading(true);
979
992
  dataImages.articleData = dataImages === null || dataImages === void 0 ? void 0 : dataImages.articleData.map(function (e) {
980
993
  delete e.src;
981
994
  e.imageID = e.image_id;
@@ -984,32 +997,32 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
984
997
  if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
985
998
  return e;
986
999
  });
987
- _context9.prev = 3;
988
- _context9.next = 6;
1000
+ _context9.prev = 2;
1001
+ _context9.next = 5;
989
1002
  return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?image=true&version=").concat(version), dataImages, {
990
1003
  headers: {
991
1004
  Authorization: token
992
1005
  }
993
1006
  });
994
1007
 
995
- case 6:
1008
+ case 5:
996
1009
  setMessage("Imágenes guardadas con éxito");
997
1010
  sessionStorage.removeItem("imagesList");
998
1011
  loadData();
999
- _context9.next = 14;
1012
+ _context9.next = 13;
1000
1013
  break;
1001
1014
 
1002
- case 11:
1003
- _context9.prev = 11;
1004
- _context9.t0 = _context9["catch"](3);
1015
+ case 10:
1016
+ _context9.prev = 10;
1017
+ _context9.t0 = _context9["catch"](2);
1005
1018
  console.log(_context9.t0);
1006
1019
 
1007
- case 14:
1020
+ case 13:
1008
1021
  case "end":
1009
1022
  return _context9.stop();
1010
1023
  }
1011
1024
  }
1012
- }, _callee9, null, [[3, 11]]);
1025
+ }, _callee9, null, [[2, 10]]);
1013
1026
  })), [dataImages, imagesUploaded]);
1014
1027
 
1015
1028
  var evaluationFinished = function evaluationFinished(userId, tab, statusArray) {// const srv = servicesData.filter((serv) => serv.service === getConcept(tab));
@@ -1274,7 +1287,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1274
1287
  }();
1275
1288
 
1276
1289
  var getRequired = function getRequired(services) {
1277
- var _services$4, _services$4$inputs;
1290
+ var _services$4, _services$4$retailerM, _services$5, _services$5$inputs;
1278
1291
 
1279
1292
  var objetcTemp = {};
1280
1293
  var datasheetServicesArray = Object.values(services[0]);
@@ -1308,8 +1321,18 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1308
1321
  });
1309
1322
  });
1310
1323
  objetcTemp["Descripción"] = desInputsRequired;
1311
- 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) {
1312
- return e.required;
1324
+ var retailersRequested = [];
1325
+ (_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) {
1326
+ return retMan.forEach(function (rm) {
1327
+ return retailersRequested.push(rm);
1328
+ });
1329
+ });
1330
+ 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) {
1331
+ return e.required === 1 && retailersRequested.filter(function (ret) {
1332
+ return ret.id_image === e.id && servicesData.filter(function (srv) {
1333
+ return srv.id_retailer === ret.id_retailer;
1334
+ }).length > 0;
1335
+ }).length > 0;
1313
1336
  });
1314
1337
  var requiredCounter = 0;
1315
1338
  requiredImages === null || requiredImages === void 0 ? void 0 : requiredImages.forEach(function (req) {
@@ -1445,7 +1468,6 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1445
1468
 
1446
1469
  var deleteImages = function deleteImages() {
1447
1470
  setLoading(true);
1448
- var imagesTemp = images;
1449
1471
  var values = images.values;
1450
1472
  var imgsInBack = [];
1451
1473
  selectedImages.forEach(function (selectedImg) {
@@ -1454,12 +1476,13 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1454
1476
  var imgsLeft = values.filter(function (value) {
1455
1477
  return selectedImages.indexOf(value) === -1;
1456
1478
  });
1457
- imagesTemp.values = imgsLeft;
1458
1479
 
1459
1480
  if (imgsInBack.length > 0) {
1481
+ var _product$article4;
1482
+
1460
1483
  var data = {
1461
- articleId: product.article.id_article,
1462
- deleteImages: selectedImages
1484
+ articleId: (product === null || product === void 0 ? void 0 : product.id_article) || (product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_article),
1485
+ deleteImages: imgsInBack
1463
1486
  };
1464
1487
 
1465
1488
  try {
@@ -1473,8 +1496,13 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1473
1496
  }
1474
1497
  }
1475
1498
 
1476
- sessionStorage.setItem("imagesList", JSON.stringify(imagesTemp));
1477
- loadData();
1499
+ setImages({
1500
+ action: "deleteImage",
1501
+ selectedImages: selectedImages
1502
+ });
1503
+ setTimeout(function () {
1504
+ setLoading(false);
1505
+ }, 500);
1478
1506
  setMessage("");
1479
1507
  setComponentsArray([]);
1480
1508
  };
@@ -1695,6 +1723,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1695
1723
  return true;
1696
1724
  };
1697
1725
 
1726
+ (0, _react.useEffect)(function () {
1727
+ setSaving(loading);
1728
+ }, [loading]);
1698
1729
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
1699
1730
  headerTop: headerTop,
1700
1731
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
@@ -1808,15 +1839,15 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1808
1839
  onClickSave: function onClickSave() {
1809
1840
  switch (activeTab) {
1810
1841
  case "Descripción":
1811
- saveDescriptions();
1842
+ !saving && saveDescriptions();
1812
1843
  break;
1813
1844
 
1814
1845
  case "Ficha técnica":
1815
- saveDatasheets();
1846
+ !saving && saveDatasheets();
1816
1847
  break;
1817
1848
 
1818
1849
  case "Imágenes":
1819
- updateImages();
1850
+ !saving && updateImages();
1820
1851
  break;
1821
1852
 
1822
1853
  default:
@@ -1826,7 +1857,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1826
1857
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
1827
1858
  className: "services-information-container " + (imageLayout && activeTab === "Imágenes" ? "image-services" : ""),
1828
1859
  children: loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
1829
- children: [!imageLayout && activeTab === "Imágenes" && (product === null || product === void 0 ? void 0 : (_product$services2 = product.services) === null || _product$services2 === void 0 ? void 0 : _product$services2.images) === 1 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1860
+ children: [!imageLayout && activeTab === "Imágenes" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GalleryHeader.GalleryHeader, {
1830
1861
  setSelectedImages: setSelectedImages,
1831
1862
  checkAll: checkAll,
1832
1863
  setCheckAll: setCheckAll