contentoh-components-library 21.5.85 → 21.5.87

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 (23) hide show
  1. package/dist/components/atoms/GeneralButton/styles.js +1 -1
  2. package/dist/components/molecules/TagAndInput/index.js +55 -14
  3. package/dist/components/molecules/TagAndInput/styles.js +1 -1
  4. package/dist/components/organisms/ChangeStatusModal/index.js +531 -0
  5. package/dist/components/organisms/ChangeStatusModal/styles.js +85 -0
  6. package/dist/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +108 -231
  7. package/dist/components/pages/RetailerProductEdition/context/reducers/product.js +48 -2
  8. package/dist/components/pages/RetailerProductEdition/index.js +329 -101
  9. package/dist/components/pages/RetailerProductEdition/styles.js +1 -1
  10. package/dist/contexts/AiProductEdition.js +75 -22
  11. package/dist/global-files/statusDictionary.js +103 -0
  12. package/package.json +1 -1
  13. package/src/components/atoms/GeneralButton/styles.js +4 -0
  14. package/src/components/molecules/TagAndInput/index.js +32 -2
  15. package/src/components/molecules/TagAndInput/styles.js +11 -0
  16. package/src/components/organisms/ChangeStatusModal/index.jsx +488 -0
  17. package/src/components/organisms/ChangeStatusModal/styles.js +333 -0
  18. package/src/components/pages/RetailerProductEdition/RetailerProductEdition.stories.js +107 -259
  19. package/src/components/pages/RetailerProductEdition/context/reducers/product.js +55 -0
  20. package/src/components/pages/RetailerProductEdition/index.js +236 -78
  21. package/src/components/pages/RetailerProductEdition/styles.js +6 -0
  22. package/src/contexts/AiProductEdition.jsx +46 -0
  23. package/src/global-files/statusDictionary.js +103 -0
@@ -0,0 +1,531 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.default = void 0;
9
+
10
+ var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
11
+
12
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
13
+
14
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/slicedToArray"));
15
+
16
+ var _react = require("react");
17
+
18
+ var _material = require("@mui/material");
19
+
20
+ var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
21
+
22
+ var _Link = _interopRequireDefault(require("@mui/icons-material/Link"));
23
+
24
+ var _BuildOutlined = _interopRequireDefault(require("@mui/icons-material/BuildOutlined"));
25
+
26
+ var _ArrowForward = _interopRequireDefault(require("@mui/icons-material/ArrowForward"));
27
+
28
+ var _Layers = _interopRequireDefault(require("@mui/icons-material/Layers"));
29
+
30
+ var _ViewInArOutlined = _interopRequireDefault(require("@mui/icons-material/ViewInArOutlined"));
31
+
32
+ var _iconsMaterial = require("@mui/icons-material");
33
+
34
+ var _CheckCircle = _interopRequireDefault(require("@mui/icons-material/CheckCircle"));
35
+
36
+ var _RadioButtonUnchecked = _interopRequireDefault(require("@mui/icons-material/RadioButtonUnchecked"));
37
+
38
+ var _statusDictionary = require("../../../global-files/statusDictionary");
39
+
40
+ var _styles = require("./styles");
41
+
42
+ var _axios = _interopRequireDefault(require("axios"));
43
+
44
+ var _jsxRuntime = require("react/jsx-runtime");
45
+
46
+ var statusOptions = [{
47
+ value: "PA",
48
+ label: "Por Asignar"
49
+ }, {
50
+ value: "AS",
51
+ label: "Asignado"
52
+ }, {
53
+ value: "AC",
54
+ label: "Aprobado Coordinador"
55
+ }, {
56
+ value: "AP",
57
+ label: "Aprobado Proveedor"
58
+ }, {
59
+ value: "R",
60
+ label: "Rechazado"
61
+ }, {
62
+ value: "RP",
63
+ label: "Rechazo Pendiente"
64
+ }];
65
+ var availableServices = ["description", "datasheet", "images"];
66
+
67
+ var ChangeStatusModal = function ChangeStatusModal(_ref) {
68
+ var _state$product9, _state$product10, _state$product10$cate, _state$product$servic, _state$product11, _state$product$servic2, _state$product12;
69
+
70
+ var state = _ref.state,
71
+ open = _ref.open,
72
+ onClose = _ref.onClose,
73
+ _ref$token = _ref.token,
74
+ token = _ref$token === void 0 ? "" : _ref$token,
75
+ _ref$reloadData = _ref.reloadData,
76
+ reloadData = _ref$reloadData === void 0 ? function () {} : _ref$reloadData;
77
+
78
+ var _useState = (0, _react.useState)("product"),
79
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
80
+ scope = _useState2[0],
81
+ setScope = _useState2[1];
82
+
83
+ var _useState3 = (0, _react.useState)(""),
84
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
85
+ newStatus = _useState4[0],
86
+ setNewStatus = _useState4[1];
87
+
88
+ var _useState5 = (0, _react.useState)(""),
89
+ _useState6 = (0, _slicedToArray2.default)(_useState5, 2),
90
+ comment = _useState6[0],
91
+ setComment = _useState6[1];
92
+
93
+ var _useState7 = (0, _react.useState)([]),
94
+ _useState8 = (0, _slicedToArray2.default)(_useState7, 2),
95
+ availableRetailers = _useState8[0],
96
+ setAvailableRetailers = _useState8[1];
97
+
98
+ var _useState9 = (0, _react.useState)([]),
99
+ _useState10 = (0, _slicedToArray2.default)(_useState9, 2),
100
+ selectedChains = _useState10[0],
101
+ setSelectedChains = _useState10[1];
102
+
103
+ var _useState11 = (0, _react.useState)([]),
104
+ _useState12 = (0, _slicedToArray2.default)(_useState11, 2),
105
+ selectedServices = _useState12[0],
106
+ setSelectedServices = _useState12[1];
107
+
108
+ var _useState13 = (0, _react.useState)(false),
109
+ _useState14 = (0, _slicedToArray2.default)(_useState13, 2),
110
+ isSubmitting = _useState14[0],
111
+ setIsSubmitting = _useState14[1];
112
+
113
+ var _useState15 = (0, _react.useState)({}),
114
+ _useState16 = (0, _slicedToArray2.default)(_useState15, 2),
115
+ currentStatusObj = _useState16[0],
116
+ setCurrentStatusObj = _useState16[1];
117
+
118
+ var isStatusValid = newStatus !== "" && newStatus !== currentStatusObj.label;
119
+ var isCommentValid = comment.trim().length > 0;
120
+ var isScopeValid = false;
121
+ if (scope === "product") isScopeValid = true;
122
+ if (scope === "retailer") isScopeValid = selectedChains.length > 0;
123
+ if (scope === "service") isScopeValid = selectedChains.length > 0 && selectedServices.length > 0;
124
+ var canSubmit = isStatusValid && isCommentValid && isScopeValid;
125
+
126
+ var handleScopeChange = function handleScopeChange(newScope) {
127
+ setScope(newScope);
128
+ setSelectedChains([]);
129
+ setSelectedServices([]);
130
+ };
131
+
132
+ var handleSubmit = /*#__PURE__*/function () {
133
+ var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee() {
134
+ var _state$product, _state$product2, _state$product3, _state$product4, _availableRetailers$f, _state$product5;
135
+
136
+ var upc, article_id, order_id, version, retailers_selected, services_selected, old_status, new_status, commentary, payload, response;
137
+ return _regenerator.default.wrap(function _callee$(_context) {
138
+ while (1) {
139
+ switch (_context.prev = _context.next) {
140
+ case 0:
141
+ if (!(!canSubmit || isSubmitting)) {
142
+ _context.next = 2;
143
+ break;
144
+ }
145
+
146
+ return _context.abrupt("return");
147
+
148
+ case 2:
149
+ setIsSubmitting(true);
150
+ upc = state === null || state === void 0 ? void 0 : (_state$product = state.product) === null || _state$product === void 0 ? void 0 : _state$product.upc;
151
+ article_id = state === null || state === void 0 ? void 0 : (_state$product2 = state.product) === null || _state$product2 === void 0 ? void 0 : _state$product2.id_article;
152
+ order_id = state === null || state === void 0 ? void 0 : (_state$product3 = state.product) === null || _state$product3 === void 0 ? void 0 : _state$product3.id_order;
153
+ version = state === null || state === void 0 ? void 0 : (_state$product4 = state.product) === null || _state$product4 === void 0 ? void 0 : _state$product4.version;
154
+ retailers_selected = availableRetailers === null || availableRetailers === void 0 ? void 0 : (_availableRetailers$f = availableRetailers.filter(function (retailer) {
155
+ return selectedChains === null || selectedChains === void 0 ? void 0 : selectedChains.includes(retailer.id_retailer);
156
+ })) === null || _availableRetailers$f === void 0 ? void 0 : _availableRetailers$f.map(function (retailer) {
157
+ return {
158
+ id: retailer === null || retailer === void 0 ? void 0 : retailer.id_retailer,
159
+ name: retailer === null || retailer === void 0 ? void 0 : retailer.name
160
+ };
161
+ });
162
+ services_selected = selectedServices;
163
+ old_status = state === null || state === void 0 ? void 0 : (_state$product5 = state.product) === null || _state$product5 === void 0 ? void 0 : _state$product5.status;
164
+ new_status = Object.values(_statusDictionary.STATUS_DICTIONARY).find(function (status) {
165
+ return status.name === newStatus;
166
+ }).status;
167
+ commentary = comment;
168
+ payload = {
169
+ upc: upc,
170
+ articleId: article_id,
171
+ orderId: order_id,
172
+ version: version,
173
+ retailers: scope === "product" ? availableRetailers === null || availableRetailers === void 0 ? void 0 : availableRetailers.map(function (retailer) {
174
+ return {
175
+ id: retailer === null || retailer === void 0 ? void 0 : retailer.id_retailer,
176
+ name: retailer === null || retailer === void 0 ? void 0 : retailer.name
177
+ };
178
+ }) : retailers_selected,
179
+ services: scope !== "service" ? Object.keys(state === null || state === void 0 ? void 0 : state.product.services).filter(function (service) {
180
+ var _state$product6;
181
+
182
+ return !!(state !== null && state !== void 0 && (_state$product6 = state.product) !== null && _state$product6 !== void 0 && _state$product6.services[service]);
183
+ }).map(function (service) {
184
+ return service.replace("datasheets", "datasheet").replace("descriptions", "description");
185
+ }) : services_selected,
186
+ oldStatus: old_status,
187
+ newStatus: new_status,
188
+ commentary: commentary
189
+ };
190
+ _context.next = 15;
191
+ return _axios.default.post(process.env.REACT_APP_REQUEST_CHANGE_STATUS, payload, {
192
+ headers: {
193
+ Authorization: token
194
+ }
195
+ });
196
+
197
+ case 15:
198
+ response = _context.sent;
199
+ reloadData();
200
+ setIsSubmitting(false);
201
+ onClose();
202
+
203
+ case 19:
204
+ case "end":
205
+ return _context.stop();
206
+ }
207
+ }
208
+ }, _callee);
209
+ }));
210
+
211
+ return function handleSubmit() {
212
+ return _ref2.apply(this, arguments);
213
+ };
214
+ }();
215
+
216
+ (0, _react.useEffect)(function () {
217
+ var _state$product7, _state$product8;
218
+
219
+ if (!state) return;
220
+ setCurrentStatusObj(_statusDictionary.STATUS_DICTIONARY[state === null || state === void 0 ? void 0 : (_state$product7 = state.product) === null || _state$product7 === void 0 ? void 0 : _state$product7.status]);
221
+ setAvailableRetailers((state === null || state === void 0 ? void 0 : (_state$product8 = state.product) === null || _state$product8 === void 0 ? void 0 : _state$product8.categoryRetailerInOrder) || []);
222
+ }, [state]);
223
+ var selectMenuProps = {
224
+ PaperProps: {
225
+ style: {
226
+ borderRadius: "5px",
227
+ marginTop: "5px",
228
+ boxShadow: "0px 4px 20px rgba(0,0,0,0.1)"
229
+ }
230
+ }
231
+ };
232
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.StyledDialog, {
233
+ open: open,
234
+ onClose: onClose,
235
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ModalHeader, {
236
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
237
+ className: "close-icon",
238
+ onClick: onClose,
239
+ size: "small",
240
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Close.default, {
241
+ fontSize: "small"
242
+ })
243
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.BadgeCircle, {
244
+ children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.CachedOutlined, {})
245
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
246
+ className: "title-container",
247
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h2", {
248
+ children: "Cambio de Estatus"
249
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("p", {
250
+ children: state === null || state === void 0 ? void 0 : (_state$product9 = state.product) === null || _state$product9 === void 0 ? void 0 : _state$product9.name
251
+ })]
252
+ })]
253
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.MainSection, {
254
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Section, {
255
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SectionTitle, {
256
+ children: "Alcance del cambio:"
257
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ScopeButtonGroup, {
258
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ScopeButton, {
259
+ active: scope === "product",
260
+ onClick: function onClick() {
261
+ return handleScopeChange("product");
262
+ },
263
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ViewInArOutlined.default, {}), " Producto completo"]
264
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ScopeButton, {
265
+ active: scope === "retailer",
266
+ onClick: function onClick() {
267
+ return handleScopeChange("retailer");
268
+ },
269
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.default, {}), " Por Cadena"]
270
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ScopeButton, {
271
+ active: scope === "service",
272
+ onClick: function onClick() {
273
+ return handleScopeChange("service");
274
+ },
275
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_BuildOutlined.default, {}), " Por Servicio"]
276
+ })]
277
+ }), scope === "product" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.HelperText, {
278
+ children: "Se cambiar\xE1 el estatus de todos los servicios y cadenas"
279
+ }), scope === "retailer" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.HelperText, {
280
+ children: "Afectar\xE1 todos los servicios de las cadenas seleccionadas"
281
+ }), scope === "service" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.HelperText, {
282
+ children: "Afectar\xE1 \xFAnicamente los servicios de las cadenas seleccionadas"
283
+ })]
284
+ }), (scope === "retailer" || scope === "service") && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Section, {
285
+ style: {
286
+ paddingTop: 10
287
+ },
288
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.StyledFormControl, {
289
+ fullWidth: true,
290
+ size: "small",
291
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
292
+ id: "chain-label",
293
+ children: "Selecciona Cadena(s)"
294
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StyledSelect, {
295
+ labelId: "chain-label",
296
+ multiple: true // 1. El value debe ser directamente tu estado (el arreglo de IDs)
297
+ ,
298
+ value: selectedChains // 2. onChange seguro para MUI
299
+ ,
300
+ onChange: function onChange(e) {
301
+ var value = e.target.value;
302
+ setSelectedChains(typeof value === "string" ? value.split(",") : value);
303
+ } // 3. renderValue traduce los IDs a los Nombres de las cadenas para mostrarlos separados por coma
304
+ ,
305
+ renderValue: function renderValue(selected) {
306
+ return availableRetailers.filter(function (retailer) {
307
+ return selected.includes(retailer.id_retailer);
308
+ }).map(function (retailer) {
309
+ return retailer.name;
310
+ }).join(", ");
311
+ },
312
+ MenuProps: selectMenuProps,
313
+ children: availableRetailers.map(function (retailer) {
314
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
315
+ value: retailer.id_retailer,
316
+ sx: {
317
+ fontFamily: "Raleway",
318
+ fontSize: "0.85rem",
319
+ padding: "6px 12px",
320
+ "&.Mui-selected": {
321
+ backgroundColor: "".concat(_styles.colors.primary, "1A")
322
+ },
323
+ "&.Mui-selected:hover": {
324
+ backgroundColor: "".concat(_styles.colors.primary, "33")
325
+ }
326
+ },
327
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
328
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioButtonUnchecked.default, {
329
+ sx: {
330
+ fontSize: 18
331
+ }
332
+ }),
333
+ checkedIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckCircle.default, {
334
+ sx: {
335
+ fontSize: 18
336
+ }
337
+ }),
338
+ checked: selectedChains.indexOf(retailer.id_retailer) > -1,
339
+ style: {
340
+ color: _styles.colors.primary,
341
+ padding: "4px 8px 4px 4px"
342
+ }
343
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
344
+ src: "https://content-management-images.s3.amazonaws.com/retailers/".concat(retailer === null || retailer === void 0 ? void 0 : retailer.id_retailer, ".png"),
345
+ alt: retailer === null || retailer === void 0 ? void 0 : retailer.name,
346
+ style: {
347
+ width: "20px",
348
+ height: "20px",
349
+ objectFit: "contain",
350
+ marginRight: "12px",
351
+ borderRadius: "4px"
352
+ }
353
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
354
+ primary: retailer === null || retailer === void 0 ? void 0 : retailer.name,
355
+ primaryTypographyProps: {
356
+ style: {
357
+ fontFamily: "Raleway",
358
+ fontSize: "0.85rem"
359
+ }
360
+ }
361
+ })]
362
+ }, retailer.name);
363
+ })
364
+ })]
365
+ })
366
+ }), scope === "service" && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Section, {
367
+ style: {
368
+ paddingTop: 0
369
+ },
370
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.StyledFormControl, {
371
+ fullWidth: true,
372
+ size: "small",
373
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.InputLabel, {
374
+ id: "service-label",
375
+ children: "Selecciona Servicio(s)"
376
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StyledSelect, {
377
+ labelId: "service-label",
378
+ multiple: true,
379
+ value: selectedServices,
380
+ onChange: function onChange(e) {
381
+ var value = e.target.value;
382
+ setSelectedServices(typeof value === "string" ? value.split(",") : value);
383
+ },
384
+ renderValue: function renderValue(selected) {
385
+ return selected.map(function (service) {
386
+ return service === "description" ? "Descripciones" : service === "datasheet" ? "Ficha Técnica" : "Imágenes";
387
+ }).join(", ");
388
+ },
389
+ MenuProps: selectMenuProps,
390
+ children: availableServices.map(function (service) {
391
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
392
+ value: service,
393
+ sx: {
394
+ fontFamily: "Raleway",
395
+ fontSize: "0.85rem",
396
+ padding: "6px 12px",
397
+ "&.Mui-selected": {
398
+ backgroundColor: "".concat(_styles.colors.primary, "1A")
399
+ },
400
+ "&.Mui-selected:hover": {
401
+ backgroundColor: "".concat(_styles.colors.primary, "33")
402
+ }
403
+ },
404
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Checkbox, {
405
+ icon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_RadioButtonUnchecked.default, {
406
+ sx: {
407
+ fontSize: 18
408
+ }
409
+ }),
410
+ checkedIcon: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CheckCircle.default, {
411
+ sx: {
412
+ fontSize: 18
413
+ }
414
+ }),
415
+ checked: selectedServices.indexOf(service) > -1,
416
+ style: {
417
+ color: _styles.colors.primary,
418
+ padding: "4px 8px 4px 4px"
419
+ }
420
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItemText, {
421
+ primary: service === "description" ? "Descripciones" : service === "datasheet" ? "Ficha Técnica" : "Imágenes",
422
+ primaryTypographyProps: {
423
+ style: {
424
+ fontFamily: "Raleway",
425
+ fontSize: "0.85rem"
426
+ }
427
+ }
428
+ })]
429
+ }, service);
430
+ })
431
+ })]
432
+ })
433
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Section, {
434
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SectionTitle, {
435
+ children: "Estatus actual:"
436
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StatusPill, {
437
+ label: currentStatusObj.name,
438
+ selected: false,
439
+ disabled: true
440
+ })]
441
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Section, {
442
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SectionTitle, {
443
+ children: "Nuevo estatus:"
444
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StatusGrid, {
445
+ children: Object.values(_statusDictionary.STATUS_DICTIONARY).map(function (status) {
446
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StatusPill, {
447
+ label: status.name,
448
+ disabled: status.name === currentStatusObj.name,
449
+ selected: status.name === newStatus,
450
+ onClick: function onClick() {
451
+ return status.name !== currentStatusObj.name && setNewStatus(status.name);
452
+ }
453
+ }, status.name);
454
+ })
455
+ })]
456
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Section, {
457
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.SectionTitle, {
458
+ children: "Comentario:"
459
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StyledTextArea, {
460
+ multiline: true,
461
+ rows: 3,
462
+ placeholder: "Explica el motivo del cambio de estatus...",
463
+ value: comment,
464
+ onChange: function onChange(e) {
465
+ if (e.target.value.length <= 255) {
466
+ setComment(e.target.value);
467
+ }
468
+ },
469
+ inputProps: {
470
+ maxLength: 255
471
+ },
472
+ helperText: "".concat(comment.length, "/255 caracteres"),
473
+ FormHelperTextProps: {
474
+ style: {
475
+ textAlign: "right"
476
+ }
477
+ }
478
+ })]
479
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.ImpactSummary, {
480
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
481
+ className: "summary-title",
482
+ children: "Resumen de impacto:"
483
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
484
+ className: "status-flow",
485
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StatusPill, {
486
+ label: currentStatusObj.name,
487
+ selected: false,
488
+ disabled: true,
489
+ size: "small"
490
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ArrowForward.default, {
491
+ fontSize: "small",
492
+ sx: {
493
+ color: _styles.colors.textMuted
494
+ }
495
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.StatusPill, {
496
+ label: newStatus || "Selecciona un estatus",
497
+ selected: !!newStatus,
498
+ size: "small"
499
+ })]
500
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
501
+ className: "impact-counts",
502
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
503
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Link.default, {
504
+ fontSize: "small"
505
+ }), scope === "product" ? state === null || state === void 0 ? void 0 : (_state$product10 = state.product) === null || _state$product10 === void 0 ? void 0 : (_state$product10$cate = _state$product10.categoryRetailerInOrder) === null || _state$product10$cate === void 0 ? void 0 : _state$product10$cate.length : selectedChains.length, " ", "cadena(s)"]
506
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
507
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_BuildOutlined.default, {
508
+ fontSize: "small"
509
+ }), scope === "service" ? selectedServices.length : Object.values((_state$product$servic = state === null || state === void 0 ? void 0 : (_state$product11 = state.product) === null || _state$product11 === void 0 ? void 0 : _state$product11.services) !== null && _state$product$servic !== void 0 ? _state$product$servic : {}) ? Object.values((_state$product$servic2 = state === null || state === void 0 ? void 0 : (_state$product12 = state.product) === null || _state$product12 === void 0 ? void 0 : _state$product12.services) !== null && _state$product$servic2 !== void 0 ? _state$product$servic2 : {}).filter(function (service) {
510
+ return !!service;
511
+ }).length : "No es un array", "\xA0servicios"]
512
+ })]
513
+ })]
514
+ })]
515
+ }), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.FooterActions, {
516
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ActionButton, {
517
+ className: "cancel",
518
+ onClick: onClose,
519
+ children: "Cancelar"
520
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ActionButton, {
521
+ className: "submit",
522
+ disabled: !canSubmit || isSubmitting,
523
+ onClick: handleSubmit,
524
+ children: isSubmitting ? "Guardando..." : "Realizar cambio"
525
+ })]
526
+ })]
527
+ });
528
+ };
529
+
530
+ var _default = ChangeStatusModal;
531
+ exports.default = _default;
@@ -0,0 +1,85 @@
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.colors = exports.StyledTextArea = exports.StyledSelect = exports.StyledFormControl = exports.StyledDialog = exports.StatusPill = exports.StatusGrid = exports.SectionTitle = exports.Section = exports.ScopeButtonGroup = exports.ScopeButton = exports.ModalHeader = exports.MainSection = exports.ImpactSummary = exports.HelperText = exports.FooterActions = exports.BadgeCircle = exports.ActionButton = void 0;
9
+
10
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/taggedTemplateLiteral"));
11
+
12
+ var _styledComponents = _interopRequireDefault(require("styled-components"));
13
+
14
+ var _material = require("@mui/material");
15
+
16
+ var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8, _templateObject9, _templateObject10, _templateObject11, _templateObject12, _templateObject13, _templateObject14, _templateObject15, _templateObject16, _templateObject17;
17
+
18
+ var colors = {
19
+ background: 'rgba(0, 0, 0, 0.4)',
20
+ paper: '#FFFFFF',
21
+ primary: '#E039A7',
22
+ primaryHover: '#C82A91',
23
+ textMain: '#121212',
24
+ textMuted: '#666666',
25
+ border: '#E0E0E0',
26
+ inputBg: '#FFFFFF',
27
+ summaryBg: '#F9F9F9'
28
+ };
29
+ exports.colors = colors;
30
+ var StyledDialog = (0, _styledComponents.default)(_material.Dialog)(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n align-items: center;\n justify-content: center;\n\n .MuiDialog-container {\n width: 100%;\n display: flex;\n justify-content: center;\n align-items: center;\n }\n\n .MuiDialog-paper {\n background-color: ", ";\n color: ", ";\n border-radius: 5px;\n padding: 0;\n max-width: 38.5rem;\n max-height: 90vh;\n display: flex;\n flex-direction: column;\n overflow: hidden;\n width: 100%;\n box-shadow: 0 8px 32px rgba(0,0,0,0.15);\n font-family: \"Raleway\", sans-serif;\n }\n"])), colors.paper, colors.textMain);
31
+ exports.StyledDialog = StyledDialog;
32
+ var ModalHeader = (0, _styledComponents.default)(_material.Box)(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n flex-shrink: 0;\n position: relative;\n display: flex;\n align-items: center;\n padding: 20px 24px 16px;\n gap: 1rem;\n border-bottom: 1px solid rgba(0, 0, 0, 0.1);\n margin-bottom: 0.5rem;\n\n .close-icon {\n position: absolute;\n top: 12px;\n right: 12px;\n color: ", ";\n }\n\n h2 {\n font-size: 1.35rem;\n font-weight: 600;\n }\n\n p {\n margin: 0;\n color: ", ";\n font-size: 0.8rem;\n }\n"])), colors.primary, colors.textMuted);
33
+ exports.ModalHeader = ModalHeader;
34
+ var BadgeCircle = (0, _styledComponents.default)(_material.Box)(_templateObject3 || (_templateObject3 = (0, _taggedTemplateLiteral2.default)(["\n width: 40px;\n height: 40px;\n border-radius: 50%;\n border: 2px solid ", ";\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: ", ";\n color: ", ";\n\n svg {\n font-size: 1.5rem;\n }\n"])), colors.primary, colors.paper, colors.primary);
35
+ exports.BadgeCircle = BadgeCircle;
36
+ var MainSection = (0, _styledComponents.default)(_material.Box)(_templateObject4 || (_templateObject4 = (0, _taggedTemplateLiteral2.default)(["\n flex: 1;\n overflow-y: auto;\n padding-bottom: 20px;\n\n &::-webkit-scrollbar {\n width: 8px;\n }\n &::-webkit-scrollbar-track {\n background: transparent;\n }\n &::-webkit-scrollbar-thumb {\n background: #CCCCCC;\n border-radius: 4px;\n }\n &::-webkit-scrollbar-thumb:hover {\n background: #999999;\n }\n"])));
37
+ exports.MainSection = MainSection;
38
+ var Section = (0, _styledComponents.default)(_material.Box)(_templateObject5 || (_templateObject5 = (0, _taggedTemplateLiteral2.default)(["\n padding: 10px 32px;\n"])));
39
+ exports.Section = Section;
40
+
41
+ var SectionTitle = _styledComponents.default.h3(_templateObject6 || (_templateObject6 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 0.9rem;\n font-family: \"Raleway-500\", \"Raleway\", sans-serif;\n color: ", ";\n margin-bottom: 12px;\n"])), colors.textMuted);
42
+
43
+ exports.SectionTitle = SectionTitle;
44
+ var ScopeButtonGroup = (0, _styledComponents.default)(_material.Box)(_templateObject7 || (_templateObject7 = (0, _taggedTemplateLiteral2.default)(["\n display: grid;\n grid-template-columns: repeat(3, 1fr);\n gap: 12px;\n margin-bottom: 8px;\n"])));
45
+ exports.ScopeButtonGroup = ScopeButtonGroup;
46
+ var ScopeButton = (0, _styledComponents.default)(_material.Button)(_templateObject8 || (_templateObject8 = (0, _taggedTemplateLiteral2.default)(["\n && {\n border-radius: 5px;\n text-transform: none;\n text-wrap: nowrap;\n font-weight: 600;\n font-size: 12px;\n padding: 0.4rem 1rem;\n background-color: ", ";\n color: ", ";\n border: 1px solid ", ";\n font-family: \"Raleway-500\", \"Raleway\", sans-serif;\n\n &:hover {\n background-color: ", ";\n }\n\n svg {\n margin-right: 8px;\n font-size: 18px;\n }\n }\n"])), function (props) {
47
+ return props.active ? colors.primary : 'transparent';
48
+ }, function (props) {
49
+ return props.active ? '#FFFFFF' : colors.textMuted;
50
+ }, function (props) {
51
+ return props.active ? colors.primary : colors.border;
52
+ }, function (props) {
53
+ return props.active ? colors.primaryHover : colors.summaryBg;
54
+ });
55
+ exports.ScopeButton = ScopeButton;
56
+
57
+ var HelperText = _styledComponents.default.p(_templateObject9 || (_templateObject9 = (0, _taggedTemplateLiteral2.default)(["\n font-size: 0.8rem;\n color: ", ";\n margin: 8px 0 0;\n font-family: \"Raleway\", sans-serif;\n"])), colors.textMuted);
58
+
59
+ exports.HelperText = HelperText;
60
+ var StatusPill = (0, _styledComponents.default)(_material.Chip)(_templateObject10 || (_templateObject10 = (0, _taggedTemplateLiteral2.default)(["\n && {\n background-color: ", ";\n color: ", ";\n border: 1px solid ", ";\n font-weight: 600;\n border-radius: 5px;\n opacity: 1 !important;\n cursor: ", ";\n font-family: \"Raleway\", sans-serif;\n\n &:hover {\n background-color: ", ";\n }\n }\n"])), function (props) {
61
+ return props.selected ? colors.primary : props.disabled ? '#603888' : 'transparent';
62
+ }, function (props) {
63
+ return props.selected ? '#FFFFFF' : props.disabled ? 'white' : 'rgba(0, 0, 0, 0.45)';
64
+ }, function (props) {
65
+ return props.selected ? colors.primary : 'rgba(0, 0, 0, 0.25)';
66
+ }, function (props) {
67
+ return props.disabled ? 'not-allowed' : 'pointer';
68
+ }, function (props) {
69
+ return props.disabled ? 'transparent' : props.selected ? colors.primaryHover : 'rgba(0, 0, 0, 0.05)';
70
+ });
71
+ exports.StatusPill = StatusPill;
72
+ var StatusGrid = (0, _styledComponents.default)(_material.Box)(_templateObject11 || (_templateObject11 = (0, _taggedTemplateLiteral2.default)(["\n display: flex;\n flex-wrap: wrap;\n gap: 12px;\n"])));
73
+ exports.StatusGrid = StatusGrid;
74
+ var StyledTextArea = (0, _styledComponents.default)(_material.TextField)(_templateObject12 || (_templateObject12 = (0, _taggedTemplateLiteral2.default)(["\n && {\n width: 100%;\n background-color: ", ";\n border-radius: 8px;\n\n .MuiOutlinedInput-root {\n font-size: 14px;\n font-family: \"Raleway\", sans-serif;\n color: ", ";\n fieldset {\n border-color: ", ";\n }\n &:hover fieldset {\n border-color: #BDBDBD;\n }\n &.Mui-focused fieldset {\n border-color: ", ";\n }\n }\n }\n"])), colors.inputBg, colors.textMain, colors.border, colors.primary);
75
+ exports.StyledTextArea = StyledTextArea;
76
+ var StyledSelect = (0, _styledComponents.default)(_material.Select)(_templateObject13 || (_templateObject13 = (0, _taggedTemplateLiteral2.default)(["\n && {\n width: 100%;\n background-color: ", ";\n border-radius: 5px;\n font-family: \"Raleway\", sans-serif;\n font-size: 0.85rem;\n margin-bottom: 12px;\n\n .MuiSelect-select {\n padding: 8px 12px;\n display: flex;\n align-items: center;\n min-height: auto !important;\n }\n\n .MuiOutlinedInput-notchedOutline {\n border-color: ", ";\n }\n &:hover .MuiOutlinedInput-notchedOutline {\n border-color: #BDBDBD;\n }\n &.Mui-focused .MuiOutlinedInput-notchedOutline {\n border-color: ", ";\n }\n\n .MuiSvgIcon-root {\n color: ", ";\n font-size: 1.2rem;\n }\n }\n"])), colors.inputBg, colors.border, colors.primary, colors.textMuted);
77
+ exports.StyledSelect = StyledSelect;
78
+ var StyledFormControl = (0, _styledComponents.default)(_material.FormControl)(_templateObject14 || (_templateObject14 = (0, _taggedTemplateLiteral2.default)(["\n && {\n .MuiInputLabel-root {\n font-family: \"Raleway\", sans-serif;\n font-size: 0.85rem;\n color: ", ";\n transform: translate(14px, 10px) scale(1);\n\n &.MuiInputLabel-shrink {\n transform: translate(14px, -8px) scale(0.75);\n color: ", ";\n background-color: #fff;\n padding: 0 6px;\n }\n }\n }\n"])), colors.textMuted, colors.primary);
79
+ exports.StyledFormControl = StyledFormControl;
80
+ var FooterActions = (0, _styledComponents.default)(_material.Box)(_templateObject15 || (_templateObject15 = (0, _taggedTemplateLiteral2.default)(["\n flex-shrink: 0;\n display: flex;\n justify-content: flex-end;\n gap: 16px;\n padding: 16px 32px;\n background-color: ", ";\n border-top: 1px solid ", ";\n"])), colors.paper, colors.border);
81
+ exports.FooterActions = FooterActions;
82
+ var ActionButton = (0, _styledComponents.default)(_material.Button)(_templateObject16 || (_templateObject16 = (0, _taggedTemplateLiteral2.default)(["\n && {\n text-transform: none;\n font-family: \"Raleway-500\", \"Raleway\", sans-serif;\n padding: 4px 16px;\n border-radius: 5px;\n\n &.cancel {\n color: ", ";\n border: 1px solid ", ";\n &:hover {\n background-color: ", ";\n }\n }\n\n &.submit {\n background-color: ", ";\n color: #FFFFFF;\n &:hover {\n background-color: ", ";\n }\n &:disabled {\n opacity: 0.5;\n background-color: #CCCCCC;\n color: #888888;\n }\n }\n }\n"])), colors.textMain, colors.border, colors.summaryBg, colors.primary, colors.primaryHover);
83
+ exports.ActionButton = ActionButton;
84
+ var ImpactSummary = (0, _styledComponents.default)(_material.Box)(_templateObject17 || (_templateObject17 = (0, _taggedTemplateLiteral2.default)(["\n margin: 0 32px 32px;\n padding: 20px;\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: 12px;\n\n .summary-title {\n font-family: \"Raleway-500\", \"Raleway\", sans-serif;\n font-size: 0.9rem;\n color: ", ";\n margin-bottom: 16px;\n display: block;\n }\n\n .status-flow {\n display: flex;\n align-items: center;\n gap: 12px;\n margin-bottom: 16px;\n color: ", ";\n }\n\n .impact-counts {\n display: flex;\n gap: 24px;\n color: ", ";\n font-size: 0.85rem;\n\n div {\n display: flex;\n align-items: center;\n gap: 8px;\n }\n }\n"])), colors.summaryBg, colors.border, colors.textMuted, colors.textMain, colors.textMuted);
85
+ exports.ImpactSummary = ImpactSummary;