contentoh-components-library 21.4.79 → 21.4.81
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.
|
@@ -78,7 +78,9 @@ var reducerGroups = function reducerGroups(state, action) {
|
|
|
78
78
|
};
|
|
79
79
|
|
|
80
80
|
var EditGroup = function EditGroup(_ref) {
|
|
81
|
-
var token = _ref.token
|
|
81
|
+
var token = _ref.token,
|
|
82
|
+
show = _ref.show,
|
|
83
|
+
onClose = _ref.onClose;
|
|
82
84
|
|
|
83
85
|
var _useState = (0, _react.useState)([]),
|
|
84
86
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -105,35 +107,35 @@ var EditGroup = function EditGroup(_ref) {
|
|
|
105
107
|
deletingIndex = _useState8[0],
|
|
106
108
|
setDeletingIndex = _useState8[1];
|
|
107
109
|
|
|
108
|
-
var _useState9 = (0, _react.useState)(
|
|
110
|
+
var _useState9 = (0, _react.useState)(null),
|
|
109
111
|
_useState10 = (0, _slicedToArray2.default)(_useState9, 2),
|
|
110
|
-
|
|
111
|
-
|
|
112
|
+
hoveredIndex = _useState10[0],
|
|
113
|
+
setHoveredIndex = _useState10[1];
|
|
112
114
|
|
|
113
|
-
var _useState11 = (0, _react.useState)(
|
|
115
|
+
var _useState11 = (0, _react.useState)([]),
|
|
114
116
|
_useState12 = (0, _slicedToArray2.default)(_useState11, 2),
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
isEditingList = _useState12[0],
|
|
118
|
+
setIsEditingList = _useState12[1];
|
|
117
119
|
|
|
118
|
-
var _useState13 = (0, _react.useState)(
|
|
120
|
+
var _useState13 = (0, _react.useState)(false),
|
|
119
121
|
_useState14 = (0, _slicedToArray2.default)(_useState13, 2),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
+
newGroup = _useState14[0],
|
|
123
|
+
setNewGroup = _useState14[1];
|
|
122
124
|
|
|
123
|
-
var _useState15 = (0, _react.useState)(
|
|
125
|
+
var _useState15 = (0, _react.useState)(null),
|
|
124
126
|
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
125
|
-
|
|
126
|
-
|
|
127
|
+
currentEditIndex = _useState16[0],
|
|
128
|
+
setCurrentEditIndex = _useState16[1];
|
|
127
129
|
|
|
128
|
-
var _useState17 = (0, _react.useState)(
|
|
130
|
+
var _useState17 = (0, _react.useState)([]),
|
|
129
131
|
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
130
|
-
|
|
131
|
-
|
|
132
|
+
inputValue = _useState18[0],
|
|
133
|
+
setInputValue = _useState18[1];
|
|
132
134
|
|
|
133
|
-
var _useState19 = (0, _react.useState)(
|
|
135
|
+
var _useState19 = (0, _react.useState)(false),
|
|
134
136
|
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
+
shouldClose = _useState20[0],
|
|
138
|
+
setShouldClose = _useState20[1];
|
|
137
139
|
|
|
138
140
|
var _useState21 = (0, _react.useState)({
|
|
139
141
|
show: false,
|
|
@@ -150,6 +152,11 @@ var EditGroup = function EditGroup(_ref) {
|
|
|
150
152
|
(0, _react.useEffect)(function () {
|
|
151
153
|
loadData();
|
|
152
154
|
}, []);
|
|
155
|
+
(0, _react.useEffect)(function () {
|
|
156
|
+
if (shouldClose) {
|
|
157
|
+
onClose && onClose();
|
|
158
|
+
}
|
|
159
|
+
}, [shouldClose, onClose]);
|
|
153
160
|
|
|
154
161
|
var loadData = /*#__PURE__*/function () {
|
|
155
162
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
|
|
@@ -162,7 +169,7 @@ var EditGroup = function EditGroup(_ref) {
|
|
|
162
169
|
_context.next = 3;
|
|
163
170
|
return _axios.default.post("".concat(process.env.REACT_APP_GROUPS_ENDPOINT, "/get"), {}, {
|
|
164
171
|
headers: {
|
|
165
|
-
Authorization:
|
|
172
|
+
Authorization: token
|
|
166
173
|
}
|
|
167
174
|
});
|
|
168
175
|
|
|
@@ -449,110 +456,113 @@ var EditGroup = function EditGroup(_ref) {
|
|
|
449
456
|
}
|
|
450
457
|
};
|
|
451
458
|
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
src: _close.default,
|
|
478
|
-
alt: "close icon"
|
|
479
|
-
})
|
|
480
|
-
})]
|
|
481
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
482
|
-
className: "details-edit",
|
|
483
|
-
children: "Agrega, edita y borra. Luego guarda los cambios."
|
|
484
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
485
|
-
className: "".concat(isMoreThanTenGroups ? "table-groups-max" : "table-groups-edit"),
|
|
486
|
-
children: groups.map(function (group, index) {
|
|
487
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.GroupRow, {
|
|
488
|
-
editing: editingIndex === index,
|
|
489
|
-
deleting: deletingIndex === index,
|
|
490
|
-
onMouseEnter: function onMouseEnter() {
|
|
491
|
-
return setHoveredIndex(index);
|
|
492
|
-
},
|
|
493
|
-
onMouseLeave: function onMouseLeave() {
|
|
494
|
-
return setHoveredIndex(null);
|
|
495
|
-
},
|
|
496
|
-
className: "group-row ".concat(isEditingList[index] ? "editing" : ""),
|
|
497
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
498
|
-
className: "input-group",
|
|
499
|
-
placeholder: "Escribe el nombre del grupo",
|
|
500
|
-
value: index !== undefined ? group.groupName : inputValue,
|
|
501
|
-
onChange: function onChange(e) {
|
|
502
|
-
return handleInputChange(e.target.value, index);
|
|
503
|
-
},
|
|
504
|
-
disabled: !isEditingList[index],
|
|
505
|
-
autoFocus: isEditingList[index] && editingIndex === index
|
|
506
|
-
}, index), currentEditIndex === index ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
507
|
-
className: "circular-button save-button visible",
|
|
508
|
-
onClick: function onClick() {
|
|
509
|
-
return handleSaveChanges(index);
|
|
510
|
-
},
|
|
459
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Backdrop, {
|
|
460
|
+
open: show,
|
|
461
|
+
className: "container-backgroundModal",
|
|
462
|
+
timeout: 400,
|
|
463
|
+
style: {
|
|
464
|
+
backgroundColor: "transparent",
|
|
465
|
+
zIndex: 10
|
|
466
|
+
},
|
|
467
|
+
onClick: onClose,
|
|
468
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, {
|
|
469
|
+
in: show,
|
|
470
|
+
timeout: 400,
|
|
471
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
|
|
472
|
+
ref: modalRef,
|
|
473
|
+
open: show,
|
|
474
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
475
|
+
className: "contentModal",
|
|
476
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
477
|
+
className: "header",
|
|
478
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
|
|
479
|
+
className: "title-edit",
|
|
480
|
+
children: "Editar grupos"
|
|
481
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
482
|
+
className: "circular-button close-button",
|
|
483
|
+
onClick: onClose,
|
|
511
484
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
512
|
-
src:
|
|
513
|
-
alt: "
|
|
485
|
+
src: _close.default,
|
|
486
|
+
alt: "close icon"
|
|
514
487
|
})
|
|
515
|
-
})
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
488
|
+
})]
|
|
489
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
|
|
490
|
+
className: "details-edit",
|
|
491
|
+
children: "Agrega, edita y borra. Luego guarda los cambios."
|
|
492
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
493
|
+
className: "".concat(isMoreThanTenGroups ? "table-groups-max" : "table-groups-edit"),
|
|
494
|
+
children: groups.map(function (group, index) {
|
|
495
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.GroupRow, {
|
|
496
|
+
editing: editingIndex === index,
|
|
497
|
+
deleting: deletingIndex === index,
|
|
498
|
+
onMouseEnter: function onMouseEnter() {
|
|
499
|
+
return setHoveredIndex(index);
|
|
520
500
|
},
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
alt: "edit icon"
|
|
524
|
-
})
|
|
525
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
526
|
-
className: "circular-button delete-button ".concat(hoveredIndex === index ? "visible" : ""),
|
|
527
|
-
onClick: function onClick() {
|
|
528
|
-
return handleDeleteButtonClick(group.groupId);
|
|
501
|
+
onMouseLeave: function onMouseLeave() {
|
|
502
|
+
return setHoveredIndex(null);
|
|
529
503
|
},
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
504
|
+
className: "group-row ".concat(isEditingList[index] ? "editing" : ""),
|
|
505
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
506
|
+
className: "input-group",
|
|
507
|
+
placeholder: "Escribe el nombre del grupo",
|
|
508
|
+
value: index !== undefined ? group.groupName : inputValue,
|
|
509
|
+
onChange: function onChange(e) {
|
|
510
|
+
return handleInputChange(e.target.value, index);
|
|
511
|
+
},
|
|
512
|
+
disabled: !isEditingList[index],
|
|
513
|
+
autoFocus: isEditingList[index] && editingIndex === index
|
|
514
|
+
}, index), currentEditIndex === index ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
515
|
+
className: "circular-button save-button visible",
|
|
516
|
+
onClick: function onClick() {
|
|
517
|
+
return handleSaveChanges(index);
|
|
518
|
+
},
|
|
519
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
520
|
+
src: _save.default,
|
|
521
|
+
alt: "save update icon"
|
|
522
|
+
})
|
|
523
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
524
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
525
|
+
className: "circular-button edit-button ".concat(hoveredIndex === index ? "visible" : ""),
|
|
526
|
+
onClick: function onClick() {
|
|
527
|
+
return handleEditButtonClick(index);
|
|
528
|
+
},
|
|
529
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
530
|
+
src: _edit.default,
|
|
531
|
+
alt: "edit icon"
|
|
532
|
+
})
|
|
533
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
534
|
+
className: "circular-button delete-button ".concat(hoveredIndex === index ? "visible" : ""),
|
|
535
|
+
onClick: function onClick() {
|
|
536
|
+
return handleDeleteButtonClick(group.groupId);
|
|
537
|
+
},
|
|
538
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
539
|
+
src: _trash.default,
|
|
540
|
+
alt: "trash icon"
|
|
541
|
+
})
|
|
542
|
+
})]
|
|
543
|
+
})]
|
|
544
|
+
}, group.groupId);
|
|
545
|
+
})
|
|
546
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
547
|
+
className: "container-save-add",
|
|
548
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
549
|
+
className: "button-add",
|
|
550
|
+
onClick: function onClick() {
|
|
551
|
+
return handleAddButtonClick();
|
|
552
|
+
},
|
|
553
|
+
children: "+ Agregar Grupo"
|
|
554
|
+
})
|
|
555
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_Modal.Modal, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, modalData), {}, {
|
|
556
|
+
onClickBtnDefault: function onClickBtnDefault() {
|
|
557
|
+
return setModalData(function (prev) {
|
|
558
|
+
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, prev), {}, {
|
|
559
|
+
show: false
|
|
560
|
+
});
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
}))]
|
|
546
564
|
})
|
|
547
|
-
})
|
|
548
|
-
onClickBtnDefault: function onClickBtnDefault() {
|
|
549
|
-
return setModalData(function (prev) {
|
|
550
|
-
return (0, _objectSpread2.default)((0, _objectSpread2.default)({}, prev), {}, {
|
|
551
|
-
show: false
|
|
552
|
-
});
|
|
553
|
-
});
|
|
554
|
-
}
|
|
555
|
-
}))]
|
|
565
|
+
})
|
|
556
566
|
})
|
|
557
567
|
});
|
|
558
568
|
};
|
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import edit from "../../../assets/images/Icons/edit.svg";
|
|
|
8
8
|
import close from "../../../assets/images/Icons/close.svg";
|
|
9
9
|
import save from "../../../assets/images/Icons/save.svg";
|
|
10
10
|
import { Modal } from "../../organisms/Modal";
|
|
11
|
+
import { Fade, Grow, Zoom, Backdrop } from "@mui/material";
|
|
11
12
|
import axios from "axios";
|
|
12
13
|
|
|
13
14
|
const reducerGroups = (state, action) => {
|
|
@@ -32,18 +33,18 @@ const reducerGroups = (state, action) => {
|
|
|
32
33
|
}
|
|
33
34
|
};
|
|
34
35
|
|
|
35
|
-
export const EditGroup = ({ token }) => {
|
|
36
|
+
export const EditGroup = ({ token, show, onClose }) => {
|
|
36
37
|
const [groups, setGroups] = useState([]);
|
|
37
38
|
const [state, dispatch] = useReducer(reducerGroups, {});
|
|
38
39
|
const [isMoreThanTenGroups, setIsMoreThanTenGroups] = useState(false);
|
|
39
40
|
const [editingIndex, setEditingIndex] = useState(null);
|
|
40
41
|
const [deletingIndex, setDeletingIndex] = useState(null);
|
|
41
|
-
const [deletedRows, setDeletedRows] = useState([]);
|
|
42
42
|
const [hoveredIndex, setHoveredIndex] = useState(null);
|
|
43
43
|
const [isEditingList, setIsEditingList] = useState([]);
|
|
44
44
|
const [newGroup, setNewGroup] = useState(false);
|
|
45
45
|
const [currentEditIndex, setCurrentEditIndex] = useState(null);
|
|
46
46
|
const [inputValue, setInputValue] = useState([]);
|
|
47
|
+
const [shouldClose, setShouldClose] = useState(false);
|
|
47
48
|
const [modalData, setModalData] = useState({
|
|
48
49
|
show: false,
|
|
49
50
|
title: "Actualización completa",
|
|
@@ -53,13 +54,18 @@ export const EditGroup = ({ token }) => {
|
|
|
53
54
|
|
|
54
55
|
const modalRef = useRef();
|
|
55
56
|
|
|
56
|
-
useEffect(() => {
|
|
57
|
-
}, [groups]);
|
|
57
|
+
useEffect(() => {}, [groups]);
|
|
58
58
|
|
|
59
59
|
useEffect(() => {
|
|
60
60
|
loadData();
|
|
61
61
|
}, []);
|
|
62
62
|
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (shouldClose) {
|
|
65
|
+
onClose && onClose();
|
|
66
|
+
}
|
|
67
|
+
}, [shouldClose, onClose]);
|
|
68
|
+
|
|
63
69
|
const loadData = async () => {
|
|
64
70
|
try {
|
|
65
71
|
const response = await axios.post(
|
|
@@ -67,7 +73,7 @@ export const EditGroup = ({ token }) => {
|
|
|
67
73
|
{},
|
|
68
74
|
{
|
|
69
75
|
headers: {
|
|
70
|
-
Authorization:
|
|
76
|
+
Authorization: token,
|
|
71
77
|
},
|
|
72
78
|
}
|
|
73
79
|
);
|
|
@@ -123,7 +129,7 @@ export const EditGroup = ({ token }) => {
|
|
|
123
129
|
try {
|
|
124
130
|
const response = await axios.post(
|
|
125
131
|
`${process.env.REACT_APP_GROUPS_ENDPOINT}/update?id=${groupId}&groupName=${updatedGroupName}`,
|
|
126
|
-
|
|
132
|
+
{},
|
|
127
133
|
{
|
|
128
134
|
headers: {
|
|
129
135
|
Authorization: token,
|
|
@@ -231,101 +237,108 @@ export const EditGroup = ({ token }) => {
|
|
|
231
237
|
if (newGroup !== undefined) {
|
|
232
238
|
handleUpdateGroup(index, newGroup, concatenatedValue);
|
|
233
239
|
} else {
|
|
234
|
-
AddGroup(index,concatenatedValue);
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
const handleCloseModal = (e) => {
|
|
239
|
-
if (modalRef.current && !modalRef.current.contains(e.target)) {
|
|
240
|
-
setEditingIndex(null);
|
|
240
|
+
AddGroup(index, concatenatedValue);
|
|
241
241
|
}
|
|
242
242
|
};
|
|
243
243
|
|
|
244
|
-
useEffect(() => {
|
|
245
|
-
document.addEventListener("mousedown", handleCloseModal);
|
|
246
|
-
|
|
247
|
-
return () => {
|
|
248
|
-
document.removeEventListener("mousedown", handleCloseModal);
|
|
249
|
-
};
|
|
250
|
-
}, []);
|
|
251
|
-
|
|
252
244
|
return (
|
|
253
|
-
<
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
<
|
|
265
|
-
className={
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
245
|
+
<Backdrop
|
|
246
|
+
open={show}
|
|
247
|
+
className="container-backgroundModal"
|
|
248
|
+
timeout={400}
|
|
249
|
+
style={{
|
|
250
|
+
backgroundColor: "transparent",
|
|
251
|
+
zIndex: 10,
|
|
252
|
+
}}
|
|
253
|
+
onClick={onClose}
|
|
254
|
+
>
|
|
255
|
+
<Fade in={show} timeout={400}>
|
|
256
|
+
<Container ref={modalRef} open={show}>
|
|
257
|
+
<div className={`contentModal`}>
|
|
258
|
+
<div className="header">
|
|
259
|
+
<h2 className="title-edit">Editar grupos</h2>
|
|
260
|
+
<Button
|
|
261
|
+
className={`circular-button close-button`}
|
|
262
|
+
onClick={onClose}
|
|
263
|
+
>
|
|
264
|
+
<img src={close} alt="close icon" />
|
|
265
|
+
</Button>
|
|
266
|
+
</div>
|
|
267
|
+
<p className="details-edit">
|
|
268
|
+
Agrega, edita y borra. Luego guarda los cambios.
|
|
269
|
+
</p>
|
|
270
|
+
<div
|
|
271
|
+
className={`${
|
|
272
|
+
isMoreThanTenGroups ? "table-groups-max" : "table-groups-edit"
|
|
273
|
+
}`}
|
|
277
274
|
>
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
<Button
|
|
289
|
-
className={`circular-button save-button visible`}
|
|
290
|
-
onClick={() => handleSaveChanges(index)}
|
|
275
|
+
{groups.map((group, index) => (
|
|
276
|
+
<GroupRow
|
|
277
|
+
key={group.groupId}
|
|
278
|
+
editing={editingIndex === index}
|
|
279
|
+
deleting={deletingIndex === index}
|
|
280
|
+
onMouseEnter={() => setHoveredIndex(index)}
|
|
281
|
+
onMouseLeave={() => setHoveredIndex(null)}
|
|
282
|
+
className={`group-row ${
|
|
283
|
+
isEditingList[index] ? "editing" : ""
|
|
284
|
+
}`}
|
|
291
285
|
>
|
|
292
|
-
<
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
<
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
286
|
+
<input
|
|
287
|
+
key={index}
|
|
288
|
+
className={`input-group`}
|
|
289
|
+
placeholder="Escribe el nombre del grupo"
|
|
290
|
+
value={index !== undefined ? group.groupName : inputValue}
|
|
291
|
+
onChange={(e) => handleInputChange(e.target.value, index)}
|
|
292
|
+
disabled={!isEditingList[index]}
|
|
293
|
+
autoFocus={isEditingList[index] && editingIndex === index}
|
|
294
|
+
/>
|
|
295
|
+
{currentEditIndex === index ? (
|
|
296
|
+
<Button
|
|
297
|
+
className={`circular-button save-button visible`}
|
|
298
|
+
onClick={() => handleSaveChanges(index)}
|
|
299
|
+
>
|
|
300
|
+
<img src={save} alt="save update icon" />
|
|
301
|
+
</Button>
|
|
302
|
+
) : (
|
|
303
|
+
<>
|
|
304
|
+
<Button
|
|
305
|
+
className={`circular-button edit-button ${
|
|
306
|
+
hoveredIndex === index ? "visible" : ""
|
|
307
|
+
}`}
|
|
308
|
+
onClick={() => handleEditButtonClick(index)}
|
|
309
|
+
>
|
|
310
|
+
<img src={edit} alt="edit icon" />
|
|
311
|
+
</Button>
|
|
312
|
+
<Button
|
|
313
|
+
className={`circular-button delete-button ${
|
|
314
|
+
hoveredIndex === index ? "visible" : ""
|
|
315
|
+
}`}
|
|
316
|
+
onClick={() => handleDeleteButtonClick(group.groupId)}
|
|
317
|
+
>
|
|
318
|
+
<img src={trash} alt="trash icon" />
|
|
319
|
+
</Button>
|
|
320
|
+
</>
|
|
321
|
+
)}
|
|
322
|
+
</GroupRow>
|
|
323
|
+
))}
|
|
324
|
+
</div>
|
|
325
|
+
<div className="container-save-add">
|
|
326
|
+
<Button
|
|
327
|
+
className="button-add"
|
|
328
|
+
onClick={() => handleAddButtonClick()}
|
|
329
|
+
>
|
|
330
|
+
+ Agregar Grupo
|
|
331
|
+
</Button>
|
|
332
|
+
</div>
|
|
333
|
+
<Modal
|
|
334
|
+
{...modalData}
|
|
335
|
+
onClickBtnDefault={() =>
|
|
336
|
+
setModalData((prev) => ({ ...prev, show: false }))
|
|
337
|
+
}
|
|
338
|
+
/>
|
|
339
|
+
</div>
|
|
340
|
+
</Container>
|
|
341
|
+
</Fade>
|
|
342
|
+
</Backdrop>
|
|
330
343
|
);
|
|
331
344
|
};
|