contentoh-components-library 21.0.62 → 21.0.65
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.
- package/dist/components/atoms/InputFormatter/index.js +3 -4
- package/dist/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +102 -0
- package/dist/components/pages/ProviderProductEdition/index.js +1688 -0
- package/dist/components/pages/ProviderProductEdition/styles.js +21 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +36 -54
- package/dist/components/pages/RetailerProductEdition/index.js +84 -66
- package/package.json +1 -1
- package/src/components/pages/ProviderProductEdition/ProviderProductEdition.stories.js +89 -0
- package/src/components/pages/ProviderProductEdition/index.js +1249 -0
- package/src/components/pages/ProviderProductEdition/styles.js +100 -0
- package/src/components/pages/RetailerProductEdition/index.js +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.Container = void 0;
|
|
9
|
+
|
|
10
|
+
var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
|
|
11
|
+
|
|
12
|
+
var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
13
|
+
|
|
14
|
+
var _templateObject;
|
|
15
|
+
|
|
16
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-direction: column;\n height: 100%;\n flex: 1;\n overflow: auto;\n\n .data-container {\n display: flex;\n flex: 0%;\n height: calc(100% - ", "px);\n .image-data-panel {\n width: 340px;\n\n & + * {\n margin-left: 10px;\n }\n }\n\n .product-information {\n width: 100%;\n display: flex;\n flex-direction: column;\n\n .services-information-container {\n height: 100%;\n overflow: auto;\n }\n\n .image-services {\n aside {\n display: grid;\n grid-template-columns: repeat(auto-fill, 179px);\n column-gap: 15px;\n row-gap: 15px;\n padding: 20px;\n }\n }\n\n .commentary-box {\n display: flex;\n justify-content: space-between;\n align-items: flex-end;\n padding: 10px;\n padding-left: 0;\n\n .commentary {\n display: flex;\n align-items: flex-end;\n\n .input-container {\n width: 500px;\n\n .quill {\n height: 100px;\n }\n\n & + * {\n margin-left: 5px;\n }\n }\n\n .buttons-box {\n display: flex;\n width: 210px;\n flex-wrap: wrap;\n\n .general-transparent-button {\n & + * {\n margin-top: 5px;\n }\n }\n\n .general-transparent-button,\n .general-green-button,\n .general-button-disabled {\n width: fit-content;\n min-width: 201px;\n height: 40px;\n }\n }\n }\n }\n\n .feedback-box {\n display: flex;\n }\n }\n }\n .container {\n width: 100%;\n height: 100%;\n .dropzone {\n height: 100%;\n width: 100%;\n }\n }\n"])), function (_ref) {
|
|
17
|
+
var headerTop = _ref.headerTop;
|
|
18
|
+
return headerTop;
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
exports.Container = Container;
|
|
@@ -41,26 +41,26 @@ RetailerProductEditionDefault.args = {
|
|
|
41
41
|
descriptions: 1,
|
|
42
42
|
images: 1
|
|
43
43
|
},
|
|
44
|
-
orderId:
|
|
45
|
-
status: "
|
|
46
|
-
datasheet_status: "
|
|
44
|
+
orderId: 152,
|
|
45
|
+
status: "ASSIGNED",
|
|
46
|
+
datasheet_status: "IN_PROGRESS",
|
|
47
47
|
prio: "none",
|
|
48
|
-
version:
|
|
49
|
-
description_status: "
|
|
50
|
-
images_status: "
|
|
48
|
+
version: 3,
|
|
49
|
+
description_status: "IN_PROGRESS",
|
|
50
|
+
images_status: "IN_PROGRESS",
|
|
51
51
|
article: {
|
|
52
|
-
id_article:
|
|
53
|
-
id_category: "
|
|
54
|
-
name: "
|
|
55
|
-
upc: "
|
|
56
|
-
timestamp: "2022-
|
|
52
|
+
id_article: 343,
|
|
53
|
+
id_category: "2898",
|
|
54
|
+
name: "Producto prueba dos ",
|
|
55
|
+
upc: "2004202212",
|
|
56
|
+
timestamp: "2022-04-20T17:01:17.000Z",
|
|
57
57
|
id_user: 28,
|
|
58
58
|
status: "NULL",
|
|
59
59
|
active: 1,
|
|
60
60
|
company_id: 1,
|
|
61
61
|
company_name: "COMPANY DEV",
|
|
62
|
-
country: "
|
|
63
|
-
id_order:
|
|
62
|
+
country: "México",
|
|
63
|
+
id_order: 152,
|
|
64
64
|
id_datasheet_especialist: 54,
|
|
65
65
|
id_datasheet_facilitator: 52,
|
|
66
66
|
id_description_especialist: 54,
|
|
@@ -69,62 +69,44 @@ RetailerProductEditionDefault.args = {
|
|
|
69
69
|
id_images_facilitator: 53,
|
|
70
70
|
id_auditor: 30,
|
|
71
71
|
id_recepcionist: null,
|
|
72
|
-
category: "
|
|
73
|
-
missingAttributes:
|
|
74
|
-
missingDescriptions:
|
|
75
|
-
missingImages:
|
|
72
|
+
category: "HALLOWEN|DECORACIÓN E INFLABLES|DECORACIÓN E INFLABLES",
|
|
73
|
+
missingAttributes: null,
|
|
74
|
+
missingDescriptions: null,
|
|
75
|
+
missingImages: null
|
|
76
76
|
},
|
|
77
77
|
retailers: [{
|
|
78
|
-
id:
|
|
79
|
-
name: "
|
|
80
|
-
country: "México",
|
|
81
|
-
id_region: 1,
|
|
82
|
-
active: 1
|
|
83
|
-
}, {
|
|
84
|
-
id: 5,
|
|
85
|
-
name: "Chedraui",
|
|
86
|
-
country: "México",
|
|
87
|
-
id_region: 1,
|
|
88
|
-
active: 1
|
|
89
|
-
}, {
|
|
90
|
-
id: 9,
|
|
91
|
-
name: "Amazon",
|
|
92
|
-
country: "México",
|
|
93
|
-
id_region: 1,
|
|
94
|
-
active: 1
|
|
95
|
-
}, {
|
|
96
|
-
id: 12,
|
|
97
|
-
name: "La Comer",
|
|
98
|
-
country: "México",
|
|
99
|
-
id_region: 1,
|
|
100
|
-
active: 1
|
|
101
|
-
}, {
|
|
102
|
-
id: 20,
|
|
103
|
-
name: "Cornershop",
|
|
78
|
+
id: 58,
|
|
79
|
+
name: "The Home Depot",
|
|
104
80
|
country: "México",
|
|
105
81
|
id_region: 1,
|
|
106
82
|
active: 1
|
|
107
83
|
}],
|
|
108
|
-
country: "
|
|
109
|
-
upc: "
|
|
84
|
+
country: "México",
|
|
85
|
+
upc: "2004202212"
|
|
86
|
+
},
|
|
87
|
+
location: {
|
|
88
|
+
product: {
|
|
89
|
+
articleId: 109485,
|
|
90
|
+
versionId: 3
|
|
91
|
+
}
|
|
110
92
|
},
|
|
111
93
|
user: {
|
|
112
|
-
id_user:
|
|
113
|
-
name: "
|
|
114
|
-
last_name: "
|
|
115
|
-
email: "
|
|
116
|
-
position:
|
|
94
|
+
id_user: 54,
|
|
95
|
+
name: "ESPECIALISTA TXTS PRUEBA",
|
|
96
|
+
last_name: "",
|
|
97
|
+
email: "rlegorreta@contentoh.com",
|
|
98
|
+
position: null,
|
|
117
99
|
telephone: null,
|
|
118
|
-
country:
|
|
100
|
+
country: null,
|
|
119
101
|
id_company: 2,
|
|
120
|
-
id_cognito: "
|
|
102
|
+
id_cognito: "ca1d24ab-e992-4c19-b4e1-2fe6f720c16b",
|
|
121
103
|
birth_Date: null,
|
|
122
104
|
about_me: null,
|
|
123
105
|
zip_code: null,
|
|
124
106
|
address: null,
|
|
125
107
|
job: null,
|
|
126
108
|
id_stripe: null,
|
|
127
|
-
id_role:
|
|
109
|
+
id_role: 7,
|
|
128
110
|
active: 1,
|
|
129
111
|
is_retailer: 0,
|
|
130
112
|
membership: {
|
|
@@ -138,6 +120,6 @@ RetailerProductEditionDefault.args = {
|
|
|
138
120
|
products_limit: "3",
|
|
139
121
|
type: "PyMES"
|
|
140
122
|
},
|
|
141
|
-
src: "https://content-management-profile.s3.amazonaws.com/id-
|
|
123
|
+
src: "https://content-management-profile.s3.amazonaws.com/id-54/54.png?1653425316222"
|
|
142
124
|
}
|
|
143
125
|
};
|
|
@@ -123,13 +123,15 @@ var myBucket = new _awsSdk.default.S3({
|
|
|
123
123
|
});
|
|
124
124
|
|
|
125
125
|
var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
126
|
-
var
|
|
126
|
+
var _product$retailers, _product$services5, _datasheets$, _datasheets$$data, _product$article13;
|
|
127
127
|
|
|
128
128
|
var tabsSections = _ref.tabsSections,
|
|
129
129
|
_ref$productSelected = _ref.productSelected,
|
|
130
130
|
productSelected = _ref$productSelected === void 0 ? {} : _ref$productSelected,
|
|
131
131
|
_ref$user = _ref.user,
|
|
132
132
|
user = _ref$user === void 0 ? {} : _ref$user,
|
|
133
|
+
_ref$location = _ref.location,
|
|
134
|
+
location = _ref$location === void 0 ? {} : _ref$location,
|
|
133
135
|
token = _ref.token;
|
|
134
136
|
|
|
135
137
|
var _useState = (0, _react.useState)("Descripción"),
|
|
@@ -252,7 +254,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
252
254
|
dataImages = _useState22[0],
|
|
253
255
|
setDataImages = _useState22[1];
|
|
254
256
|
|
|
255
|
-
var _useState23 = (0, _react.useState)(new Array(
|
|
257
|
+
var _useState23 = (0, _react.useState)(new Array(product === null || product === void 0 ? void 0 : (_product$retailers = product.retailers) === null || _product$retailers === void 0 ? void 0 : _product$retailers.length).fill({
|
|
256
258
|
percentage: 0
|
|
257
259
|
})),
|
|
258
260
|
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
@@ -264,7 +266,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
264
266
|
activePercentage = _useState26[0],
|
|
265
267
|
setActivePercentage = _useState26[1];
|
|
266
268
|
|
|
267
|
-
var _useState27 = (0, _react.useState)(
|
|
269
|
+
var _useState27 = (0, _react.useState)({}),
|
|
268
270
|
_useState28 = (0, _slicedToArray2.default)(_useState27, 2),
|
|
269
271
|
activeRetailer = _useState28[0],
|
|
270
272
|
setActiveRetailer = _useState28[1];
|
|
@@ -294,7 +296,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
294
296
|
icon = _useState38[0],
|
|
295
297
|
setIcon = _useState38[1];
|
|
296
298
|
|
|
297
|
-
var _useState39 = (0, _react.useState)(
|
|
299
|
+
var _useState39 = (0, _react.useState)(product === null || product === void 0 ? void 0 : product.version),
|
|
298
300
|
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
299
301
|
version = _useState40[0],
|
|
300
302
|
setVersion = _useState40[1];
|
|
@@ -371,7 +373,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
371
373
|
|
|
372
374
|
var loadData = /*#__PURE__*/function () {
|
|
373
375
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2() {
|
|
374
|
-
var
|
|
376
|
+
var _product$article, _product$article2, _services$, _services$$values;
|
|
375
377
|
|
|
376
378
|
var services;
|
|
377
379
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
@@ -379,26 +381,27 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
379
381
|
switch (_context2.prev = _context2.next) {
|
|
380
382
|
case 0:
|
|
381
383
|
_context2.next = 2;
|
|
382
|
-
return (0, _data2.getRetailerServices)(
|
|
384
|
+
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);
|
|
383
385
|
|
|
384
386
|
case 2:
|
|
385
387
|
services = _context2.sent;
|
|
386
388
|
//Converts the data inside the datasheets object to array
|
|
387
|
-
setServices(services); //setActiveRetailer(
|
|
389
|
+
setServices(services); //setActiveRetailer(product?.retailers[0]);
|
|
388
390
|
|
|
389
391
|
setImages({
|
|
390
392
|
action: "init",
|
|
391
393
|
init: services[2]
|
|
392
394
|
});
|
|
393
395
|
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);
|
|
396
|
+
setActiveRetailer(product.retailers ? product.retailers[0] : product.retailersAvailable[0]);
|
|
394
397
|
(0, _data2.getPercentage)({
|
|
395
|
-
data: [
|
|
398
|
+
data: [product]
|
|
396
399
|
}).then(function (res) {
|
|
397
400
|
return setPercentages(res);
|
|
398
401
|
});
|
|
399
402
|
setLoading(false);
|
|
400
403
|
|
|
401
|
-
case
|
|
404
|
+
case 9:
|
|
402
405
|
case "end":
|
|
403
406
|
return _context2.stop();
|
|
404
407
|
}
|
|
@@ -413,7 +416,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
413
416
|
|
|
414
417
|
var getServices = /*#__PURE__*/function () {
|
|
415
418
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
416
|
-
var _product$
|
|
419
|
+
var _product$article3, _product$article4, _servicesResponse$dat;
|
|
417
420
|
|
|
418
421
|
var servicesResponse, parsedResponse;
|
|
419
422
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
@@ -421,7 +424,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
421
424
|
switch (_context3.prev = _context3.next) {
|
|
422
425
|
case 0:
|
|
423
426
|
_context3.next = 2;
|
|
424
|
-
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$
|
|
427
|
+
return _axios.default.get("".concat(process.env.REACT_APP_SERVICES_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article3 = product.article) === null || _product$article3 === void 0 ? void 0 : _product$article3.id_article, "&orderId=").concat(product === null || product === void 0 ? void 0 : (_product$article4 = product.article) === null || _product$article4 === void 0 ? void 0 : _product$article4.id_order, "&end=true"));
|
|
425
428
|
|
|
426
429
|
case 2:
|
|
427
430
|
servicesResponse = _context3.sent;
|
|
@@ -457,7 +460,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
457
460
|
|
|
458
461
|
var getComments = /*#__PURE__*/function () {
|
|
459
462
|
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
460
|
-
var
|
|
463
|
+
var _product$article5, _product$article6, _product$article7;
|
|
461
464
|
|
|
462
465
|
var tab,
|
|
463
466
|
commentsResponse,
|
|
@@ -469,7 +472,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
469
472
|
case 0:
|
|
470
473
|
tab = _args4.length > 0 && _args4[0] !== undefined ? _args4[0] : "Descripción";
|
|
471
474
|
_context4.next = 3;
|
|
472
|
-
return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(
|
|
475
|
+
return Promise.all([_axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article5 = product.article) === null || _product$article5 === void 0 ? void 0 : _product$article5.id_article, "&concept=description&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article6 = product.article) === null || _product$article6 === void 0 ? void 0 : _product$article6.id_article, "&concept=datasheet&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version)), _axios.default.get("".concat(process.env.REACT_APP_COMMENTS_ENDPOINT, "?articleId=").concat(product === null || product === void 0 ? void 0 : (_product$article7 = product.article) === null || _product$article7 === void 0 ? void 0 : _product$article7.id_article, "&concept=images&orderIdColab=").concat(product === null || product === void 0 ? void 0 : product.orderId, "&version=").concat(version))]);
|
|
473
476
|
|
|
474
477
|
case 3:
|
|
475
478
|
commentsResponse = _context4.sent;
|
|
@@ -501,7 +504,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
501
504
|
while (1) {
|
|
502
505
|
switch (_context5.prev = _context5.next) {
|
|
503
506
|
case 0:
|
|
504
|
-
loadData(); // getPercentage({ data: [
|
|
507
|
+
loadData(); // getPercentage({ data: [product] }).then((res) =>
|
|
505
508
|
// setPercentages(res)
|
|
506
509
|
// );
|
|
507
510
|
|
|
@@ -544,7 +547,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
544
547
|
}
|
|
545
548
|
}
|
|
546
549
|
}, _callee5);
|
|
547
|
-
})), []);
|
|
550
|
+
})), [product]);
|
|
548
551
|
|
|
549
552
|
var loadAssignations = function loadAssignations(currentProduct) {
|
|
550
553
|
var _currentProduct$artic, _currentProduct$artic2, _currentProduct$artic3, _currentProduct$artic4, _currentProduct$artic5, _currentProduct$artic6;
|
|
@@ -593,25 +596,25 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
593
596
|
};
|
|
594
597
|
|
|
595
598
|
(0, _react.useEffect)(function () {
|
|
596
|
-
loadAssignations(
|
|
599
|
+
loadAssignations(product);
|
|
597
600
|
}, [userGroups]);
|
|
598
601
|
(0, _react.useEffect)(function () {
|
|
599
|
-
var
|
|
602
|
+
var _product$retailers2, _product$retailers$;
|
|
600
603
|
|
|
601
|
-
|
|
604
|
+
product === null || product === void 0 ? void 0 : (_product$retailers2 = product.retailers) === null || _product$retailers2 === void 0 ? void 0 : _product$retailers2.forEach(function (retailer) {
|
|
602
605
|
var _percentages$filter$;
|
|
603
606
|
|
|
604
607
|
retailer["percentage"] = percentages === null || percentages === void 0 ? void 0 : (_percentages$filter$ = percentages.filter(function (percent) {
|
|
605
608
|
return (retailer === null || retailer === void 0 ? void 0 : retailer.id) === (percent === null || percent === void 0 ? void 0 : percent.id_retailer);
|
|
606
609
|
})[0]) === null || _percentages$filter$ === void 0 ? void 0 : _percentages$filter$.percentage;
|
|
607
610
|
});
|
|
608
|
-
setActivePercentage(
|
|
611
|
+
setActivePercentage(product === null || product === void 0 ? void 0 : (_product$retailers$ = product.retailers[0]) === null || _product$retailers$ === void 0 ? void 0 : _product$retailers$.percentage);
|
|
609
612
|
}, [percentages]);
|
|
610
613
|
(0, _react.useEffect)(function () {
|
|
611
614
|
if (services.length > 0) {
|
|
612
|
-
var _services$2, _services$3;
|
|
615
|
+
var _services$0$activeRet, _services$2, _services$3;
|
|
613
616
|
|
|
614
|
-
if (services[0][activeRetailer.id].data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
|
|
617
|
+
if ((_services$0$activeRet = services[0][activeRetailer.id]) !== null && _services$0$activeRet !== void 0 && _services$0$activeRet.data) services[0][activeRetailer.id].data = Object.values(services[0][activeRetailer.id].data);
|
|
615
618
|
setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
|
|
616
619
|
var datagroups = services[0][activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id];
|
|
617
620
|
var inputs = (_services$2 = services[0]) === null || _services$2 === void 0 ? void 0 : _services$2.inputs;
|
|
@@ -666,44 +669,51 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
666
669
|
|
|
667
670
|
var saveDescriptions = /*#__PURE__*/function () {
|
|
668
671
|
var _ref7 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
669
|
-
var
|
|
672
|
+
var _product$article8;
|
|
670
673
|
|
|
671
|
-
var dataObject;
|
|
674
|
+
var productTemp, dataObject;
|
|
672
675
|
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
673
676
|
while (1) {
|
|
674
677
|
switch (_context6.prev = _context6.next) {
|
|
675
678
|
case 0:
|
|
676
679
|
setLoading(true);
|
|
680
|
+
productTemp = product;
|
|
677
681
|
dataObject = {
|
|
678
|
-
articleId:
|
|
682
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article8 = product.article) === null || _product$article8 === void 0 ? void 0 : _product$article8.id_article,
|
|
679
683
|
articleData: updatedDescriptions
|
|
680
684
|
};
|
|
681
|
-
if (
|
|
682
|
-
_context6.prev =
|
|
683
|
-
_context6.next =
|
|
685
|
+
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
686
|
+
_context6.prev = 4;
|
|
687
|
+
_context6.next = 7;
|
|
684
688
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?description=true&version=").concat(version), dataObject, {
|
|
685
689
|
headers: {
|
|
686
690
|
Authorization: token
|
|
687
691
|
}
|
|
688
692
|
});
|
|
689
693
|
|
|
690
|
-
case
|
|
694
|
+
case 7:
|
|
695
|
+
if (productTemp.status === "ASSIGNED") {
|
|
696
|
+
productTemp.status = "IN_PROGRESS";
|
|
697
|
+
setProduct(productTemp);
|
|
698
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
699
|
+
}
|
|
700
|
+
|
|
691
701
|
setMessage("Descripciones guardadas con éxito");
|
|
692
702
|
loadData();
|
|
693
|
-
_context6.next =
|
|
703
|
+
_context6.next = 15;
|
|
694
704
|
break;
|
|
695
705
|
|
|
696
|
-
case
|
|
697
|
-
_context6.prev =
|
|
698
|
-
_context6.t0 = _context6["catch"](
|
|
706
|
+
case 12:
|
|
707
|
+
_context6.prev = 12;
|
|
708
|
+
_context6.t0 = _context6["catch"](4);
|
|
699
709
|
console.log(_context6.t0);
|
|
700
710
|
|
|
701
|
-
case
|
|
711
|
+
case 15:
|
|
702
712
|
case "end":
|
|
703
713
|
return _context6.stop();
|
|
704
714
|
}
|
|
705
715
|
}
|
|
706
|
-
}, _callee6, null, [[
|
|
716
|
+
}, _callee6, null, [[4, 12]]);
|
|
707
717
|
}));
|
|
708
718
|
|
|
709
719
|
return function saveDescriptions() {
|
|
@@ -713,44 +723,52 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
713
723
|
|
|
714
724
|
var saveDatasheets = /*#__PURE__*/function () {
|
|
715
725
|
var _ref8 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee7() {
|
|
716
|
-
var
|
|
726
|
+
var _product$article9;
|
|
717
727
|
|
|
718
|
-
var dataObject;
|
|
728
|
+
var productTemp, dataObject;
|
|
719
729
|
return _regenerator.default.wrap(function _callee7$(_context7) {
|
|
720
730
|
while (1) {
|
|
721
731
|
switch (_context7.prev = _context7.next) {
|
|
722
732
|
case 0:
|
|
723
733
|
setLoading(true);
|
|
734
|
+
productTemp = product;
|
|
724
735
|
dataObject = {
|
|
725
|
-
articleId:
|
|
736
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article9 = product.article) === null || _product$article9 === void 0 ? void 0 : _product$article9.id_article,
|
|
726
737
|
articleData: updatedDatasheets
|
|
727
738
|
};
|
|
728
|
-
if (
|
|
729
|
-
_context7.prev =
|
|
730
|
-
_context7.next =
|
|
739
|
+
if (product !== null && product !== void 0 && product.orderId) dataObject["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
740
|
+
_context7.prev = 4;
|
|
741
|
+
_context7.next = 7;
|
|
731
742
|
return _axios.default.put("".concat(process.env.REACT_APP_ARTICLE_DATA_ENDPOINT, "?datasheet=true&version=").concat(version), dataObject, {
|
|
732
743
|
headers: {
|
|
733
744
|
Authorization: token
|
|
734
745
|
}
|
|
735
746
|
});
|
|
736
747
|
|
|
737
|
-
case
|
|
748
|
+
case 7:
|
|
738
749
|
setMessage("Fichas técnicas guardadas");
|
|
750
|
+
|
|
751
|
+
if (productTemp.status === "ASSIGNED") {
|
|
752
|
+
productTemp.status = "IN_PROGRESS";
|
|
753
|
+
setProduct(productTemp);
|
|
754
|
+
sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
755
|
+
}
|
|
756
|
+
|
|
739
757
|
loadData();
|
|
740
|
-
_context7.next =
|
|
758
|
+
_context7.next = 15;
|
|
741
759
|
break;
|
|
742
760
|
|
|
743
|
-
case
|
|
744
|
-
_context7.prev =
|
|
745
|
-
_context7.t0 = _context7["catch"](
|
|
761
|
+
case 12:
|
|
762
|
+
_context7.prev = 12;
|
|
763
|
+
_context7.t0 = _context7["catch"](4);
|
|
746
764
|
console.log(_context7.t0);
|
|
747
765
|
|
|
748
|
-
case
|
|
766
|
+
case 15:
|
|
749
767
|
case "end":
|
|
750
768
|
return _context7.stop();
|
|
751
769
|
}
|
|
752
770
|
}
|
|
753
|
-
}, _callee7, null, [[
|
|
771
|
+
}, _callee7, null, [[4, 12]]);
|
|
754
772
|
}));
|
|
755
773
|
|
|
756
774
|
return function saveDatasheets() {
|
|
@@ -759,7 +777,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
759
777
|
}();
|
|
760
778
|
|
|
761
779
|
var updateImages = (0, _react.useCallback)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee8() {
|
|
762
|
-
var _images$values2, _product$
|
|
780
|
+
var _images$values2, _product$article10, _data$articleData, _data$articleData2, _data$updateImages;
|
|
763
781
|
|
|
764
782
|
var imagesList, imagesListTemp, duplicated, attrForImgs, data, valid, _data$updateImages2, _data$articleData3, _data$articleData4, _data$articleData5, promiseArray;
|
|
765
783
|
|
|
@@ -778,7 +796,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
778
796
|
attrForImgs = Object.values(images === null || images === void 0 ? void 0 : images.attrForImgs);
|
|
779
797
|
attrForImgs.pop();
|
|
780
798
|
data = {
|
|
781
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
799
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article10 = product.article) === null || _product$article10 === void 0 ? void 0 : _product$article10.id_article,
|
|
782
800
|
attrReqImgs: attrForImgs === null || attrForImgs === void 0 ? void 0 : attrForImgs.map(function (e) {
|
|
783
801
|
var _e$, _e$2;
|
|
784
802
|
|
|
@@ -794,7 +812,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
794
812
|
return e.id;
|
|
795
813
|
})
|
|
796
814
|
};
|
|
797
|
-
if (
|
|
815
|
+
if (product !== null && product !== void 0 && product.orderId) data["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
798
816
|
valid = (data === null || data === void 0 ? void 0 : (_data$articleData = data.articleData) === null || _data$articleData === void 0 ? void 0 : _data$articleData.length) === 0 ? true : data === null || data === void 0 ? void 0 : (_data$articleData2 = data.articleData) === null || _data$articleData2 === void 0 ? void 0 : _data$articleData2.every(function (e, i) {
|
|
799
817
|
if (e !== null && e !== void 0 && e.image_id && e !== null && e !== void 0 && e.packing_type && e !== null && e !== void 0 && e.image_type) {
|
|
800
818
|
return true;
|
|
@@ -892,7 +910,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
892
910
|
e.imageID = e.image_id;
|
|
893
911
|
e.packingType = e.packing_type;
|
|
894
912
|
e.imageType = e.image_type;
|
|
895
|
-
if (
|
|
913
|
+
if (product !== null && product !== void 0 && product.orderId) e["orderId"] = product === null || product === void 0 ? void 0 : product.orderId;
|
|
896
914
|
return e;
|
|
897
915
|
});
|
|
898
916
|
_context9.prev = 3;
|
|
@@ -928,7 +946,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
928
946
|
});
|
|
929
947
|
|
|
930
948
|
var _srv$filter = srv.filter(function (serv) {
|
|
931
|
-
return serv.id_retailer === activeRetailer.id;
|
|
949
|
+
return serv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id);
|
|
932
950
|
}),
|
|
933
951
|
_srv$filter2 = (0, _slicedToArray2.default)(_srv$filter, 1),
|
|
934
952
|
srvActive = _srv$filter2[0];
|
|
@@ -976,12 +994,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
976
994
|
concept = action ? action : concept;
|
|
977
995
|
|
|
978
996
|
var _servicesData$filter = servicesData.filter(function (srv) {
|
|
979
|
-
return srv.id_retailer === activeRetailer.id && srv.service === concept;
|
|
997
|
+
return srv.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && srv.service === concept;
|
|
980
998
|
}),
|
|
981
999
|
_servicesData$filter2 = (0, _slicedToArray2.default)(_servicesData$filter, 1),
|
|
982
1000
|
retailerStatus = _servicesData$filter2[0];
|
|
983
1001
|
|
|
984
|
-
return (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "AF" && ( //sessionStorage
|
|
1002
|
+
return (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "QF" && (user.id_role === 1 || user.id_role === 4 || user.id_role === 5) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "AF" && ( //sessionStorage product
|
|
985
1003
|
user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RP" && (user.id_role === 1 || user.id_role === 6) || (retailerStatus === null || retailerStatus === void 0 ? void 0 : retailerStatus.status) === "RC" && (user.id_role === 1 || user.id_role === 6);
|
|
986
1004
|
};
|
|
987
1005
|
|
|
@@ -1165,16 +1183,16 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1165
1183
|
}
|
|
1166
1184
|
}
|
|
1167
1185
|
|
|
1168
|
-
return
|
|
1186
|
+
return product.article["id_".concat(concept, "_").concat(rol)] === user.id_user && validUser;
|
|
1169
1187
|
};
|
|
1170
1188
|
|
|
1171
1189
|
var auditorAssigned = function auditorAssigned() {
|
|
1172
|
-
return (
|
|
1190
|
+
return (product === null || product === void 0 ? void 0 : product.article["id_auditor"]) === user.id_user;
|
|
1173
1191
|
};
|
|
1174
1192
|
|
|
1175
1193
|
var createComment = /*#__PURE__*/function () {
|
|
1176
1194
|
var _ref12 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(e, body, tab) {
|
|
1177
|
-
var _product$
|
|
1195
|
+
var _product$article11;
|
|
1178
1196
|
|
|
1179
1197
|
var concept, data;
|
|
1180
1198
|
return _regenerator.default.wrap(function _callee11$(_context11) {
|
|
@@ -1200,7 +1218,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1200
1218
|
|
|
1201
1219
|
case 10:
|
|
1202
1220
|
data = {
|
|
1203
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
1221
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article11 = product.article) === null || _product$article11 === void 0 ? void 0 : _product$article11.id_article,
|
|
1204
1222
|
orderId: product === null || product === void 0 ? void 0 : product.orderId,
|
|
1205
1223
|
message: body,
|
|
1206
1224
|
concept: concept,
|
|
@@ -1319,7 +1337,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1319
1337
|
|
|
1320
1338
|
var setAssignation = /*#__PURE__*/function () {
|
|
1321
1339
|
var _ref14 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee13(assignationType, assignationId) {
|
|
1322
|
-
var _product$
|
|
1340
|
+
var _product$article12;
|
|
1323
1341
|
|
|
1324
1342
|
var concept, productTemp, data;
|
|
1325
1343
|
return _regenerator.default.wrap(function _callee13$(_context13) {
|
|
@@ -1344,12 +1362,12 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1344
1362
|
return _context13.abrupt("break", 10);
|
|
1345
1363
|
|
|
1346
1364
|
case 10:
|
|
1347
|
-
productTemp =
|
|
1365
|
+
productTemp = product;
|
|
1348
1366
|
productTemp.article["id_".concat(concept, "_").concat(assignationType)] = assignationId;
|
|
1349
1367
|
data = (0, _defineProperty2.default)({
|
|
1350
1368
|
articleList: [{
|
|
1351
1369
|
orderId: product.orderId,
|
|
1352
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
1370
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article12 = product.article) === null || _product$article12 === void 0 ? void 0 : _product$article12.id_article
|
|
1353
1371
|
}],
|
|
1354
1372
|
concept: concept
|
|
1355
1373
|
}, "".concat(assignationType, "Id"), assignationId);
|
|
@@ -1509,7 +1527,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1509
1527
|
var retailerService = {};
|
|
1510
1528
|
|
|
1511
1529
|
var _arr$filter = arr === null || arr === void 0 ? void 0 : arr.filter(function (service) {
|
|
1512
|
-
return service.id_retailer === activeRetailer.id && service.service === concept;
|
|
1530
|
+
return service.id_retailer === (activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && service.service === concept;
|
|
1513
1531
|
});
|
|
1514
1532
|
|
|
1515
1533
|
var _arr$filter2 = (0, _slicedToArray2.default)(_arr$filter, 1);
|
|
@@ -1541,10 +1559,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1541
1559
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageDataTable.ImageDataTable, {
|
|
1542
1560
|
lists: images,
|
|
1543
1561
|
activeImage: images !== null && images !== void 0 && images.values ? images === null || images === void 0 ? void 0 : images.values[activeImage] : {},
|
|
1544
|
-
retailerSelected: activeRetailer.id,
|
|
1562
|
+
retailerSelected: activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id,
|
|
1545
1563
|
setImages: setImages,
|
|
1546
1564
|
assignationsImages: assig["Imágenes"],
|
|
1547
|
-
imagesStatus:
|
|
1565
|
+
imagesStatus: product === null || product === void 0 ? void 0 : product.images_status,
|
|
1548
1566
|
setAssignation: setAssignation,
|
|
1549
1567
|
isRetailer: isRetailer,
|
|
1550
1568
|
onClickSave: function onClickSave() {
|
|
@@ -1606,7 +1624,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1606
1624
|
setCheckAll: setCheckAll
|
|
1607
1625
|
}), activeTab === "Ficha técnica" && ((product === null || product === void 0 ? void 0 : product.datasheet_status) !== "NS" ? (_datasheets$ = datasheets[0]) === null || _datasheets$ === void 0 ? void 0 : (_datasheets$$data = _datasheets$.data) === null || _datasheets$$data === void 0 ? void 0 : _datasheets$$data.map(function (dataGroup, index) {
|
|
1608
1626
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_InputGroup.InputGroup, {
|
|
1609
|
-
articleId:
|
|
1627
|
+
articleId: product.article.id_article,
|
|
1610
1628
|
version: version,
|
|
1611
1629
|
activeSection: activeTab,
|
|
1612
1630
|
inputGroup: dataGroup,
|
|
@@ -1622,7 +1640,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1622
1640
|
inputGroup: descriptions[0],
|
|
1623
1641
|
updatedDescriptions: updatedDescriptions,
|
|
1624
1642
|
setUpdatedDescriptions: setUpdatedDescriptions,
|
|
1625
|
-
articleId: product === null || product === void 0 ? void 0 : (_product$
|
|
1643
|
+
articleId: product === null || product === void 0 ? void 0 : (_product$article13 = product.article) === null || _product$article13 === void 0 ? void 0 : _product$article13.id_article,
|
|
1626
1644
|
version: version,
|
|
1627
1645
|
dinamicHeight: true
|
|
1628
1646
|
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|