contentoh-components-library 21.6.61 → 21.6.62

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 (88) hide show
  1. package/.claude/settings.local.json +7 -0
  2. package/dist/ai/prompts/attribute.prompt.js +28 -0
  3. package/dist/ai/prompts/description.prompt.js +33 -0
  4. package/dist/ai/schemas/attribute.schema.js +35 -0
  5. package/dist/ai/schemas/description.schema.js +27 -0
  6. package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +11 -5
  7. package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +58 -31
  8. package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +5 -1
  9. package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +3 -40
  10. package/dist/components/pages/CreatorsProductEdition/sections/ImagesSection.js +18 -3
  11. package/dist/components/pages/CreatorsProductEdition/sections/StatusChip.js +4 -13
  12. package/dist/components/pages/CreatorsProductEdition/sections/TabsBar.js +10 -0
  13. package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +10 -2
  14. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -15
  15. package/dist/components/pages/RetailerProductEdition/index.js +40 -57
  16. package/dist/components/pages/RetailerProductEdition/utils.js +2 -6
  17. package/dist/index.js +0 -13
  18. package/package.json +1 -1
  19. package/src/components/pages/CreatorsProductEdition/CreatorsProductEditionView.jsx +22 -3
  20. package/src/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +36 -1
  21. package/src/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +15 -3
  22. package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +8 -18
  23. package/src/components/pages/CreatorsProductEdition/sections/ImagesSection.jsx +24 -2
  24. package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +4 -8
  25. package/src/components/pages/CreatorsProductEdition/sections/TabsBar.jsx +9 -0
  26. package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +6 -0
  27. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +0 -12
  28. package/src/components/pages/RetailerProductEdition/index.js +3 -28
  29. package/src/components/pages/RetailerProductEdition/utils.js +0 -5
  30. package/src/index.js +0 -1
  31. package/dist/components/organisms/ServicesNavigation/ServiceToolbar.js +0 -210
  32. package/dist/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +0 -138
  33. package/dist/components/organisms/ServicesNavigation/ServicesRail.js +0 -705
  34. package/dist/components/organisms/ServicesNavigation/catalog.js +0 -505
  35. package/dist/components/organisms/ServicesNavigation/index.js +0 -337
  36. package/dist/components/organisms/ServicesNavigation/model.js +0 -167
  37. package/dist/components/organisms/ServicesNavigation/ui.js +0 -371
  38. package/dist/components/organisms/ServicesNavigation/views.js +0 -1237
  39. package/dist/components/organisms/ServicesWorkspace/AssigneePicker.js +0 -459
  40. package/dist/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +0 -119
  41. package/dist/components/organisms/ServicesWorkspace/demo.js +0 -137
  42. package/dist/components/organisms/ServicesWorkspace/index.js +0 -813
  43. package/dist/components/organisms/ServicesWorkspace/servicesModel.js +0 -351
  44. package/dist/components/organisms/ServicesWorkspace/tooltipStyles.js +0 -37
  45. package/dist/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +0 -387
  46. package/dist/components/pages/ProductEdition/ProductEdition.stories.js +0 -148
  47. package/dist/components/pages/ProductEdition/ProductEditionView.js +0 -1355
  48. package/dist/components/pages/ProductEdition/ServiceHeader.js +0 -142
  49. package/dist/components/pages/ProductEdition/api.js +0 -256
  50. package/dist/components/pages/ProductEdition/index.js +0 -37
  51. package/dist/components/pages/ProductEdition/permissions.js +0 -200
  52. package/dist/components/pages/ProductEdition/permissions.test.js +0 -320
  53. package/dist/components/pages/ProductEdition/sections/CatalogServicePanel.js +0 -237
  54. package/dist/components/pages/ProductEdition/sections/EditionTopBar.js +0 -174
  55. package/dist/components/pages/ProductEdition/sections/ImagePanel.js +0 -440
  56. package/dist/components/pages/ProductEdition/sections/ServiceTeam.js +0 -275
  57. package/dist/components/pages/ProductEdition/sections/ServiceTools.js +0 -186
  58. package/dist/components/pages/ProductEdition/services.js +0 -233
  59. package/dist/components/pages/ProductEdition/services.test.js +0 -195
  60. package/src/components/organisms/ServicesNavigation/ServiceToolbar.jsx +0 -143
  61. package/src/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +0 -101
  62. package/src/components/organisms/ServicesNavigation/ServicesRail.jsx +0 -591
  63. package/src/components/organisms/ServicesNavigation/catalog.js +0 -180
  64. package/src/components/organisms/ServicesNavigation/index.jsx +0 -232
  65. package/src/components/organisms/ServicesNavigation/model.js +0 -85
  66. package/src/components/organisms/ServicesNavigation/ui.jsx +0 -229
  67. package/src/components/organisms/ServicesNavigation/views.jsx +0 -705
  68. package/src/components/organisms/ServicesWorkspace/AssigneePicker.js +0 -348
  69. package/src/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +0 -61
  70. package/src/components/organisms/ServicesWorkspace/demo.js +0 -58
  71. package/src/components/organisms/ServicesWorkspace/index.js +0 -556
  72. package/src/components/organisms/ServicesWorkspace/servicesModel.js +0 -203
  73. package/src/components/organisms/ServicesWorkspace/tooltipStyles.js +0 -27
  74. package/src/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +0 -175
  75. package/src/components/pages/ProductEdition/ProductEdition.stories.js +0 -106
  76. package/src/components/pages/ProductEdition/ProductEditionView.jsx +0 -1142
  77. package/src/components/pages/ProductEdition/ServiceHeader.jsx +0 -104
  78. package/src/components/pages/ProductEdition/api.js +0 -84
  79. package/src/components/pages/ProductEdition/index.js +0 -21
  80. package/src/components/pages/ProductEdition/permissions.js +0 -128
  81. package/src/components/pages/ProductEdition/permissions.test.js +0 -249
  82. package/src/components/pages/ProductEdition/sections/CatalogServicePanel.jsx +0 -123
  83. package/src/components/pages/ProductEdition/sections/EditionTopBar.jsx +0 -134
  84. package/src/components/pages/ProductEdition/sections/ImagePanel.jsx +0 -342
  85. package/src/components/pages/ProductEdition/sections/ServiceTeam.jsx +0 -184
  86. package/src/components/pages/ProductEdition/sections/ServiceTools.jsx +0 -134
  87. package/src/components/pages/ProductEdition/services.js +0 -187
  88. package/src/components/pages/ProductEdition/services.test.js +0 -88
@@ -190,13 +190,21 @@ const buildFamily = (familia) => {
190
190
  /**
191
191
  * Crea las respuestas.
192
192
  * - `images: false` simula un producto sin imágenes.
193
+ * - `imagesService: false` simula un producto sin el servicio de imágenes
194
+ * contratado: sin su renglón en los servicios, el estatus queda en "NS".
193
195
  * - `delSolStatus` cambia el estatus de los tres servicios de Del Sol; con
194
196
  * "AC" el auditor asignado puede validar o rechazar.
195
197
  * - `familia`: "padre" (este producto con dos hijos) o "hijo" (este producto
196
198
  * es hijo de otro, con un hermano).
197
199
  * - `grupo`: el producto está en un grupo de variantes con otros dos.
198
200
  */
199
- export const buildFixtures = ({ images = true, delSolStatus, familia, grupo = false } = {}) => ({
201
+ export const buildFixtures = ({
202
+ images = true,
203
+ imagesService = true,
204
+ delSolStatus,
205
+ familia,
206
+ grupo = false,
207
+ } = {}) => ({
200
208
  comments: {
201
209
  description: lambda({ message: "OK", data: [comment(15886, "description", "Revisar la longitud del header.")], order: null }),
202
210
  datasheet: lambda({ message: "OK", data: [comment(15885, "datasheet", "Rechazo")], order: null }),
@@ -269,10 +277,14 @@ export const buildFixtures = ({ images = true, delSolStatus, familia, grupo = fa
269
277
  data: [
270
278
  service(36, "datasheet", "RA/AS", 2),
271
279
  service(36, "description", "RA/AS", 2),
272
- service(36, "images", "AA", 5),
273
280
  service(38, "datasheet", delSolStatus ?? "RA/AS", 2),
274
281
  service(38, "description", delSolStatus ?? "RA/AS", 2),
275
- service(38, "images", delSolStatus ?? "AA", 5),
282
+ ...(imagesService
283
+ ? [
284
+ service(36, "images", "AA", 5),
285
+ service(38, "images", delSolStatus ?? "AA", 5),
286
+ ]
287
+ : []),
276
288
  ],
277
289
  }),
278
290
  percentages: lambda([
@@ -2,7 +2,6 @@ import { useEffect, useState } from "react";
2
2
  import axios from "axios";
3
3
 
4
4
  import { buildFixtures } from "./api.fixtures";
5
- import { applyProductServicesChange, assignablesFor, buildProductServices } from "./productServices.fixtures";
6
5
 
7
6
  /*
8
7
  API falsa para las historias: reemplaza el adaptador de axios mientras la
@@ -37,17 +36,19 @@ const ok = { statusCode: 200, body: JSON.stringify({ message: "OK" }) };
37
36
 
38
37
  export const createMockAdapter = ({
39
38
  images = true,
39
+ imagesService = true,
40
40
  failLoad = false,
41
41
  delSolStatus,
42
42
  familia,
43
43
  grupo,
44
44
  } = {}) => {
45
- const fx = buildFixtures({ images, delSolStatus, familia, grupo });
46
- // Servicios del producto (edición unificada): con estado, para que un cambio
47
- // de estatus o de asignación se vea al volver a pedir la lista.
48
- const productServices = buildProductServices({ delSolStatus });
49
- const lambdaReply = (config, statusCode, body) =>
50
- reply(config, { statusCode, body: JSON.stringify(body) });
45
+ const fx = buildFixtures({
46
+ images,
47
+ imagesService,
48
+ delSolStatus,
49
+ familia,
50
+ grupo,
51
+ });
51
52
 
52
53
  return (config) => {
53
54
  const method = (config.method || "get").toUpperCase();
@@ -69,17 +70,6 @@ export const createMockAdapter = ({
69
70
  if (path === "variants/group") return reply(config, fx.group);
70
71
  if (method === "GET" && path === "services") return reply(config, fx.services);
71
72
  if (method === "GET" && path === "versions") return reply(config, fx.versions);
72
- if (method === "GET" && path === "product-services") return lambdaReply(config, 200, productServices);
73
- if (method === "PUT" && path.startsWith("product-services/")) {
74
- const action = path.split("/")[1];
75
- const data = typeof config.data === "string" ? JSON.parse(config.data) : config.data;
76
- const { statusCode, message } = applyProductServicesChange(productServices, action, data);
77
- console.info(`[mock API] PUT ${path}`, data);
78
- return lambdaReply(config, statusCode, statusCode === 200 ? { action, result: data } : { message });
79
- }
80
- if (method === "GET" && path === "service-catalog" && query.view === "assignables") {
81
- return lambdaReply(config, 200, { users: assignablesFor(query.assignment_role) });
82
- }
83
73
  if (path === "percentages") return reply(config, fx.percentages);
84
74
  // Sin versión auditable ni observación: con la API real de dev estas dos
85
75
  // fallan por CORS, así que la pantalla ya sabe vivir sin ellas.
@@ -38,9 +38,22 @@ const LIST_COLUMNS = [
38
38
  // de lado dentro de su caja en vez de aplastar las columnas.
39
39
  const LIST_MIN_WIDTH = 760;
40
40
 
41
- const TrayTabs = ({ activeTray, setActiveTray, imagesCount, assetsCount }) => {
41
+ const TrayTabs = ({
42
+ activeTray,
43
+ setActiveTray,
44
+ imagesCount,
45
+ assetsCount,
46
+ hasImagesService = true,
47
+ }) => {
42
48
  const trays = [
43
- { id: TRAYS.IMAGES, label: "Imágenes", count: imagesCount },
49
+ {
50
+ id: TRAYS.IMAGES,
51
+ label: "Imágenes",
52
+ count: imagesCount,
53
+ // Sin el servicio contratado no hay nada que mostrar en esa bandeja,
54
+ // pero se deja a la vista para que se entienda por qué.
55
+ disabled: !hasImagesService,
56
+ },
44
57
  { id: TRAYS.ASSETS, label: "Activos digitales", count: assetsCount },
45
58
  ];
46
59
  return (
@@ -58,6 +71,7 @@ const TrayTabs = ({ activeTray, setActiveTray, imagesCount, assetsCount }) => {
58
71
  <Tab
59
72
  key={tray.id}
60
73
  value={tray.id}
74
+ disabled={tray.disabled}
61
75
  disableRipple
62
76
  label={
63
77
  <Stack direction="row" alignItems="center" gap="6px">
@@ -87,6 +101,12 @@ const TrayTabs = ({ activeTray, setActiveTray, imagesCount, assetsCount }) => {
87
101
  letterSpacing: "-0.015em",
88
102
  color: COLORS.s4,
89
103
  "&.Mui-selected": { color: COLORS.s5, fontWeight: 600 },
104
+ // Igual que en `TabsBar`: el tema de Creators las pinta de rosa
105
+ // al pasar el ratón y aquí no se quiere.
106
+ "&:hover, &.Mui-selected:hover": {
107
+ color: COLORS.s5,
108
+ backgroundColor: "transparent",
109
+ },
90
110
  }}
91
111
  />
92
112
  );
@@ -167,6 +187,7 @@ export const ImagesSection = ({
167
187
  imageLayout,
168
188
  // bandejas
169
189
  enableDigitalAssets,
190
+ hasImagesService = true,
170
191
  currentTray,
171
192
  setActiveTray,
172
193
  digitalAssets,
@@ -230,6 +251,7 @@ export const ImagesSection = ({
230
251
  setActiveTray={setActiveTray}
231
252
  imagesCount={images.length}
232
253
  assetsCount={digitalAssets?.assets?.length ?? 0}
254
+ hasImagesService={hasImagesService}
233
255
  />
234
256
  )}
235
257
 
@@ -6,13 +6,9 @@ import { COLORS, FONTS, statusColor, statusName } from "./tokens";
6
6
  * Etiqueta de estatus ("RA/AS", "AA"...). Mismo color y tamaño que
7
7
  * `atoms/Status`; el nombre completo va en el tooltip. `oval` es la variante
8
8
  * redondeada de la barra de pestañas.
9
- *
10
- * `label`, `color` y `title` (opcionales) reemplazan el texto, el color y el
11
- * tooltip: los estatus de los flujos simples del catálogo (Pendiente, Hecho…)
12
- * traen los suyos desde el backend.
13
9
  */
14
- export const StatusChip = ({ status, oval = false, label: labelProp, color, title }) => {
15
- const label = labelProp ?? status ?? "NS";
10
+ export const StatusChip = ({ status, oval = false }) => {
11
+ const label = status ?? "NS";
16
12
  const chip = (
17
13
  <Chip
18
14
  label={label}
@@ -20,7 +16,7 @@ export const StatusChip = ({ status, oval = false, label: labelProp, color, titl
20
16
  sx={{
21
17
  height: 20,
22
18
  borderRadius: oval ? "10px" : "3px",
23
- backgroundColor: color ?? statusColor(status),
19
+ backgroundColor: statusColor(status),
24
20
  color: COLORS.white,
25
21
  fontFamily: FONTS.Lato,
26
22
  fontSize: 12,
@@ -30,7 +26,7 @@ export const StatusChip = ({ status, oval = false, label: labelProp, color, titl
30
26
  />
31
27
  );
32
28
 
33
- const name = title ?? statusName(status);
29
+ const name = statusName(status);
34
30
  return name ? (
35
31
  <Tooltip title={name} arrow placement="top">
36
32
  {chip}
@@ -44,6 +44,15 @@ const tabSx = {
44
44
  borderBottom: `2px solid ${COLORS.s3}`,
45
45
  transition: "font-size 0.1s",
46
46
  "&.Mui-selected": { color: COLORS.s5, fontSize: { xs: 14, sm: 18 } },
47
+ /*
48
+ El tema de MUI de Creators pinta las pestañas de rosa al pasar el ratón
49
+ (`MuiTab.styleOverrides.root`). Aquí no se quiere ese realce, y la librería
50
+ no debe depender del tema de quien la consume: se anula explícitamente.
51
+ */
52
+ "&:hover, &.Mui-selected:hover": {
53
+ color: COLORS.s5,
54
+ backgroundColor: "transparent",
55
+ },
47
56
  };
48
57
 
49
58
  export const TabsBar = ({
@@ -102,6 +102,12 @@ HijoDeOtro.decorators = [withMockApi({ familia: "hijo" })];
102
102
 
103
103
  // --- Casos límite -----------------------------------------------------------
104
104
 
105
+ // Producto sin el servicio de imágenes contratado: la bandeja de imágenes
106
+ // queda deshabilitada y la de activos digitales sigue siendo utilizable.
107
+ export const SinServicioDeImagenes = Template.bind({});
108
+ SinServicioDeImagenes.args = AuditorQA.args;
109
+ SinServicioDeImagenes.decorators = [withMockApi({ imagesService: false })];
110
+
105
111
  export const SinImagenes = Template.bind({});
106
112
  SinImagenes.args = EspecialistaImagenes.args;
107
113
  SinImagenes.decorators = [withMockApi({ images: false })];
@@ -1,5 +1,4 @@
1
1
  import { RetailerProductEdition } from "./index";
2
- import { withDemoServices } from "../../organisms/ServicesWorkspace/demo";
3
2
 
4
3
  export default {
5
4
  title: "Components/pages/RetailerProductEdition",
@@ -218,14 +217,3 @@ user: {
218
217
  }
219
218
 
220
219
  };
221
-
222
- /**
223
- * Con la pestaña "Servicios" (la activa Creators con `showServicesTab`) y
224
- * servicios de ejemplo además de los tres de siempre.
225
- */
226
- export const ConPestanaServicios = Template.bind({});
227
- ConPestanaServicios.args = {
228
- ...RetailerProductEditionDefault.args,
229
- showServicesTab: true,
230
- productSelected: withDemoServices(RetailerProductEditionDefault.args.productSelected, 14),
231
- };
@@ -1,4 +1,4 @@
1
- import { useEffect, useMemo, useRef, useState } from "react";
1
+ import { useEffect, useRef, useState } from "react";
2
2
 
3
3
  import axios from "axios";
4
4
  import { useDropzone } from "react-dropzone";
@@ -74,7 +74,6 @@ import generateThumbnail from "./generateThumnail";
74
74
 
75
75
  import { AiProductEditionProvider } from "../../../contexts/AiProductEdition";
76
76
  import ChangeStatusModal from "../../organisms/ChangeStatusModal";
77
- import ServicesWorkspace from "../../organisms/ServicesWorkspace";
78
77
 
79
78
  import { Skeleton, Box, Stack } from "@mui/material";
80
79
 
@@ -106,14 +105,8 @@ function obtenerDuracionVideoBase64(base64Data) {
106
105
  });
107
106
  }
108
107
 
109
- /** Pestaña con todos los servicios del producto (ver organisms/ServicesWorkspace). */
110
- const SERVICES_TAB = "Servicios";
111
-
112
108
  const RetailerProductEditionView = ({
113
109
  tabsSections,
114
- // Opcional para no cambiar la edición de quien no la pida (aplicación de
115
- // proveedores). Creators la activa.
116
- showServicesTab = false,
117
110
  productSelected = {},
118
111
  user = {},
119
112
  token,
@@ -141,13 +134,6 @@ const RetailerProductEditionView = ({
141
134
 
142
135
  const isRetailer = user?.is_retailer;
143
136
 
144
- const tabs = useMemo(
145
- () =>
146
- showServicesTab ? { ...tabsSections, [SERVICES_TAB]: false } : tabsSections,
147
- [tabsSections, showServicesTab],
148
- );
149
- const isServicesTab = state.active_tab === SERVICES_TAB;
150
-
151
137
  const [showVersionSelector, setShowVersionSelector] =
152
138
  useCloseModal("version-selector");
153
139
  const [auditableVersion, setAuditableVersion] = useState(null);
@@ -2942,7 +2928,7 @@ const RetailerProductEditionView = ({
2942
2928
  }
2943
2929
  />
2944
2930
  <FullTabsMenu
2945
- tabsSections={tabs}
2931
+ tabsSections={tabsSections}
2946
2932
  status={getStatusByCurrentServiceAndRetailer()}
2947
2933
  activeTab={state.active_tab}
2948
2934
  isRetailer={isRetailer}
@@ -2989,14 +2975,6 @@ const RetailerProductEditionView = ({
2989
2975
  <Loading />
2990
2976
  ) : (
2991
2977
  <>
2992
- {isServicesTab && (
2993
- <ServicesWorkspace
2994
- product={state.product}
2995
- retailers={state.product?.categoryRetailerInOrder ?? []}
2996
- canAssign={![7, 8].includes(user.id_role)}
2997
- onOpenEditor={handleOnChangeActiveTab}
2998
- />
2999
- )}
3000
2978
  {state.active_tab === "Descripción" &&
3001
2979
  (state.product?.description_status !== "NS" ? (
3002
2980
  <InputGroup
@@ -3172,10 +3150,7 @@ const RetailerProductEditionView = ({
3172
3150
  </>
3173
3151
  )}
3174
3152
  </div>
3175
- {/* Comentario y cambio de estatus son de un servicio con editor;
3176
- en la pestaña Servicios cada servicio lleva su propio detalle. */}
3177
- {!isServicesTab &&
3178
- (isUserAssignedToService(state.active_tab) ||
3153
+ {(isUserAssignedToService(state.active_tab) ||
3179
3154
  isAuditorAssigned()) &&
3180
3155
  state.product[`${getConceptByTab(state.active_tab)}_status`] !==
3181
3156
  "NS" && (
@@ -148,11 +148,6 @@ export const normalizeProduct = (product) => {
148
148
  id_auditor: article.id_auditor || 0,
149
149
  statusByRetailer: productData.statusByRetailer || null,
150
150
  categoryRetailerInOrder: categoryRetailerInOrder || null,
151
-
152
- // Servicios para la pestaña "Servicios": estatus por servicio del listado
153
- // ligero de Creators (view=summary) y, en modo demo, los de ejemplo.
154
- serviceStatuses: productData.serviceStatuses ?? null,
155
- demo_services: productData.demo_services ?? null,
156
151
  };
157
152
  };
158
153
 
package/src/index.js CHANGED
@@ -116,7 +116,6 @@ export * from "./components/pages/RegistrationLoginSecondStep";
116
116
  export * from "./components/pages/RegistrationLoginThirdStep";
117
117
  export * from "./components/pages/RetailerProductEdition";
118
118
  export * from "./components/pages/CreatorsProductEdition";
119
- export * from "./components/pages/ProductEdition";
120
119
  export * from "./components/pages/ProviderProductEdition";
121
120
  export * from "./components/pages/VerificationCodeResetPassword";
122
121
  export * from "./components/pages/MultipleEdition";
@@ -1,210 +0,0 @@
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.ServiceToolbar = void 0;
9
-
10
- var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
11
-
12
- var _material = require("@mui/material");
13
-
14
- var _Menu = _interopRequireDefault(require("@mui/icons-material/Menu"));
15
-
16
- var _SaveOutlined = _interopRequireDefault(require("@mui/icons-material/SaveOutlined"));
17
-
18
- var _ui = require("./ui");
19
-
20
- var _model = require("./model");
21
-
22
- var _jsxRuntime = require("react/jsx-runtime");
23
-
24
- /*
25
- Barra del servicio abierto. Ocupa el lugar de la barra de pestañas: dice en
26
- qué servicio estás, su estatus y su equipo, y lleva la acción de guardar.
27
- No hay botón de «siguiente»: quien produce ya sabe qué le toca, y la lista
28
- lateral lo marca con el punto rosa.
29
- */
30
- var Team = function Team(_ref) {
31
- var _ref$assignees = _ref.assignees,
32
- assignees = _ref$assignees === void 0 ? {} : _ref$assignees,
33
- userId = _ref.userId;
34
- return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
35
- direction: "row",
36
- alignItems: "center",
37
- spacing: 1.5,
38
- sx: {
39
- flexWrap: "wrap",
40
- rowGap: 0.5
41
- },
42
- children: Object.entries(_model.ROLE_LABELS).map(function (_ref2) {
43
- var _ref3 = (0, _slicedToArray2.default)(_ref2, 2),
44
- role = _ref3[0],
45
- label = _ref3[1];
46
-
47
- var user = assignees[role];
48
- var isMe = Boolean(user) && user.id_user === userId;
49
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
50
- direction: "row",
51
- alignItems: "center",
52
- spacing: 0.75,
53
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.PersonAvatar, {
54
- user: user,
55
- isMe: isMe,
56
- size: 24,
57
- title: user ? "".concat(label, ": ").concat((0, _model.fullName)(user)) : "".concat(label, ": sin asignar")
58
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
59
- sx: {
60
- lineHeight: 1.1
61
- },
62
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
63
- sx: {
64
- fontFamily: _ui.FONT_STACK,
65
- fontSize: 10,
66
- color: _ui.COLORS.s4,
67
- textTransform: "uppercase",
68
- letterSpacing: "0.05em"
69
- },
70
- children: label
71
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
72
- sx: {
73
- fontFamily: _ui.FONT_STACK,
74
- fontSize: 12,
75
- fontWeight: isMe ? 700 : 400,
76
- color: user ? _ui.COLORS.s5 : _ui.COLORS.s3
77
- },
78
- children: user ? isMe ? "Tú" : user.name : "Sin asignar"
79
- })]
80
- })]
81
- }, role);
82
- })
83
- });
84
- };
85
-
86
- var ServiceToolbar = function ServiceToolbar(_ref4) {
87
- var service = _ref4.service,
88
- _ref4$isSummary = _ref4.isSummary,
89
- isSummary = _ref4$isSummary === void 0 ? false : _ref4$isSummary,
90
- summaryCounts = _ref4.summaryCounts,
91
- onOpenRail = _ref4.onOpenRail,
92
- userId = _ref4.userId;
93
- var canSave = !isSummary && service && (0, _model.isMine)(service, userId);
94
- return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
95
- sx: {
96
- display: "flex",
97
- flexWrap: "wrap",
98
- alignItems: "center",
99
- columnGap: 2,
100
- rowGap: 1.25,
101
- pb: 1.5,
102
- mb: 2,
103
- borderBottom: "2px solid ".concat(_ui.COLORS.s2)
104
- },
105
- children: [onOpenRail && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
106
- onClick: onOpenRail,
107
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Menu.default, {
108
- sx: {
109
- fontSize: 18
110
- }
111
- }),
112
- sx: _ui.outlineButtonSx,
113
- children: "Servicios"
114
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
115
- direction: "row",
116
- alignItems: "center",
117
- spacing: 1.25,
118
- sx: {
119
- minWidth: 0,
120
- flex: "1 1 260px"
121
- },
122
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
123
- sx: {
124
- width: 36,
125
- height: 36,
126
- borderRadius: "10px",
127
- bgcolor: _ui.COLORS.s2,
128
- display: "flex",
129
- alignItems: "center",
130
- justifyContent: "center",
131
- flexShrink: 0
132
- },
133
- children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.ServiceIcon, {
134
- icon: isSummary ? "summary" : service === null || service === void 0 ? void 0 : service.icon,
135
- sx: {
136
- fontSize: 20,
137
- color: _ui.COLORS.magenta_s2
138
- }
139
- })
140
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Box, {
141
- sx: {
142
- minWidth: 0
143
- },
144
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
145
- sx: {
146
- fontFamily: _ui.FONT_STACK,
147
- fontSize: 11,
148
- fontWeight: 700,
149
- letterSpacing: "0.06em",
150
- textTransform: "uppercase",
151
- color: _ui.COLORS.s4
152
- },
153
- children: isSummary ? "Todos los servicios" : (0, _model.groupLabel)(service === null || service === void 0 ? void 0 : service.group)
154
- }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
155
- direction: "row",
156
- alignItems: "center",
157
- spacing: 1,
158
- sx: {
159
- minWidth: 0
160
- },
161
- children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
162
- component: "h3",
163
- sx: {
164
- fontFamily: _ui.TITLE_STACK,
165
- fontWeight: 500,
166
- fontSize: 20,
167
- lineHeight: "26px",
168
- color: _ui.COLORS.s5,
169
- overflow: "hidden",
170
- textOverflow: "ellipsis",
171
- whiteSpace: "nowrap"
172
- },
173
- children: isSummary ? "Resumen" : service === null || service === void 0 ? void 0 : service.display_name
174
- }), !isSummary && service && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ui.StatusChip, {
175
- status: service.status,
176
- oval: true
177
- })]
178
- })]
179
- })]
180
- }), isSummary ? summaryCounts && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Typography, {
181
- sx: {
182
- fontFamily: _ui.FONT_STACK,
183
- fontSize: 13,
184
- color: _ui.COLORS.s4
185
- },
186
- children: [summaryCounts.total, " servicios \xB7 ", summaryCounts.pending, " te", " ", summaryCounts.pending === 1 ? "toca" : "tocan", " a ti"]
187
- }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(Team, {
188
- assignees: service === null || service === void 0 ? void 0 : service.assignees,
189
- userId: userId
190
- }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Stack, {
191
- direction: "row",
192
- spacing: 1,
193
- sx: {
194
- ml: "auto"
195
- },
196
- children: canSave && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Button, {
197
- variant: "contained",
198
- startIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_SaveOutlined.default, {
199
- sx: {
200
- fontSize: 18
201
- }
202
- }),
203
- sx: _ui.primaryButtonSx,
204
- children: "Guardar"
205
- })
206
- })]
207
- });
208
- };
209
-
210
- exports.ServiceToolbar = ServiceToolbar;