contentoh-components-library 21.6.61 → 21.6.63
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/.claude/settings.local.json +7 -0
- package/dist/ai/prompts/attribute.prompt.js +28 -0
- package/dist/ai/prompts/description.prompt.js +33 -0
- package/dist/ai/schemas/attribute.schema.js +35 -0
- package/dist/ai/schemas/description.schema.js +27 -0
- package/dist/components/atoms/MetricCard/index.js +3 -1
- package/dist/components/organisms/DashboardMetric/DashboardMetric.stories.js +12 -2
- package/dist/components/organisms/DashboardMetric/index.js +24 -1
- package/dist/components/organisms/DashboardMetric/styles.js +1 -1
- package/dist/components/pages/CreatorsProductEdition/CreatorsProductEditionView.js +11 -5
- package/dist/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +58 -31
- package/dist/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +5 -1
- package/dist/components/pages/CreatorsProductEdition/mocks/mockApi.js +3 -40
- package/dist/components/pages/CreatorsProductEdition/sections/ImagesSection.js +18 -3
- package/dist/components/pages/CreatorsProductEdition/sections/StatusChip.js +4 -13
- package/dist/components/pages/CreatorsProductEdition/sections/TabsBar.js +10 -0
- package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +10 -2
- package/dist/components/pages/Dashboard/dashboardUtils.js +3 -3
- package/dist/components/pages/Dashboard/index.js +102 -88
- package/dist/components/pages/Dashboard/styles.js +1 -1
- package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +2 -15
- package/dist/components/pages/RetailerProductEdition/index.js +40 -57
- package/dist/components/pages/RetailerProductEdition/utils.js +2 -6
- package/dist/index.js +0 -13
- package/package.json +1 -1
- package/src/components/atoms/MetricCard/index.js +2 -2
- package/src/components/organisms/DashboardMetric/DashboardMetric.stories.js +11 -0
- package/src/components/organisms/DashboardMetric/index.js +13 -1
- package/src/components/organisms/DashboardMetric/styles.js +13 -0
- package/src/components/pages/CreatorsProductEdition/CreatorsProductEditionView.jsx +22 -3
- package/src/components/pages/CreatorsProductEdition/hooks/useCreatorsProductEdition.js +36 -1
- package/src/components/pages/CreatorsProductEdition/mocks/api.fixtures.js +15 -3
- package/src/components/pages/CreatorsProductEdition/mocks/mockApi.js +8 -18
- package/src/components/pages/CreatorsProductEdition/sections/ImagesSection.jsx +24 -2
- package/src/components/pages/CreatorsProductEdition/sections/StatusChip.jsx +4 -8
- package/src/components/pages/CreatorsProductEdition/sections/TabsBar.jsx +9 -0
- package/src/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js +6 -0
- package/src/components/pages/Dashboard/dashboardUtils.js +3 -3
- package/src/components/pages/Dashboard/index.js +62 -106
- package/src/components/pages/Dashboard/styles.js +17 -12
- package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +0 -12
- package/src/components/pages/RetailerProductEdition/index.js +3 -28
- package/src/components/pages/RetailerProductEdition/utils.js +0 -5
- package/src/index.js +0 -1
- package/dist/components/organisms/ServicesNavigation/ServiceToolbar.js +0 -210
- package/dist/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +0 -138
- package/dist/components/organisms/ServicesNavigation/ServicesRail.js +0 -705
- package/dist/components/organisms/ServicesNavigation/catalog.js +0 -505
- package/dist/components/organisms/ServicesNavigation/index.js +0 -337
- package/dist/components/organisms/ServicesNavigation/model.js +0 -167
- package/dist/components/organisms/ServicesNavigation/ui.js +0 -371
- package/dist/components/organisms/ServicesNavigation/views.js +0 -1237
- package/dist/components/organisms/ServicesWorkspace/AssigneePicker.js +0 -459
- package/dist/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +0 -119
- package/dist/components/organisms/ServicesWorkspace/demo.js +0 -137
- package/dist/components/organisms/ServicesWorkspace/index.js +0 -813
- package/dist/components/organisms/ServicesWorkspace/servicesModel.js +0 -351
- package/dist/components/organisms/ServicesWorkspace/tooltipStyles.js +0 -37
- package/dist/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +0 -387
- package/dist/components/pages/ProductEdition/ProductEdition.stories.js +0 -148
- package/dist/components/pages/ProductEdition/ProductEditionView.js +0 -1355
- package/dist/components/pages/ProductEdition/ServiceHeader.js +0 -142
- package/dist/components/pages/ProductEdition/api.js +0 -256
- package/dist/components/pages/ProductEdition/index.js +0 -37
- package/dist/components/pages/ProductEdition/permissions.js +0 -200
- package/dist/components/pages/ProductEdition/permissions.test.js +0 -320
- package/dist/components/pages/ProductEdition/sections/CatalogServicePanel.js +0 -237
- package/dist/components/pages/ProductEdition/sections/EditionTopBar.js +0 -174
- package/dist/components/pages/ProductEdition/sections/ImagePanel.js +0 -440
- package/dist/components/pages/ProductEdition/sections/ServiceTeam.js +0 -275
- package/dist/components/pages/ProductEdition/sections/ServiceTools.js +0 -186
- package/dist/components/pages/ProductEdition/services.js +0 -233
- package/dist/components/pages/ProductEdition/services.test.js +0 -195
- package/src/components/organisms/ServicesNavigation/ServiceToolbar.jsx +0 -143
- package/src/components/organisms/ServicesNavigation/ServicesNavigation.stories.js +0 -101
- package/src/components/organisms/ServicesNavigation/ServicesRail.jsx +0 -591
- package/src/components/organisms/ServicesNavigation/catalog.js +0 -180
- package/src/components/organisms/ServicesNavigation/index.jsx +0 -232
- package/src/components/organisms/ServicesNavigation/model.js +0 -85
- package/src/components/organisms/ServicesNavigation/ui.jsx +0 -229
- package/src/components/organisms/ServicesNavigation/views.jsx +0 -705
- package/src/components/organisms/ServicesWorkspace/AssigneePicker.js +0 -348
- package/src/components/organisms/ServicesWorkspace/ServicesWorkspace.stories.js +0 -61
- package/src/components/organisms/ServicesWorkspace/demo.js +0 -58
- package/src/components/organisms/ServicesWorkspace/index.js +0 -556
- package/src/components/organisms/ServicesWorkspace/servicesModel.js +0 -203
- package/src/components/organisms/ServicesWorkspace/tooltipStyles.js +0 -27
- package/src/components/pages/CreatorsProductEdition/mocks/productServices.fixtures.js +0 -175
- package/src/components/pages/ProductEdition/ProductEdition.stories.js +0 -106
- package/src/components/pages/ProductEdition/ProductEditionView.jsx +0 -1142
- package/src/components/pages/ProductEdition/ServiceHeader.jsx +0 -104
- package/src/components/pages/ProductEdition/api.js +0 -84
- package/src/components/pages/ProductEdition/index.js +0 -21
- package/src/components/pages/ProductEdition/permissions.js +0 -128
- package/src/components/pages/ProductEdition/permissions.test.js +0 -249
- package/src/components/pages/ProductEdition/sections/CatalogServicePanel.jsx +0 -123
- package/src/components/pages/ProductEdition/sections/EditionTopBar.jsx +0 -134
- package/src/components/pages/ProductEdition/sections/ImagePanel.jsx +0 -342
- package/src/components/pages/ProductEdition/sections/ServiceTeam.jsx +0 -184
- package/src/components/pages/ProductEdition/sections/ServiceTools.jsx +0 -134
- package/src/components/pages/ProductEdition/services.js +0 -187
- package/src/components/pages/ProductEdition/services.test.js +0 -88
|
@@ -17,8 +17,6 @@ var _axios = _interopRequireDefault(require("axios"));
|
|
|
17
17
|
|
|
18
18
|
var _api = require("./api.fixtures");
|
|
19
19
|
|
|
20
|
-
var _productServices = require("./productServices.fixtures");
|
|
21
|
-
|
|
22
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
21
|
|
|
24
22
|
/*
|
|
@@ -80,6 +78,8 @@ var createMockAdapter = function createMockAdapter() {
|
|
|
80
78
|
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
81
79
|
_ref$images = _ref.images,
|
|
82
80
|
images = _ref$images === void 0 ? true : _ref$images,
|
|
81
|
+
_ref$imagesService = _ref.imagesService,
|
|
82
|
+
imagesService = _ref$imagesService === void 0 ? true : _ref$imagesService,
|
|
83
83
|
_ref$failLoad = _ref.failLoad,
|
|
84
84
|
failLoad = _ref$failLoad === void 0 ? false : _ref$failLoad,
|
|
85
85
|
delSolStatus = _ref.delSolStatus,
|
|
@@ -88,23 +88,11 @@ var createMockAdapter = function createMockAdapter() {
|
|
|
88
88
|
|
|
89
89
|
var fx = (0, _api.buildFixtures)({
|
|
90
90
|
images: images,
|
|
91
|
+
imagesService: imagesService,
|
|
91
92
|
delSolStatus: delSolStatus,
|
|
92
93
|
familia: familia,
|
|
93
94
|
grupo: grupo
|
|
94
|
-
}); // Servicios del producto (edición unificada): con estado, para que un cambio
|
|
95
|
-
// de estatus o de asignación se vea al volver a pedir la lista.
|
|
96
|
-
|
|
97
|
-
var productServices = (0, _productServices.buildProductServices)({
|
|
98
|
-
delSolStatus: delSolStatus
|
|
99
95
|
});
|
|
100
|
-
|
|
101
|
-
var lambdaReply = function lambdaReply(config, statusCode, body) {
|
|
102
|
-
return reply(config, {
|
|
103
|
-
statusCode: statusCode,
|
|
104
|
-
body: JSON.stringify(body)
|
|
105
|
-
});
|
|
106
|
-
};
|
|
107
|
-
|
|
108
96
|
return function (config) {
|
|
109
97
|
var _fx$comments$query$co, _fx$users$query$fetch;
|
|
110
98
|
|
|
@@ -140,31 +128,6 @@ var createMockAdapter = function createMockAdapter() {
|
|
|
140
128
|
if (path === "variants/group") return reply(config, fx.group);
|
|
141
129
|
if (method === "GET" && path === "services") return reply(config, fx.services);
|
|
142
130
|
if (method === "GET" && path === "versions") return reply(config, fx.versions);
|
|
143
|
-
if (method === "GET" && path === "product-services") return lambdaReply(config, 200, productServices);
|
|
144
|
-
|
|
145
|
-
if (method === "PUT" && path.startsWith("product-services/")) {
|
|
146
|
-
var action = path.split("/")[1];
|
|
147
|
-
var data = typeof config.data === "string" ? JSON.parse(config.data) : config.data;
|
|
148
|
-
|
|
149
|
-
var _applyProductServices = (0, _productServices.applyProductServicesChange)(productServices, action, data),
|
|
150
|
-
statusCode = _applyProductServices.statusCode,
|
|
151
|
-
message = _applyProductServices.message;
|
|
152
|
-
|
|
153
|
-
console.info("[mock API] PUT ".concat(path), data);
|
|
154
|
-
return lambdaReply(config, statusCode, statusCode === 200 ? {
|
|
155
|
-
action: action,
|
|
156
|
-
result: data
|
|
157
|
-
} : {
|
|
158
|
-
message: message
|
|
159
|
-
});
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
if (method === "GET" && path === "service-catalog" && query.view === "assignables") {
|
|
163
|
-
return lambdaReply(config, 200, {
|
|
164
|
-
users: (0, _productServices.assignablesFor)(query.assignment_role)
|
|
165
|
-
});
|
|
166
|
-
}
|
|
167
|
-
|
|
168
131
|
if (path === "percentages") return reply(config, fx.percentages); // Sin versión auditable ni observación: con la API real de dev estas dos
|
|
169
132
|
// fallan por CORS, así que la pantalla ya sabe vivir sin ellas.
|
|
170
133
|
|
|
@@ -65,11 +65,16 @@ var TrayTabs = function TrayTabs(_ref) {
|
|
|
65
65
|
var activeTray = _ref.activeTray,
|
|
66
66
|
setActiveTray = _ref.setActiveTray,
|
|
67
67
|
imagesCount = _ref.imagesCount,
|
|
68
|
-
assetsCount = _ref.assetsCount
|
|
68
|
+
assetsCount = _ref.assetsCount,
|
|
69
|
+
_ref$hasImagesService = _ref.hasImagesService,
|
|
70
|
+
hasImagesService = _ref$hasImagesService === void 0 ? true : _ref$hasImagesService;
|
|
69
71
|
var trays = [{
|
|
70
72
|
id: _GalleryTrayTabs.TRAYS.IMAGES,
|
|
71
73
|
label: "Imágenes",
|
|
72
|
-
count: imagesCount
|
|
74
|
+
count: imagesCount,
|
|
75
|
+
// Sin el servicio contratado no hay nada que mostrar en esa bandeja,
|
|
76
|
+
// pero se deja a la vista para que se entienda por qué.
|
|
77
|
+
disabled: !hasImagesService
|
|
73
78
|
}, {
|
|
74
79
|
id: _GalleryTrayTabs.TRAYS.ASSETS,
|
|
75
80
|
label: "Activos digitales",
|
|
@@ -96,6 +101,7 @@ var TrayTabs = function TrayTabs(_ref) {
|
|
|
96
101
|
var active = tray.id === activeTray;
|
|
97
102
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tab, {
|
|
98
103
|
value: tray.id,
|
|
104
|
+
disabled: tray.disabled,
|
|
99
105
|
disableRipple: true,
|
|
100
106
|
label: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Stack, {
|
|
101
107
|
direction: "row",
|
|
@@ -129,6 +135,12 @@ var TrayTabs = function TrayTabs(_ref) {
|
|
|
129
135
|
"&.Mui-selected": {
|
|
130
136
|
color: _tokens.COLORS.s5,
|
|
131
137
|
fontWeight: 600
|
|
138
|
+
},
|
|
139
|
+
// Igual que en `TabsBar`: el tema de Creators las pinta de rosa
|
|
140
|
+
// al pasar el ratón y aquí no se quiere.
|
|
141
|
+
"&:hover, &.Mui-selected:hover": {
|
|
142
|
+
color: _tokens.COLORS.s5,
|
|
143
|
+
backgroundColor: "transparent"
|
|
132
144
|
}
|
|
133
145
|
}
|
|
134
146
|
}, tray.id);
|
|
@@ -223,6 +235,8 @@ var ImagesSection = function ImagesSection(_ref3) {
|
|
|
223
235
|
selectedImages = _ref3.selectedImages,
|
|
224
236
|
imageLayout = _ref3.imageLayout,
|
|
225
237
|
enableDigitalAssets = _ref3.enableDigitalAssets,
|
|
238
|
+
_ref3$hasImagesServic = _ref3.hasImagesService,
|
|
239
|
+
hasImagesService = _ref3$hasImagesServic === void 0 ? true : _ref3$hasImagesServic,
|
|
226
240
|
currentTray = _ref3.currentTray,
|
|
227
241
|
setActiveTray = _ref3.setActiveTray,
|
|
228
242
|
digitalAssets = _ref3.digitalAssets,
|
|
@@ -293,7 +307,8 @@ var ImagesSection = function ImagesSection(_ref3) {
|
|
|
293
307
|
activeTray: currentTray,
|
|
294
308
|
setActiveTray: setActiveTray,
|
|
295
309
|
imagesCount: images.length,
|
|
296
|
-
assetsCount: (_digitalAssets$assets = digitalAssets === null || digitalAssets === void 0 ? void 0 : (_digitalAssets$assets2 = digitalAssets.assets) === null || _digitalAssets$assets2 === void 0 ? void 0 : _digitalAssets$assets2.length) !== null && _digitalAssets$assets !== void 0 ? _digitalAssets$assets : 0
|
|
310
|
+
assetsCount: (_digitalAssets$assets = digitalAssets === null || digitalAssets === void 0 ? void 0 : (_digitalAssets$assets2 = digitalAssets.assets) === null || _digitalAssets$assets2 === void 0 ? void 0 : _digitalAssets$assets2.length) !== null && _digitalAssets$assets !== void 0 ? _digitalAssets$assets : 0,
|
|
311
|
+
hasImagesService: hasImagesService
|
|
297
312
|
}), currentTray === _GalleryTrayTabs.TRAYS.ASSETS && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
|
298
313
|
sx: {
|
|
299
314
|
position: "relative",
|
|
@@ -15,28 +15,19 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
15
15
|
* Etiqueta de estatus ("RA/AS", "AA"...). Mismo color y tamaño que
|
|
16
16
|
* `atoms/Status`; el nombre completo va en el tooltip. `oval` es la variante
|
|
17
17
|
* redondeada de la barra de pestañas.
|
|
18
|
-
*
|
|
19
|
-
* `label`, `color` y `title` (opcionales) reemplazan el texto, el color y el
|
|
20
|
-
* tooltip: los estatus de los flujos simples del catálogo (Pendiente, Hecho…)
|
|
21
|
-
* traen los suyos desde el backend.
|
|
22
18
|
*/
|
|
23
19
|
var StatusChip = function StatusChip(_ref) {
|
|
24
|
-
var _ref2;
|
|
25
|
-
|
|
26
20
|
var status = _ref.status,
|
|
27
21
|
_ref$oval = _ref.oval,
|
|
28
|
-
oval = _ref$oval === void 0 ? false : _ref$oval
|
|
29
|
-
|
|
30
|
-
color = _ref.color,
|
|
31
|
-
title = _ref.title;
|
|
32
|
-
var label = (_ref2 = labelProp !== null && labelProp !== void 0 ? labelProp : status) !== null && _ref2 !== void 0 ? _ref2 : "NS";
|
|
22
|
+
oval = _ref$oval === void 0 ? false : _ref$oval;
|
|
23
|
+
var label = status !== null && status !== void 0 ? status : "NS";
|
|
33
24
|
var chip = /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Chip, {
|
|
34
25
|
label: label,
|
|
35
26
|
size: "small",
|
|
36
27
|
sx: {
|
|
37
28
|
height: 20,
|
|
38
29
|
borderRadius: oval ? "10px" : "3px",
|
|
39
|
-
backgroundColor:
|
|
30
|
+
backgroundColor: (0, _tokens.statusColor)(status),
|
|
40
31
|
color: _tokens.COLORS.white,
|
|
41
32
|
fontFamily: _tokens.FONTS.Lato,
|
|
42
33
|
fontSize: 12,
|
|
@@ -47,7 +38,7 @@ var StatusChip = function StatusChip(_ref) {
|
|
|
47
38
|
}
|
|
48
39
|
}
|
|
49
40
|
});
|
|
50
|
-
var name =
|
|
41
|
+
var name = (0, _tokens.statusName)(status);
|
|
51
42
|
return name ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
|
52
43
|
title: name,
|
|
53
44
|
arrow: true,
|
|
@@ -60,6 +60,16 @@ var tabSx = {
|
|
|
60
60
|
xs: 14,
|
|
61
61
|
sm: 18
|
|
62
62
|
}
|
|
63
|
+
},
|
|
64
|
+
|
|
65
|
+
/*
|
|
66
|
+
El tema de MUI de Creators pinta las pestañas de rosa al pasar el ratón
|
|
67
|
+
(`MuiTab.styleOverrides.root`). Aquí no se quiere ese realce, y la librería
|
|
68
|
+
no debe depender del tema de quien la consume: se anula explícitamente.
|
|
69
|
+
*/
|
|
70
|
+
"&:hover, &.Mui-selected:hover": {
|
|
71
|
+
color: _tokens.COLORS.s5,
|
|
72
|
+
backgroundColor: "transparent"
|
|
63
73
|
}
|
|
64
74
|
};
|
|
65
75
|
|
package/dist/components/pages/CreatorsProductEdition/stories/CreatorsProductEdition.stories.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.SinImagenes = exports.HijoDeOtro = exports.EspecialistaTextosCelular = exports.EspecialistaTextos = exports.EspecialistaImagenesCelular = exports.EspecialistaImagenes = exports.ErrorAlCargar = exports.ConVariantes = exports.AuditorQACelular = exports.AuditorQA = exports.AuditorPorEvaluar = void 0;
|
|
8
|
+
exports.default = exports.SinServicioDeImagenes = exports.SinImagenes = exports.HijoDeOtro = exports.EspecialistaTextosCelular = exports.EspecialistaTextos = exports.EspecialistaImagenesCelular = exports.EspecialistaImagenes = exports.ErrorAlCargar = exports.ConVariantes = exports.AuditorQACelular = exports.AuditorQA = exports.AuditorPorEvaluar = void 0;
|
|
9
9
|
|
|
10
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
11
|
|
|
@@ -125,7 +125,15 @@ HijoDeOtro.args = EspecialistaTextos.args;
|
|
|
125
125
|
HijoDeOtro.decorators = [(0, _mockApi.withMockApi)({
|
|
126
126
|
familia: "hijo"
|
|
127
127
|
})]; // --- Casos límite -----------------------------------------------------------
|
|
128
|
-
|
|
128
|
+
// Producto sin el servicio de imágenes contratado: la bandeja de imágenes
|
|
129
|
+
// queda deshabilitada y la de activos digitales sigue siendo utilizable.
|
|
130
|
+
|
|
131
|
+
var SinServicioDeImagenes = Template.bind({});
|
|
132
|
+
exports.SinServicioDeImagenes = SinServicioDeImagenes;
|
|
133
|
+
SinServicioDeImagenes.args = AuditorQA.args;
|
|
134
|
+
SinServicioDeImagenes.decorators = [(0, _mockApi.withMockApi)({
|
|
135
|
+
imagesService: false
|
|
136
|
+
})];
|
|
129
137
|
var SinImagenes = Template.bind({});
|
|
130
138
|
exports.SinImagenes = SinImagenes;
|
|
131
139
|
SinImagenes.args = EspecialistaImagenes.args;
|
|
@@ -111,9 +111,9 @@ exports.getCategories = getCategories;
|
|
|
111
111
|
var formatDate = function formatDate(date) {
|
|
112
112
|
var newDate = new Date(date);
|
|
113
113
|
var year = newDate.getFullYear();
|
|
114
|
-
var month = newDate.getMonth() + 1;
|
|
115
|
-
var day = newDate.getDate();
|
|
116
|
-
return "".concat(year, "
|
|
114
|
+
var month = "".concat(newDate.getMonth() + 1).padStart(2, "0");
|
|
115
|
+
var day = "".concat(newDate.getDate()).padStart(2, "0");
|
|
116
|
+
return "".concat(year, "-").concat(month, "-").concat(day);
|
|
117
117
|
};
|
|
118
118
|
|
|
119
119
|
exports.formatDate = formatDate;
|
|
@@ -32,7 +32,7 @@ var _axios = _interopRequireDefault(require("axios"));
|
|
|
32
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
33
33
|
|
|
34
34
|
var Dashboard = function Dashboard(_ref) {
|
|
35
|
-
var _company$financedReta
|
|
35
|
+
var _company$financedReta;
|
|
36
36
|
|
|
37
37
|
var jwt = _ref.jwt,
|
|
38
38
|
user = _ref.user,
|
|
@@ -135,21 +135,17 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
135
135
|
var _useState31 = (0, _react.useState)(0),
|
|
136
136
|
_useState32 = (0, _slicedToArray2.default)(_useState31, 2),
|
|
137
137
|
totalCount = _useState32[0],
|
|
138
|
-
setTotalCount = _useState32[1];
|
|
138
|
+
setTotalCount = _useState32[1]; // Total sin filtros, solo para el porcentaje de la dona.
|
|
139
139
|
|
|
140
|
-
var _useState33 = (0, _react.useState)((company === null || company === void 0 ? void 0 : (_company$financedReta = company.financedRetailers) === null || _company$financedReta === void 0 ? void 0 : _company$financedReta.length) > 0),
|
|
141
|
-
_useState34 = (0, _slicedToArray2.default)(_useState33, 1),
|
|
142
|
-
isProviderFinanced = _useState34[0];
|
|
143
140
|
|
|
144
|
-
var
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
141
|
+
var _useState33 = (0, _react.useState)(0),
|
|
142
|
+
_useState34 = (0, _slicedToArray2.default)(_useState33, 2),
|
|
143
|
+
totalUnfiltered = _useState34[0],
|
|
144
|
+
setTotalUnfiltered = _useState34[1];
|
|
148
145
|
|
|
149
|
-
var
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
setTradesSelected = _useState38[1];
|
|
146
|
+
var _useState35 = (0, _react.useState)((company === null || company === void 0 ? void 0 : (_company$financedReta = company.financedRetailers) === null || _company$financedReta === void 0 ? void 0 : _company$financedReta.length) > 0),
|
|
147
|
+
_useState36 = (0, _slicedToArray2.default)(_useState35, 1),
|
|
148
|
+
isProviderFinanced = _useState36[0];
|
|
153
149
|
|
|
154
150
|
var loadProductVersions = /*#__PURE__*/function () {
|
|
155
151
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(queryObject) {
|
|
@@ -241,71 +237,99 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
241
237
|
|
|
242
238
|
var loadProductsByStatus = /*#__PURE__*/function () {
|
|
243
239
|
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3(orderByStatus) {
|
|
244
|
-
var
|
|
240
|
+
var _ordersByActive$regis;
|
|
241
|
+
|
|
242
|
+
var isBaseline,
|
|
243
|
+
isRetailer,
|
|
244
|
+
isProvider,
|
|
245
|
+
isCollaborator,
|
|
246
|
+
_ref5,
|
|
247
|
+
ordersBydate,
|
|
248
|
+
_ref5$ordersByStatus,
|
|
249
|
+
ordersByStatus,
|
|
250
|
+
_ref5$ordersByActive,
|
|
251
|
+
ordersByActive,
|
|
252
|
+
_ordersByStatus$total,
|
|
253
|
+
total,
|
|
254
|
+
_ordersByStatus$R,
|
|
255
|
+
R,
|
|
256
|
+
_ordersByStatus$PA,
|
|
257
|
+
PA,
|
|
258
|
+
_ordersByStatus$Ex,
|
|
259
|
+
Ex,
|
|
260
|
+
_ordersByStatus$ACA,
|
|
261
|
+
ACA,
|
|
262
|
+
productsFinished,
|
|
263
|
+
unassigned,
|
|
264
|
+
inProcess,
|
|
265
|
+
registeredProducts,
|
|
266
|
+
metricsArray,
|
|
267
|
+
_args3 = arguments;
|
|
245
268
|
|
|
246
269
|
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
247
270
|
while (1) {
|
|
248
271
|
switch (_context3.prev = _context3.next) {
|
|
249
272
|
case 0:
|
|
273
|
+
isBaseline = _args3.length > 1 && _args3[1] !== undefined ? _args3[1] : false;
|
|
250
274
|
isRetailer = user.is_retailer && company.retailers;
|
|
251
275
|
isProvider = !user.is_retailer && user.id_role === 0;
|
|
252
276
|
isCollaborator = user.id_role > 0;
|
|
253
|
-
_context3.next =
|
|
277
|
+
_context3.next = 6;
|
|
254
278
|
return loadProductVersions(orderByStatus);
|
|
255
279
|
|
|
256
|
-
case
|
|
280
|
+
case 6:
|
|
257
281
|
_context3.t0 = _context3.sent;
|
|
258
282
|
|
|
259
283
|
if (_context3.t0) {
|
|
260
|
-
_context3.next =
|
|
284
|
+
_context3.next = 9;
|
|
261
285
|
break;
|
|
262
286
|
}
|
|
263
287
|
|
|
264
288
|
_context3.t0 = {};
|
|
265
289
|
|
|
266
|
-
case
|
|
290
|
+
case 9:
|
|
267
291
|
_ref5 = _context3.t0;
|
|
268
292
|
ordersBydate = _ref5.ordersBydate;
|
|
269
|
-
ordersByStatus = _ref5.ordersByStatus;
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
293
|
+
_ref5$ordersByStatus = _ref5.ordersByStatus;
|
|
294
|
+
ordersByStatus = _ref5$ordersByStatus === void 0 ? {} : _ref5$ordersByStatus;
|
|
295
|
+
_ref5$ordersByActive = _ref5.ordersByActive;
|
|
296
|
+
ordersByActive = _ref5$ordersByActive === void 0 ? {} : _ref5$ordersByActive;
|
|
273
297
|
_ordersByStatus$total = ordersByStatus.total, total = _ordersByStatus$total === void 0 ? 0 : _ordersByStatus$total, _ordersByStatus$R = ordersByStatus.R, R = _ordersByStatus$R === void 0 ? 0 : _ordersByStatus$R, _ordersByStatus$PA = ordersByStatus.PA, PA = _ordersByStatus$PA === void 0 ? 0 : _ordersByStatus$PA, _ordersByStatus$Ex = ordersByStatus.Ex, Ex = _ordersByStatus$Ex === void 0 ? 0 : _ordersByStatus$Ex, _ordersByStatus$ACA = ordersByStatus.ACA, ACA = _ordersByStatus$ACA === void 0 ? 0 : _ordersByStatus$ACA;
|
|
274
298
|
productsFinished = 0;
|
|
275
299
|
if (isRetailer) productsFinished = Ex;
|
|
276
|
-
if (isProvider) productsFinished = ACA;
|
|
277
|
-
if (isCollaborator) productsFinished = Ex + ACA;
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
label: "Productos activos",
|
|
288
|
-
value: registeredProducts
|
|
300
|
+
if (isProvider) productsFinished = ACA + Ex;
|
|
301
|
+
if (isCollaborator) productsFinished = Ex + ACA; // Lo que no está sin asignar ni terminado está en proceso, para que las
|
|
302
|
+
// tres tarjetas siempre sumen el total filtrado.
|
|
303
|
+
|
|
304
|
+
unassigned = PA + R;
|
|
305
|
+
inProcess = total - unassigned - productsFinished;
|
|
306
|
+
registeredProducts = (_ordersByActive$regis = ordersByActive.registered) !== null && _ordersByActive$regis !== void 0 ? _ordersByActive$regis : 0;
|
|
307
|
+
metricsArray = [{
|
|
308
|
+
label: "Catálogo activo",
|
|
309
|
+
value: registeredProducts,
|
|
310
|
+
hint: "Productos dados de alta y activos. No depende del filtro de fechas, que aplica a la fecha de la orden."
|
|
289
311
|
}, {
|
|
290
|
-
label: "
|
|
291
|
-
value: total
|
|
312
|
+
label: "En órdenes de trabajo",
|
|
313
|
+
value: total,
|
|
314
|
+
hint: "Productos con orden de trabajo viva dentro de los filtros. Un producto en dos órdenes cuenta en cada una."
|
|
292
315
|
}, {
|
|
293
|
-
label: "
|
|
294
|
-
value:
|
|
316
|
+
label: "Sin asignar",
|
|
317
|
+
value: unassigned
|
|
295
318
|
}, {
|
|
296
|
-
label: "
|
|
319
|
+
label: "En proceso",
|
|
297
320
|
value: inProcess
|
|
298
321
|
}, {
|
|
299
|
-
label: "
|
|
322
|
+
label: "Terminados",
|
|
300
323
|
value: productsFinished
|
|
301
|
-
}
|
|
324
|
+
}];
|
|
302
325
|
setMetricsData(metricsArray);
|
|
303
326
|
setTotalCount(total);
|
|
327
|
+
if (isBaseline) setTotalUnfiltered(total);
|
|
304
328
|
delete ordersByStatus.total;
|
|
305
329
|
setRequiredProducts(ordersBydate);
|
|
306
330
|
setProductsByStatus(ordersByStatus);
|
|
307
331
|
|
|
308
|
-
case
|
|
332
|
+
case 30:
|
|
309
333
|
case "end":
|
|
310
334
|
return _context3.stop();
|
|
311
335
|
}
|
|
@@ -319,7 +343,23 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
319
343
|
}();
|
|
320
344
|
|
|
321
345
|
var datesSelect = function datesSelect() {
|
|
322
|
-
|
|
346
|
+
// Cada rango se calcula al momento de elegirlo y con fechas locales: si se
|
|
347
|
+
// parte de un Date compartido, los options se pisan entre sí, y
|
|
348
|
+
// new Date("2026-11-01") cae en el día anterior al oeste de UTC.
|
|
349
|
+
var applyRange = function applyRange(startDate) {
|
|
350
|
+
var endDate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : new Date();
|
|
351
|
+
return setDatesRange({
|
|
352
|
+
startDate: (0, _dashboardUtils.formatDate)(startDate),
|
|
353
|
+
endDate: (0, _dashboardUtils.formatDate)(endDate)
|
|
354
|
+
});
|
|
355
|
+
};
|
|
356
|
+
|
|
357
|
+
var daysAgo = function daysAgo(days) {
|
|
358
|
+
var date = new Date();
|
|
359
|
+
date.setDate(date.getDate() - days);
|
|
360
|
+
return date;
|
|
361
|
+
};
|
|
362
|
+
|
|
323
363
|
setDateOptions([{
|
|
324
364
|
id: 0,
|
|
325
365
|
name: "Rango de fechas"
|
|
@@ -327,64 +367,46 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
327
367
|
id: 1,
|
|
328
368
|
name: "Todo el tiempo",
|
|
329
369
|
function: function _function() {
|
|
330
|
-
return
|
|
331
|
-
startDate: (0, _dashboardUtils.formatDate)(new Date("1900-01-01")),
|
|
332
|
-
endDate: (0, _dashboardUtils.formatDate)(new Date())
|
|
333
|
-
});
|
|
370
|
+
return applyRange(new Date(1900, 0, 1));
|
|
334
371
|
}
|
|
335
372
|
}, {
|
|
336
373
|
id: 2,
|
|
337
374
|
name: "Hoy",
|
|
338
375
|
function: function _function() {
|
|
339
|
-
return
|
|
340
|
-
startDate: (0, _dashboardUtils.formatDate)(new Date()),
|
|
341
|
-
endDate: (0, _dashboardUtils.formatDate)(new Date())
|
|
342
|
-
});
|
|
376
|
+
return applyRange(new Date());
|
|
343
377
|
}
|
|
344
378
|
}, {
|
|
345
379
|
id: 3,
|
|
346
380
|
name: "Ayer",
|
|
347
381
|
function: function _function() {
|
|
348
|
-
return
|
|
349
|
-
startDate: (0, _dashboardUtils.formatDate)(new Date(today.setDate(today.getDate() - 1))),
|
|
350
|
-
endDate: (0, _dashboardUtils.formatDate)(new Date())
|
|
351
|
-
});
|
|
382
|
+
return applyRange(daysAgo(1), daysAgo(1));
|
|
352
383
|
}
|
|
353
384
|
}, {
|
|
354
385
|
id: 4,
|
|
355
386
|
name: "Esta semana",
|
|
356
387
|
function: function _function() {
|
|
357
|
-
return
|
|
358
|
-
startDate: (0, _dashboardUtils.formatDate)(new Date(today.setDate(today.getDate() - today.getDay()))),
|
|
359
|
-
endDate: (0, _dashboardUtils.formatDate)(new Date())
|
|
360
|
-
});
|
|
388
|
+
return applyRange(daysAgo(new Date().getDay()));
|
|
361
389
|
}
|
|
362
390
|
}, {
|
|
363
391
|
id: 5,
|
|
364
392
|
name: "La semana pasada",
|
|
365
393
|
function: function _function() {
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
endDate: (0, _dashboardUtils.formatDate)(new Date(today.setDate(today.getDate() - today.getDay() + 7)))
|
|
369
|
-
});
|
|
394
|
+
var weekday = new Date().getDay();
|
|
395
|
+
return applyRange(daysAgo(weekday + 7), daysAgo(weekday + 1));
|
|
370
396
|
}
|
|
371
397
|
}, {
|
|
372
398
|
id: 6,
|
|
373
399
|
name: "Este mes",
|
|
374
400
|
function: function _function() {
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
endDate: (0, _dashboardUtils.formatDate)(today)
|
|
378
|
-
});
|
|
401
|
+
var today = new Date();
|
|
402
|
+
return applyRange(new Date(today.getFullYear(), today.getMonth(), 1));
|
|
379
403
|
}
|
|
380
404
|
}, {
|
|
381
405
|
id: 7,
|
|
382
406
|
name: "El mes pasado",
|
|
383
407
|
function: function _function() {
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
endDate: (0, _dashboardUtils.formatDate)(new Date("".concat(today.getFullYear(), "-").concat(today.getMonth() + 1, "-01")))
|
|
387
|
-
});
|
|
408
|
+
var today = new Date();
|
|
409
|
+
return applyRange(new Date(today.getFullYear(), today.getMonth() - 1, 1), new Date(today.getFullYear(), today.getMonth(), 0));
|
|
388
410
|
}
|
|
389
411
|
}]);
|
|
390
412
|
};
|
|
@@ -427,7 +449,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
427
449
|
});
|
|
428
450
|
setOrderByStatus(queryObject);
|
|
429
451
|
setOrderByRequired(queryObject);
|
|
430
|
-
loadProductsByStatus(queryObject);
|
|
452
|
+
loadProductsByStatus(queryObject, true);
|
|
431
453
|
|
|
432
454
|
case 21:
|
|
433
455
|
case "end":
|
|
@@ -455,18 +477,17 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
455
477
|
if (companyId.length > 0) queryObject["companyId"] = companyId.join(",");
|
|
456
478
|
if (retailerId.length > 0) queryObject["retailerId"] = retailerId.join(",");
|
|
457
479
|
if (categoryId.length > 0) queryObject["categoryId"] = categoryId.join(",");
|
|
458
|
-
if (tradesSelected.length > 0) queryObject["trades"] = encodeURIComponent(tradesSelected.join(","));
|
|
459
480
|
applicantsFilter.length > 0 && (queryObject["requestedBy"] = applicantsFilter.join(","));
|
|
460
|
-
_context5.next =
|
|
461
|
-
return loadProductsByStatus(queryObject
|
|
481
|
+
_context5.next = 8;
|
|
482
|
+
return loadProductsByStatus(queryObject);
|
|
462
483
|
|
|
463
|
-
case
|
|
484
|
+
case 8:
|
|
464
485
|
case "end":
|
|
465
486
|
return _context5.stop();
|
|
466
487
|
}
|
|
467
488
|
}
|
|
468
489
|
}, _callee5);
|
|
469
|
-
})), [companyId, retailerId, categoryId, datesRange, applicantsFilter
|
|
490
|
+
})), [companyId, retailerId, categoryId, datesRange, applicantsFilter]);
|
|
470
491
|
return loading ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Loading.Loading, {}) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Container, {
|
|
471
492
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
472
493
|
className: "filters",
|
|
@@ -517,21 +538,14 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
517
538
|
parameterArray: applicantsFilter,
|
|
518
539
|
setParameterArray: setApplicantsFilter,
|
|
519
540
|
defaultOption: "Todos los solicitantes"
|
|
520
|
-
}), user.id_role === 0 && (trades === null || trades === void 0 ? void 0 : trades.length) > 0 && /*#__PURE__*/(0, _jsxRuntime.jsx)(_CustomSelect.CustomSelect, {
|
|
521
|
-
showSearchBar: true,
|
|
522
|
-
options: trades,
|
|
523
|
-
selectLabel: "Todas las marcas",
|
|
524
|
-
placeHolder: "Buscar marca",
|
|
525
|
-
customSelectId: "trade-select",
|
|
526
|
-
parameterArray: tradesSelected,
|
|
527
|
-
setParameterArray: setTradesSelected
|
|
528
541
|
})]
|
|
529
542
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
|
530
543
|
className: "metric-cards",
|
|
531
544
|
children: metricsData.map(function (metric, index) {
|
|
532
545
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_MetricCard.MetricCard, {
|
|
533
546
|
label: metric.label,
|
|
534
|
-
number: metric.value
|
|
547
|
+
number: metric.value,
|
|
548
|
+
hint: metric.hint
|
|
535
549
|
}, "".concat(index, "-").concat(metric.value));
|
|
536
550
|
})
|
|
537
551
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
@@ -551,7 +565,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
551
565
|
showPercent: true,
|
|
552
566
|
displayScale: false,
|
|
553
567
|
totalFiltered: totalCount,
|
|
554
|
-
total:
|
|
568
|
+
total: totalUnfiltered
|
|
555
569
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_DashboardMetric.DashboardMetric, {
|
|
556
570
|
label: "Productos solicitados",
|
|
557
571
|
description: "Filtra los productos solicitados por fecha y alcance para revisar rápidamente el flujo de trabajo.",
|
|
@@ -13,6 +13,6 @@ var _styledComponents = _interopRequireDefault(require("styled-components"));
|
|
|
13
13
|
|
|
14
14
|
var _templateObject;
|
|
15
15
|
|
|
16
|
-
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n padding: 30px;\n\n .filters {\n display: flex;\n
|
|
16
|
+
var Container = _styledComponents.default.div(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n padding: 30px;\n\n .filters {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n\n & + * {\n margin-top: 20px;\n }\n }\n\n .metric-cards {\n display: flex;\n flex-wrap: wrap;\n gap: 10px;\n\n & + * {\n margin-top: 10px;\n }\n }\n\n .metrics-main-container {\n display: grid;\n /* Dos paneles mientras quepan 320px cada uno; si no, uno debajo del otro.\n El min() evita que la columna siga midiendo 320px en pantallas menores. */\n grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr));\n gap: 10px;\n\n /* Sin esto las gr\xE1ficas no pueden encogerse por debajo de su ancho. */\n > * {\n min-width: 0;\n }\n }\n\n @media (max-width: 600px) {\n padding: 15px;\n }\n"])));
|
|
17
17
|
|
|
18
18
|
exports.Container = Container;
|
|
@@ -5,14 +5,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.default = exports.RetailerProductEditionDefault =
|
|
8
|
+
exports.default = exports.RetailerProductEditionDefault = void 0;
|
|
9
9
|
|
|
10
10
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
11
11
|
|
|
12
12
|
var _index = require("./index");
|
|
13
13
|
|
|
14
|
-
var _demo = require("../../organisms/ServicesWorkspace/demo");
|
|
15
|
-
|
|
16
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
15
|
|
|
18
16
|
var _default = {
|
|
@@ -216,15 +214,4 @@ RetailerProductEditionDefault.args = {
|
|
|
216
214
|
},
|
|
217
215
|
"src": "https://content-management-profile-prod.s3.amazonaws.com/id-425/425.png?1778260157973"
|
|
218
216
|
}
|
|
219
|
-
};
|
|
220
|
-
/**
|
|
221
|
-
* Con la pestaña "Servicios" (la activa Creators con `showServicesTab`) y
|
|
222
|
-
* servicios de ejemplo además de los tres de siempre.
|
|
223
|
-
*/
|
|
224
|
-
|
|
225
|
-
var ConPestanaServicios = Template.bind({});
|
|
226
|
-
exports.ConPestanaServicios = ConPestanaServicios;
|
|
227
|
-
ConPestanaServicios.args = (0, _objectSpread2.default)((0, _objectSpread2.default)({}, RetailerProductEditionDefault.args), {}, {
|
|
228
|
-
showServicesTab: true,
|
|
229
|
-
productSelected: (0, _demo.withDemoServices)(RetailerProductEditionDefault.args.productSelected, 14)
|
|
230
|
-
});
|
|
217
|
+
};
|