kupos-ui-components-lib 5.0.10 → 6.0.0

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.
@@ -137,462 +137,49 @@ const FilterBarDesktop = ({ t, serviceList, setServiceList, allSchedules, showRe
137
137
  if (isPeru) {
138
138
  if (fil.type == "seat_types") {
139
139
  let activeOptions = fil.options.filter((it) => it.active);
140
- // if (activeOptions && activeOptions.length > 0) {
141
140
  filteredRoutes = filteredRoutes.filter((it) => {
142
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0, _1;
143
- if (activeOptions && activeOptions.length)
141
+ if (activeOptions && activeOptions.length) {
142
+ // Check if ANY of the active filter options match ANY seat type
144
143
  for (let f of activeOptions) {
145
144
  if (f.active) {
146
- // New condition for B/C 140
147
- if (f.value.toLowerCase().indexOf("b/c 140") > -1) {
148
- for (let bt of it.seat_types) {
149
- if (((_a = bt === null || bt === void 0 ? void 0 : bt.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf("b/c 140")) > -1) {
150
- return true;
151
- }
152
- }
153
- }
154
- else if (f.value.toLowerCase().indexOf("v.relax 180") > -1) {
155
- for (let bt of it.seat_types) {
156
- if (((_b = bt === null || bt === void 0 ? void 0 : bt.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().indexOf("v.relax 180")) > -1) {
157
- return true;
158
- }
159
- }
160
- }
161
- else if (f.value.toLowerCase().indexOf("vip 2p 160") > -1) {
162
- for (let bt of it.seat_types) {
163
- if (((_c = bt === null || bt === void 0 ? void 0 : bt.label) === null || _c === void 0 ? void 0 : _c.toLowerCase().indexOf("vip 2p 160")) > -1) {
164
- return true;
165
- }
166
- }
167
- }
168
- else if (f.value.toLowerCase().indexOf("180°") > -1) {
169
- for (let bt of it.seat_types) {
170
- if (((_d = bt === null || bt === void 0 ? void 0 : bt.label) === null || _d === void 0 ? void 0 : _d.toLowerCase().indexOf("180°")) > -1) {
171
- return true;
172
- }
173
- }
174
- }
175
- else if (f.value.toLowerCase().indexOf("160°") > -1) {
176
- for (let bt of it.seat_types) {
177
- if (((_e = bt === null || bt === void 0 ? void 0 : bt.label) === null || _e === void 0 ? void 0 : _e.toLowerCase().indexOf("160°")) > -1) {
178
- return true;
179
- }
180
- }
181
- }
182
- else if (f.value.toLowerCase().indexOf("140°") > -1) {
183
- for (let bt of it.seat_types) {
184
- if (((_f = bt === null || bt === void 0 ? void 0 : bt.label) === null || _f === void 0 ? void 0 : _f.toLowerCase().indexOf("140°")) > -1) {
185
- return true;
186
- }
187
- }
188
- }
189
- else if (f.value.toLowerCase().indexOf("king service") > -1) {
190
- for (let bt of it.seat_types) {
191
- if (((_g = bt === null || bt === void 0 ? void 0 : bt.label) === null || _g === void 0 ? void 0 : _g.toLowerCase().indexOf("king service")) > -1) {
192
- return true;
193
- }
194
- }
195
- }
196
- else if (f.value.toLowerCase().indexOf("salon cama low") > -1) {
197
- for (let bt of it.seat_types) {
198
- if (((_h = bt === null || bt === void 0 ? void 0 : bt.label) === null || _h === void 0 ? void 0 : _h.toLowerCase().indexOf("salon cama low")) >
199
- -1) {
200
- return true;
201
- }
202
- }
203
- }
204
- else if (f.value.toLowerCase().indexOf("salón cama low") > -1) {
205
- for (let bt of it.seat_types) {
206
- if (((_j = bt === null || bt === void 0 ? void 0 : bt.label) === null || _j === void 0 ? void 0 : _j.toLowerCase().indexOf("salón cama low")) >
207
- -1) {
208
- return true;
209
- }
210
- }
211
- }
212
- else if (f.value.toLowerCase().indexOf("semi cama low") > -1) {
213
- for (let bt of it.seat_types) {
214
- if (((_k = bt === null || bt === void 0 ? void 0 : bt.label) === null || _k === void 0 ? void 0 : _k.toLowerCase().indexOf("semi cama low")) > -1) {
215
- return true;
216
- }
217
- }
218
- }
219
- else if (f.value.toLowerCase().indexOf("cama premium (i)") > -1) {
220
- for (let bt of it.seat_types) {
221
- if (((_l = bt === null || bt === void 0 ? void 0 : bt.label) === null || _l === void 0 ? void 0 : _l.toLowerCase().indexOf("cama premium (i)")) >
222
- -1) {
223
- return true;
224
- }
225
- }
226
- }
227
- else if (f.value.toLowerCase().indexOf("ejecutivo") > -1) {
228
- // for (let bt of it.fare_str.split(",")) {
229
- // if (
230
- // bt.toLowerCase().split(":")[0].indexOf("ejecutivo") > -1
231
- // ) {
232
- // return true;
233
- // }
234
- // }
235
- for (let bt of it.seat_types) {
236
- if (((_m = bt === null || bt === void 0 ? void 0 : bt.label) === null || _m === void 0 ? void 0 : _m.toLowerCase().indexOf("ejecutivo")) > -1) {
237
- return true;
238
- }
239
- }
240
- }
241
- else if (f.value.toLowerCase().indexOf("semi") > -1) {
242
- // for (let bt of it.fare_str.split(",")) {
243
- // if (bt.toLowerCase().split(":")[0].indexOf("semi") > -1) {
244
- // return true;
245
- // }
246
- // }
247
- for (let bt of it.seat_types) {
248
- if (((_o = bt === null || bt === void 0 ? void 0 : bt.label) === null || _o === void 0 ? void 0 : _o.toLowerCase().indexOf("semi")) > -1) {
249
- return true;
250
- }
251
- }
252
- }
253
- else if (f.value.toLowerCase().indexOf("salon") > -1) {
254
- // for (let bt of it.fare_str.split(",")) {
255
- // if (
256
- // bt.toLowerCase().split(":")[0].indexOf("salon") > -1
257
- // ) {
258
- // return true;
259
- // }
260
- // }
261
- for (let bt of it.seat_types) {
262
- if (((_p = bt === null || bt === void 0 ? void 0 : bt.label) === null || _p === void 0 ? void 0 : _p.toLowerCase().indexOf("salon")) > -1) {
263
- return true;
264
- }
265
- }
266
- }
267
- else if (f.value.toLowerCase().indexOf("salón") > -1) {
268
- // for (let bt of it.fare_str.split(",")) {
269
- // if (
270
- // bt.toLowerCase().split(":")[0].indexOf("salon") > -1
271
- // ) {
272
- // return true;
273
- // }
274
- // }
275
- for (let bt of it.seat_types) {
276
- if (((_q = bt === null || bt === void 0 ? void 0 : bt.label) === null || _q === void 0 ? void 0 : _q.toLowerCase().indexOf("salón")) > -1) {
277
- return true;
278
- }
279
- }
280
- }
281
- else if (f.value.toLowerCase().indexOf("suite") > -1) {
282
- // for (let bt of it.fare_str.split(",")) {
283
- // if (
284
- // bt.toLowerCase().split(":")[0].indexOf("suite") > -1
285
- // ) {
286
- // return true;
287
- // }
288
- // }
289
- for (let bt of it.seat_types) {
290
- if (((_r = bt === null || bt === void 0 ? void 0 : bt.label) === null || _r === void 0 ? void 0 : _r.toLowerCase().indexOf("suite")) > -1) {
291
- return true;
292
- }
293
- }
294
- }
295
- else if (f.value.toLowerCase().indexOf("premium") > -1) {
296
- // for (let bt of it.fare_str.split(",")) {
297
- // if (bt.toLowerCase().split(":")[0].indexOf("premium") > -1) {
298
- // return true;
299
- // }
300
- // }
301
- for (let bt of it.seat_types) {
302
- if (((_s = bt === null || bt === void 0 ? void 0 : bt.label) === null || _s === void 0 ? void 0 : _s.toLowerCase().indexOf("premium")) > -1) {
303
- return true;
304
- }
305
- }
306
- }
307
- else if (f.value.toLowerCase().indexOf("vip") > -1) {
308
- // for (let bt of it.fare_str.split(",")) {
309
- // if (bt.toLowerCase().split(":")[0].indexOf("vip") > -1) {
310
- // return true;
311
- // }
312
- // }
313
- for (let bt of it.seat_types) {
314
- if (((_t = bt === null || bt === void 0 ? void 0 : bt.label) === null || _t === void 0 ? void 0 : _t.toLowerCase().indexOf("vip")) > -1) {
315
- return true;
316
- }
317
- }
318
- }
319
- else if (f.value.toLowerCase().indexOf("express") > -1) {
320
- // for (let bt of it.fare_str.split(",")) {
321
- // if (bt.toLowerCase().split(":")[0].indexOf("vip") > -1) {
322
- // return true;
323
- // }
324
- // }
325
- for (let bt of it.seat_types) {
326
- if (((_u = bt === null || bt === void 0 ? void 0 : bt.label) === null || _u === void 0 ? void 0 : _u.toLowerCase().indexOf("express")) > -1) {
327
- return true;
328
- }
329
- }
330
- }
331
- else if (f.value.toLowerCase() == "cama") {
332
- // for (let bt of it.fare_str.split(",")) {
333
- // if (bt.toLowerCase().split(":")[0] == "cama") {
334
- // return true;
335
- // }
336
- // }
337
- for (let bt of it.seat_types) {
338
- if (((_v = bt === null || bt === void 0 ? void 0 : bt.label) === null || _v === void 0 ? void 0 : _v.toLowerCase().indexOf("cama")) > -1) {
339
- return true;
340
- }
341
- }
342
- }
343
- else if (f.value.toLowerCase() == "preferente") {
344
- // for (let bt of it.fare_str.split(",")) {
345
- // if (bt.toLowerCase().split(":")[0] == "preferente") {
346
- // return true;
347
- // }
348
- // }
349
- for (let bt of it.seat_types) {
350
- if (((_w = bt === null || bt === void 0 ? void 0 : bt.label) === null || _w === void 0 ? void 0 : _w.toLowerCase().indexOf("preferente")) > -1) {
351
- return true;
352
- }
353
- }
354
- }
355
- else if (f.value.toLowerCase().indexOf("vent") > -1) {
356
- // for (let bt of it.fare_str.split(",")) {
357
- // if (bt.toLowerCase().split(":")[0].indexOf("vent") > -1) {
358
- // return true;
359
- // }
360
- // }
361
- for (let bt of it.seat_types) {
362
- if (((_x = bt === null || bt === void 0 ? void 0 : bt.label) === null || _x === void 0 ? void 0 : _x.toLowerCase().indexOf("vent")) > -1) {
363
- return true;
364
- }
365
- }
366
- }
367
- else if (f.value.toLowerCase().indexOf("clasico") > -1) {
368
- // for (let bt of it.fare_str.split(",")) {
369
- // if (
370
- // bt.toLowerCase().split(":")[0].indexOf("clasico") > -1
371
- // ) {
372
- // return true;
373
- // }
374
- // }
375
- for (let bt of it.seat_types) {
376
- if (((_y = bt === null || bt === void 0 ? void 0 : bt.label) === null || _y === void 0 ? void 0 : _y.toLowerCase().indexOf("clasico")) > -1) {
377
- return true;
378
- }
379
- }
380
- }
381
- else if (f.value.toLowerCase().indexOf("killa plus") > -1) {
382
- for (let bt of it.seat_types) {
383
- if (((_z = bt === null || bt === void 0 ? void 0 : bt.label) === null || _z === void 0 ? void 0 : _z.toLowerCase().indexOf("killa plus")) > -1) {
384
- return true;
385
- }
386
- }
387
- }
388
- else if (f.value.toLowerCase().indexOf("inka plus") > -1) {
389
- for (let bt of it.seat_types) {
390
- if (((_0 = bt === null || bt === void 0 ? void 0 : bt.label) === null || _0 === void 0 ? void 0 : _0.toLowerCase().indexOf("inka plus")) > -1) {
391
- return true;
392
- }
393
- }
394
- }
395
- else if (f.value.toLowerCase().indexOf("emperador") > -1) {
396
- for (let bt of it.seat_types) {
397
- if (((_1 = bt === null || bt === void 0 ? void 0 : bt.label) === null || _1 === void 0 ? void 0 : _1.toLowerCase().indexOf("emperador")) > -1) {
398
- return true;
399
- }
400
- }
145
+ const filterValue = f.value.toLowerCase();
146
+ // Check if this filter value appears in any seat type label
147
+ const hasMatchingSeatType = it.seat_types.some((bt) => { var _a; return ((_a = bt === null || bt === void 0 ? void 0 : bt.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf(filterValue)) > -1; });
148
+ if (hasMatchingSeatType) {
149
+ return true;
401
150
  }
402
151
  }
403
152
  }
404
- else
153
+ return false;
154
+ }
155
+ else {
405
156
  return true;
157
+ }
406
158
  });
407
- // }
408
159
  }
409
160
  }
410
161
  else {
411
162
  if (fil.type == "seat_types") {
412
163
  let activeOptions = fil.options.filter((it) => it.active);
413
- // if (activeOptions && activeOptions.length > 0) {
414
164
  filteredRoutes = filteredRoutes.filter((it) => {
415
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q;
416
- if (activeOptions && activeOptions.length)
165
+ if (activeOptions && activeOptions.length) {
166
+ // Check if ANY of the active filter options match ANY seat type
417
167
  for (let f of activeOptions) {
418
168
  if (f.active) {
419
- if (f.value.toLowerCase().indexOf("salon cama low") > -1) {
420
- for (let bt of it.seat_types) {
421
- if (((_a = bt === null || bt === void 0 ? void 0 : bt.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf("salon cama low")) >
422
- -1) {
423
- return true;
424
- }
425
- }
426
- }
427
- else if (f.value.toLowerCase().indexOf("salón cama low") > -1) {
428
- for (let bt of it.seat_types) {
429
- if (((_b = bt === null || bt === void 0 ? void 0 : bt.label) === null || _b === void 0 ? void 0 : _b.toLowerCase().indexOf("salón cama low")) >
430
- -1) {
431
- return true;
432
- }
433
- }
434
- }
435
- else if (f.value.toLowerCase().indexOf("semi cama low") > -1) {
436
- for (let bt of it.seat_types) {
437
- if (((_c = bt === null || bt === void 0 ? void 0 : bt.label) === null || _c === void 0 ? void 0 : _c.toLowerCase().indexOf("semi cama low")) > -1) {
438
- return true;
439
- }
440
- }
441
- }
442
- else if (f.value.toLowerCase().indexOf("cama premium (i)") > -1) {
443
- for (let bt of it.seat_types) {
444
- if (((_d = bt === null || bt === void 0 ? void 0 : bt.label) === null || _d === void 0 ? void 0 : _d.toLowerCase().indexOf("cama premium (i)")) >
445
- -1) {
446
- return true;
447
- }
448
- }
449
- }
450
- else if (f.value.toLowerCase().indexOf("ejecutivo") > -1) {
451
- // for (let bt of it.fare_str.split(",")) {
452
- // if (
453
- // bt.toLowerCase().split(":")[0].indexOf("ejecutivo") > -1
454
- // ) {
455
- // return true;
456
- // }
457
- // }
458
- for (let bt of it.seat_types) {
459
- if (((_e = bt === null || bt === void 0 ? void 0 : bt.label) === null || _e === void 0 ? void 0 : _e.toLowerCase().indexOf("ejecutivo")) > -1) {
460
- return true;
461
- }
462
- }
463
- }
464
- else if (f.value.toLowerCase().indexOf("semi") > -1) {
465
- // for (let bt of it.fare_str.split(",")) {
466
- // if (bt.toLowerCase().split(":")[0].indexOf("semi") > -1) {
467
- // return true;
468
- // }
469
- // }
470
- for (let bt of it.seat_types) {
471
- if (((_f = bt === null || bt === void 0 ? void 0 : bt.label) === null || _f === void 0 ? void 0 : _f.toLowerCase().indexOf("semi")) > -1) {
472
- return true;
473
- }
474
- }
475
- }
476
- else if (f.value.toLowerCase().indexOf("salon") > -1) {
477
- for (let bt of it.fare_str.split(",")) {
478
- if (bt.toLowerCase().split(":")[0].indexOf("salon") > -1) {
479
- return true;
480
- }
481
- }
482
- for (let bt of it.seat_types) {
483
- if (((_g = bt === null || bt === void 0 ? void 0 : bt.label) === null || _g === void 0 ? void 0 : _g.toLowerCase().indexOf("salon")) > -1) {
484
- return true;
485
- }
486
- }
487
- }
488
- else if (f.value.toLowerCase().indexOf("salón") > -1) {
489
- // for (let bt of it.fare_str.split(",")) {
490
- // if (
491
- // bt.toLowerCase().split(":")[0].indexOf("salon") > -1
492
- // ) {
493
- // return true;
494
- // }
495
- // }
496
- for (let bt of it.seat_types) {
497
- if (((_h = bt === null || bt === void 0 ? void 0 : bt.label) === null || _h === void 0 ? void 0 : _h.toLowerCase().indexOf("salón")) > -1) {
498
- return true;
499
- }
500
- }
501
- }
502
- else if (f.value.toLowerCase().indexOf("suite") > -1) {
503
- // for (let bt of it.fare_str.split(",")) {
504
- // if (
505
- // bt.toLowerCase().split(":")[0].indexOf("suite") > -1
506
- // ) {
507
- // return true;
508
- // }
509
- // }
510
- for (let bt of it.seat_types) {
511
- if (((_j = bt === null || bt === void 0 ? void 0 : bt.label) === null || _j === void 0 ? void 0 : _j.toLowerCase().indexOf("suite")) > -1) {
512
- return true;
513
- }
514
- }
515
- }
516
- else if (f.value.toLowerCase().indexOf("premium") > -1) {
517
- // for (let bt of it.fare_str.split(",")) {
518
- // if (bt.toLowerCase().split(":")[0].indexOf("premium") > -1) {
519
- // return true;
520
- // }
521
- // }
522
- for (let bt of it.seat_types) {
523
- if (((_k = bt === null || bt === void 0 ? void 0 : bt.label) === null || _k === void 0 ? void 0 : _k.toLowerCase().indexOf("premium")) > -1) {
524
- return true;
525
- }
526
- }
527
- }
528
- else if (f.value.toLowerCase().indexOf("vip") > -1) {
529
- // for (let bt of it.fare_str.split(",")) {
530
- // if (bt.toLowerCase().split(":")[0].indexOf("vip") > -1) {
531
- // return true;
532
- // }
533
- // }
534
- for (let bt of it.seat_types) {
535
- if (((_l = bt === null || bt === void 0 ? void 0 : bt.label) === null || _l === void 0 ? void 0 : _l.toLowerCase().indexOf("vip")) > -1) {
536
- return true;
537
- }
538
- }
539
- }
540
- else if (f.value.toLowerCase() == "cama") {
541
- // for (let bt of it.fare_str.split(",")) {
542
- // if (bt.toLowerCase().split(":")[0] == "cama") {
543
- // return true;
544
- // }
545
- // }
546
- for (let bt of it.seat_types) {
547
- if (((_m = bt === null || bt === void 0 ? void 0 : bt.label) === null || _m === void 0 ? void 0 : _m.toLowerCase().indexOf("cama")) > -1) {
548
- return true;
549
- }
550
- }
551
- }
552
- else if (f.value.toLowerCase() == "preferente") {
553
- // for (let bt of it.fare_str.split(",")) {
554
- // if (bt.toLowerCase().split(":")[0] == "preferente") {
555
- // return true;
556
- // }
557
- // }
558
- for (let bt of it.seat_types) {
559
- if (((_o = bt === null || bt === void 0 ? void 0 : bt.label) === null || _o === void 0 ? void 0 : _o.toLowerCase().indexOf("preferente")) > -1) {
560
- return true;
561
- }
562
- }
563
- }
564
- else if (f.value.toLowerCase().indexOf("vent") > -1) {
565
- // for (let bt of it.fare_str.split(",")) {
566
- // if (bt.toLowerCase().split(":")[0].indexOf("vent") > -1) {
567
- // return true;
568
- // }
569
- // }
570
- for (let bt of it.seat_types) {
571
- if (((_p = bt === null || bt === void 0 ? void 0 : bt.label) === null || _p === void 0 ? void 0 : _p.toLowerCase().indexOf("vent")) > -1) {
572
- return true;
573
- }
574
- }
575
- }
576
- else if (f.value.toLowerCase().indexOf("clasico") > -1) {
577
- // for (let bt of it.fare_str.split(",")) {
578
- // if (
579
- // bt.toLowerCase().split(":")[0].indexOf("clasico") > -1
580
- // ) {
581
- // return true;
582
- // }
583
- // }
584
- for (let bt of it.seat_types) {
585
- if (((_q = bt === null || bt === void 0 ? void 0 : bt.label) === null || _q === void 0 ? void 0 : _q.toLowerCase().indexOf("clasico")) > -1) {
586
- return true;
587
- }
588
- }
169
+ const filterValue = f.value.toLowerCase();
170
+ // Check if this filter value appears in any seat type label
171
+ const hasMatchingSeatType = it.seat_types.some((bt) => { var _a; return ((_a = bt === null || bt === void 0 ? void 0 : bt.label) === null || _a === void 0 ? void 0 : _a.toLowerCase().indexOf(filterValue)) > -1; });
172
+ if (hasMatchingSeatType) {
173
+ return true;
589
174
  }
590
175
  }
591
176
  }
592
- else
177
+ return false;
178
+ }
179
+ else {
593
180
  return true;
181
+ }
594
182
  });
595
- // }
596
183
  }
597
184
  }
598
185
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kupos-ui-components-lib",
3
- "version": "5.0.10",
3
+ "version": "6.0.0",
4
4
  "description": "A reusable UI components package",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -170,506 +170,51 @@ const FilterBarDesktop = ({
170
170
  if (fil.type == "seat_types") {
171
171
  let activeOptions = fil.options.filter((it) => it.active);
172
172
 
173
- // if (activeOptions && activeOptions.length > 0) {
174
173
  filteredRoutes = filteredRoutes.filter((it) => {
175
- if (activeOptions && activeOptions.length)
174
+ if (activeOptions && activeOptions.length) {
175
+ // Check if ANY of the active filter options match ANY seat type
176
176
  for (let f of activeOptions) {
177
177
  if (f.active) {
178
- // New condition for B/C 140
179
- if (f.value.toLowerCase().indexOf("b/c 140") > -1) {
180
- for (let bt of it.seat_types) {
181
- if (bt?.label?.toLowerCase().indexOf("b/c 140") > -1) {
182
- return true;
183
- }
184
- }
185
- } else if (
186
- f.value.toLowerCase().indexOf("v.relax 180") > -1
187
- ) {
188
- for (let bt of it.seat_types) {
189
- if (
190
- bt?.label?.toLowerCase().indexOf("v.relax 180") > -1
191
- ) {
192
- return true;
193
- }
194
- }
195
- } else if (
196
- f.value.toLowerCase().indexOf("vip 2p 160") > -1
197
- ) {
198
- for (let bt of it.seat_types) {
199
- if (
200
- bt?.label?.toLowerCase().indexOf("vip 2p 160") > -1
201
- ) {
202
- return true;
203
- }
204
- }
205
- } else if (f.value.toLowerCase().indexOf("180°") > -1) {
206
- for (let bt of it.seat_types) {
207
- if (bt?.label?.toLowerCase().indexOf("180°") > -1) {
208
- return true;
209
- }
210
- }
211
- } else if (f.value.toLowerCase().indexOf("160°") > -1) {
212
- for (let bt of it.seat_types) {
213
- if (bt?.label?.toLowerCase().indexOf("160°") > -1) {
214
- return true;
215
- }
216
- }
217
- } else if (f.value.toLowerCase().indexOf("140°") > -1) {
218
- for (let bt of it.seat_types) {
219
- if (bt?.label?.toLowerCase().indexOf("140°") > -1) {
220
- return true;
221
- }
222
- }
223
- } else if (
224
- f.value.toLowerCase().indexOf("king service") > -1
225
- ) {
226
- for (let bt of it.seat_types) {
227
- if (
228
- bt?.label?.toLowerCase().indexOf("king service") > -1
229
- ) {
230
- return true;
231
- }
232
- }
233
- } else if (
234
- f.value.toLowerCase().indexOf("salon cama low") > -1
235
- ) {
236
- for (let bt of it.seat_types) {
237
- if (
238
- bt?.label?.toLowerCase().indexOf("salon cama low") >
239
- -1
240
- ) {
241
- return true;
242
- }
243
- }
244
- } else if (
245
- f.value.toLowerCase().indexOf("salón cama low") > -1
246
- ) {
247
- for (let bt of it.seat_types) {
248
- if (
249
- bt?.label?.toLowerCase().indexOf("salón cama low") >
250
- -1
251
- ) {
252
- return true;
253
- }
254
- }
255
- } else if (
256
- f.value.toLowerCase().indexOf("semi cama low") > -1
257
- ) {
258
- for (let bt of it.seat_types) {
259
- if (
260
- bt?.label?.toLowerCase().indexOf("semi cama low") > -1
261
- ) {
262
- return true;
263
- }
264
- }
265
- } else if (
266
- f.value.toLowerCase().indexOf("cama premium (i)") > -1
267
- ) {
268
- for (let bt of it.seat_types) {
269
- if (
270
- bt?.label?.toLowerCase().indexOf("cama premium (i)") >
271
- -1
272
- ) {
273
- return true;
274
- }
275
- }
276
- } else if (
277
- f.value.toLowerCase().indexOf("ejecutivo") > -1
278
- ) {
279
- // for (let bt of it.fare_str.split(",")) {
280
- // if (
281
- // bt.toLowerCase().split(":")[0].indexOf("ejecutivo") > -1
282
- // ) {
283
- // return true;
284
- // }
285
- // }
286
- for (let bt of it.seat_types) {
287
- if (
288
- bt?.label?.toLowerCase().indexOf("ejecutivo") > -1
289
- ) {
290
- return true;
291
- }
292
- }
293
- } else if (f.value.toLowerCase().indexOf("semi") > -1) {
294
- // for (let bt of it.fare_str.split(",")) {
295
- // if (bt.toLowerCase().split(":")[0].indexOf("semi") > -1) {
296
- // return true;
297
- // }
298
- // }
299
- for (let bt of it.seat_types) {
300
- if (bt?.label?.toLowerCase().indexOf("semi") > -1) {
301
- return true;
302
- }
303
- }
304
- } else if (f.value.toLowerCase().indexOf("salon") > -1) {
305
- // for (let bt of it.fare_str.split(",")) {
306
- // if (
307
- // bt.toLowerCase().split(":")[0].indexOf("salon") > -1
308
- // ) {
309
- // return true;
310
- // }
311
- // }
312
-
313
- for (let bt of it.seat_types) {
314
- if (bt?.label?.toLowerCase().indexOf("salon") > -1) {
315
- return true;
316
- }
317
- }
318
- } else if (f.value.toLowerCase().indexOf("salón") > -1) {
319
- // for (let bt of it.fare_str.split(",")) {
320
- // if (
321
- // bt.toLowerCase().split(":")[0].indexOf("salon") > -1
322
- // ) {
323
- // return true;
324
- // }
325
- // }
326
-
327
- for (let bt of it.seat_types) {
328
- if (bt?.label?.toLowerCase().indexOf("salón") > -1) {
329
- return true;
330
- }
331
- }
332
- } else if (f.value.toLowerCase().indexOf("suite") > -1) {
333
- // for (let bt of it.fare_str.split(",")) {
334
- // if (
335
- // bt.toLowerCase().split(":")[0].indexOf("suite") > -1
336
- // ) {
337
- // return true;
338
- // }
339
- // }
340
-
341
- for (let bt of it.seat_types) {
342
- if (bt?.label?.toLowerCase().indexOf("suite") > -1) {
343
- return true;
344
- }
345
- }
346
- } else if (f.value.toLowerCase().indexOf("premium") > -1) {
347
- // for (let bt of it.fare_str.split(",")) {
348
- // if (bt.toLowerCase().split(":")[0].indexOf("premium") > -1) {
349
- // return true;
350
- // }
351
- // }
352
-
353
- for (let bt of it.seat_types) {
354
- if (bt?.label?.toLowerCase().indexOf("premium") > -1) {
355
- return true;
356
- }
357
- }
358
- } else if (f.value.toLowerCase().indexOf("vip") > -1) {
359
- // for (let bt of it.fare_str.split(",")) {
360
- // if (bt.toLowerCase().split(":")[0].indexOf("vip") > -1) {
361
- // return true;
362
- // }
363
- // }
364
-
365
- for (let bt of it.seat_types) {
366
- if (bt?.label?.toLowerCase().indexOf("vip") > -1) {
367
- return true;
368
- }
369
- }
370
- } else if (f.value.toLowerCase().indexOf("express") > -1) {
371
- // for (let bt of it.fare_str.split(",")) {
372
- // if (bt.toLowerCase().split(":")[0].indexOf("vip") > -1) {
373
- // return true;
374
- // }
375
- // }
376
-
377
- for (let bt of it.seat_types) {
378
- if (bt?.label?.toLowerCase().indexOf("express") > -1) {
379
- return true;
380
- }
381
- }
382
- } else if (f.value.toLowerCase() == "cama") {
383
- // for (let bt of it.fare_str.split(",")) {
384
- // if (bt.toLowerCase().split(":")[0] == "cama") {
385
- // return true;
386
- // }
387
- // }
388
-
389
- for (let bt of it.seat_types) {
390
- if (bt?.label?.toLowerCase().indexOf("cama") > -1) {
391
- return true;
392
- }
393
- }
394
- } else if (f.value.toLowerCase() == "preferente") {
395
- // for (let bt of it.fare_str.split(",")) {
396
- // if (bt.toLowerCase().split(":")[0] == "preferente") {
397
- // return true;
398
- // }
399
- // }
400
-
401
- for (let bt of it.seat_types) {
402
- if (
403
- bt?.label?.toLowerCase().indexOf("preferente") > -1
404
- ) {
405
- return true;
406
- }
407
- }
408
- } else if (f.value.toLowerCase().indexOf("vent") > -1) {
409
- // for (let bt of it.fare_str.split(",")) {
410
- // if (bt.toLowerCase().split(":")[0].indexOf("vent") > -1) {
411
- // return true;
412
- // }
413
- // }
414
-
415
- for (let bt of it.seat_types) {
416
- if (bt?.label?.toLowerCase().indexOf("vent") > -1) {
417
- return true;
418
- }
419
- }
420
- } else if (f.value.toLowerCase().indexOf("clasico") > -1) {
421
- // for (let bt of it.fare_str.split(",")) {
422
- // if (
423
- // bt.toLowerCase().split(":")[0].indexOf("clasico") > -1
424
- // ) {
425
- // return true;
426
- // }
427
- // }
428
-
429
- for (let bt of it.seat_types) {
430
- if (bt?.label?.toLowerCase().indexOf("clasico") > -1) {
431
- return true;
432
- }
433
- }
434
- } else if (
435
- f.value.toLowerCase().indexOf("killa plus") > -1
436
- ) {
437
- for (let bt of it.seat_types) {
438
- if (
439
- bt?.label?.toLowerCase().indexOf("killa plus") > -1
440
- ) {
441
- return true;
442
- }
443
- }
444
- } else if (
445
- f.value.toLowerCase().indexOf("inka plus") > -1
446
- ) {
447
- for (let bt of it.seat_types) {
448
- if (
449
- bt?.label?.toLowerCase().indexOf("inka plus") > -1
450
- ) {
451
- return true;
452
- }
453
- }
454
- } else if (
455
- f.value.toLowerCase().indexOf("emperador") > -1
456
- ) {
457
- for (let bt of it.seat_types) {
458
- if (
459
- bt?.label?.toLowerCase().indexOf("emperador") > -1
460
- ) {
461
- return true;
462
- }
463
- }
178
+ const filterValue = f.value.toLowerCase();
179
+ // Check if this filter value appears in any seat type label
180
+ const hasMatchingSeatType = it.seat_types.some(
181
+ (bt) => bt?.label?.toLowerCase().indexOf(filterValue) > -1
182
+ );
183
+ if (hasMatchingSeatType) {
184
+ return true;
464
185
  }
465
186
  }
466
187
  }
467
- else return true;
188
+ return false;
189
+ } else {
190
+ return true;
191
+ }
468
192
  });
469
- // }
470
193
  }
471
194
  } else {
472
195
  if (fil.type == "seat_types") {
473
196
  let activeOptions = fil.options.filter((it) => it.active);
474
197
 
475
- // if (activeOptions && activeOptions.length > 0) {
476
198
  filteredRoutes = filteredRoutes.filter((it) => {
477
- if (activeOptions && activeOptions.length)
199
+ if (activeOptions && activeOptions.length) {
200
+ // Check if ANY of the active filter options match ANY seat type
478
201
  for (let f of activeOptions) {
479
202
  if (f.active) {
480
- if (f.value.toLowerCase().indexOf("salon cama low") > -1) {
481
- for (let bt of it.seat_types) {
482
- if (
483
- bt?.label?.toLowerCase().indexOf("salon cama low") >
484
- -1
485
- ) {
486
- return true;
487
- }
488
- }
489
- } else if (
490
- f.value.toLowerCase().indexOf("salón cama low") > -1
491
- ) {
492
- for (let bt of it.seat_types) {
493
- if (
494
- bt?.label?.toLowerCase().indexOf("salón cama low") >
495
- -1
496
- ) {
497
- return true;
498
- }
499
- }
500
- } else if (
501
- f.value.toLowerCase().indexOf("semi cama low") > -1
502
- ) {
503
- for (let bt of it.seat_types) {
504
- if (
505
- bt?.label?.toLowerCase().indexOf("semi cama low") > -1
506
- ) {
507
- return true;
508
- }
509
- }
510
- } else if (
511
- f.value.toLowerCase().indexOf("cama premium (i)") > -1
512
- ) {
513
- for (let bt of it.seat_types) {
514
- if (
515
- bt?.label?.toLowerCase().indexOf("cama premium (i)") >
516
- -1
517
- ) {
518
- return true;
519
- }
520
- }
521
- } else if (
522
- f.value.toLowerCase().indexOf("ejecutivo") > -1
523
- ) {
524
- // for (let bt of it.fare_str.split(",")) {
525
- // if (
526
- // bt.toLowerCase().split(":")[0].indexOf("ejecutivo") > -1
527
- // ) {
528
- // return true;
529
- // }
530
- // }
531
- for (let bt of it.seat_types) {
532
- if (
533
- bt?.label?.toLowerCase().indexOf("ejecutivo") > -1
534
- ) {
535
- return true;
536
- }
537
- }
538
- } else if (f.value.toLowerCase().indexOf("semi") > -1) {
539
- // for (let bt of it.fare_str.split(",")) {
540
- // if (bt.toLowerCase().split(":")[0].indexOf("semi") > -1) {
541
- // return true;
542
- // }
543
- // }
544
- for (let bt of it.seat_types) {
545
- if (bt?.label?.toLowerCase().indexOf("semi") > -1) {
546
- return true;
547
- }
548
- }
549
- } else if (f.value.toLowerCase().indexOf("salon") > -1) {
550
- for (let bt of it.fare_str.split(",")) {
551
- if (
552
- bt.toLowerCase().split(":")[0].indexOf("salon") > -1
553
- ) {
554
- return true;
555
- }
556
- }
557
-
558
- for (let bt of it.seat_types) {
559
- if (bt?.label?.toLowerCase().indexOf("salon") > -1) {
560
- return true;
561
- }
562
- }
563
- } else if (f.value.toLowerCase().indexOf("salón") > -1) {
564
- // for (let bt of it.fare_str.split(",")) {
565
- // if (
566
- // bt.toLowerCase().split(":")[0].indexOf("salon") > -1
567
- // ) {
568
- // return true;
569
- // }
570
- // }
571
-
572
- for (let bt of it.seat_types) {
573
- if (bt?.label?.toLowerCase().indexOf("salón") > -1) {
574
- return true;
575
- }
576
- }
577
- } else if (f.value.toLowerCase().indexOf("suite") > -1) {
578
- // for (let bt of it.fare_str.split(",")) {
579
- // if (
580
- // bt.toLowerCase().split(":")[0].indexOf("suite") > -1
581
- // ) {
582
- // return true;
583
- // }
584
- // }
585
-
586
- for (let bt of it.seat_types) {
587
- if (bt?.label?.toLowerCase().indexOf("suite") > -1) {
588
- return true;
589
- }
590
- }
591
- } else if (f.value.toLowerCase().indexOf("premium") > -1) {
592
- // for (let bt of it.fare_str.split(",")) {
593
- // if (bt.toLowerCase().split(":")[0].indexOf("premium") > -1) {
594
- // return true;
595
- // }
596
- // }
597
-
598
- for (let bt of it.seat_types) {
599
- if (bt?.label?.toLowerCase().indexOf("premium") > -1) {
600
- return true;
601
- }
602
- }
603
- } else if (f.value.toLowerCase().indexOf("vip") > -1) {
604
- // for (let bt of it.fare_str.split(",")) {
605
- // if (bt.toLowerCase().split(":")[0].indexOf("vip") > -1) {
606
- // return true;
607
- // }
608
- // }
609
-
610
- for (let bt of it.seat_types) {
611
- if (bt?.label?.toLowerCase().indexOf("vip") > -1) {
612
- return true;
613
- }
614
- }
615
- } else if (f.value.toLowerCase() == "cama") {
616
- // for (let bt of it.fare_str.split(",")) {
617
- // if (bt.toLowerCase().split(":")[0] == "cama") {
618
- // return true;
619
- // }
620
- // }
621
-
622
- for (let bt of it.seat_types) {
623
- if (bt?.label?.toLowerCase().indexOf("cama") > -1) {
624
- return true;
625
- }
626
- }
627
- } else if (f.value.toLowerCase() == "preferente") {
628
- // for (let bt of it.fare_str.split(",")) {
629
- // if (bt.toLowerCase().split(":")[0] == "preferente") {
630
- // return true;
631
- // }
632
- // }
633
-
634
- for (let bt of it.seat_types) {
635
- if (
636
- bt?.label?.toLowerCase().indexOf("preferente") > -1
637
- ) {
638
- return true;
639
- }
640
- }
641
- } else if (f.value.toLowerCase().indexOf("vent") > -1) {
642
- // for (let bt of it.fare_str.split(",")) {
643
- // if (bt.toLowerCase().split(":")[0].indexOf("vent") > -1) {
644
- // return true;
645
- // }
646
- // }
647
-
648
- for (let bt of it.seat_types) {
649
- if (bt?.label?.toLowerCase().indexOf("vent") > -1) {
650
- return true;
651
- }
652
- }
653
- } else if (f.value.toLowerCase().indexOf("clasico") > -1) {
654
- // for (let bt of it.fare_str.split(",")) {
655
- // if (
656
- // bt.toLowerCase().split(":")[0].indexOf("clasico") > -1
657
- // ) {
658
- // return true;
659
- // }
660
- // }
661
-
662
- for (let bt of it.seat_types) {
663
- if (bt?.label?.toLowerCase().indexOf("clasico") > -1) {
664
- return true;
665
- }
666
- }
203
+ const filterValue = f.value.toLowerCase();
204
+ // Check if this filter value appears in any seat type label
205
+ const hasMatchingSeatType = it.seat_types.some(
206
+ (bt) => bt?.label?.toLowerCase().indexOf(filterValue) > -1
207
+ );
208
+ if (hasMatchingSeatType) {
209
+ return true;
667
210
  }
668
211
  }
669
212
  }
670
- else return true;
213
+ return false;
214
+ } else {
215
+ return true;
216
+ }
671
217
  });
672
- // }
673
218
  }
674
219
  }
675
220
  }