contentoh-components-library 21.1.12 → 21.1.13

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.
@@ -31,70 +31,76 @@ RetailerProductEditionDefault.args = {
31
31
  "Ficha técnica": false,
32
32
  Imágenes: false
33
33
  },
34
- token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiI3MTNhNzQ1Ny1mOTQzLTRiYzktOGViMC04NmI0MWY1YmQ0ZjgiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6IjcxM2E3NDU3LWY5NDMtNGJjOS04ZWIwLTg2YjQxZjViZDRmOCIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiI4NjQwM2FlZC03Y2I3LTQ4MjgtYmNhOS05NGY1OWRkYjFhMTAiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1NTY4MDY2MiwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY1NTY4NDI2MiwiaWF0IjoxNjU1NjgwNjYyLCJlbWFpbCI6ImhjYXJyaWxsb0Bjb250ZW50b2guY29tIn0.WL09DLe9etfQEhxSL7D1fdgjF_tO3PxyUraxU3cZ9QHS0lYxiG_0tKReYAwNOHZWag-5IAu2WNPZEtbc4FK_nHyrz3qof4LTTHeRii2WybzUYtRCVZmAZ7omjM2vB-kr_V9Hk8wGK0ylm8eQuwvtpGFnIjmpCpdRbUjwFRJefEon1TGW1QshpzsovcI5Tvr1AASno6wuZTwTnX68OTPIJ947wj0u_Hicx9YwjQAqAwOyadiSQ-J3dkHPaDFGU41c4BT2ggSG5HOjmopX5jBxaVBLQsC0yM-0w1rqG9R93s1SmeanluvQH0NXVbofqnixjnt8r-dd9or_y4gy8hpZsg",
34
+ token: "eyJraWQiOiJkQWJkZCtlclwvTlwveVRQUWNvUlVyOCtrNUd2M1hMM2N1MWUzQ09zWExVRnc9IiwiYWxnIjoiUlMyNTYifQ.eyJzdWIiOiJhNmM0ZDNkNi0yNGE0LTQxZDQtYWQwZi1kMDg3NDM4YWI1YjYiLCJjb2duaXRvOmdyb3VwcyI6WyJjb2xhYm9yYWRvcmVzX2NvbnRlbnRvaCJdLCJlbWFpbF92ZXJpZmllZCI6dHJ1ZSwiaXNzIjoiaHR0cHM6XC9cL2NvZ25pdG8taWRwLnVzLWVhc3QtMS5hbWF6b25hd3MuY29tXC91cy1lYXN0LTFfWE1aUWRxa0dqIiwiY29nbml0bzp1c2VybmFtZSI6ImE2YzRkM2Q2LTI0YTQtNDFkNC1hZDBmLWQwODc0MzhhYjViNiIsImNvZ25pdG86cm9sZXMiOlsiYXJuOmF3czppYW06Ojg5ODY3MDIzMjgwNzpyb2xlXC9jb250ZW50b2gtZGV2LXVzLWVhc3QtMS1sYW1iZGFSb2xlIl0sImF1ZCI6IjVhYzh0cGdzNmdic3ExM2ZydnJwaWVlcDQwIiwiZXZlbnRfaWQiOiIxMDEyMmE5OC0wMDc1LTQxYmMtYjkxMi02NjBiNTE2MzMxMDQiLCJ0b2tlbl91c2UiOiJpZCIsImF1dGhfdGltZSI6MTY1NTc1NDEyNSwibmFtZSI6IkNvbGFib3JhZG9yIiwicGhvbmVfbnVtYmVyIjoiKzUyMTExMSIsImV4cCI6MTY1NTc1NzcyNSwiaWF0IjoxNjU1NzU0MTI1LCJlbWFpbCI6ImV0Y0Bjb250ZW50b2guY29tIn0.KFEGYLEDArzX7rXRsXo4wCc6nuSxATU6E8aL_XSCJyvYk3F2fn-cslstPX-zEgG1uybmzXfxMvSfnhjMGe1hCdxpHXXrcq4Khm6jlHcnsF62QUdIz5gPqZDoXjegctkCqQtTYhuZEhxhXmHn9Ijj3rSdk2_5-4AKYx89l9p1_G3u1EN8Vs1jH6BuE2v7u1wv45QQ9KB6h7s8DLZF_SfmivlJbQrqKmOzbwlDBpll94rRffKjHXzJtXx0YmKM--zU0E3dzAEdq-UcfEnM7GpC-SV__xMoLK7Rj7yTAq1fTHEfcMnAFBzkSoPjNAUi5xBw9GLCxt55DmZlVfvKyfzx6Q",
35
35
  articleId: 238,
36
36
  category: 846,
37
37
  version: 2,
38
38
  productSelected: {
39
39
  services: {
40
- datasheets: 0,
41
- descriptions: 0,
40
+ datasheets: 1,
41
+ descriptions: 1,
42
42
  images: 1
43
43
  },
44
- orderId: 72,
45
- status: "ASSIGNED",
46
- datasheet_status: "NS",
44
+ orderId: 42,
45
+ status: "RECEIVED",
46
+ datasheet_status: null,
47
47
  prio: "none",
48
- version: 14,
49
- description_status: "NS",
50
- images_status: "IN_PROGRESS",
48
+ version: 2,
49
+ description_status: null,
50
+ images_status: null,
51
51
  article: {
52
- id_article: 55109,
53
- id_category: "2999",
54
- name: "Resize Ismael",
55
- upc: "ResizeIsmael",
56
- timestamp: "2022-06-18T03:32:56.000Z",
57
- id_user: 110,
52
+ id_article: 54413,
53
+ id_category: "684",
54
+ name: "Crema dental 120 gr",
55
+ upc: "456463435",
56
+ timestamp: "2022-06-17T16:21:59.000Z",
57
+ id_user: 28,
58
58
  status: "NULL",
59
59
  active: 1,
60
- company_id: 834,
61
- company_name: "THD Resize Proveedor",
62
- country: null,
63
- id_order: 72,
64
- id_datasheet_especialist: 54,
65
- id_datasheet_facilitator: 52,
66
- id_description_especialist: 54,
67
- id_description_facilitator: 52,
68
- id_images_especialist: 55,
69
- id_images_facilitator: 53,
60
+ company_id: 1,
61
+ company_name: "COMPANY DEV",
62
+ country: "México",
63
+ id_order: 42,
64
+ id_datasheet_especialist: null,
65
+ id_datasheet_facilitator: null,
66
+ id_description_especialist: null,
67
+ id_description_facilitator: null,
68
+ id_images_especialist: null,
69
+ id_images_facilitator: null,
70
70
  id_auditor: null,
71
71
  id_recepcionist: null,
72
- category: "RESIZING|RESIZING|RESIZING",
73
- missingAttributes: null,
74
- missingDescriptions: null,
75
- missingImages: null
72
+ category: "SALUD Y BELLEZA|CUIDADO BUCAL|PASTAS DENTALES Y ASEO BUCAL",
73
+ missingAttributes: 22,
74
+ missingDescriptions: 16,
75
+ missingImages: 4
76
76
  },
77
77
  retailers: [{
78
- id: 58,
79
- name: "The Home Depot Golden",
78
+ id: 4,
79
+ name: "Walmart Super y Superama",
80
+ country: "México",
81
+ id_region: 1,
82
+ active: 1
83
+ }, {
84
+ id: 5,
85
+ name: "Chedraui",
80
86
  country: "México",
81
87
  id_region: 1,
82
88
  active: 1
83
89
  }, {
84
- id: 59,
85
- name: "The Home Depot Platinum",
90
+ id: 6,
91
+ name: "HEB",
86
92
  country: "México",
87
93
  id_region: 1,
88
94
  active: 1
89
95
  }, {
90
- id: 60,
91
- name: "The Home Depot Resizing",
96
+ id: 13,
97
+ name: "Soriana",
92
98
  country: "México",
93
99
  id_region: 1,
94
100
  active: 1
95
101
  }],
96
- country: null,
97
- upc: "ResizeIsmael"
102
+ country: "México",
103
+ upc: "456463435"
98
104
  },
99
105
  location: {
100
106
  product: {
@@ -103,22 +109,22 @@ RetailerProductEditionDefault.args = {
103
109
  }
104
110
  },
105
111
  user: {
106
- id_user: 55,
107
- name: "ESPECIALISTA ED PRUEBA",
112
+ id_user: 51,
113
+ name: "ADMIN PRUEBA",
108
114
  last_name: "",
109
- email: "hcarrillo@contentoh.com",
115
+ email: "etc@contentoh.com",
110
116
  position: null,
111
117
  telephone: null,
112
118
  country: null,
113
119
  id_company: 2,
114
- id_cognito: "713a7457-f943-4bc9-8eb0-86b41f5bd4f8",
120
+ id_cognito: "a6c4d3d6-24a4-41d4-ad0f-d087438ab5b6",
115
121
  birth_Date: null,
116
122
  about_me: null,
117
123
  zip_code: null,
118
124
  address: null,
119
125
  job: null,
120
126
  id_stripe: null,
121
- id_role: 8,
127
+ id_role: 1,
122
128
  active: 1,
123
129
  is_retailer: 0,
124
130
  membership: {
@@ -132,6 +138,6 @@ RetailerProductEditionDefault.args = {
132
138
  products_limit: "3",
133
139
  type: "PyMES"
134
140
  },
135
- src: "https://content-management-profile.s3.amazonaws.com/id-55/55.png?1655680663244"
141
+ src: "https://content-management-profile.s3.amazonaws.com/id-51/51.png?1655754126500"
136
142
  }
137
143
  };
@@ -382,40 +382,47 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
382
382
 
383
383
  var loadData = /*#__PURE__*/function () {
384
384
  var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
385
- var _product$article, _product$article2, _services$, _services$$values;
385
+ var _product$article, _product$article2, _services$, _services$$values, _services;
386
386
 
387
- var services;
388
387
  return _regenerator.default.wrap(function _callee$(_context) {
389
388
  while (1) {
390
389
  switch (_context.prev = _context.next) {
391
390
  case 0:
392
- _context.next = 2;
391
+ _context.prev = 0;
392
+ _context.next = 3;
393
393
  return (0, _data2.getRetailerServices)(product === null || product === void 0 ? void 0 : (_product$article = product.article) === null || _product$article === void 0 ? void 0 : _product$article.id_article, parseInt(product === null || product === void 0 ? void 0 : (_product$article2 = product.article) === null || _product$article2 === void 0 ? void 0 : _product$article2.id_category), product === null || product === void 0 ? void 0 : product.version);
394
394
 
395
- case 2:
396
- services = _context.sent;
395
+ case 3:
396
+ _services = _context.sent;
397
397
  //Converts the data inside the datasheets object to array
398
- setServices(services);
398
+ setServices(_services);
399
399
  getServices(); //setActiveRetailer(product?.retailers[0]);
400
400
 
401
401
  setImages({
402
402
  action: "init",
403
- init: services[2]
403
+ init: _services[2]
404
404
  });
405
- 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);
405
+ 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);
406
406
  (0, _data2.getPercentage)({
407
407
  data: [product]
408
408
  }).then(function (res) {
409
409
  return setPercentages(res);
410
410
  });
411
411
  setLoading(false);
412
+ _context.next = 15;
413
+ break;
414
+
415
+ case 12:
416
+ _context.prev = 12;
417
+ _context.t0 = _context["catch"](0);
418
+ console.log(_context.t0);
412
419
 
413
- case 9:
420
+ case 15:
414
421
  case "end":
415
422
  return _context.stop();
416
423
  }
417
424
  }
418
- }, _callee);
425
+ }, _callee, null, [[0, 12]]);
419
426
  }));
420
427
 
421
428
  return function loadData() {
@@ -427,7 +434,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
427
434
  var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
428
435
  var _product$article3, _product$article4, _servicesResponse$dat;
429
436
 
430
- var servicesResponse, parsedResponse;
437
+ var servicesResponse, parsedResponse, retailers, active;
431
438
  return _regenerator.default.wrap(function _callee2$(_context2) {
432
439
  while (1) {
433
440
  switch (_context2.prev = _context2.next) {
@@ -438,9 +445,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
438
445
  case 2:
439
446
  servicesResponse = _context2.sent;
440
447
  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;
448
+ retailers = product.retailers || product.retailersAvailable;
449
+ active = retailers === null || retailers === void 0 ? void 0 : retailers.filter(function (retailer) {
450
+ return parsedResponse === null || parsedResponse === void 0 ? void 0 : parsedResponse.map(function (srv) {
451
+ return srv.id_retailer;
452
+ }).includes(retailer.id);
453
+ })[0];
454
+ !activeRetailer.id && setActiveRetailer(active ? active : retailers[0]);
441
455
  setServicesData(parsedResponse);
442
456
 
443
- case 5:
457
+ case 8:
444
458
  case "end":
445
459
  return _context2.stop();
446
460
  }
@@ -513,46 +527,40 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
513
527
  while (1) {
514
528
  switch (_context4.prev = _context4.next) {
515
529
  case 0:
516
- loadData(); // getPercentage({ data: [product] }).then((res) =>
517
- // setPercentages(res)
518
- // );
519
-
520
- setActiveRetailer(function (current) {
521
- return current.id ? current : product.retailers ? product.retailers[0] : product.retailersAvailable[0];
522
- });
530
+ loadData();
523
531
  getComments();
524
532
  _context4.t0 = setUserGroups;
525
- _context4.next = 6;
533
+ _context4.next = 5;
526
534
  return (0, _data2.fetchUsers)(token);
527
535
 
528
- case 6:
536
+ case 5:
529
537
  _context4.t1 = _context4.sent;
530
538
  (0, _context4.t0)(_context4.t1);
531
539
  arr = [];
532
540
  _context4.t2 = user.id_role;
533
- _context4.next = _context4.t2 === 7 ? 12 : _context4.t2 === 8 ? 12 : _context4.t2 === 4 ? 14 : _context4.t2 === 5 ? 14 : _context4.t2 === 6 ? 16 : 18;
541
+ _context4.next = _context4.t2 === 7 ? 11 : _context4.t2 === 8 ? 11 : _context4.t2 === 4 ? 13 : _context4.t2 === 5 ? 13 : _context4.t2 === 6 ? 15 : 17;
534
542
  break;
535
543
 
536
- case 12:
544
+ case 11:
537
545
  arr = ["IN_PROGRESS", "RF", "RA"];
538
- return _context4.abrupt("break", 20);
546
+ return _context4.abrupt("break", 19);
539
547
 
540
- case 14:
548
+ case 13:
541
549
  arr = ["RF", "AF", "AA", "AP", "AC"];
542
- return _context4.abrupt("break", 20);
550
+ return _context4.abrupt("break", 19);
543
551
 
544
- case 16:
552
+ case 15:
545
553
  arr = ["RP", "RC", "AF", "RA"];
546
- return _context4.abrupt("break", 20);
554
+ return _context4.abrupt("break", 19);
547
555
 
548
- case 18:
556
+ case 17:
549
557
  arr = [];
550
- return _context4.abrupt("break", 20);
558
+ return _context4.abrupt("break", 19);
551
559
 
552
- case 20:
560
+ case 19:
553
561
  setStatusArray(arr);
554
562
 
555
- case 21:
563
+ case 20:
556
564
  case "end":
557
565
  return _context4.stop();
558
566
  }
@@ -642,7 +650,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
642
650
  var thumbs = function thumbs() {
643
651
  var _images$imageType, _images$imagePackagin, _images$values;
644
652
 
645
- var imageInputs = socketType.slice();
653
+ var imageInputs = socketType === null || socketType === void 0 ? void 0 : socketType.slice();
646
654
  var imageType = images === null || images === void 0 ? void 0 : (_images$imageType = images.imageType) === null || _images$imageType === void 0 ? void 0 : _images$imageType.map(function (e) {
647
655
  return {
648
656
  value: e === null || e === void 0 ? void 0 : e.id,
@@ -1199,7 +1207,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1199
1207
  }
1200
1208
  }
1201
1209
 
1202
- return product.article["id_".concat(concept, "_").concat(rol)] === user.id_user && validUser;
1210
+ return user.id_role === 1 || product.article["id_".concat(concept, "_").concat(rol)] === user.id_user && validUser;
1203
1211
  };
1204
1212
 
1205
1213
  var auditorAssigned = function auditorAssigned() {
@@ -1269,61 +1277,65 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1269
1277
  }();
1270
1278
 
1271
1279
  var getRequired = function getRequired(services) {
1272
- var _services$4, _services$4$retailerM, _services$5, _services$5$inputs;
1273
-
1274
- var objetcTemp = {};
1275
- var datasheetServicesArray = Object.values(services[0]);
1276
- var dsInputs = datasheetServicesArray.pop();
1277
- var descriptionsServicesArray = services[1];
1278
- var dsInputsRequired = [];
1279
- var desInputsRequired = 0;
1280
- datasheetServicesArray.forEach(function (datasheet) {
1281
- var _servicesData$filter3 = servicesData.filter(function (srv) {
1282
- return srv.id_retailer === datasheet.retailer.id && srv.service === getConcept(activeTab);
1283
- }),
1284
- _servicesData$filter4 = (0, _slicedToArray2.default)(_servicesData$filter3, 1),
1285
- requested = _servicesData$filter4[0];
1286
-
1287
- requested && Object.values(datasheet === null || datasheet === void 0 ? void 0 : datasheet.data).forEach(function (dataGroup) {
1288
- return dsInputsRequired.push.apply(dsInputsRequired, (0, _toConsumableArray2.default)(dataGroup.inputs.filter(function (input) {
1289
- return dsInputs[input].required && (dsInputs[input].value === undefined || !dsInputs[input].value);
1290
- })));
1280
+ try {
1281
+ var _services$4, _services$4$retailerM, _services$5, _services$5$inputs;
1282
+
1283
+ var objetcTemp = {};
1284
+ var datasheetServicesArray = Object.values(services[0]);
1285
+ var dsInputs = datasheetServicesArray.pop();
1286
+ var descriptionsServicesArray = services[1];
1287
+ var dsInputsRequired = [];
1288
+ var desInputsRequired = 0;
1289
+ datasheetServicesArray === null || datasheetServicesArray === void 0 ? void 0 : datasheetServicesArray.forEach(function (datasheet) {
1290
+ var _servicesData$filter3 = servicesData === null || servicesData === void 0 ? void 0 : servicesData.filter(function (srv) {
1291
+ return srv.id_retailer === datasheet.retailer.id && srv.service === getConcept(activeTab);
1292
+ }),
1293
+ _servicesData$filter4 = (0, _slicedToArray2.default)(_servicesData$filter3, 1),
1294
+ requested = _servicesData$filter4[0];
1295
+
1296
+ requested && (datasheet === null || datasheet === void 0 ? void 0 : datasheet.data) && Object.values(datasheet === null || datasheet === void 0 ? void 0 : datasheet.data).forEach(function (dataGroup) {
1297
+ return dsInputsRequired.push.apply(dsInputsRequired, (0, _toConsumableArray2.default)(dataGroup.inputs.filter(function (input) {
1298
+ return dsInputs[input].required && (dsInputs[input].value === undefined || !dsInputs[input].value);
1299
+ })));
1300
+ });
1291
1301
  });
1292
- });
1293
- objetcTemp["Ficha técnica"] = dsInputsRequired.length;
1294
- descriptionsServicesArray.forEach(function (description) {
1295
- var _servicesData$filter5 = servicesData.filter(function (srv) {
1296
- return srv.id_retailer === description.id && srv.service === getConcept(activeTab);
1297
- }),
1298
- _servicesData$filter6 = (0, _slicedToArray2.default)(_servicesData$filter5, 1),
1299
- requested = _servicesData$filter6[0];
1300
-
1301
- requested && description.inputs.forEach(function (input) {
1302
- return input.required && (!input.value || input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") === "") && desInputsRequired++;
1302
+ objetcTemp["Ficha técnica"] = dsInputsRequired.length;
1303
+ descriptionsServicesArray.forEach(function (description) {
1304
+ var _servicesData$filter5 = servicesData.filter(function (srv) {
1305
+ return srv.id_retailer === description.id && srv.service === getConcept(activeTab);
1306
+ }),
1307
+ _servicesData$filter6 = (0, _slicedToArray2.default)(_servicesData$filter5, 1),
1308
+ requested = _servicesData$filter6[0];
1309
+
1310
+ requested && description.inputs.forEach(function (input) {
1311
+ return input.required && (!input.value || input.value.replace(/(<\/?p>)|(<\/?strong>)|(<br>)/gm, "") === "") && desInputsRequired++;
1312
+ });
1303
1313
  });
1304
- });
1305
- objetcTemp["Descripción"] = desInputsRequired;
1306
- var retailersRequested = [];
1307
- (_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) {
1308
- return retMan.forEach(function (rm) {
1309
- return retailersRequested.push(rm);
1314
+ objetcTemp["Descripción"] = desInputsRequired;
1315
+ var retailersRequested = [];
1316
+ (_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) {
1317
+ return retMan.forEach(function (rm) {
1318
+ return retailersRequested.push(rm);
1319
+ });
1310
1320
  });
1311
- });
1312
- 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) {
1313
- return e.required === 1 && retailersRequested.filter(function (ret) {
1314
- return ret.id_image === e.id && servicesData.filter(function (srv) {
1315
- return srv.id_retailer === ret.id_retailer;
1321
+ 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) {
1322
+ return e.required === 1 && retailersRequested.filter(function (ret) {
1323
+ return ret.id_image === e.id && servicesData.filter(function (srv) {
1324
+ return srv.id_retailer === ret.id_retailer;
1325
+ }).length > 0;
1316
1326
  }).length > 0;
1317
- }).length > 0;
1318
- });
1319
- var requiredCounter = 0;
1320
- requiredImages === null || requiredImages === void 0 ? void 0 : requiredImages.forEach(function (req) {
1321
- return services[2].values.filter(function (img) {
1322
- return img.image_id === req.id;
1323
- }).length === 0 && requiredCounter++;
1324
- });
1325
- objetcTemp["Imágenes"] = requiredCounter;
1326
- setRequiredNull(objetcTemp);
1327
+ });
1328
+ var requiredCounter = 0;
1329
+ requiredImages === null || requiredImages === void 0 ? void 0 : requiredImages.forEach(function (req) {
1330
+ return services[2].values.filter(function (img) {
1331
+ return img.image_id === req.id;
1332
+ }).length === 0 && requiredCounter++;
1333
+ });
1334
+ objetcTemp["Imágenes"] = requiredCounter;
1335
+ setRequiredNull(objetcTemp);
1336
+ } catch (error) {
1337
+ console.log(error);
1338
+ }
1327
1339
  };
1328
1340
 
1329
1341
  (0, _react.useEffect)(function () {
@@ -1425,60 +1437,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1425
1437
  };
1426
1438
  }();
1427
1439
 
1428
- var evaluationComplete = function evaluationComplete() {
1429
- var concept = "";
1430
-
1431
- switch (activeTab) {
1432
- case "Ficha técnica":
1433
- concept = "datasheet";
1434
- break;
1435
-
1436
- case "Imágenes":
1437
- concept = "images";
1438
- break;
1439
-
1440
- case "Descripción":
1441
- concept = "description";
1442
- break;
1443
- }
1444
-
1445
- var serv = servicesData.filter(function (item) {
1446
- return item.service === concept;
1447
- });
1448
- var approved = "";
1449
- var rejected = "";
1450
-
1451
- if (product.status === "IN_PROGRESS" || product.status === "QF" || product.status === "RF") {
1452
- approved = "AF";
1453
- rejected = "RF";
1454
-
1455
- if (product.status === "IN_PROGRESS" || product.status === "QF") {
1456
- return serv.filter(function (item) {
1457
- return item.status === approved || item.status === rejected || item.status === "AA" || item.status === "IN_PROGRESS" || item.status === "AP";
1458
- }).length === serv.length;
1459
- }
1460
- } else if (product.status === "AF" || product.status === "RA" || product.status === "RP") {
1461
- approved = "AA";
1462
- rejected = "RA";
1463
-
1464
- if (product.status === "RP" || product.status === "AF") {
1465
- return serv.filter(function (item) {
1466
- return item.status === approved || item.status === rejected || item.status === "AP";
1467
- }).length === serv.length;
1468
- }
1469
- } else if (product.status === "RC") {
1470
- approved = "AP";
1471
- rejected = "RA";
1472
- return serv.filter(function (item) {
1473
- return item.status === approved || item.status === rejected;
1474
- }).length === serv.length;
1475
- }
1476
-
1477
- return serv.filter(function (item) {
1478
- return item.status === approved || item.status === rejected;
1479
- }).length === serv.length;
1480
- };
1481
-
1482
1440
  var downloadImages = function downloadImages() {
1483
1441
  selectedImages.forEach(function (e) {
1484
1442
  if (e.id) {
@@ -1553,26 +1511,6 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1553
1511
  }
1554
1512
  };
1555
1513
 
1556
- var specialistValid = function specialistValid(tab) {
1557
- var concept = "";
1558
-
1559
- switch (tab) {
1560
- case "Ficha técnica":
1561
- concept = "datasheet";
1562
- break;
1563
-
1564
- case "Imágenes":
1565
- concept = "images";
1566
- break;
1567
-
1568
- case "Descripción":
1569
- concept = "description";
1570
- break;
1571
- }
1572
-
1573
- return product["".concat(concept, "_status")] === "IN_PROGRESS" || product["".concat(concept, "_status")] === "RF" || product["".concat(concept, "_status")] === "RA";
1574
- };
1575
-
1576
1514
  var getRetailerStatus = function getRetailerStatus(servicesData, tab) {
1577
1515
  var arr = servicesData === null || servicesData === void 0 ? void 0 : servicesData.slice();
1578
1516
  var concept = getConcept(tab);
@@ -1624,7 +1562,8 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1624
1562
  var _product$services;
1625
1563
 
1626
1564
  return (product === null || product === void 0 ? void 0 : (_product$services = product.services) === null || _product$services === void 0 ? void 0 : _product$services.images) === 1 && updateImages();
1627
- }
1565
+ },
1566
+ showSaveButton: userAssigned()
1628
1567
  })]
1629
1568
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
1630
1569
  className: "product-information",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.1.12",
3
+ "version": "21.1.13",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -10,6 +10,7 @@ export const TableHeader = ({
10
10
  setAssignation,
11
11
  isRetailer,
12
12
  onClickSave,
13
+ showSaveButton,
13
14
  }) => {
14
15
  return (
15
16
  <Container>
@@ -24,6 +25,7 @@ export const TableHeader = ({
24
25
  setAssignation={setAssignation}
25
26
  isRetailer={isRetailer}
26
27
  onClickSave={onClickSave}
28
+ showSaveButton={showSaveButton}
27
29
  />
28
30
  </Container>
29
31
  );
@@ -15,6 +15,7 @@ export const ImageDataTable = ({
15
15
  setAssignation,
16
16
  isRetailer,
17
17
  onClickSave,
18
+ showSaveButton,
18
19
  }) => {
19
20
  return (
20
21
  <Container darkMode={darkMode}>
@@ -24,6 +25,7 @@ export const ImageDataTable = ({
24
25
  assignationsImages={assignationsImages}
25
26
  setAssignation={setAssignation}
26
27
  isRetailer={isRetailer}
28
+ showSaveButton={showSaveButton}
27
29
  onClickSave={onClickSave}
28
30
  />
29
31
  <Row>