contentoh-components-library 21.1.88 → 21.1.89

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.
@@ -16,7 +16,7 @@ function Select(props) {
16
16
  id: props.id,
17
17
  width: props.width,
18
18
  onChange: props.onChange,
19
- defaultValue: props.valueSelected ? props.valueSelected : "",
19
+ value: props.valueSelected ? props.valueSelected : "",
20
20
  className: props.className,
21
21
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
22
22
  value: "",
@@ -22,7 +22,9 @@ var TableHeader = function TableHeader(_ref) {
22
22
  setAssignation = _ref.setAssignation,
23
23
  isRetailer = _ref.isRetailer,
24
24
  onClickSave = _ref.onClickSave,
25
- showSaveButton = _ref.showSaveButton;
25
+ showSaveButton = _ref.showSaveButton,
26
+ version = _ref.version,
27
+ setShowVersionSelector = _ref.setShowVersionSelector;
26
28
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
27
29
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
28
30
  text: (activeImage === null || activeImage === void 0 ? void 0 : activeImage.name) || "-",
@@ -34,7 +36,9 @@ var TableHeader = function TableHeader(_ref) {
34
36
  setAssignation: setAssignation,
35
37
  isRetailer: isRetailer,
36
38
  onClickSave: onClickSave,
37
- showSaveButton: showSaveButton
39
+ showSaveButton: showSaveButton,
40
+ version: version,
41
+ setShowVersionSelector: setShowVersionSelector
38
42
  })]
39
43
  });
40
44
  };
@@ -32,7 +32,9 @@ var ImageDataTable = function ImageDataTable(_ref) {
32
32
  setAssignation = _ref.setAssignation,
33
33
  isRetailer = _ref.isRetailer,
34
34
  onClickSave = _ref.onClickSave,
35
- showSaveButton = _ref.showSaveButton;
35
+ showSaveButton = _ref.showSaveButton,
36
+ version = _ref.version,
37
+ setShowVersionSelector = _ref.setShowVersionSelector;
36
38
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
37
39
  darkMode: darkMode,
38
40
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_TableHeader.TableHeader, {
@@ -42,7 +44,9 @@ var ImageDataTable = function ImageDataTable(_ref) {
42
44
  setAssignation: setAssignation,
43
45
  isRetailer: isRetailer,
44
46
  showSaveButton: showSaveButton,
45
- onClickSave: onClickSave
47
+ onClickSave: onClickSave,
48
+ version: version,
49
+ setShowVersionSelector: setShowVersionSelector
46
50
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles2.Container, {
47
51
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
48
52
  headerType: "table-row-text",
@@ -15,10 +15,10 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
15
15
 
16
16
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
17
17
 
18
- var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
19
-
20
18
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
21
19
 
20
+ var _objectSpread3 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
21
+
22
22
  var _styles = require("./styles");
23
23
 
24
24
  var _HeaderTop = require("../../molecules/HeaderTop");
@@ -104,12 +104,27 @@ var _CreateVersion = require("../../organisms/CreateVersion");
104
104
  var _jsxRuntime = require("react/jsx-runtime");
105
105
 
106
106
  var reducerImages = function reducerImages(state, action) {
107
+ var _action$init, _action$init$inputsBy;
108
+
107
109
  var values = state.values,
108
- attrForImgs = state.attrForImgs;
110
+ attrForImgs = state.attrForImgs,
111
+ inputsByRetailer = state.inputsByRetailer;
109
112
 
110
113
  switch (action.action) {
111
114
  case "init":
112
- return action.init;
115
+ var newInputsByRetailer = {};
116
+ action === null || action === void 0 ? void 0 : (_action$init = action.init) === null || _action$init === void 0 ? void 0 : (_action$init$inputsBy = _action$init.inputsByRetailer) === null || _action$init$inputsBy === void 0 ? void 0 : _action$init$inputsBy.forEach(function (inputs) {
117
+ inputs === null || inputs === void 0 ? void 0 : inputs.forEach(function (input) {
118
+ if (!newInputsByRetailer["".concat(input.id_retailer)]) newInputsByRetailer["".concat(input.id_retailer)] = [];
119
+ newInputsByRetailer["".concat(input.id_retailer)].push(input);
120
+ });
121
+ });
122
+ inputsByRetailer = newInputsByRetailer;
123
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, action.init), {}, {
124
+ inputsByRetailer: inputsByRetailer,
125
+ valuesInitial: action.init.values,
126
+ inputsInitial: action.init.inputs
127
+ });
113
128
 
114
129
  case "addImg":
115
130
  values = [].concat((0, _toConsumableArray2.default)(values), [action.img]);
@@ -124,7 +139,14 @@ var reducerImages = function reducerImages(state, action) {
124
139
  });
125
140
 
126
141
  case "changeAttrValue":
127
- attrForImgs[action.retailer][action.index].value = action.value;
142
+ var index = attrForImgs.general.findIndex(function (f) {
143
+ return f.id = action.id;
144
+ });
145
+
146
+ if (index !== -1) {
147
+ attrForImgs.general[index].value = action.value;
148
+ }
149
+
128
150
  return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
129
151
  attrForImgs: attrForImgs,
130
152
  values: values
@@ -138,6 +160,32 @@ var reducerImages = function reducerImages(state, action) {
138
160
  values: values
139
161
  });
140
162
 
163
+ case "orderImages":
164
+ {
165
+ var _inputsByRetailer$act;
166
+
167
+ var _inputsByRetailer = state.inputsByRetailer,
168
+ valuesInitial = state.valuesInitial,
169
+ inputsInitial = state.inputsInitial,
170
+ inputs = state.inputs;
171
+ var orderedImages = [];
172
+ var imageIdArray = [];
173
+ action.retailerId && ((_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
174
+ imageIdArray.push(input.id_image);
175
+ valuesInitial.forEach(function (value) {
176
+ if (value.image_id === input.id_image) orderedImages.push(value);
177
+ });
178
+ }));
179
+ inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
180
+ return imageIdArray.includes(input.id);
181
+ });
182
+ values = orderedImages.length > 0 ? orderedImages : valuesInitial;
183
+ return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
184
+ values: values,
185
+ inputs: inputs
186
+ });
187
+ }
188
+
141
189
  default:
142
190
  return state;
143
191
  }
@@ -692,6 +740,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
692
740
 
693
741
  (0, _react.useEffect)(function () {
694
742
  loadInputs();
743
+ setImages({
744
+ action: "orderImages",
745
+ retailerId: activeRetailer.id
746
+ });
695
747
  }, [servicesData, activeRetailer, services]);
696
748
 
697
749
  var thumbs = function thumbs() {
@@ -1636,7 +1688,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
1636
1688
  var _product$services;
1637
1689
 
1638
1690
  return (product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.images) === 1 && updateImages();
1639
- }
1691
+ },
1692
+ setShowVersionSelector: setShowVersionSelector,
1693
+ version: version
1640
1694
  })]
1641
1695
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1642
1696
  className: "product-information",
@@ -31,59 +31,85 @@ RetailerProductEditionDefault.args = {
31
31
  "Ficha técnica": false,
32
32
  Imágenes: false
33
33
  },
34
- token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJhNmM0ZDNkNi0yNGE0LTQxZDQtYWQwZi1kMDg3NDM4YWI1YjYiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYX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  productSelected: {
36
36
  services: {
37
- datasheets: 1,
38
- descriptions: 1,
37
+ datasheets: 0,
38
+ descriptions: 0,
39
39
  images: 1
40
40
  },
41
- orderId: 2426,
42
- status: "AS",
43
- datasheet_status: "AS",
41
+ orderId: 82,
42
+ status: "AA",
43
+ datasheet_status: "NS",
44
44
  prio: "none",
45
45
  version: 2,
46
- description_status: "AS",
47
- images_status: "AS",
46
+ description_status: "NS",
47
+ images_status: "AA",
48
48
  article: {
49
- id_article: 78738,
50
- id_category: "2427",
51
- name: "INTERRUPTOR TERMOMAGNETICO IUSA 2P 15A",
52
- upc: "157126",
53
- timestamp: "2022-08-01T18:28:05.000Z",
54
- id_user: 651,
49
+ id_article: 55147,
50
+ id_category: "157",
51
+ name: "Lavatrastes Axion ",
52
+ upc: "977358",
53
+ timestamp: "2022-06-21T17:37:05.000Z",
54
+ id_user: 28,
55
55
  status: "NULL",
56
56
  active: 1,
57
- company_id: 388,
58
- SKU: null,
59
- Descripcion: null,
60
- Proveedor: null,
61
- id_proveedor: 0,
62
- company_name: "",
63
- country: null,
64
- id_order: 2426,
65
- id_datasheet_especialist: 1248,
66
- id_datasheet_facilitator: 1252,
67
- id_description_especialist: 1248,
68
- id_description_facilitator: 1252,
69
- id_images_especialist: 1251,
70
- id_images_facilitator: 1286,
71
- id_auditor: 1254,
57
+ company_id: 1,
58
+ company_name: "COMPANY DEV",
59
+ country: "México",
60
+ id_order: 82,
61
+ id_datasheet_especialist: 54,
62
+ id_datasheet_facilitator: 52,
63
+ id_description_especialist: 54,
64
+ id_description_facilitator: 52,
65
+ id_images_especialist: 55,
66
+ id_images_facilitator: 53,
67
+ id_auditor: 30,
72
68
  id_recepcionist: null,
73
- category: "Eléctrico|Centros de Carga e Interruptores|Interruptores de Seguridad",
74
- missingAttributes: null,
75
- missingDescriptions: null,
76
- missingImages: null
69
+ category: "Consumibles|Productos de Limpieza y Lavandería|Jabones y Lavatrastes",
70
+ missingAttributes: 0,
71
+ missingDescriptions: 0,
72
+ missingImages: 0
77
73
  },
78
74
  retailers: [{
79
- id: 58,
80
- name: "The Home Depot Golden",
81
- country: "México",
82
- id_region: 1,
83
- active: 1
75
+ id: 3,
76
+ name: "Sam´s Club"
77
+ }, {
78
+ id: 4,
79
+ name: "Walmart Super y Superama"
80
+ }, {
81
+ id: 5,
82
+ name: "Chedraui"
83
+ }, {
84
+ id: 6,
85
+ name: "HEB"
86
+ }, {
87
+ id: 12,
88
+ name: "La Comer"
89
+ }, {
90
+ id: 13,
91
+ name: "Soriana"
92
+ }, {
93
+ id: 17,
94
+ name: "Genérico"
95
+ }, {
96
+ id: 20,
97
+ name: "Cornershop"
98
+ }, {
99
+ id: 26,
100
+ name: "Mercado Libre"
101
+ }, {
102
+ id: 34,
103
+ name: "San Pablo"
104
+ }, {
105
+ id: 38,
106
+ name: "Del Sol"
107
+ }, {
108
+ id: 64,
109
+ name: "Cali"
84
110
  }],
85
- country: null,
86
- upc: "157126"
111
+ country: "México",
112
+ upc: "977358"
87
113
  },
88
114
  location: {
89
115
  product: {
@@ -92,16 +118,16 @@ RetailerProductEditionDefault.args = {
92
118
  }
93
119
  },
94
120
  user: {
95
- id_user: 460,
96
- name: "Ismael",
97
- last_name: "López",
98
- email: "ilopez@contentoh.com",
99
- position: "Desarrollador",
121
+ id_user: 30,
122
+ name: "Admin",
123
+ last_name: "Ulises",
124
+ email: "salmeron.5@hotmail.com",
125
+ position: "Admin",
100
126
  telephone: null,
101
127
  country: "México",
102
- id_company: 254,
103
- id_cognito: "9d0cc5c8-a89e-4bdd-9e2d-358a01cc9a62",
104
- birth_Date: "1997-08-15T00:00:00.000Z",
128
+ id_company: 2,
129
+ id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
130
+ birth_Date: null,
105
131
  about_me: null,
106
132
  zip_code: null,
107
133
  address: null,
@@ -110,18 +136,18 @@ RetailerProductEditionDefault.args = {
110
136
  id_role: 1,
111
137
  active: 1,
112
138
  is_retailer: 0,
113
- email_notify: null,
139
+ email_notify: 0,
114
140
  membership: {
115
- id: 750,
116
- start_date: "2022-01-07T21:32:54.000Z",
117
- end_date: "2023-01-07T21:32:54.000Z",
118
- planID: 6,
119
- plan: "prod_KvGd6YSTJyR3AP",
120
- name: "Plan Small",
121
- user_limit: "10",
122
- products_limit: "1000",
123
- type: "Enterprise"
141
+ id: 2,
142
+ start_date: "2021-11-05T02:35:12.000Z",
143
+ end_date: "2022-11-05T02:34:49.000Z",
144
+ planID: 1,
145
+ plan: "prod_KtkvuFFLpOdP6e",
146
+ name: "Plan Free",
147
+ user_limit: "1",
148
+ products_limit: "3",
149
+ type: "PyMES"
124
150
  },
125
- src: "https://content-management-profile-prod.s3.amazonaws.com/id-460/460.png?1659463389000"
151
+ src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1659497033479"
126
152
  }
127
153
  };
@@ -13,10 +13,10 @@ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/
13
13
 
14
14
  var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
15
15
 
16
- var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
17
-
18
16
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
19
17
 
18
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
19
+
20
20
  var _styles = require("./styles");
21
21
 
22
22
  var _HeaderTop = require("../../molecules/HeaderTop");
@@ -82,12 +82,27 @@ var _CreateVersion = require("../../organisms/CreateVersion");
82
82
  var _jsxRuntime = require("react/jsx-runtime");
83
83
 
84
84
  var reducerImages = function reducerImages(state, action) {
85
+ var _action$init, _action$init$inputsBy;
86
+
85
87
  var values = state.values,
86
- attrForImgs = state.attrForImgs;
88
+ attrForImgs = state.attrForImgs,
89
+ inputsByRetailer = state.inputsByRetailer;
87
90
 
88
91
  switch (action.action) {
89
92
  case "init":
90
- return action.init;
93
+ var newInputsByRetailer = {};
94
+ action === null || action === void 0 ? void 0 : (_action$init = action.init) === null || _action$init === void 0 ? void 0 : (_action$init$inputsBy = _action$init.inputsByRetailer) === null || _action$init$inputsBy === void 0 ? void 0 : _action$init$inputsBy.forEach(function (inputs) {
95
+ inputs === null || inputs === void 0 ? void 0 : inputs.forEach(function (input) {
96
+ if (!newInputsByRetailer["".concat(input.id_retailer)]) newInputsByRetailer["".concat(input.id_retailer)] = [];
97
+ newInputsByRetailer["".concat(input.id_retailer)].push(input);
98
+ });
99
+ });
100
+ inputsByRetailer = newInputsByRetailer;
101
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, action.init), {}, {
102
+ inputsByRetailer: inputsByRetailer,
103
+ valuesInitial: action.init.values,
104
+ inputsInitial: action.init.inputs
105
+ });
91
106
 
92
107
  case "addImg":
93
108
  values = [].concat((0, _toConsumableArray2.default)(values), [action.img]);
@@ -123,6 +138,32 @@ var reducerImages = function reducerImages(state, action) {
123
138
  values: values
124
139
  });
125
140
 
141
+ case "orderImages":
142
+ {
143
+ var _inputsByRetailer$act;
144
+
145
+ var _inputsByRetailer = state.inputsByRetailer,
146
+ valuesInitial = state.valuesInitial,
147
+ inputsInitial = state.inputsInitial,
148
+ inputs = state.inputs;
149
+ var orderedImages = [];
150
+ var imageIdArray = [];
151
+ action.retailerId && ((_inputsByRetailer$act = _inputsByRetailer[action.retailerId]) === null || _inputsByRetailer$act === void 0 ? void 0 : _inputsByRetailer$act.filter(function (input) {
152
+ imageIdArray.push(input.id_image);
153
+ valuesInitial.forEach(function (value) {
154
+ if (value.image_id === input.id_image) orderedImages.push(value);
155
+ });
156
+ }));
157
+ inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
158
+ return imageIdArray.includes(input.id);
159
+ });
160
+ values = orderedImages.length > 0 ? orderedImages : valuesInitial;
161
+ return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
162
+ values: values,
163
+ inputs: inputs
164
+ });
165
+ }
166
+
126
167
  default:
127
168
  return state;
128
169
  }
@@ -663,6 +704,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
663
704
  setDatasheets([datagroups, inputs]);
664
705
  setDescriptions(_descriptions);
665
706
  }
707
+
708
+ setImages({
709
+ action: "orderImages",
710
+ retailerId: activeRetailer.id
711
+ });
666
712
  }, [activeRetailer, services]);
667
713
 
668
714
  var thumbs = function thumbs() {
@@ -696,7 +742,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
696
742
  changeImage: setImages,
697
743
  selectedImages: selectedImages,
698
744
  setSelectedImages: setSelectedImages
699
- }, index);
745
+ }, index + "-" + imageType.name);
700
746
  });
701
747
  };
702
748
 
@@ -834,11 +880,13 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
834
880
  var _images$inputs;
835
881
 
836
882
  var imageInputs = images === null || images === void 0 ? void 0 : (_images$inputs = images.inputs) === null || _images$inputs === void 0 ? void 0 : _images$inputs.map(function (e) {
883
+ var _images$values2;
884
+
837
885
  return {
838
886
  value: e === null || e === void 0 ? void 0 : e.id,
839
887
  name: e === null || e === void 0 ? void 0 : e.name,
840
888
  required: e === null || e === void 0 ? void 0 : e.required,
841
- active: images === null || images === void 0 ? void 0 : images.values.some(function (value) {
889
+ active: images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.some(function (value) {
842
890
  return (value === null || value === void 0 ? void 0 : value.image_id) === (e === null || e === void 0 ? void 0 : e.id);
843
891
  })
844
892
  };
@@ -846,7 +894,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
846
894
  setSocketType(imageInputs);
847
895
  }, [images]);
848
896
  var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
849
- var _images$values2, _product$article11, _data$articleData, _data$articleData2, _data$updateImages;
897
+ var _images$values3, _product$article11, _data$articleData, _data$articleData2, _data$updateImages;
850
898
 
851
899
  var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
852
900
 
@@ -854,7 +902,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
854
902
  while (1) {
855
903
  switch (_context7.prev = _context7.next) {
856
904
  case 0:
857
- imagesList = images === null || images === void 0 ? void 0 : (_images$values2 = images.values) === null || _images$values2 === void 0 ? void 0 : _images$values2.slice();
905
+ imagesList = images === null || images === void 0 ? void 0 : (_images$values3 = images.values) === null || _images$values3 === void 0 ? void 0 : _images$values3.slice();
858
906
  imagesListTemp = imagesList === null || imagesList === void 0 ? void 0 : imagesList.reduce(function (acc, image) {
859
907
  acc[image === null || image === void 0 ? void 0 : image.image_id] = ++acc[image === null || image === void 0 ? void 0 : image.image_id] || 0;
860
908
  return acc;
@@ -1476,13 +1524,13 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1476
1524
  }();
1477
1525
 
1478
1526
  var downloadImages = function downloadImages() {
1479
- var _images$values3;
1527
+ var _images$values4;
1480
1528
 
1481
1529
  selectedImages.length > 0 ? selectedImages.forEach(function (e) {
1482
1530
  if (e.id) {
1483
1531
  (0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.article.upc, "_").concat(e.name, ".").concat(e.ext));
1484
1532
  }
1485
- }) : images === null || images === void 0 ? void 0 : (_images$values3 = images.values) === null || _images$values3 === void 0 ? void 0 : _images$values3.forEach(function (e) {
1533
+ }) : images === null || images === void 0 ? void 0 : (_images$values4 = images.values) === null || _images$values4 === void 0 ? void 0 : _images$values4.forEach(function (e) {
1486
1534
  if (e.id) {
1487
1535
  (0, _fileSaver.saveAs)("https://".concat(process.env.REACT_APP_IMAGES_BUCKET, ".s3.amazonaws.com/").concat(e.srcDB), "".concat(product.article.upc, "_").concat(e.name, ".").concat(e.ext));
1488
1536
  }
@@ -1693,7 +1741,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1693
1741
 
1694
1742
  return (product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.images) === 1 && updateImages();
1695
1743
  },
1696
- showSaveButton: auditorAssigned() || userAssigned()
1744
+ showSaveButton: auditorAssigned() || userAssigned(),
1745
+ setShowVersionSelector: setShowVersionSelector,
1746
+ version: version
1697
1747
  })]
1698
1748
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1699
1749
  className: "product-information",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.1.88",
3
+ "version": "21.1.89",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -7,7 +7,7 @@ export default function Select(props) {
7
7
  id={props.id}
8
8
  width={props.width}
9
9
  onChange={props.onChange}
10
- defaultValue={props.valueSelected ? props.valueSelected : ""}
10
+ value={props.valueSelected ? props.valueSelected : ""}
11
11
  className={props.className}
12
12
  >
13
13
  <option value="" disabled>
@@ -11,6 +11,8 @@ export const TableHeader = ({
11
11
  isRetailer,
12
12
  onClickSave,
13
13
  showSaveButton,
14
+ version,
15
+ setShowVersionSelector,
14
16
  }) => {
15
17
  return (
16
18
  <Container>
@@ -26,6 +28,8 @@ export const TableHeader = ({
26
28
  isRetailer={isRetailer}
27
29
  onClickSave={onClickSave}
28
30
  showSaveButton={showSaveButton}
31
+ version={version}
32
+ setShowVersionSelector={setShowVersionSelector}
29
33
  />
30
34
  </Container>
31
35
  );
@@ -16,6 +16,8 @@ export const ImageDataTable = ({
16
16
  isRetailer,
17
17
  onClickSave,
18
18
  showSaveButton,
19
+ version,
20
+ setShowVersionSelector,
19
21
  }) => {
20
22
  return (
21
23
  <Container darkMode={darkMode}>
@@ -27,6 +29,8 @@ export const ImageDataTable = ({
27
29
  isRetailer={isRetailer}
28
30
  showSaveButton={showSaveButton}
29
31
  onClickSave={onClickSave}
32
+ version={version}
33
+ setShowVersionSelector={setShowVersionSelector}
30
34
  />
31
35
  <Row>
32
36
  <ScreenHeader headerType={"table-row-text"} text="Tipo de toma" />
@@ -45,10 +45,24 @@ import { useCloseModal } from "../../../global-files/customHooks";
45
45
  import { CreateVersion } from "../../organisms/CreateVersion";
46
46
 
47
47
  const reducerImages = (state, action) => {
48
- let { values, attrForImgs } = state;
48
+ let { values, attrForImgs, inputsByRetailer } = state;
49
49
  switch (action.action) {
50
50
  case "init":
51
- return action.init;
51
+ const newInputsByRetailer = {};
52
+ action?.init?.inputsByRetailer?.forEach((inputs) => {
53
+ inputs?.forEach((input) => {
54
+ if (!newInputsByRetailer[`${input.id_retailer}`])
55
+ newInputsByRetailer[`${input.id_retailer}`] = [];
56
+ newInputsByRetailer[`${input.id_retailer}`].push(input);
57
+ });
58
+ });
59
+ inputsByRetailer = newInputsByRetailer;
60
+ return {
61
+ ...action.init,
62
+ inputsByRetailer,
63
+ valuesInitial: action.init.values,
64
+ inputsInitial: action.init.inputs,
65
+ };
52
66
  case "addImg":
53
67
  values = [...values, action.img];
54
68
  return { ...state, values };
@@ -56,18 +70,40 @@ const reducerImages = (state, action) => {
56
70
  values[action.index][action.attribute] = action.value;
57
71
  return { ...state, values };
58
72
  case "changeAttrValue":
59
- attrForImgs[action.retailer][action.index].value = action.value;
73
+ const index = attrForImgs.general.findIndex((f) => (f.id = action.id));
74
+ if (index !== -1) {
75
+ attrForImgs.general[index].value = action.value;
76
+ }
77
+
60
78
  return { ...state, attrForImgs, values };
61
79
  case "deleteImage":
62
80
  values = values.filter(
63
81
  (value) => action.selectedImages.indexOf(value) === -1
64
82
  );
65
83
  return { ...state, values };
84
+ case "orderImages": {
85
+ let { inputsByRetailer, valuesInitial, inputsInitial, inputs } = state;
86
+ const orderedImages = [];
87
+ const imageIdArray = [];
88
+ action.retailerId &&
89
+ inputsByRetailer[action.retailerId]?.filter((input) => {
90
+ imageIdArray.push(input.id_image);
91
+ valuesInitial.forEach((value) => {
92
+ if (value.image_id === input.id_image) orderedImages.push(value);
93
+ });
94
+ });
95
+
96
+ inputs = inputsInitial?.filter((input) =>
97
+ imageIdArray.includes(input.id)
98
+ );
99
+
100
+ values = orderedImages.length > 0 ? orderedImages : valuesInitial;
101
+ return { ...state, values, inputs };
102
+ }
66
103
  default:
67
104
  return state;
68
105
  }
69
106
  };
70
-
71
107
  const S3_BUCKET = process.env.REACT_APP_IMAGES_BUCKET;
72
108
  const REGION = "us-east-1";
73
109
 
@@ -355,6 +391,7 @@ export const ProviderProductEdition = ({
355
391
 
356
392
  useEffect(() => {
357
393
  loadInputs();
394
+ setImages({ action: "orderImages", retailerId: activeRetailer.id });
358
395
  }, [servicesData, activeRetailer, services]);
359
396
 
360
397
  const thumbs = () => {
@@ -1041,6 +1078,8 @@ export const ProviderProductEdition = ({
1041
1078
  onClickSave={() =>
1042
1079
  product?.services?.images === 1 && updateImages()
1043
1080
  }
1081
+ setShowVersionSelector={setShowVersionSelector}
1082
+ version={version}
1044
1083
  />
1045
1084
  </div>
1046
1085
  <div className="product-information">
@@ -16,77 +16,114 @@ RetailerProductEditionDefault.args = {
16
16
  Imágenes: false,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJhNmM0ZDNkNi0yNGE0LTQxZDQtYWQwZi1kMDg3NDM4YWI1YjYiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6ImE2YzRkM2Q2LTI0YTQtNDFk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
  images: 1,
25
25
  },
26
- orderId: 2426,
27
- status: "AS",
28
- datasheet_status: "AS",
26
+ orderId: 82,
27
+ status: "AA",
28
+ datasheet_status: "NS",
29
29
  prio: "none",
30
30
  version: 2,
31
- description_status: "AS",
32
- images_status: "AS",
31
+ description_status: "NS",
32
+ images_status: "AA",
33
33
  article: {
34
- id_article: 78738,
35
- id_category: "2427",
36
- name: "INTERRUPTOR TERMOMAGNETICO IUSA 2P 15A",
37
- upc: "157126",
38
- timestamp: "2022-08-01T18:28:05.000Z",
39
- id_user: 651,
34
+ id_article: 55147,
35
+ id_category: "157",
36
+ name: "Lavatrastes Axion ",
37
+ upc: "977358",
38
+ timestamp: "2022-06-21T17:37:05.000Z",
39
+ id_user: 28,
40
40
  status: "NULL",
41
41
  active: 1,
42
- company_id: 388,
43
- SKU: null,
44
- Descripcion: null,
45
- Proveedor: null,
46
- id_proveedor: 0,
47
- company_name: "",
48
- country: null,
49
- id_order: 2426,
50
- id_datasheet_especialist: 1248,
51
- id_datasheet_facilitator: 1252,
52
- id_description_especialist: 1248,
53
- id_description_facilitator: 1252,
54
- id_images_especialist: 1251,
55
- id_images_facilitator: 1286,
56
- id_auditor: 1254,
42
+ company_id: 1,
43
+ company_name: "COMPANY DEV",
44
+ country: "México",
45
+ id_order: 82,
46
+ id_datasheet_especialist: 54,
47
+ id_datasheet_facilitator: 52,
48
+ id_description_especialist: 54,
49
+ id_description_facilitator: 52,
50
+ id_images_especialist: 55,
51
+ id_images_facilitator: 53,
52
+ id_auditor: 30,
57
53
  id_recepcionist: null,
58
54
  category:
59
- "Eléctrico|Centros de Carga e Interruptores|Interruptores de Seguridad",
60
- missingAttributes: null,
61
- missingDescriptions: null,
62
- missingImages: null,
55
+ "Consumibles|Productos de Limpieza y Lavandería|Jabones y Lavatrastes",
56
+ missingAttributes: 0,
57
+ missingDescriptions: 0,
58
+ missingImages: 0,
63
59
  },
64
60
  retailers: [
65
61
  {
66
- id: 58,
67
- name: "The Home Depot Golden",
68
- country: "México",
69
- id_region: 1,
70
- active: 1,
62
+ id: 3,
63
+ name: "Sam´s Club",
64
+ },
65
+ {
66
+ id: 4,
67
+ name: "Walmart Super y Superama",
68
+ },
69
+ {
70
+ id: 5,
71
+ name: "Chedraui",
72
+ },
73
+ {
74
+ id: 6,
75
+ name: "HEB",
76
+ },
77
+ {
78
+ id: 12,
79
+ name: "La Comer",
80
+ },
81
+ {
82
+ id: 13,
83
+ name: "Soriana",
84
+ },
85
+ {
86
+ id: 17,
87
+ name: "Genérico",
88
+ },
89
+ {
90
+ id: 20,
91
+ name: "Cornershop",
92
+ },
93
+ {
94
+ id: 26,
95
+ name: "Mercado Libre",
96
+ },
97
+ {
98
+ id: 34,
99
+ name: "San Pablo",
100
+ },
101
+ {
102
+ id: 38,
103
+ name: "Del Sol",
104
+ },
105
+ {
106
+ id: 64,
107
+ name: "Cali",
71
108
  },
72
109
  ],
73
- country: null,
74
- upc: "157126",
110
+ country: "México",
111
+ upc: "977358",
75
112
  },
76
113
  location: {
77
114
  product: { articleId: 109485, versionId: 3 },
78
115
  },
79
116
  user: {
80
- id_user: 460,
81
- name: "Ismael",
82
- last_name: "López",
83
- email: "ilopez@contentoh.com",
84
- position: "Desarrollador",
117
+ id_user: 30,
118
+ name: "Admin",
119
+ last_name: "Ulises",
120
+ email: "salmeron.5@hotmail.com",
121
+ position: "Admin",
85
122
  telephone: null,
86
123
  country: "México",
87
- id_company: 254,
88
- id_cognito: "9d0cc5c8-a89e-4bdd-9e2d-358a01cc9a62",
89
- birth_Date: "1997-08-15T00:00:00.000Z",
124
+ id_company: 2,
125
+ id_cognito: "c94a7305-9365-46ff-a423-4b4bc3b8b180",
126
+ birth_Date: null,
90
127
  about_me: null,
91
128
  zip_code: null,
92
129
  address: null,
@@ -95,18 +132,18 @@ RetailerProductEditionDefault.args = {
95
132
  id_role: 1,
96
133
  active: 1,
97
134
  is_retailer: 0,
98
- email_notify: null,
135
+ email_notify: 0,
99
136
  membership: {
100
- id: 750,
101
- start_date: "2022-01-07T21:32:54.000Z",
102
- end_date: "2023-01-07T21:32:54.000Z",
103
- planID: 6,
104
- plan: "prod_KvGd6YSTJyR3AP",
105
- name: "Plan Small",
106
- user_limit: "10",
107
- products_limit: "1000",
108
- type: "Enterprise",
137
+ id: 2,
138
+ start_date: "2021-11-05T02:35:12.000Z",
139
+ end_date: "2022-11-05T02:34:49.000Z",
140
+ planID: 1,
141
+ plan: "prod_KtkvuFFLpOdP6e",
142
+ name: "Plan Free",
143
+ user_limit: "1",
144
+ products_limit: "3",
145
+ type: "PyMES",
109
146
  },
110
- src: "https://content-management-profile-prod.s3.amazonaws.com/id-460/460.png?1659463389000",
147
+ src: "https://content-management-profile.s3.amazonaws.com/id-30/30.png?1659497033479",
111
148
  },
112
149
  };
@@ -35,10 +35,24 @@ import { useCloseModal } from "../../../global-files/customHooks";
35
35
  import { CreateVersion } from "../../organisms/CreateVersion";
36
36
 
37
37
  const reducerImages = (state, action) => {
38
- let { values, attrForImgs } = state;
38
+ let { values, attrForImgs, inputsByRetailer } = state;
39
39
  switch (action.action) {
40
40
  case "init":
41
- return action.init;
41
+ const newInputsByRetailer = {};
42
+ action?.init?.inputsByRetailer?.forEach((inputs) => {
43
+ inputs?.forEach((input) => {
44
+ if (!newInputsByRetailer[`${input.id_retailer}`])
45
+ newInputsByRetailer[`${input.id_retailer}`] = [];
46
+ newInputsByRetailer[`${input.id_retailer}`].push(input);
47
+ });
48
+ });
49
+ inputsByRetailer = newInputsByRetailer;
50
+ return {
51
+ ...action.init,
52
+ inputsByRetailer,
53
+ valuesInitial: action.init.values,
54
+ inputsInitial: action.init.inputs,
55
+ };
42
56
  case "addImg":
43
57
  values = [...values, action.img];
44
58
  return { ...state, values };
@@ -57,6 +71,25 @@ const reducerImages = (state, action) => {
57
71
  (value) => action.selectedImages.indexOf(value) === -1
58
72
  );
59
73
  return { ...state, values };
74
+ case "orderImages": {
75
+ let { inputsByRetailer, valuesInitial, inputsInitial, inputs } = state;
76
+ const orderedImages = [];
77
+ const imageIdArray = [];
78
+ action.retailerId &&
79
+ inputsByRetailer[action.retailerId]?.filter((input) => {
80
+ imageIdArray.push(input.id_image);
81
+ valuesInitial.forEach((value) => {
82
+ if (value.image_id === input.id_image) orderedImages.push(value);
83
+ });
84
+ });
85
+
86
+ inputs = inputsInitial?.filter((input) =>
87
+ imageIdArray.includes(input.id)
88
+ );
89
+
90
+ values = orderedImages.length > 0 ? orderedImages : valuesInitial;
91
+ return { ...state, values, inputs };
92
+ }
60
93
  default:
61
94
  return state;
62
95
  }
@@ -356,6 +389,7 @@ export const RetailerProductEdition = ({
356
389
  setDatasheets([datagroups, inputs]);
357
390
  setDescriptions(descriptions);
358
391
  }
392
+ setImages({ action: "orderImages", retailerId: activeRetailer.id });
359
393
  }, [activeRetailer, services]);
360
394
 
361
395
  const thumbs = () => {
@@ -371,7 +405,7 @@ export const RetailerProductEdition = ({
371
405
  return images?.values?.map((image, index) => (
372
406
  <GalleryElement
373
407
  setCheckAll={setCheckAll}
374
- key={index}
408
+ key={index + "-" + imageType.name}
375
409
  image={image}
376
410
  gridLayout={imageLayout}
377
411
  id={"gallery-element-" + index}
@@ -461,7 +495,7 @@ export const RetailerProductEdition = ({
461
495
  value: e?.id,
462
496
  name: e?.name,
463
497
  required: e?.required,
464
- active: images?.values.some((value) => value?.image_id === e?.id),
498
+ active: images?.values?.some((value) => value?.image_id === e?.id),
465
499
  }));
466
500
  setSocketType(imageInputs);
467
501
  }, [images]);
@@ -1143,6 +1177,8 @@ export const RetailerProductEdition = ({
1143
1177
  product?.services?.images === 1 && updateImages()
1144
1178
  }
1145
1179
  showSaveButton={auditorAssigned() || userAssigned()}
1180
+ setShowVersionSelector={setShowVersionSelector}
1181
+ version={version}
1146
1182
  />
1147
1183
  </div>
1148
1184
  <div className="product-information">