contentoh-components-library 21.5.84 → 21.5.86

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.
@@ -47,7 +47,7 @@ var _variables = require("../../../global-files/variables");
47
47
 
48
48
  var _templateObject;
49
49
 
50
- var Container = _styledComponents.default.button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background-color: #e33aa9;\n border: none;\n border-radius: 30px;\n color: #fff;\n font-family: ", ";\n font-style: normal;\n font-weight: normal;\n font-size: 18px;\n line-height: 22px;\n padding: 10px 25px;\n cursor: pointer;\n\n &:hover {\n opacity: 0.7;\n }\n\n &.general-purple-button {\n background-color: #603888;\n }\n\n &.general-transparent-button {\n background-color: transparent;\n border: 1px solid #503d66;\n color: #503d66;\n }\n &.general-white-button {\n background-color: ", ";\n color: ", ";\n }\n\n &.general-green-button {\n background-color: #71de56;\n }\n\n &.circular-button {\n width: 25px;\n height: 25px;\n padding: 0;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n\n &.accept-button {\n background-image: url(", ");\n }\n\n &.reject-button {\n background-image: url(", ");\n }\n\n &.null-button {\n background-image: url(", ");\n }\n\n &.save-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n\n &:hover {\n background-image: url(", ");\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.delete-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n background-size: 15px;\n\n &:hover {\n background-image: url(", ");\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.download-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n background-size: 15px;\n\n &:hover {\n color: white;\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.disabled {\n opacity: 0.5;\n }\n\n img {\n width: 100%;\n }\n\n &.version-button {\n color: ", ";\n border: 1px solid ", ";\n border-radius: 15px;\n font-size: 12px;\n line-height: 25px;\n text-align: center;\n filter: brightness(.35);\n }\n }\n\n &.general-arrow-button {\n background-image: url(", ");\n width: 27px;\n height: 27px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n }\n\n &.close-button {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.close-buttonv2 {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.close-button-white {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.open-modal-button {\n background-color: transparent;\n border: none;\n cursor: pointer;\n position: absolute;\n right: 10px;\n bottom: 10px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n width: 21px;\n height: 21px;\n padding: 0;\n border-radius: 0;\n background-image: url(", ");\n }\n\n &.grid-layout,\n &.row-layout {\n background-color: transparent;\n background-repeat: no-repeat;\n width: 24px;\n height: 24px;\n padding: 0;\n }\n\n &.grid-layout {\n background-image: url(", ");\n }\n\n &.row-layout {\n background-image: url(", ");\n }\n\n &.general-button-disabled {\n background-color: grey;\n color: ", ";\n\n &:hover {\n opacity: 1;\n }\n }\n &.general-button-rec {\n background:#85BC5B;\n color: ", ";\n padding: 4px 5px;\n border-radius: 3px;\n font-size: 10px;\n height: 20px;\n line-height: 12px;\n text-align: center;\n }\n\n &.general-button-sol {\n background-color: #e33aa9;\n border: none;\n border-radius: 50px;\n color: ", ";\n height: 34px;\n font-family: Avenir Next;\n font-style: normal;\n font-weight: normal;\n font-size: 12px;\n line-height: 14px;\n padding: 10px 15px;\n cursor: pointer;\n }\n"])), function (props) {
50
+ var Container = _styledComponents.default.button(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n background-color: #e33aa9;\n border: none;\n border-radius: 30px;\n color: #fff;\n font-family: ", ";\n font-style: normal;\n font-weight: normal;\n font-size: 18px;\n line-height: 22px;\n padding: 10px 25px;\n cursor: pointer;\n\n &:hover {\n opacity: 0.7;\n }\n\n &.general-purple-button {\n background-color: #603888;\n }\n\n &.general-pink-button {\n background-color: #E33AA9;\n }\n\n &.general-transparent-button {\n background-color: transparent;\n border: 1px solid #503d66;\n color: #503d66;\n }\n &.general-white-button {\n background-color: ", ";\n color: ", ";\n }\n\n &.general-green-button {\n background-color: #71de56;\n }\n\n &.circular-button {\n width: 25px;\n height: 25px;\n padding: 0;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n\n &.accept-button {\n background-image: url(", ");\n }\n\n &.reject-button {\n background-image: url(", ");\n }\n\n &.null-button {\n background-image: url(", ");\n }\n\n &.save-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n\n &:hover {\n background-image: url(", ");\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.delete-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n background-size: 15px;\n\n &:hover {\n background-image: url(", ");\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.download-button {\n background-image: url(", ");\n border: 1px solid ", ";\n border-radius: 15px;\n background-size: 15px;\n\n &:hover {\n color: white;\n background-color: ", ";\n border: 1px solid ", ";\n }\n }\n\n &.disabled {\n opacity: 0.5;\n }\n\n img {\n width: 100%;\n }\n\n &.version-button {\n color: ", ";\n border: 1px solid ", ";\n border-radius: 15px;\n font-size: 12px;\n line-height: 25px;\n text-align: center;\n filter: brightness(.35);\n }\n }\n\n &.general-arrow-button {\n background-image: url(", ");\n width: 27px;\n height: 27px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n }\n\n &.close-button {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.close-buttonv2 {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.close-button-white {\n width: 52px;\n height: 52px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n background-image: url(", ");\n }\n\n &.open-modal-button {\n background-color: transparent;\n border: none;\n cursor: pointer;\n position: absolute;\n right: 10px;\n bottom: 10px;\n background-color: transparent;\n background-repeat: no-repeat;\n background-position: center;\n width: 21px;\n height: 21px;\n padding: 0;\n border-radius: 0;\n background-image: url(", ");\n }\n\n &.grid-layout,\n &.row-layout {\n background-color: transparent;\n background-repeat: no-repeat;\n width: 24px;\n height: 24px;\n padding: 0;\n }\n\n &.grid-layout {\n background-image: url(", ");\n }\n\n &.row-layout {\n background-image: url(", ");\n }\n\n &.general-button-disabled {\n background-color: grey;\n color: ", ";\n\n &:hover {\n opacity: 1;\n }\n }\n &.general-button-rec {\n background:#85BC5B;\n color: ", ";\n padding: 4px 5px;\n border-radius: 3px;\n font-size: 10px;\n height: 20px;\n line-height: 12px;\n text-align: center;\n }\n\n &.general-button-sol {\n background-color: #e33aa9;\n border: none;\n border-radius: 50px;\n color: ", ";\n height: 34px;\n font-family: Avenir Next;\n font-style: normal;\n font-weight: normal;\n font-size: 12px;\n line-height: 14px;\n padding: 10px 15px;\n cursor: pointer;\n }\n"])), function (props) {
51
51
  return props.buttonFont;
52
52
  }, _variables.GlobalColors.s1, _variables.GlobalColors.original_purpura, _acceptIcon.default, _rejectIcon.default, _nullIcon.default, _saveIcon.default, _variables.GlobalColors.color_gray, _saveIconHover.default, _variables.GlobalColors.color_pink, _variables.GlobalColors.color_pink, _deleteIcon.default, _variables.GlobalColors.s3, _deleteIconHover.default, _variables.GlobalColors.magenta_s2, _variables.GlobalColors.magenta_s2, _downloadIcon.default, _variables.GlobalColors.s3, _variables.GlobalColors.magenta_s2, _variables.GlobalColors.magenta_s2, _variables.GlobalColors.color_purple, _variables.GlobalColors.color_purple, _arrowIcon.default, _closeIcon.default, _closeIconv.default, _closeIconWhite.default, _openModal.default, _rowLayout.default, _gridLayout.default, _variables.GlobalColors.white, _variables.GlobalColors.white, _variables.GlobalColors.white);
53
53
 
@@ -114,10 +114,12 @@ var GeneralInput = function GeneralInput(_ref) {
114
114
  setValueAccepted = _useState8[1];
115
115
 
116
116
  var updateParentData = function updateParentData(generalValue, isAiAccepted) {
117
+ var newBaseValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
117
118
  setTextValue({
118
119
  value: generalValue
119
120
  });
120
- var similarity = (0, _compareStrings.getTextSimilarityPercentage)(valueAccepted, generalValue);
121
+ var baseToCompare = newBaseValue !== null ? newBaseValue : valueAccepted;
122
+ var similarity = (0, _compareStrings.getTextSimilarityPercentage)(baseToCompare, generalValue);
121
123
  var generatedWithAi = (isAiAccepted || aiGenerated) && similarity >= 50;
122
124
 
123
125
  if (updatedDatasheets || updatedDescriptions || inputType === "textarea") {
@@ -230,7 +232,7 @@ var GeneralInput = function GeneralInput(_ref) {
230
232
  setValueAccepted(suggestionValue);
231
233
  setAiSuggestionAccepted(true);
232
234
  setIsAiActive(false);
233
- updateParentData(suggestionValue, true);
235
+ updateParentData(suggestionValue, true, suggestionValue);
234
236
  };
235
237
 
236
238
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Container, {
@@ -350,7 +350,7 @@ var TagAndInput = function TagAndInput(_ref) {
350
350
  }
351
351
 
352
352
  setInputsGeneratedWithAi(function (prev) {
353
- return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, prev), {}, (0, _defineProperty2.default)({}, "".concat(inputId, "-").concat(inputType, "-").concat(version !== null && version !== void 0 ? version : label), {
353
+ return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, prev), {}, (0, _defineProperty2.default)({}, "".concat(inputId, "-").concat(inputType, "-").concat(version), {
354
354
  inputType: inputType,
355
355
  inputId: inputId,
356
356
  version: version,
@@ -362,7 +362,7 @@ var TagAndInput = function TagAndInput(_ref) {
362
362
  (0, _react.useEffect)(function () {
363
363
  var _inputsGeneratedWithA;
364
364
 
365
- setIsAiGenerated(!!((_inputsGeneratedWithA = inputsGeneratedWithAi["".concat(inputId, "-").concat(inputType, "-").concat(version !== null && version !== void 0 ? version : label)]) !== null && _inputsGeneratedWithA !== void 0 && _inputsGeneratedWithA.isAiGenerated));
365
+ setIsAiGenerated(!!((_inputsGeneratedWithA = inputsGeneratedWithAi["".concat(inputId, "-").concat(inputType, "-").concat(version)]) !== null && _inputsGeneratedWithA !== void 0 && _inputsGeneratedWithA.isAiGenerated));
366
366
  }, [inputsGeneratedWithAi]);
367
367
  (0, _react.useEffect)(function () {
368
368
  setInputsUsingAi(function (prev) {
@@ -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;