contentoh-components-library 21.1.93 → 21.1.96

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.
@@ -62,7 +62,6 @@ var InputFormatter = function InputFormatter(_ref) {
62
62
  var maxLength = maxChar ? maxChar : 999;
63
63
 
64
64
  var getValue = function getValue(value) {
65
- console.log(value);
66
65
  var temp = value.replace(/\n/gm, "<br>").replace(/\&(nbsp;|amp;)/gm, " ");
67
66
  return temp;
68
67
  }; //const quillRef = useRef();
@@ -36,92 +36,144 @@ ProviderProductEditionDefault.args = {
36
36
  category: 846,
37
37
  version: 2,
38
38
  productSelected: {
39
- orderId: 2446,
40
- article_status: "AP",
41
- datasheet_status: "AP",
42
- description_status: "AP",
43
- images_status: "ACA",
44
- prio: "none",
45
- version: 2,
46
- brand: null,
39
+ articleStatus: "ACA",
40
+ version: 5,
41
+ missing: {},
47
42
  article: {
48
- category: "Organizadores y Closets|Accesorios de Lavandería|Organizadores de Lavandería",
49
- company_name: "WOMEX SA DE CV",
50
- id_company: 424,
51
- country: null,
52
- id_category: "2522",
53
- id_article: 78773,
54
- name: "RACK PARA ROPA DOBLE NEGRO",
55
- upc: "168462"
43
+ category: "Materiales de Construcción|Impermeabilizantes y Recubrimientos|Selladores",
44
+ company_name: "SIKA MEXICANA S.A. DE C.V.",
45
+ company_id: 383,
46
+ id_category: "2249",
47
+ id_article: 29457,
48
+ name: "SIKA TECHO FRESCO SUPER 15",
49
+ upc: "111187"
56
50
  },
51
+ asignations: [],
57
52
  retailers: [{
58
53
  id: 58,
59
- name: "The Home Depot Golden"
54
+ name: "The Home Depot Golden",
55
+ country: "México",
56
+ id_region: 1,
57
+ active: 1
58
+ }, {
59
+ id: 59,
60
+ name: "The Home Depot Platinum",
61
+ country: "México",
62
+ id_region: 1,
63
+ active: 1
64
+ }, {
65
+ id: 61,
66
+ name: "Home Depot TAB",
67
+ country: "México",
68
+ id_region: 1,
69
+ active: 1
60
70
  }],
61
- services: {
62
- datasheets: 1,
63
- descriptions: 1,
64
- images: 1
65
- },
66
- statusByRetailer: {
67
- 58: {
68
- datasheet: "AP",
69
- description: "AP",
70
- images: "ACA"
71
- }
72
- },
73
- retailersWithService: ["58"],
74
- id_article: 78773,
71
+ percentage: 33.35,
75
72
  retailersAvailable: [{
76
73
  id: 58,
77
- name: "The Home Depot Golden"
74
+ name: "The Home Depot Golden",
75
+ country: "México",
76
+ id_region: 1,
77
+ active: 1
78
+ }, {
79
+ id: 59,
80
+ name: "The Home Depot Platinum",
81
+ country: "México",
82
+ id_region: 1,
83
+ active: 1
84
+ }, {
85
+ id: 61,
86
+ name: "Home Depot TAB",
87
+ country: "México",
88
+ id_region: 1,
89
+ active: 1
90
+ }],
91
+ upc: "111187",
92
+ name: "SIKA TECHO FRESCO SUPER 15",
93
+ categoryName: "Materiales de Construcción|Impermeabilizantes y Recubrimientos|Selladores",
94
+ id_category: "2249",
95
+ id_article: 29457,
96
+ services: [{
97
+ id_article: 29457,
98
+ service: "datasheet",
99
+ quantity: 1,
100
+ price: 0,
101
+ id_user: 1237,
102
+ datasheet_common: null,
103
+ discount: null
78
104
  }]
79
105
  },
80
106
  productToEdit: {
81
- ArticleId: 78773,
82
- idCategory: "2522",
83
- product: {
84
- orderId: 2446,
85
- article_status: "AP",
86
- datasheet_status: "AP",
87
- description_status: "AP",
88
- images_status: "ACA",
89
- prio: "none",
90
- version: 2,
91
- brand: null,
107
+ idCategory: "2249",
108
+ ArticleId: 29457,
109
+ product: [{
110
+ articleStatus: "ACA",
111
+ version: 5,
112
+ missing: {},
92
113
  article: {
93
- category: "Organizadores y Closets|Accesorios de Lavandería|Organizadores de Lavandería",
94
- company_name: "WOMEX SA DE CV",
95
- id_company: 424,
96
- country: null,
97
- id_category: "2522",
98
- id_article: 78773,
99
- name: "RACK PARA ROPA DOBLE NEGRO",
100
- upc: "168462"
114
+ category: "Materiales de Construcción|Impermeabilizantes y Recubrimientos|Selladores",
115
+ company_name: "SIKA MEXICANA S.A. DE C.V.",
116
+ company_id: 383,
117
+ id_category: "2249",
118
+ id_article: 29457,
119
+ name: "SIKA TECHO FRESCO SUPER 15",
120
+ upc: "111187"
101
121
  },
122
+ asignations: [],
102
123
  retailers: [{
103
124
  id: 58,
104
- name: "The Home Depot Golden"
125
+ name: "The Home Depot Golden",
126
+ country: "México",
127
+ id_region: 1,
128
+ active: 1
129
+ }, {
130
+ id: 59,
131
+ name: "The Home Depot Platinum",
132
+ country: "México",
133
+ id_region: 1,
134
+ active: 1
135
+ }, {
136
+ id: 61,
137
+ name: "Home Depot TAB",
138
+ country: "México",
139
+ id_region: 1,
140
+ active: 1
105
141
  }],
106
- services: {
107
- datasheets: 1,
108
- descriptions: 1,
109
- images: 1
110
- },
111
- statusByRetailer: {
112
- 58: {
113
- datasheet: "AP",
114
- description: "AP",
115
- images: "ACA"
116
- }
117
- },
118
- retailersWithService: ["58"],
119
- id_article: 78773,
142
+ percentage: 33.35,
120
143
  retailersAvailable: [{
121
144
  id: 58,
122
- name: "The Home Depot Golden"
145
+ name: "The Home Depot Golden",
146
+ country: "México",
147
+ id_region: 1,
148
+ active: 1
149
+ }, {
150
+ id: 59,
151
+ name: "The Home Depot Platinum",
152
+ country: "México",
153
+ id_region: 1,
154
+ active: 1
155
+ }, {
156
+ id: 61,
157
+ name: "Home Depot TAB",
158
+ country: "México",
159
+ id_region: 1,
160
+ active: 1
161
+ }],
162
+ upc: "111187",
163
+ name: "SIKA TECHO FRESCO SUPER 15",
164
+ categoryName: "Materiales de Construcción|Impermeabilizantes y Recubrimientos|Selladores",
165
+ id_category: "2249",
166
+ id_article: 29457,
167
+ services: [{
168
+ id_article: 29457,
169
+ service: "datasheet",
170
+ quantity: 1,
171
+ price: 0,
172
+ id_user: 1237,
173
+ datasheet_common: null,
174
+ discount: null
123
175
  }]
124
- }
176
+ }]
125
177
  },
126
178
  location: {
127
179
  state: {
@@ -179,7 +179,7 @@ var reducerImages = function reducerImages(state, action) {
179
179
  inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
180
180
  return imageIdArray.includes(input.id);
181
181
  });
182
- values = orderedImages.length > 0 ? orderedImages : valuesInitial;
182
+ values = orderedImages.length > 0 ? orderedImages : [];
183
183
  return (0, _objectSpread3.default)((0, _objectSpread3.default)({}, state), {}, {
184
184
  values: values,
185
185
  inputs: inputs
@@ -548,8 +548,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
548
548
  services = _context2.sent;
549
549
  //Converts the data inside the datasheets object to array
550
550
  setServices(services);
551
- getServices();
551
+ _context2.next = 6;
552
+ return getServices();
552
553
 
554
+ case 6:
553
555
  if (!originProp) {
554
556
  setActiveRetailer(product !== null && product !== void 0 && product.retailers ? product === null || product === void 0 ? void 0 : product.retailers[0] : product === null || product === void 0 ? void 0 : product.retailersAvailable[0]);
555
557
  } // setActiveRetailer(product?.retailers[0]);
@@ -567,7 +569,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
567
569
  });
568
570
  setLoading(false);
569
571
 
570
- case 10:
572
+ case 11:
571
573
  case "end":
572
574
  return _context2.stop();
573
575
  }
@@ -584,7 +586,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
584
586
  var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
585
587
  var _product$article4;
586
588
 
587
- var productInOrder, idArticle, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailerResponse, retailers, active;
589
+ var productInOrder, idArticle, retailers, active, _product$id_order, _servicesResponse$dat, servicesResponse, parsedResponse, retailerResponse;
588
590
 
589
591
  return _regenerator.default.wrap(function _callee3$(_context3) {
590
592
  while (1) {
@@ -592,29 +594,32 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
592
594
  case 0:
593
595
  productInOrder = product.id_order || product.orderId;
594
596
  idArticle = (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);
597
+ retailers = product.retailers || product.retailersAvailable;
598
+ active = null;
595
599
 
596
600
  if (!(isRevision() || productInOrder)) {
597
601
  _context3.next = 12;
598
602
  break;
599
603
  }
600
604
 
601
- _context3.next = 5;
605
+ _context3.next = 7;
602
606
  return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(idArticle, "&orderId=").concat((_product$id_order = product === null || product === void 0 ? void 0 : product.id_order) !== null && _product$id_order !== void 0 ? _product$id_order : product.orderId, "&end=true"));
603
607
 
604
- case 5:
608
+ case 7:
605
609
  servicesResponse = _context3.sent;
606
610
  parsedResponse = JSON.parse(servicesResponse === null || servicesResponse === void 0 ? void 0 : (_servicesResponse$dat = servicesResponse.data) === null || _servicesResponse$dat === void 0 ? void 0 : _servicesResponse$dat.body).data;
607
611
  retailerResponse = parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
608
612
  return srv.id_retailer;
609
613
  });
610
- retailers = product.retailers || product.retailersAvailable;
611
614
  active = retailers === null || retailers === void 0 ? void 0 : retailers.find(function (retailer) {
612
615
  return retailerResponse.includes(retailer.id);
613
616
  });
614
- !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
615
617
  setServicesData(parsedResponse);
616
618
 
617
619
  case 12:
620
+ !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
621
+
622
+ case 13:
618
623
  case "end":
619
624
  return _context3.stop();
620
625
  }
@@ -695,6 +700,10 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
695
700
  (0, _data.fetchUsers)(token).then(function (res) {
696
701
  return setUserGroups(res);
697
702
  });
703
+ setImages({
704
+ action: "orderImages",
705
+ retailerId: activeRetailer.id
706
+ });
698
707
  }, [product, version]);
699
708
 
700
709
  var loadAssignations = function loadAssignations(currentProduct) {
@@ -740,7 +749,7 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
740
749
 
741
750
  (0, _react.useEffect)(function () {
742
751
  loadInputs();
743
- setImages({
752
+ activeRetailer.id && setImages({
744
753
  action: "orderImages",
745
754
  retailerId: activeRetailer.id
746
755
  });
@@ -31,59 +31,59 @@ RetailerProductEditionDefault.args = {
31
31
  "Ficha técnica": false,
32
32
  Imágenes: false
33
33
  },
34
- token: "eyJraWQiOiJEV3owZnNieXg2MXNFcVduN3RCXC81bVhod3ZNbFZIOTgwUnZcL3RjT0lKdEk9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIyM2EzZjQ5Ni00ZTM4LTRlMTItOWJmNS03ZjkwYjc3YTJmMzUiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfbFN6UVo0WjdSIiwiY29nbml0bzp1c2VybmFtZSI6IjIzYTNmNDk2LTRlMzgtNGUxMi05YmY1LTdmOTBiNzdhMmYzNSIsImF1ZCI6IjUyZDlza2tkY2c4cWpwODhvb2sxdXNlNm1rIiwiZXZlbnRfaWQiOiJiYjY1ODZhYS02MzQ5LTQ2ZDgtOTk1Ni00ZGQ3NGEzY2FmODYiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1OTY0OTAyOCwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY1OTY1MjYyOCwiaWF0IjoxNjU5NjQ5MDI4LCJlbWFpbCI6ImxhZGlib2g3ODVAbWkxNjYuY29tIn0.OWVf7QX5rQpQAPmqhwGG14kDJhuG051MjYdv6TVMoEi5LrwmamTk8RJiDqgLTOZOgadlQoAHq27w5LnbYqDfQRqJYfj0kh0qTg2lA7xIZCCd-ljvvMtW6XGmd2_XoEhGkrjnZkniBiOaYSpNW_qTV0FiuWNh4enI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CXs4XYnCZ7dRMXnkjpRL4PVbrGji9qbEEJR6TxCJafR-zes1o4HC1KfQ5QF4s5I_LYQYbD-Ot0A1zDiJg34HR9tTILu5f4uc_2Nj8bqqYJsEdKg982WWO9ac2uKRPXQqNL6CsdltnSeQQcnS6Wj5DJTRRoc-lRdE6ekpAvDGPo0Dyj1Q8GYH3uxvM-pVu8J1Z_JOtO5j5mPN9krpA",
35
35
  productSelected: {
36
36
  services: {
37
- datasheets: 1,
38
- descriptions: 1,
37
+ datasheets: 0,
38
+ descriptions: 0,
39
39
  images: 1
40
40
  },
41
- orderId: 2012,
41
+ orderId: 1789,
42
42
  status: "ACA",
43
- datasheet_status: "ACA",
43
+ datasheet_status: "NS",
44
44
  prio: "none",
45
45
  version: 2,
46
- description_status: "ACA",
46
+ description_status: "NS",
47
47
  images_status: "ACA",
48
48
  article: {
49
- id_article: 77106,
50
- id_category: "2898",
51
- name: "INFLABLE CATRINA 2.13M HALLOWEEN",
52
- upc: "163556",
53
- timestamp: "2022-07-07T17:01:17.000Z",
54
- id_user: 1195,
49
+ id_article: 68865,
50
+ id_category: "2999",
51
+ name: "RESIZE",
52
+ upc: "169955",
53
+ timestamp: "2022-06-21T16:03:10.000Z",
54
+ id_user: 1238,
55
55
  status: "NULL",
56
- active: 1,
57
- company_id: 657,
56
+ active: 0,
57
+ company_id: 819,
58
58
  SKU: null,
59
59
  Descripcion: null,
60
60
  Proveedor: null,
61
61
  id_proveedor: 0,
62
- company_name: "",
63
- country: null,
64
- id_order: 2012,
65
- id_datasheet_especialist: 1248,
66
- id_datasheet_facilitator: 1252,
67
- id_description_especialist: 334,
68
- id_description_facilitator: 1252,
62
+ company_name: "The Home Depot Resize",
63
+ country: "México",
64
+ id_order: 1789,
65
+ id_datasheet_especialist: null,
66
+ id_datasheet_facilitator: null,
67
+ id_description_especialist: null,
68
+ id_description_facilitator: null,
69
69
  id_images_especialist: 1250,
70
- id_images_facilitator: 1286,
71
- id_auditor: 1254,
70
+ id_images_facilitator: 424,
71
+ id_auditor: null,
72
72
  id_recepcionist: null,
73
- category: "Hallowen|Decoración e Inflables|Decoración e Inflables",
74
- missingAttributes: 3,
75
- missingDescriptions: 0,
76
- missingImages: -2
73
+ category: "Resizing|Resizing|Resizing",
74
+ missingAttributes: null,
75
+ missingDescriptions: null,
76
+ missingImages: null
77
77
  },
78
78
  retailers: [{
79
- id: 58,
80
- name: "The Home Depot Golden",
79
+ id: 60,
80
+ name: "The Home Depot Resizing",
81
81
  country: "México",
82
82
  id_region: 1,
83
83
  active: 1
84
84
  }],
85
- country: null,
86
- upc: "163556"
85
+ country: "México",
86
+ upc: "169955"
87
87
  },
88
88
  location: {
89
89
  product: {
@@ -157,7 +157,7 @@ var reducerImages = function reducerImages(state, action) {
157
157
  inputs = inputsInitial === null || inputsInitial === void 0 ? void 0 : inputsInitial.filter(function (input) {
158
158
  return imageIdArray.includes(input.id);
159
159
  });
160
- values = orderedImages.length > 0 ? orderedImages : valuesInitial;
160
+ values = orderedImages.length > 0 ? orderedImages : [];
161
161
  return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, state), {}, {
162
162
  values: values,
163
163
  inputs: inputs
@@ -705,7 +705,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
705
705
  setDescriptions(_descriptions);
706
706
  }
707
707
 
708
- setImages({
708
+ (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && setImages({
709
709
  action: "orderImages",
710
710
  retailerId: activeRetailer.id
711
711
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.1.93",
3
+ "version": "21.1.96",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -22,7 +22,6 @@ export const InputFormatter = ({
22
22
  const maxLength = maxChar ? maxChar : 999;
23
23
 
24
24
  const getValue = (value) => {
25
- console.log(value);
26
25
  let temp = value.replace(/\n/gm, "<br>").replace(/\&(nbsp;|amp;)/gm, " ");
27
26
  return temp;
28
27
  };
@@ -21,102 +21,170 @@ ProviderProductEditionDefault.args = {
21
21
  category: 846,
22
22
  version: 2,
23
23
  productSelected: {
24
- orderId: 2446,
25
- article_status: "AP",
26
- datasheet_status: "AP",
27
- description_status: "AP",
28
- images_status: "ACA",
29
- prio: "none",
30
- version: 2,
31
- brand: null,
24
+ articleStatus: "ACA",
25
+ version: 5,
26
+ missing: {},
32
27
  article: {
33
28
  category:
34
- "Organizadores y Closets|Accesorios de Lavandería|Organizadores de Lavandería",
35
- company_name: "WOMEX SA DE CV",
36
- id_company: 424,
37
- country: null,
38
- id_category: "2522",
39
- id_article: 78773,
40
- name: "RACK PARA ROPA DOBLE NEGRO",
41
- upc: "168462",
29
+ "Materiales de Construcción|Impermeabilizantes y Recubrimientos|Selladores",
30
+ company_name: "SIKA MEXICANA S.A. DE C.V.",
31
+ company_id: 383,
32
+ id_category: "2249",
33
+ id_article: 29457,
34
+ name: "SIKA TECHO FRESCO SUPER 15",
35
+ upc: "111187",
42
36
  },
37
+ asignations: [],
43
38
  retailers: [
44
39
  {
45
40
  id: 58,
46
41
  name: "The Home Depot Golden",
42
+ country: "México",
43
+ id_region: 1,
44
+ active: 1,
47
45
  },
48
- ],
49
- services: {
50
- datasheets: 1,
51
- descriptions: 1,
52
- images: 1,
53
- },
54
- statusByRetailer: {
55
- 58: {
56
- datasheet: "AP",
57
- description: "AP",
58
- images: "ACA",
46
+ {
47
+ id: 59,
48
+ name: "The Home Depot Platinum",
49
+ country: "México",
50
+ id_region: 1,
51
+ active: 1,
59
52
  },
60
- },
61
- retailersWithService: ["58"],
62
- id_article: 78773,
53
+ {
54
+ id: 61,
55
+ name: "Home Depot TAB",
56
+ country: "México",
57
+ id_region: 1,
58
+ active: 1,
59
+ },
60
+ ],
61
+ percentage: 33.35,
63
62
  retailersAvailable: [
64
63
  {
65
64
  id: 58,
66
65
  name: "The Home Depot Golden",
66
+ country: "México",
67
+ id_region: 1,
68
+ active: 1,
69
+ },
70
+ {
71
+ id: 59,
72
+ name: "The Home Depot Platinum",
73
+ country: "México",
74
+ id_region: 1,
75
+ active: 1,
76
+ },
77
+ {
78
+ id: 61,
79
+ name: "Home Depot TAB",
80
+ country: "México",
81
+ id_region: 1,
82
+ active: 1,
83
+ },
84
+ ],
85
+ upc: "111187",
86
+ name: "SIKA TECHO FRESCO SUPER 15",
87
+ categoryName:
88
+ "Materiales de Construcción|Impermeabilizantes y Recubrimientos|Selladores",
89
+ id_category: "2249",
90
+ id_article: 29457,
91
+ services: [
92
+ {
93
+ id_article: 29457,
94
+ service: "datasheet",
95
+ quantity: 1,
96
+ price: 0,
97
+ id_user: 1237,
98
+ datasheet_common: null,
99
+ discount: null,
67
100
  },
68
101
  ],
69
102
  },
70
103
  productToEdit: {
71
- ArticleId: 78773,
72
- idCategory: "2522",
73
- product: {
74
- orderId: 2446,
75
- article_status: "AP",
76
- datasheet_status: "AP",
77
- description_status: "AP",
78
- images_status: "ACA",
79
- prio: "none",
80
- version: 2,
81
- brand: null,
82
- article: {
83
- category:
84
- "Organizadores y Closets|Accesorios de Lavandería|Organizadores de Lavandería",
85
- company_name: "WOMEX SA DE CV",
86
- id_company: 424,
87
- country: null,
88
- id_category: "2522",
89
- id_article: 78773,
90
- name: "RACK PARA ROPA DOBLE NEGRO",
91
- upc: "168462",
92
- },
93
- retailers: [
94
- {
95
- id: 58,
96
- name: "The Home Depot Golden",
97
- },
98
- ],
99
- services: {
100
- datasheets: 1,
101
- descriptions: 1,
102
- images: 1,
103
- },
104
- statusByRetailer: {
105
- 58: {
106
- datasheet: "AP",
107
- description: "AP",
108
- images: "ACA",
104
+ idCategory: "2249",
105
+ ArticleId: 29457,
106
+ product: [
107
+ {
108
+ articleStatus: "ACA",
109
+ version: 5,
110
+ missing: {},
111
+ article: {
112
+ category:
113
+ "Materiales de Construcción|Impermeabilizantes y Recubrimientos|Selladores",
114
+ company_name: "SIKA MEXICANA S.A. DE C.V.",
115
+ company_id: 383,
116
+ id_category: "2249",
117
+ id_article: 29457,
118
+ name: "SIKA TECHO FRESCO SUPER 15",
119
+ upc: "111187",
109
120
  },
121
+ asignations: [],
122
+ retailers: [
123
+ {
124
+ id: 58,
125
+ name: "The Home Depot Golden",
126
+ country: "México",
127
+ id_region: 1,
128
+ active: 1,
129
+ },
130
+ {
131
+ id: 59,
132
+ name: "The Home Depot Platinum",
133
+ country: "México",
134
+ id_region: 1,
135
+ active: 1,
136
+ },
137
+ {
138
+ id: 61,
139
+ name: "Home Depot TAB",
140
+ country: "México",
141
+ id_region: 1,
142
+ active: 1,
143
+ },
144
+ ],
145
+ percentage: 33.35,
146
+ retailersAvailable: [
147
+ {
148
+ id: 58,
149
+ name: "The Home Depot Golden",
150
+ country: "México",
151
+ id_region: 1,
152
+ active: 1,
153
+ },
154
+ {
155
+ id: 59,
156
+ name: "The Home Depot Platinum",
157
+ country: "México",
158
+ id_region: 1,
159
+ active: 1,
160
+ },
161
+ {
162
+ id: 61,
163
+ name: "Home Depot TAB",
164
+ country: "México",
165
+ id_region: 1,
166
+ active: 1,
167
+ },
168
+ ],
169
+ upc: "111187",
170
+ name: "SIKA TECHO FRESCO SUPER 15",
171
+ categoryName:
172
+ "Materiales de Construcción|Impermeabilizantes y Recubrimientos|Selladores",
173
+ id_category: "2249",
174
+ id_article: 29457,
175
+ services: [
176
+ {
177
+ id_article: 29457,
178
+ service: "datasheet",
179
+ quantity: 1,
180
+ price: 0,
181
+ id_user: 1237,
182
+ datasheet_common: null,
183
+ discount: null,
184
+ },
185
+ ],
110
186
  },
111
- retailersWithService: ["58"],
112
- id_article: 78773,
113
- retailersAvailable: [
114
- {
115
- id: 58,
116
- name: "The Home Depot Golden",
117
- },
118
- ],
119
- },
187
+ ],
120
188
  },
121
189
  location: {
122
190
  state: { origin: "Contentoh" },
@@ -97,7 +97,7 @@ const reducerImages = (state, action) => {
97
97
  imageIdArray.includes(input.id)
98
98
  );
99
99
 
100
- values = orderedImages.length > 0 ? orderedImages : valuesInitial;
100
+ values = orderedImages.length > 0 ? orderedImages : [];
101
101
  return { ...state, values, inputs };
102
102
  }
103
103
  default:
@@ -263,7 +263,7 @@ export const ProviderProductEdition = ({
263
263
 
264
264
  //Converts the data inside the datasheets object to array
265
265
  setServices(services);
266
- getServices();
266
+ await getServices();
267
267
 
268
268
  if (!originProp) {
269
269
  setActiveRetailer(
@@ -284,6 +284,8 @@ export const ProviderProductEdition = ({
284
284
  const getServices = async () => {
285
285
  const productInOrder = product.id_order || product.orderId;
286
286
  const idArticle = product?.id_article || product?.article?.id_article;
287
+ let retailers = product.retailers || product.retailersAvailable;
288
+ let active = null;
287
289
  if (isRevision() || productInOrder) {
288
290
  const servicesResponse = await axios.get(
289
291
  `${
@@ -294,13 +296,12 @@ export const ProviderProductEdition = ({
294
296
  );
295
297
  const parsedResponse = JSON.parse(servicesResponse?.data?.body).data;
296
298
  const retailerResponse = parsedResponse?.map((srv) => srv.id_retailer);
297
- let retailers = product.retailers || product.retailersAvailable;
298
- let active = retailers?.find((retailer) =>
299
+ active = retailers?.find((retailer) =>
299
300
  retailerResponse.includes(retailer.id)
300
301
  );
301
- !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
302
302
  setServicesData(parsedResponse);
303
303
  }
304
+ !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
304
305
  };
305
306
 
306
307
  const isRevision = () => {
@@ -348,6 +349,7 @@ export const ProviderProductEdition = ({
348
349
  loadData();
349
350
  getCart();
350
351
  fetchUsers(token).then((res) => setUserGroups(res));
352
+ setImages({ action: "orderImages", retailerId: activeRetailer.id });
351
353
  }, [product, version]);
352
354
 
353
355
  const loadAssignations = (currentProduct) => {
@@ -391,7 +393,8 @@ export const ProviderProductEdition = ({
391
393
 
392
394
  useEffect(() => {
393
395
  loadInputs();
394
- setImages({ action: "orderImages", retailerId: activeRetailer.id });
396
+ activeRetailer.id &&
397
+ setImages({ action: "orderImages", retailerId: activeRetailer.id });
395
398
  }, [servicesData, activeRetailer, services]);
396
399
 
397
400
  const thumbs = () => {
@@ -16,61 +16,61 @@ RetailerProductEditionDefault.args = {
16
16
  Imágenes: false,
17
17
  },
18
18
  token:
19
- "eyJraWQiOiJEV3owZnNieXg2MXNFcVduN3RCXC81bVhod3ZNbFZIOTgwUnZcL3RjT0lKdEk9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiIyM2EzZjQ5Ni00ZTM4LTRlMTItOWJmNS03ZjkwYjc3YTJmMzUiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfbFN6UVo0WjdSIiwiY29nbml0bzp1c2VybmFtZSI6IjIzYTNmNDk2LTRlMzgtNGUxMi05YmY1LTdmOTBiNzdhMmYzNSIsImF1ZCI6IjUyZDlza2tkY2c4cWpwODhvb2sxdXNlNm1rIiwiZXZlbnRfaWQiOiJiYjY1ODZhYS02MzQ5LTQ2ZDgtOTk1Ni00ZGQ3NGEzY2FmODYiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1OTY0OTAyOCwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY1OTY1MjYyOCwiaWF0IjoxNjU5NjQ5MDI4LCJlbWFpbCI6ImxhZGlib2g3ODVAbWkxNjYuY29tIn0.OWVf7QX5rQpQAPmqhwGG14kDJhuG051MjYdv6TVMoEi5LrwmamTk8RJiDqgLTOZOgadlQoAHq27w5LnbYqDfQRqJYfj0kh0qTg2lA7xIZCCd-ljvvMtW6XGmd2_XoEhGkrjnZkniBiOaYSpNW_qTV0FiuWNh4enI7k4kl3x48QEPG9Jd7-4q4I21xVEBD1hy_TYhKQzS7H0FP487W89qOMZhOfm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F4s5I_LYQYbD-Ot0A1zDiJg34HR9tTILu5f4uc_2Nj8bqqYJsEdKg982WWO9ac2uKRPXQqNL6CsdltnSeQQcnS6Wj5DJTRRoc-lRdE6ekpAvDGPo0Dyj1Q8GYH3uxvM-pVu8J1Z_JOtO5j5mPN9krpA",
20
20
  productSelected: {
21
21
  services: {
22
- datasheets: 1,
23
- descriptions: 1,
22
+ datasheets: 0,
23
+ descriptions: 0,
24
24
  images: 1,
25
25
  },
26
- orderId: 2012,
26
+ orderId: 1789,
27
27
  status: "ACA",
28
- datasheet_status: "ACA",
28
+ datasheet_status: "NS",
29
29
  prio: "none",
30
30
  version: 2,
31
- description_status: "ACA",
31
+ description_status: "NS",
32
32
  images_status: "ACA",
33
33
  article: {
34
- id_article: 77106,
35
- id_category: "2898",
36
- name: "INFLABLE CATRINA 2.13M HALLOWEEN",
37
- upc: "163556",
38
- timestamp: "2022-07-07T17:01:17.000Z",
39
- id_user: 1195,
34
+ id_article: 68865,
35
+ id_category: "2999",
36
+ name: "RESIZE",
37
+ upc: "169955",
38
+ timestamp: "2022-06-21T16:03:10.000Z",
39
+ id_user: 1238,
40
40
  status: "NULL",
41
- active: 1,
42
- company_id: 657,
41
+ active: 0,
42
+ company_id: 819,
43
43
  SKU: null,
44
44
  Descripcion: null,
45
45
  Proveedor: null,
46
46
  id_proveedor: 0,
47
- company_name: "",
48
- country: null,
49
- id_order: 2012,
50
- id_datasheet_especialist: 1248,
51
- id_datasheet_facilitator: 1252,
52
- id_description_especialist: 334,
53
- id_description_facilitator: 1252,
47
+ company_name: "The Home Depot Resize",
48
+ country: "México",
49
+ id_order: 1789,
50
+ id_datasheet_especialist: null,
51
+ id_datasheet_facilitator: null,
52
+ id_description_especialist: null,
53
+ id_description_facilitator: null,
54
54
  id_images_especialist: 1250,
55
- id_images_facilitator: 1286,
56
- id_auditor: 1254,
55
+ id_images_facilitator: 424,
56
+ id_auditor: null,
57
57
  id_recepcionist: null,
58
- category: "Hallowen|Decoración e Inflables|Decoración e Inflables",
59
- missingAttributes: 3,
60
- missingDescriptions: 0,
61
- missingImages: -2,
58
+ category: "Resizing|Resizing|Resizing",
59
+ missingAttributes: null,
60
+ missingDescriptions: null,
61
+ missingImages: null,
62
62
  },
63
63
  retailers: [
64
64
  {
65
- id: 58,
66
- name: "The Home Depot Golden",
65
+ id: 60,
66
+ name: "The Home Depot Resizing",
67
67
  country: "México",
68
68
  id_region: 1,
69
69
  active: 1,
70
70
  },
71
71
  ],
72
- country: null,
73
- upc: "163556",
72
+ country: "México",
73
+ upc: "169955",
74
74
  },
75
75
  location: {
76
76
  product: { articleId: 109485, versionId: 3 },
@@ -87,7 +87,7 @@ const reducerImages = (state, action) => {
87
87
  imageIdArray.includes(input.id)
88
88
  );
89
89
 
90
- values = orderedImages.length > 0 ? orderedImages : valuesInitial;
90
+ values = orderedImages.length > 0 ? orderedImages : [];
91
91
  return { ...state, values, inputs };
92
92
  }
93
93
  default:
@@ -389,7 +389,8 @@ export const RetailerProductEdition = ({
389
389
  setDatasheets([datagroups, inputs]);
390
390
  setDescriptions(descriptions);
391
391
  }
392
- setImages({ action: "orderImages", retailerId: activeRetailer.id });
392
+ activeRetailer?.id &&
393
+ setImages({ action: "orderImages", retailerId: activeRetailer.id });
393
394
  }, [activeRetailer, services]);
394
395
 
395
396
  const thumbs = () => {