@qite/tide-booking-component 0.0.2-preview.9 → 1.0.0-preview
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/README.md +1 -0
- package/build/build-cjs/booking-wizard/components/message.d.ts +1 -0
- package/build/build-cjs/booking-wizard/components/product-card.d.ts +1 -2
- package/build/build-cjs/booking-wizard/features/booking/api.d.ts +21 -0
- package/build/build-cjs/booking-wizard/features/booking/booking-slice.d.ts +95 -19
- package/build/build-cjs/booking-wizard/features/booking/booking.d.ts +1 -2
- package/build/build-cjs/booking-wizard/features/booking/selectors.d.ts +208 -0
- package/build/build-cjs/booking-wizard/features/price-details/price-details-api.d.ts +8 -6
- package/build/build-cjs/booking-wizard/features/price-details/price-details-slice.d.ts +98 -30
- package/build/build-cjs/booking-wizard/features/price-details/util.d.ts +5 -0
- package/build/build-cjs/booking-wizard/features/product-options/no-options.d.ts +2 -0
- package/build/build-cjs/booking-wizard/features/product-options/none-option.d.ts +17 -0
- package/build/build-cjs/booking-wizard/features/product-options/option-booking-group.d.ts +18 -0
- package/build/build-cjs/booking-wizard/features/product-options/option-item.d.ts +11 -0
- package/build/build-cjs/booking-wizard/features/product-options/option-pax-card.d.ts +9 -0
- package/build/build-cjs/booking-wizard/features/product-options/option-pax-group.d.ts +20 -0
- package/build/build-cjs/booking-wizard/features/product-options/option-room.d.ts +16 -0
- package/build/build-cjs/booking-wizard/features/product-options/option-unit-group.d.ts +20 -0
- package/build/build-cjs/booking-wizard/features/product-options/option-units-card.d.ts +9 -0
- package/build/build-cjs/booking-wizard/features/sidebar/index.d.ts +5 -1
- package/build/build-cjs/booking-wizard/features/sidebar/sidebar-flight.d.ts +8 -0
- package/build/build-cjs/booking-wizard/features/sidebar/sidebar-util.d.ts +22 -5
- package/build/build-cjs/booking-wizard/features/sidebar/sidebar.d.ts +16 -8
- package/build/build-cjs/booking-wizard/features/summary/summary-booking-option-pax.d.ts +7 -0
- package/build/build-cjs/booking-wizard/features/summary/summary-booking-option-unit.d.ts +7 -0
- package/build/build-cjs/booking-wizard/features/summary/summary-flight.d.ts +8 -0
- package/build/build-cjs/booking-wizard/features/summary/summary-per-booking-option-group.d.ts +10 -0
- package/build/build-cjs/booking-wizard/features/summary/summary-per-pax-option-group.d.ts +10 -0
- package/build/build-cjs/booking-wizard/features/summary/summary-per-unit-option-group.d.ts +10 -0
- package/build/build-cjs/booking-wizard/features/summary/summary-slice.d.ts +0 -28
- package/build/build-cjs/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +82 -88
- package/build/build-cjs/booking-wizard/features/travelers-form/type-ahead-input.d.ts +1 -0
- package/build/build-cjs/booking-wizard/features/travelers-form/validate-form.d.ts +2 -1
- package/build/build-cjs/booking-wizard/index.d.ts +3 -2
- package/build/build-cjs/booking-wizard/store.d.ts +23 -45
- package/build/build-cjs/booking-wizard/types.d.ts +63 -11
- package/build/build-cjs/booking-wizard/utils/query-string-util.d.ts +13 -0
- package/build/build-cjs/index.js +12065 -2381
- package/build/build-esm/booking-wizard/components/message.d.ts +1 -0
- package/build/build-esm/booking-wizard/components/product-card.d.ts +1 -2
- package/build/build-esm/booking-wizard/features/booking/api.d.ts +21 -0
- package/build/build-esm/booking-wizard/features/booking/booking-slice.d.ts +95 -19
- package/build/build-esm/booking-wizard/features/booking/booking.d.ts +1 -2
- package/build/build-esm/booking-wizard/features/booking/selectors.d.ts +208 -0
- package/build/build-esm/booking-wizard/features/price-details/price-details-api.d.ts +8 -6
- package/build/build-esm/booking-wizard/features/price-details/price-details-slice.d.ts +98 -30
- package/build/build-esm/booking-wizard/features/price-details/util.d.ts +5 -0
- package/build/build-esm/booking-wizard/features/product-options/no-options.d.ts +2 -0
- package/build/build-esm/booking-wizard/features/product-options/none-option.d.ts +17 -0
- package/build/build-esm/booking-wizard/features/product-options/option-booking-group.d.ts +18 -0
- package/build/build-esm/booking-wizard/features/product-options/option-item.d.ts +11 -0
- package/build/build-esm/booking-wizard/features/product-options/option-pax-card.d.ts +9 -0
- package/build/build-esm/booking-wizard/features/product-options/option-pax-group.d.ts +20 -0
- package/build/build-esm/booking-wizard/features/product-options/option-room.d.ts +16 -0
- package/build/build-esm/booking-wizard/features/product-options/option-unit-group.d.ts +20 -0
- package/build/build-esm/booking-wizard/features/product-options/option-units-card.d.ts +9 -0
- package/build/build-esm/booking-wizard/features/sidebar/index.d.ts +5 -1
- package/build/build-esm/booking-wizard/features/sidebar/sidebar-flight.d.ts +8 -0
- package/build/build-esm/booking-wizard/features/sidebar/sidebar-util.d.ts +22 -5
- package/build/build-esm/booking-wizard/features/sidebar/sidebar.d.ts +16 -8
- package/build/build-esm/booking-wizard/features/summary/summary-booking-option-pax.d.ts +7 -0
- package/build/build-esm/booking-wizard/features/summary/summary-booking-option-unit.d.ts +7 -0
- package/build/build-esm/booking-wizard/features/summary/summary-flight.d.ts +8 -0
- package/build/build-esm/booking-wizard/features/summary/summary-per-booking-option-group.d.ts +10 -0
- package/build/build-esm/booking-wizard/features/summary/summary-per-pax-option-group.d.ts +10 -0
- package/build/build-esm/booking-wizard/features/summary/summary-per-unit-option-group.d.ts +10 -0
- package/build/build-esm/booking-wizard/features/summary/summary-slice.d.ts +0 -28
- package/build/build-esm/booking-wizard/features/travelers-form/travelers-form-slice.d.ts +82 -88
- package/build/build-esm/booking-wizard/features/travelers-form/type-ahead-input.d.ts +1 -0
- package/build/build-esm/booking-wizard/features/travelers-form/validate-form.d.ts +2 -1
- package/build/build-esm/booking-wizard/index.d.ts +3 -2
- package/build/build-esm/booking-wizard/store.d.ts +23 -45
- package/build/build-esm/booking-wizard/types.d.ts +63 -11
- package/build/build-esm/booking-wizard/utils/query-string-util.d.ts +13 -0
- package/build/build-esm/index.js +11888 -2330
- package/package.json +8 -4
- package/rollup.config.js +1 -6
- package/src/booking-wizard/components/message.tsx +14 -8
- package/src/booking-wizard/components/product-card.tsx +10 -39
- package/src/booking-wizard/components/step-indicator.tsx +1 -1
- package/src/booking-wizard/components/step-route.tsx +1 -1
- package/src/booking-wizard/features/booking/api.ts +44 -0
- package/src/booking-wizard/features/booking/booking-slice.ts +274 -40
- package/src/booking-wizard/features/booking/booking.tsx +193 -57
- package/src/booking-wizard/features/booking/selectors.ts +328 -0
- package/src/booking-wizard/features/confirmation/confirmation.tsx +22 -11
- package/src/booking-wizard/features/error/error.tsx +15 -2
- package/src/booking-wizard/features/price-details/price-details-api.ts +12 -6
- package/src/booking-wizard/features/price-details/price-details-slice.ts +80 -50
- package/src/booking-wizard/features/price-details/util.ts +135 -0
- package/src/booking-wizard/features/product-options/no-options.tsx +18 -0
- package/src/booking-wizard/features/product-options/none-option.tsx +118 -0
- package/src/booking-wizard/features/product-options/option-booking-group.tsx +210 -0
- package/src/booking-wizard/features/product-options/option-item.tsx +321 -0
- package/src/booking-wizard/features/product-options/option-pax-card.tsx +102 -0
- package/src/booking-wizard/features/product-options/option-pax-group.tsx +169 -0
- package/src/booking-wizard/features/product-options/option-room.tsx +300 -0
- package/src/booking-wizard/features/product-options/option-unit-group.tsx +192 -0
- package/src/booking-wizard/features/product-options/option-units-card.tsx +100 -0
- package/src/booking-wizard/features/product-options/options-form.tsx +226 -48
- package/src/booking-wizard/features/sidebar/index.tsx +43 -20
- package/src/booking-wizard/features/sidebar/sidebar-flight.tsx +66 -0
- package/src/booking-wizard/features/sidebar/sidebar-util.ts +81 -39
- package/src/booking-wizard/features/sidebar/sidebar.tsx +150 -100
- package/src/booking-wizard/features/summary/summary-booking-option-pax.tsx +25 -0
- package/src/booking-wizard/features/summary/summary-booking-option-unit.tsx +25 -0
- package/src/booking-wizard/features/summary/summary-flight.tsx +35 -0
- package/src/booking-wizard/features/summary/summary-per-booking-option-group.tsx +57 -0
- package/src/booking-wizard/features/summary/summary-per-pax-option-group.tsx +51 -0
- package/src/booking-wizard/features/summary/summary-per-unit-option-group.tsx +54 -0
- package/src/booking-wizard/features/summary/summary-slice.ts +1 -134
- package/src/booking-wizard/features/summary/summary.tsx +521 -134
- package/src/booking-wizard/features/travelers-form/travelers-form-slice.ts +54 -55
- package/src/booking-wizard/features/travelers-form/travelers-form.tsx +202 -94
- package/src/booking-wizard/features/travelers-form/type-ahead-input.tsx +23 -3
- package/src/booking-wizard/features/travelers-form/validate-form.ts +40 -3
- package/src/booking-wizard/index.tsx +5 -6
- package/src/booking-wizard/settings-context.ts +33 -5
- package/src/booking-wizard/store.ts +5 -4
- package/src/booking-wizard/translations/translations.json +95 -61
- package/src/booking-wizard/types.ts +67 -10
- package/src/booking-wizard/utils/query-string-util.ts +42 -0
- package/build/build-cjs/booking-wizard/features/product-options/checkbox.d.ts +0 -11
- package/build/build-cjs/booking-wizard/features/product-options/option-details.d.ts +0 -11
- package/build/build-cjs/booking-wizard/features/product-options/product-options-api.d.ts +0 -29
- package/build/build-cjs/booking-wizard/features/product-options/product-options-slice.d.ts +0 -75
- package/build/build-cjs/booking-wizard/features/product-options/radio-button.d.ts +0 -10
- package/build/build-cjs/booking-wizard/features/product-options/rooms-slice.d.ts +0 -23
- package/build/build-cjs/booking-wizard/features/product-options/tree-level.d.ts +0 -7
- package/build/build-esm/booking-wizard/features/product-options/checkbox.d.ts +0 -11
- package/build/build-esm/booking-wizard/features/product-options/option-details.d.ts +0 -11
- package/build/build-esm/booking-wizard/features/product-options/product-options-api.d.ts +0 -29
- package/build/build-esm/booking-wizard/features/product-options/product-options-slice.d.ts +0 -75
- package/build/build-esm/booking-wizard/features/product-options/radio-button.d.ts +0 -10
- package/build/build-esm/booking-wizard/features/product-options/rooms-slice.d.ts +0 -23
- package/build/build-esm/booking-wizard/features/product-options/tree-level.d.ts +0 -7
- package/src/booking-wizard/features/product-options/checkbox.tsx +0 -38
- package/src/booking-wizard/features/product-options/option-details.tsx +0 -65
- package/src/booking-wizard/features/product-options/product-options-api.ts +0 -148
- package/src/booking-wizard/features/product-options/product-options-slice.ts +0 -149
- package/src/booking-wizard/features/product-options/radio-button.tsx +0 -35
- package/src/booking-wizard/features/product-options/rooms-slice.ts +0 -28
- package/src/booking-wizard/features/product-options/tree-level.tsx +0 -118
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { PackagePriceDetailsRequest, ServiceType } from "@qite/tide-client";
|
|
2
|
-
import {
|
|
3
|
-
PayloadAction,
|
|
4
|
-
createAsyncThunk,
|
|
5
|
-
createEntityAdapter,
|
|
6
|
-
createSelector,
|
|
7
|
-
createSlice,
|
|
8
|
-
} from "@reduxjs/toolkit";
|
|
9
|
-
import { find, findLast, isNil } from "lodash";
|
|
10
|
-
import productOptionsApi, {
|
|
11
|
-
ProductOption,
|
|
12
|
-
ProductOptionsRequest,
|
|
13
|
-
} from "./product-options-api";
|
|
14
|
-
import {
|
|
15
|
-
selectAdultCount,
|
|
16
|
-
selectChildCount,
|
|
17
|
-
selectTravelerAges,
|
|
18
|
-
} from "../travelers-form/travelers-form-slice";
|
|
19
|
-
import {
|
|
20
|
-
selectBookingAttributes,
|
|
21
|
-
selectOfficeId,
|
|
22
|
-
selectProductAttributes,
|
|
23
|
-
setCacheKey,
|
|
24
|
-
} from "../booking/booking-slice";
|
|
25
|
-
|
|
26
|
-
import { RootState } from "../../store";
|
|
27
|
-
import { fetchPriceDetails } from "../price-details/price-details-slice";
|
|
28
|
-
import { parseISO } from "date-fns";
|
|
29
|
-
import { setRooms } from "./rooms-slice";
|
|
30
|
-
|
|
31
|
-
export const fetchProductOptions = createAsyncThunk(
|
|
32
|
-
"productOptions/fetchProductOptions",
|
|
33
|
-
async (_, { dispatch, getState }) => {
|
|
34
|
-
const state = getState() as RootState;
|
|
35
|
-
|
|
36
|
-
const officeId = selectOfficeId(state);
|
|
37
|
-
const productAttributes = selectProductAttributes(state);
|
|
38
|
-
const bookingAttributes = selectBookingAttributes(state);
|
|
39
|
-
const adultCount = selectAdultCount(state);
|
|
40
|
-
const childCount = selectChildCount(state);
|
|
41
|
-
const travelerAges = selectTravelerAges(state);
|
|
42
|
-
|
|
43
|
-
if (isNil(productAttributes)) {
|
|
44
|
-
throw Error("productAttributes could not be found");
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
if (isNil(bookingAttributes)) {
|
|
48
|
-
throw Error("bookingAttributes could not be found");
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const request: ProductOptionsRequest = {
|
|
52
|
-
officeId,
|
|
53
|
-
catalogId: bookingAttributes.catalog,
|
|
54
|
-
productId: productAttributes.productId,
|
|
55
|
-
startDate: parseISO(bookingAttributes.startDate),
|
|
56
|
-
endDate: parseISO(bookingAttributes.endDate),
|
|
57
|
-
accommodationCode: bookingAttributes.accommodation,
|
|
58
|
-
regimeCode: bookingAttributes.regime,
|
|
59
|
-
adultCount: adultCount,
|
|
60
|
-
childCount: childCount,
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
const productOptionsResult = await productOptionsApi.fetchProductOptions(
|
|
64
|
-
request
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
const cacheKey = productOptionsResult?.cacheKey;
|
|
68
|
-
const rooms = productOptionsResult?.rooms;
|
|
69
|
-
|
|
70
|
-
if (cacheKey && rooms) {
|
|
71
|
-
dispatch(setCacheKey(cacheKey));
|
|
72
|
-
dispatch(setRooms(rooms));
|
|
73
|
-
|
|
74
|
-
if (rooms.length === 0) {
|
|
75
|
-
throw Error("No rooms present in response.");
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
const priceDetailsRequest: PackagePriceDetailsRequest = {
|
|
79
|
-
packageSearchResultCacheKey: cacheKey,
|
|
80
|
-
officeId: 1,
|
|
81
|
-
language: "nl-BE",
|
|
82
|
-
optionGuids:
|
|
83
|
-
productOptionsResult?.productOptions
|
|
84
|
-
?.filter((option) => option.isSelected)
|
|
85
|
-
?.map((option) => option.guid) ?? [],
|
|
86
|
-
rooms: [
|
|
87
|
-
{
|
|
88
|
-
id: rooms[0].id,
|
|
89
|
-
travelerAges: travelerAges,
|
|
90
|
-
},
|
|
91
|
-
],
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
dispatch(fetchPriceDetails(priceDetailsRequest));
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
return productOptionsResult;
|
|
98
|
-
}
|
|
99
|
-
);
|
|
100
|
-
|
|
101
|
-
const productOptionsAdapter = createEntityAdapter<ProductOption>({
|
|
102
|
-
selectId: (productOption) => productOption.code,
|
|
103
|
-
sortComparer: (a, b) => {
|
|
104
|
-
if (a.fromDate === b.fromDate) {
|
|
105
|
-
return a.code.localeCompare(b.code);
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
return a.fromDate.localeCompare(b.fromDate);
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
const productOptionsSlice = createSlice({
|
|
113
|
-
name: "productOptions",
|
|
114
|
-
initialState: productOptionsAdapter.getInitialState(),
|
|
115
|
-
reducers: {
|
|
116
|
-
updateOption: (state, action: PayloadAction<ProductOption>) => {
|
|
117
|
-
productOptionsAdapter.upsertOne(state, action.payload);
|
|
118
|
-
},
|
|
119
|
-
},
|
|
120
|
-
extraReducers: (builder) => {
|
|
121
|
-
builder.addCase(fetchProductOptions.fulfilled, (state, action) => {
|
|
122
|
-
productOptionsAdapter.setAll(state, action.payload?.productOptions ?? []);
|
|
123
|
-
});
|
|
124
|
-
},
|
|
125
|
-
});
|
|
126
|
-
|
|
127
|
-
const productOptionsSelectors = productOptionsAdapter.getSelectors<RootState>(
|
|
128
|
-
(state) => {
|
|
129
|
-
return state.productOptions;
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
export const selectOptions = productOptionsSelectors.selectAll;
|
|
134
|
-
|
|
135
|
-
export const selectSelectedOptions = createSelector(selectOptions, (options) =>
|
|
136
|
-
options.filter((option) => option.isSelected)
|
|
137
|
-
);
|
|
138
|
-
|
|
139
|
-
export const selectDepartureFlight = createSelector(selectOptions, (options) =>
|
|
140
|
-
find(options, (option) => option.productType === ServiceType.flight)
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
export const selectReturnFlight = createSelector(selectOptions, (options) =>
|
|
144
|
-
findLast(options, (option) => option.productType === ServiceType.flight)
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
export const { updateOption } = productOptionsSlice.actions;
|
|
148
|
-
|
|
149
|
-
export default productOptionsSlice.reducer;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
interface RadioButtonProps {
|
|
4
|
-
text: string;
|
|
5
|
-
name: string;
|
|
6
|
-
value: string;
|
|
7
|
-
defaultChecked?: boolean;
|
|
8
|
-
onChange?: React.ChangeEventHandler<HTMLInputElement>;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const RadioButton: React.FC<RadioButtonProps> = ({
|
|
12
|
-
text,
|
|
13
|
-
name,
|
|
14
|
-
value,
|
|
15
|
-
defaultChecked,
|
|
16
|
-
children,
|
|
17
|
-
onChange,
|
|
18
|
-
}) => (
|
|
19
|
-
<div className="radiobutton">
|
|
20
|
-
<label className="radiobutton__label">
|
|
21
|
-
<input
|
|
22
|
-
type="radio"
|
|
23
|
-
value={value}
|
|
24
|
-
name={name}
|
|
25
|
-
className="radiobutton__input"
|
|
26
|
-
defaultChecked={defaultChecked}
|
|
27
|
-
onChange={onChange}
|
|
28
|
-
/>
|
|
29
|
-
<span className="radiobutton__label-text">{text}</span>
|
|
30
|
-
{children}
|
|
31
|
-
</label>
|
|
32
|
-
</div>
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
export default RadioButton;
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { createEntityAdapter, createSlice } from "@reduxjs/toolkit";
|
|
2
|
-
|
|
3
|
-
import { PackageRoom } from "@qite/tide-client";
|
|
4
|
-
import { RootState } from "../../store";
|
|
5
|
-
|
|
6
|
-
const productOptionsAdapter = createEntityAdapter<PackageRoom>({
|
|
7
|
-
selectId: (room) => room.id,
|
|
8
|
-
});
|
|
9
|
-
|
|
10
|
-
const roomsSlice = createSlice({
|
|
11
|
-
name: "rooms",
|
|
12
|
-
initialState: productOptionsAdapter.getInitialState(),
|
|
13
|
-
reducers: {
|
|
14
|
-
setRooms: productOptionsAdapter.setAll,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
const roomsSelectors = productOptionsAdapter.getSelectors<RootState>(
|
|
19
|
-
(state) => {
|
|
20
|
-
return state.rooms;
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
|
|
24
|
-
export const selectRooms = roomsSelectors.selectAll;
|
|
25
|
-
|
|
26
|
-
export const { setRooms } = roomsSlice.actions;
|
|
27
|
-
|
|
28
|
-
export default roomsSlice.reducer;
|
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import { selectOptions, updateOption } from "./product-options-slice";
|
|
2
|
-
import { useDispatch, useSelector } from "react-redux";
|
|
3
|
-
|
|
4
|
-
import Checkbox from "./checkbox";
|
|
5
|
-
import OptionDetails from "./option-details";
|
|
6
|
-
import { ProductOption } from "./product-options-api";
|
|
7
|
-
import RadioButton from "./radio-button";
|
|
8
|
-
import React from "react";
|
|
9
|
-
import _, { isEmpty } from "lodash";
|
|
10
|
-
import { parseISO } from "date-fns";
|
|
11
|
-
import { fetchPriceDetails } from "../price-details/price-details-slice";
|
|
12
|
-
import { useState } from "react";
|
|
13
|
-
|
|
14
|
-
interface TreeLevelProps {
|
|
15
|
-
productOption: ProductOption;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const TreeLevel: React.FC<TreeLevelProps> = ({ productOption }) => {
|
|
19
|
-
const dispatch = useDispatch();
|
|
20
|
-
|
|
21
|
-
const [collapsed, setCollapsed] = useState(false);
|
|
22
|
-
|
|
23
|
-
const productOptions = useSelector(selectOptions);
|
|
24
|
-
|
|
25
|
-
const childProductOptions = _.compact(
|
|
26
|
-
Object.values(productOptions).filter(
|
|
27
|
-
(p) => p?.parentCode === productOption.code
|
|
28
|
-
)
|
|
29
|
-
);
|
|
30
|
-
|
|
31
|
-
const optionDetails = (
|
|
32
|
-
<OptionDetails
|
|
33
|
-
startDate={parseISO(productOption.fromDate)}
|
|
34
|
-
endDate={parseISO(productOption.toDate)}
|
|
35
|
-
price={productOption.price}
|
|
36
|
-
onToggleCollapse={(collapsed) => setCollapsed(collapsed)}
|
|
37
|
-
collapsed={collapsed}
|
|
38
|
-
isCollapsible={
|
|
39
|
-
productOptions.filter(
|
|
40
|
-
(childOption) => childOption.parentCode === productOption.code
|
|
41
|
-
).length > 0
|
|
42
|
-
}
|
|
43
|
-
/>
|
|
44
|
-
);
|
|
45
|
-
|
|
46
|
-
const handleSelectedChange: React.ChangeEventHandler<HTMLInputElement> = (
|
|
47
|
-
e
|
|
48
|
-
) => {
|
|
49
|
-
const updatedProductOption: ProductOption = {
|
|
50
|
-
...productOption,
|
|
51
|
-
isSelected: e.target.checked,
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
dispatch(updateOption(updatedProductOption));
|
|
55
|
-
dispatch(fetchPriceDetails());
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const options =
|
|
59
|
-
childProductOptions.length > 0 && productOption.isSelected && !collapsed ? (
|
|
60
|
-
<div className="tree__level">
|
|
61
|
-
<table className="table table--striped">
|
|
62
|
-
<thead>
|
|
63
|
-
<tr>
|
|
64
|
-
<th>
|
|
65
|
-
<h6 className="tree__level-heading">Opties</h6>
|
|
66
|
-
</th>
|
|
67
|
-
</tr>
|
|
68
|
-
</thead>
|
|
69
|
-
<tbody>
|
|
70
|
-
{childProductOptions.map((childProductOption) => (
|
|
71
|
-
<tr key={childProductOption.code}>
|
|
72
|
-
<td>
|
|
73
|
-
<TreeLevel productOption={childProductOption} />
|
|
74
|
-
</td>
|
|
75
|
-
</tr>
|
|
76
|
-
))}
|
|
77
|
-
</tbody>
|
|
78
|
-
</table>
|
|
79
|
-
</div>
|
|
80
|
-
) : null;
|
|
81
|
-
|
|
82
|
-
const body = options ? <div className="tree__body">{options}</div> : null;
|
|
83
|
-
|
|
84
|
-
return (
|
|
85
|
-
<div className="tree__level">
|
|
86
|
-
<div className="tree__header">
|
|
87
|
-
<div className="tree__description-collapse">
|
|
88
|
-
{isEmpty(productOption.group) ? (
|
|
89
|
-
<Checkbox
|
|
90
|
-
text={productOption.name}
|
|
91
|
-
value=""
|
|
92
|
-
name=""
|
|
93
|
-
required={productOption.isRequired}
|
|
94
|
-
defaultChecked={productOption.isSelected}
|
|
95
|
-
onChange={handleSelectedChange}
|
|
96
|
-
>
|
|
97
|
-
{optionDetails}
|
|
98
|
-
{body}
|
|
99
|
-
</Checkbox>
|
|
100
|
-
) : (
|
|
101
|
-
<RadioButton
|
|
102
|
-
text={productOption.name}
|
|
103
|
-
value=""
|
|
104
|
-
name={productOption.group ?? ""}
|
|
105
|
-
defaultChecked={productOption.isSelected}
|
|
106
|
-
onChange={handleSelectedChange}
|
|
107
|
-
>
|
|
108
|
-
{optionDetails}
|
|
109
|
-
{body}
|
|
110
|
-
</RadioButton>
|
|
111
|
-
)}
|
|
112
|
-
</div>
|
|
113
|
-
</div>
|
|
114
|
-
</div>
|
|
115
|
-
);
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export default TreeLevel;
|