contentoh-components-library 21.0.82 → 21.0.83

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.
@@ -41,7 +41,8 @@ var GalleryElement = function GalleryElement(_ref) {
41
41
  changeImage = _ref.changeImage,
42
42
  selectedImages = _ref.selectedImages,
43
43
  setSelectedImages = _ref.setSelectedImages,
44
- setCheckAll = _ref.setCheckAll;
44
+ setCheckAll = _ref.setCheckAll,
45
+ setSocketType = _ref.setSocketType;
45
46
 
46
47
  var _useState = (0, _react.useState)(validation),
47
48
  _useState2 = (0, _slicedToArray2.default)(_useState, 2),
@@ -110,7 +111,9 @@ var GalleryElement = function GalleryElement(_ref) {
110
111
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Select.default, {
111
112
  width: "100%",
112
113
  placeholder: "Tipo de toma",
113
- options: imageInputs,
114
+ options: imageInputs === null || imageInputs === void 0 ? void 0 : imageInputs.filter(function (img) {
115
+ return img.value === image.image_id || !img.active;
116
+ }),
114
117
  valueSelected: image.image_id,
115
118
  onChange: function onChange(e) {
116
119
  changeImage({
@@ -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 justify-content: space-between;\n padding-bottom: 5px;\n border-bottom: 1px solid ", ";\n\n .input-name-header {\n overflow: auto;\n max-width: 40%;\n white-space: nowrap;\n }\n .status-asignation-info {\n display: flex;\n align-items: center;\n\n * + * {\n margin-left: 5px;\n }\n }\n\n & + * {\n margin-top: 4px;\n }\n"])), _variables.GlobalColors.s2);
18
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n justify-content: space-between;\n padding-bottom: 5px;\n border-bottom: 1px solid ", ";\n\n .input-name-header {\n overflow-x: auto;\n max-width: 40%;\n white-space: nowrap;\n height: 23px;\n line-height: 23px;\n text-overflow: initial;\n }\n .status-asignation-info {\n display: flex;\n align-items: center;\n\n * + * {\n margin-left: 5px;\n }\n }\n\n & + * {\n margin-top: 4px;\n }\n"])), _variables.GlobalColors.s2);
19
19
 
20
20
  exports.Container = Container;
@@ -439,6 +439,11 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
439
439
  modalViewTextArea = _useState78[0],
440
440
  setModalViewTextArea = _useState78[1];
441
441
 
442
+ var _useState79 = (0, _react.useState)(null),
443
+ _useState80 = (0, _slicedToArray2.default)(_useState79, 2),
444
+ socketType = _useState80[0],
445
+ setSocketType = _useState80[1];
446
+
442
447
  (0, _react.useEffect)(function () {
443
448
  checkAll && setSelectedImages(images.values);
444
449
  }, [checkAll]);
@@ -684,15 +689,9 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
684
689
  }, [activeRetailer, services]);
685
690
 
686
691
  var thumbs = function thumbs() {
687
- var _images$inputs, _images$imageType, _images$imagePackagin, _images$values;
692
+ var _images$imageType, _images$imagePackagin, _images$values;
688
693
 
689
- 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) {
690
- return {
691
- value: e === null || e === void 0 ? void 0 : e.id,
692
- name: e === null || e === void 0 ? void 0 : e.name,
693
- required: e === null || e === void 0 ? void 0 : e.required
694
- };
695
- });
694
+ var imageInputs = socketType.slice();
696
695
  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) {
697
696
  return {
698
697
  value: e === null || e === void 0 ? void 0 : e.id,
@@ -723,6 +722,22 @@ var ProviderProductEdition = function ProviderProductEdition(_ref) {
723
722
  });
724
723
  };
725
724
 
725
+ (0, _react.useEffect)(function () {
726
+ var _images$inputs;
727
+
728
+ 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) {
729
+ return {
730
+ value: e === null || e === void 0 ? void 0 : e.id,
731
+ name: e === null || e === void 0 ? void 0 : e.name,
732
+ required: e === null || e === void 0 ? void 0 : e.required,
733
+ active: images === null || images === void 0 ? void 0 : images.values.some(function (value) {
734
+ return (value === null || value === void 0 ? void 0 : value.image_id) === (e === null || e === void 0 ? void 0 : e.id);
735
+ })
736
+ };
737
+ });
738
+ setSocketType(imageInputs);
739
+ }, [images]);
740
+
726
741
  var saveDescriptions = /*#__PURE__*/function () {
727
742
  var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
728
743
  var productTemp, dataObject;
@@ -42,8 +42,8 @@ RetailerProductEditionDefault.args = {
42
42
  images: 1
43
43
  },
44
44
  orderId: 233,
45
- status: "IN_PROGRESS",
46
- datasheet_status: "IN_PROGRESS",
45
+ status: "QF",
46
+ datasheet_status: "QF",
47
47
  prio: "none",
48
48
  version: 2,
49
49
  description_status: "QF",
@@ -79,13 +79,15 @@ RetailerProductEditionDefault.args = {
79
79
  name: "Walmart Super y Superama",
80
80
  country: "México",
81
81
  id_region: 1,
82
- active: 1
82
+ active: 1,
83
+ percentage: 100
83
84
  }, {
84
85
  id: 26,
85
86
  name: "Mercado Libre",
86
87
  country: "México",
87
88
  id_region: 1,
88
- active: 1
89
+ active: 1,
90
+ percentage: 100
89
91
  }],
90
92
  country: "México",
91
93
  upc: "6545345"
@@ -97,22 +99,22 @@ RetailerProductEditionDefault.args = {
97
99
  }
98
100
  },
99
101
  user: {
100
- id_user: 54,
101
- name: "ESPECIALISTA TXTS PRUEBA",
102
+ id_user: 53,
103
+ name: "FACILITADOR ED PRUEBA",
102
104
  last_name: "",
103
- email: "rlegorreta@contentoh.com",
105
+ email: "arojas@contentoh.com",
104
106
  position: null,
105
107
  telephone: null,
106
108
  country: null,
107
109
  id_company: 2,
108
- id_cognito: "ca1d24ab-e992-4c19-b4e1-2fe6f720c16b",
110
+ id_cognito: "c106e141-e221-49e8-a382-ce99385c6d88",
109
111
  birth_Date: null,
110
112
  about_me: null,
111
113
  zip_code: null,
112
114
  address: null,
113
115
  job: null,
114
116
  id_stripe: null,
115
- id_role: 7,
117
+ id_role: 5,
116
118
  active: 1,
117
119
  is_retailer: 0,
118
120
  membership: {
@@ -126,6 +128,6 @@ RetailerProductEditionDefault.args = {
126
128
  products_limit: "3",
127
129
  type: "PyMES"
128
130
  },
129
- src: "https://content-management-profile.s3.amazonaws.com/id-54/54.png?1653425316222"
131
+ src: "https://content-management-profile.s3.amazonaws.com/id-53/53.png?1655161876316"
130
132
  }
131
133
  };
@@ -367,6 +367,11 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
367
367
  statusArray = _useState64[0],
368
368
  setStatusArray = _useState64[1];
369
369
 
370
+ var _useState65 = (0, _react.useState)(null),
371
+ _useState66 = (0, _slicedToArray2.default)(_useState65, 2),
372
+ socketType = _useState66[0],
373
+ setSocketType = _useState66[1];
374
+
370
375
  (0, _react.useEffect)(function () {
371
376
  checkAll && setSelectedImages(images.values);
372
377
  }, [checkAll]);
@@ -629,15 +634,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
629
634
  }, [activeRetailer, services]);
630
635
 
631
636
  var thumbs = function thumbs() {
632
- var _images$inputs, _images$imageType, _images$imagePackagin, _images$values;
637
+ var _images$imageType, _images$imagePackagin, _images$values;
633
638
 
634
- 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) {
635
- return {
636
- value: e === null || e === void 0 ? void 0 : e.id,
637
- name: e === null || e === void 0 ? void 0 : e.name,
638
- required: e === null || e === void 0 ? void 0 : e.required
639
- };
640
- });
639
+ var imageInputs = socketType.slice();
641
640
  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) {
642
641
  return {
643
642
  value: e === null || e === void 0 ? void 0 : e.id,
@@ -661,6 +660,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
661
660
  imageType: imageType,
662
661
  imagePackagingType: imagePackagingType,
663
662
  imageInputs: imageInputs,
663
+ setSocketType: setSocketType,
664
664
  changeImage: setImages,
665
665
  selectedImages: selectedImages,
666
666
  setSelectedImages: setSelectedImages
@@ -777,6 +777,21 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
777
777
  };
778
778
  }();
779
779
 
780
+ (0, _react.useEffect)(function () {
781
+ var _images$inputs;
782
+
783
+ 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) {
784
+ return {
785
+ value: e === null || e === void 0 ? void 0 : e.id,
786
+ name: e === null || e === void 0 ? void 0 : e.name,
787
+ required: e === null || e === void 0 ? void 0 : e.required,
788
+ active: images === null || images === void 0 ? void 0 : images.values.some(function (value) {
789
+ return (value === null || value === void 0 ? void 0 : value.image_id) === (e === null || e === void 0 ? void 0 : e.id);
790
+ })
791
+ };
792
+ });
793
+ setSocketType(imageInputs);
794
+ }, [images]);
780
795
  var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
781
796
  var _images$values2, _product$article10, _data$articleData, _data$articleData2, _data$updateImages;
782
797
 
@@ -992,8 +1007,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
992
1007
  };
993
1008
 
994
1009
  var approveRejectButtons = function approveRejectButtons(action) {
995
- var concept = getConcept(activeTab);
996
- concept = action ? action : concept;
1010
+ var concept = getConcept(action || activeTab);
997
1011
 
998
1012
  var _servicesData$filter = servicesData.filter(function (srv) {
999
1013
  return srv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && srv.service === concept;
@@ -1152,24 +1166,9 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
1152
1166
  }();
1153
1167
 
1154
1168
  var userAssigned = function userAssigned(tab, rol) {
1155
- var concept = "";
1156
-
1157
- switch (tab) {
1158
- case "Ficha técnica":
1159
- concept = "datasheet";
1160
- break;
1161
-
1162
- case "Imágenes":
1163
- concept = "images";
1164
- break;
1165
-
1166
- default:
1167
- concept = "description";
1168
- break;
1169
- }
1170
-
1169
+ var concept = getConcept(activeTab);
1171
1170
  var allowedRoles = [1, 4, 5, 6, 7, 8];
1172
- var validUser = allowedRoles.indexOf(user === null || user === void 0 ? void 0 : user.id_role) !== -1;
1171
+ var validUser = allowedRoles.includes(user === null || user === void 0 ? void 0 : user.id_role);
1173
1172
 
1174
1173
  if (!rol) {
1175
1174
  switch (user.id_role) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.0.82",
3
+ "version": "21.0.83",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -20,6 +20,7 @@ export const GalleryElement = ({
20
20
  selectedImages,
21
21
  setSelectedImages,
22
22
  setCheckAll,
23
+ setSocketType,
23
24
  }) => {
24
25
  const [statusValidation, setStatusValidation] = useState(validation);
25
26
  const [showValidationPanel, setShowValidationPanel] = useState(false);
@@ -76,7 +77,9 @@ export const GalleryElement = ({
76
77
  <Select
77
78
  width="100%"
78
79
  placeholder="Tipo de toma"
79
- options={imageInputs}
80
+ options={imageInputs?.filter(
81
+ (img) => img.value === image.image_id || !img.active
82
+ )}
80
83
  valueSelected={image.image_id}
81
84
  onChange={(e) => {
82
85
  changeImage({
@@ -8,9 +8,12 @@ export const Container = styled.div`
8
8
  border-bottom: 1px solid ${GlobalColors.s2};
9
9
 
10
10
  .input-name-header {
11
- overflow: auto;
11
+ overflow-x: auto;
12
12
  max-width: 40%;
13
13
  white-space: nowrap;
14
+ height: 23px;
15
+ line-height: 23px;
16
+ text-overflow: initial;
14
17
  }
15
18
  .status-asignation-info {
16
19
  display: flex;
@@ -192,6 +192,7 @@ export const ProviderProductEdition = ({
192
192
  img: face,
193
193
  });
194
194
  const [modalViewTextArea, setModalViewTextArea] = useState(false);
195
+ const [socketType, setSocketType] = useState(null);
195
196
 
196
197
  useEffect(() => {
197
198
  checkAll && setSelectedImages(images.values);
@@ -355,11 +356,7 @@ export const ProviderProductEdition = ({
355
356
  }, [activeRetailer, services]);
356
357
 
357
358
  const thumbs = () => {
358
- const imageInputs = images?.inputs?.map((e) => ({
359
- value: e?.id,
360
- name: e?.name,
361
- required: e?.required,
362
- }));
359
+ const imageInputs = socketType.slice();
363
360
  const imageType = images?.imageType?.map((e) => ({
364
361
  value: e?.id,
365
362
  name: e?.name,
@@ -387,6 +384,16 @@ export const ProviderProductEdition = ({
387
384
  ));
388
385
  };
389
386
 
387
+ useEffect(() => {
388
+ const imageInputs = images?.inputs?.map((e) => ({
389
+ value: e?.id,
390
+ name: e?.name,
391
+ required: e?.required,
392
+ active: images?.values.some((value) => value?.image_id === e?.id),
393
+ }));
394
+ setSocketType(imageInputs);
395
+ }, [images]);
396
+
390
397
  const saveDescriptions = async () => {
391
398
  setLoading(true);
392
399
  const productTemp = product;
@@ -27,8 +27,8 @@ RetailerProductEditionDefault.args = {
27
27
  images: 1,
28
28
  },
29
29
  orderId: 233,
30
- status: "IN_PROGRESS",
31
- datasheet_status: "IN_PROGRESS",
30
+ status: "QF",
31
+ datasheet_status: "QF",
32
32
  prio: "none",
33
33
  version: 2,
34
34
  description_status: "QF",
@@ -67,6 +67,7 @@ RetailerProductEditionDefault.args = {
67
67
  country: "México",
68
68
  id_region: 1,
69
69
  active: 1,
70
+ percentage: 100,
70
71
  },
71
72
  {
72
73
  id: 26,
@@ -74,6 +75,7 @@ RetailerProductEditionDefault.args = {
74
75
  country: "México",
75
76
  id_region: 1,
76
77
  active: 1,
78
+ percentage: 100,
77
79
  },
78
80
  ],
79
81
  country: "México",
@@ -83,22 +85,22 @@ RetailerProductEditionDefault.args = {
83
85
  product: { articleId: 109485, versionId: 3 },
84
86
  },
85
87
  user: {
86
- id_user: 54,
87
- name: "ESPECIALISTA TXTS PRUEBA",
88
+ id_user: 53,
89
+ name: "FACILITADOR ED PRUEBA",
88
90
  last_name: "",
89
- email: "rlegorreta@contentoh.com",
91
+ email: "arojas@contentoh.com",
90
92
  position: null,
91
93
  telephone: null,
92
94
  country: null,
93
95
  id_company: 2,
94
- id_cognito: "ca1d24ab-e992-4c19-b4e1-2fe6f720c16b",
96
+ id_cognito: "c106e141-e221-49e8-a382-ce99385c6d88",
95
97
  birth_Date: null,
96
98
  about_me: null,
97
99
  zip_code: null,
98
100
  address: null,
99
101
  job: null,
100
102
  id_stripe: null,
101
- id_role: 7,
103
+ id_role: 5,
102
104
  active: 1,
103
105
  is_retailer: 0,
104
106
  membership: {
@@ -112,6 +114,6 @@ RetailerProductEditionDefault.args = {
112
114
  products_limit: "3",
113
115
  type: "PyMES",
114
116
  },
115
- src: "https://content-management-profile.s3.amazonaws.com/id-54/54.png?1653425316222",
117
+ src: "https://content-management-profile.s3.amazonaws.com/id-53/53.png?1655161876316",
116
118
  },
117
119
  };
@@ -150,6 +150,7 @@ export const RetailerProductEdition = ({
150
150
  const [loading, setLoading] = useState(true);
151
151
  const [retailerStatus, setRetailerStatus] = useState("-");
152
152
  const [statusArray, setStatusArray] = useState([]);
153
+ const [socketType, setSocketType] = useState(null);
153
154
 
154
155
  useEffect(() => {
155
156
  checkAll && setSelectedImages(images.values);
@@ -339,11 +340,7 @@ export const RetailerProductEdition = ({
339
340
  }, [activeRetailer, services]);
340
341
 
341
342
  const thumbs = () => {
342
- const imageInputs = images?.inputs?.map((e) => ({
343
- value: e?.id,
344
- name: e?.name,
345
- required: e?.required,
346
- }));
343
+ const imageInputs = socketType.slice();
347
344
  const imageType = images?.imageType?.map((e) => ({
348
345
  value: e?.id,
349
346
  name: e?.name,
@@ -364,6 +361,7 @@ export const RetailerProductEdition = ({
364
361
  imageType={imageType}
365
362
  imagePackagingType={imagePackagingType}
366
363
  imageInputs={imageInputs}
364
+ setSocketType={setSocketType}
367
365
  changeImage={setImages}
368
366
  selectedImages={selectedImages}
369
367
  setSelectedImages={setSelectedImages}
@@ -432,6 +430,16 @@ export const RetailerProductEdition = ({
432
430
  }
433
431
  };
434
432
 
433
+ useEffect(() => {
434
+ const imageInputs = images?.inputs?.map((e) => ({
435
+ value: e?.id,
436
+ name: e?.name,
437
+ required: e?.required,
438
+ active: images?.values.some((value) => value?.image_id === e?.id),
439
+ }));
440
+ setSocketType(imageInputs);
441
+ }, [images]);
442
+
435
443
  const updateImages = useCallback(async () => {
436
444
  const imagesList = images?.values?.slice();
437
445
  const imagesListTemp = imagesList?.reduce((acc, image) => {
@@ -591,8 +599,7 @@ export const RetailerProductEdition = ({
591
599
  };
592
600
 
593
601
  const approveRejectButtons = (action) => {
594
- let concept = getConcept(activeTab);
595
- concept = action ? action : concept;
602
+ let concept = getConcept(action || activeTab);
596
603
 
597
604
  const [retailerStatus] = servicesData.filter(
598
605
  (srv) => srv.id_retailer === activeRetailer?.id && srv.service === concept
@@ -725,22 +732,10 @@ export const RetailerProductEdition = ({
725
732
  };
726
733
 
727
734
  const userAssigned = (tab, rol) => {
728
- let concept = "";
729
- switch (tab) {
730
- case "Ficha técnica":
731
- concept = "datasheet";
732
- break;
733
- case "Imágenes":
734
- concept = "images";
735
- break;
736
-
737
- default:
738
- concept = "description";
739
- break;
740
- }
735
+ let concept = getConcept(activeTab);
741
736
 
742
737
  const allowedRoles = [1, 4, 5, 6, 7, 8];
743
- const validUser = allowedRoles.indexOf(user?.id_role) !== -1;
738
+ const validUser = allowedRoles.includes(user?.id_role);
744
739
 
745
740
  if (!rol) {
746
741
  switch (user.id_role) {