@qite/tide-booking-component 1.4.93 → 1.4.95
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/.prettierrc +9 -9
- package/.vs/ProjectSettings.json +3 -3
- package/.vs/VSWorkspaceState.json +5 -5
- package/build/build-cjs/index.js +81 -27
- package/build/build-cjs/src/booking-wizard/features/booking/booking-slice.d.ts +2 -1
- package/build/build-cjs/src/booking-wizard/features/booking/selectors.d.ts +4 -3
- package/build/build-cjs/src/booking-wizard/features/price-details/price-details-slice.d.ts +1 -0
- package/build/build-cjs/src/booking-wizard/features/price-details/selectors.d.ts +1 -0
- package/build/build-cjs/src/booking-wizard/features/sidebar/sidebar.d.ts +1 -0
- package/build/build-cjs/src/booking-wizard/types.d.ts +1 -0
- package/build/build-cjs/src/shared/utils/localization-util.d.ts +1 -0
- package/build/build-esm/index.js +81 -27
- package/build/build-esm/src/booking-wizard/features/booking/booking-slice.d.ts +2 -1
- package/build/build-esm/src/booking-wizard/features/booking/selectors.d.ts +4 -3
- package/build/build-esm/src/booking-wizard/features/price-details/price-details-slice.d.ts +1 -0
- package/build/build-esm/src/booking-wizard/features/price-details/selectors.d.ts +1 -0
- package/build/build-esm/src/booking-wizard/features/sidebar/sidebar.d.ts +1 -0
- package/build/build-esm/src/booking-wizard/types.d.ts +1 -0
- package/build/build-esm/src/shared/utils/localization-util.d.ts +1 -0
- package/package.json +83 -83
- package/src/booking-product/components/age-select.tsx +35 -35
- package/src/booking-product/components/amount-input.tsx +51 -51
- package/src/booking-product/components/date-range-picker/calendar.tsx +155 -155
- package/src/booking-product/components/footer.tsx +54 -54
- package/src/booking-product/components/header.tsx +57 -57
- package/src/booking-product/components/icon.tsx +200 -200
- package/src/booking-product/components/list-view.tsx +54 -54
- package/src/booking-product/components/rating.tsx +21 -21
- package/src/booking-product/components/rooms.tsx +171 -171
- package/src/booking-product/constants.ts +1 -1
- package/src/booking-product/index.tsx +21 -21
- package/src/booking-product/settings-context.ts +16 -16
- package/src/booking-product/types.ts +30 -30
- package/src/booking-product/utils/api.ts +26 -26
- package/src/booking-product/utils/price.ts +28 -28
- package/src/booking-wizard/api-settings-slice.ts +24 -24
- package/src/booking-wizard/components/icon.tsx +398 -398
- package/src/booking-wizard/components/labeled-input.tsx +56 -56
- package/src/booking-wizard/components/labeled-select.tsx +54 -54
- package/src/booking-wizard/components/message.tsx +21 -21
- package/src/booking-wizard/components/multi-range-filter.tsx +99 -99
- package/src/booking-wizard/components/phone-input.tsx +146 -146
- package/src/booking-wizard/components/print-offer-button.tsx +53 -53
- package/src/booking-wizard/components/product-card.tsx +23 -23
- package/src/booking-wizard/declarations.d.ts +4 -4
- package/src/booking-wizard/features/booking/booking-self-contained.tsx +16 -1
- package/src/booking-wizard/features/booking/booking-slice.ts +9 -1
- package/src/booking-wizard/features/booking/booking.tsx +16 -1
- package/src/booking-wizard/features/booking/selectors.ts +5 -0
- package/src/booking-wizard/features/flight-options/flight-filter.tsx +371 -371
- package/src/booking-wizard/features/flight-options/flight-option-flight.tsx +354 -354
- package/src/booking-wizard/features/flight-options/flight-option-modal.tsx +211 -211
- package/src/booking-wizard/features/flight-options/flight-option.tsx +57 -57
- package/src/booking-wizard/features/flight-options/flight-utils.ts +423 -423
- package/src/booking-wizard/features/price-details/price-details-api.ts +20 -20
- package/src/booking-wizard/features/price-details/price-details-slice.ts +2 -0
- package/src/booking-wizard/features/price-details/selectors.ts +1 -0
- package/src/booking-wizard/features/price-details/util.ts +115 -115
- package/src/booking-wizard/features/product-options/no-options.tsx +18 -18
- package/src/booking-wizard/features/product-options/none-option.tsx +73 -73
- package/src/booking-wizard/features/product-options/option-booking-airline-group.tsx +53 -53
- package/src/booking-wizard/features/product-options/option-booking-group.tsx +152 -152
- package/src/booking-wizard/features/product-options/option-item.tsx +236 -236
- package/src/booking-wizard/features/product-options/option-pax-card.tsx +159 -159
- package/src/booking-wizard/features/product-options/option-pax-group.tsx +122 -122
- package/src/booking-wizard/features/product-options/option-room.tsx +226 -226
- package/src/booking-wizard/features/product-options/option-unit-group.tsx +138 -138
- package/src/booking-wizard/features/room-options/room-utils.ts +154 -154
- package/src/booking-wizard/features/room-options/room.tsx +123 -123
- package/src/booking-wizard/features/room-options/traveler-rooms.tsx +64 -64
- package/src/booking-wizard/features/sidebar/index.tsx +2 -0
- package/src/booking-wizard/features/sidebar/sidebar-flight.tsx +66 -66
- package/src/booking-wizard/features/sidebar/sidebar.tsx +17 -1
- package/src/booking-wizard/features/summary/summary-booking-option-pax.tsx +23 -23
- package/src/booking-wizard/features/summary/summary-booking-option-unit.tsx +23 -23
- package/src/booking-wizard/features/summary/summary-flight.tsx +36 -36
- package/src/booking-wizard/features/summary/summary-per-booking-option-group.tsx +60 -60
- package/src/booking-wizard/features/summary/summary-per-pax-option-group.tsx +56 -56
- package/src/booking-wizard/features/summary/summary-per-unit-option-group.tsx +58 -58
- package/src/booking-wizard/features/summary/summary-slice.ts +27 -27
- package/src/booking-wizard/features/travelers-form/travelers-form-slice.ts +157 -157
- package/src/booking-wizard/features/travelers-form/travelers-form-util.ts +10 -10
- package/src/booking-wizard/features/travelers-form/type-ahead-input.tsx +85 -85
- package/src/booking-wizard/features/travelers-form/validate-form.ts +178 -178
- package/src/booking-wizard/index.tsx +27 -27
- package/src/booking-wizard/store.ts +26 -26
- package/src/booking-wizard/types.ts +1 -0
- package/src/booking-wizard/use-offer-printer.ts +108 -108
- package/src/content/components/LanguageSwitcher.tsx +158 -158
- package/src/content/components/accordion.tsx +30 -30
- package/src/content/components/contact.tsx +211 -211
- package/src/content/components/personal-contact-form.tsx +809 -809
- package/src/content/header/index.tsx +43 -43
- package/src/content/header/types.ts +26 -26
- package/src/qsm/components/date-picker/index.tsx +152 -152
- package/src/qsm/components/date-range-picker/calendar-day.tsx +49 -49
- package/src/qsm/components/date-range-picker/calendar.tsx +211 -211
- package/src/qsm/components/date-range-picker/index.tsx +404 -404
- package/src/qsm/index.tsx +26 -26
- package/src/qsm/store/qsm-store.ts +13 -13
- package/src/search-results/components/flight/flight-card.tsx +38 -38
- package/src/search-results/components/flight/flight-leg.tsx +61 -61
- package/src/search-results/components/flight/flight-path.tsx +23 -23
- package/src/search-results/components/multi-range-filter.tsx +104 -104
- package/src/search-results/components/search-results-container/search-results-container.tsx +2 -2
- package/src/search-results/index.tsx +24 -24
- package/src/search-results/search-results-configuration-context.ts +6 -6
- package/src/search-results/store/search-results-store.ts +13 -13
- package/src/shared/components/loader.tsx +16 -16
- package/src/shared/translations/ar-SA.json +2 -1
- package/src/shared/translations/da-DK.json +2 -1
- package/src/shared/translations/de-DE.json +2 -1
- package/src/shared/translations/en-GB.json +2 -1
- package/src/shared/translations/es-ES.json +2 -1
- package/src/shared/translations/fr-BE.json +2 -1
- package/src/shared/translations/fr-FR.json +2 -1
- package/src/shared/translations/is-IS.json +2 -1
- package/src/shared/translations/it-IT.json +2 -1
- package/src/shared/translations/ja-JP.json +2 -1
- package/src/shared/translations/nl-BE.json +2 -1
- package/src/shared/translations/nl-NL.json +2 -1
- package/src/shared/translations/no-NO.json +2 -1
- package/src/shared/translations/pl-PL.json +2 -1
- package/src/shared/translations/pt-PT.json +2 -1
- package/src/shared/translations/sv-SE.json +2 -1
- package/src/shared/utils/class-util.ts +7 -7
- package/src/shared/utils/query-string-util.ts +91 -91
- package/src/shared/utils/tide-api-utils.ts +34 -34
- package/src/shared/utils/use-media-query-util.ts +19 -19
- package/styles/abstracts/_mixins.scss +74 -74
- package/styles/abstracts/_variables.scss +57 -57
- package/styles/base/_fonts.scss +2 -2
- package/styles/base/_normalize.scss +227 -227
- package/styles/base/_typography.scss +35 -35
- package/styles/booking-joker-variables.scss +596 -596
- package/styles/booking-product-variables.scss +330 -330
- package/styles/booking-product.scss +438 -438
- package/styles/booking-qsm-variables.scss +501 -501
- package/styles/booking-qsm.scss +52 -52
- package/styles/booking-wizard-variables.scss +603 -603
- package/styles/booking-wizard.scss +61 -61
- package/styles/components/_accordion.scss +67 -67
- package/styles/components/_animations.scss +39 -39
- package/styles/components/_base.scss +107 -107
- package/styles/components/_breadcrumb.scss +92 -92
- package/styles/components/_button.scss +238 -238
- package/styles/components/_checkbox.scss +230 -230
- package/styles/components/_contact.scss +239 -239
- package/styles/components/_cta.scss +238 -238
- package/styles/components/_date-list.scss +41 -41
- package/styles/components/_date-range-picker.scss +223 -223
- package/styles/components/_decrement-increment.scss +35 -35
- package/styles/components/_dropdown.scss +72 -72
- package/styles/components/_faq.scss +27 -27
- package/styles/components/_flight-option.scss +1419 -1419
- package/styles/components/_gallery.scss +314 -314
- package/styles/components/_header.scss +113 -113
- package/styles/components/_img-slider.scss +175 -175
- package/styles/components/_info-message.scss +75 -75
- package/styles/components/_input.scss +35 -35
- package/styles/components/_list.scss +185 -185
- package/styles/components/_loader.scss +70 -70
- package/styles/components/_mixins.scss +579 -579
- package/styles/components/_passenger-picker.scss +306 -306
- package/styles/components/_phone-input.scss +8 -8
- package/styles/components/_placeholders.scss +165 -165
- package/styles/components/_qsm.scss +17 -17
- package/styles/components/_radiobutton.scss +170 -170
- package/styles/components/_select-wrapper.scss +76 -76
- package/styles/components/_slider.scss +128 -128
- package/styles/components/_spinner.scss +29 -29
- package/styles/components/_step-indicators.scss +161 -161
- package/styles/components/_table.scss +81 -81
- package/styles/components/_typeahead.scss +275 -275
- package/styles/components/_variables.scss +89 -89
- package/styles/content-blocks-variables.scss +507 -507
- package/styles/font.scss +2 -2
- package/styles/qsm/_calendar.scss +274 -274
- package/styles/qsm/_qsm.scss +1094 -1094
- package/styles/search.scss +1200 -1200
- package/tsconfig.json +24 -24
|
@@ -1,159 +1,159 @@
|
|
|
1
|
-
import {
|
|
2
|
-
AirlineBookingPackageOption,
|
|
3
|
-
AirportBookingPackageOption,
|
|
4
|
-
BookingAirlineGroup,
|
|
5
|
-
BookingAirportGroup,
|
|
6
|
-
BookingOptionGroup,
|
|
7
|
-
BookingOptionPax,
|
|
8
|
-
BookingPackagePax,
|
|
9
|
-
PerPaxPackageOption
|
|
10
|
-
} from '@qite/tide-client/build/types';
|
|
11
|
-
import React, { useEffect, useState } from 'react';
|
|
12
|
-
import { useSelector } from 'react-redux';
|
|
13
|
-
import { buildClassName } from '../../../shared/utils/class-util';
|
|
14
|
-
import { selectBookingPackagePax, selectDepartureFlight, selectReturnFlight, selectTranslations } from '../booking/selectors';
|
|
15
|
-
import { CHILD_MAX_AGE } from '../travelers-form/travelers-form-slice';
|
|
16
|
-
import OptionPaxGroup from './option-pax-group';
|
|
17
|
-
import OptionBookingAirlineGroup from './option-booking-airline-group';
|
|
18
|
-
|
|
19
|
-
interface OptionPaxCardProps {
|
|
20
|
-
pax: BookingOptionPax[];
|
|
21
|
-
requestRoomsPax?: BookingPackagePax[];
|
|
22
|
-
parentIndex?: number;
|
|
23
|
-
onPaxChange?: (pax: BookingOptionPax[], index?: number) => void;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
const OptionPaxCard: React.FC<OptionPaxCardProps> = ({ pax, requestRoomsPax, parentIndex, onPaxChange }) => {
|
|
27
|
-
const [toggleStates, setToggleStates] = useState<boolean[]>();
|
|
28
|
-
const translations = useSelector(selectTranslations);
|
|
29
|
-
const departureFlight = useSelector(selectDepartureFlight);
|
|
30
|
-
const returnFlight = useSelector(selectReturnFlight);
|
|
31
|
-
|
|
32
|
-
useEffect(() => {
|
|
33
|
-
if (!toggleStates || toggleStates.length !== pax.length) {
|
|
34
|
-
setToggleStates(pax.map(() => true));
|
|
35
|
-
}
|
|
36
|
-
}, [pax, toggleStates, setToggleStates]);
|
|
37
|
-
|
|
38
|
-
const bookingPax = useSelector(selectBookingPackagePax);
|
|
39
|
-
|
|
40
|
-
const getPaxName = (bookingOptionPax: BookingOptionPax) => {
|
|
41
|
-
const item = bookingPax.find((x) => x.id === bookingOptionPax.id);
|
|
42
|
-
if (!item?.firstName && !item?.lastName) {
|
|
43
|
-
return bookingOptionPax?.paxName;
|
|
44
|
-
}
|
|
45
|
-
return `${item?.firstName} ${item?.lastName}`;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
const onGroupChange = (group: BookingOptionGroup<PerPaxPackageOption>, paxId: number) => {
|
|
49
|
-
const updatedPax = pax.map((p) => {
|
|
50
|
-
return p.id !== paxId
|
|
51
|
-
? p
|
|
52
|
-
: {
|
|
53
|
-
...p,
|
|
54
|
-
groups: p.groups.map((pg) => {
|
|
55
|
-
return pg.name !== group.name ? pg : group;
|
|
56
|
-
})
|
|
57
|
-
};
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
if (onPaxChange) onPaxChange(updatedPax, parentIndex);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const getAirlineGroups = (p: BookingOptionPax) => {
|
|
64
|
-
return p.airlineGroups.filter((x) => x.flightIds.includes(departureFlight?.entryLineGuid ?? '') || x.flightIds.includes(returnFlight?.entryLineGuid ?? ''));
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const handleOnAirlineGroupChange = (group: BookingAirlineGroup<AirlineBookingPackageOption>, paxId: number) => {
|
|
68
|
-
const updatedPax = pax.map((p) => {
|
|
69
|
-
return p.id !== paxId
|
|
70
|
-
? p
|
|
71
|
-
: {
|
|
72
|
-
...p,
|
|
73
|
-
airlineGroups: p.airlineGroups.map((g) => (g.label === group.label ? group : g))
|
|
74
|
-
};
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
if (onPaxChange) onPaxChange(updatedPax, parentIndex);
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const getAirportGroups = (p: BookingOptionPax) => {
|
|
81
|
-
return p.airportGroups.filter((x) => x.flightIds.includes(departureFlight?.entryLineGuid ?? '') || x.flightIds.includes(returnFlight?.entryLineGuid ?? ''));
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
const handleOnAirportGroupChange = (group: BookingAirportGroup<AirportBookingPackageOption>, paxId: number) => {
|
|
85
|
-
const updatedPax = pax.map((p) => {
|
|
86
|
-
return p.id !== paxId
|
|
87
|
-
? p
|
|
88
|
-
: {
|
|
89
|
-
...p,
|
|
90
|
-
airportGroups: p.airportGroups.map((g) => (g.label === group.label ? group : g))
|
|
91
|
-
};
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
if (onPaxChange) onPaxChange(updatedPax, parentIndex);
|
|
95
|
-
};
|
|
96
|
-
|
|
97
|
-
return (
|
|
98
|
-
<>
|
|
99
|
-
{pax.map((p, i) => (
|
|
100
|
-
<div key={i} className={buildClassName(['booking-card__group', toggleStates && toggleStates[i] && 'booking-card__group--active'])}>
|
|
101
|
-
<div className="booking-card__group-header">
|
|
102
|
-
<h3 className="booking-card__body-heading">{getPaxName(p)}</h3>
|
|
103
|
-
{requestRoomsPax?.find((x) => x.id == p.id)?.age && (
|
|
104
|
-
<p className="form__region-label">
|
|
105
|
-
{requestRoomsPax.find((x) => x.id == p.id)?.age! > CHILD_MAX_AGE ? translations.TRAVELERS_FORM.ADULT : translations.TRAVELERS_FORM.CHILD}
|
|
106
|
-
</p>
|
|
107
|
-
)}
|
|
108
|
-
<div className="booking-card__actions">
|
|
109
|
-
<button
|
|
110
|
-
type="button"
|
|
111
|
-
className="booking-card__toggle"
|
|
112
|
-
onClick={() => {
|
|
113
|
-
setToggleStates(toggleStates?.map((s, si) => (si == i ? !s : s)));
|
|
114
|
-
}}></button>
|
|
115
|
-
</div>
|
|
116
|
-
</div>
|
|
117
|
-
{toggleStates && toggleStates[i] && (
|
|
118
|
-
<>
|
|
119
|
-
{p.groups.map(
|
|
120
|
-
(pg) =>
|
|
121
|
-
pg && (
|
|
122
|
-
<OptionPaxGroup
|
|
123
|
-
key={pg.name}
|
|
124
|
-
paxId={p.id}
|
|
125
|
-
group={pg}
|
|
126
|
-
firstClassName={'booking-card__group-body'}
|
|
127
|
-
secondClassName={'booking-card__group-heading'}
|
|
128
|
-
parentId={`${p.id}_${pg.name}`}
|
|
129
|
-
onGroupChange={onGroupChange}
|
|
130
|
-
/>
|
|
131
|
-
)
|
|
132
|
-
)}
|
|
133
|
-
{getAirlineGroups(p).map((group, i) => (
|
|
134
|
-
<OptionBookingAirlineGroup
|
|
135
|
-
key={`${group.label}_${i}`}
|
|
136
|
-
airGroup={group}
|
|
137
|
-
onGroupChange={(updatedGroup) => {
|
|
138
|
-
handleOnAirlineGroupChange(updatedGroup, p.id);
|
|
139
|
-
}}
|
|
140
|
-
/>
|
|
141
|
-
))}
|
|
142
|
-
{getAirportGroups(p).map((group, i) => (
|
|
143
|
-
<OptionBookingAirlineGroup
|
|
144
|
-
key={`${group.label}_${i}`}
|
|
145
|
-
airGroup={group}
|
|
146
|
-
onGroupChange={(updatedGroup) => {
|
|
147
|
-
handleOnAirportGroupChange(updatedGroup, p.id);
|
|
148
|
-
}}
|
|
149
|
-
/>
|
|
150
|
-
))}
|
|
151
|
-
</>
|
|
152
|
-
)}
|
|
153
|
-
</div>
|
|
154
|
-
))}
|
|
155
|
-
</>
|
|
156
|
-
);
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
export default OptionPaxCard;
|
|
1
|
+
import {
|
|
2
|
+
AirlineBookingPackageOption,
|
|
3
|
+
AirportBookingPackageOption,
|
|
4
|
+
BookingAirlineGroup,
|
|
5
|
+
BookingAirportGroup,
|
|
6
|
+
BookingOptionGroup,
|
|
7
|
+
BookingOptionPax,
|
|
8
|
+
BookingPackagePax,
|
|
9
|
+
PerPaxPackageOption
|
|
10
|
+
} from '@qite/tide-client/build/types';
|
|
11
|
+
import React, { useEffect, useState } from 'react';
|
|
12
|
+
import { useSelector } from 'react-redux';
|
|
13
|
+
import { buildClassName } from '../../../shared/utils/class-util';
|
|
14
|
+
import { selectBookingPackagePax, selectDepartureFlight, selectReturnFlight, selectTranslations } from '../booking/selectors';
|
|
15
|
+
import { CHILD_MAX_AGE } from '../travelers-form/travelers-form-slice';
|
|
16
|
+
import OptionPaxGroup from './option-pax-group';
|
|
17
|
+
import OptionBookingAirlineGroup from './option-booking-airline-group';
|
|
18
|
+
|
|
19
|
+
interface OptionPaxCardProps {
|
|
20
|
+
pax: BookingOptionPax[];
|
|
21
|
+
requestRoomsPax?: BookingPackagePax[];
|
|
22
|
+
parentIndex?: number;
|
|
23
|
+
onPaxChange?: (pax: BookingOptionPax[], index?: number) => void;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const OptionPaxCard: React.FC<OptionPaxCardProps> = ({ pax, requestRoomsPax, parentIndex, onPaxChange }) => {
|
|
27
|
+
const [toggleStates, setToggleStates] = useState<boolean[]>();
|
|
28
|
+
const translations = useSelector(selectTranslations);
|
|
29
|
+
const departureFlight = useSelector(selectDepartureFlight);
|
|
30
|
+
const returnFlight = useSelector(selectReturnFlight);
|
|
31
|
+
|
|
32
|
+
useEffect(() => {
|
|
33
|
+
if (!toggleStates || toggleStates.length !== pax.length) {
|
|
34
|
+
setToggleStates(pax.map(() => true));
|
|
35
|
+
}
|
|
36
|
+
}, [pax, toggleStates, setToggleStates]);
|
|
37
|
+
|
|
38
|
+
const bookingPax = useSelector(selectBookingPackagePax);
|
|
39
|
+
|
|
40
|
+
const getPaxName = (bookingOptionPax: BookingOptionPax) => {
|
|
41
|
+
const item = bookingPax.find((x) => x.id === bookingOptionPax.id);
|
|
42
|
+
if (!item?.firstName && !item?.lastName) {
|
|
43
|
+
return bookingOptionPax?.paxName;
|
|
44
|
+
}
|
|
45
|
+
return `${item?.firstName} ${item?.lastName}`;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const onGroupChange = (group: BookingOptionGroup<PerPaxPackageOption>, paxId: number) => {
|
|
49
|
+
const updatedPax = pax.map((p) => {
|
|
50
|
+
return p.id !== paxId
|
|
51
|
+
? p
|
|
52
|
+
: {
|
|
53
|
+
...p,
|
|
54
|
+
groups: p.groups.map((pg) => {
|
|
55
|
+
return pg.name !== group.name ? pg : group;
|
|
56
|
+
})
|
|
57
|
+
};
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
if (onPaxChange) onPaxChange(updatedPax, parentIndex);
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const getAirlineGroups = (p: BookingOptionPax) => {
|
|
64
|
+
return p.airlineGroups.filter((x) => x.flightIds.includes(departureFlight?.entryLineGuid ?? '') || x.flightIds.includes(returnFlight?.entryLineGuid ?? ''));
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
const handleOnAirlineGroupChange = (group: BookingAirlineGroup<AirlineBookingPackageOption>, paxId: number) => {
|
|
68
|
+
const updatedPax = pax.map((p) => {
|
|
69
|
+
return p.id !== paxId
|
|
70
|
+
? p
|
|
71
|
+
: {
|
|
72
|
+
...p,
|
|
73
|
+
airlineGroups: p.airlineGroups.map((g) => (g.label === group.label ? group : g))
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
if (onPaxChange) onPaxChange(updatedPax, parentIndex);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const getAirportGroups = (p: BookingOptionPax) => {
|
|
81
|
+
return p.airportGroups.filter((x) => x.flightIds.includes(departureFlight?.entryLineGuid ?? '') || x.flightIds.includes(returnFlight?.entryLineGuid ?? ''));
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const handleOnAirportGroupChange = (group: BookingAirportGroup<AirportBookingPackageOption>, paxId: number) => {
|
|
85
|
+
const updatedPax = pax.map((p) => {
|
|
86
|
+
return p.id !== paxId
|
|
87
|
+
? p
|
|
88
|
+
: {
|
|
89
|
+
...p,
|
|
90
|
+
airportGroups: p.airportGroups.map((g) => (g.label === group.label ? group : g))
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
if (onPaxChange) onPaxChange(updatedPax, parentIndex);
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
return (
|
|
98
|
+
<>
|
|
99
|
+
{pax.map((p, i) => (
|
|
100
|
+
<div key={i} className={buildClassName(['booking-card__group', toggleStates && toggleStates[i] && 'booking-card__group--active'])}>
|
|
101
|
+
<div className="booking-card__group-header">
|
|
102
|
+
<h3 className="booking-card__body-heading">{getPaxName(p)}</h3>
|
|
103
|
+
{requestRoomsPax?.find((x) => x.id == p.id)?.age && (
|
|
104
|
+
<p className="form__region-label">
|
|
105
|
+
{requestRoomsPax.find((x) => x.id == p.id)?.age! > CHILD_MAX_AGE ? translations.TRAVELERS_FORM.ADULT : translations.TRAVELERS_FORM.CHILD}
|
|
106
|
+
</p>
|
|
107
|
+
)}
|
|
108
|
+
<div className="booking-card__actions">
|
|
109
|
+
<button
|
|
110
|
+
type="button"
|
|
111
|
+
className="booking-card__toggle"
|
|
112
|
+
onClick={() => {
|
|
113
|
+
setToggleStates(toggleStates?.map((s, si) => (si == i ? !s : s)));
|
|
114
|
+
}}></button>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
{toggleStates && toggleStates[i] && (
|
|
118
|
+
<>
|
|
119
|
+
{p.groups.map(
|
|
120
|
+
(pg) =>
|
|
121
|
+
pg && (
|
|
122
|
+
<OptionPaxGroup
|
|
123
|
+
key={pg.name}
|
|
124
|
+
paxId={p.id}
|
|
125
|
+
group={pg}
|
|
126
|
+
firstClassName={'booking-card__group-body'}
|
|
127
|
+
secondClassName={'booking-card__group-heading'}
|
|
128
|
+
parentId={`${p.id}_${pg.name}`}
|
|
129
|
+
onGroupChange={onGroupChange}
|
|
130
|
+
/>
|
|
131
|
+
)
|
|
132
|
+
)}
|
|
133
|
+
{getAirlineGroups(p).map((group, i) => (
|
|
134
|
+
<OptionBookingAirlineGroup
|
|
135
|
+
key={`${group.label}_${i}`}
|
|
136
|
+
airGroup={group}
|
|
137
|
+
onGroupChange={(updatedGroup) => {
|
|
138
|
+
handleOnAirlineGroupChange(updatedGroup, p.id);
|
|
139
|
+
}}
|
|
140
|
+
/>
|
|
141
|
+
))}
|
|
142
|
+
{getAirportGroups(p).map((group, i) => (
|
|
143
|
+
<OptionBookingAirlineGroup
|
|
144
|
+
key={`${group.label}_${i}`}
|
|
145
|
+
airGroup={group}
|
|
146
|
+
onGroupChange={(updatedGroup) => {
|
|
147
|
+
handleOnAirportGroupChange(updatedGroup, p.id);
|
|
148
|
+
}}
|
|
149
|
+
/>
|
|
150
|
+
))}
|
|
151
|
+
</>
|
|
152
|
+
)}
|
|
153
|
+
</div>
|
|
154
|
+
))}
|
|
155
|
+
</>
|
|
156
|
+
);
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
export default OptionPaxCard;
|
|
@@ -1,122 +1,122 @@
|
|
|
1
|
-
import { BookingOptionGroup, PerPackageOption, PerPaxPackageOption } from '@qite/tide-client/build/types';
|
|
2
|
-
import { isEmpty } from 'lodash';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
import { buildClassName } from '../../../shared/utils/class-util';
|
|
5
|
-
import NoneOption from './none-option';
|
|
6
|
-
import OptionItem from './option-item';
|
|
7
|
-
|
|
8
|
-
interface OptionPaxGroupProps {
|
|
9
|
-
paxId: number;
|
|
10
|
-
optionId?: string;
|
|
11
|
-
group: BookingOptionGroup<PerPaxPackageOption>;
|
|
12
|
-
firstClassName: string;
|
|
13
|
-
secondClassName: string;
|
|
14
|
-
parentId: string;
|
|
15
|
-
onGroupChange?: (group: BookingOptionGroup<PerPaxPackageOption>, paxId: number, optionId?: string) => void;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const OptionPaxGroup: React.FC<OptionPaxGroupProps> = ({ paxId, optionId, group, firstClassName, secondClassName, parentId, onGroupChange }) => {
|
|
19
|
-
const handleOptionChange = (option: PerPackageOption, index: number) => {
|
|
20
|
-
const updatedGroup = {
|
|
21
|
-
...group,
|
|
22
|
-
options: group.options.map((o, i) => {
|
|
23
|
-
return i === index
|
|
24
|
-
? option
|
|
25
|
-
: {
|
|
26
|
-
...o,
|
|
27
|
-
isSelected: option.requirementType === 2 || option.requirementType === 3 ? false : o.isSelected
|
|
28
|
-
};
|
|
29
|
-
})
|
|
30
|
-
} as BookingOptionGroup<PerPaxPackageOption>;
|
|
31
|
-
|
|
32
|
-
if (onGroupChange) onGroupChange(updatedGroup, paxId, optionId);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
const handleChildGroupChange = (childGroup: BookingOptionGroup<PerPaxPackageOption>, paxId: number, optionId?: string) => {
|
|
36
|
-
const updatedGroup = {
|
|
37
|
-
...group,
|
|
38
|
-
options: group.options.map((groupOption) => {
|
|
39
|
-
return groupOption.line.entryLineGuid === optionId
|
|
40
|
-
? {
|
|
41
|
-
...groupOption,
|
|
42
|
-
groups: groupOption.groups.map((optionGroup) => {
|
|
43
|
-
return optionGroup.name === childGroup.name ? childGroup : optionGroup;
|
|
44
|
-
})
|
|
45
|
-
}
|
|
46
|
-
: groupOption;
|
|
47
|
-
})
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
if (onGroupChange) onGroupChange(updatedGroup, paxId, optionId);
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
const handleNoneSelectionChanged = () => {
|
|
54
|
-
const updatedGroup = {
|
|
55
|
-
...group,
|
|
56
|
-
options: group.options.map((groupOption) => ({
|
|
57
|
-
...groupOption,
|
|
58
|
-
isSelected: false
|
|
59
|
-
}))
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
if (onGroupChange) onGroupChange(updatedGroup, paxId, optionId);
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const selectedPrice = group.name === '' ? 0 : group.options.find((x) => x.isSelected)?.line.price ?? 0;
|
|
66
|
-
|
|
67
|
-
return (
|
|
68
|
-
<div className={firstClassName}>
|
|
69
|
-
{group.title && <h4 className={secondClassName}>{group.title}</h4>}
|
|
70
|
-
<table className={buildClassName(['table', 'table--striped'])}>
|
|
71
|
-
<tbody>
|
|
72
|
-
{group.options.map((option, index) => (
|
|
73
|
-
<tr key={option.line.entryLineGuid}>
|
|
74
|
-
<td>
|
|
75
|
-
<div className={buildClassName(['tree', option.isSelected && 'tree--selected'])}>
|
|
76
|
-
<div className="tree__level">
|
|
77
|
-
<div className="tree__header">
|
|
78
|
-
<div className="tree__description-collapse">
|
|
79
|
-
<div
|
|
80
|
-
className={buildClassName([
|
|
81
|
-
(option.requirementType === 0 || option.requirementType === 1) && 'checkbox',
|
|
82
|
-
(option.requirementType === 2 || option.requirementType === 3) && 'radiobutton'
|
|
83
|
-
])}>
|
|
84
|
-
<label
|
|
85
|
-
htmlFor={`${parentId}_${index}`}
|
|
86
|
-
className={buildClassName([
|
|
87
|
-
(option.requirementType === 0 || option.requirementType === 1) && 'checkbox__label',
|
|
88
|
-
(option.requirementType === 2 || option.requirementType === 3) && 'radiobutton__label'
|
|
89
|
-
])}>
|
|
90
|
-
<OptionItem option={option} parentId={parentId} index={index} selectedPrice={selectedPrice} onOptionChange={handleOptionChange} />
|
|
91
|
-
{!isEmpty(option.groups) && (
|
|
92
|
-
<div className="tree__body">
|
|
93
|
-
{option.groups.map((optionGroup) => (
|
|
94
|
-
<OptionPaxGroup
|
|
95
|
-
paxId={paxId}
|
|
96
|
-
optionId={option.line.entryLineGuid}
|
|
97
|
-
group={optionGroup}
|
|
98
|
-
firstClassName={'tree__level'}
|
|
99
|
-
secondClassName={'tree__level-heading'}
|
|
100
|
-
parentId={`${parentId}_${optionGroup.name}`}
|
|
101
|
-
onGroupChange={handleChildGroupChange}
|
|
102
|
-
/>
|
|
103
|
-
))}
|
|
104
|
-
</div>
|
|
105
|
-
)}
|
|
106
|
-
</label>
|
|
107
|
-
</div>
|
|
108
|
-
</div>
|
|
109
|
-
</div>
|
|
110
|
-
</div>
|
|
111
|
-
</div>
|
|
112
|
-
</td>
|
|
113
|
-
</tr>
|
|
114
|
-
))}
|
|
115
|
-
<NoneOption group={group} parentId={parentId} handleNoneSelectionChanged={handleNoneSelectionChanged} />
|
|
116
|
-
</tbody>
|
|
117
|
-
</table>
|
|
118
|
-
</div>
|
|
119
|
-
);
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
export default OptionPaxGroup;
|
|
1
|
+
import { BookingOptionGroup, PerPackageOption, PerPaxPackageOption } from '@qite/tide-client/build/types';
|
|
2
|
+
import { isEmpty } from 'lodash';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { buildClassName } from '../../../shared/utils/class-util';
|
|
5
|
+
import NoneOption from './none-option';
|
|
6
|
+
import OptionItem from './option-item';
|
|
7
|
+
|
|
8
|
+
interface OptionPaxGroupProps {
|
|
9
|
+
paxId: number;
|
|
10
|
+
optionId?: string;
|
|
11
|
+
group: BookingOptionGroup<PerPaxPackageOption>;
|
|
12
|
+
firstClassName: string;
|
|
13
|
+
secondClassName: string;
|
|
14
|
+
parentId: string;
|
|
15
|
+
onGroupChange?: (group: BookingOptionGroup<PerPaxPackageOption>, paxId: number, optionId?: string) => void;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const OptionPaxGroup: React.FC<OptionPaxGroupProps> = ({ paxId, optionId, group, firstClassName, secondClassName, parentId, onGroupChange }) => {
|
|
19
|
+
const handleOptionChange = (option: PerPackageOption, index: number) => {
|
|
20
|
+
const updatedGroup = {
|
|
21
|
+
...group,
|
|
22
|
+
options: group.options.map((o, i) => {
|
|
23
|
+
return i === index
|
|
24
|
+
? option
|
|
25
|
+
: {
|
|
26
|
+
...o,
|
|
27
|
+
isSelected: option.requirementType === 2 || option.requirementType === 3 ? false : o.isSelected
|
|
28
|
+
};
|
|
29
|
+
})
|
|
30
|
+
} as BookingOptionGroup<PerPaxPackageOption>;
|
|
31
|
+
|
|
32
|
+
if (onGroupChange) onGroupChange(updatedGroup, paxId, optionId);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const handleChildGroupChange = (childGroup: BookingOptionGroup<PerPaxPackageOption>, paxId: number, optionId?: string) => {
|
|
36
|
+
const updatedGroup = {
|
|
37
|
+
...group,
|
|
38
|
+
options: group.options.map((groupOption) => {
|
|
39
|
+
return groupOption.line.entryLineGuid === optionId
|
|
40
|
+
? {
|
|
41
|
+
...groupOption,
|
|
42
|
+
groups: groupOption.groups.map((optionGroup) => {
|
|
43
|
+
return optionGroup.name === childGroup.name ? childGroup : optionGroup;
|
|
44
|
+
})
|
|
45
|
+
}
|
|
46
|
+
: groupOption;
|
|
47
|
+
})
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
if (onGroupChange) onGroupChange(updatedGroup, paxId, optionId);
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const handleNoneSelectionChanged = () => {
|
|
54
|
+
const updatedGroup = {
|
|
55
|
+
...group,
|
|
56
|
+
options: group.options.map((groupOption) => ({
|
|
57
|
+
...groupOption,
|
|
58
|
+
isSelected: false
|
|
59
|
+
}))
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
if (onGroupChange) onGroupChange(updatedGroup, paxId, optionId);
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const selectedPrice = group.name === '' ? 0 : group.options.find((x) => x.isSelected)?.line.price ?? 0;
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div className={firstClassName}>
|
|
69
|
+
{group.title && <h4 className={secondClassName}>{group.title}</h4>}
|
|
70
|
+
<table className={buildClassName(['table', 'table--striped'])}>
|
|
71
|
+
<tbody>
|
|
72
|
+
{group.options.map((option, index) => (
|
|
73
|
+
<tr key={option.line.entryLineGuid}>
|
|
74
|
+
<td>
|
|
75
|
+
<div className={buildClassName(['tree', option.isSelected && 'tree--selected'])}>
|
|
76
|
+
<div className="tree__level">
|
|
77
|
+
<div className="tree__header">
|
|
78
|
+
<div className="tree__description-collapse">
|
|
79
|
+
<div
|
|
80
|
+
className={buildClassName([
|
|
81
|
+
(option.requirementType === 0 || option.requirementType === 1) && 'checkbox',
|
|
82
|
+
(option.requirementType === 2 || option.requirementType === 3) && 'radiobutton'
|
|
83
|
+
])}>
|
|
84
|
+
<label
|
|
85
|
+
htmlFor={`${parentId}_${index}`}
|
|
86
|
+
className={buildClassName([
|
|
87
|
+
(option.requirementType === 0 || option.requirementType === 1) && 'checkbox__label',
|
|
88
|
+
(option.requirementType === 2 || option.requirementType === 3) && 'radiobutton__label'
|
|
89
|
+
])}>
|
|
90
|
+
<OptionItem option={option} parentId={parentId} index={index} selectedPrice={selectedPrice} onOptionChange={handleOptionChange} />
|
|
91
|
+
{!isEmpty(option.groups) && (
|
|
92
|
+
<div className="tree__body">
|
|
93
|
+
{option.groups.map((optionGroup) => (
|
|
94
|
+
<OptionPaxGroup
|
|
95
|
+
paxId={paxId}
|
|
96
|
+
optionId={option.line.entryLineGuid}
|
|
97
|
+
group={optionGroup}
|
|
98
|
+
firstClassName={'tree__level'}
|
|
99
|
+
secondClassName={'tree__level-heading'}
|
|
100
|
+
parentId={`${parentId}_${optionGroup.name}`}
|
|
101
|
+
onGroupChange={handleChildGroupChange}
|
|
102
|
+
/>
|
|
103
|
+
))}
|
|
104
|
+
</div>
|
|
105
|
+
)}
|
|
106
|
+
</label>
|
|
107
|
+
</div>
|
|
108
|
+
</div>
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
</td>
|
|
113
|
+
</tr>
|
|
114
|
+
))}
|
|
115
|
+
<NoneOption group={group} parentId={parentId} handleNoneSelectionChanged={handleNoneSelectionChanged} />
|
|
116
|
+
</tbody>
|
|
117
|
+
</table>
|
|
118
|
+
</div>
|
|
119
|
+
);
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
export default OptionPaxGroup;
|