kupos-ui-components-lib 5.0.9 → 5.0.10
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/dist/components/FilterBar/FilterBarMobile.js +65 -4
- package/dist/components/PaymentSideBar/PaymentSideBarMobile.js +31 -9
- package/dist/components/PaymentSideBar/types.d.ts +1 -0
- package/dist/components/ServiceItem/ServiceItemMobile.js +3 -3
- package/dist/styles.css +6 -3
- package/dist/utils/CommonService.d.ts +1 -1
- package/dist/utils/CommonService.js +2 -0
- package/package.json +1 -1
- package/src/components/FilterBar/FilterBarMobile.tsx +85 -4
- package/src/components/PaymentSideBar/PaymentSideBarMobile.tsx +49 -14
- package/src/components/PaymentSideBar/types.ts +1 -0
- package/src/components/ServiceItem/ServiceItemMobile.tsx +4 -3
- package/src/utils/CommonService.ts +2 -0
|
@@ -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
|
-
|
|
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
|
};
|
|
@@ -2,7 +2,15 @@ import React from "react";
|
|
|
2
2
|
import DateService from "../../utils/DateService";
|
|
3
3
|
import PaymentItem from "./PaymentItem";
|
|
4
4
|
import CommonService from "../../utils/CommonService";
|
|
5
|
-
const
|
|
5
|
+
const getRoundedHour = (duration) => {
|
|
6
|
+
const [hoursStr, minutesStr] = duration.split(":");
|
|
7
|
+
const hours = parseInt(hoursStr, 10);
|
|
8
|
+
const minutes = parseInt(minutesStr, 10);
|
|
9
|
+
const roundedHours = minutes < 30 ? hours : hours + 1;
|
|
10
|
+
return roundedHours;
|
|
11
|
+
};
|
|
12
|
+
const renderSummaryDetailsCard = ({ serviceName, date, source, dest, boardingStage, boardingTime, droppingStage, droppingTime, duration, trainType, isTrain, icons, isTacna, }) => {
|
|
13
|
+
console.log("🚀 ~ renderSummaryDetailsCard ~ droppingTime:", droppingTime);
|
|
6
14
|
return (React.createElement(React.Fragment, null,
|
|
7
15
|
React.createElement("div", { className: "mt-3 border-b border-[#ccc] text-[14px]" },
|
|
8
16
|
React.createElement("div", { className: "summary-details-card mb-[15px]" },
|
|
@@ -21,29 +29,41 @@ const renderSummaryDetailsCard = ({ serviceName, date, source, dest, boardingSta
|
|
|
21
29
|
React.createElement("div", { className: "w-5 h-5 rounded-full flex items-center justify-center mr-2" },
|
|
22
30
|
React.createElement("img", { src: icons === null || icons === void 0 ? void 0 : icons.origin, className: "w-[16px] h-[16px] mr-[5px]" })),
|
|
23
31
|
React.createElement("span", { className: "bold-text capitalize" }, source)),
|
|
24
|
-
React.createElement("div", { className: "
|
|
32
|
+
isTacna ? (React.createElement("div", { className: "address " },
|
|
33
|
+
boardingStage,
|
|
34
|
+
" ",
|
|
35
|
+
boardingTime && !(boardingStage === null || boardingStage === void 0 ? void 0 : boardingStage.includes("-")) ? (React.createElement("span", null,
|
|
36
|
+
"-",
|
|
37
|
+
DateService.ampmOnly(boardingTime))) : null)) : (React.createElement("div", { className: "ml-7 text-xs mt-[5px]" },
|
|
25
38
|
boardingStage,
|
|
26
39
|
". ",
|
|
27
|
-
boardingTime ? (React.createElement("span", null, DateService.formatTime(boardingTime))) : null)),
|
|
40
|
+
boardingTime ? (React.createElement("span", null, DateService.formatTime(boardingTime))) : null))),
|
|
28
41
|
React.createElement("div", { className: "mt-[15px]" },
|
|
29
42
|
React.createElement("div", { className: "flex items-center" },
|
|
30
43
|
React.createElement("div", { className: "w-5 h-5 rounded-full flex items-center justify-center mr-2" },
|
|
31
44
|
React.createElement("img", { src: icons === null || icons === void 0 ? void 0 : icons.destination, className: "w-[16px] h-[16px] mr-[5px]" })),
|
|
32
45
|
React.createElement("span", { className: "bold-text capitalize" }, dest)),
|
|
33
|
-
React.createElement("div", { className: "ml-7 text-xs mt-[5px]" },
|
|
46
|
+
isTacna ? (React.createElement("div", { className: " ml-7 text-xs mt-[5px]" },
|
|
47
|
+
droppingStage,
|
|
48
|
+
".",
|
|
49
|
+
" ",
|
|
50
|
+
droppingTime && !(droppingStage === null || droppingStage === void 0 ? void 0 : droppingStage.includes("-")) ? (React.createElement("span", null,
|
|
51
|
+
DateService.formatTime(droppingTime),
|
|
52
|
+
" aprox")) : null)) : (React.createElement("div", { className: "ml-7 text-xs mt-[5px]" },
|
|
34
53
|
droppingStage,
|
|
35
54
|
". ",
|
|
36
|
-
droppingTime ? (React.createElement("span", null, DateService.formatTime(droppingTime))) : null))),
|
|
55
|
+
droppingTime ? (React.createElement("span", null, DateService.formatTime(droppingTime))) : null)))),
|
|
37
56
|
duration && (React.createElement("div", { className: "mt-3 flex items-center text-xs text-gray-500 " },
|
|
38
57
|
React.createElement("div", { className: " flex items-center justify-center mr-2" },
|
|
39
58
|
React.createElement("img", { src: icons === null || icons === void 0 ? void 0 : icons.hours, className: "w-[16px] h-[16px] mr-[5px]" })),
|
|
40
59
|
React.createElement("span", null,
|
|
41
60
|
React.createElement("span", { className: "bold-text" }, "Duraci\u00F3n:"),
|
|
42
61
|
" ",
|
|
43
|
-
|
|
44
|
-
|
|
62
|
+
isTacna
|
|
63
|
+
? `${getRoundedHour(duration)}hrs aprox`
|
|
64
|
+
: `${duration} horas`)))))));
|
|
45
65
|
};
|
|
46
|
-
const PaymentSideBarMobile = ({ serviceNameOnward, serviceNameReturn, metaData, currencySign, dateOnward, dateReturn, sourceOnward, sourceReturn, destinationOnward, destinationReturn, boardingStageOnward, boardingStageReturn, droppingStageOnward, droppingStageReturn, boardingTimeOnward, boardingTimeReturn, droppingTimeOnward, droppingTimeReturn, durationOnward, durationReturn, selectSeatOnward, selectSeatReturn, journeyTypeActive, setJourneyTypeActive, translation, trainTypeOnward, trainTypeReturn, colors, trainType, icons, selectedOnward, selectedReturn, conexionChecked, conexionPassengers, returnConexionFare, conexionFare, loginData, checkWhatsappEligibility, removeDiscountAtomValue, netFare, promoCode, onPromoRemove, isAgency, agencyFee, walletMoney, virtualMoney, virtualLimit, showUsd, netFareInUsd, renderDiscount, discountAmount, currency, showWhatsappChargesInfo, setShowWhatsappChargesInfo, t, countdown, walletLabel, creditosLabel, }) => {
|
|
66
|
+
const PaymentSideBarMobile = ({ serviceNameOnward, serviceNameReturn, metaData, currencySign, dateOnward, dateReturn, sourceOnward, sourceReturn, destinationOnward, destinationReturn, boardingStageOnward, boardingStageReturn, droppingStageOnward, droppingStageReturn, boardingTimeOnward, boardingTimeReturn, droppingTimeOnward, droppingTimeReturn, durationOnward, durationReturn, selectSeatOnward, selectSeatReturn, journeyTypeActive, setJourneyTypeActive, translation, trainTypeOnward, trainTypeReturn, colors, trainType, icons, selectedOnward, selectedReturn, conexionChecked, conexionPassengers, returnConexionFare, conexionFare, loginData, checkWhatsappEligibility, removeDiscountAtomValue, netFare, promoCode, onPromoRemove, isAgency, agencyFee, walletMoney, virtualMoney, virtualLimit, showUsd, netFareInUsd, renderDiscount, discountAmount, currency, showWhatsappChargesInfo, setShowWhatsappChargesInfo, t, countdown, walletLabel, creditosLabel, isTacna, }) => {
|
|
47
67
|
return (React.createElement("div", { className: "pb-[10px]" },
|
|
48
68
|
React.createElement("div", { className: "border border-[#ccc] m-[20px] rounded-[20px] relative" },
|
|
49
69
|
React.createElement("div", { style: {
|
|
@@ -90,6 +110,7 @@ const PaymentSideBarMobile = ({ serviceNameOnward, serviceNameReturn, metaData,
|
|
|
90
110
|
trainType: trainTypeOnward,
|
|
91
111
|
isTrain: trainType,
|
|
92
112
|
icons: icons,
|
|
113
|
+
isTacna: isTacna,
|
|
93
114
|
})
|
|
94
115
|
: renderSummaryDetailsCard({
|
|
95
116
|
serviceName: serviceNameReturn,
|
|
@@ -104,6 +125,7 @@ const PaymentSideBarMobile = ({ serviceNameOnward, serviceNameReturn, metaData,
|
|
|
104
125
|
trainType: trainTypeReturn,
|
|
105
126
|
isTrain: trainType,
|
|
106
127
|
icons: icons,
|
|
128
|
+
isTacna: isTacna,
|
|
107
129
|
})),
|
|
108
130
|
React.createElement("div", { className: "mt-[15px] " },
|
|
109
131
|
React.createElement("div", { className: " text-[14px]", style: { margin: checkWhatsappEligibility ? "0" : "6px 0" } },
|
|
@@ -173,7 +195,7 @@ const PaymentSideBarMobile = ({ serviceNameOnward, serviceNameReturn, metaData,
|
|
|
173
195
|
walletMoney ? (React.createElement(PaymentItem, { label: walletLabel, amount: CommonService.currency(walletMoney, currencySign), className: "text-[14px]", customStyle: { color: "var(--secondary-color)" }, currency: "" })) : null,
|
|
174
196
|
virtualMoney ? (React.createElement(PaymentItem, { label: React.createElement("span", { className: "secondary-text", style: { color: "var(--secondary-color)" } }, `${creditosLabel}(${virtualLimit}%)`), amount: CommonService.currency(virtualMoney, currencySign), customStyle: { color: "var(--secondary-color)" }, className: "text-[14px]", currency: "" })) : null,
|
|
175
197
|
showUsd ? (React.createElement(PaymentItem, { label: React.createElement("span", { className: "primary-text" }, translation === null || translation === void 0 ? void 0 : translation.showUsd), amount: CommonService.currency(isAgency ? netFareInUsd + agencyFee : netFareInUsd, currencySign), currency: "USD", customStyle: { color: "var(--primary-color)" }, className: "text-[14px]" })) : null)),
|
|
176
|
-
React.createElement("div", { className: ` text-[#fff] p-[10px_15px] text-left w-full flex items-center absolute -bottom-[
|
|
198
|
+
React.createElement("div", { className: ` text-[#fff] p-[10px_15px] text-left w-full flex items-center absolute -bottom-[10%] pt-[50px] z-1 rounded-b-[14px] text-[14px]`, style: { backgroundColor: colors === null || colors === void 0 ? void 0 : colors.bottomStripColor } },
|
|
177
199
|
React.createElement("div", { className: "flex justify-between items-center w-full text-[#fff]" },
|
|
178
200
|
React.createElement("div", { className: "bold-text" }, "Total"),
|
|
179
201
|
React.createElement("div", { className: "bold-text text-[14px] text-[#fff]", style: {
|
|
@@ -181,7 +181,7 @@ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, o
|
|
|
181
181
|
.slice(0, 2)
|
|
182
182
|
.map((am, i) => {
|
|
183
183
|
var _a;
|
|
184
|
-
return (React.createElement("img", { key: i, className: "amenity", height:
|
|
184
|
+
return (React.createElement("img", { key: i, className: "amenity", height: 14, width: 14, src: getAmenitiesImage((_a = amenitiesData === null || amenitiesData === void 0 ? void 0 : amenitiesData[am]) === null || _a === void 0 ? void 0 : _a.toLowerCase()), alt: "icon" }));
|
|
185
185
|
});
|
|
186
186
|
return nodes;
|
|
187
187
|
};
|
|
@@ -273,7 +273,7 @@ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, o
|
|
|
273
273
|
React.createElement("div", { className: "flex items-center cursor-pointer ", style: { color: isSoldOut ? "#bbb" : "text-[#464647]" } },
|
|
274
274
|
React.createElement("span", { className: "ml-[3px] min-[420]:text-[13px] text-[11px] bold-text" }, serviceItem.operator_details[2])))),
|
|
275
275
|
React.createElement("div", { className: "flex relative ", style: { color: isSoldOut ? "#bbb" : "text-[#464647]" } },
|
|
276
|
-
React.createElement("div", { className: `w-[12px] h-auto mr-[2px] ${isSoldOut ? "grayscale" : ""}` }, renderIcon("hours", "
|
|
276
|
+
React.createElement("div", { className: `w-[12px] h-auto mr-[2px] ${isSoldOut ? "grayscale" : ""}` }, renderIcon("hours", "14px")),
|
|
277
277
|
React.createElement("div", { className: `cursor-default group min-[420]:text-[13px] text-[11px] ${isSoldOut ? "text-[#c0c0c0]" : ""}`, style: { lineHeight: "normal" } },
|
|
278
278
|
serviceItem.duration,
|
|
279
279
|
"hrs")),
|
|
@@ -300,7 +300,7 @@ function ServiceItemMobile({ serviceItem, onBookButtonPress, colors, busStage, o
|
|
|
300
300
|
React.createElement("div", { className: `h-auto mr-[4px] min-[420]:text-[13px] text-[11px] text-[#464647] ${isSoldOut ? "grayscale" : ""}` },
|
|
301
301
|
React.createElement(LottiePlayer, { animationData: serviceItem.icons.locationAnim, width: "20px", height: "20px" })))),
|
|
302
302
|
(serviceItem.is_change_ticket || isPetSeat) && (React.createElement("img", { src: serviceItem.icons.plus, alt: "icon", width: 11 })))))),
|
|
303
|
-
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text) && (React.createElement("div", { className: ` text-white p-[
|
|
303
|
+
(serviceItem === null || serviceItem === void 0 ? void 0 : serviceItem.offer_text) && (React.createElement("div", { className: ` text-white p-[10px_15px] text-left w-full flex items-center absolute -bottom-[40px] pt-[50px] z-10 rounded-b-[14px] min-[420]:text-[14px] text-[12px]`, style: {
|
|
304
304
|
backgroundColor: isSoldOut ? "#ccc" : colors === null || colors === void 0 ? void 0 : colors.bottomStripColor,
|
|
305
305
|
zIndex: -1,
|
|
306
306
|
color: "#fff",
|
package/dist/styles.css
CHANGED
|
@@ -60,9 +60,15 @@
|
|
|
60
60
|
.-bottom-\[9\%\] {
|
|
61
61
|
bottom: calc(9% * -1);
|
|
62
62
|
}
|
|
63
|
+
.-bottom-\[10\%\] {
|
|
64
|
+
bottom: calc(10% * -1);
|
|
65
|
+
}
|
|
63
66
|
.-bottom-\[36px\] {
|
|
64
67
|
bottom: calc(36px * -1);
|
|
65
68
|
}
|
|
69
|
+
.-bottom-\[40px\] {
|
|
70
|
+
bottom: calc(40px * -1);
|
|
71
|
+
}
|
|
66
72
|
.-bottom-\[160px\] {
|
|
67
73
|
bottom: calc(160px * -1);
|
|
68
74
|
}
|
|
@@ -610,9 +616,6 @@
|
|
|
610
616
|
-o-object-fit: contain;
|
|
611
617
|
object-fit: contain;
|
|
612
618
|
}
|
|
613
|
-
.p-\[5px_15px\] {
|
|
614
|
-
padding: 5px 15px;
|
|
615
|
-
}
|
|
616
619
|
.p-\[6px_0px\] {
|
|
617
620
|
padding: 6px 0px;
|
|
618
621
|
}
|
|
@@ -28,7 +28,7 @@ declare const commonService: {
|
|
|
28
28
|
options: any[];
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
|
-
getServiceTypeLabelForFilters: (service_type: any) => "" | "Tipo de servicio" | "Punto de embarque" | "Tipos de asiento";
|
|
31
|
+
getServiceTypeLabelForFilters: (service_type: any) => "" | "Tipo de servicio" | "Punto de embarque" | "Tipos de asiento" | "SERVICIOS";
|
|
32
32
|
getSeatNameForFilters: (rawSeat: any) => any;
|
|
33
33
|
capitalize: (str: any) => any;
|
|
34
34
|
};
|
package/package.json
CHANGED
|
@@ -34,12 +34,14 @@ const FilterBarMobile = ({
|
|
|
34
34
|
let serviceList = getServiceListBasedOnTripStep(tripStep);
|
|
35
35
|
const mySeatTypeFilters = getFilters(myFilters, "seat_type");
|
|
36
36
|
const myBoradingStageFilters = getFilters(myFilters, "special_departure");
|
|
37
|
+
const myDropoffStageFilters = getFilters(myFilters, "dropoff_stage");
|
|
37
38
|
|
|
38
39
|
let new_service_list = getNewServiceList(
|
|
39
40
|
serviceList,
|
|
40
41
|
selectedItems,
|
|
41
42
|
mySeatTypeFilters,
|
|
42
|
-
myBoradingStageFilters
|
|
43
|
+
myBoradingStageFilters,
|
|
44
|
+
myDropoffStageFilters
|
|
43
45
|
);
|
|
44
46
|
|
|
45
47
|
setServiceListFilteredBasedOnTripStep(tripStep, new_service_list);
|
|
@@ -85,7 +87,8 @@ const FilterBarMobile = ({
|
|
|
85
87
|
serviceList,
|
|
86
88
|
selectedItems,
|
|
87
89
|
mySeatTypeFilters,
|
|
88
|
-
myBoradingStageFilters
|
|
90
|
+
myBoradingStageFilters,
|
|
91
|
+
myDropoffStageFilters
|
|
89
92
|
) => {
|
|
90
93
|
let new_service_list = [];
|
|
91
94
|
serviceList?.map((service) => {
|
|
@@ -93,7 +96,8 @@ const FilterBarMobile = ({
|
|
|
93
96
|
service,
|
|
94
97
|
selectedItems,
|
|
95
98
|
mySeatTypeFilters,
|
|
96
|
-
myBoradingStageFilters
|
|
99
|
+
myBoradingStageFilters,
|
|
100
|
+
myDropoffStageFilters
|
|
97
101
|
);
|
|
98
102
|
if (service_qualifing) {
|
|
99
103
|
new_service_list.push(service);
|
|
@@ -115,7 +119,8 @@ const FilterBarMobile = ({
|
|
|
115
119
|
service,
|
|
116
120
|
selectedItems,
|
|
117
121
|
mySeatTypeFilters,
|
|
118
|
-
myBoradingStageFilters
|
|
122
|
+
myBoradingStageFilters,
|
|
123
|
+
myDropoffStageFilters
|
|
119
124
|
) => {
|
|
120
125
|
let is_direct_service = service.is_direct_trip;
|
|
121
126
|
let pet_friendly = service.pet_seat_info;
|
|
@@ -123,11 +128,14 @@ const FilterBarMobile = ({
|
|
|
123
128
|
let fare_arr = service.seat_types;
|
|
124
129
|
// let fare_arr = service.fare_str.split(",");
|
|
125
130
|
let is_train_type = service.train_type_label;
|
|
131
|
+
let bus_comapnies = service.operator_service_name;
|
|
132
|
+
|
|
126
133
|
let seat_type = fare_arr.map((fare) => {
|
|
127
134
|
return fare.label;
|
|
128
135
|
// return CommonService.getSeatNameForFilters(fare.split(":")[0]);
|
|
129
136
|
});
|
|
130
137
|
let boarding_stages = service.boarding_stages.split("|")[0];
|
|
138
|
+
let dropoff_stages = service.dropoff_stages.split("|")[0];
|
|
131
139
|
|
|
132
140
|
let service_qualifing = false;
|
|
133
141
|
let is_pet_friendly_applied = false;
|
|
@@ -135,6 +143,8 @@ const FilterBarMobile = ({
|
|
|
135
143
|
let is_boarding_filter_applied = false;
|
|
136
144
|
let is_change_ticket_applied = false;
|
|
137
145
|
let is_train_type_applied = false;
|
|
146
|
+
let is_bus_company_applied = false;
|
|
147
|
+
let is_dropoff_filter_applied = false;
|
|
138
148
|
|
|
139
149
|
selectedItems?.map((item) => {
|
|
140
150
|
// ********** pet seat filter **********
|
|
@@ -303,6 +313,77 @@ const FilterBarMobile = ({
|
|
|
303
313
|
service_qualifing = true;
|
|
304
314
|
}
|
|
305
315
|
}
|
|
316
|
+
|
|
317
|
+
// ********** bus company filter **********
|
|
318
|
+
if (
|
|
319
|
+
myFilters["bus_company"] &&
|
|
320
|
+
myFilters["bus_company"].some((comp) => comp.selected)
|
|
321
|
+
) {
|
|
322
|
+
is_bus_company_applied = true;
|
|
323
|
+
let bus_company_found = false;
|
|
324
|
+
myFilters["bus_company"].forEach((comp) => {
|
|
325
|
+
if (
|
|
326
|
+
comp.selected &&
|
|
327
|
+
comp.name === item.name &&
|
|
328
|
+
bus_comapnies === item.name
|
|
329
|
+
) {
|
|
330
|
+
bus_company_found = true;
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
if (
|
|
334
|
+
bus_company_found &&
|
|
335
|
+
!is_pet_friendly_applied &&
|
|
336
|
+
!is_direct_service_applied &&
|
|
337
|
+
!is_boarding_filter_applied &&
|
|
338
|
+
!is_change_ticket_applied
|
|
339
|
+
) {
|
|
340
|
+
service_qualifing = true;
|
|
341
|
+
} else if (
|
|
342
|
+
bus_company_found &&
|
|
343
|
+
((is_pet_friendly_applied && service_qualifing) ||
|
|
344
|
+
(is_direct_service_applied && service_qualifing) ||
|
|
345
|
+
(is_boarding_filter_applied && service_qualifing) ||
|
|
346
|
+
(is_change_ticket_applied && service_qualifing))
|
|
347
|
+
) {
|
|
348
|
+
service_qualifing = true;
|
|
349
|
+
}
|
|
350
|
+
// Do not set service_qualifing = false here
|
|
351
|
+
}
|
|
352
|
+
if (myDropoffStageFilters && myDropoffStageFilters.length > 0) {
|
|
353
|
+
is_dropoff_filter_applied = true;
|
|
354
|
+
let showTopLabel =
|
|
355
|
+
busTerminals[dropoff_stages] &&
|
|
356
|
+
busTerminals[dropoff_stages].split("|")[1] === "true" &&
|
|
357
|
+
busTerminals[dropoff_stages].split("|")[0];
|
|
358
|
+
|
|
359
|
+
let dropoff_stage_found = false;
|
|
360
|
+
|
|
361
|
+
myDropoffStageFilters.map((dropoff_stage) => {
|
|
362
|
+
if (item.name === dropoff_stage.name) {
|
|
363
|
+
if (
|
|
364
|
+
showTopLabel === dropoff_stage.name &&
|
|
365
|
+
!is_pet_friendly_applied &&
|
|
366
|
+
!is_direct_service_applied &&
|
|
367
|
+
!is_boarding_filter_applied &&
|
|
368
|
+
!is_change_ticket_applied
|
|
369
|
+
) {
|
|
370
|
+
dropoff_stage_found = true;
|
|
371
|
+
} else if (
|
|
372
|
+
showTopLabel === dropoff_stage.name &&
|
|
373
|
+
((is_pet_friendly_applied && service_qualifing) ||
|
|
374
|
+
(is_direct_service_applied && service_qualifing) ||
|
|
375
|
+
(is_boarding_filter_applied && service_qualifing) ||
|
|
376
|
+
(is_change_ticket_applied && service_qualifing))
|
|
377
|
+
) {
|
|
378
|
+
dropoff_stage_found = true;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
|
|
383
|
+
if (dropoff_stage_found) {
|
|
384
|
+
service_qualifing = true;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
306
387
|
});
|
|
307
388
|
|
|
308
389
|
return service_qualifing;
|
|
@@ -5,6 +5,15 @@ import PaymentItem from "./PaymentItem";
|
|
|
5
5
|
import CommonService from "../../utils/CommonService";
|
|
6
6
|
import CountDownTimer from "./CountDownTimer";
|
|
7
7
|
|
|
8
|
+
const getRoundedHour = (duration) => {
|
|
9
|
+
const [hoursStr, minutesStr] = duration.split(":");
|
|
10
|
+
const hours = parseInt(hoursStr, 10);
|
|
11
|
+
const minutes = parseInt(minutesStr, 10);
|
|
12
|
+
|
|
13
|
+
const roundedHours = minutes < 30 ? hours : hours + 1;
|
|
14
|
+
return roundedHours;
|
|
15
|
+
};
|
|
16
|
+
|
|
8
17
|
const renderSummaryDetailsCard = ({
|
|
9
18
|
serviceName,
|
|
10
19
|
date,
|
|
@@ -18,7 +27,9 @@ const renderSummaryDetailsCard = ({
|
|
|
18
27
|
trainType,
|
|
19
28
|
isTrain,
|
|
20
29
|
icons,
|
|
30
|
+
isTacna,
|
|
21
31
|
}) => {
|
|
32
|
+
console.log("🚀 ~ renderSummaryDetailsCard ~ droppingTime:", droppingTime);
|
|
22
33
|
return (
|
|
23
34
|
<>
|
|
24
35
|
{/* Summary Details Card */}
|
|
@@ -58,12 +69,21 @@ const renderSummaryDetailsCard = ({
|
|
|
58
69
|
</div>
|
|
59
70
|
<span className="bold-text capitalize">{source}</span>
|
|
60
71
|
</div>
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
{isTacna ? (
|
|
73
|
+
<div className="address ">
|
|
74
|
+
{boardingStage}{" "}
|
|
75
|
+
{boardingTime && !boardingStage?.includes("-") ? (
|
|
76
|
+
<span>-{DateService.ampmOnly(boardingTime)}</span>
|
|
77
|
+
) : null}
|
|
78
|
+
</div>
|
|
79
|
+
) : (
|
|
80
|
+
<div className="ml-7 text-xs mt-[5px]">
|
|
81
|
+
{boardingStage}. {/* {boardingTime && `. ${boardingTime}`} */}
|
|
82
|
+
{boardingTime ? (
|
|
83
|
+
<span>{DateService.formatTime(boardingTime)}</span>
|
|
84
|
+
) : null}
|
|
85
|
+
</div>
|
|
86
|
+
)}
|
|
67
87
|
</div>
|
|
68
88
|
|
|
69
89
|
{/* Destination */}
|
|
@@ -78,12 +98,21 @@ const renderSummaryDetailsCard = ({
|
|
|
78
98
|
</div>
|
|
79
99
|
<span className="bold-text capitalize">{dest}</span>
|
|
80
100
|
</div>
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
101
|
+
{isTacna ? (
|
|
102
|
+
<div className=" ml-7 text-xs mt-[5px]">
|
|
103
|
+
{droppingStage}.{" "}
|
|
104
|
+
{droppingTime && !droppingStage?.includes("-") ? (
|
|
105
|
+
<span>{DateService.formatTime(droppingTime)} aprox</span>
|
|
106
|
+
) : null}
|
|
107
|
+
</div>
|
|
108
|
+
) : (
|
|
109
|
+
<div className="ml-7 text-xs mt-[5px]">
|
|
110
|
+
{droppingStage}. {/* {droppingTime && `. ${droppingTime}`} */}
|
|
111
|
+
{droppingTime ? (
|
|
112
|
+
<span>{DateService.formatTime(droppingTime)}</span>
|
|
113
|
+
) : null}
|
|
114
|
+
</div>
|
|
115
|
+
)}
|
|
87
116
|
</div>
|
|
88
117
|
</div>
|
|
89
118
|
|
|
@@ -97,7 +126,10 @@ const renderSummaryDetailsCard = ({
|
|
|
97
126
|
/>
|
|
98
127
|
</div>
|
|
99
128
|
<span>
|
|
100
|
-
<span className="bold-text">Duración:</span>
|
|
129
|
+
<span className="bold-text">Duración:</span>{" "}
|
|
130
|
+
{isTacna
|
|
131
|
+
? `${getRoundedHour(duration)}hrs aprox`
|
|
132
|
+
: `${duration} horas`}
|
|
101
133
|
</span>
|
|
102
134
|
</div>
|
|
103
135
|
)}
|
|
@@ -166,6 +198,7 @@ const PaymentSideBarMobile: React.FC<PaymentSideBarProps> = ({
|
|
|
166
198
|
countdown,
|
|
167
199
|
walletLabel,
|
|
168
200
|
creditosLabel,
|
|
201
|
+
isTacna,
|
|
169
202
|
}) => {
|
|
170
203
|
return (
|
|
171
204
|
<div className="pb-[10px]">
|
|
@@ -251,6 +284,7 @@ const PaymentSideBarMobile: React.FC<PaymentSideBarProps> = ({
|
|
|
251
284
|
trainType: trainTypeOnward,
|
|
252
285
|
isTrain: trainType,
|
|
253
286
|
icons: icons,
|
|
287
|
+
isTacna: isTacna,
|
|
254
288
|
})
|
|
255
289
|
: renderSummaryDetailsCard({
|
|
256
290
|
serviceName: serviceNameReturn,
|
|
@@ -265,6 +299,7 @@ const PaymentSideBarMobile: React.FC<PaymentSideBarProps> = ({
|
|
|
265
299
|
trainType: trainTypeReturn,
|
|
266
300
|
isTrain: trainType,
|
|
267
301
|
icons: icons,
|
|
302
|
+
isTacna: isTacna,
|
|
268
303
|
})}
|
|
269
304
|
</div>
|
|
270
305
|
|
|
@@ -486,7 +521,7 @@ const PaymentSideBarMobile: React.FC<PaymentSideBarProps> = ({
|
|
|
486
521
|
</div>
|
|
487
522
|
</div>
|
|
488
523
|
<div
|
|
489
|
-
className={` text-[#fff] p-[10px_15px] text-left w-full flex items-center absolute -bottom-[
|
|
524
|
+
className={` text-[#fff] p-[10px_15px] text-left w-full flex items-center absolute -bottom-[10%] pt-[50px] z-1 rounded-b-[14px] text-[14px]`}
|
|
490
525
|
style={{ backgroundColor: colors?.bottomStripColor }}
|
|
491
526
|
>
|
|
492
527
|
<div className="flex justify-between items-center w-full text-[#fff]">
|
|
@@ -256,7 +256,8 @@ function ServiceItemMobile({
|
|
|
256
256
|
<img
|
|
257
257
|
key={i}
|
|
258
258
|
className="amenity"
|
|
259
|
-
height={
|
|
259
|
+
height={14}
|
|
260
|
+
width={14}
|
|
260
261
|
src={getAmenitiesImage(amenitiesData?.[am]?.toLowerCase())}
|
|
261
262
|
alt="icon"
|
|
262
263
|
/>
|
|
@@ -521,7 +522,7 @@ function ServiceItemMobile({
|
|
|
521
522
|
isSoldOut ? "grayscale" : ""
|
|
522
523
|
}`}
|
|
523
524
|
>
|
|
524
|
-
{renderIcon("hours", "
|
|
525
|
+
{renderIcon("hours", "14px")}
|
|
525
526
|
</div>
|
|
526
527
|
<div
|
|
527
528
|
className={`cursor-default group min-[420]:text-[13px] text-[11px] ${
|
|
@@ -610,7 +611,7 @@ function ServiceItemMobile({
|
|
|
610
611
|
|
|
611
612
|
{serviceItem?.offer_text && (
|
|
612
613
|
<div
|
|
613
|
-
className={` text-white p-[
|
|
614
|
+
className={` text-white p-[10px_15px] text-left w-full flex items-center absolute -bottom-[40px] pt-[50px] z-10 rounded-b-[14px] min-[420]:text-[14px] text-[12px]`}
|
|
614
615
|
style={{
|
|
615
616
|
backgroundColor: isSoldOut ? "#ccc" : colors?.bottomStripColor,
|
|
616
617
|
zIndex: -1,
|