kupos-ui-components-lib 5.0.9 → 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
  }
@@ -9,7 +9,8 @@ const FilterBarMobile = ({ tripStep, isOpen, setIsOpen, icons, busTerminals, myF
9
9
  let serviceList = getServiceListBasedOnTripStep(tripStep);
10
10
  const mySeatTypeFilters = getFilters(myFilters, "seat_type");
11
11
  const myBoradingStageFilters = getFilters(myFilters, "special_departure");
12
- let new_service_list = getNewServiceList(serviceList, selectedItems, mySeatTypeFilters, myBoradingStageFilters);
12
+ const myDropoffStageFilters = getFilters(myFilters, "dropoff_stage");
13
+ let new_service_list = getNewServiceList(serviceList, selectedItems, mySeatTypeFilters, myBoradingStageFilters, myDropoffStageFilters);
13
14
  setServiceListFilteredBasedOnTripStep(tripStep, new_service_list);
14
15
  }
15
16
  else {
@@ -47,10 +48,10 @@ const FilterBarMobile = ({ tripStep, isOpen, setIsOpen, icons, busTerminals, myF
47
48
  return (filters[filterType] &&
48
49
  filters[filterType].filter((filter) => filter.selected));
49
50
  };
50
- const getNewServiceList = (serviceList, selectedItems, mySeatTypeFilters, myBoradingStageFilters) => {
51
+ const getNewServiceList = (serviceList, selectedItems, mySeatTypeFilters, myBoradingStageFilters, myDropoffStageFilters) => {
51
52
  let new_service_list = [];
52
53
  serviceList === null || serviceList === void 0 ? void 0 : serviceList.map((service) => {
53
- let service_qualifing = isServiceQualifying(service, selectedItems, mySeatTypeFilters, myBoradingStageFilters);
54
+ let service_qualifing = isServiceQualifying(service, selectedItems, mySeatTypeFilters, myBoradingStageFilters, myDropoffStageFilters);
54
55
  if (service_qualifing) {
55
56
  new_service_list.push(service);
56
57
  }
@@ -65,24 +66,28 @@ const FilterBarMobile = ({ tripStep, isOpen, setIsOpen, icons, busTerminals, myF
65
66
  setServiceListReturnFiltered(new_service_list);
66
67
  }
67
68
  };
68
- const isServiceQualifying = (service, selectedItems, mySeatTypeFilters, myBoradingStageFilters) => {
69
+ const isServiceQualifying = (service, selectedItems, mySeatTypeFilters, myBoradingStageFilters, myDropoffStageFilters) => {
69
70
  let is_direct_service = service.is_direct_trip;
70
71
  let pet_friendly = service.pet_seat_info;
71
72
  let change_ticket = service.is_change_ticket;
72
73
  let fare_arr = service.seat_types;
73
74
  // let fare_arr = service.fare_str.split(",");
74
75
  let is_train_type = service.train_type_label;
76
+ let bus_comapnies = service.operator_service_name;
75
77
  let seat_type = fare_arr.map((fare) => {
76
78
  return fare.label;
77
79
  // return CommonService.getSeatNameForFilters(fare.split(":")[0]);
78
80
  });
79
81
  let boarding_stages = service.boarding_stages.split("|")[0];
82
+ let dropoff_stages = service.dropoff_stages.split("|")[0];
80
83
  let service_qualifing = false;
81
84
  let is_pet_friendly_applied = false;
82
85
  let is_direct_service_applied = false;
83
86
  let is_boarding_filter_applied = false;
84
87
  let is_change_ticket_applied = false;
85
88
  let is_train_type_applied = false;
89
+ let is_bus_company_applied = false;
90
+ let is_dropoff_filter_applied = false;
86
91
  selectedItems === null || selectedItems === void 0 ? void 0 : selectedItems.map((item) => {
87
92
  // ********** pet seat filter **********
88
93
  if (item.name === "Regular") {
@@ -226,6 +231,62 @@ const FilterBarMobile = ({ tripStep, isOpen, setIsOpen, icons, busTerminals, myF
226
231
  service_qualifing = true;
227
232
  }
228
233
  }
234
+ // ********** bus company filter **********
235
+ if (myFilters["bus_company"] &&
236
+ myFilters["bus_company"].some((comp) => comp.selected)) {
237
+ is_bus_company_applied = true;
238
+ let bus_company_found = false;
239
+ myFilters["bus_company"].forEach((comp) => {
240
+ if (comp.selected &&
241
+ comp.name === item.name &&
242
+ bus_comapnies === item.name) {
243
+ bus_company_found = true;
244
+ }
245
+ });
246
+ if (bus_company_found &&
247
+ !is_pet_friendly_applied &&
248
+ !is_direct_service_applied &&
249
+ !is_boarding_filter_applied &&
250
+ !is_change_ticket_applied) {
251
+ service_qualifing = true;
252
+ }
253
+ else if (bus_company_found &&
254
+ ((is_pet_friendly_applied && service_qualifing) ||
255
+ (is_direct_service_applied && service_qualifing) ||
256
+ (is_boarding_filter_applied && service_qualifing) ||
257
+ (is_change_ticket_applied && service_qualifing))) {
258
+ service_qualifing = true;
259
+ }
260
+ // Do not set service_qualifing = false here
261
+ }
262
+ if (myDropoffStageFilters && myDropoffStageFilters.length > 0) {
263
+ is_dropoff_filter_applied = true;
264
+ let showTopLabel = busTerminals[dropoff_stages] &&
265
+ busTerminals[dropoff_stages].split("|")[1] === "true" &&
266
+ busTerminals[dropoff_stages].split("|")[0];
267
+ let dropoff_stage_found = false;
268
+ myDropoffStageFilters.map((dropoff_stage) => {
269
+ if (item.name === dropoff_stage.name) {
270
+ if (showTopLabel === dropoff_stage.name &&
271
+ !is_pet_friendly_applied &&
272
+ !is_direct_service_applied &&
273
+ !is_boarding_filter_applied &&
274
+ !is_change_ticket_applied) {
275
+ dropoff_stage_found = true;
276
+ }
277
+ else if (showTopLabel === dropoff_stage.name &&
278
+ ((is_pet_friendly_applied && service_qualifing) ||
279
+ (is_direct_service_applied && service_qualifing) ||
280
+ (is_boarding_filter_applied && service_qualifing) ||
281
+ (is_change_ticket_applied && service_qualifing))) {
282
+ dropoff_stage_found = true;
283
+ }
284
+ }
285
+ });
286
+ if (dropoff_stage_found) {
287
+ service_qualifing = true;
288
+ }
289
+ }
229
290
  });
230
291
  return service_qualifing;
231
292
  };