contentoh-components-library 21.4.89 → 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.
- package/dist/assets/images/generalButton/saveIconpink.svg +3 -0
- package/dist/components/atoms/CustomChip/CustomChip.stories.js +31 -0
- package/dist/components/atoms/CustomChip/index.js +63 -0
- package/dist/components/atoms/CustomChip/styles.js +20 -0
- package/dist/components/atoms/Multiselect/index.js +148 -23
- package/dist/components/atoms/Multiselect/styles.js +1 -1
- package/dist/components/atoms/ObservationFlag/index.js +189 -16
- package/dist/components/atoms/ObservationFlag/styles.js +26 -4
- package/dist/components/molecules/Phase/Phase.stories.js +72 -34
- package/dist/components/molecules/Phase/index.js +243 -134
- package/dist/components/molecules/ProductNameHeader/index.js +4 -2
- package/dist/components/organisms/DragAndDropPhases/DragAndDropPhases.stories.js +0 -23
- package/dist/components/organisms/DragAndDropPhases/index.js +246 -163
- package/dist/components/organisms/FullProductNameHeader/index.js +2 -1
- package/package.json +1 -1
- package/src/assets/images/generalButton/saveIconpink.svg +3 -0
- package/src/components/atoms/CustomChip/CustomChip.stories.js +16 -0
- package/src/components/atoms/CustomChip/index.js +35 -0
- package/src/components/atoms/CustomChip/styles.js +6 -0
- package/src/components/atoms/Multiselect/index.js +200 -115
- package/src/components/atoms/Multiselect/styles.js +4 -0
- package/src/components/atoms/ObservationFlag/index.js +143 -17
- package/src/components/atoms/ObservationFlag/styles.js +101 -1
- package/src/components/molecules/Phase/Phase.stories.js +91 -21
- package/src/components/molecules/Phase/index.js +174 -98
- package/src/components/molecules/ProductNameHeader/index.js +9 -3
- package/src/components/organisms/DragAndDropPhases/DragAndDropPhases.stories.js +0 -27
- package/src/components/organisms/DragAndDropPhases/index.js +98 -42
- package/src/components/organisms/FullProductNameHeader/index.js +2 -1
- package/src/components/pages/RetailerProductEdition/index.js +2 -2
|
@@ -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>
|
|
@@ -0,0 +1,31 @@
|
|
|
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.CustomChipDefault = 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/CustomChip",
|
|
18
|
+
component: _index.CustomChip,
|
|
19
|
+
argTypes: {}
|
|
20
|
+
};
|
|
21
|
+
exports.default = _default;
|
|
22
|
+
|
|
23
|
+
var Template = function Template(args) {
|
|
24
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.CustomChip, (0, _objectSpread2.default)({}, args));
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
var CustomChipDefault = Template.bind({});
|
|
28
|
+
exports.CustomChipDefault = CustomChipDefault;
|
|
29
|
+
CustomChipDefault.args = {
|
|
30
|
+
name: "legal"
|
|
31
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
|
|
5
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
6
|
+
|
|
7
|
+
Object.defineProperty(exports, "__esModule", {
|
|
8
|
+
value: true
|
|
9
|
+
});
|
|
10
|
+
exports.CustomChip = void 0;
|
|
11
|
+
|
|
12
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
13
|
+
|
|
14
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
15
|
+
|
|
16
|
+
var _styles = require("./styles");
|
|
17
|
+
|
|
18
|
+
var _Chip = _interopRequireDefault(require("@mui/material/Chip"));
|
|
19
|
+
|
|
20
|
+
var _DeleteForeverOutlined = _interopRequireDefault(require("@mui/icons-material/DeleteForeverOutlined"));
|
|
21
|
+
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
|
|
24
|
+
var CustomChip = function CustomChip(_ref) {
|
|
25
|
+
var label = _ref.label,
|
|
26
|
+
onDelete = _ref.onDelete;
|
|
27
|
+
|
|
28
|
+
var _useState = (0, _react.useState)(false),
|
|
29
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
30
|
+
isHovered = _useState2[0],
|
|
31
|
+
setIsHovered = _useState2[1];
|
|
32
|
+
|
|
33
|
+
var handleMouseEnter = function handleMouseEnter() {
|
|
34
|
+
setIsHovered(true);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
var handleMouseLeave = function handleMouseLeave() {
|
|
38
|
+
setIsHovered(false);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Chip.default, {
|
|
42
|
+
label: label,
|
|
43
|
+
onDelete: onDelete,
|
|
44
|
+
onMouseEnter: handleMouseEnter,
|
|
45
|
+
onMouseLeave: handleMouseLeave,
|
|
46
|
+
deleteIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_DeleteForeverOutlined.default, {
|
|
47
|
+
sx: {
|
|
48
|
+
color: "#B64545!important",
|
|
49
|
+
fontSize: "14px!important",
|
|
50
|
+
cursor: "pointer"
|
|
51
|
+
}
|
|
52
|
+
}),
|
|
53
|
+
style: {
|
|
54
|
+
height: "30px",
|
|
55
|
+
borderRadius: "5px",
|
|
56
|
+
background: "transparent",
|
|
57
|
+
border: "1px solid ".concat(isHovered ? "#B64545" : "#F0F0F0"),
|
|
58
|
+
color: "".concat(isHovered ? "#B64545" : "#707070")
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
exports.CustomChip = CustomChip;
|
|
@@ -0,0 +1,20 @@
|
|
|
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 _variables = require("../../../global-files/variables");
|
|
15
|
+
|
|
16
|
+
var _templateObject;
|
|
17
|
+
|
|
18
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n\n"])));
|
|
19
|
+
|
|
20
|
+
exports.Container = Container;
|
|
@@ -9,6 +9,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
9
9
|
});
|
|
10
10
|
exports.Multiselect = void 0;
|
|
11
11
|
|
|
12
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
13
|
+
|
|
14
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
15
|
+
|
|
12
16
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
13
17
|
|
|
14
18
|
var _objectSpread5 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
@@ -17,6 +21,8 @@ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm
|
|
|
17
21
|
|
|
18
22
|
var _react = _interopRequireWildcard(require("react"));
|
|
19
23
|
|
|
24
|
+
var _axios = _interopRequireDefault(require("axios"));
|
|
25
|
+
|
|
20
26
|
var _styles = require("./styles");
|
|
21
27
|
|
|
22
28
|
var _Select = _interopRequireDefault(require("@mui/material/Select"));
|
|
@@ -31,6 +37,10 @@ var _OutlinedInput = _interopRequireDefault(require("@mui/material/OutlinedInput
|
|
|
31
37
|
|
|
32
38
|
var _EditGroup = require("../../organisms/EditGroup");
|
|
33
39
|
|
|
40
|
+
var _Modal = require("../../organisms/Modal");
|
|
41
|
+
|
|
42
|
+
var _ButtonV = require("../ButtonV2");
|
|
43
|
+
|
|
34
44
|
var _search = _interopRequireDefault(require("../../../assets/images/Icons/search.svg"));
|
|
35
45
|
|
|
36
46
|
var _settings = _interopRequireDefault(require("../../../assets/images/Icons/settings.svg"));
|
|
@@ -52,23 +62,28 @@ var Multiselect = function Multiselect(_ref) {
|
|
|
52
62
|
|
|
53
63
|
var _useState = (0, _react.useState)([]),
|
|
54
64
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
55
|
-
|
|
56
|
-
|
|
65
|
+
filters = _useState2[0],
|
|
66
|
+
setFilters = _useState2[1];
|
|
57
67
|
|
|
58
|
-
var _useState3 = (0, _react.useState)(
|
|
68
|
+
var _useState3 = (0, _react.useState)([]),
|
|
59
69
|
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
60
|
-
|
|
61
|
-
|
|
70
|
+
selectValues = _useState4[0],
|
|
71
|
+
setSelectValues = _useState4[1];
|
|
62
72
|
|
|
63
|
-
var _useState5 = (0, _react.useState)(
|
|
73
|
+
var _useState5 = (0, _react.useState)(""),
|
|
64
74
|
_useState6 = (0, _slicedToArray2.default)(_useState5, 2),
|
|
65
|
-
|
|
66
|
-
|
|
75
|
+
text = _useState6[0],
|
|
76
|
+
setText = _useState6[1];
|
|
67
77
|
|
|
68
|
-
var _useState7 = (0, _react.useState)(
|
|
78
|
+
var _useState7 = (0, _react.useState)(false),
|
|
69
79
|
_useState8 = (0, _slicedToArray2.default)(_useState7, 2),
|
|
70
|
-
|
|
71
|
-
|
|
80
|
+
isEditGroupVisible = _useState8[0],
|
|
81
|
+
setIsEditGroupVisible = _useState8[1];
|
|
82
|
+
|
|
83
|
+
var _useState9 = (0, _react.useState)(true),
|
|
84
|
+
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
85
|
+
isItemListVisible = _useState10[0],
|
|
86
|
+
setIsItemListVisible = _useState10[1];
|
|
72
87
|
|
|
73
88
|
var currentUser = arrayData.find(function (user) {
|
|
74
89
|
return user.idUser === userId;
|
|
@@ -78,6 +93,21 @@ var Multiselect = function Multiselect(_ref) {
|
|
|
78
93
|
idUser = _ref2.idUser,
|
|
79
94
|
groups = _ref2.groups;
|
|
80
95
|
|
|
96
|
+
var _useState11 = (0, _react.useState)([]),
|
|
97
|
+
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
98
|
+
selectedItems = _useState12[0],
|
|
99
|
+
setSelectedItems = _useState12[1];
|
|
100
|
+
|
|
101
|
+
var _useState13 = (0, _react.useState)({
|
|
102
|
+
show: false,
|
|
103
|
+
title: "Actualización completa",
|
|
104
|
+
message: "",
|
|
105
|
+
icon: "success"
|
|
106
|
+
}),
|
|
107
|
+
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
108
|
+
modalData = _useState14[0],
|
|
109
|
+
setModalData = _useState14[1];
|
|
110
|
+
|
|
81
111
|
(0, _react.useEffect)(function () {
|
|
82
112
|
var hasUserContentGroup1 = groups.some(function (group) {
|
|
83
113
|
return group.userContentGroup === 1;
|
|
@@ -97,7 +127,14 @@ var Multiselect = function Multiselect(_ref) {
|
|
|
97
127
|
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prevValues), {}, (0, _defineProperty2.default)({}, idUser, ["Sin grupos asignados"]));
|
|
98
128
|
});
|
|
99
129
|
}
|
|
130
|
+
|
|
131
|
+
setFilters(groups ? groups : []);
|
|
100
132
|
}, [idUser, groups]);
|
|
133
|
+
(0, _react.useEffect)(function () {
|
|
134
|
+
if (selectValues[userId]) {
|
|
135
|
+
setSelectedItems(selectValues[userId]);
|
|
136
|
+
}
|
|
137
|
+
}, [selectValues, userId]);
|
|
101
138
|
|
|
102
139
|
var onChange = function onChange(evt) {
|
|
103
140
|
setText(evt.target.value);
|
|
@@ -106,27 +143,105 @@ var Multiselect = function Multiselect(_ref) {
|
|
|
106
143
|
var handleChange = function handleChange(userId) {
|
|
107
144
|
return function (event) {
|
|
108
145
|
var value = event.target.value;
|
|
109
|
-
var updatedValues = value.
|
|
146
|
+
var updatedValues = value.map(function (groupName) {
|
|
110
147
|
var groupInfo = groups.find(function (g) {
|
|
111
148
|
return g.groupName === groupName;
|
|
112
149
|
});
|
|
113
|
-
return groupInfo;
|
|
150
|
+
return groupInfo ? groupInfo.groupName : null;
|
|
151
|
+
});
|
|
152
|
+
setSelectedItems(function (prevItems) {
|
|
153
|
+
updateGroup(value.map(function (groupName) {
|
|
154
|
+
var groupInfo = groups.find(function (g) {
|
|
155
|
+
return g.groupName === groupName;
|
|
156
|
+
});
|
|
157
|
+
return groupInfo ? groupInfo.groupId : null;
|
|
158
|
+
}).filter(function (groupId) {
|
|
159
|
+
return groupId !== null;
|
|
160
|
+
}));
|
|
161
|
+
return updatedValues;
|
|
114
162
|
});
|
|
115
163
|
setSelectValues(function (prevValues) {
|
|
116
164
|
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prevValues), {}, (0, _defineProperty2.default)({}, userId, updatedValues));
|
|
117
165
|
});
|
|
118
166
|
};
|
|
119
|
-
};
|
|
167
|
+
}; //actualiza los grupos seleccionados
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
var updateGroup = /*#__PURE__*/function () {
|
|
171
|
+
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(groupsIds) {
|
|
172
|
+
var body, response;
|
|
173
|
+
return _regenerator.default.wrap(function _callee$(_context) {
|
|
174
|
+
while (1) {
|
|
175
|
+
switch (_context.prev = _context.next) {
|
|
176
|
+
case 0:
|
|
177
|
+
_context.prev = 0;
|
|
178
|
+
body = {
|
|
179
|
+
userId: userId,
|
|
180
|
+
groupsIds: groupsIds
|
|
181
|
+
};
|
|
182
|
+
_context.next = 4;
|
|
183
|
+
return _axios.default.post("".concat(process.env.REACT_APP_USERS_ONBOARDING_ENDPOINT, "/update"), body, {
|
|
184
|
+
headers: {
|
|
185
|
+
Authorization: token
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
|
|
189
|
+
case 4:
|
|
190
|
+
response = _context.sent;
|
|
191
|
+
setModalData({
|
|
192
|
+
show: true,
|
|
193
|
+
className: "modal-save",
|
|
194
|
+
title: "",
|
|
195
|
+
message: "El cambio de grupo fue aplicado correctamente.",
|
|
196
|
+
icon: "successv2",
|
|
197
|
+
buttons: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ButtonV.ButtonV2, {
|
|
198
|
+
type: "pink",
|
|
199
|
+
label: "Aceptar",
|
|
200
|
+
size: 12,
|
|
201
|
+
onClick: function onClick() {
|
|
202
|
+
setModalData(false);
|
|
203
|
+
}
|
|
204
|
+
}, "btn-Aceptar-guardar")]
|
|
205
|
+
});
|
|
206
|
+
console.log("grupo actualizado correctamente", response.data.body);
|
|
207
|
+
console.log("body", body);
|
|
208
|
+
_context.next = 13;
|
|
209
|
+
break;
|
|
210
|
+
|
|
211
|
+
case 10:
|
|
212
|
+
_context.prev = 10;
|
|
213
|
+
_context.t0 = _context["catch"](0);
|
|
214
|
+
console.error("Error al cambiar grupos de usuarios:", _context.t0);
|
|
215
|
+
|
|
216
|
+
case 13:
|
|
217
|
+
case "end":
|
|
218
|
+
return _context.stop();
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
}, _callee, null, [[0, 10]]);
|
|
222
|
+
}));
|
|
223
|
+
|
|
224
|
+
return function updateGroup(_x) {
|
|
225
|
+
return _ref3.apply(this, arguments);
|
|
226
|
+
};
|
|
227
|
+
}();
|
|
120
228
|
|
|
121
229
|
(0, _react.useEffect)(function () {}, [selectValues]);
|
|
122
230
|
(0, _react.useEffect)(function () {
|
|
123
231
|
var filteredArray = (groups === null || groups === void 0 ? void 0 : groups.slice()) || [];
|
|
232
|
+
var normalizedText = text.trim().toLowerCase();
|
|
124
233
|
|
|
125
|
-
if (
|
|
234
|
+
if (normalizedText.length > 0) {
|
|
126
235
|
filteredArray = filteredArray.filter(function (option) {
|
|
127
|
-
|
|
236
|
+
var _option$groupName;
|
|
237
|
+
|
|
238
|
+
return option === null || option === void 0 ? void 0 : (_option$groupName = option.groupName) === null || _option$groupName === void 0 ? void 0 : _option$groupName.toLowerCase().includes(normalizedText);
|
|
128
239
|
});
|
|
129
240
|
}
|
|
241
|
+
|
|
242
|
+
setFilters(filteredArray);
|
|
243
|
+
console.log("text:", normalizedText);
|
|
244
|
+
console.log("filteredArray:", filteredArray);
|
|
130
245
|
}, [text]);
|
|
131
246
|
var ITEM_HEIGHT = 48;
|
|
132
247
|
var ITEM_PADDING_TOP = 8;
|
|
@@ -151,9 +266,7 @@ var Multiselect = function Multiselect(_ref) {
|
|
|
151
266
|
sx: {
|
|
152
267
|
width: "80%",
|
|
153
268
|
height: "34px",
|
|
154
|
-
paddingBottom: "1px solid #F0F0F0"
|
|
155
|
-
color: "#707070",
|
|
156
|
-
fontSize: "12px"
|
|
269
|
+
paddingBottom: "1px solid #F0F0F0"
|
|
157
270
|
}
|
|
158
271
|
}),
|
|
159
272
|
renderValue: function renderValue(selected) {
|
|
@@ -162,9 +275,13 @@ var Multiselect = function Multiselect(_ref) {
|
|
|
162
275
|
MenuProps: MenuProps,
|
|
163
276
|
sx: {
|
|
164
277
|
width: "80%",
|
|
165
|
-
height: "24px"
|
|
278
|
+
height: "24px",
|
|
279
|
+
"& div": {
|
|
280
|
+
color: "#707070",
|
|
281
|
+
fontSize: "12px"
|
|
282
|
+
}
|
|
166
283
|
},
|
|
167
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
284
|
+
children: [showSearchBar && /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuItem.default, {
|
|
168
285
|
sx: {
|
|
169
286
|
maxHeight: "34px",
|
|
170
287
|
paddingLeft: "10px",
|
|
@@ -189,7 +306,7 @@ var Multiselect = function Multiselect(_ref) {
|
|
|
189
306
|
}
|
|
190
307
|
}
|
|
191
308
|
},
|
|
192
|
-
children:
|
|
309
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
193
310
|
className: "search-bar-filter",
|
|
194
311
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
195
312
|
src: _search.default,
|
|
@@ -277,7 +394,15 @@ var Multiselect = function Multiselect(_ref) {
|
|
|
277
394
|
setIsEditGroupVisible(false);
|
|
278
395
|
setIsItemListVisible(true);
|
|
279
396
|
}
|
|
280
|
-
})
|
|
397
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, (0, _objectSpread5.default)((0, _objectSpread5.default)({}, modalData), {}, {
|
|
398
|
+
onClickBtnDefault: function onClickBtnDefault() {
|
|
399
|
+
return setModalData(function (prev) {
|
|
400
|
+
return (0, _objectSpread5.default)((0, _objectSpread5.default)({}, prev), {}, {
|
|
401
|
+
show: false
|
|
402
|
+
});
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
}))]
|
|
281
406
|
});
|
|
282
407
|
};
|
|
283
408
|
|
|
@@ -13,6 +13,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
13
13
|
|
|
14
14
|
var _templateObject;
|
|
15
15
|
|
|
16
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n min-width:200px;\n max-height:34px;\n .search-bar-filter {\n display: flex;\n align-items: center;\n border: 1px solid #f0f0f0;\n padding-left: 10px;\n \n img {\n width: 15px;\n height: 15px;\n }\n \n input {\n background-color: transparent;\n padding: 10px 10px;\n outline: none;\n border: none;\n }\n }\n\n img.icon{\n width: 15px;\n height: 15px;\n }\n"])));
|
|
16
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n min-width:200px;\n max-height:34px;\n .search-bar-filter {\n display: flex;\n align-items: center;\n border: 1px solid #f0f0f0;\n padding-left: 10px;\n \n img {\n width: 15px;\n height: 15px;\n }\n \n input {\n background-color: transparent;\n padding: 10px 10px;\n outline: none;\n border: none;\n }\n }\n\n img.icon{\n width: 15px;\n height: 15px;\n }\n\n .modal-save .contentModal {\n max-width:200px;\n }\n"])));
|
|
17
17
|
|
|
18
18
|
exports.Container = Container;
|
|
@@ -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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
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
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
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;
|