contentoh-components-library 21.6.59 → 21.6.61

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.
Files changed (78) hide show
  1. package/dist/components/organisms/ServicesNavigation/ServiceToolbar.js +210 -0
  2. package/dist/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +138 -0
  3. package/dist/components/organisms/ServicesNavigation/ServicesRail.js +705 -0
  4. package/dist/components/organisms/ServicesNavigation/catalog.js +505 -0
  5. package/dist/components/organisms/ServicesNavigation/index.js +337 -0
  6. package/dist/components/organisms/ServicesNavigation/model.js +167 -0
  7. package/dist/components/organisms/ServicesNavigation/ui.js +371 -0
  8. package/dist/components/organisms/ServicesNavigation/views.js +1237 -0
  9. package/dist/components/organisms/ServicesWorkspace/AssigneePicker.js +459 -0
  10. package/dist/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +119 -0
  11. package/dist/components/organisms/ServicesWorkspace/demo.js +137 -0
  12. package/dist/components/organisms/ServicesWorkspace/index.js +813 -0
  13. package/dist/components/organisms/ServicesWorkspace/servicesModel.js +351 -0
  14. package/dist/components/organisms/ServicesWorkspace/tooltipStyles.js +37 -0
  15. package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +40 -0
  16. package/dist/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +387 -0
  17. package/dist/components/pages/CreatorsProductEdition/sections/StatusChip.js +13 -4
  18. package/dist/components/pages/ProductEdition/ProductEdition.stories.js +148 -0
  19. package/dist/components/pages/ProductEdition/ProductEditionView.js +1355 -0
  20. package/dist/components/pages/ProductEdition/ServiceHeader.js +142 -0
  21. package/dist/components/pages/ProductEdition/api.js +256 -0
  22. package/dist/components/pages/ProductEdition/index.js +37 -0
  23. package/dist/components/pages/ProductEdition/permissions.js +200 -0
  24. package/dist/components/pages/ProductEdition/permissions.test.js +320 -0
  25. package/dist/components/pages/ProductEdition/sections/CatalogServicePanel.js +237 -0
  26. package/dist/components/pages/ProductEdition/sections/EditionTopBar.js +174 -0
  27. package/dist/components/pages/ProductEdition/sections/ImagePanel.js +440 -0
  28. package/dist/components/pages/ProductEdition/sections/ServiceTeam.js +275 -0
  29. package/dist/components/pages/ProductEdition/sections/ServiceTools.js +186 -0
  30. package/dist/components/pages/ProductEdition/services.js +233 -0
  31. package/dist/components/pages/ProductEdition/services.test.js +195 -0
  32. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +15 -2
  33. package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +2 -2
  34. package/dist/components/pages/RetailerProductEdition/index.js +57 -40
  35. package/dist/components/pages/RetailerProductEdition/utils.js +6 -2
  36. package/dist/index.js +13 -0
  37. package/package.json +1 -1
  38. package/src/components/organisms/ServicesNavigation/ServiceToolbar.jsx +143 -0
  39. package/src/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +101 -0
  40. package/src/components/organisms/ServicesNavigation/ServicesRail.jsx +591 -0
  41. package/src/components/organisms/ServicesNavigation/catalog.js +180 -0
  42. package/src/components/organisms/ServicesNavigation/index.jsx +232 -0
  43. package/src/components/organisms/ServicesNavigation/model.js +85 -0
  44. package/src/components/organisms/ServicesNavigation/ui.jsx +229 -0
  45. package/src/components/organisms/ServicesNavigation/views.jsx +705 -0
  46. package/src/components/organisms/ServicesWorkspace/AssigneePicker.js +348 -0
  47. package/src/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +61 -0
  48. package/src/components/organisms/ServicesWorkspace/demo.js +58 -0
  49. package/src/components/organisms/ServicesWorkspace/index.js +556 -0
  50. package/src/components/organisms/ServicesWorkspace/servicesModel.js +203 -0
  51. package/src/components/organisms/ServicesWorkspace/tooltipStyles.js +27 -0
  52. package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +17 -0
  53. package/src/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +175 -0
  54. package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +8 -4
  55. package/src/components/pages/ProductEdition/ProductEdition.stories.js +106 -0
  56. package/src/components/pages/ProductEdition/ProductEditionView.jsx +1142 -0
  57. package/src/components/pages/ProductEdition/ServiceHeader.jsx +104 -0
  58. package/src/components/pages/ProductEdition/api.js +84 -0
  59. package/src/components/pages/ProductEdition/index.js +21 -0
  60. package/src/components/pages/ProductEdition/permissions.js +128 -0
  61. package/src/components/pages/ProductEdition/permissions.test.js +249 -0
  62. package/src/components/pages/ProductEdition/sections/CatalogServicePanel.jsx +123 -0
  63. package/src/components/pages/ProductEdition/sections/EditionTopBar.jsx +134 -0
  64. package/src/components/pages/ProductEdition/sections/ImagePanel.jsx +342 -0
  65. package/src/components/pages/ProductEdition/sections/ServiceTeam.jsx +184 -0
  66. package/src/components/pages/ProductEdition/sections/ServiceTools.jsx +134 -0
  67. package/src/components/pages/ProductEdition/services.js +187 -0
  68. package/src/components/pages/ProductEdition/services.test.js +88 -0
  69. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +12 -0
  70. package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +6 -2
  71. package/src/components/pages/RetailerProductEdition/index.js +28 -3
  72. package/src/components/pages/RetailerProductEdition/utils.js +5 -0
  73. package/src/index.js +1 -0
  74. package/.claude/settings.local.json +0 -7
  75. package/dist/ai/prompts/attribute.prompt.js +0 -28
  76. package/dist/ai/prompts/description.prompt.js +0 -33
  77. package/dist/ai/schemas/attribute.schema.js +0 -35
  78. package/dist/ai/schemas/description.schema.js +0 -27
@@ -0,0 +1,459 @@
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.canCurrentUserAssign = exports.READ_ONLY_ROLES = void 0;
9
+ exports.default = AssigneePicker;
10
+ exports.isFloatingLayerClick = exports.fullName = void 0;
11
+
12
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
13
+
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
15
+
16
+ var _react = require("react");
17
+
18
+ var _material = require("@mui/material");
19
+
20
+ var _LockOutlined = _interopRequireDefault(require("@mui/icons-material/LockOutlined"));
21
+
22
+ var _PersonAddAlt1Outlined = _interopRequireDefault(require("@mui/icons-material/PersonAddAlt1Outlined"));
23
+
24
+ var _Search = _interopRequireDefault(require("@mui/icons-material/Search"));
25
+
26
+ var _Check = _interopRequireDefault(require("@mui/icons-material/Check"));
27
+
28
+ var _data = require("../../../global-files/data");
29
+
30
+ var _tooltipStyles = require("./tooltipStyles");
31
+
32
+ var _jsxRuntime = require("react/jsx-runtime");
33
+
34
+ /** Roles que ven la asignación pero no pueden cambiarla (igual que AsignationControl). */
35
+ var READ_ONLY_ROLES = [2, 3, 7, 8];
36
+ exports.READ_ONLY_ROLES = READ_ONLY_ROLES;
37
+
38
+ var canCurrentUserAssign = function canCurrentUserAssign() {
39
+ try {
40
+ var user = JSON.parse(sessionStorage.getItem("user"));
41
+ return !READ_ONLY_ROLES.includes(user === null || user === void 0 ? void 0 : user.id_role);
42
+ } catch (error) {
43
+ return true;
44
+ }
45
+ };
46
+ /**
47
+ * ¿El clic fue dentro de una capa flotante de MUI (selector, tooltip, diálogo)?
48
+ * Esas capas se pintan fuera del panel lateral, así que los "clic afuera para
49
+ * cerrar" deben ignorarlas.
50
+ */
51
+
52
+
53
+ exports.canCurrentUserAssign = canCurrentUserAssign;
54
+
55
+ var isFloatingLayerClick = function isFloatingLayerClick(target) {
56
+ var _target$closest;
57
+
58
+ return Boolean(target === null || target === void 0 ? void 0 : (_target$closest = target.closest) === null || _target$closest === void 0 ? void 0 : _target$closest.call(target, ".MuiPopover-root, .MuiModal-root, .MuiTooltip-popper"));
59
+ };
60
+
61
+ exports.isFloatingLayerClick = isFloatingLayerClick;
62
+
63
+ var fullName = function fullName(user) {
64
+ return [user === null || user === void 0 ? void 0 : user.name, user === null || user === void 0 ? void 0 : user.last_name].filter(Boolean).join(" ");
65
+ };
66
+
67
+ exports.fullName = fullName;
68
+
69
+ var initials = function initials(user) {
70
+ return [user === null || user === void 0 ? void 0 : user.name, user === null || user === void 0 ? void 0 : user.last_name].filter(Boolean).map(function (part) {
71
+ return part.trim()[0];
72
+ }).join("").toUpperCase().slice(0, 2);
73
+ };
74
+ /** Foto del usuario; si no carga, sus iniciales (MUI muestra `children` cuando falla la imagen). */
75
+
76
+
77
+ function UserAvatar(_ref) {
78
+ var user = _ref.user,
79
+ _ref$size = _ref.size,
80
+ size = _ref$size === void 0 ? 28 : _ref$size;
81
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Avatar, {
82
+ src: user !== null && user !== void 0 && user.id_user ? (0, _data.getProfilePicture)(user.id_user, 40, 40) : undefined,
83
+ alt: fullName(user),
84
+ sx: {
85
+ width: size,
86
+ height: size,
87
+ fontSize: size * 0.4,
88
+ fontFamily: "Lato, sans-serif",
89
+ fontWeight: 700,
90
+ bgcolor: "#F0EEF2",
91
+ color: "#503D66"
92
+ },
93
+ children: initials(user)
94
+ });
95
+ }
96
+
97
+ var pillSx = {
98
+ display: "inline-flex",
99
+ alignItems: "center",
100
+ gap: 0.75,
101
+ height: 34,
102
+ pl: 1.25,
103
+ pr: 0.5,
104
+ borderRadius: "17px",
105
+ backgroundColor: "#F0F0F0",
106
+ border: "1px solid transparent",
107
+ fontFamily: "Lato, sans-serif",
108
+ transition: "background-color 120ms, border-color 120ms"
109
+ };
110
+ var statusSx = {
111
+ fontFamily: "Lato, sans-serif",
112
+ fontSize: 12,
113
+ fontWeight: 600,
114
+ color: "#707070",
115
+ whiteSpace: "nowrap"
116
+ };
117
+ /**
118
+ * Pastilla "estatus + responsable" y selector de personas.
119
+ *
120
+ * Copia de la de Creators (ServicesCell/AssigneePicker) para que la edición se
121
+ * vea y se comporte igual que la tabla. Colores fijos porque la librería no
122
+ * define las variables CSS de las aplicaciones.
123
+ *
124
+ * - Clic en la pastilla: abre un buscador con la lista de personas asignables.
125
+ * - `lockedReason`: si viene, la pastilla muestra un candado, no abre nada
126
+ * y explica el motivo en el tooltip.
127
+ * - `onAssign(user)`: se llama al elegir a alguien (el padre llama assignUser).
128
+ */
129
+
130
+ function AssigneePicker(_ref2) {
131
+ var statusLabel = _ref2.statusLabel,
132
+ statusTitle = _ref2.statusTitle,
133
+ _ref2$users = _ref2.users,
134
+ users = _ref2$users === void 0 ? [] : _ref2$users,
135
+ _ref2$currentId = _ref2.currentId,
136
+ currentId = _ref2$currentId === void 0 ? null : _ref2$currentId,
137
+ onAssign = _ref2.onAssign,
138
+ _ref2$lockedReason = _ref2.lockedReason,
139
+ lockedReason = _ref2$lockedReason === void 0 ? null : _ref2$lockedReason,
140
+ _ref2$roleLabel = _ref2.roleLabel,
141
+ roleLabel = _ref2$roleLabel === void 0 ? "Responsable" : _ref2$roleLabel,
142
+ _ref2$loading = _ref2.loading,
143
+ loading = _ref2$loading === void 0 ? false : _ref2$loading;
144
+ var pillRef = (0, _react.useRef)(null);
145
+
146
+ var _useState = (0, _react.useState)(false),
147
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
148
+ open = _useState2[0],
149
+ setOpen = _useState2[1];
150
+
151
+ var _useState3 = (0, _react.useState)(""),
152
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
153
+ query = _useState4[0],
154
+ setQuery = _useState4[1]; // Asignación optimista: se ve de inmediato aunque la tabla tarde en refrescarse.
155
+
156
+
157
+ var _useState5 = (0, _react.useState)(null),
158
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
159
+ pickedId = _useState6[0],
160
+ setPickedId = _useState6[1];
161
+
162
+ var selectedId = pickedId !== null && pickedId !== void 0 ? pickedId : currentId;
163
+ var current = (0, _react.useMemo)(function () {
164
+ return users.find(function (user) {
165
+ return user.id_user === selectedId;
166
+ }) || null;
167
+ }, [users, selectedId]); // `statusLabel` puede ser texto fijo o una función del asignado actual (para
168
+ // mostrar el nombre de la persona apenas se elige, sin esperar al padre).
169
+
170
+ var label = typeof statusLabel === "function" ? statusLabel(current) : statusLabel;
171
+ var filtered = (0, _react.useMemo)(function () {
172
+ var text = query.trim().toLowerCase();
173
+ if (!text) return users;
174
+ return users.filter(function (user) {
175
+ return fullName(user).toLowerCase().includes(text);
176
+ });
177
+ }, [users, query]); // Al elegir con Enter, el foco vuelve a la pastilla y el mismo Enter la
178
+ // volvía a abrir. Se ignoran los clics que llegan justo después de cerrar.
179
+
180
+ var closedAtRef = (0, _react.useRef)(0);
181
+
182
+ var close = function close() {
183
+ closedAtRef.current = Date.now();
184
+ setOpen(false);
185
+ setQuery("");
186
+ };
187
+
188
+ var pick = function pick(user) {
189
+ if (user.id_user !== selectedId) {
190
+ setPickedId(user.id_user);
191
+ onAssign === null || onAssign === void 0 ? void 0 : onAssign(user);
192
+ }
193
+
194
+ close();
195
+ }; // Mientras llegan las asignaciones (se piden al desplegar la etapa).
196
+
197
+
198
+ if (loading) {
199
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
200
+ component: "span",
201
+ role: "status",
202
+ "aria-busy": "true",
203
+ "aria-label": "Cargando ".concat(roleLabel.toLowerCase()),
204
+ sx: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, pillSx), {}, {
205
+ cursor: "progress",
206
+ pr: 0.75
207
+ }),
208
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
209
+ component: "span",
210
+ title: statusTitle,
211
+ sx: statusSx,
212
+ children: label
213
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
214
+ component: "span",
215
+ sx: {
216
+ width: 26,
217
+ height: 26,
218
+ display: "inline-flex",
219
+ alignItems: "center",
220
+ justifyContent: "center"
221
+ },
222
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.CircularProgress, {
223
+ size: 16,
224
+ thickness: 5,
225
+ sx: {
226
+ color: "#8A6CAA"
227
+ }
228
+ })
229
+ })]
230
+ });
231
+ }
232
+
233
+ if (lockedReason) {
234
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _tooltipStyles.whiteTooltipProps), {}, {
235
+ title: lockedReason,
236
+ arrow: true,
237
+ placement: "left",
238
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
239
+ component: "span",
240
+ role: "img",
241
+ "aria-label": "No se puede asignar: ".concat(lockedReason),
242
+ sx: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, pillSx), {}, {
243
+ cursor: "not-allowed",
244
+ pr: 1,
245
+ opacity: 0.85
246
+ }),
247
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
248
+ component: "span",
249
+ title: statusTitle,
250
+ sx: statusSx,
251
+ children: label
252
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LockOutlined.default, {
253
+ sx: {
254
+ fontSize: 18,
255
+ color: "#707070"
256
+ }
257
+ })]
258
+ })
259
+ }));
260
+ }
261
+
262
+ var tooltip = current ? "".concat(roleLabel, ": ").concat(fullName(current)) : "".concat(roleLabel, ": por asignar");
263
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
264
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, _tooltipStyles.whiteTooltipProps), {}, {
265
+ title: open ? "" : tooltip,
266
+ arrow: true,
267
+ placement: "left",
268
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ButtonBase, {
269
+ ref: pillRef,
270
+ onClick: function onClick(event) {
271
+ event.stopPropagation();
272
+ if (Date.now() - closedAtRef.current < 400) return;
273
+ setOpen(true);
274
+ },
275
+ "aria-haspopup": "dialog",
276
+ "aria-expanded": open,
277
+ "aria-label": "".concat(tooltip, ". Cambiar"),
278
+ sx: (0, _objectSpread2.default)((0, _objectSpread2.default)((0, _objectSpread2.default)({}, pillSx), {}, {
279
+ cursor: "pointer"
280
+ }, open && {
281
+ borderColor: "#E33AA9",
282
+ backgroundColor: "#F0EEF2"
283
+ }), {}, {
284
+ "&:hover": {
285
+ backgroundColor: "#F0EEF2"
286
+ },
287
+ "&.Mui-focusVisible": {
288
+ borderColor: "#E33AA9"
289
+ }
290
+ }),
291
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
292
+ component: "span",
293
+ title: statusTitle,
294
+ sx: statusSx,
295
+ children: label
296
+ }), current ? /*#__PURE__*/(0, _jsxRuntime.jsx)(UserAvatar, {
297
+ user: current,
298
+ size: 26
299
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
300
+ component: "span",
301
+ sx: {
302
+ width: 26,
303
+ height: 26,
304
+ borderRadius: "50%",
305
+ display: "inline-flex",
306
+ alignItems: "center",
307
+ justifyContent: "center",
308
+ border: "1px dashed #8A6CAA",
309
+ color: "#8A6CAA",
310
+ backgroundColor: "#FFFFFF"
311
+ },
312
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PersonAddAlt1Outlined.default, {
313
+ sx: {
314
+ fontSize: 15
315
+ }
316
+ })
317
+ })]
318
+ })
319
+ })), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Popover, {
320
+ open: open,
321
+ anchorEl: pillRef.current,
322
+ onClose: close,
323
+ onClick: function onClick(event) {
324
+ return event.stopPropagation();
325
+ },
326
+ anchorOrigin: {
327
+ vertical: "bottom",
328
+ horizontal: "right"
329
+ },
330
+ transformOrigin: {
331
+ vertical: "top",
332
+ horizontal: "right"
333
+ },
334
+ PaperProps: {
335
+ sx: {
336
+ mt: 0.75,
337
+ width: 300,
338
+ maxWidth: "calc(100vw - 32px)",
339
+ borderRadius: "12px",
340
+ border: "1px solid #F0EEF2",
341
+ boxShadow: 6,
342
+ overflow: "hidden"
343
+ }
344
+ },
345
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
346
+ sx: {
347
+ p: 1.5,
348
+ pb: 1,
349
+ display: "flex",
350
+ flexDirection: "column",
351
+ gap: 1
352
+ },
353
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
354
+ sx: {
355
+ fontFamily: "Raleway, sans-serif",
356
+ fontSize: 13,
357
+ fontWeight: 600,
358
+ color: "#503D66"
359
+ },
360
+ children: ["Asignar ", roleLabel.toLowerCase()]
361
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
362
+ autoFocus: true,
363
+ size: "small",
364
+ fullWidth: true,
365
+ placeholder: "Buscar persona\u2026",
366
+ value: query,
367
+ onChange: function onChange(event) {
368
+ return setQuery(event.target.value);
369
+ },
370
+ onKeyDown: function onKeyDown(event) {
371
+ if (event.key === "Enter" && filtered[0]) {
372
+ event.preventDefault();
373
+ pick(filtered[0]);
374
+ }
375
+ },
376
+ InputProps: {
377
+ startAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputAdornment, {
378
+ position: "start",
379
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Search.default, {
380
+ sx: {
381
+ fontSize: 18,
382
+ color: "#707070"
383
+ }
384
+ })
385
+ }),
386
+ sx: {
387
+ borderRadius: "8px",
388
+ fontFamily: "Lato, sans-serif",
389
+ fontSize: 13,
390
+ "&.Mui-focused .MuiOutlinedInput-notchedOutline": {
391
+ borderColor: "#E33AA9"
392
+ }
393
+ }
394
+ }
395
+ })]
396
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.List, {
397
+ dense: true,
398
+ disablePadding: true,
399
+ sx: {
400
+ maxHeight: 280,
401
+ overflowY: "auto",
402
+ px: 0.75,
403
+ pb: 0.75
404
+ },
405
+ children: [filtered.map(function (user) {
406
+ var isSelected = user.id_user === selectedId;
407
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
408
+ selected: isSelected,
409
+ onClick: function onClick() {
410
+ return pick(user);
411
+ },
412
+ sx: {
413
+ gap: 1.25,
414
+ borderRadius: "8px",
415
+ py: 0.75,
416
+ "&:hover": {
417
+ backgroundColor: "#F0EEF2"
418
+ },
419
+ "&.Mui-selected, &.Mui-selected:hover": {
420
+ backgroundColor: "#F0EEF2"
421
+ }
422
+ },
423
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(UserAvatar, {
424
+ user: user,
425
+ size: 30
426
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
427
+ sx: {
428
+ flex: 1,
429
+ minWidth: 0,
430
+ fontFamily: "Lato, sans-serif",
431
+ fontSize: 14,
432
+ fontWeight: isSelected ? 700 : 400,
433
+ color: isSelected ? "#503D66" : "#262626",
434
+ overflow: "hidden",
435
+ textOverflow: "ellipsis",
436
+ whiteSpace: "nowrap"
437
+ },
438
+ children: fullName(user)
439
+ }), isSelected && /*#__PURE__*/(0, _jsxRuntime.jsx)(_Check.default, {
440
+ sx: {
441
+ fontSize: 18,
442
+ color: "#E33AA9"
443
+ }
444
+ })]
445
+ }, user.id_user);
446
+ }), filtered.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
447
+ sx: {
448
+ py: 2,
449
+ textAlign: "center",
450
+ fontFamily: "Lato, sans-serif",
451
+ fontSize: 13,
452
+ color: "#707070"
453
+ },
454
+ children: users.length === 0 ? "No hay personas asignables" : "Sin coincidencias"
455
+ })]
456
+ })]
457
+ })]
458
+ });
459
+ }
@@ -0,0 +1,119 @@
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.TresServicios = exports.SoloConsulta = exports.DiecisieteServicios = void 0;
9
+
10
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
11
+
12
+ var _index = _interopRequireDefault(require("./index"));
13
+
14
+ var _demo = require("./demo");
15
+
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+
18
+ var _default = {
19
+ title: "Components/organisms/ServicesWorkspace",
20
+ component: _index.default,
21
+ argTypes: {
22
+ onAssign: {
23
+ action: "onAssign"
24
+ },
25
+ onOpenEditor: {
26
+ action: "onOpenEditor"
27
+ }
28
+ }
29
+ };
30
+ exports.default = _default;
31
+ var retailers = [{
32
+ id_retailer: 4,
33
+ retailer: "Walmart"
34
+ }, {
35
+ id_retailer: 9,
36
+ retailer: "Soriana"
37
+ }, {
38
+ id_retailer: 12,
39
+ retailer: "Alsuper"
40
+ }]; // Producto con la forma que deja `normalizeProduct` en la edición.
41
+
42
+ var baseProduct = {
43
+ id_article: 11080102,
44
+ id_order: 10478,
45
+ name: "Prueba variantes 2 - hijo de 1",
46
+ datasheet_status: "AS",
47
+ description_status: "RA/AS",
48
+ images_status: "PA",
49
+ id_datasheet_especialist: 9101,
50
+ id_datasheet_facilitator: 9103,
51
+ id_description_especialist: 9102,
52
+ id_images_especialist: 0,
53
+ id_auditor: 9104,
54
+ statusByRetailer: [{
55
+ service: "datasheet",
56
+ retailer_id: 4,
57
+ status: "AS"
58
+ }, {
59
+ service: "datasheet",
60
+ retailer_id: 9,
61
+ status: "CA"
62
+ }, {
63
+ service: "description",
64
+ retailer_id: 4,
65
+ status: "RA/AS"
66
+ }, {
67
+ service: "description",
68
+ retailer_id: 12,
69
+ status: "AC"
70
+ }, {
71
+ service: "images",
72
+ retailer_id: 4,
73
+ status: "PA"
74
+ }]
75
+ };
76
+ var users = {
77
+ especialist: _demo.DEMO_USERS,
78
+ facilitator: _demo.DEMO_USERS,
79
+ auditor: _demo.DEMO_USERS
80
+ };
81
+
82
+ var Template = function Template(args) {
83
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
84
+ style: {
85
+ maxWidth: 1100,
86
+ padding: 24,
87
+ background: "#FAFAFA"
88
+ },
89
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_index.default, (0, _objectSpread2.default)({}, args))
90
+ });
91
+ };
92
+ /** Producto de hoy: solo Ficha técnica, Descripción e Imágenes. */
93
+
94
+
95
+ var TresServicios = Template.bind({});
96
+ exports.TresServicios = TresServicios;
97
+ TresServicios.args = {
98
+ product: baseProduct,
99
+ retailers: retailers,
100
+ users: users,
101
+ canAssign: true
102
+ };
103
+ /** Con 17 servicios (3 de siempre + 14 de ejemplo). */
104
+
105
+ var DiecisieteServicios = Template.bind({});
106
+ exports.DiecisieteServicios = DiecisieteServicios;
107
+ DiecisieteServicios.args = {
108
+ product: (0, _demo.withDemoServices)(baseProduct, 14),
109
+ retailers: retailers,
110
+ users: users,
111
+ canAssign: true
112
+ };
113
+ /** Rol que solo consulta (sin asignar). */
114
+
115
+ var SoloConsulta = Template.bind({});
116
+ exports.SoloConsulta = SoloConsulta;
117
+ SoloConsulta.args = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, DiecisieteServicios.args), {}, {
118
+ canAssign: false
119
+ });