contentoh-components-library 21.4.100 → 21.4.101
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.
|
@@ -58,7 +58,11 @@ var Phase = function Phase(_ref) {
|
|
|
58
58
|
nextPhase = _ref.nextPhase,
|
|
59
59
|
groups = _ref.groups,
|
|
60
60
|
onDeletePhase = _ref.onDeletePhase,
|
|
61
|
-
token = _ref.token
|
|
61
|
+
token = _ref.token,
|
|
62
|
+
_ref$showMenu = _ref.showMenu,
|
|
63
|
+
showMenu = _ref$showMenu === void 0 ? true : _ref$showMenu,
|
|
64
|
+
_ref$showButtonChip = _ref.showButtonChip,
|
|
65
|
+
showButtonChip = _ref$showButtonChip === void 0 ? true : _ref$showButtonChip;
|
|
62
66
|
|
|
63
67
|
var _useState = (0, _react.useState)([]),
|
|
64
68
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -501,43 +505,45 @@ var Phase = function Phase(_ref) {
|
|
|
501
505
|
children: phase.phaseName
|
|
502
506
|
}, phase.phaseId);
|
|
503
507
|
})
|
|
504
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
sx: {
|
|
525
|
-
ul: {
|
|
526
|
-
paddingTop: "0px",
|
|
527
|
-
paddingBottom: "0px"
|
|
528
|
-
}
|
|
529
|
-
},
|
|
530
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
531
|
-
onClick: function onClick() {
|
|
532
|
-
return onDeletePhase(id);
|
|
508
|
+
}), showMenu && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
509
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
|
|
510
|
+
id: "basic-button",
|
|
511
|
+
"aria-controls": open ? "basic-menu" : undefined,
|
|
512
|
+
"aria-haspopup": "true",
|
|
513
|
+
"aria-expanded": open ? "true" : undefined,
|
|
514
|
+
onClick: function onClick(e) {
|
|
515
|
+
return handleClick(e);
|
|
516
|
+
},
|
|
517
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
518
|
+
src: _options.default,
|
|
519
|
+
alt: ""
|
|
520
|
+
})
|
|
521
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Menu, {
|
|
522
|
+
id: "basic-menu",
|
|
523
|
+
anchorEl: anchorEl,
|
|
524
|
+
open: open,
|
|
525
|
+
onClose: handleClose,
|
|
526
|
+
MenuListProps: {
|
|
527
|
+
"aria-labelledby": "basic-button"
|
|
533
528
|
},
|
|
534
529
|
sx: {
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
530
|
+
ul: {
|
|
531
|
+
paddingTop: "0px",
|
|
532
|
+
paddingBottom: "0px"
|
|
533
|
+
}
|
|
538
534
|
},
|
|
539
|
-
children:
|
|
540
|
-
|
|
535
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.MenuItem, {
|
|
536
|
+
onClick: function onClick() {
|
|
537
|
+
return onDeletePhase(id);
|
|
538
|
+
},
|
|
539
|
+
sx: {
|
|
540
|
+
fontSize: "12px",
|
|
541
|
+
color: "#262626",
|
|
542
|
+
minHeight: "auto"
|
|
543
|
+
},
|
|
544
|
+
children: "Eliminar Fase"
|
|
545
|
+
})
|
|
546
|
+
})]
|
|
541
547
|
})]
|
|
542
548
|
})
|
|
543
549
|
})]
|
|
@@ -550,7 +556,7 @@ var Phase = function Phase(_ref) {
|
|
|
550
556
|
return handleChipDelete(phaseId, chip);
|
|
551
557
|
}
|
|
552
558
|
}, chip.id);
|
|
553
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GroupSelect.GroupSelect, {
|
|
559
|
+
}), showButtonChip && /*#__PURE__*/(0, _jsxRuntime.jsx)(_GroupSelect.GroupSelect, {
|
|
554
560
|
options: groups.filter(function (group) {
|
|
555
561
|
return group.groupActive === 0;
|
|
556
562
|
}).map(function (group) {
|
|
@@ -176,41 +176,39 @@ var DragAndDropPhases = function DragAndDropPhases(_ref) {
|
|
|
176
176
|
while (1) {
|
|
177
177
|
switch (_context2.prev = _context2.next) {
|
|
178
178
|
case 0:
|
|
179
|
-
|
|
180
|
-
_context2.prev = 1;
|
|
179
|
+
_context2.prev = 0;
|
|
181
180
|
body = {
|
|
182
181
|
name: phaseName,
|
|
183
182
|
retailerGroupsIds: [],
|
|
184
183
|
nextPhaseId: null
|
|
185
184
|
};
|
|
186
|
-
_context2.next =
|
|
185
|
+
_context2.next = 4;
|
|
187
186
|
return _axios.default.post("".concat(process.env.REACT_APP_PHASES_ENDPOINT, "/create"), body, {
|
|
188
187
|
headers: {
|
|
189
188
|
Authorization: token
|
|
190
189
|
}
|
|
191
190
|
});
|
|
192
191
|
|
|
193
|
-
case
|
|
192
|
+
case 4:
|
|
194
193
|
response = _context2.sent;
|
|
195
|
-
console.log("body", body);
|
|
196
194
|
createdPhase = response.data.body;
|
|
197
195
|
console.log(createdPhase);
|
|
198
196
|
setInputValue("");
|
|
199
197
|
loadData();
|
|
200
|
-
_context2.next =
|
|
198
|
+
_context2.next = 14;
|
|
201
199
|
break;
|
|
202
200
|
|
|
203
|
-
case
|
|
204
|
-
_context2.prev =
|
|
205
|
-
_context2.t0 = _context2["catch"](
|
|
201
|
+
case 11:
|
|
202
|
+
_context2.prev = 11;
|
|
203
|
+
_context2.t0 = _context2["catch"](0);
|
|
206
204
|
console.error("Error al agregar fase:", _context2.t0);
|
|
207
205
|
|
|
208
|
-
case
|
|
206
|
+
case 14:
|
|
209
207
|
case "end":
|
|
210
208
|
return _context2.stop();
|
|
211
209
|
}
|
|
212
210
|
}
|
|
213
|
-
}, _callee2, null, [[
|
|
211
|
+
}, _callee2, null, [[0, 11]]);
|
|
214
212
|
}));
|
|
215
213
|
|
|
216
214
|
return function addPhase(_x) {
|
|
@@ -412,21 +410,38 @@ var DragAndDropPhases = function DragAndDropPhases(_ref) {
|
|
|
412
410
|
|
|
413
411
|
|
|
414
412
|
var renderPhase = function renderPhase(phase, idx) {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
413
|
+
if (phase.isInitialPhase === 1) {
|
|
414
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Phase.Phase, {
|
|
415
|
+
id: idx,
|
|
416
|
+
phaseId: phase.phaseId,
|
|
417
|
+
phases: listPhases,
|
|
418
|
+
phaseName: phase.phaseName,
|
|
419
|
+
nextPhase: phase.nextPhaseIfApproved,
|
|
420
|
+
groups: phase.groupsAssigned,
|
|
421
|
+
onDeletePhase: function onDeletePhase() {
|
|
422
|
+
return handleDeletePhase(phase.phaseId);
|
|
423
|
+
},
|
|
424
|
+
token: token,
|
|
425
|
+
showMenu: false,
|
|
426
|
+
showButtonChip: false
|
|
427
|
+
}, phase.phaseId);
|
|
428
|
+
} else {
|
|
429
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Phase.Phase, {
|
|
430
|
+
id: idx,
|
|
431
|
+
phaseId: phase.phaseId,
|
|
432
|
+
phases: listPhases,
|
|
433
|
+
phaseName: phase.phaseName,
|
|
434
|
+
nextPhase: phase.nextPhaseIfApproved,
|
|
435
|
+
groups: phase.groupsAssigned,
|
|
436
|
+
onDeletePhase: function onDeletePhase() {
|
|
437
|
+
return handleDeletePhase(phase.phaseId);
|
|
438
|
+
} // onDragStart={(e) => onDragStart(e, idx)}
|
|
439
|
+
// onDragOver={() => onDragOver(idx)}
|
|
440
|
+
// onDragEnd={onDragEnd}
|
|
441
|
+
,
|
|
442
|
+
token: token
|
|
443
|
+
}, phase.phaseId);
|
|
444
|
+
}
|
|
430
445
|
};
|
|
431
446
|
|
|
432
447
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
package/package.json
CHANGED
|
@@ -26,6 +26,8 @@ export const Phase = ({
|
|
|
26
26
|
groups,
|
|
27
27
|
onDeletePhase,
|
|
28
28
|
token,
|
|
29
|
+
showMenu=true,
|
|
30
|
+
showButtonChip=true,
|
|
29
31
|
}) => {
|
|
30
32
|
const [selectedValue, setSelectedValue] = useState([]);
|
|
31
33
|
const [chips, setChips] = useState([]);
|
|
@@ -276,20 +278,20 @@ export const Phase = ({
|
|
|
276
278
|
<div className="phase-sel">
|
|
277
279
|
<p className="text-phase">Siguiente Fase </p>
|
|
278
280
|
<Select
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
281
|
+
value={
|
|
282
|
+
selectedValue.length > 0
|
|
283
|
+
? selectedValue[0]
|
|
284
|
+
: nextPhaseState
|
|
285
|
+
? nextPhaseState
|
|
286
|
+
: ""
|
|
287
|
+
}
|
|
288
|
+
placeholder={`Fase`}
|
|
289
|
+
onChange={(e) => {
|
|
290
|
+
const selectedPhase = phases.find(
|
|
291
|
+
(phase) => phase.phaseName === e.target.value
|
|
292
|
+
);
|
|
293
|
+
setSelectedValue(selectedPhase ? [selectedPhase.phaseId] : []);
|
|
294
|
+
}}
|
|
293
295
|
sx={{
|
|
294
296
|
minWidth: "100px",
|
|
295
297
|
height: "24px",
|
|
@@ -319,37 +321,45 @@ export const Phase = ({
|
|
|
319
321
|
</MenuItem>
|
|
320
322
|
))}
|
|
321
323
|
</Select>
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
324
|
+
{showMenu && (
|
|
325
|
+
<>
|
|
326
|
+
<Button
|
|
327
|
+
id="basic-button"
|
|
328
|
+
aria-controls={open ? "basic-menu" : undefined}
|
|
329
|
+
aria-haspopup="true"
|
|
330
|
+
aria-expanded={open ? "true" : undefined}
|
|
331
|
+
onClick={(e) => handleClick(e)}
|
|
332
|
+
>
|
|
333
|
+
<img src={options} alt="" />
|
|
334
|
+
</Button>
|
|
335
|
+
<Menu
|
|
336
|
+
id="basic-menu"
|
|
337
|
+
anchorEl={anchorEl}
|
|
338
|
+
open={open}
|
|
339
|
+
onClose={handleClose}
|
|
340
|
+
MenuListProps={{
|
|
341
|
+
"aria-labelledby": "basic-button",
|
|
342
|
+
}}
|
|
343
|
+
sx={{
|
|
344
|
+
ul: {
|
|
345
|
+
paddingTop: "0px",
|
|
346
|
+
paddingBottom: "0px",
|
|
347
|
+
},
|
|
348
|
+
}}
|
|
349
|
+
>
|
|
350
|
+
<MenuItem
|
|
351
|
+
onClick={() => onDeletePhase(id)}
|
|
352
|
+
sx={{
|
|
353
|
+
fontSize: "12px",
|
|
354
|
+
color: "#262626",
|
|
355
|
+
minHeight: "auto",
|
|
356
|
+
}}
|
|
357
|
+
>
|
|
358
|
+
Eliminar Fase
|
|
359
|
+
</MenuItem>
|
|
360
|
+
</Menu>
|
|
361
|
+
</>
|
|
362
|
+
)}
|
|
353
363
|
</div>
|
|
354
364
|
</div>
|
|
355
365
|
</div>
|
|
@@ -361,8 +371,8 @@ export const Phase = ({
|
|
|
361
371
|
onDelete={() => handleChipDelete(phaseId, chip)}
|
|
362
372
|
/>
|
|
363
373
|
))}
|
|
364
|
-
|
|
365
|
-
|
|
374
|
+
|
|
375
|
+
{showButtonChip && <GroupSelect
|
|
366
376
|
options={groups
|
|
367
377
|
.filter((group) => group.groupActive === 0)
|
|
368
378
|
.map((group) => ({
|
|
@@ -377,9 +387,10 @@ export const Phase = ({
|
|
|
377
387
|
defaultOption={"Todos los grupos"}
|
|
378
388
|
parameterArray={groupsSelected}
|
|
379
389
|
setParameterArray={setGroupsSelected}
|
|
380
|
-
onClickItem={()=>{
|
|
381
|
-
handleGroupSelect()
|
|
382
|
-
|
|
390
|
+
onClickItem={() => {
|
|
391
|
+
handleGroupSelect();
|
|
392
|
+
}}
|
|
393
|
+
/>}
|
|
383
394
|
</div>
|
|
384
395
|
<Modal
|
|
385
396
|
{...modalData}
|
|
@@ -93,7 +93,6 @@ export const DragAndDropPhases = ({ token}) => {
|
|
|
93
93
|
};
|
|
94
94
|
|
|
95
95
|
const addPhase = async(phaseName) => {
|
|
96
|
-
console.log("fase nueva", phaseName);
|
|
97
96
|
try {
|
|
98
97
|
const body = {
|
|
99
98
|
name: phaseName,
|
|
@@ -109,7 +108,6 @@ export const DragAndDropPhases = ({ token}) => {
|
|
|
109
108
|
},
|
|
110
109
|
}
|
|
111
110
|
);
|
|
112
|
-
console.log("body", body)
|
|
113
111
|
const createdPhase = response.data.body;
|
|
114
112
|
console.log(createdPhase)
|
|
115
113
|
setInputValue("");
|
|
@@ -258,22 +256,41 @@ const handleDeletePhase = (id) => {
|
|
|
258
256
|
// }, [listPhases]);
|
|
259
257
|
|
|
260
258
|
const renderPhase = (phase, idx) => {
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
259
|
+
if (phase.isInitialPhase===1){
|
|
260
|
+
return (
|
|
261
|
+
<Phase
|
|
262
|
+
key={phase.phaseId}
|
|
263
|
+
id={idx}
|
|
264
|
+
phaseId={phase.phaseId}
|
|
265
|
+
phases={listPhases}
|
|
266
|
+
phaseName={phase.phaseName}
|
|
267
|
+
nextPhase={phase.nextPhaseIfApproved}
|
|
268
|
+
groups={phase.groupsAssigned}
|
|
269
|
+
onDeletePhase={() => handleDeletePhase(phase.phaseId)}
|
|
270
|
+
token={token}
|
|
271
|
+
showMenu={false}
|
|
272
|
+
showButtonChip={false}
|
|
273
|
+
/>
|
|
274
|
+
);
|
|
275
|
+
}else{
|
|
276
|
+
return (
|
|
277
|
+
<Phase
|
|
278
|
+
key={phase.phaseId}
|
|
279
|
+
id={idx}
|
|
280
|
+
phaseId={phase.phaseId}
|
|
281
|
+
phases={listPhases}
|
|
282
|
+
phaseName={phase.phaseName}
|
|
283
|
+
nextPhase={phase.nextPhaseIfApproved}
|
|
284
|
+
groups={phase.groupsAssigned}
|
|
285
|
+
onDeletePhase={() => handleDeletePhase(phase.phaseId)}
|
|
286
|
+
// onDragStart={(e) => onDragStart(e, idx)}
|
|
287
|
+
// onDragOver={() => onDragOver(idx)}
|
|
288
|
+
// onDragEnd={onDragEnd}
|
|
289
|
+
token={token}
|
|
290
|
+
/>
|
|
291
|
+
);
|
|
292
|
+
}
|
|
293
|
+
|
|
277
294
|
};
|
|
278
295
|
|
|
279
296
|
|