contentoh-components-library 21.4.90 → 21.4.91

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.
@@ -0,0 +1,3 @@
1
+ <svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M8.76419 1.25748L8.05551 0.488358C7.76757 0.1754 7.37713 0 6.96975 0H1.05581C0.472617 0 0 0.512924 0 1.14586V8.85414C0 9.48708 0.472617 10 1.05581 10H8.15836C8.74156 10 9.21417 9.48708 9.21417 8.85414V2.43584C9.21417 1.99371 9.05256 1.56998 8.76419 1.25748ZM1.53567 2.60414V1.5625C1.53567 1.39 1.66467 1.25 1.82361 1.25H5.85482C6.01376 1.25 6.14276 1.39 6.14276 1.5625V2.60414C6.14276 2.77664 6.01376 2.91664 5.85482 2.91664H1.82361C1.66467 2.91664 1.53567 2.77664 1.53567 2.60414ZM4.60709 8.33336C3.65306 8.33336 2.87943 7.49374 2.87943 6.45836C2.87943 5.4229 3.65306 4.58336 4.60709 4.58336C5.56111 4.58336 6.33474 5.4229 6.33474 6.45836C6.33474 7.49374 5.56111 8.33336 4.60709 8.33336Z" fill="#E33AA9"/>
3
+ </svg>
@@ -1,5 +1,7 @@
1
1
  "use strict";
2
2
 
3
+ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
4
+
3
5
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
6
 
5
7
  Object.defineProperty(exports, "__esModule", {
@@ -7,8 +9,18 @@ Object.defineProperty(exports, "__esModule", {
7
9
  });
8
10
  exports.ObservationFlag = void 0;
9
11
 
12
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
13
+
14
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
15
+
16
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
17
+
10
18
  var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
11
19
 
20
+ var _react = _interopRequireWildcard(require("react"));
21
+
22
+ var _axios = _interopRequireDefault(require("axios"));
23
+
12
24
  var _styles = require("./styles");
13
25
 
14
26
  var _Tooltip = require("../Tooltip");
@@ -21,31 +33,192 @@ var _mediumPriority = _interopRequireDefault(require("../../../assets/images/fla
21
33
 
22
34
  var _lowPriority = _interopRequireDefault(require("../../../assets/images/flags/lowPriority.svg"));
23
35
 
36
+ var _saveIconpink = _interopRequireDefault(require("../../../assets/images/generalButton/saveIconpink.svg"));
37
+
38
+ var _Modal = require("../../organisms/Modal");
39
+
24
40
  var _jsxRuntime = require("react/jsx-runtime");
25
41
 
26
42
  var ObservationFlag = function ObservationFlag(_ref) {
27
43
  var _PriorityFlags;
28
44
 
29
45
  var observation = _ref.observation,
30
- contentObservation = _ref.contentObservation;
46
+ contentObservation = _ref.contentObservation,
47
+ dataProduct = _ref.dataProduct;
31
48
  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"
49
+
50
+ var _useState = (0, _react.useState)(false),
51
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
52
+ isObservationVisible = _useState2[0],
53
+ setObservationVisible = _useState2[1];
54
+
55
+ var _useState3 = (0, _react.useState)(contentObservation || ""),
56
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
57
+ material = _useState4[0],
58
+ setMaterial = _useState4[1];
59
+
60
+ var _useState5 = (0, _react.useState)(observation),
61
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
62
+ currentObservation = _useState6[0],
63
+ setCurrentObservation = _useState6[1];
64
+
65
+ var _useState7 = (0, _react.useState)(null),
66
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
67
+ modalView = _useState8[0],
68
+ setModalView = _useState8[1];
69
+
70
+ var _useState9 = (0, _react.useState)(false),
71
+ _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
72
+ showModal = _useState10[0],
73
+ setShowModal = _useState10[1];
74
+
75
+ var _useState11 = (0, _react.useState)({}),
76
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
77
+ modalData = _useState12[0],
78
+ setModalData = _useState12[1];
79
+
80
+ var textareaRef = (0, _react.useRef)(null);
81
+
82
+ var toggleObservation = function toggleObservation() {
83
+ setObservationVisible(!isObservationVisible);
84
+ };
85
+
86
+ (0, _react.useEffect)(function () {
87
+ var handleClickOutside = function handleClickOutside(event) {
88
+ if (isObservationVisible && !event.target.closest(".Observation") && !event.target.closest(".Container")) {
89
+ setObservationVisible(false);
90
+ }
91
+ };
92
+
93
+ document.addEventListener("click", handleClickOutside);
94
+ return function () {
95
+ document.removeEventListener("click", handleClickOutside);
96
+ };
97
+ }, [isObservationVisible]);
98
+ (0, _react.useEffect)(function () {
99
+ setMaterial(contentObservation || ""); // Establecer material después de montar el componente
100
+ }, [contentObservation]); // Volver a establecer material cuando contentObservation cambia
101
+
102
+ (0, _react.useEffect)(function () {
103
+ setCurrentObservation(observation);
104
+ }, [observation]);
105
+
106
+ var saveRequest = /*#__PURE__*/function () {
107
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
108
+ var dataToSend, response, succesResponse, errorResponse;
109
+ return _regenerator.default.wrap(function _callee$(_context) {
110
+ while (1) {
111
+ switch (_context.prev = _context.next) {
112
+ case 0:
113
+ dataToSend = {
114
+ orderId: parseInt(dataProduct.orderId),
115
+ articleId: dataProduct.article.id_article,
116
+ observation: textareaRef.current.value
117
+ };
118
+ _context.prev = 1;
119
+ _context.next = 4;
120
+ return _axios.default.put(process.env.REACT_APP_UPDATE_OBSERVATION, dataToSend);
121
+
122
+ case 4:
123
+ response = _context.sent;
124
+ succesResponse = {
125
+ status: true,
126
+ message: "Información guardada correctamente",
127
+ detail: "",
128
+ img: true
129
+ };
130
+ errorResponse = {
131
+ status: false,
132
+ message: "Error al guardar la información",
133
+ detail: "",
134
+ img: false
135
+ };
136
+ setShowModal(true);
137
+ setModalData(response.data.statusCode === 200 ? succesResponse : errorResponse);
138
+ setCurrentObservation(material !== "" ? "high" : "low");
139
+ setObservationVisible(false);
140
+ return _context.abrupt("return", response);
141
+
142
+ case 14:
143
+ _context.prev = 14;
144
+ _context.t0 = _context["catch"](1);
145
+ console.log(_context.t0);
146
+
147
+ case 17:
148
+ case "end":
149
+ return _context.stop();
150
+ }
151
+ }
152
+ }, _callee, null, [[1, 14]]);
153
+ }));
154
+
155
+ return function saveRequest() {
156
+ return _ref2.apply(this, arguments);
157
+ };
158
+ }();
159
+
160
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
161
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
162
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
163
+ src: PriorityFlags[currentObservation],
164
+ alt: observation,
165
+ style: {
166
+ cursor: "pointer"
167
+ },
168
+ onClick: toggleObservation
169
+ }), isObservationVisible && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Observation, {
170
+ onClick: function onClick(evt) {
171
+ evt.stopPropagation();
172
+ },
173
+ className: "Observation",
174
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ServTab, {
175
+ onClick: function onClick(evt) {
176
+ evt.stopPropagation();
177
+ },
178
+ className: "close-Container",
179
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
180
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
181
+ children: "Material completo"
182
+ })
183
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
184
+ className: "flex",
185
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("textarea", {
186
+ ref: textareaRef,
187
+ name: "textarea",
188
+ rows: "10",
189
+ cols: "50",
190
+ style: {
191
+ color: "black",
192
+ padding: "5px"
193
+ },
194
+ value: material,
195
+ onChange: function onChange(e) {
196
+ return setMaterial(e.target.value);
197
+ },
198
+ onClick: function onClick(e) {
199
+ return e.stopPropagation();
200
+ }
201
+ })
202
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SaveButton, {
203
+ onClick: function onClick(evt) {
204
+ evt.stopPropagation();
205
+ saveRequest();
206
+ },
207
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
208
+ src: _saveIconpink.default,
209
+ alt: "Guardar"
210
+ })
211
+ })]
37
212
  })
38
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("p", {
39
- children: [contentObservation, " "]
40
213
  })]
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"
214
+ }), showModal && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, {
215
+ show: showModal,
216
+ title: modalData.title,
217
+ message: modalData.message,
218
+ onClickBtnDefault: function onClickBtnDefault(event) {
219
+ return setShowModal(false);
220
+ }
221
+ })]
49
222
  });
50
223
  };
51
224
 
@@ -5,14 +5,36 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
- exports.Container = void 0;
8
+ exports.ServTab = exports.SaveButton = exports.Observation = exports.Content = exports.Container = void 0;
9
9
 
10
10
  var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
11
 
12
12
  var _styledComponents = _interopRequireDefault(require("styled-components"));
13
13
 
14
- var _templateObject;
14
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
15
15
 
16
- var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)([""])));
16
+ var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n /* position: relative;\n height: 100%;\n width: 100%; */\n"])));
17
17
 
18
- exports.Container = Container;
18
+ exports.Container = Container;
19
+
20
+ var Observation = _styledComponents.default.div(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n /* height: 100%;\n width: 100%; */\n"])));
21
+
22
+ exports.Observation = Observation;
23
+
24
+ var Content = _styledComponents.default.div(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n height: 100%;\n width: 100%;\n & > div {\n width: 30px;\n height: 20px;\n font-family: Lato;\n font-style: normal;\n font-weight: normal;\n font-size: 12px;\n line-height: 20px;\n text-align: center;\n border-radius: 3px;\n color: ", ";\n background-color: ", ";\n }\n"])), function (_ref) {
25
+ var cont = _ref.cont;
26
+ return cont === "-" || cont === "Pt" ? "#817393" : "#FFF";
27
+ }, function (_ref2) {
28
+ var cont = _ref2.cont;
29
+ return backgroundContent(cont);
30
+ });
31
+
32
+ exports.Content = Content;
33
+
34
+ var ServTab = _styledComponents.default.div(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n position: absolute;\n top: 0;\n right: 10%;\n z-index: 2;\n width: 300px;\n max-height: 280px;\n overflow-y: auto;\n box-sizing: border-box;\n background: #281f33;\n padding: 8px;\n white-space: normal;\n font-family: Avenir Next;\n font-style: normal;\n > div {\n background-color: #503d66;\n margin-bottom: 8px;\n color: #f0eef2;\n box-sizing: border-box;\n padding: 8px;\n text-align: left;\n > span {\n font-weight: bold;\n font-size: 14px;\n line-height: 19px;\n }\n > p {\n font-weight: normal;\n font-size: 12px;\n line-height: 16px;\n }\n }\n .flex {\n display: flex;\n width: 100%;\n background-color: #503d6644;\n margin-left: 0px;\n p {\n width: 16%;\n &:first-child {\n width: 50%;\n }\n }\n }\n .title {\n position: sticky;\n top: -9px;\n background-color: #503d66;\n }\n .ignore-background {\n background-color: #1111;\n margin: 0;\n }\n"])));
35
+
36
+ exports.ServTab = ServTab;
37
+
38
+ var SaveButton = _styledComponents.default.button(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n position: sticky;\n bottom: 0;\n left: 100%;\n background-color: #fbfbfb;\n border: 2px solid #e33aa9;\n width: 20px;\n height: 20px;\n padding: 0;\n cursor: pointer;\n min-height: initial;\n"])));
39
+
40
+ exports.SaveButton = SaveButton;
@@ -25,7 +25,8 @@ var ProductNameHeader = function ProductNameHeader(_ref) {
25
25
  priority = _ref.priority,
26
26
  date = _ref.date,
27
27
  percentRequired = _ref.percentRequired,
28
- productObservation = _ref.productObservation;
28
+ productObservation = _ref.productObservation,
29
+ dataProduct = _ref.dataProduct;
29
30
  var typeFlag = productObservation !== null && productObservation !== "" ? "high" : "low";
30
31
  return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
31
32
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
@@ -39,7 +40,8 @@ var ProductNameHeader = function ProductNameHeader(_ref) {
39
40
  percentRequired: percentRequired
40
41
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index5.ObservationFlag, {
41
42
  observation: typeFlag,
42
- contentObservation: productObservation
43
+ contentObservation: productObservation,
44
+ dataProduct: dataProduct
43
45
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.ScreenHeader, {
44
46
  headerType: "date-header",
45
47
  text: date
@@ -70,7 +70,8 @@ var FullProductNameHeader = function FullProductNameHeader(_ref) {
70
70
  percent: percent === null || percent === void 0 ? void 0 : percent.toFixed(0),
71
71
  priority: headerData === null || headerData === void 0 ? void 0 : headerData.prio,
72
72
  productObservation: productObservation,
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))
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)),
74
+ dataProduct: headerData
74
75
  }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
75
76
  className: "features-bar-container",
76
77
  children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_FeaturesBar.FeaturesBar, {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "contentoh-components-library",
3
- "version": "21.4.90",
3
+ "version": "21.4.91",
4
4
  "dependencies": {
5
5
  "@aws-amplify/auth": "^4.5.3",
6
6
  "@aws-amplify/datastore": "^3.11.0",
@@ -0,0 +1,3 @@
1
+ <svg width="10" height="10" viewBox="0 0 10 10" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M8.76419 1.25748L8.05551 0.488358C7.76757 0.1754 7.37713 0 6.96975 0H1.05581C0.472617 0 0 0.512924 0 1.14586V8.85414C0 9.48708 0.472617 10 1.05581 10H8.15836C8.74156 10 9.21417 9.48708 9.21417 8.85414V2.43584C9.21417 1.99371 9.05256 1.56998 8.76419 1.25748ZM1.53567 2.60414V1.5625C1.53567 1.39 1.66467 1.25 1.82361 1.25H5.85482C6.01376 1.25 6.14276 1.39 6.14276 1.5625V2.60414C6.14276 2.77664 6.01376 2.91664 5.85482 2.91664H1.82361C1.66467 2.91664 1.53567 2.77664 1.53567 2.60414ZM4.60709 8.33336C3.65306 8.33336 2.87943 7.49374 2.87943 6.45836C2.87943 5.4229 3.65306 4.58336 4.60709 4.58336C5.56111 4.58336 6.33474 5.4229 6.33474 6.45836C6.33474 7.49374 5.56111 8.33336 4.60709 8.33336Z" fill="#E33AA9"/>
3
+ </svg>
@@ -1,33 +1,159 @@
1
- import { Container } from "./styles";
1
+ import React, { useState, useEffect, useRef } from "react";
2
+ import axios from "axios";
3
+ import { Container, Observation, Content, ServTab, SaveButton } from "./styles";
2
4
  import { Tooltip } from "../Tooltip";
3
5
  import without from "../../../assets/images/flags/noPriority.svg";
4
6
  import high from "../../../assets/images/flags/highPriority.svg";
5
7
  import medium from "../../../assets/images/flags/mediumPriority.svg";
6
8
  import low from "../../../assets/images/flags/lowPriority.svg";
9
+ import saveIconpink from "../../../assets/images/generalButton/saveIconpink.svg";
10
+ import { Modal } from "../../organisms/Modal";
7
11
 
8
- export const ObservationFlag = ({ observation,contentObservation }) => {
12
+ export const ObservationFlag = ({
13
+ observation,
14
+ contentObservation,
15
+ dataProduct,
16
+ }) => {
9
17
  const PriorityFlags = {
10
18
  ["none"]: without,
11
19
  ["low"]: low,
12
20
  ["medium"]: medium,
13
21
  ["high"]: high,
14
22
  };
15
- return (
16
- <Tooltip
17
- componentTooltip={
18
- <>
19
- <p>
20
- <b>Observaciones del producto</b>
21
- </p>
22
- <p>{contentObservation} </p>
23
- </>
23
+
24
+ const [isObservationVisible, setObservationVisible] = useState(false);
25
+ const [material, setMaterial] = useState(contentObservation || "");
26
+ const [currentObservation, setCurrentObservation] = useState(observation);
27
+
28
+ const [modalView, setModalView] = useState(null);
29
+ const [showModal, setShowModal] = useState(false);
30
+ const [modalData, setModalData] = useState({});
31
+
32
+ const textareaRef = useRef(null);
33
+ const toggleObservation = () => {
34
+ setObservationVisible(!isObservationVisible);
35
+ };
36
+ useEffect(() => {
37
+ const handleClickOutside = (event) => {
38
+ if (
39
+ isObservationVisible &&
40
+ !event.target.closest(".Observation") &&
41
+ !event.target.closest(".Container")
42
+ ) {
43
+ setObservationVisible(false);
44
+ }
45
+ };
46
+ document.addEventListener("click", handleClickOutside);
47
+ return () => {
48
+ document.removeEventListener("click", handleClickOutside);
49
+ };
50
+ }, [isObservationVisible]);
51
+
52
+ useEffect(() => {
53
+ setMaterial(contentObservation || ""); // Establecer material después de montar el componente
54
+ }, [contentObservation]); // Volver a establecer material cuando contentObservation cambia
55
+
56
+ useEffect(() => {
57
+ setCurrentObservation(observation);
58
+ }, [observation]);
59
+
60
+ const saveRequest = async () => {
61
+ let dataToSend = {
62
+ orderId: parseInt(dataProduct.orderId),
63
+ articleId: dataProduct.article.id_article,
64
+ observation: textareaRef.current.value,
65
+ };
66
+
67
+ try {
68
+ const response = await axios.put(
69
+ process.env.REACT_APP_UPDATE_OBSERVATION,
70
+ dataToSend
71
+ );
72
+
73
+ const succesResponse = {
74
+ status: true,
75
+ message: "Información guardada correctamente",
76
+ detail: "",
77
+ img: true,
78
+ };
79
+ const errorResponse = {
80
+ status: false,
81
+ message: "Error al guardar la información",
82
+ detail: "",
83
+ img: false,
84
+ };
85
+
86
+ setShowModal(true);
87
+ setModalData(
88
+ response.data.statusCode === 200 ? succesResponse : errorResponse
89
+ );
90
+ setCurrentObservation(material !== "" ? "high" : "low");
91
+ setObservationVisible(false);
92
+ return response;
93
+ } catch (err) {
94
+ console.log(err);
24
95
  }
25
- children={
96
+ };
97
+ return (
98
+ <>
26
99
  <Container>
27
- <img src={PriorityFlags[observation]} alt={observation} />
28
- </Container>
29
- }
30
- classNameTooltip={"container-tooltip"}
31
- />
100
+ <img
101
+ src={PriorityFlags[currentObservation]}
102
+ alt={observation}
103
+ style={{ cursor: "pointer" }}
104
+ onClick={toggleObservation}
105
+ />
106
+ {isObservationVisible && (
107
+ <Observation
108
+ onClick={(evt) => {
109
+ evt.stopPropagation();
110
+ }}
111
+ className="Observation"
112
+ >
113
+ <ServTab
114
+ onClick={(evt) => {
115
+ evt.stopPropagation();
116
+ }}
117
+ className="close-Container"
118
+ >
119
+ <div>
120
+ <span>Material completo</span>
121
+ </div>
122
+
123
+ <div className="flex">
124
+ <textarea
125
+ ref={textareaRef}
126
+ name="textarea"
127
+ rows="10"
128
+ cols="50"
129
+ style={{ color: "black", padding: "5px" }}
130
+ value={material}
131
+ onChange={(e) => setMaterial(e.target.value)}
132
+ onClick={(e) => e.stopPropagation()}
133
+ />
134
+ </div>
135
+
136
+ <SaveButton
137
+ onClick={(evt) => {
138
+ evt.stopPropagation();
139
+ saveRequest();
140
+ }}
141
+ >
142
+ <img src={saveIconpink} alt="Guardar" />
143
+ </SaveButton>
144
+ </ServTab>
145
+ </Observation>
146
+ )}
147
+ </Container>
148
+
149
+ {showModal && (
150
+ <Modal
151
+ show={showModal}
152
+ title={modalData.title}
153
+ message={modalData.message}
154
+ onClickBtnDefault={(event) => setShowModal(false)}
155
+ />
156
+ )}
157
+ </>
32
158
  );
33
159
  };
@@ -1,3 +1,103 @@
1
1
  import styled from "styled-components";
2
2
 
3
- export const Container = styled.div``;
3
+ export const Container = styled.div`
4
+ /* position: relative;
5
+ height: 100%;
6
+ width: 100%; */
7
+ `;
8
+ export const Observation = styled.div`
9
+ position: relative;
10
+ /* height: 100%;
11
+ width: 100%; */
12
+ `;
13
+
14
+ export const Content = styled.div`
15
+ position: relative;
16
+ display: flex;
17
+ justify-content: center;
18
+ align-items: center;
19
+ height: 100%;
20
+ width: 100%;
21
+ & > div {
22
+ width: 30px;
23
+ height: 20px;
24
+ font-family: Lato;
25
+ font-style: normal;
26
+ font-weight: normal;
27
+ font-size: 12px;
28
+ line-height: 20px;
29
+ text-align: center;
30
+ border-radius: 3px;
31
+ color: ${({ cont }) =>
32
+ cont === "-" || cont === "Pt" ? "#817393" : "#FFF"};
33
+ background-color: ${({ cont }) => backgroundContent(cont)};
34
+ }
35
+ `;
36
+
37
+ export const ServTab = styled.div`
38
+ position: absolute;
39
+ top: 0;
40
+ right: 10%;
41
+ z-index: 2;
42
+ width: 300px;
43
+ max-height: 280px;
44
+ overflow-y: auto;
45
+ box-sizing: border-box;
46
+ background: #281f33;
47
+ padding: 8px;
48
+ white-space: normal;
49
+ font-family: Avenir Next;
50
+ font-style: normal;
51
+ > div {
52
+ background-color: #503d66;
53
+ margin-bottom: 8px;
54
+ color: #f0eef2;
55
+ box-sizing: border-box;
56
+ padding: 8px;
57
+ text-align: left;
58
+ > span {
59
+ font-weight: bold;
60
+ font-size: 14px;
61
+ line-height: 19px;
62
+ }
63
+ > p {
64
+ font-weight: normal;
65
+ font-size: 12px;
66
+ line-height: 16px;
67
+ }
68
+ }
69
+ .flex {
70
+ display: flex;
71
+ width: 100%;
72
+ background-color: #503d6644;
73
+ margin-left: 0px;
74
+ p {
75
+ width: 16%;
76
+ &:first-child {
77
+ width: 50%;
78
+ }
79
+ }
80
+ }
81
+ .title {
82
+ position: sticky;
83
+ top: -9px;
84
+ background-color: #503d66;
85
+ }
86
+ .ignore-background {
87
+ background-color: #1111;
88
+ margin: 0;
89
+ }
90
+ `;
91
+
92
+ export const SaveButton = styled.button`
93
+ position: sticky;
94
+ bottom: 0;
95
+ left: 100%;
96
+ background-color: #fbfbfb;
97
+ border: 2px solid #e33aa9;
98
+ width: 20px;
99
+ height: 20px;
100
+ padding: 0;
101
+ cursor: pointer;
102
+ min-height: initial;
103
+ `;
@@ -11,9 +11,11 @@ export const ProductNameHeader = ({
11
11
  priority,
12
12
  date,
13
13
  percentRequired,
14
- productObservation
14
+ productObservation,
15
+ dataProduct,
15
16
  }) => {
16
- const typeFlag = productObservation!== null && productObservation !== "" ? "high" : "low";
17
+ const typeFlag =
18
+ productObservation !== null && productObservation !== "" ? "high" : "low";
17
19
  return (
18
20
  <Container>
19
21
  <ScreenHeader headerType={"product-name-header"} text={productName} />
@@ -24,7 +26,11 @@ export const ProductNameHeader = ({
24
26
  percentRequired={percentRequired}
25
27
  />
26
28
  {/* <PriorityFlag priority={priority} /> */}
27
- <ObservationFlag observation={typeFlag}contentObservation={productObservation}/>
29
+ <ObservationFlag
30
+ observation={typeFlag}
31
+ contentObservation={productObservation}
32
+ dataProduct={dataProduct}
33
+ />
28
34
  <ScreenHeader headerType={"date-header"} text={date} />
29
35
  </Container>
30
36
  );
@@ -17,7 +17,7 @@ export const FullProductNameHeader = ({
17
17
  rejectAll,
18
18
  servicesData,
19
19
  showApproveRejectAll,
20
- productObservation
20
+ productObservation,
21
21
  }) => {
22
22
  const [retailers, setRetailers] = useState([]);
23
23
 
@@ -55,6 +55,7 @@ export const FullProductNameHeader = ({
55
55
  priority={headerData?.prio}
56
56
  productObservation={productObservation}
57
57
  date={getTime(headerData?.article?.timestamp || headerData?.timestamp)}
58
+ dataProduct={headerData}
58
59
  />
59
60
  <div className="features-bar-container">
60
61
  <FeaturesBar
@@ -1292,7 +1292,7 @@ export const RetailerProductEdition = ({
1292
1292
  }
1293
1293
  );
1294
1294
  const parseData = JSON.parse(response.data.body).data[0];
1295
- setObservation( parseData.observations);
1295
+ setObservation(parseData.observations);
1296
1296
  };
1297
1297
  useEffect(() => {
1298
1298
  getObservation();
@@ -1339,7 +1339,7 @@ export const RetailerProductEdition = ({
1339
1339
  <div className="product-information">
1340
1340
  <FullProductNameHeader
1341
1341
  headerData={product}
1342
- productObservation= {observation}
1342
+ productObservation={observation}
1343
1343
  percent={activePercentage}
1344
1344
  activeRetailer={activeRetailer}
1345
1345
  servicesData={servicesData}