contentoh-components-library 21.4.75 → 21.4.77
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/ObservationFlag/ObservationFlag.stories.js +38 -0
- package/dist/components/atoms/ObservationFlag/index.js +52 -0
- package/dist/components/atoms/ObservationFlag/styles.js +18 -0
- package/dist/components/molecules/ProductNameHeader/index.js +8 -3
- package/dist/components/organisms/FullProductNameHeader/index.js +3 -1
- package/dist/components/organisms/VersionSelector/index.js +101 -167
- package/dist/components/pages/RetailerProductEdition/index.js +60 -149
- package/package.json +2 -1
- package/src/components/atoms/ObservationFlag/ObservationFlag.stories.js +20 -0
- package/src/components/atoms/ObservationFlag/index.js +33 -0
- package/src/components/atoms/ObservationFlag/styles.js +3 -0
- package/src/components/molecules/ProductNameHeader/index.js +5 -1
- package/src/components/organisms/FullProductNameHeader/index.js +2 -0
- package/src/components/organisms/VersionSelector/index.js +100 -99
- package/src/components/pages/RetailerProductEdition/index.js +18 -143
|
@@ -0,0 +1,38 @@
|
|
|
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.default = exports.PriorityFlagDefault = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _index = require("./index");
|
|
13
|
+
|
|
14
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
|
|
16
|
+
var _default = {
|
|
17
|
+
title: "Components/atoms/ObservationFlag",
|
|
18
|
+
component: _index.ObservationFlag,
|
|
19
|
+
argTypes: {
|
|
20
|
+
observation: {
|
|
21
|
+
options: ["no priority", "low", "medium", "high"],
|
|
22
|
+
control: {
|
|
23
|
+
type: "select"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
exports.default = _default;
|
|
29
|
+
|
|
30
|
+
var Template = function Template(args) {
|
|
31
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ObservationFlag, (0, _objectSpread2.default)({}, args));
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
var PriorityFlagDefault = Template.bind({});
|
|
35
|
+
exports.PriorityFlagDefault = PriorityFlagDefault;
|
|
36
|
+
PriorityFlagDefault.args = {
|
|
37
|
+
observation: "no observation"
|
|
38
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
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.ObservationFlag = void 0;
|
|
9
|
+
|
|
10
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
11
|
+
|
|
12
|
+
var _styles = require("./styles");
|
|
13
|
+
|
|
14
|
+
var _Tooltip = require("../Tooltip");
|
|
15
|
+
|
|
16
|
+
var _noPriority = _interopRequireDefault(require("../../../assets/images/flags/noPriority.svg"));
|
|
17
|
+
|
|
18
|
+
var _highPriority = _interopRequireDefault(require("../../../assets/images/flags/highPriority.svg"));
|
|
19
|
+
|
|
20
|
+
var _mediumPriority = _interopRequireDefault(require("../../../assets/images/flags/mediumPriority.svg"));
|
|
21
|
+
|
|
22
|
+
var _lowPriority = _interopRequireDefault(require("../../../assets/images/flags/lowPriority.svg"));
|
|
23
|
+
|
|
24
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
25
|
+
|
|
26
|
+
var ObservationFlag = function ObservationFlag(_ref) {
|
|
27
|
+
var _PriorityFlags;
|
|
28
|
+
|
|
29
|
+
var observation = _ref.observation,
|
|
30
|
+
contentObservation = _ref.contentObservation;
|
|
31
|
+
var PriorityFlags = (_PriorityFlags = {}, (0, _defineProperty2.default)(_PriorityFlags, "none", _noPriority.default), (0, _defineProperty2.default)(_PriorityFlags, "low", _lowPriority.default), (0, _defineProperty2.default)(_PriorityFlags, "medium", _mediumPriority.default), (0, _defineProperty2.default)(_PriorityFlags, "high", _highPriority.default), _PriorityFlags);
|
|
32
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Tooltip.Tooltip, {
|
|
33
|
+
componentTooltip: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
34
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
35
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("b", {
|
|
36
|
+
children: "Observaciones del producto"
|
|
37
|
+
})
|
|
38
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
|
|
39
|
+
children: [contentObservation, " "]
|
|
40
|
+
})]
|
|
41
|
+
}),
|
|
42
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
|
|
43
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
44
|
+
src: PriorityFlags[observation],
|
|
45
|
+
alt: observation
|
|
46
|
+
})
|
|
47
|
+
}),
|
|
48
|
+
classNameTooltip: "container-tooltip"
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
exports.ObservationFlag = ObservationFlag;
|
|
@@ -0,0 +1,18 @@
|
|
|
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)([""])));
|
|
17
|
+
|
|
18
|
+
exports.Container = Container;
|
|
@@ -15,6 +15,8 @@ var _index3 = require("../../atoms/ProgressBar/index");
|
|
|
15
15
|
|
|
16
16
|
var _index4 = require("../../atoms/PriorityFlag/index");
|
|
17
17
|
|
|
18
|
+
var _index5 = require("../../atoms/ObservationFlag/index");
|
|
19
|
+
|
|
18
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
21
|
|
|
20
22
|
var ProductNameHeader = function ProductNameHeader(_ref) {
|
|
@@ -22,7 +24,9 @@ var ProductNameHeader = function ProductNameHeader(_ref) {
|
|
|
22
24
|
statusType = _ref.statusType,
|
|
23
25
|
priority = _ref.priority,
|
|
24
26
|
date = _ref.date,
|
|
25
|
-
percentRequired = _ref.percentRequired
|
|
27
|
+
percentRequired = _ref.percentRequired,
|
|
28
|
+
productObservation = _ref.productObservation;
|
|
29
|
+
var typeFlag = productObservation !== null && productObservation !== "" ? "high" : "low";
|
|
26
30
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
27
31
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
|
|
28
32
|
headerType: "product-name-header",
|
|
@@ -33,8 +37,9 @@ var ProductNameHeader = function ProductNameHeader(_ref) {
|
|
|
33
37
|
percent: percentRequired,
|
|
34
38
|
progressBarType: statusType,
|
|
35
39
|
percentRequired: percentRequired
|
|
36
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
37
|
-
|
|
40
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index5.ObservationFlag, {
|
|
41
|
+
observation: typeFlag,
|
|
42
|
+
contentObservation: productObservation
|
|
38
43
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
|
|
39
44
|
headerType: "date-header",
|
|
40
45
|
text: date
|
|
@@ -34,7 +34,8 @@ var FullProductNameHeader = function FullProductNameHeader(_ref) {
|
|
|
34
34
|
approveAll = _ref.approveAll,
|
|
35
35
|
rejectAll = _ref.rejectAll,
|
|
36
36
|
servicesData = _ref.servicesData,
|
|
37
|
-
showApproveRejectAll = _ref.showApproveRejectAll
|
|
37
|
+
showApproveRejectAll = _ref.showApproveRejectAll,
|
|
38
|
+
productObservation = _ref.productObservation;
|
|
38
39
|
|
|
39
40
|
var _useState = (0, _react.useState)([]),
|
|
40
41
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -68,6 +69,7 @@ var FullProductNameHeader = function FullProductNameHeader(_ref) {
|
|
|
68
69
|
percentRequired: percent,
|
|
69
70
|
percent: percent === null || percent === void 0 ? void 0 : percent.toFixed(0),
|
|
70
71
|
priority: headerData === null || headerData === void 0 ? void 0 : headerData.prio,
|
|
72
|
+
productObservation: productObservation,
|
|
71
73
|
date: getTime((headerData === null || headerData === void 0 ? void 0 : (_headerData$article2 = headerData.article) === null || _headerData$article2 === void 0 ? void 0 : _headerData$article2.timestamp) || (headerData === null || headerData === void 0 ? void 0 : headerData.timestamp))
|
|
72
74
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
73
75
|
className: "features-bar-container",
|
|
@@ -1,167 +1,101 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
}();
|
|
103
|
-
|
|
104
|
-
(0, _react.useEffect)(function () {
|
|
105
|
-
var ac = new AbortController();
|
|
106
|
-
loadProductVersions(articleId);
|
|
107
|
-
return function () {
|
|
108
|
-
setVersions([]);
|
|
109
|
-
setShowCreateVersion(false);
|
|
110
|
-
return function () {
|
|
111
|
-
return ac.abort();
|
|
112
|
-
}; // Abort both fetches on unmount
|
|
113
|
-
};
|
|
114
|
-
}, [reload]);
|
|
115
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
116
|
-
id: modalId,
|
|
117
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
118
|
-
className: "versions-header",
|
|
119
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ScreenHeader.ScreenHeader, {
|
|
120
|
-
text: "Versión del producto",
|
|
121
|
-
headerType: "input-name-header",
|
|
122
|
-
color: _variables.GlobalColors.white,
|
|
123
|
-
fontFamily: _variables.FontFamily.Lato
|
|
124
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
125
|
-
className: "buttons-container",
|
|
126
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
127
|
-
image: _addVersion.default,
|
|
128
|
-
buttonType: "circular-button",
|
|
129
|
-
onClick: function onClick() {
|
|
130
|
-
return setShowCreateVersion(true);
|
|
131
|
-
},
|
|
132
|
-
id: "add-version"
|
|
133
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GeneralButton.Button, {
|
|
134
|
-
image: _closeVersionSelector.default,
|
|
135
|
-
buttonType: "circular-button",
|
|
136
|
-
onClick: function onClick() {
|
|
137
|
-
return setShowVersionSelector(false);
|
|
138
|
-
},
|
|
139
|
-
id: "close-button"
|
|
140
|
-
})]
|
|
141
|
-
})]
|
|
142
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
143
|
-
className: "versions-container",
|
|
144
|
-
children: versions === null || versions === void 0 ? void 0 : versions.map(function (item) {
|
|
145
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_VersionItem.VersionItem, {
|
|
146
|
-
version: item.version,
|
|
147
|
-
articleStatus: item.article_status,
|
|
148
|
-
currentVersion: item.version === currentVersion,
|
|
149
|
-
productOwner: companyName,
|
|
150
|
-
setVersion: setVersion,
|
|
151
|
-
timestamp: item.timestamp
|
|
152
|
-
}, item.version);
|
|
153
|
-
})
|
|
154
|
-
}), showCreateVersion && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CreateVersion.CreateVersion, {
|
|
155
|
-
articleId: articleId,
|
|
156
|
-
version: currentVersion,
|
|
157
|
-
versionsList: versions,
|
|
158
|
-
setShowCreateVersion: setShowCreateVersion,
|
|
159
|
-
realoadVersion: function realoadVersion() {
|
|
160
|
-
return setReload(!reload);
|
|
161
|
-
},
|
|
162
|
-
jwt: jwt
|
|
163
|
-
})]
|
|
164
|
-
});
|
|
165
|
-
};
|
|
166
|
-
|
|
167
|
-
exports.VersionSelector = VersionSelector;
|
|
1
|
+
// import { Container } from "./styles";
|
|
2
|
+
// import axios from "axios";
|
|
3
|
+
// import { useEffect, useState } from "react";
|
|
4
|
+
// import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
5
|
+
// import { Button } from "../../atoms/GeneralButton";
|
|
6
|
+
// import addVersion from "../../../assets/images/versionSelector/addVersion.svg";
|
|
7
|
+
// import closeIcon from "../../../assets/images/versionSelector/closeVersionSelector.svg";
|
|
8
|
+
// import { GlobalColors } from "../../../../dist/global-files/variables";
|
|
9
|
+
// import { FontFamily } from "../../../global-files/variables";
|
|
10
|
+
// import { VersionItem } from "../../molecules/VersionItem";
|
|
11
|
+
// import { CreateVersion } from "../../organisms/CreateVersion";
|
|
12
|
+
// import { useCloseModal } from "../../../global-files/customHooks";
|
|
13
|
+
// export const VersionSelector = ({
|
|
14
|
+
// modalId,
|
|
15
|
+
// articleId,
|
|
16
|
+
// setVersion,
|
|
17
|
+
// companyName,
|
|
18
|
+
// currentVersion,
|
|
19
|
+
// setShowVersionSelector,
|
|
20
|
+
// jwt,
|
|
21
|
+
// }) => {
|
|
22
|
+
// const [versions, setVersions] = useState([]);
|
|
23
|
+
// const [showCreateVersion, setShowCreateVersion] =
|
|
24
|
+
// useCloseModal("create-version");
|
|
25
|
+
// const [reload, setReload] = useState(false);
|
|
26
|
+
// const loadProductVersions = async (articleId) => {
|
|
27
|
+
// try {
|
|
28
|
+
// const response = await axios.get(
|
|
29
|
+
// `${process.env.REACT_APP_VERSIONS_ENDPOINT}?articleId=${articleId}&provider=true`,
|
|
30
|
+
// {
|
|
31
|
+
// headers: {
|
|
32
|
+
// Authorization: jwt,
|
|
33
|
+
// },
|
|
34
|
+
// }
|
|
35
|
+
// );
|
|
36
|
+
// const versionList = JSON.parse(response.data.body).data;
|
|
37
|
+
// setVersions(versionList);
|
|
38
|
+
// } catch (error) {
|
|
39
|
+
// console.log(error);
|
|
40
|
+
// }
|
|
41
|
+
// };
|
|
42
|
+
// useEffect(() => {
|
|
43
|
+
// const ac = new AbortController();
|
|
44
|
+
// loadProductVersions(articleId);
|
|
45
|
+
// return () => {
|
|
46
|
+
// setVersions([]);
|
|
47
|
+
// setShowCreateVersion(false);
|
|
48
|
+
// return () => ac.abort(); // Abort both fetches on unmount
|
|
49
|
+
// };
|
|
50
|
+
// }, [reload]);
|
|
51
|
+
// return (
|
|
52
|
+
// <Container id={modalId}>
|
|
53
|
+
// <div className="versions-header">
|
|
54
|
+
// <ScreenHeader
|
|
55
|
+
// text={"Versión del producto"}
|
|
56
|
+
// headerType={"input-name-header"}
|
|
57
|
+
// color={GlobalColors.white}
|
|
58
|
+
// fontFamily={FontFamily.Lato}
|
|
59
|
+
// />
|
|
60
|
+
// <div className="buttons-container">
|
|
61
|
+
// <Button
|
|
62
|
+
// image={addVersion}
|
|
63
|
+
// buttonType={"circular-button"}
|
|
64
|
+
// onClick={() => setShowCreateVersion(true)}
|
|
65
|
+
// id="add-version"
|
|
66
|
+
// />
|
|
67
|
+
// <Button
|
|
68
|
+
// image={closeIcon}
|
|
69
|
+
// buttonType={"circular-button"}
|
|
70
|
+
// onClick={() => setShowVersionSelector(false)}
|
|
71
|
+
// id="close-button"
|
|
72
|
+
// />
|
|
73
|
+
// </div>
|
|
74
|
+
// </div>
|
|
75
|
+
// <div className="versions-container">
|
|
76
|
+
// {versions?.map((item) => (
|
|
77
|
+
// <VersionItem
|
|
78
|
+
// key={item.version}
|
|
79
|
+
// version={item.version}
|
|
80
|
+
// articleStatus={item.article_status}
|
|
81
|
+
// currentVersion={item.version === currentVersion}
|
|
82
|
+
// productOwner={companyName}
|
|
83
|
+
// setVersion={setVersion}
|
|
84
|
+
// timestamp={item.timestamp}
|
|
85
|
+
// />
|
|
86
|
+
// ))}
|
|
87
|
+
// </div>
|
|
88
|
+
// {showCreateVersion && (
|
|
89
|
+
// <CreateVersion
|
|
90
|
+
// articleId={articleId}
|
|
91
|
+
// version={currentVersion}
|
|
92
|
+
// versionsList={versions}
|
|
93
|
+
// setShowCreateVersion={setShowCreateVersion}
|
|
94
|
+
// realoadVersion={() => setReload(!reload)}
|
|
95
|
+
// jwt={jwt}
|
|
96
|
+
// />
|
|
97
|
+
// )}
|
|
98
|
+
// </Container>
|
|
99
|
+
// );
|
|
100
|
+
// };
|
|
101
|
+
"use strict";
|
|
@@ -482,25 +482,30 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
482
482
|
compare = _useState82[0],
|
|
483
483
|
setCompare = _useState82[1];
|
|
484
484
|
|
|
485
|
-
var _useState83 = (0, _react.useState)(
|
|
485
|
+
var _useState83 = (0, _react.useState)(),
|
|
486
486
|
_useState84 = (0, _slicedToArray2.default)(_useState83, 2),
|
|
487
|
-
|
|
488
|
-
|
|
487
|
+
observation = _useState84[0],
|
|
488
|
+
setObservation = _useState84[1];
|
|
489
489
|
|
|
490
|
-
var _useState85 = (0, _react.useState)(
|
|
490
|
+
var _useState85 = (0, _react.useState)(false),
|
|
491
491
|
_useState86 = (0, _slicedToArray2.default)(_useState85, 2),
|
|
492
|
-
|
|
493
|
-
|
|
492
|
+
valRejAll = _useState86[0],
|
|
493
|
+
setValRejAll = _useState86[1];
|
|
494
494
|
|
|
495
495
|
var _useState87 = (0, _react.useState)([]),
|
|
496
496
|
_useState88 = (0, _slicedToArray2.default)(_useState87, 2),
|
|
497
|
-
|
|
498
|
-
|
|
497
|
+
desc = _useState88[0],
|
|
498
|
+
setDesc = _useState88[1];
|
|
499
499
|
|
|
500
500
|
var _useState89 = (0, _react.useState)([]),
|
|
501
501
|
_useState90 = (0, _slicedToArray2.default)(_useState89, 2),
|
|
502
|
-
|
|
503
|
-
|
|
502
|
+
fich = _useState90[0],
|
|
503
|
+
setFich = _useState90[1];
|
|
504
|
+
|
|
505
|
+
var _useState91 = (0, _react.useState)([]),
|
|
506
|
+
_useState92 = (0, _slicedToArray2.default)(_useState91, 2),
|
|
507
|
+
imag = _useState92[0],
|
|
508
|
+
setImag = _useState92[1];
|
|
504
509
|
|
|
505
510
|
(0, _react.useEffect)( /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
506
511
|
var _ref3, id_article;
|
|
@@ -838,7 +843,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
838
843
|
setActivePercentage((_retailers$ = retailers[0]) === null || _retailers$ === void 0 ? void 0 : _retailers$.percentage);
|
|
839
844
|
}, [percentages]);
|
|
840
845
|
(0, _react.useEffect)(function () {
|
|
841
|
-
|
|
846
|
+
//getInputsData(services, activeRetailer, setDatasheets, setDescriptions);
|
|
842
847
|
auditableVersion && loadAuditableData();
|
|
843
848
|
setActivePercentage(Math.round(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.percentage, 0));
|
|
844
849
|
(activeRetailer === null || activeRetailer === void 0 ? void 0 : activeRetailer.id) && setImages({
|
|
@@ -1356,80 +1361,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1356
1361
|
default:
|
|
1357
1362
|
break;
|
|
1358
1363
|
}
|
|
1359
|
-
};
|
|
1360
|
-
// setLoading(true);
|
|
1361
|
-
// try {
|
|
1362
|
-
// let concept = getConcept(activeTab);
|
|
1363
|
-
// const productTemp = { ...product };
|
|
1364
|
-
// const evalStatus = retailerStatus;
|
|
1365
|
-
// const articleId = product.article.id_article;
|
|
1366
|
-
// const orderId = product.orderId;
|
|
1367
|
-
// // const body = {
|
|
1368
|
-
// // orderArticleRetailers: [
|
|
1369
|
-
// // { orderId, articleId, retailersIds: [activeRetailer.id] },
|
|
1370
|
-
// // ],
|
|
1371
|
-
// // isAproved: false,
|
|
1372
|
-
// // service: concept,
|
|
1373
|
-
// // };
|
|
1374
|
-
// const body = {
|
|
1375
|
-
// articleId: product.article.id_article,
|
|
1376
|
-
// orderId: product.orderId,
|
|
1377
|
-
// concept: concept,
|
|
1378
|
-
// result: result,
|
|
1379
|
-
// evalStatus: evalStatus,
|
|
1380
|
-
// retailerId: activeRetailer.id,
|
|
1381
|
-
// };
|
|
1382
|
-
// let res;
|
|
1383
|
-
// let message;
|
|
1384
|
-
// if (result) {
|
|
1385
|
-
// body.isAproved = result === "A";
|
|
1386
|
-
// res = await axios.put(
|
|
1387
|
-
// `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
1388
|
-
// body,
|
|
1389
|
-
// {
|
|
1390
|
-
// headers: {
|
|
1391
|
-
// Authorization: token,
|
|
1392
|
-
// },
|
|
1393
|
-
// }
|
|
1394
|
-
// );
|
|
1395
|
-
// console.log(JSON.parse(res.data.body), "res");
|
|
1396
|
-
// getServices();
|
|
1397
|
-
// } else {
|
|
1398
|
-
// const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
|
|
1399
|
-
// if (specialistDone) {
|
|
1400
|
-
// message = `${activeTab} enviada a facilitador`;
|
|
1401
|
-
// getSectionIcon();
|
|
1402
|
-
// } else if (["IE", "AC", "RP", "RCA"].includes(evalStatus)) {
|
|
1403
|
-
// message = "Evaluación enviada";
|
|
1404
|
-
// getSectionIcon();
|
|
1405
|
-
// }
|
|
1406
|
-
// res = await axios.put(
|
|
1407
|
-
// `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
1408
|
-
// body,
|
|
1409
|
-
// {
|
|
1410
|
-
// headers: {
|
|
1411
|
-
// Authorization: token,
|
|
1412
|
-
// },
|
|
1413
|
-
// }
|
|
1414
|
-
// );
|
|
1415
|
-
// }
|
|
1416
|
-
// if (res.data.statusCode === 200) {
|
|
1417
|
-
// const response = JSON.parse(res.data.body)?.successfulData;
|
|
1418
|
-
// const statusObject =
|
|
1419
|
-
// response[`${orderId}-${articleId}-${activeRetailer.id}`];
|
|
1420
|
-
// productTemp.status = statusObject["generalStatus"];
|
|
1421
|
-
// productTemp[`${concept}_status`] = statusObject[`${concept}Status`];
|
|
1422
|
-
// await loadData();
|
|
1423
|
-
// if (message) setMessage(message);
|
|
1424
|
-
// sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1425
|
-
// setProduct(productTemp);
|
|
1426
|
-
// }
|
|
1427
|
-
// } catch (error) {
|
|
1428
|
-
// console.log(error);
|
|
1429
|
-
// }
|
|
1430
|
-
// setLoading(false);
|
|
1431
|
-
// };
|
|
1432
|
-
|
|
1364
|
+
};
|
|
1433
1365
|
|
|
1434
1366
|
var sendToFacilitator = /*#__PURE__*/function () {
|
|
1435
1367
|
var _ref15 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee11(result) {
|
|
@@ -1900,64 +1832,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
1900
1832
|
}, [services, servicesData, activeTab]);
|
|
1901
1833
|
(0, _react.useEffect)(function () {
|
|
1902
1834
|
setSaving(loading);
|
|
1903
|
-
}, [loading]);
|
|
1904
|
-
// try {
|
|
1905
|
-
// setLoading(true);
|
|
1906
|
-
// const evaluationArray = [];
|
|
1907
|
-
// let conceptArray = ["description", "datasheet", "images"];
|
|
1908
|
-
// switch (user.id_role) {
|
|
1909
|
-
// case 4:
|
|
1910
|
-
// conceptArray = ["description", "datasheet"];
|
|
1911
|
-
// break;
|
|
1912
|
-
// case 5:
|
|
1913
|
-
// conceptArray = ["images"];
|
|
1914
|
-
// break;
|
|
1915
|
-
// default:
|
|
1916
|
-
// conceptArray = ["description", "datasheet", "images"];
|
|
1917
|
-
// break;
|
|
1918
|
-
// }
|
|
1919
|
-
// const isAproved = result === "A";
|
|
1920
|
-
// const retailersIds = [];
|
|
1921
|
-
// servicesData?.forEach((ret) => {
|
|
1922
|
-
// if (!retailersIds.includes(ret.id_retailer))
|
|
1923
|
-
// retailersIds.push(ret.id_retailer);
|
|
1924
|
-
// });
|
|
1925
|
-
// const body = {
|
|
1926
|
-
// orderArticleRetailers: [
|
|
1927
|
-
// {
|
|
1928
|
-
// orderId: product.id_order ?? product.orderId,
|
|
1929
|
-
// articleId: product.article.id_article,
|
|
1930
|
-
// retailersIds,
|
|
1931
|
-
// },
|
|
1932
|
-
// ],
|
|
1933
|
-
// isAproved,
|
|
1934
|
-
// };
|
|
1935
|
-
// conceptArray.forEach((concept) => {
|
|
1936
|
-
// body.service = concept;
|
|
1937
|
-
// evaluationArray.push(
|
|
1938
|
-
// axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, body, {
|
|
1939
|
-
// headers: {
|
|
1940
|
-
// Authorization: token,
|
|
1941
|
-
// },
|
|
1942
|
-
// })
|
|
1943
|
-
// );
|
|
1944
|
-
// });
|
|
1945
|
-
// await Promise.all(evaluationArray);
|
|
1946
|
-
// const productTemp = product;
|
|
1947
|
-
// productTemp.status = `${result}A`;
|
|
1948
|
-
// productTemp.datasheet_status =
|
|
1949
|
-
// productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
|
|
1950
|
-
// productTemp.description_status =
|
|
1951
|
-
// productTemp.description_status === "NA" ? "NA" : `${result}A`;
|
|
1952
|
-
// productTemp.images_status =
|
|
1953
|
-
// productTemp.images_status === "NA" ? "NA" : `${result}A`;
|
|
1954
|
-
// sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1955
|
-
// setProduct(productTemp);
|
|
1956
|
-
// await loadData();
|
|
1957
|
-
// } catch (error) {
|
|
1958
|
-
// console.log(error);
|
|
1959
|
-
// }
|
|
1960
|
-
// };
|
|
1835
|
+
}, [loading]);
|
|
1961
1836
|
|
|
1962
1837
|
var validateAll = /*#__PURE__*/function () {
|
|
1963
1838
|
var _ref19 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee15(result) {
|
|
@@ -2048,6 +1923,41 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2048
1923
|
};
|
|
2049
1924
|
}();
|
|
2050
1925
|
|
|
1926
|
+
var getObservation = /*#__PURE__*/function () {
|
|
1927
|
+
var _ref20 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee16() {
|
|
1928
|
+
var response, parseData;
|
|
1929
|
+
return _regenerator.default.wrap(function _callee16$(_context16) {
|
|
1930
|
+
while (1) {
|
|
1931
|
+
switch (_context16.prev = _context16.next) {
|
|
1932
|
+
case 0:
|
|
1933
|
+
_context16.next = 2;
|
|
1934
|
+
return _axios.default.get("".concat(process.env.REACT_APP_READ_OBSERVATION, "?articleId=").concat(product.article.id_article, "&orderId=").concat(product === null || product === void 0 ? void 0 : product.orderId), {
|
|
1935
|
+
headers: {
|
|
1936
|
+
Authorization: sessionStorage.getItem("jwt")
|
|
1937
|
+
}
|
|
1938
|
+
});
|
|
1939
|
+
|
|
1940
|
+
case 2:
|
|
1941
|
+
response = _context16.sent;
|
|
1942
|
+
parseData = JSON.parse(response.data.body).data[0];
|
|
1943
|
+
setObservation(parseData.observations);
|
|
1944
|
+
|
|
1945
|
+
case 5:
|
|
1946
|
+
case "end":
|
|
1947
|
+
return _context16.stop();
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
}, _callee16);
|
|
1951
|
+
}));
|
|
1952
|
+
|
|
1953
|
+
return function getObservation() {
|
|
1954
|
+
return _ref20.apply(this, arguments);
|
|
1955
|
+
};
|
|
1956
|
+
}();
|
|
1957
|
+
|
|
1958
|
+
(0, _react.useEffect)(function () {
|
|
1959
|
+
getObservation();
|
|
1960
|
+
}, []);
|
|
2051
1961
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
2052
1962
|
headerTop: headerTop,
|
|
2053
1963
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderTop.HeaderTop, {
|
|
@@ -2092,6 +2002,7 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2092
2002
|
className: "product-information",
|
|
2093
2003
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FullProductNameHeader.FullProductNameHeader, {
|
|
2094
2004
|
headerData: product,
|
|
2005
|
+
productObservation: observation,
|
|
2095
2006
|
percent: activePercentage,
|
|
2096
2007
|
activeRetailer: activeRetailer,
|
|
2097
2008
|
servicesData: servicesData,
|
|
@@ -2266,18 +2177,18 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2266
2177
|
type: "pink",
|
|
2267
2178
|
label: "Aceptar",
|
|
2268
2179
|
size: 12,
|
|
2269
|
-
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function
|
|
2180
|
+
onClick: /*#__PURE__*/(0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee17() {
|
|
2270
2181
|
var body, messages;
|
|
2271
|
-
return _regenerator.default.wrap(function
|
|
2182
|
+
return _regenerator.default.wrap(function _callee17$(_context17) {
|
|
2272
2183
|
while (1) {
|
|
2273
|
-
switch (
|
|
2184
|
+
switch (_context17.prev = _context17.next) {
|
|
2274
2185
|
case 0:
|
|
2275
2186
|
body = document.querySelector("#modal-message-box .ql-container .ql-editor > p").innerHTML;
|
|
2276
2187
|
messages = [{
|
|
2277
2188
|
type: "message",
|
|
2278
2189
|
value: body === null || body === void 0 ? void 0 : body.replace(/<.*?\/?>/gm, "")
|
|
2279
2190
|
}];
|
|
2280
|
-
|
|
2191
|
+
_context17.next = 4;
|
|
2281
2192
|
return createComment(messages, activeRetailer.id);
|
|
2282
2193
|
|
|
2283
2194
|
case 4:
|
|
@@ -2287,10 +2198,10 @@ var RetailerProductEdition = function RetailerProductEdition(_ref) {
|
|
|
2287
2198
|
|
|
2288
2199
|
case 7:
|
|
2289
2200
|
case "end":
|
|
2290
|
-
return
|
|
2201
|
+
return _context17.stop();
|
|
2291
2202
|
}
|
|
2292
2203
|
}
|
|
2293
|
-
},
|
|
2204
|
+
}, _callee17);
|
|
2294
2205
|
}))
|
|
2295
2206
|
}, "btn-Aceptar")]
|
|
2296
2207
|
})]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "contentoh-components-library",
|
|
3
|
-
"version": "21.4.
|
|
3
|
+
"version": "21.4.77",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@aws-amplify/auth": "^4.5.3",
|
|
6
6
|
"@aws-amplify/datastore": "^3.11.0",
|
|
@@ -27,6 +27,7 @@
|
|
|
27
27
|
"babel-preset-react-app": "^10.0.1",
|
|
28
28
|
"caniuse-lite": "^1.0.30001472",
|
|
29
29
|
"chart.js": "^3.7.1",
|
|
30
|
+
"contentoh-components-library": "^21.4.75",
|
|
30
31
|
"draft-js": "^0.11.7",
|
|
31
32
|
"file-saver": "^2.0.5",
|
|
32
33
|
"infinite-react-carousel": "^1.2.11",
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ObservationFlag } from "./index";
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
title: "Components/atoms/ObservationFlag",
|
|
5
|
+
component: ObservationFlag,
|
|
6
|
+
argTypes: {
|
|
7
|
+
observation: {
|
|
8
|
+
options: ["no priority", "low", "medium", "high"],
|
|
9
|
+
control: { type: "select" },
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
const Template = (args) => <ObservationFlag {...args} />;
|
|
15
|
+
|
|
16
|
+
export const PriorityFlagDefault = Template.bind({});
|
|
17
|
+
|
|
18
|
+
PriorityFlagDefault.args = {
|
|
19
|
+
observation: "no observation",
|
|
20
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Container } from "./styles";
|
|
2
|
+
import { Tooltip } from "../Tooltip";
|
|
3
|
+
import without from "../../../assets/images/flags/noPriority.svg";
|
|
4
|
+
import high from "../../../assets/images/flags/highPriority.svg";
|
|
5
|
+
import medium from "../../../assets/images/flags/mediumPriority.svg";
|
|
6
|
+
import low from "../../../assets/images/flags/lowPriority.svg";
|
|
7
|
+
|
|
8
|
+
export const ObservationFlag = ({ observation,contentObservation }) => {
|
|
9
|
+
const PriorityFlags = {
|
|
10
|
+
["none"]: without,
|
|
11
|
+
["low"]: low,
|
|
12
|
+
["medium"]: medium,
|
|
13
|
+
["high"]: high,
|
|
14
|
+
};
|
|
15
|
+
return (
|
|
16
|
+
<Tooltip
|
|
17
|
+
componentTooltip={
|
|
18
|
+
<>
|
|
19
|
+
<p>
|
|
20
|
+
<b>Observaciones del producto</b>
|
|
21
|
+
</p>
|
|
22
|
+
<p>{contentObservation} </p>
|
|
23
|
+
</>
|
|
24
|
+
}
|
|
25
|
+
children={
|
|
26
|
+
<Container>
|
|
27
|
+
<img src={PriorityFlags[observation]} alt={observation} />
|
|
28
|
+
</Container>
|
|
29
|
+
}
|
|
30
|
+
classNameTooltip={"container-tooltip"}
|
|
31
|
+
/>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -3,6 +3,7 @@ import { ScreenHeader } from "../../atoms/ScreenHeader/index";
|
|
|
3
3
|
import { Status } from "../../atoms/Status/index";
|
|
4
4
|
import { ProgressBar } from "../../atoms/ProgressBar/index";
|
|
5
5
|
import { PriorityFlag } from "../../atoms/PriorityFlag/index";
|
|
6
|
+
import { ObservationFlag } from "../../atoms/ObservationFlag/index";
|
|
6
7
|
|
|
7
8
|
export const ProductNameHeader = ({
|
|
8
9
|
productName,
|
|
@@ -10,7 +11,9 @@ export const ProductNameHeader = ({
|
|
|
10
11
|
priority,
|
|
11
12
|
date,
|
|
12
13
|
percentRequired,
|
|
14
|
+
productObservation
|
|
13
15
|
}) => {
|
|
16
|
+
const typeFlag = productObservation!== null && productObservation !== "" ? "high" : "low";
|
|
14
17
|
return (
|
|
15
18
|
<Container>
|
|
16
19
|
<ScreenHeader headerType={"product-name-header"} text={productName} />
|
|
@@ -20,7 +23,8 @@ export const ProductNameHeader = ({
|
|
|
20
23
|
progressBarType={statusType}
|
|
21
24
|
percentRequired={percentRequired}
|
|
22
25
|
/>
|
|
23
|
-
<PriorityFlag priority={priority} />
|
|
26
|
+
{/* <PriorityFlag priority={priority} /> */}
|
|
27
|
+
<ObservationFlag observation={typeFlag}contentObservation={productObservation}/>
|
|
24
28
|
<ScreenHeader headerType={"date-header"} text={date} />
|
|
25
29
|
</Container>
|
|
26
30
|
);
|
|
@@ -17,6 +17,7 @@ export const FullProductNameHeader = ({
|
|
|
17
17
|
rejectAll,
|
|
18
18
|
servicesData,
|
|
19
19
|
showApproveRejectAll,
|
|
20
|
+
productObservation
|
|
20
21
|
}) => {
|
|
21
22
|
const [retailers, setRetailers] = useState([]);
|
|
22
23
|
|
|
@@ -52,6 +53,7 @@ export const FullProductNameHeader = ({
|
|
|
52
53
|
percentRequired={percent}
|
|
53
54
|
percent={percent?.toFixed(0)}
|
|
54
55
|
priority={headerData?.prio}
|
|
56
|
+
productObservation={productObservation}
|
|
55
57
|
date={getTime(headerData?.article?.timestamp || headerData?.timestamp)}
|
|
56
58
|
/>
|
|
57
59
|
<div className="features-bar-container">
|
|
@@ -1,105 +1,106 @@
|
|
|
1
|
-
import { Container } from "./styles";
|
|
2
|
-
import axios from "axios";
|
|
3
|
-
import { useEffect, useState } from "react";
|
|
4
|
-
import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
5
|
-
import { Button } from "../../atoms/GeneralButton";
|
|
6
|
-
import addVersion from "../../../assets/images/versionSelector/addVersion.svg";
|
|
7
|
-
import closeIcon from "../../../assets/images/versionSelector/closeVersionSelector.svg";
|
|
8
|
-
import { GlobalColors
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
// import { Container } from "./styles";
|
|
2
|
+
// import axios from "axios";
|
|
3
|
+
// import { useEffect, useState } from "react";
|
|
4
|
+
// import { ScreenHeader } from "../../atoms/ScreenHeader";
|
|
5
|
+
// import { Button } from "../../atoms/GeneralButton";
|
|
6
|
+
// import addVersion from "../../../assets/images/versionSelector/addVersion.svg";
|
|
7
|
+
// import closeIcon from "../../../assets/images/versionSelector/closeVersionSelector.svg";
|
|
8
|
+
// import { GlobalColors } from "../../../../dist/global-files/variables";
|
|
9
|
+
// import { FontFamily } from "../../../global-files/variables";
|
|
10
|
+
// import { VersionItem } from "../../molecules/VersionItem";
|
|
11
|
+
// import { CreateVersion } from "../../organisms/CreateVersion";
|
|
12
|
+
// import { useCloseModal } from "../../../global-files/customHooks";
|
|
12
13
|
|
|
13
|
-
export const VersionSelector = ({
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
}) => {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
14
|
+
// export const VersionSelector = ({
|
|
15
|
+
// modalId,
|
|
16
|
+
// articleId,
|
|
17
|
+
// setVersion,
|
|
18
|
+
// companyName,
|
|
19
|
+
// currentVersion,
|
|
20
|
+
// setShowVersionSelector,
|
|
21
|
+
// jwt,
|
|
22
|
+
// }) => {
|
|
23
|
+
// const [versions, setVersions] = useState([]);
|
|
24
|
+
// const [showCreateVersion, setShowCreateVersion] =
|
|
25
|
+
// useCloseModal("create-version");
|
|
26
|
+
// const [reload, setReload] = useState(false);
|
|
26
27
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
28
|
+
// const loadProductVersions = async (articleId) => {
|
|
29
|
+
// try {
|
|
30
|
+
// const response = await axios.get(
|
|
31
|
+
// `${process.env.REACT_APP_VERSIONS_ENDPOINT}?articleId=${articleId}&provider=true`,
|
|
32
|
+
// {
|
|
33
|
+
// headers: {
|
|
34
|
+
// Authorization: jwt,
|
|
35
|
+
// },
|
|
36
|
+
// }
|
|
37
|
+
// );
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
// const versionList = JSON.parse(response.data.body).data;
|
|
40
|
+
// setVersions(versionList);
|
|
41
|
+
// } catch (error) {
|
|
42
|
+
// console.log(error);
|
|
43
|
+
// }
|
|
44
|
+
// };
|
|
44
45
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
// useEffect(() => {
|
|
47
|
+
// const ac = new AbortController();
|
|
48
|
+
// loadProductVersions(articleId);
|
|
48
49
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
// return () => {
|
|
51
|
+
// setVersions([]);
|
|
52
|
+
// setShowCreateVersion(false);
|
|
53
|
+
// return () => ac.abort(); // Abort both fetches on unmount
|
|
54
|
+
// };
|
|
55
|
+
// }, [reload]);
|
|
55
56
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
};
|
|
57
|
+
// return (
|
|
58
|
+
// <Container id={modalId}>
|
|
59
|
+
// <div className="versions-header">
|
|
60
|
+
// <ScreenHeader
|
|
61
|
+
// text={"Versión del producto"}
|
|
62
|
+
// headerType={"input-name-header"}
|
|
63
|
+
// color={GlobalColors.white}
|
|
64
|
+
// fontFamily={FontFamily.Lato}
|
|
65
|
+
// />
|
|
66
|
+
// <div className="buttons-container">
|
|
67
|
+
// <Button
|
|
68
|
+
// image={addVersion}
|
|
69
|
+
// buttonType={"circular-button"}
|
|
70
|
+
// onClick={() => setShowCreateVersion(true)}
|
|
71
|
+
// id="add-version"
|
|
72
|
+
// />
|
|
73
|
+
// <Button
|
|
74
|
+
// image={closeIcon}
|
|
75
|
+
// buttonType={"circular-button"}
|
|
76
|
+
// onClick={() => setShowVersionSelector(false)}
|
|
77
|
+
// id="close-button"
|
|
78
|
+
// />
|
|
79
|
+
// </div>
|
|
80
|
+
// </div>
|
|
81
|
+
// <div className="versions-container">
|
|
82
|
+
// {versions?.map((item) => (
|
|
83
|
+
// <VersionItem
|
|
84
|
+
// key={item.version}
|
|
85
|
+
// version={item.version}
|
|
86
|
+
// articleStatus={item.article_status}
|
|
87
|
+
// currentVersion={item.version === currentVersion}
|
|
88
|
+
// productOwner={companyName}
|
|
89
|
+
// setVersion={setVersion}
|
|
90
|
+
// timestamp={item.timestamp}
|
|
91
|
+
// />
|
|
92
|
+
// ))}
|
|
93
|
+
// </div>
|
|
94
|
+
// {showCreateVersion && (
|
|
95
|
+
// <CreateVersion
|
|
96
|
+
// articleId={articleId}
|
|
97
|
+
// version={currentVersion}
|
|
98
|
+
// versionsList={versions}
|
|
99
|
+
// setShowCreateVersion={setShowCreateVersion}
|
|
100
|
+
// realoadVersion={() => setReload(!reload)}
|
|
101
|
+
// jwt={jwt}
|
|
102
|
+
// />
|
|
103
|
+
// )}
|
|
104
|
+
// </Container>
|
|
105
|
+
// );
|
|
106
|
+
// };
|
|
@@ -224,6 +224,7 @@ export const RetailerProductEdition = ({
|
|
|
224
224
|
const [auditDescriptions, setAuditDescriptions] = useState([]);
|
|
225
225
|
const [auditImages, setAuditImages] = useState([]);
|
|
226
226
|
const [compare, setCompare] = useState(false);
|
|
227
|
+
const [observation,setObservation] = useState();
|
|
227
228
|
const [valRejAll, setValRejAll] = useState(false);
|
|
228
229
|
|
|
229
230
|
const [desc, setDesc] = useState([]);
|
|
@@ -452,7 +453,7 @@ export const RetailerProductEdition = ({
|
|
|
452
453
|
}, [percentages]);
|
|
453
454
|
|
|
454
455
|
useEffect(() => {
|
|
455
|
-
getInputsData(services, activeRetailer, setDatasheets, setDescriptions);
|
|
456
|
+
//getInputsData(services, activeRetailer, setDatasheets, setDescriptions);
|
|
456
457
|
auditableVersion && loadAuditableData();
|
|
457
458
|
setActivePercentage(Math.round(activeRetailer?.percentage, 0));
|
|
458
459
|
activeRetailer?.id &&
|
|
@@ -833,84 +834,6 @@ export const RetailerProductEdition = ({
|
|
|
833
834
|
}
|
|
834
835
|
};
|
|
835
836
|
|
|
836
|
-
// const sendToFacilitator = async (result) => {
|
|
837
|
-
// setLoading(true);
|
|
838
|
-
// try {
|
|
839
|
-
// let concept = getConcept(activeTab);
|
|
840
|
-
|
|
841
|
-
// const productTemp = { ...product };
|
|
842
|
-
// const evalStatus = retailerStatus;
|
|
843
|
-
// const articleId = product.article.id_article;
|
|
844
|
-
// const orderId = product.orderId;
|
|
845
|
-
|
|
846
|
-
// // const body = {
|
|
847
|
-
// // orderArticleRetailers: [
|
|
848
|
-
// // { orderId, articleId, retailersIds: [activeRetailer.id] },
|
|
849
|
-
// // ],
|
|
850
|
-
// // isAproved: false,
|
|
851
|
-
// // service: concept,
|
|
852
|
-
// // };
|
|
853
|
-
|
|
854
|
-
// const body = {
|
|
855
|
-
// articleId: product.article.id_article,
|
|
856
|
-
// orderId: product.orderId,
|
|
857
|
-
// concept: concept,
|
|
858
|
-
// result: result,
|
|
859
|
-
// evalStatus: evalStatus,
|
|
860
|
-
// retailerId: activeRetailer.id,
|
|
861
|
-
// };
|
|
862
|
-
|
|
863
|
-
// let res;
|
|
864
|
-
// let message;
|
|
865
|
-
// if (result) {
|
|
866
|
-
// body.isAproved = result === "A";
|
|
867
|
-
// res = await axios.put(
|
|
868
|
-
// `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
869
|
-
// body,
|
|
870
|
-
// {
|
|
871
|
-
// headers: {
|
|
872
|
-
// Authorization: token,
|
|
873
|
-
// },
|
|
874
|
-
// }
|
|
875
|
-
// );
|
|
876
|
-
// console.log(JSON.parse(res.data.body), "res");
|
|
877
|
-
// getServices();
|
|
878
|
-
// } else {
|
|
879
|
-
// const specialistDone = ["RC", "RA", "CA"].includes(evalStatus);
|
|
880
|
-
|
|
881
|
-
// if (specialistDone) {
|
|
882
|
-
// message = `${activeTab} enviada a facilitador`;
|
|
883
|
-
// getSectionIcon();
|
|
884
|
-
// } else if (["IE", "AC", "RP", "RCA"].includes(evalStatus)) {
|
|
885
|
-
// message = "Evaluación enviada";
|
|
886
|
-
// getSectionIcon();
|
|
887
|
-
// }
|
|
888
|
-
// res = await axios.put(
|
|
889
|
-
// `${process.env.REACT_APP_EVALUATION_ENDPOINT}`,
|
|
890
|
-
// body,
|
|
891
|
-
// {
|
|
892
|
-
// headers: {
|
|
893
|
-
// Authorization: token,
|
|
894
|
-
// },
|
|
895
|
-
// }
|
|
896
|
-
// );
|
|
897
|
-
// }
|
|
898
|
-
// if (res.data.statusCode === 200) {
|
|
899
|
-
// const response = JSON.parse(res.data.body)?.successfulData;
|
|
900
|
-
// const statusObject =
|
|
901
|
-
// response[`${orderId}-${articleId}-${activeRetailer.id}`];
|
|
902
|
-
// productTemp.status = statusObject["generalStatus"];
|
|
903
|
-
// productTemp[`${concept}_status`] = statusObject[`${concept}Status`];
|
|
904
|
-
// await loadData();
|
|
905
|
-
// if (message) setMessage(message);
|
|
906
|
-
// sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
907
|
-
// setProduct(productTemp);
|
|
908
|
-
// }
|
|
909
|
-
// } catch (error) {
|
|
910
|
-
// console.log(error);
|
|
911
|
-
// }
|
|
912
|
-
// setLoading(false);
|
|
913
|
-
// };
|
|
914
837
|
const sendToFacilitator = async (result) => {
|
|
915
838
|
setLoading(true);
|
|
916
839
|
try {
|
|
@@ -1300,70 +1223,6 @@ export const RetailerProductEdition = ({
|
|
|
1300
1223
|
setSaving(loading);
|
|
1301
1224
|
}, [loading]);
|
|
1302
1225
|
|
|
1303
|
-
// const validateAll = async (result) => {
|
|
1304
|
-
// try {
|
|
1305
|
-
// setLoading(true);
|
|
1306
|
-
// const evaluationArray = [];
|
|
1307
|
-
// let conceptArray = ["description", "datasheet", "images"];
|
|
1308
|
-
// switch (user.id_role) {
|
|
1309
|
-
// case 4:
|
|
1310
|
-
// conceptArray = ["description", "datasheet"];
|
|
1311
|
-
// break;
|
|
1312
|
-
// case 5:
|
|
1313
|
-
// conceptArray = ["images"];
|
|
1314
|
-
// break;
|
|
1315
|
-
|
|
1316
|
-
// default:
|
|
1317
|
-
// conceptArray = ["description", "datasheet", "images"];
|
|
1318
|
-
// break;
|
|
1319
|
-
// }
|
|
1320
|
-
|
|
1321
|
-
// const isAproved = result === "A";
|
|
1322
|
-
// const retailersIds = [];
|
|
1323
|
-
// servicesData?.forEach((ret) => {
|
|
1324
|
-
// if (!retailersIds.includes(ret.id_retailer))
|
|
1325
|
-
// retailersIds.push(ret.id_retailer);
|
|
1326
|
-
// });
|
|
1327
|
-
// const body = {
|
|
1328
|
-
// orderArticleRetailers: [
|
|
1329
|
-
// {
|
|
1330
|
-
// orderId: product.id_order ?? product.orderId,
|
|
1331
|
-
// articleId: product.article.id_article,
|
|
1332
|
-
// retailersIds,
|
|
1333
|
-
// },
|
|
1334
|
-
// ],
|
|
1335
|
-
// isAproved,
|
|
1336
|
-
// };
|
|
1337
|
-
// conceptArray.forEach((concept) => {
|
|
1338
|
-
// body.service = concept;
|
|
1339
|
-
// evaluationArray.push(
|
|
1340
|
-
// axios.put(`${process.env.REACT_APP_EVALUATION_ENDPOINT}`, body, {
|
|
1341
|
-
// headers: {
|
|
1342
|
-
// Authorization: token,
|
|
1343
|
-
// },
|
|
1344
|
-
// })
|
|
1345
|
-
// );
|
|
1346
|
-
// });
|
|
1347
|
-
|
|
1348
|
-
// await Promise.all(evaluationArray);
|
|
1349
|
-
|
|
1350
|
-
// const productTemp = product;
|
|
1351
|
-
// productTemp.status = `${result}A`;
|
|
1352
|
-
// productTemp.datasheet_status =
|
|
1353
|
-
// productTemp.datasheet_status === "NA" ? "NA" : `${result}A`;
|
|
1354
|
-
// productTemp.description_status =
|
|
1355
|
-
// productTemp.description_status === "NA" ? "NA" : `${result}A`;
|
|
1356
|
-
// productTemp.images_status =
|
|
1357
|
-
// productTemp.images_status === "NA" ? "NA" : `${result}A`;
|
|
1358
|
-
// sessionStorage.setItem("productSelected", JSON.stringify(productTemp));
|
|
1359
|
-
// setProduct(productTemp);
|
|
1360
|
-
|
|
1361
|
-
// await loadData();
|
|
1362
|
-
// } catch (error) {
|
|
1363
|
-
// console.log(error);
|
|
1364
|
-
// }
|
|
1365
|
-
// };
|
|
1366
|
-
|
|
1367
1226
|
const validateAll = async (result) => {
|
|
1368
1227
|
try {
|
|
1369
1228
|
setLoading(true);
|
|
@@ -1423,6 +1282,21 @@ export const RetailerProductEdition = ({
|
|
|
1423
1282
|
}
|
|
1424
1283
|
};
|
|
1425
1284
|
|
|
1285
|
+
const getObservation = async () => {
|
|
1286
|
+
const response = await axios.get(
|
|
1287
|
+
`${process.env.REACT_APP_READ_OBSERVATION}?articleId=${product.article.id_article}&orderId=${product?.orderId}`,
|
|
1288
|
+
{
|
|
1289
|
+
headers: {
|
|
1290
|
+
Authorization: sessionStorage.getItem("jwt"),
|
|
1291
|
+
},
|
|
1292
|
+
}
|
|
1293
|
+
);
|
|
1294
|
+
const parseData = JSON.parse(response.data.body).data[0];
|
|
1295
|
+
setObservation( parseData.observations);
|
|
1296
|
+
};
|
|
1297
|
+
useEffect(() => {
|
|
1298
|
+
getObservation();
|
|
1299
|
+
}, []);
|
|
1426
1300
|
return (
|
|
1427
1301
|
<Container headerTop={headerTop}>
|
|
1428
1302
|
<HeaderTop
|
|
@@ -1465,6 +1339,7 @@ export const RetailerProductEdition = ({
|
|
|
1465
1339
|
<div className="product-information">
|
|
1466
1340
|
<FullProductNameHeader
|
|
1467
1341
|
headerData={product}
|
|
1342
|
+
productObservation= {observation}
|
|
1468
1343
|
percent={activePercentage}
|
|
1469
1344
|
activeRetailer={activeRetailer}
|
|
1470
1345
|
servicesData={servicesData}
|