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.
- package/dist/components/organisms/ServicesNavigation/ServiceToolbar.js +210 -0
- package/dist/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +138 -0
- package/dist/components/organisms/ServicesNavigation/ServicesRail.js +705 -0
- package/dist/components/organisms/ServicesNavigation/catalog.js +505 -0
- package/dist/components/organisms/ServicesNavigation/index.js +337 -0
- package/dist/components/organisms/ServicesNavigation/model.js +167 -0
- package/dist/components/organisms/ServicesNavigation/ui.js +371 -0
- package/dist/components/organisms/ServicesNavigation/views.js +1237 -0
- package/dist/components/organisms/ServicesWorkspace/AssigneePicker.js +459 -0
- package/dist/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +119 -0
- package/dist/components/organisms/ServicesWorkspace/demo.js +137 -0
- package/dist/components/organisms/ServicesWorkspace/index.js +813 -0
- package/dist/components/organisms/ServicesWorkspace/servicesModel.js +351 -0
- package/dist/components/organisms/ServicesWorkspace/tooltipStyles.js +37 -0
- package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +40 -0
- package/dist/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +387 -0
- package/dist/components/pages/CreatorsProductEdition/sections/StatusChip.js +13 -4
- package/dist/components/pages/ProductEdition/ProductEdition.stories.js +148 -0
- package/dist/components/pages/ProductEdition/ProductEditionView.js +1355 -0
- package/dist/components/pages/ProductEdition/ServiceHeader.js +142 -0
- package/dist/components/pages/ProductEdition/api.js +256 -0
- package/dist/components/pages/ProductEdition/index.js +37 -0
- package/dist/components/pages/ProductEdition/permissions.js +200 -0
- package/dist/components/pages/ProductEdition/permissions.test.js +320 -0
- package/dist/components/pages/ProductEdition/sections/CatalogServicePanel.js +237 -0
- package/dist/components/pages/ProductEdition/sections/EditionTopBar.js +174 -0
- package/dist/components/pages/ProductEdition/sections/ImagePanel.js +440 -0
- package/dist/components/pages/ProductEdition/sections/ServiceTeam.js +275 -0
- package/dist/components/pages/ProductEdition/sections/ServiceTools.js +186 -0
- package/dist/components/pages/ProductEdition/services.js +233 -0
- package/dist/components/pages/ProductEdition/services.test.js +195 -0
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +15 -2
- package/dist/components/pages/RetailerProductEdition/context/provider-product-edition.context.js +2 -2
- package/dist/components/pages/RetailerProductEdition/index.js +57 -40
- package/dist/components/pages/RetailerProductEdition/utils.js +6 -2
- package/dist/index.js +13 -0
- package/package.json +1 -1
- package/src/components/organisms/ServicesNavigation/ServiceToolbar.jsx +143 -0
- package/src/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +101 -0
- package/src/components/organisms/ServicesNavigation/ServicesRail.jsx +591 -0
- package/src/components/organisms/ServicesNavigation/catalog.js +180 -0
- package/src/components/organisms/ServicesNavigation/index.jsx +232 -0
- package/src/components/organisms/ServicesNavigation/model.js +85 -0
- package/src/components/organisms/ServicesNavigation/ui.jsx +229 -0
- package/src/components/organisms/ServicesNavigation/views.jsx +705 -0
- package/src/components/organisms/ServicesWorkspace/AssigneePicker.js +348 -0
- package/src/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +61 -0
- package/src/components/organisms/ServicesWorkspace/demo.js +58 -0
- package/src/components/organisms/ServicesWorkspace/index.js +556 -0
- package/src/components/organisms/ServicesWorkspace/servicesModel.js +203 -0
- package/src/components/organisms/ServicesWorkspace/tooltipStyles.js +27 -0
- package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +17 -0
- package/src/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +175 -0
- package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +8 -4
- package/src/components/pages/ProductEdition/ProductEdition.stories.js +106 -0
- package/src/components/pages/ProductEdition/ProductEditionView.jsx +1142 -0
- package/src/components/pages/ProductEdition/ServiceHeader.jsx +104 -0
- package/src/components/pages/ProductEdition/api.js +84 -0
- package/src/components/pages/ProductEdition/index.js +21 -0
- package/src/components/pages/ProductEdition/permissions.js +128 -0
- package/src/components/pages/ProductEdition/permissions.test.js +249 -0
- package/src/components/pages/ProductEdition/sections/CatalogServicePanel.jsx +123 -0
- package/src/components/pages/ProductEdition/sections/EditionTopBar.jsx +134 -0
- package/src/components/pages/ProductEdition/sections/ImagePanel.jsx +342 -0
- package/src/components/pages/ProductEdition/sections/ServiceTeam.jsx +184 -0
- package/src/components/pages/ProductEdition/sections/ServiceTools.jsx +134 -0
- package/src/components/pages/ProductEdition/services.js +187 -0
- package/src/components/pages/ProductEdition/services.test.js +88 -0
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +12 -0
- package/src/components/pages/RetailerProductEdition/context/provider-product-edition.context.jsx +6 -2
- package/src/components/pages/RetailerProductEdition/index.js +28 -3
- package/src/components/pages/RetailerProductEdition/utils.js +5 -0
- package/src/index.js +1 -0
- package/.claude/settings.local.json +0 -7
- package/dist/ai/prompts/attribute.prompt.js +0 -28
- package/dist/ai/prompts/description.prompt.js +0 -33
- package/dist/ai/schemas/attribute.schema.js +0 -35
- package/dist/ai/schemas/description.schema.js +0 -27
|
@@ -0,0 +1,705 @@
|
|
|
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.ServicesRail = exports.RAIL_WIDTH = exports.RAIL_COLLAPSED_WIDTH = void 0;
|
|
9
|
+
|
|
10
|
+
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
|
+
|
|
12
|
+
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
13
|
+
|
|
14
|
+
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
|
|
15
|
+
|
|
16
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
17
|
+
|
|
18
|
+
var _react = require("react");
|
|
19
|
+
|
|
20
|
+
var _material = require("@mui/material");
|
|
21
|
+
|
|
22
|
+
var _ExpandMore = _interopRequireDefault(require("@mui/icons-material/ExpandMore"));
|
|
23
|
+
|
|
24
|
+
var _Search = _interopRequireDefault(require("@mui/icons-material/Search"));
|
|
25
|
+
|
|
26
|
+
var _MenuOpen = _interopRequireDefault(require("@mui/icons-material/MenuOpen"));
|
|
27
|
+
|
|
28
|
+
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
|
29
|
+
|
|
30
|
+
var _ui = require("./ui");
|
|
31
|
+
|
|
32
|
+
var _model = require("./model");
|
|
33
|
+
|
|
34
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
35
|
+
|
|
36
|
+
/*
|
|
37
|
+
Lista lateral de servicios: reemplaza a la barra de pestañas.
|
|
38
|
+
|
|
39
|
+
- Solo muestra los servicios que el producto tiene contratados.
|
|
40
|
+
- «Resumen» va primero: el panorama de todos los servicios.
|
|
41
|
+
- Los servicios van en bloques fijos (Textos, Imágenes...). No se reordenan
|
|
42
|
+
por estatus: cada uno queda siempre en el mismo lugar.
|
|
43
|
+
- «Míos / Todos»: por omisión, solo lo que la persona trabaja. Aparece solo
|
|
44
|
+
cuando sirve (trabaja algunos servicios del producto, no todos).
|
|
45
|
+
- El buscador aparece cuando hay más de 8 servicios a la vista.
|
|
46
|
+
- Se contrae a una columna de íconos para dejarle el ancho al editor.
|
|
47
|
+
- `side`: de qué lado de la pantalla va («left» o «right»). Del lado derecho
|
|
48
|
+
es el espejo del izquierdo: borde, marca del servicio abierto, flechas de
|
|
49
|
+
contraer y globos de ayuda cambian de lado.
|
|
50
|
+
*/
|
|
51
|
+
var RAIL_WIDTH = 256;
|
|
52
|
+
exports.RAIL_WIDTH = RAIL_WIDTH;
|
|
53
|
+
var RAIL_COLLAPSED_WIDTH = 64;
|
|
54
|
+
exports.RAIL_COLLAPSED_WIDTH = RAIL_COLLAPSED_WIDTH;
|
|
55
|
+
var SEARCH_THRESHOLD = 8;
|
|
56
|
+
var EXPAND_ALL_THRESHOLD = 12;
|
|
57
|
+
|
|
58
|
+
var CountBadge = function CountBadge(_ref) {
|
|
59
|
+
var children = _ref.children,
|
|
60
|
+
_ref$active = _ref.active,
|
|
61
|
+
active = _ref$active === void 0 ? false : _ref$active;
|
|
62
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
63
|
+
component: "span",
|
|
64
|
+
sx: {
|
|
65
|
+
minWidth: 20,
|
|
66
|
+
height: 18,
|
|
67
|
+
px: 0.75,
|
|
68
|
+
borderRadius: "9px",
|
|
69
|
+
display: "inline-flex",
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
justifyContent: "center",
|
|
72
|
+
fontFamily: _ui.FONT_STACK,
|
|
73
|
+
fontSize: 11,
|
|
74
|
+
fontWeight: 700,
|
|
75
|
+
bgcolor: active ? _ui.COLORS.s5 : _ui.COLORS.s2,
|
|
76
|
+
color: active ? _ui.COLORS.white : _ui.COLORS.s4
|
|
77
|
+
},
|
|
78
|
+
children: children
|
|
79
|
+
});
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
var FilterToggle = function FilterToggle(_ref2) {
|
|
83
|
+
var value = _ref2.value,
|
|
84
|
+
onChange = _ref2.onChange,
|
|
85
|
+
mineCount = _ref2.mineCount,
|
|
86
|
+
allCount = _ref2.allCount;
|
|
87
|
+
var options = [{
|
|
88
|
+
key: "mine",
|
|
89
|
+
label: "Míos",
|
|
90
|
+
count: mineCount
|
|
91
|
+
}, {
|
|
92
|
+
key: "all",
|
|
93
|
+
label: "Todos",
|
|
94
|
+
count: allCount
|
|
95
|
+
}];
|
|
96
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
97
|
+
role: "group",
|
|
98
|
+
"aria-label": "Qu\xE9 servicios ver",
|
|
99
|
+
sx: {
|
|
100
|
+
display: "flex",
|
|
101
|
+
p: "3px",
|
|
102
|
+
mx: 2,
|
|
103
|
+
mb: 1.5,
|
|
104
|
+
bgcolor: _ui.COLORS.s2,
|
|
105
|
+
borderRadius: "18px"
|
|
106
|
+
},
|
|
107
|
+
children: options.map(function (option) {
|
|
108
|
+
var active = option.key === value;
|
|
109
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ButtonBase, {
|
|
110
|
+
"aria-pressed": active,
|
|
111
|
+
onClick: function onClick() {
|
|
112
|
+
return onChange(option.key);
|
|
113
|
+
},
|
|
114
|
+
sx: {
|
|
115
|
+
flex: 1,
|
|
116
|
+
height: 28,
|
|
117
|
+
gap: 0.75,
|
|
118
|
+
borderRadius: "15px",
|
|
119
|
+
fontFamily: _ui.FONT_STACK,
|
|
120
|
+
fontSize: 13,
|
|
121
|
+
fontWeight: active ? 700 : 400,
|
|
122
|
+
color: active ? _ui.COLORS.s5 : _ui.COLORS.s4,
|
|
123
|
+
bgcolor: active ? _ui.COLORS.white : "transparent",
|
|
124
|
+
boxShadow: active ? "0 1px 3px rgba(80, 61, 102, 0.18)" : "none",
|
|
125
|
+
transition: "background-color 120ms, box-shadow 120ms"
|
|
126
|
+
},
|
|
127
|
+
children: [option.label, /*#__PURE__*/(0, _jsxRuntime.jsx)(CountBadge, {
|
|
128
|
+
active: active,
|
|
129
|
+
children: option.count
|
|
130
|
+
})]
|
|
131
|
+
}, option.key);
|
|
132
|
+
})
|
|
133
|
+
});
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
var itemSx = function itemSx(active) {
|
|
137
|
+
var _before;
|
|
138
|
+
|
|
139
|
+
var side = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : "left";
|
|
140
|
+
return {
|
|
141
|
+
width: "100%",
|
|
142
|
+
display: "flex",
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
gap: 1.25,
|
|
145
|
+
height: 36,
|
|
146
|
+
pl: 1.5,
|
|
147
|
+
pr: 1,
|
|
148
|
+
borderRadius: "8px",
|
|
149
|
+
position: "relative",
|
|
150
|
+
textAlign: "left",
|
|
151
|
+
bgcolor: active ? _ui.COLORS.s2 : "transparent",
|
|
152
|
+
"&:hover": {
|
|
153
|
+
bgcolor: _ui.COLORS.s2
|
|
154
|
+
},
|
|
155
|
+
"&::before": (_before = {
|
|
156
|
+
content: '""',
|
|
157
|
+
position: "absolute"
|
|
158
|
+
}, (0, _defineProperty2.default)(_before, side, 0), (0, _defineProperty2.default)(_before, "top", 8), (0, _defineProperty2.default)(_before, "bottom", 8), (0, _defineProperty2.default)(_before, "width", 3), (0, _defineProperty2.default)(_before, "borderRadius", "2px"), (0, _defineProperty2.default)(_before, "bgcolor", active ? _ui.COLORS.magenta_s2 : "transparent"), _before)
|
|
159
|
+
};
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
var ItemLabel = function ItemLabel(_ref3) {
|
|
163
|
+
var active = _ref3.active,
|
|
164
|
+
children = _ref3.children;
|
|
165
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
166
|
+
sx: {
|
|
167
|
+
flex: 1,
|
|
168
|
+
minWidth: 0,
|
|
169
|
+
fontFamily: _ui.FONT_STACK,
|
|
170
|
+
fontSize: 14,
|
|
171
|
+
fontWeight: active ? 700 : 400,
|
|
172
|
+
color: active ? _ui.COLORS.s5 : _ui.COLORS.color_gray,
|
|
173
|
+
overflow: "hidden",
|
|
174
|
+
textOverflow: "ellipsis",
|
|
175
|
+
whiteSpace: "nowrap"
|
|
176
|
+
},
|
|
177
|
+
children: children
|
|
178
|
+
});
|
|
179
|
+
};
|
|
180
|
+
/* ------------------------------------------------------------------------ */
|
|
181
|
+
|
|
182
|
+
/* Lista completa */
|
|
183
|
+
|
|
184
|
+
/* ------------------------------------------------------------------------ */
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
var ExpandedRail = function ExpandedRail(_ref4) {
|
|
188
|
+
var _services$find;
|
|
189
|
+
|
|
190
|
+
var services = _ref4.services,
|
|
191
|
+
visible = _ref4.visible,
|
|
192
|
+
selected = _ref4.selected,
|
|
193
|
+
onSelect = _ref4.onSelect,
|
|
194
|
+
userId = _ref4.userId,
|
|
195
|
+
filter = _ref4.filter,
|
|
196
|
+
onFilterChange = _ref4.onFilterChange,
|
|
197
|
+
showFilter = _ref4.showFilter,
|
|
198
|
+
onCollapse = _ref4.onCollapse,
|
|
199
|
+
onClose = _ref4.onClose,
|
|
200
|
+
side = _ref4.side;
|
|
201
|
+
|
|
202
|
+
var _useState = (0, _react.useState)(""),
|
|
203
|
+
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
204
|
+
query = _useState2[0],
|
|
205
|
+
setQuery = _useState2[1];
|
|
206
|
+
|
|
207
|
+
var text = query.trim().toLowerCase();
|
|
208
|
+
var matches = text ? visible.filter(function (service) {
|
|
209
|
+
return service.display_name.toLowerCase().includes(text);
|
|
210
|
+
}) : visible;
|
|
211
|
+
var groups = (0, _model.groupServices)(matches);
|
|
212
|
+
var pendingCount = services.filter(function (service) {
|
|
213
|
+
return (0, _model.isPendingFor)(service, userId);
|
|
214
|
+
}).length;
|
|
215
|
+
/*
|
|
216
|
+
Bloques abiertos: todos si caben; si no, el del servicio abierto y los que
|
|
217
|
+
tienen algo que le toca a la persona. Al buscar se abren todos.
|
|
218
|
+
*/
|
|
219
|
+
// `visible` es un arreglo nuevo en cada render: se compara por sus nombres.
|
|
220
|
+
|
|
221
|
+
var visibleKey = visible.map(function (service) {
|
|
222
|
+
return service.service_name;
|
|
223
|
+
}).join(",");
|
|
224
|
+
var defaultOpen = (0, _react.useMemo)(function () {
|
|
225
|
+
var all = (0, _model.groupServices)(visible);
|
|
226
|
+
if (visible.length <= EXPAND_ALL_THRESHOLD) return all.map(function (group) {
|
|
227
|
+
return group.key;
|
|
228
|
+
});
|
|
229
|
+
return all.filter(function (group) {
|
|
230
|
+
return group.services.some(function (service) {
|
|
231
|
+
return service.service_name === selected || (0, _model.isPendingFor)(service, userId);
|
|
232
|
+
});
|
|
233
|
+
}).map(function (group) {
|
|
234
|
+
return group.key;
|
|
235
|
+
}); // Solo al cambiar lo que se ve: abrir un servicio no vuelve a cerrar bloques.
|
|
236
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
237
|
+
}, [visibleKey, userId]);
|
|
238
|
+
|
|
239
|
+
var _useState3 = (0, _react.useState)(defaultOpen),
|
|
240
|
+
_useState4 = (0, _slicedToArray2.default)(_useState3, 2),
|
|
241
|
+
open = _useState4[0],
|
|
242
|
+
setOpen = _useState4[1];
|
|
243
|
+
|
|
244
|
+
(0, _react.useEffect)(function () {
|
|
245
|
+
return setOpen(defaultOpen);
|
|
246
|
+
}, [defaultOpen]); // Si se abre un servicio de un bloque cerrado (desde el Resumen), se abre.
|
|
247
|
+
|
|
248
|
+
var selectedGroup = (_services$find = services.find(function (service) {
|
|
249
|
+
return service.service_name === selected;
|
|
250
|
+
})) === null || _services$find === void 0 ? void 0 : _services$find.group;
|
|
251
|
+
(0, _react.useEffect)(function () {
|
|
252
|
+
if (selectedGroup) setOpen(function (prev) {
|
|
253
|
+
return prev.includes(selectedGroup) ? prev : [].concat((0, _toConsumableArray2.default)(prev), [selectedGroup]);
|
|
254
|
+
});
|
|
255
|
+
}, [selectedGroup]);
|
|
256
|
+
|
|
257
|
+
var toggle = function toggle(key) {
|
|
258
|
+
return setOpen(function (prev) {
|
|
259
|
+
return prev.includes(key) ? prev.filter(function (item) {
|
|
260
|
+
return item !== key;
|
|
261
|
+
}) : [].concat((0, _toConsumableArray2.default)(prev), [key]);
|
|
262
|
+
});
|
|
263
|
+
};
|
|
264
|
+
|
|
265
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
266
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
267
|
+
sx: {
|
|
268
|
+
display: "flex",
|
|
269
|
+
alignItems: "center",
|
|
270
|
+
gap: 1,
|
|
271
|
+
px: 2,
|
|
272
|
+
pt: 2,
|
|
273
|
+
pb: 1.5
|
|
274
|
+
},
|
|
275
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
276
|
+
sx: {
|
|
277
|
+
flex: 1,
|
|
278
|
+
fontFamily: _ui.TITLE_STACK,
|
|
279
|
+
fontWeight: 600,
|
|
280
|
+
fontSize: 16,
|
|
281
|
+
color: _ui.COLORS.s5
|
|
282
|
+
},
|
|
283
|
+
children: "Servicios"
|
|
284
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(CountBadge, {
|
|
285
|
+
children: services.length
|
|
286
|
+
}), onCollapse && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
287
|
+
title: "Contraer la lista",
|
|
288
|
+
arrow: true,
|
|
289
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
290
|
+
"aria-label": "Contraer la lista de servicios",
|
|
291
|
+
size: "small",
|
|
292
|
+
onClick: onCollapse,
|
|
293
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuOpen.default, {
|
|
294
|
+
sx: {
|
|
295
|
+
fontSize: 20,
|
|
296
|
+
color: _ui.COLORS.s4,
|
|
297
|
+
transform: side === "right" ? "scaleX(-1)" : "none"
|
|
298
|
+
}
|
|
299
|
+
})
|
|
300
|
+
})
|
|
301
|
+
}), onClose && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
302
|
+
"aria-label": "Cerrar la lista de servicios",
|
|
303
|
+
size: "small",
|
|
304
|
+
onClick: onClose,
|
|
305
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {
|
|
306
|
+
sx: {
|
|
307
|
+
fontSize: 20,
|
|
308
|
+
color: _ui.COLORS.s4
|
|
309
|
+
}
|
|
310
|
+
})
|
|
311
|
+
})]
|
|
312
|
+
}), showFilter && /*#__PURE__*/(0, _jsxRuntime.jsx)(FilterToggle, {
|
|
313
|
+
value: filter,
|
|
314
|
+
onChange: onFilterChange,
|
|
315
|
+
mineCount: services.filter(function (service) {
|
|
316
|
+
return (0, _model.isMine)(service, userId);
|
|
317
|
+
}).length,
|
|
318
|
+
allCount: services.length
|
|
319
|
+
}), visible.length > SEARCH_THRESHOLD && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
320
|
+
sx: {
|
|
321
|
+
px: 2,
|
|
322
|
+
mb: 1
|
|
323
|
+
},
|
|
324
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.TextField, {
|
|
325
|
+
size: "small",
|
|
326
|
+
fullWidth: true,
|
|
327
|
+
placeholder: "Buscar servicio\u2026",
|
|
328
|
+
value: query,
|
|
329
|
+
onChange: function onChange(event) {
|
|
330
|
+
return setQuery(event.target.value);
|
|
331
|
+
},
|
|
332
|
+
sx: _ui.fieldSx,
|
|
333
|
+
InputProps: {
|
|
334
|
+
startAdornment: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputAdornment, {
|
|
335
|
+
position: "start",
|
|
336
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Search.default, {
|
|
337
|
+
sx: {
|
|
338
|
+
fontSize: 18,
|
|
339
|
+
color: _ui.COLORS.s4
|
|
340
|
+
}
|
|
341
|
+
})
|
|
342
|
+
})
|
|
343
|
+
}
|
|
344
|
+
})
|
|
345
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
346
|
+
sx: {
|
|
347
|
+
flex: 1,
|
|
348
|
+
minHeight: 0,
|
|
349
|
+
overflowY: "auto",
|
|
350
|
+
px: 1,
|
|
351
|
+
pb: 1
|
|
352
|
+
},
|
|
353
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ButtonBase, {
|
|
354
|
+
onClick: function onClick() {
|
|
355
|
+
return onSelect(_model.SUMMARY);
|
|
356
|
+
},
|
|
357
|
+
"aria-current": selected === _model.SUMMARY ? "true" : undefined,
|
|
358
|
+
sx: (0, _objectSpread2.default)((0, _objectSpread2.default)({}, itemSx(selected === _model.SUMMARY, side)), {}, {
|
|
359
|
+
mb: 0.5
|
|
360
|
+
}),
|
|
361
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ServiceIcon, {
|
|
362
|
+
icon: "summary",
|
|
363
|
+
sx: {
|
|
364
|
+
color: selected === _model.SUMMARY ? _ui.COLORS.magenta_s2 : _ui.COLORS.s4
|
|
365
|
+
}
|
|
366
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ItemLabel, {
|
|
367
|
+
active: selected === _model.SUMMARY,
|
|
368
|
+
children: "Resumen"
|
|
369
|
+
}), pendingCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(CountBadge, {
|
|
370
|
+
children: pendingCount
|
|
371
|
+
})]
|
|
372
|
+
}), groups.length === 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
373
|
+
sx: {
|
|
374
|
+
py: 3,
|
|
375
|
+
textAlign: "center",
|
|
376
|
+
fontFamily: _ui.FONT_STACK,
|
|
377
|
+
fontSize: 13,
|
|
378
|
+
color: _ui.COLORS.s4
|
|
379
|
+
},
|
|
380
|
+
children: "Sin coincidencias"
|
|
381
|
+
}), groups.map(function (group) {
|
|
382
|
+
var isOpen = Boolean(text) || open.includes(group.key);
|
|
383
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
384
|
+
sx: {
|
|
385
|
+
mt: 0.5
|
|
386
|
+
},
|
|
387
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ButtonBase, {
|
|
388
|
+
onClick: function onClick() {
|
|
389
|
+
return toggle(group.key);
|
|
390
|
+
},
|
|
391
|
+
"aria-expanded": isOpen,
|
|
392
|
+
sx: {
|
|
393
|
+
width: "100%",
|
|
394
|
+
display: "flex",
|
|
395
|
+
alignItems: "center",
|
|
396
|
+
gap: 1,
|
|
397
|
+
px: 1.5,
|
|
398
|
+
py: 0.75,
|
|
399
|
+
borderRadius: "6px",
|
|
400
|
+
"&:hover": {
|
|
401
|
+
bgcolor: _ui.COLORS.s1
|
|
402
|
+
}
|
|
403
|
+
},
|
|
404
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
405
|
+
sx: {
|
|
406
|
+
flex: 1,
|
|
407
|
+
textAlign: "left",
|
|
408
|
+
fontFamily: _ui.FONT_STACK,
|
|
409
|
+
fontSize: 11,
|
|
410
|
+
fontWeight: 700,
|
|
411
|
+
letterSpacing: "0.06em",
|
|
412
|
+
textTransform: "uppercase",
|
|
413
|
+
color: _ui.COLORS.s4
|
|
414
|
+
},
|
|
415
|
+
children: group.label
|
|
416
|
+
}), group.services.some(function (service) {
|
|
417
|
+
return (0, _model.isPendingFor)(service, userId);
|
|
418
|
+
}) && !isOpen && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.PendingDot, {
|
|
419
|
+
size: 6,
|
|
420
|
+
withTooltip: false
|
|
421
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
|
422
|
+
sx: {
|
|
423
|
+
fontFamily: _ui.FONT_STACK,
|
|
424
|
+
fontSize: 11,
|
|
425
|
+
fontWeight: 700,
|
|
426
|
+
color: _ui.COLORS.s4
|
|
427
|
+
},
|
|
428
|
+
children: group.services.length
|
|
429
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ExpandMore.default, {
|
|
430
|
+
sx: {
|
|
431
|
+
fontSize: 18,
|
|
432
|
+
color: _ui.COLORS.s4,
|
|
433
|
+
transition: "transform 150ms",
|
|
434
|
+
transform: isOpen ? "rotate(180deg)" : "none"
|
|
435
|
+
}
|
|
436
|
+
})]
|
|
437
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Collapse, {
|
|
438
|
+
in: isOpen,
|
|
439
|
+
children: group.services.map(function (service) {
|
|
440
|
+
var active = service.service_name === selected;
|
|
441
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ButtonBase, {
|
|
442
|
+
onClick: function onClick() {
|
|
443
|
+
return onSelect(service.service_name);
|
|
444
|
+
},
|
|
445
|
+
"aria-current": active ? "true" : undefined,
|
|
446
|
+
sx: itemSx(active, side),
|
|
447
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ServiceIcon, {
|
|
448
|
+
icon: service.icon,
|
|
449
|
+
sx: {
|
|
450
|
+
color: active ? _ui.COLORS.magenta_s2 : _ui.COLORS.s4
|
|
451
|
+
}
|
|
452
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(ItemLabel, {
|
|
453
|
+
active: active,
|
|
454
|
+
children: service.display_name
|
|
455
|
+
}), (0, _model.isPendingFor)(service, userId) && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.PendingDot, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.StatusChip, (0, _objectSpread2.default)((0, _objectSpread2.default)({}, (0, _ui.serviceStatusProps)(service)), {}, {
|
|
456
|
+
oval: true
|
|
457
|
+
}))]
|
|
458
|
+
}, service.service_name);
|
|
459
|
+
})
|
|
460
|
+
})]
|
|
461
|
+
}, group.key);
|
|
462
|
+
})]
|
|
463
|
+
}), pendingCount > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
464
|
+
sx: {
|
|
465
|
+
display: "flex",
|
|
466
|
+
alignItems: "center",
|
|
467
|
+
gap: 1,
|
|
468
|
+
px: 2,
|
|
469
|
+
py: 1.25,
|
|
470
|
+
borderTop: "1px solid ".concat(_ui.COLORS.s2)
|
|
471
|
+
},
|
|
472
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.PendingDot, {
|
|
473
|
+
withTooltip: false
|
|
474
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
|
|
475
|
+
sx: {
|
|
476
|
+
fontFamily: _ui.FONT_STACK,
|
|
477
|
+
fontSize: 12,
|
|
478
|
+
color: _ui.COLORS.s4
|
|
479
|
+
},
|
|
480
|
+
children: ["Te toca a ti \xB7 ", pendingCount, " ", pendingCount === 1 ? "servicio" : "servicios"]
|
|
481
|
+
})]
|
|
482
|
+
})]
|
|
483
|
+
});
|
|
484
|
+
};
|
|
485
|
+
/* ------------------------------------------------------------------------ */
|
|
486
|
+
|
|
487
|
+
/* Lista contraída: solo íconos */
|
|
488
|
+
|
|
489
|
+
/* ------------------------------------------------------------------------ */
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
var CollapsedRail = function CollapsedRail(_ref5) {
|
|
493
|
+
var visible = _ref5.visible,
|
|
494
|
+
selected = _ref5.selected,
|
|
495
|
+
onSelect = _ref5.onSelect,
|
|
496
|
+
userId = _ref5.userId,
|
|
497
|
+
onExpand = _ref5.onExpand,
|
|
498
|
+
side = _ref5.side;
|
|
499
|
+
var groups = (0, _model.groupServices)(visible); // Los globos de ayuda salen hacia el editor, no hacia el borde de la pantalla.
|
|
500
|
+
|
|
501
|
+
var tooltipPlacement = side === "right" ? "left" : "right";
|
|
502
|
+
|
|
503
|
+
var iconButtonSx = function iconButtonSx(active) {
|
|
504
|
+
var _before2;
|
|
505
|
+
|
|
506
|
+
return {
|
|
507
|
+
width: 44,
|
|
508
|
+
height: 40,
|
|
509
|
+
borderRadius: "8px",
|
|
510
|
+
position: "relative",
|
|
511
|
+
bgcolor: active ? _ui.COLORS.s2 : "transparent",
|
|
512
|
+
"&:hover": {
|
|
513
|
+
bgcolor: _ui.COLORS.s2
|
|
514
|
+
},
|
|
515
|
+
"&::before": (_before2 = {
|
|
516
|
+
content: '""',
|
|
517
|
+
position: "absolute"
|
|
518
|
+
}, (0, _defineProperty2.default)(_before2, side, -10), (0, _defineProperty2.default)(_before2, "top", 8), (0, _defineProperty2.default)(_before2, "bottom", 8), (0, _defineProperty2.default)(_before2, "width", 3), (0, _defineProperty2.default)(_before2, "borderRadius", "2px"), (0, _defineProperty2.default)(_before2, "bgcolor", active ? _ui.COLORS.magenta_s2 : "transparent"), _before2)
|
|
519
|
+
};
|
|
520
|
+
};
|
|
521
|
+
|
|
522
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
523
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
524
|
+
sx: {
|
|
525
|
+
display: "flex",
|
|
526
|
+
justifyContent: "center",
|
|
527
|
+
pt: 1.5,
|
|
528
|
+
pb: 1
|
|
529
|
+
},
|
|
530
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
531
|
+
title: "Mostrar la lista de servicios",
|
|
532
|
+
arrow: true,
|
|
533
|
+
placement: tooltipPlacement,
|
|
534
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
|
535
|
+
"aria-label": "Mostrar la lista de servicios",
|
|
536
|
+
onClick: onExpand,
|
|
537
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_MenuOpen.default, {
|
|
538
|
+
sx: {
|
|
539
|
+
fontSize: 22,
|
|
540
|
+
color: _ui.COLORS.s4,
|
|
541
|
+
transform: side === "right" ? "none" : "scaleX(-1)"
|
|
542
|
+
}
|
|
543
|
+
})
|
|
544
|
+
})
|
|
545
|
+
})
|
|
546
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
|
|
547
|
+
sx: {
|
|
548
|
+
flex: 1,
|
|
549
|
+
minHeight: 0,
|
|
550
|
+
overflowY: "auto",
|
|
551
|
+
display: "flex",
|
|
552
|
+
flexDirection: "column",
|
|
553
|
+
alignItems: "center",
|
|
554
|
+
gap: 0.5,
|
|
555
|
+
pb: 1
|
|
556
|
+
},
|
|
557
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
558
|
+
title: "Resumen",
|
|
559
|
+
arrow: true,
|
|
560
|
+
placement: tooltipPlacement,
|
|
561
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ButtonBase, {
|
|
562
|
+
"aria-label": "Resumen",
|
|
563
|
+
"aria-current": selected === _model.SUMMARY ? "true" : undefined,
|
|
564
|
+
onClick: function onClick() {
|
|
565
|
+
return onSelect(_model.SUMMARY);
|
|
566
|
+
},
|
|
567
|
+
sx: iconButtonSx(selected === _model.SUMMARY),
|
|
568
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ServiceIcon, {
|
|
569
|
+
icon: "summary",
|
|
570
|
+
sx: {
|
|
571
|
+
fontSize: 22,
|
|
572
|
+
color: selected === _model.SUMMARY ? _ui.COLORS.magenta_s2 : _ui.COLORS.s4
|
|
573
|
+
}
|
|
574
|
+
})
|
|
575
|
+
})
|
|
576
|
+
}), groups.map(function (group) {
|
|
577
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
578
|
+
sx: {
|
|
579
|
+
display: "flex",
|
|
580
|
+
flexDirection: "column",
|
|
581
|
+
alignItems: "center",
|
|
582
|
+
gap: 0.5,
|
|
583
|
+
pt: 0.75,
|
|
584
|
+
mt: 0.25,
|
|
585
|
+
borderTop: "1px solid ".concat(_ui.COLORS.s2),
|
|
586
|
+
width: 40
|
|
587
|
+
},
|
|
588
|
+
children: group.services.map(function (service) {
|
|
589
|
+
var _statusName;
|
|
590
|
+
|
|
591
|
+
var active = service.service_name === selected;
|
|
592
|
+
var pending = (0, _model.isPendingFor)(service, userId);
|
|
593
|
+
var label = [service.display_name, (_statusName = (0, _ui.statusName)(service.status)) !== null && _statusName !== void 0 ? _statusName : service.status, pending ? "Te toca a ti" : null].filter(Boolean).join(" · ");
|
|
594
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
595
|
+
title: label,
|
|
596
|
+
arrow: true,
|
|
597
|
+
placement: tooltipPlacement,
|
|
598
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ButtonBase, {
|
|
599
|
+
"aria-label": label,
|
|
600
|
+
"aria-current": active ? "true" : undefined,
|
|
601
|
+
onClick: function onClick() {
|
|
602
|
+
return onSelect(service.service_name);
|
|
603
|
+
},
|
|
604
|
+
sx: iconButtonSx(active),
|
|
605
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ServiceIcon, {
|
|
606
|
+
icon: service.icon,
|
|
607
|
+
sx: {
|
|
608
|
+
fontSize: 22,
|
|
609
|
+
color: active ? _ui.COLORS.magenta_s2 : _ui.COLORS.s4
|
|
610
|
+
}
|
|
611
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
612
|
+
component: "span",
|
|
613
|
+
sx: {
|
|
614
|
+
position: "absolute",
|
|
615
|
+
top: 5,
|
|
616
|
+
right: 6,
|
|
617
|
+
width: 9,
|
|
618
|
+
height: 9,
|
|
619
|
+
borderRadius: "50%",
|
|
620
|
+
bgcolor: (0, _ui.serviceStatusColor)(service),
|
|
621
|
+
border: "2px solid ".concat(active ? _ui.COLORS.s2 : _ui.COLORS.white)
|
|
622
|
+
}
|
|
623
|
+
}), pending && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
624
|
+
component: "span",
|
|
625
|
+
sx: {
|
|
626
|
+
position: "absolute",
|
|
627
|
+
bottom: 4,
|
|
628
|
+
left: "50%",
|
|
629
|
+
transform: "translateX(-50%)",
|
|
630
|
+
width: 14,
|
|
631
|
+
height: 3,
|
|
632
|
+
borderRadius: "2px",
|
|
633
|
+
bgcolor: _ui.COLORS.magenta_s2
|
|
634
|
+
}
|
|
635
|
+
})]
|
|
636
|
+
})
|
|
637
|
+
}, service.service_name);
|
|
638
|
+
})
|
|
639
|
+
}, group.key);
|
|
640
|
+
})]
|
|
641
|
+
})]
|
|
642
|
+
});
|
|
643
|
+
};
|
|
644
|
+
/* ------------------------------------------------------------------------ */
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
var ServicesRail = function ServicesRail(_ref6) {
|
|
648
|
+
var _ref7;
|
|
649
|
+
|
|
650
|
+
var services = _ref6.services,
|
|
651
|
+
selected = _ref6.selected,
|
|
652
|
+
onSelect = _ref6.onSelect,
|
|
653
|
+
userId = _ref6.userId,
|
|
654
|
+
filter = _ref6.filter,
|
|
655
|
+
onFilterChange = _ref6.onFilterChange,
|
|
656
|
+
showFilter = _ref6.showFilter,
|
|
657
|
+
_ref6$collapsed = _ref6.collapsed,
|
|
658
|
+
collapsed = _ref6$collapsed === void 0 ? false : _ref6$collapsed,
|
|
659
|
+
onToggleCollapsed = _ref6.onToggleCollapsed,
|
|
660
|
+
onClose = _ref6.onClose,
|
|
661
|
+
_ref6$variant = _ref6.variant,
|
|
662
|
+
variant = _ref6$variant === void 0 ? "rail" : _ref6$variant,
|
|
663
|
+
_ref6$side = _ref6.side,
|
|
664
|
+
side = _ref6$side === void 0 ? "left" : _ref6$side;
|
|
665
|
+
var visible = showFilter && filter === "mine" ? services.filter(function (service) {
|
|
666
|
+
return (0, _model.isMine)(service, userId) || service.service_name === selected;
|
|
667
|
+
}) : services;
|
|
668
|
+
var isRail = variant === "rail";
|
|
669
|
+
var width = isRail ? collapsed ? RAIL_COLLAPSED_WIDTH : RAIL_WIDTH : "100%";
|
|
670
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
671
|
+
component: "nav",
|
|
672
|
+
"aria-label": "Servicios del producto",
|
|
673
|
+
sx: (_ref7 = {
|
|
674
|
+
width: width,
|
|
675
|
+
flexShrink: 0,
|
|
676
|
+
height: "100%",
|
|
677
|
+
minHeight: 0,
|
|
678
|
+
display: "flex",
|
|
679
|
+
flexDirection: "column",
|
|
680
|
+
bgcolor: _ui.COLORS.white
|
|
681
|
+
}, (0, _defineProperty2.default)(_ref7, side === "right" ? "borderLeft" : "borderRight", isRail ? "1px solid ".concat(_ui.COLORS.s2) : "none"), (0, _defineProperty2.default)(_ref7, "transition", "width 160ms ease"), (0, _defineProperty2.default)(_ref7, "overflow", "hidden"), (0, _defineProperty2.default)(_ref7, "fontFamily", _ui.FONT_STACK), _ref7),
|
|
682
|
+
children: isRail && collapsed ? /*#__PURE__*/(0, _jsxRuntime.jsx)(CollapsedRail, {
|
|
683
|
+
visible: visible,
|
|
684
|
+
selected: selected,
|
|
685
|
+
onSelect: onSelect,
|
|
686
|
+
userId: userId,
|
|
687
|
+
onExpand: onToggleCollapsed,
|
|
688
|
+
side: side
|
|
689
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(ExpandedRail, {
|
|
690
|
+
services: services,
|
|
691
|
+
visible: visible,
|
|
692
|
+
selected: selected,
|
|
693
|
+
onSelect: onSelect,
|
|
694
|
+
userId: userId,
|
|
695
|
+
filter: filter,
|
|
696
|
+
onFilterChange: onFilterChange,
|
|
697
|
+
showFilter: showFilter,
|
|
698
|
+
onCollapse: isRail ? onToggleCollapsed : undefined,
|
|
699
|
+
onClose: onClose,
|
|
700
|
+
side: side
|
|
701
|
+
})
|
|
702
|
+
});
|
|
703
|
+
};
|
|
704
|
+
|
|
705
|
+
exports.ServicesRail = ServicesRail;
|