contentoh-components-library 21.6.22 → 21.6.24
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/.env.test +1 -0
- package/dist/_utils/helper.js +47 -2
- package/dist/components/organisms/LinkVariantsModal/index.js +891 -186
- package/dist/components/organisms/LinkVariantsModal/styles.js +29 -5
- package/dist/components/pages/ProviderProductEdition/context/provider-product-edition.context.js +22 -13
- package/dist/components/pages/ProviderProductEdition/index.js +393 -110
- package/dist/components/pages/ProviderProductEdition/styles.js +2 -2
- package/package.json +1 -1
- package/src/_utils/helper.js +40 -0
- package/src/components/organisms/LinkVariantsModal/index.js +813 -117
- package/src/components/organisms/LinkVariantsModal/styles.js +256 -0
- package/src/components/pages/ProviderProductEdition/context/provider-product-edition.context.jsx +14 -1
- package/src/components/pages/ProviderProductEdition/index.js +223 -3
- package/src/components/pages/ProviderProductEdition/styles.js +68 -0
|
@@ -9,6 +9,10 @@ exports.LinkVariantsModal = void 0;
|
|
|
9
9
|
|
|
10
10
|
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
11
11
|
|
|
12
|
+
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/defineProperty"));
|
|
13
|
+
|
|
14
|
+
var _objectSpread6 = _interopRequireDefault(require("@babel/runtime/helpers/esm/objectSpread2"));
|
|
15
|
+
|
|
12
16
|
var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/toConsumableArray"));
|
|
13
17
|
|
|
14
18
|
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/esm/asyncToGenerator"));
|
|
@@ -21,6 +25,8 @@ var _axios = _interopRequireDefault(require("axios"));
|
|
|
21
25
|
|
|
22
26
|
var _api = require("./api");
|
|
23
27
|
|
|
28
|
+
var _helper = require("../../../_utils/helper");
|
|
29
|
+
|
|
24
30
|
var _styles = require("./styles");
|
|
25
31
|
|
|
26
32
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -73,6 +79,8 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
73
79
|
token = _ref.token,
|
|
74
80
|
_ref$endpoint = _ref.endpoint,
|
|
75
81
|
endpoint = _ref$endpoint === void 0 ? process.env.REACT_APP_VARIANTS_ENDPOINT : _ref$endpoint,
|
|
82
|
+
_ref$filtersEndpoint = _ref.filtersEndpoint,
|
|
83
|
+
filtersEndpoint = _ref$filtersEndpoint === void 0 ? process.env.REACT_APP_CREATE_PRODUCTS_FILTERS : _ref$filtersEndpoint,
|
|
76
84
|
onClose = _ref.onClose,
|
|
77
85
|
onLinked = _ref.onLinked;
|
|
78
86
|
|
|
@@ -111,50 +119,133 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
111
119
|
selected = _useState14[0],
|
|
112
120
|
setSelected = _useState14[1];
|
|
113
121
|
|
|
114
|
-
var _useState15 = (0, _react.useState)(
|
|
122
|
+
var _useState15 = (0, _react.useState)(0),
|
|
115
123
|
_useState16 = (0, _slicedToArray2.default)(_useState15, 2),
|
|
116
|
-
|
|
117
|
-
|
|
124
|
+
total = _useState16[0],
|
|
125
|
+
setTotal = _useState16[1];
|
|
118
126
|
|
|
119
|
-
var _useState17 = (0, _react.useState)(
|
|
127
|
+
var _useState17 = (0, _react.useState)(false),
|
|
120
128
|
_useState18 = (0, _slicedToArray2.default)(_useState17, 2),
|
|
121
|
-
|
|
122
|
-
|
|
129
|
+
hasMore = _useState18[0],
|
|
130
|
+
setHasMore = _useState18[1];
|
|
123
131
|
|
|
124
|
-
var _useState19 = (0, _react.useState)(
|
|
132
|
+
var _useState19 = (0, _react.useState)(false),
|
|
125
133
|
_useState20 = (0, _slicedToArray2.default)(_useState19, 2),
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
134
|
+
loadingMore = _useState20[0],
|
|
135
|
+
setLoadingMore = _useState20[1]; // Lo que el padre ofrece en cada dimensión, y lo que el usuario eligió de
|
|
136
|
+
// cada una. Se guardan por separado porque se eligen por separado: heredar
|
|
137
|
+
// todos los atributos no dice nada sobre qué fotos quiere la variante.
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
var _useState21 = (0, _react.useState)({
|
|
141
|
+
attributes: [],
|
|
142
|
+
descriptions: [],
|
|
143
|
+
images: [],
|
|
144
|
+
categoryRetailers: []
|
|
145
|
+
}),
|
|
130
146
|
_useState22 = (0, _slicedToArray2.default)(_useState21, 2),
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
var _useState23 = (0, _react.useState)(
|
|
147
|
+
offered = _useState22[0],
|
|
148
|
+
setOffered = _useState22[1];
|
|
149
|
+
|
|
150
|
+
var _useState23 = (0, _react.useState)({
|
|
151
|
+
attributes: [],
|
|
152
|
+
descriptions: [],
|
|
153
|
+
images: [],
|
|
154
|
+
categoryRetailers: []
|
|
155
|
+
}),
|
|
135
156
|
_useState24 = (0, _slicedToArray2.default)(_useState23, 2),
|
|
136
|
-
|
|
137
|
-
|
|
157
|
+
chosen = _useState24[0],
|
|
158
|
+
setChosen = _useState24[1];
|
|
138
159
|
|
|
139
|
-
var _useState25 = (0, _react.useState)(
|
|
160
|
+
var _useState25 = (0, _react.useState)(null),
|
|
140
161
|
_useState26 = (0, _slicedToArray2.default)(_useState25, 2),
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
162
|
+
nameScope = _useState26[0],
|
|
163
|
+
setNameScope = _useState26[1]; // Un modo por dimensión, y ninguno decidido de entrada: el usuario tiene que
|
|
164
|
+
// pasar por las cuatro antes de poder ligar. Preseleccionar "todo" hacía que
|
|
165
|
+
// se pudiera ligar sin haber mirado nada, que es justo lo que hay que evitar
|
|
166
|
+
// en una operación que sobrescribe valores capturados.
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
var _useState27 = (0, _react.useState)({
|
|
170
|
+
categoryRetailers: null,
|
|
171
|
+
descriptions: null,
|
|
172
|
+
attributes: null,
|
|
173
|
+
images: null
|
|
174
|
+
}),
|
|
145
175
|
_useState28 = (0, _slicedToArray2.default)(_useState27, 2),
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
176
|
+
modes = _useState28[0],
|
|
177
|
+
setModes = _useState28[1];
|
|
178
|
+
/*
|
|
179
|
+
Al ligar varios productos, la herencia puede ser la misma para todos o
|
|
180
|
+
distinta para cada uno.
|
|
181
|
+
Por defecto es la misma: es lo que se quiere casi siempre y evita repetir
|
|
182
|
+
cuatro decisiones por producto. Al desmarcarlo aparecen las pestañas y cada
|
|
183
|
+
producto guarda su propia selección en `perChild`.
|
|
184
|
+
*/
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
var _useState29 = (0, _react.useState)(true),
|
|
150
188
|
_useState30 = (0, _slicedToArray2.default)(_useState29, 2),
|
|
151
|
-
|
|
152
|
-
|
|
189
|
+
applyToAll = _useState30[0],
|
|
190
|
+
setApplyToAll = _useState30[1];
|
|
153
191
|
|
|
154
192
|
var _useState31 = (0, _react.useState)(null),
|
|
155
193
|
_useState32 = (0, _slicedToArray2.default)(_useState31, 2),
|
|
156
|
-
|
|
157
|
-
|
|
194
|
+
activeChild = _useState32[0],
|
|
195
|
+
setActiveChild = _useState32[1];
|
|
196
|
+
|
|
197
|
+
var _useState33 = (0, _react.useState)({}),
|
|
198
|
+
_useState34 = (0, _slicedToArray2.default)(_useState33, 2),
|
|
199
|
+
perChild = _useState34[0],
|
|
200
|
+
setPerChild = _useState34[1]; // Cadenas que el padre NO tiene y el usuario decidió agregar a la variante.
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
var _useState35 = (0, _react.useState)([]),
|
|
204
|
+
_useState36 = (0, _slicedToArray2.default)(_useState35, 2),
|
|
205
|
+
extraRetailers = _useState36[0],
|
|
206
|
+
setExtraRetailers = _useState36[1];
|
|
207
|
+
|
|
208
|
+
var _useState37 = (0, _react.useState)(""),
|
|
209
|
+
_useState38 = (0, _slicedToArray2.default)(_useState37, 2),
|
|
210
|
+
newRetailer = _useState38[0],
|
|
211
|
+
setNewRetailer = _useState38[1];
|
|
212
|
+
|
|
213
|
+
var _useState39 = (0, _react.useState)(""),
|
|
214
|
+
_useState40 = (0, _slicedToArray2.default)(_useState39, 2),
|
|
215
|
+
newDepartment = _useState40[0],
|
|
216
|
+
setNewDepartment = _useState40[1];
|
|
217
|
+
|
|
218
|
+
var _useState41 = (0, _react.useState)(""),
|
|
219
|
+
_useState42 = (0, _slicedToArray2.default)(_useState41, 2),
|
|
220
|
+
newCategory = _useState42[0],
|
|
221
|
+
setNewCategory = _useState42[1]; // Las categorías no son una lista plana: dependen de la cadena y del
|
|
222
|
+
// departamento. Es la misma cascada que usa el alta de productos, y se sirve
|
|
223
|
+
// del mismo endpoint para no acabar con dos árboles de categorías distintos.
|
|
224
|
+
|
|
225
|
+
|
|
226
|
+
var _useState43 = (0, _react.useState)({
|
|
227
|
+
retailers: [],
|
|
228
|
+
departments: [],
|
|
229
|
+
categories: []
|
|
230
|
+
}),
|
|
231
|
+
_useState44 = (0, _slicedToArray2.default)(_useState43, 2),
|
|
232
|
+
filters = _useState44[0],
|
|
233
|
+
setFilters = _useState44[1];
|
|
234
|
+
|
|
235
|
+
var _useState45 = (0, _react.useState)(false),
|
|
236
|
+
_useState46 = (0, _slicedToArray2.default)(_useState45, 2),
|
|
237
|
+
loadingFilters = _useState46[0],
|
|
238
|
+
setLoadingFilters = _useState46[1];
|
|
239
|
+
|
|
240
|
+
var _useState47 = (0, _react.useState)(false),
|
|
241
|
+
_useState48 = (0, _slicedToArray2.default)(_useState47, 2),
|
|
242
|
+
loading = _useState48[0],
|
|
243
|
+
setLoading = _useState48[1];
|
|
244
|
+
|
|
245
|
+
var _useState49 = (0, _react.useState)(null),
|
|
246
|
+
_useState50 = (0, _slicedToArray2.default)(_useState49, 2),
|
|
247
|
+
error = _useState50[0],
|
|
248
|
+
setError = _useState50[1];
|
|
158
249
|
|
|
159
250
|
var request = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
160
251
|
var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(action, body) {
|
|
@@ -198,13 +289,16 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
198
289
|
setSelected([]);
|
|
199
290
|
setRejected(null);
|
|
200
291
|
setSearched(false);
|
|
292
|
+
setTotal(0);
|
|
293
|
+
setHasMore(false);
|
|
201
294
|
setError(null);
|
|
202
295
|
setStep("search");
|
|
203
296
|
}, [mode]);
|
|
204
297
|
|
|
205
298
|
var search = /*#__PURE__*/function () {
|
|
206
299
|
var _ref3 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee2(event) {
|
|
207
|
-
var data;
|
|
300
|
+
var _data$total, data;
|
|
301
|
+
|
|
208
302
|
return _regenerator.default.wrap(function _callee2$(_context2) {
|
|
209
303
|
while (1) {
|
|
210
304
|
switch (_context2.prev = _context2.next) {
|
|
@@ -224,32 +318,94 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
224
318
|
data = _context2.sent;
|
|
225
319
|
setCandidates(data.candidates || []);
|
|
226
320
|
setRejected(data.rejected || null);
|
|
321
|
+
setTotal((_data$total = data.total) !== null && _data$total !== void 0 ? _data$total : (data.candidates || []).length);
|
|
322
|
+
setHasMore(!!data.hasMore);
|
|
227
323
|
setSearched(true);
|
|
228
|
-
_context2.next =
|
|
324
|
+
_context2.next = 17;
|
|
229
325
|
break;
|
|
230
326
|
|
|
231
|
-
case
|
|
232
|
-
_context2.prev =
|
|
327
|
+
case 14:
|
|
328
|
+
_context2.prev = 14;
|
|
233
329
|
_context2.t0 = _context2["catch"](3);
|
|
234
330
|
setError(readError(_context2.t0));
|
|
235
331
|
|
|
236
|
-
case
|
|
237
|
-
_context2.prev =
|
|
332
|
+
case 17:
|
|
333
|
+
_context2.prev = 17;
|
|
238
334
|
setLoading(false);
|
|
239
|
-
return _context2.finish(
|
|
335
|
+
return _context2.finish(17);
|
|
240
336
|
|
|
241
|
-
case
|
|
337
|
+
case 20:
|
|
242
338
|
case "end":
|
|
243
339
|
return _context2.stop();
|
|
244
340
|
}
|
|
245
341
|
}
|
|
246
|
-
}, _callee2, null, [[3,
|
|
342
|
+
}, _callee2, null, [[3, 14, 17, 20]]);
|
|
247
343
|
}));
|
|
248
344
|
|
|
249
345
|
return function search(_x3) {
|
|
250
346
|
return _ref3.apply(this, arguments);
|
|
251
347
|
};
|
|
252
348
|
}();
|
|
349
|
+
/*
|
|
350
|
+
Trae la siguiente página y la agrega a la lista.
|
|
351
|
+
Se acumula en vez de reemplazar porque la selección vive en esta pantalla: si
|
|
352
|
+
la página 2 borrara la 1, lo marcado antes desaparecería de la vista sin
|
|
353
|
+
dejar de estar seleccionado, y el usuario acabaría ligando productos que ya
|
|
354
|
+
no ve.
|
|
355
|
+
*/
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
var loadMore = /*#__PURE__*/function () {
|
|
359
|
+
var _ref4 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee3() {
|
|
360
|
+
var _data$total2, data;
|
|
361
|
+
|
|
362
|
+
return _regenerator.default.wrap(function _callee3$(_context3) {
|
|
363
|
+
while (1) {
|
|
364
|
+
switch (_context3.prev = _context3.next) {
|
|
365
|
+
case 0:
|
|
366
|
+
setLoadingMore(true);
|
|
367
|
+
setError(null);
|
|
368
|
+
_context3.prev = 2;
|
|
369
|
+
_context3.next = 5;
|
|
370
|
+
return request("search", {
|
|
371
|
+
mode: mode,
|
|
372
|
+
articleId: articleId,
|
|
373
|
+
query: query.trim(),
|
|
374
|
+
offset: candidates.length
|
|
375
|
+
});
|
|
376
|
+
|
|
377
|
+
case 5:
|
|
378
|
+
data = _context3.sent;
|
|
379
|
+
setCandidates(function (current) {
|
|
380
|
+
return [].concat((0, _toConsumableArray2.default)(current), (0, _toConsumableArray2.default)(data.candidates || []));
|
|
381
|
+
});
|
|
382
|
+
setTotal((_data$total2 = data.total) !== null && _data$total2 !== void 0 ? _data$total2 : total);
|
|
383
|
+
setHasMore(!!data.hasMore);
|
|
384
|
+
_context3.next = 14;
|
|
385
|
+
break;
|
|
386
|
+
|
|
387
|
+
case 11:
|
|
388
|
+
_context3.prev = 11;
|
|
389
|
+
_context3.t0 = _context3["catch"](2);
|
|
390
|
+
setError(readError(_context3.t0));
|
|
391
|
+
|
|
392
|
+
case 14:
|
|
393
|
+
_context3.prev = 14;
|
|
394
|
+
setLoadingMore(false);
|
|
395
|
+
return _context3.finish(14);
|
|
396
|
+
|
|
397
|
+
case 17:
|
|
398
|
+
case "end":
|
|
399
|
+
return _context3.stop();
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}, _callee3, null, [[2, 11, 14, 17]]);
|
|
403
|
+
}));
|
|
404
|
+
|
|
405
|
+
return function loadMore() {
|
|
406
|
+
return _ref4.apply(this, arguments);
|
|
407
|
+
};
|
|
408
|
+
}();
|
|
253
409
|
|
|
254
410
|
var toggle = function toggle(id) {
|
|
255
411
|
setSelected(function (current) {
|
|
@@ -261,124 +417,410 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
261
417
|
};
|
|
262
418
|
|
|
263
419
|
var goToInheritance = /*#__PURE__*/function () {
|
|
264
|
-
var
|
|
265
|
-
var _data$nameScope, data;
|
|
420
|
+
var _ref5 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee4() {
|
|
421
|
+
var _data$nameScope, data, listas;
|
|
266
422
|
|
|
267
|
-
return _regenerator.default.wrap(function
|
|
423
|
+
return _regenerator.default.wrap(function _callee4$(_context4) {
|
|
268
424
|
while (1) {
|
|
269
|
-
switch (
|
|
425
|
+
switch (_context4.prev = _context4.next) {
|
|
270
426
|
case 0:
|
|
271
427
|
setLoading(true);
|
|
272
428
|
setError(null);
|
|
273
|
-
|
|
274
|
-
|
|
429
|
+
_context4.prev = 2;
|
|
430
|
+
_context4.next = 5;
|
|
275
431
|
return request("attributes", {
|
|
276
432
|
parentArticleId: parentArticleId,
|
|
277
433
|
retailerId: activeRetailerId
|
|
278
434
|
});
|
|
279
435
|
|
|
280
436
|
case 5:
|
|
281
|
-
data =
|
|
282
|
-
|
|
437
|
+
data = _context4.sent;
|
|
438
|
+
listas = {
|
|
439
|
+
attributes: data.attributes || [],
|
|
440
|
+
descriptions: data.descriptions || [],
|
|
441
|
+
images: data.images || [],
|
|
442
|
+
categoryRetailers: data.categoryRetailers || []
|
|
443
|
+
};
|
|
444
|
+
setOffered(listas);
|
|
283
445
|
setNameScope((_data$nameScope = data.nameScope) !== null && _data$nameScope !== void 0 ? _data$nameScope : null);
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
446
|
+
setChosen({
|
|
447
|
+
attributes: [],
|
|
448
|
+
descriptions: [],
|
|
449
|
+
images: [],
|
|
450
|
+
categoryRetailers: []
|
|
451
|
+
});
|
|
452
|
+
setModes({
|
|
453
|
+
categoryRetailers: null,
|
|
454
|
+
descriptions: null,
|
|
455
|
+
attributes: null,
|
|
456
|
+
images: null
|
|
457
|
+
});
|
|
458
|
+
setExtraRetailers([]);
|
|
459
|
+
setPerChild({});
|
|
460
|
+
setApplyToAll(true);
|
|
461
|
+
setActiveChild(mode === "children" ? selected[0] : null);
|
|
287
462
|
setStep("inherit");
|
|
288
|
-
|
|
463
|
+
_context4.next = 21;
|
|
289
464
|
break;
|
|
290
465
|
|
|
291
|
-
case
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
setError(readError(
|
|
466
|
+
case 18:
|
|
467
|
+
_context4.prev = 18;
|
|
468
|
+
_context4.t0 = _context4["catch"](2);
|
|
469
|
+
setError(readError(_context4.t0));
|
|
295
470
|
|
|
296
|
-
case
|
|
297
|
-
|
|
471
|
+
case 21:
|
|
472
|
+
_context4.prev = 21;
|
|
298
473
|
setLoading(false);
|
|
299
|
-
return
|
|
474
|
+
return _context4.finish(21);
|
|
300
475
|
|
|
301
|
-
case
|
|
476
|
+
case 24:
|
|
302
477
|
case "end":
|
|
303
|
-
return
|
|
478
|
+
return _context4.stop();
|
|
304
479
|
}
|
|
305
480
|
}
|
|
306
|
-
},
|
|
481
|
+
}, _callee4, null, [[2, 18, 21, 24]]);
|
|
307
482
|
}));
|
|
308
483
|
|
|
309
484
|
return function goToInheritance() {
|
|
310
|
-
return
|
|
485
|
+
return _ref5.apply(this, arguments);
|
|
311
486
|
};
|
|
312
487
|
}();
|
|
313
488
|
|
|
314
|
-
var
|
|
315
|
-
|
|
316
|
-
|
|
489
|
+
var toggleChoice = function toggleChoice(dimension, id) {
|
|
490
|
+
setChosen(function (current) {
|
|
491
|
+
var lista = current[dimension];
|
|
492
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, current), {}, (0, _defineProperty2.default)({}, dimension, lista.includes(id) ? lista.filter(function (item) {
|
|
317
493
|
return item !== id;
|
|
318
|
-
}) : [].concat((0, _toConsumableArray2.default)(
|
|
494
|
+
}) : [].concat((0, _toConsumableArray2.default)(lista), [id])));
|
|
319
495
|
});
|
|
320
496
|
};
|
|
321
497
|
|
|
498
|
+
var chooseMode = function chooseMode(dimension, modo, ids) {
|
|
499
|
+
setModes(function (current) {
|
|
500
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, current), {}, (0, _defineProperty2.default)({}, dimension, modo));
|
|
501
|
+
});
|
|
502
|
+
setChosen(function (current) {
|
|
503
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, current), {}, (0, _defineProperty2.default)({}, dimension, modo === "all" ? ids : []));
|
|
504
|
+
});
|
|
505
|
+
};
|
|
506
|
+
|
|
507
|
+
var loadFilters = (0, _react.useCallback)( /*#__PURE__*/function () {
|
|
508
|
+
var _ref6 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee5(retailer, department) {
|
|
509
|
+
var _data, _ref7, res, _readPayload, body, lista;
|
|
510
|
+
|
|
511
|
+
return _regenerator.default.wrap(function _callee5$(_context5) {
|
|
512
|
+
while (1) {
|
|
513
|
+
switch (_context5.prev = _context5.next) {
|
|
514
|
+
case 0:
|
|
515
|
+
setLoadingFilters(true);
|
|
516
|
+
_context5.prev = 1;
|
|
517
|
+
_context5.next = 4;
|
|
518
|
+
return _axios.default.get("".concat(filtersEndpoint, "?retailerSelected=").concat(retailer !== null && retailer !== void 0 ? retailer : "", "&departmentSelected=").concat(department !== null && department !== void 0 ? department : ""), {
|
|
519
|
+
headers: {
|
|
520
|
+
Authorization: token
|
|
521
|
+
}
|
|
522
|
+
});
|
|
523
|
+
|
|
524
|
+
case 4:
|
|
525
|
+
res = _context5.sent;
|
|
526
|
+
_readPayload = (0, _api.readPayload)(res), body = _readPayload.body;
|
|
527
|
+
lista = (_data = (_ref7 = body ? JSON.parse(body) : res.data) === null || _ref7 === void 0 ? void 0 : _ref7.data) !== null && _data !== void 0 ? _data : [];
|
|
528
|
+
setFilters(function (current) {
|
|
529
|
+
if (!retailer) {
|
|
530
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, current), {}, {
|
|
531
|
+
retailers: lista.map(function (item) {
|
|
532
|
+
return {
|
|
533
|
+
value: item.id,
|
|
534
|
+
label: item.name
|
|
535
|
+
};
|
|
536
|
+
})
|
|
537
|
+
});
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
if (!department) {
|
|
541
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, current), {}, {
|
|
542
|
+
departments: lista.map(function (item) {
|
|
543
|
+
return {
|
|
544
|
+
value: item.category,
|
|
545
|
+
label: item.category
|
|
546
|
+
};
|
|
547
|
+
}),
|
|
548
|
+
categories: []
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, current), {}, {
|
|
553
|
+
categories: lista.map(function (item) {
|
|
554
|
+
return {
|
|
555
|
+
value: item.id,
|
|
556
|
+
label: item.name
|
|
557
|
+
};
|
|
558
|
+
})
|
|
559
|
+
});
|
|
560
|
+
});
|
|
561
|
+
_context5.next = 13;
|
|
562
|
+
break;
|
|
563
|
+
|
|
564
|
+
case 10:
|
|
565
|
+
_context5.prev = 10;
|
|
566
|
+
_context5.t0 = _context5["catch"](1);
|
|
567
|
+
console.error("linkVariants/filters: ", _context5.t0);
|
|
568
|
+
|
|
569
|
+
case 13:
|
|
570
|
+
_context5.prev = 13;
|
|
571
|
+
setLoadingFilters(false);
|
|
572
|
+
return _context5.finish(13);
|
|
573
|
+
|
|
574
|
+
case 16:
|
|
575
|
+
case "end":
|
|
576
|
+
return _context5.stop();
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
}, _callee5, null, [[1, 10, 13, 16]]);
|
|
580
|
+
}));
|
|
581
|
+
|
|
582
|
+
return function (_x4, _x5) {
|
|
583
|
+
return _ref6.apply(this, arguments);
|
|
584
|
+
};
|
|
585
|
+
}(), [filtersEndpoint, token]); // Las cadenas del catálogo se piden al entrar al paso de herencia, no al abrir
|
|
586
|
+
// el modal: quien solo busca y cancela no llega a necesitarlas.
|
|
587
|
+
|
|
588
|
+
(0, _react.useEffect)(function () {
|
|
589
|
+
if (step === "inherit" && !filters.retailers.length) {
|
|
590
|
+
loadFilters(null, null);
|
|
591
|
+
}
|
|
592
|
+
}, [step, filters.retailers.length, loadFilters]);
|
|
593
|
+
|
|
594
|
+
var addRetailer = function addRetailer() {
|
|
595
|
+
var retailerId = Number(newRetailer);
|
|
596
|
+
var categoryId = Number(newCategory);
|
|
597
|
+
if (!retailerId || !categoryId) return;
|
|
598
|
+
var clave = "".concat(retailerId, "-").concat(categoryId);
|
|
599
|
+
var yaEsta = offered.categoryRetailers.some(function (item) {
|
|
600
|
+
return "".concat(item.retailerId, "-").concat(item.categoryId) === clave;
|
|
601
|
+
}) || extraRetailers.some(function (item) {
|
|
602
|
+
return item.clave === clave;
|
|
603
|
+
});
|
|
604
|
+
if (yaEsta) return;
|
|
605
|
+
var retailer = filters.retailers.find(function (item) {
|
|
606
|
+
return Number(item.value) === retailerId;
|
|
607
|
+
});
|
|
608
|
+
var category = filters.categories.find(function (item) {
|
|
609
|
+
return Number(item.value) === categoryId;
|
|
610
|
+
});
|
|
611
|
+
setExtraRetailers(function (current) {
|
|
612
|
+
var _retailer$label, _category$label;
|
|
613
|
+
|
|
614
|
+
return [].concat((0, _toConsumableArray2.default)(current), [{
|
|
615
|
+
clave: clave,
|
|
616
|
+
retailerId: retailerId,
|
|
617
|
+
categoryId: categoryId,
|
|
618
|
+
retailerName: (_retailer$label = retailer === null || retailer === void 0 ? void 0 : retailer.label) !== null && _retailer$label !== void 0 ? _retailer$label : "Cadena ".concat(retailerId),
|
|
619
|
+
categoryName: (_category$label = category === null || category === void 0 ? void 0 : category.label) !== null && _category$label !== void 0 ? _category$label : "Categor\xEDa ".concat(categoryId)
|
|
620
|
+
}]);
|
|
621
|
+
});
|
|
622
|
+
setChosen(function (current) {
|
|
623
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, current), {}, {
|
|
624
|
+
categoryRetailers: [].concat((0, _toConsumableArray2.default)(current.categoryRetailers), [clave])
|
|
625
|
+
});
|
|
626
|
+
});
|
|
627
|
+
setNewRetailer("");
|
|
628
|
+
setNewDepartment("");
|
|
629
|
+
setNewCategory("");
|
|
630
|
+
};
|
|
631
|
+
/*
|
|
632
|
+
Convierte una selección de pantalla en el bloque `inherit` de la API.
|
|
633
|
+
Con el modo en "todos" se manda la palabra y no la lista que se pintó: si
|
|
634
|
+
entre la carga del modal y el guardado alguien agregó un valor al padre,
|
|
635
|
+
"todos" sigue significando todos. La lista sería una foto ya vieja.
|
|
636
|
+
Las parejas cadena+categoría viajan como objetos, no como ids, porque pueden
|
|
637
|
+
ser cadenas que el padre no tiene: ahí no hay nada que heredar, se asigna.
|
|
638
|
+
*/
|
|
639
|
+
|
|
640
|
+
|
|
641
|
+
var buildInherit = function buildInherit(seleccion) {
|
|
642
|
+
var _seleccion$extraRetai;
|
|
643
|
+
|
|
644
|
+
var parejas = [].concat((0, _toConsumableArray2.default)(offered.categoryRetailers.map(function (item) {
|
|
645
|
+
return {
|
|
646
|
+
clave: "".concat(item.retailerId, "-").concat(item.categoryId),
|
|
647
|
+
retailerId: item.retailerId,
|
|
648
|
+
categoryId: item.categoryId
|
|
649
|
+
};
|
|
650
|
+
})), (0, _toConsumableArray2.default)((_seleccion$extraRetai = seleccion.extraRetailers) !== null && _seleccion$extraRetai !== void 0 ? _seleccion$extraRetai : []));
|
|
651
|
+
return {
|
|
652
|
+
attributes: seleccion.modes.attributes === "all" ? "all-filled" : seleccion.chosen.attributes,
|
|
653
|
+
descriptions: seleccion.modes.descriptions === "all" ? "all" : seleccion.chosen.descriptions,
|
|
654
|
+
images: seleccion.modes.images === "all" ? "all" : seleccion.chosen.images,
|
|
655
|
+
categoryRetailers: parejas.filter(function (par) {
|
|
656
|
+
return seleccion.chosen.categoryRetailers.includes(par.clave);
|
|
657
|
+
}).map(function (_ref8) {
|
|
658
|
+
var retailerId = _ref8.retailerId,
|
|
659
|
+
categoryId = _ref8.categoryId;
|
|
660
|
+
return {
|
|
661
|
+
retailerId: retailerId,
|
|
662
|
+
categoryId: categoryId
|
|
663
|
+
};
|
|
664
|
+
})
|
|
665
|
+
};
|
|
666
|
+
};
|
|
667
|
+
|
|
668
|
+
var seleccionVacia = function seleccionVacia() {
|
|
669
|
+
return {
|
|
670
|
+
modes: {
|
|
671
|
+
categoryRetailers: null,
|
|
672
|
+
descriptions: null,
|
|
673
|
+
attributes: null,
|
|
674
|
+
images: null
|
|
675
|
+
},
|
|
676
|
+
chosen: {
|
|
677
|
+
attributes: [],
|
|
678
|
+
descriptions: [],
|
|
679
|
+
images: [],
|
|
680
|
+
categoryRetailers: []
|
|
681
|
+
},
|
|
682
|
+
extraRetailers: []
|
|
683
|
+
};
|
|
684
|
+
};
|
|
685
|
+
/*
|
|
686
|
+
Cambia de pestaña conservando lo elegido en la anterior. Sin esto, moverse
|
|
687
|
+
entre productos borraría el trabajo hecho en cada uno.
|
|
688
|
+
*/
|
|
689
|
+
|
|
690
|
+
|
|
691
|
+
var switchChild = function switchChild(id) {
|
|
692
|
+
var _perChild$id, _guardado$extraRetail;
|
|
693
|
+
|
|
694
|
+
setPerChild(function (current) {
|
|
695
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, current), {}, (0, _defineProperty2.default)({}, activeChild, {
|
|
696
|
+
modes: modes,
|
|
697
|
+
chosen: chosen,
|
|
698
|
+
extraRetailers: extraRetailers
|
|
699
|
+
}));
|
|
700
|
+
});
|
|
701
|
+
var guardado = (_perChild$id = perChild[id]) !== null && _perChild$id !== void 0 ? _perChild$id : seleccionVacia();
|
|
702
|
+
setModes(guardado.modes);
|
|
703
|
+
setChosen(guardado.chosen);
|
|
704
|
+
setExtraRetailers((_guardado$extraRetail = guardado.extraRetailers) !== null && _guardado$extraRetail !== void 0 ? _guardado$extraRetail : []);
|
|
705
|
+
setActiveChild(id);
|
|
706
|
+
};
|
|
707
|
+
|
|
322
708
|
var submit = /*#__PURE__*/function () {
|
|
323
|
-
var
|
|
324
|
-
var inherit, body, data;
|
|
325
|
-
return _regenerator.default.wrap(function
|
|
709
|
+
var _ref9 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee6() {
|
|
710
|
+
var inherit, inheritByChild, body, data;
|
|
711
|
+
return _regenerator.default.wrap(function _callee6$(_context6) {
|
|
326
712
|
while (1) {
|
|
327
|
-
switch (
|
|
713
|
+
switch (_context6.prev = _context6.next) {
|
|
328
714
|
case 0:
|
|
329
715
|
setLoading(true);
|
|
330
716
|
setError(null);
|
|
331
|
-
inherit = {
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
717
|
+
inherit = buildInherit({
|
|
718
|
+
modes: modes,
|
|
719
|
+
chosen: chosen,
|
|
720
|
+
extraRetailers: extraRetailers
|
|
721
|
+
}); // Con las pestañas abiertas cada producto manda la suya. La selección de la
|
|
722
|
+
// pestaña a la vista todavía no está en perChild, así que se agrega aquí: si
|
|
723
|
+
// no, lo último que tocó el usuario se perdería al guardar.
|
|
724
|
+
|
|
725
|
+
inheritByChild = !applyToAll && mode === "children" ? selected.reduce(function (acc, id) {
|
|
726
|
+
var guardado = id === activeChild ? {
|
|
727
|
+
modes: modes,
|
|
728
|
+
chosen: chosen,
|
|
729
|
+
extraRetailers: extraRetailers
|
|
730
|
+
} : perChild[id];
|
|
731
|
+
if (guardado) acc[id] = buildInherit(guardado);
|
|
732
|
+
return acc;
|
|
733
|
+
}, {}) : undefined;
|
|
337
734
|
body = mode === "parent" ? {
|
|
338
735
|
mode: mode,
|
|
339
736
|
articleId: articleId,
|
|
340
737
|
parentArticleId: selected[0],
|
|
341
738
|
inherit: inherit
|
|
342
|
-
} : {
|
|
739
|
+
} : (0, _objectSpread6.default)({
|
|
343
740
|
mode: mode,
|
|
344
741
|
parentArticleId: articleId,
|
|
345
742
|
childrenArticleIds: selected,
|
|
346
743
|
inherit: inherit
|
|
347
|
-
}
|
|
348
|
-
|
|
349
|
-
|
|
744
|
+
}, inheritByChild ? {
|
|
745
|
+
inheritByChild: inheritByChild
|
|
746
|
+
} : {});
|
|
747
|
+
_context6.prev = 5;
|
|
748
|
+
_context6.next = 8;
|
|
350
749
|
return request("link", body);
|
|
351
750
|
|
|
352
|
-
case
|
|
353
|
-
data =
|
|
354
|
-
|
|
751
|
+
case 8:
|
|
752
|
+
data = _context6.sent;
|
|
753
|
+
// El modo importa para quien escucha: en `children` este producto GANA
|
|
754
|
+
// variantes; en `parent` pasa a SER una. Son efectos opuestos sobre la
|
|
755
|
+
// misma ficha, así que quien refresque el estado necesita distinguirlos.
|
|
756
|
+
onLinked === null || onLinked === void 0 ? void 0 : onLinked((0, _objectSpread6.default)((0, _objectSpread6.default)({}, data), {}, {
|
|
757
|
+
mode: mode,
|
|
758
|
+
parentArticleId: mode === "parent" ? selected[0] : articleId
|
|
759
|
+
}));
|
|
355
760
|
onClose === null || onClose === void 0 ? void 0 : onClose();
|
|
356
|
-
|
|
761
|
+
_context6.next = 16;
|
|
357
762
|
break;
|
|
358
763
|
|
|
359
|
-
case
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
setError(readError(
|
|
764
|
+
case 13:
|
|
765
|
+
_context6.prev = 13;
|
|
766
|
+
_context6.t0 = _context6["catch"](5);
|
|
767
|
+
setError(readError(_context6.t0));
|
|
363
768
|
|
|
364
|
-
case
|
|
365
|
-
|
|
769
|
+
case 16:
|
|
770
|
+
_context6.prev = 16;
|
|
366
771
|
setLoading(false);
|
|
367
|
-
return
|
|
772
|
+
return _context6.finish(16);
|
|
368
773
|
|
|
369
|
-
case
|
|
774
|
+
case 19:
|
|
370
775
|
case "end":
|
|
371
|
-
return
|
|
776
|
+
return _context6.stop();
|
|
372
777
|
}
|
|
373
778
|
}
|
|
374
|
-
},
|
|
779
|
+
}, _callee6, null, [[5, 13, 16, 19]]);
|
|
375
780
|
}));
|
|
376
781
|
|
|
377
782
|
return function submit() {
|
|
378
|
-
return
|
|
783
|
+
return _ref9.apply(this, arguments);
|
|
379
784
|
};
|
|
380
|
-
}();
|
|
785
|
+
}(); // Una dimensión está decidida si el usuario eligió un modo, o si el padre no
|
|
786
|
+
// ofrece nada en ella —no se puede pedir que decida sobre una lista vacía—.
|
|
787
|
+
|
|
381
788
|
|
|
789
|
+
var decidida = function decidida(dimension) {
|
|
790
|
+
return modes[dimension] !== null || (dimension === "categoryRetailers" ? offered.categoryRetailers.length === 0 && extraRetailers.length === 0 : offered[dimension].length === 0);
|
|
791
|
+
};
|
|
792
|
+
|
|
793
|
+
var DIMENSIONES = ["categoryRetailers", "descriptions", "attributes", "images"]; // Con pestañas, que la que estoy viendo esté completa no basta: ligar escribe
|
|
794
|
+
// en todos, así que todos tienen que estar decididos. Si no, un producto se
|
|
795
|
+
// ligaría sin heredar nada solo porque nadie abrió su pestaña.
|
|
796
|
+
|
|
797
|
+
var decididoPara = function decididoPara(id) {
|
|
798
|
+
var guardado = id === activeChild ? {
|
|
799
|
+
modes: modes,
|
|
800
|
+
chosen: chosen,
|
|
801
|
+
extraRetailers: extraRetailers
|
|
802
|
+
} : perChild[id];
|
|
803
|
+
if (!guardado) return false;
|
|
804
|
+
return DIMENSIONES.every(function (dimension) {
|
|
805
|
+
var _guardado$extraRetail2;
|
|
806
|
+
|
|
807
|
+
if (guardado.modes[dimension] !== null) return true;
|
|
808
|
+
return dimension === "categoryRetailers" ? offered.categoryRetailers.length === 0 && ((_guardado$extraRetail2 = guardado.extraRetailers) !== null && _guardado$extraRetail2 !== void 0 ? _guardado$extraRetail2 : []).length === 0 : offered[dimension].length === 0;
|
|
809
|
+
});
|
|
810
|
+
};
|
|
811
|
+
|
|
812
|
+
var todoDecidido = step === "inherit" && (applyToAll || mode !== "children" ? DIMENSIONES.every(decidida) : selected.every(decididoPara));
|
|
813
|
+
var faltantes = [["categoryRetailers", "cadenas"], ["descriptions", "descripciones"], ["attributes", "atributos"], ["images", "imágenes"]].filter(function (_ref10) {
|
|
814
|
+
var _ref11 = (0, _slicedToArray2.default)(_ref10, 1),
|
|
815
|
+
clave = _ref11[0];
|
|
816
|
+
|
|
817
|
+
return !decidida(clave);
|
|
818
|
+
}).map(function (_ref12) {
|
|
819
|
+
var _ref13 = (0, _slicedToArray2.default)(_ref12, 2),
|
|
820
|
+
nombre = _ref13[1];
|
|
821
|
+
|
|
822
|
+
return nombre;
|
|
823
|
+
});
|
|
382
824
|
var selectionLabel = mode === "parent" ? "Se elige un solo producto padre." : "".concat(selected.length, " producto(s) pasar\xE1n a ser variantes.");
|
|
383
825
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Overlay, {
|
|
384
826
|
onClick: onClose,
|
|
@@ -463,113 +905,377 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
463
905
|
})
|
|
464
906
|
}, candidate.articleId);
|
|
465
907
|
})
|
|
908
|
+
}), searched && candidates.length > 0 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Paging, {
|
|
909
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
910
|
+
children: ["Mostrando ", candidates.length, " de ", total]
|
|
911
|
+
}), hasMore && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
912
|
+
type: "button",
|
|
913
|
+
onClick: loadMore,
|
|
914
|
+
disabled: loadingMore,
|
|
915
|
+
children: loadingMore ? "Cargando…" : "Cargar más"
|
|
916
|
+
})]
|
|
466
917
|
})]
|
|
467
918
|
}), step === "inherit" && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
468
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
469
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.
|
|
470
|
-
|
|
471
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
472
|
-
className: "choice",
|
|
919
|
+
children: [mode === "children" && selected.length > 1 && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
920
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
921
|
+
className: "apply-all",
|
|
473
922
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
474
|
-
type: "
|
|
475
|
-
checked:
|
|
476
|
-
onChange: function onChange() {
|
|
477
|
-
|
|
923
|
+
type: "checkbox",
|
|
924
|
+
checked: applyToAll,
|
|
925
|
+
onChange: function onChange(event) {
|
|
926
|
+
setApplyToAll(event.target.checked);
|
|
927
|
+
if (event.target.checked) setPerChild({});
|
|
478
928
|
}
|
|
479
929
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
480
|
-
children: ["
|
|
930
|
+
children: ["Aplicar lo mismo a los ", selected.length, " productos", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
481
931
|
className: "hint",
|
|
482
|
-
children:
|
|
932
|
+
children: "Desm\xE1rcalo si alguno debe heredar algo distinto."
|
|
483
933
|
})]
|
|
484
934
|
})]
|
|
485
|
-
}), /*#__PURE__*/(0, _jsxRuntime.
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
children:
|
|
935
|
+
}), !applyToAll && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Tabs, {
|
|
936
|
+
children: selected.map(function (id, indice) {
|
|
937
|
+
var producto = candidates.find(function (item) {
|
|
938
|
+
return item.articleId === id;
|
|
939
|
+
});
|
|
940
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("button", {
|
|
941
|
+
type: "button",
|
|
942
|
+
className: id === activeChild ? "active" : "",
|
|
943
|
+
onClick: function onClick() {
|
|
944
|
+
return switchChild(id);
|
|
945
|
+
},
|
|
946
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
947
|
+
className: "orden",
|
|
948
|
+
children: indice + 1
|
|
949
|
+
}), (producto === null || producto === void 0 ? void 0 : producto.name) || "Producto ".concat(id), decididoPara(id) && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
950
|
+
className: "listo",
|
|
951
|
+
"aria-label": "listo",
|
|
952
|
+
children: "\u2713"
|
|
953
|
+
})]
|
|
954
|
+
}, id);
|
|
955
|
+
})
|
|
956
|
+
})]
|
|
957
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Block, {
|
|
958
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h3", {
|
|
959
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
960
|
+
className: "paso",
|
|
961
|
+
children: "1"
|
|
962
|
+
}), " Cadenas y categor\xEDas"]
|
|
963
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Choices, {
|
|
964
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
965
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
966
|
+
type: "radio",
|
|
967
|
+
checked: modes.categoryRetailers === "all",
|
|
968
|
+
onChange: function onChange() {
|
|
969
|
+
return chooseMode("categoryRetailers", "all", offered.categoryRetailers.map(function (item) {
|
|
970
|
+
return "".concat(item.retailerId, "-").concat(item.categoryId);
|
|
971
|
+
}));
|
|
972
|
+
}
|
|
973
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
974
|
+
children: ["Todas las del producto padre", /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
975
|
+
className: "hint",
|
|
976
|
+
children: [offered.categoryRetailers.length, " cadena(s)."]
|
|
977
|
+
})]
|
|
978
|
+
})]
|
|
979
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
980
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
981
|
+
type: "radio",
|
|
982
|
+
checked: modes.categoryRetailers === "some",
|
|
983
|
+
onChange: function onChange() {
|
|
984
|
+
return chooseMode("categoryRetailers", "some", []);
|
|
985
|
+
}
|
|
986
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
987
|
+
children: ["Elegir cu\xE1les", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
988
|
+
className: "hint",
|
|
989
|
+
children: "Tambi\xE9n puedes agregar una cadena que el padre no tenga."
|
|
990
|
+
})]
|
|
497
991
|
})]
|
|
498
992
|
})]
|
|
993
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.List, {
|
|
994
|
+
children: [].concat((0, _toConsumableArray2.default)(offered.categoryRetailers.map(function (item) {
|
|
995
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, item), {}, {
|
|
996
|
+
clave: "".concat(item.retailerId, "-").concat(item.categoryId),
|
|
997
|
+
delPadre: true
|
|
998
|
+
});
|
|
999
|
+
})), (0, _toConsumableArray2.default)(extraRetailers.map(function (item) {
|
|
1000
|
+
return (0, _objectSpread6.default)((0, _objectSpread6.default)({}, item), {}, {
|
|
1001
|
+
delPadre: false
|
|
1002
|
+
});
|
|
1003
|
+
}))).map(function (item) {
|
|
1004
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
1005
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1006
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1007
|
+
type: "checkbox",
|
|
1008
|
+
disabled: modes.categoryRetailers === "all",
|
|
1009
|
+
checked: chosen.categoryRetailers.includes(item.clave),
|
|
1010
|
+
onChange: function onChange() {
|
|
1011
|
+
return toggleChoice("categoryRetailers", item.clave);
|
|
1012
|
+
}
|
|
1013
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
1014
|
+
className: "logo",
|
|
1015
|
+
src: (0, _helper.getRetailerPicture)(item.retailerId, 24, 24),
|
|
1016
|
+
alt: ""
|
|
1017
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1018
|
+
children: [item.retailerName, /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1019
|
+
className: "meta",
|
|
1020
|
+
children: [item.categoryName || "Sin categoría", !item.delPadre && " · no la tiene el padre"]
|
|
1021
|
+
})]
|
|
1022
|
+
})]
|
|
1023
|
+
})
|
|
1024
|
+
}, item.clave);
|
|
1025
|
+
})
|
|
1026
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.AddRetailer, {
|
|
1027
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
|
|
1028
|
+
value: newRetailer,
|
|
1029
|
+
onChange: function onChange(event) {
|
|
1030
|
+
var valor = event.target.value;
|
|
1031
|
+
setNewRetailer(valor);
|
|
1032
|
+
setNewDepartment("");
|
|
1033
|
+
setNewCategory("");
|
|
1034
|
+
if (valor) loadFilters(valor, null);
|
|
1035
|
+
},
|
|
1036
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
1037
|
+
value: "",
|
|
1038
|
+
children: "Agregar otra cadena\u2026"
|
|
1039
|
+
}), filters.retailers.map(function (item) {
|
|
1040
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
1041
|
+
value: item.value,
|
|
1042
|
+
children: item.label
|
|
1043
|
+
}, item.value);
|
|
1044
|
+
})]
|
|
1045
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
|
|
1046
|
+
value: newDepartment,
|
|
1047
|
+
disabled: !newRetailer || !filters.departments.length,
|
|
1048
|
+
onChange: function onChange(event) {
|
|
1049
|
+
var valor = event.target.value;
|
|
1050
|
+
setNewDepartment(valor);
|
|
1051
|
+
setNewCategory("");
|
|
1052
|
+
if (valor) loadFilters(newRetailer, valor);
|
|
1053
|
+
},
|
|
1054
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
1055
|
+
value: "",
|
|
1056
|
+
children: "Departamento\u2026"
|
|
1057
|
+
}), filters.departments.map(function (item) {
|
|
1058
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
1059
|
+
value: item.value,
|
|
1060
|
+
children: item.label
|
|
1061
|
+
}, item.value);
|
|
1062
|
+
})]
|
|
1063
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("select", {
|
|
1064
|
+
value: newCategory,
|
|
1065
|
+
disabled: !newDepartment || !filters.categories.length,
|
|
1066
|
+
onChange: function onChange(event) {
|
|
1067
|
+
return setNewCategory(event.target.value);
|
|
1068
|
+
},
|
|
1069
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
1070
|
+
value: "",
|
|
1071
|
+
children: "Categor\xEDa\u2026"
|
|
1072
|
+
}), filters.categories.map(function (item) {
|
|
1073
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("option", {
|
|
1074
|
+
value: item.value,
|
|
1075
|
+
children: item.label
|
|
1076
|
+
}, item.value);
|
|
1077
|
+
})]
|
|
1078
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
1079
|
+
type: "button",
|
|
1080
|
+
onClick: addRetailer,
|
|
1081
|
+
disabled: !newRetailer || !newCategory || loadingFilters,
|
|
1082
|
+
children: loadingFilters ? "…" : "Agregar"
|
|
1083
|
+
})]
|
|
499
1084
|
})]
|
|
500
|
-
}),
|
|
501
|
-
children:
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
1085
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Block, {
|
|
1086
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h3", {
|
|
1087
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1088
|
+
className: "paso",
|
|
1089
|
+
children: "2"
|
|
1090
|
+
}), " Descripciones"]
|
|
1091
|
+
}), offered.descriptions.length ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1092
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Choices, {
|
|
1093
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
506
1094
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
507
|
-
type: "
|
|
508
|
-
checked:
|
|
1095
|
+
type: "radio",
|
|
1096
|
+
checked: modes.descriptions === "all",
|
|
509
1097
|
onChange: function onChange() {
|
|
510
|
-
return
|
|
1098
|
+
return chooseMode("descriptions", "all", offered.descriptions.map(function (item) {
|
|
1099
|
+
return item.id;
|
|
1100
|
+
}));
|
|
511
1101
|
}
|
|
512
1102
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
513
|
-
children: [
|
|
514
|
-
className: "
|
|
515
|
-
children: "
|
|
516
|
-
}), attribute.ambiguousName && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
517
|
-
className: "note",
|
|
518
|
-
children: "se llama distinto en otra cadena"
|
|
1103
|
+
children: ["Todas las que tienen valor", /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1104
|
+
className: "hint",
|
|
1105
|
+
children: [offered.descriptions.length, " descripci\xF3n(es) con informaci\xF3n en el padre."]
|
|
519
1106
|
})]
|
|
520
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
521
|
-
className: "value",
|
|
522
|
-
title: attribute.value,
|
|
523
|
-
children: attribute.value
|
|
524
1107
|
})]
|
|
1108
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1109
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1110
|
+
type: "radio",
|
|
1111
|
+
checked: modes.descriptions === "some",
|
|
1112
|
+
onChange: function onChange() {
|
|
1113
|
+
return chooseMode("descriptions", "some", []);
|
|
1114
|
+
}
|
|
1115
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1116
|
+
children: ["Elegir cu\xE1les", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1117
|
+
className: "hint",
|
|
1118
|
+
children: "Lo que no elijas conserva el valor que ya tiene la variante."
|
|
1119
|
+
})]
|
|
1120
|
+
})]
|
|
1121
|
+
})]
|
|
1122
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.AttributeList, {
|
|
1123
|
+
children: offered.descriptions.map(function (item) {
|
|
1124
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
1125
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1126
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1127
|
+
type: "checkbox",
|
|
1128
|
+
disabled: modes.descriptions === "all",
|
|
1129
|
+
checked: chosen.descriptions.includes(item.id),
|
|
1130
|
+
onChange: function onChange() {
|
|
1131
|
+
return toggleChoice("descriptions", item.id);
|
|
1132
|
+
}
|
|
1133
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1134
|
+
children: [item.name, item.duplicated && /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1135
|
+
className: "note",
|
|
1136
|
+
children: ["el padre tiene ", item.rows, " versiones de este texto; se copian todas"]
|
|
1137
|
+
})]
|
|
1138
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1139
|
+
className: "value",
|
|
1140
|
+
title: item.value,
|
|
1141
|
+
children: item.value
|
|
1142
|
+
})]
|
|
1143
|
+
})
|
|
1144
|
+
}, item.id);
|
|
525
1145
|
})
|
|
526
|
-
}, attribute.id);
|
|
527
|
-
})
|
|
528
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Section, {
|
|
529
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("h3", {
|
|
530
|
-
children: "Tambi\xE9n se hereda"
|
|
531
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
532
|
-
className: "choice",
|
|
533
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
534
|
-
type: "checkbox",
|
|
535
|
-
checked: inheritImages,
|
|
536
|
-
onChange: function onChange() {
|
|
537
|
-
return setInheritImages(function (value) {
|
|
538
|
-
return !value;
|
|
539
|
-
});
|
|
540
|
-
}
|
|
541
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
542
|
-
children: "Im\xE1genes"
|
|
543
1146
|
})]
|
|
544
|
-
})
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
children: "
|
|
1147
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Message, {
|
|
1148
|
+
children: "El producto padre no tiene descripciones que heredar."
|
|
1149
|
+
})]
|
|
1150
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Block, {
|
|
1151
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h3", {
|
|
1152
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1153
|
+
className: "paso",
|
|
1154
|
+
children: "3"
|
|
1155
|
+
}), " Atributos de la ficha t\xE9cnica"]
|
|
1156
|
+
}), offered.attributes.length ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1157
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Choices, {
|
|
1158
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1159
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1160
|
+
type: "radio",
|
|
1161
|
+
checked: modes.attributes === "all",
|
|
1162
|
+
onChange: function onChange() {
|
|
1163
|
+
return chooseMode("attributes", "all", offered.attributes.map(function (item) {
|
|
1164
|
+
return item.id;
|
|
1165
|
+
}));
|
|
1166
|
+
}
|
|
1167
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1168
|
+
children: ["Todos los que tienen valor", /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1169
|
+
className: "hint",
|
|
1170
|
+
children: [offered.attributes.length, " atributo(s) con informaci\xF3n en el padre."]
|
|
1171
|
+
})]
|
|
1172
|
+
})]
|
|
1173
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1174
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1175
|
+
type: "radio",
|
|
1176
|
+
checked: modes.attributes === "some",
|
|
1177
|
+
onChange: function onChange() {
|
|
1178
|
+
return chooseMode("attributes", "some", []);
|
|
1179
|
+
}
|
|
1180
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1181
|
+
children: ["Elegir cu\xE1les", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1182
|
+
className: "hint",
|
|
1183
|
+
children: "Lo que no elijas conserva el valor que ya tiene la variante."
|
|
1184
|
+
})]
|
|
1185
|
+
})]
|
|
1186
|
+
})]
|
|
1187
|
+
}), activeRetailerId && !nameScope && /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Message, {
|
|
1188
|
+
children: "El producto padre no comparte la cadena que tienes abierta, as\xED que los nombres de abajo son los de otra de sus cadenas."
|
|
1189
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.AttributeList, {
|
|
1190
|
+
children: offered.attributes.map(function (attribute) {
|
|
1191
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("li", {
|
|
1192
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1193
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1194
|
+
type: "checkbox",
|
|
1195
|
+
disabled: modes.attributes === "all",
|
|
1196
|
+
checked: chosen.attributes.includes(attribute.id),
|
|
1197
|
+
onChange: function onChange() {
|
|
1198
|
+
return toggleChoice("attributes", attribute.id);
|
|
1199
|
+
}
|
|
1200
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1201
|
+
children: [attribute.name, attribute.unconfigured && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1202
|
+
className: "note",
|
|
1203
|
+
children: "sin configuraci\xF3n en las cadenas del padre"
|
|
1204
|
+
}), attribute.ambiguousName && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1205
|
+
className: "note",
|
|
1206
|
+
children: "se llama distinto en otra cadena"
|
|
1207
|
+
})]
|
|
1208
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1209
|
+
className: "value",
|
|
1210
|
+
title: attribute.value,
|
|
1211
|
+
children: attribute.value
|
|
1212
|
+
})]
|
|
1213
|
+
})
|
|
1214
|
+
}, attribute.id);
|
|
1215
|
+
})
|
|
556
1216
|
})]
|
|
557
|
-
})
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
children: [
|
|
569
|
-
|
|
570
|
-
|
|
1217
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Message, {
|
|
1218
|
+
children: "El producto padre no tiene atributos con valor que heredar."
|
|
1219
|
+
})]
|
|
1220
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Block, {
|
|
1221
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("h3", {
|
|
1222
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1223
|
+
className: "paso",
|
|
1224
|
+
children: "4"
|
|
1225
|
+
}), " Im\xE1genes"]
|
|
1226
|
+
}), offered.images.length ? /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
1227
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Choices, {
|
|
1228
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1229
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1230
|
+
type: "radio",
|
|
1231
|
+
checked: modes.images === "all",
|
|
1232
|
+
onChange: function onChange() {
|
|
1233
|
+
return chooseMode("images", "all", offered.images.map(function (item) {
|
|
1234
|
+
return item.id;
|
|
1235
|
+
}));
|
|
1236
|
+
}
|
|
1237
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1238
|
+
children: ["Todas", /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1239
|
+
className: "hint",
|
|
1240
|
+
children: [offered.images.length, " imagen(es) en el padre."]
|
|
1241
|
+
})]
|
|
1242
|
+
})]
|
|
1243
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1244
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1245
|
+
type: "radio",
|
|
1246
|
+
checked: modes.images === "some",
|
|
1247
|
+
onChange: function onChange() {
|
|
1248
|
+
return chooseMode("images", "some", []);
|
|
1249
|
+
}
|
|
1250
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("span", {
|
|
1251
|
+
children: ["Elegir cu\xE1les", /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1252
|
+
className: "hint",
|
|
1253
|
+
children: "\xDAtil cuando la variante cambia de color o de empaque."
|
|
1254
|
+
})]
|
|
1255
|
+
})]
|
|
571
1256
|
})]
|
|
1257
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.ImageGrid, {
|
|
1258
|
+
children: offered.images.map(function (image) {
|
|
1259
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("label", {
|
|
1260
|
+
className: [chosen.images.includes(image.id) ? "picked" : "", modes.images === "all" ? "locked" : ""].filter(Boolean).join(" "),
|
|
1261
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("input", {
|
|
1262
|
+
type: "checkbox",
|
|
1263
|
+
disabled: modes.images === "all",
|
|
1264
|
+
checked: chosen.images.includes(image.id),
|
|
1265
|
+
onChange: function onChange() {
|
|
1266
|
+
return toggleChoice("images", image.id);
|
|
1267
|
+
}
|
|
1268
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
|
1269
|
+
src: (0, _helper.getProductImage)(image.src),
|
|
1270
|
+
alt: image.imageType || "Imagen del producto"
|
|
1271
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
1272
|
+
children: image.imageType || "Sin tipo de toma"
|
|
1273
|
+
})]
|
|
1274
|
+
}, image.id);
|
|
1275
|
+
})
|
|
572
1276
|
})]
|
|
1277
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Message, {
|
|
1278
|
+
children: "El producto padre no tiene im\xE1genes que heredar."
|
|
573
1279
|
})]
|
|
574
1280
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_styles.Message, {
|
|
575
1281
|
children: "Lo que elijas heredar reemplaza el valor actual de la variante, incluso si alguien lo hab\xEDa capturado a mano."
|
|
@@ -578,7 +1284,9 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
578
1284
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)(_styles.Footer, {
|
|
579
1285
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
580
1286
|
className: "summary",
|
|
581
|
-
children: step === "search" ? selectionLabel :
|
|
1287
|
+
children: step === "search" ? selectionLabel : todoDecidido ? "Todo revisado. Puedes ligar." : !applyToAll && mode === "children" ? "Faltan ".concat(selected.filter(function (id) {
|
|
1288
|
+
return !decididoPara(id);
|
|
1289
|
+
}).length, " producto(s) por revisar.") : "Falta decidir: ".concat(faltantes.join(", "), ".")
|
|
582
1290
|
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
|
|
583
1291
|
className: "actions",
|
|
584
1292
|
children: [step === "inherit" && /*#__PURE__*/(0, _jsxRuntime.jsx)("button", {
|
|
@@ -605,10 +1313,7 @@ var LinkVariantsModal = function LinkVariantsModal(_ref) {
|
|
|
605
1313
|
type: "button",
|
|
606
1314
|
className: "primary",
|
|
607
1315
|
onClick: submit,
|
|
608
|
-
disabled: loading ||
|
|
609
|
-
// Con el padre sin atributos heredables, ligar sigue siendo
|
|
610
|
-
// válido: se heredan imágenes, descripciones y cadenas.
|
|
611
|
-
inheritMode === "selected" && attributes.length > 0 && !chosenAttributes.length,
|
|
1316
|
+
disabled: loading || !todoDecidido,
|
|
612
1317
|
children: loading ? "Ligando…" : "Ligar"
|
|
613
1318
|
})]
|
|
614
1319
|
})]
|