mautourco-components 0.2.46 → 0.2.48
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/molecules/AgeSelector/AgeSelector.d.ts +20 -0
- package/dist/components/molecules/AgeSelector/AgeSelector.js +84 -0
- package/dist/components/molecules/LocationDropdown/LocationDropdown.js +1 -1
- package/dist/components/molecules/Pagination/Pagination.css +27 -17
- package/dist/components/molecules/Pagination/Pagination.js +4 -4
- package/dist/components/organisms/PaxSelector/PaxSelector.d.ts +5 -0
- package/dist/components/organisms/PaxSelector/PaxSelector.js +100 -114
- package/dist/components/organisms/RoundTrip/RoundTrip.d.ts +2 -0
- package/dist/components/organisms/RoundTrip/RoundTrip.js +7 -7
- package/dist/components/organisms/SearchBarTransfer/SearchBarTransfer.d.ts +4 -0
- package/dist/components/organisms/SearchBarTransfer/SearchBarTransfer.js +19 -57
- package/dist/components/organisms/Table/Table.css +64 -53
- package/dist/components/organisms/Table/Table.d.ts +1 -0
- package/dist/components/organisms/Table/Table.js +2 -1
- package/dist/components/organisms/Table/columns/booking-columns.d.ts +1 -1
- package/dist/components/organisms/Table/columns/booking-columns.js +17 -2
- package/dist/components/organisms/Table/columns/index.d.ts +1 -1
- package/dist/components/organisms/TransferLine/TransferLine.d.ts +9 -5
- package/dist/components/organisms/TransferLine/TransferLine.js +52 -35
- package/dist/index.d.ts +19 -16
- package/dist/index.js +3 -1
- package/dist/styles/components/molecule/age-selector.css +216 -0
- package/dist/styles/components/molecule/calendarInput.css +25 -6
- package/dist/styles/components/molecule/location-dropdown.css +16 -4
- package/dist/styles/components/organism/pax-selector.css +27 -189
- package/dist/styles/components/organism/transfer-line.css +40 -0
- package/dist/styles/mautourco.css +1 -0
- package/package.json +1 -1
- package/src/components/molecules/AgeSelector/AgeSelector.tsx +172 -0
- package/src/components/molecules/LocationDropdown/LocationDropdown.tsx +1 -1
- package/src/components/molecules/Pagination/Pagination.css +27 -18
- package/src/components/molecules/Pagination/Pagination.tsx +9 -13
- package/src/components/organisms/PaxSelector/PaxSelector.tsx +132 -208
- package/src/components/organisms/RoundTrip/RoundTrip.tsx +7 -0
- package/src/components/organisms/SearchBarTransfer/SearchBarTransfer.tsx +34 -54
- package/src/components/organisms/Table/Table.css +64 -53
- package/src/components/organisms/Table/Table.tsx +22 -1
- package/src/components/organisms/Table/columns/booking-columns.tsx +40 -13
- package/src/components/organisms/TransferLine/TransferLine.tsx +107 -85
- package/src/styles/components/molecule/age-selector.css +136 -0
- package/src/styles/components/molecule/calendarInput.css +12 -4
- package/src/styles/components/molecule/location-dropdown.css +9 -2
- package/src/styles/components/organism/pax-selector.css +25 -186
- package/src/styles/components/organism/transfer-line.css +31 -0
|
@@ -26,12 +26,12 @@ import LocationDropdown from "../../molecules/LocationDropdown/LocationDropdown"
|
|
|
26
26
|
import DateTimePicker from "../DateTimePicker/DateTimePicker";
|
|
27
27
|
import PaxSelector from "../PaxSelector/PaxSelector";
|
|
28
28
|
var RoundTrip = function (_a) {
|
|
29
|
-
var id = _a.id, paxData = _a.paxData, arrivalDate = _a.arrivalDate, departureDate = _a.departureDate, pickupDropoffPoint = _a.pickupDropoffPoint, accommodation = _a.accommodation, _b = _a.locations, locations = _b === void 0 ? { options: [], groups: [] } : _b, onPaxChange = _a.onPaxChange, onDatesChange = _a.onDatesChange, onPickupDropoffChange = _a.onPickupDropoffChange, onAccommodationChange = _a.onAccommodationChange, onChange = _a.onChange, _c = _a.className, className = _c === void 0 ? "" : _c, _d = _a.checkEmpty, checkEmpty = _d === void 0 ? false : _d;
|
|
30
|
-
var
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
29
|
+
var id = _a.id, paxData = _a.paxData, arrivalDate = _a.arrivalDate, departureDate = _a.departureDate, pickupDropoffPoint = _a.pickupDropoffPoint, accommodation = _a.accommodation, _b = _a.locations, locations = _b === void 0 ? { options: [], groups: [] } : _b, onPaxChange = _a.onPaxChange, onDatesChange = _a.onDatesChange, onPickupDropoffChange = _a.onPickupDropoffChange, onAccommodationChange = _a.onAccommodationChange, onChange = _a.onChange, _c = _a.className, className = _c === void 0 ? "" : _c, _d = _a.checkEmpty, checkEmpty = _d === void 0 ? false : _d, _e = _a.scrollOnOpen, scrollOnOpen = _e === void 0 ? false : _e;
|
|
30
|
+
var _f = useState(paxData), internalPaxData = _f[0], setInternalPaxData = _f[1];
|
|
31
|
+
var _g = useState(arrivalDate), internalArrivalDate = _g[0], setInternalArrivalDate = _g[1];
|
|
32
|
+
var _h = useState(departureDate), internalDepartureDate = _h[0], setInternalDepartureDate = _h[1];
|
|
33
|
+
var _j = useState(null), internalPickupDropoffPoint = _j[0], setInternalPickupDropoffPoint = _j[1];
|
|
34
|
+
var _k = useState(null), internalAccommodation = _k[0], setInternalAccommodation = _k[1];
|
|
35
35
|
// Helper function to get all locations (from options and groups)
|
|
36
36
|
var getAllLocations = function (options, groups) {
|
|
37
37
|
var groupOptions = groups.flatMap(function (group) { return group.options; });
|
|
@@ -184,6 +184,6 @@ var RoundTrip = function (_a) {
|
|
|
184
184
|
var isAccommodationEmpty = checkEmpty && !internalAccommodation;
|
|
185
185
|
var pickupDropoffOptions = getPickupDropoffOptions();
|
|
186
186
|
var accommodationOptions = getAccommodationOptions();
|
|
187
|
-
return (_jsx("div", { className: "round-trip ".concat(className), "data-round-trip-id": id, children: _jsxs("div", { className: "round-trip__content", children: [_jsx("div", { className: "round-trip__field round-trip__field--pax ".concat(isPaxEmpty ? 'round-trip__field--error' : ''), children: _jsx(PaxSelector, { label: "Number of pax", value: internalPaxData, onChange: handlePaxChange, placeholder: "2 pax", className: isPaxEmpty ? 'pax-selector--error' : '' }) }), _jsxs("div", { className: "round-trip__field round-trip__field--dates", children: [_jsx(Text, { size: "sm", variant: "regular", className: "round-trip__field-label", children: "Arrival date - Departure date" }), _jsx(DateTimePicker, { placeholder: "DD/MM/YYYY - DD/MM/YYYY", mode: "calendar", iconPosition: "left", numberOfMonths: 2, iconBGFull: false, showChevron: true, onValueChange: handleDateRangeChange, selectionMode: "range", defaultValue: internalArrivalDate && internalDepartureDate ? [internalArrivalDate, internalDepartureDate] : undefined, inputClassName: "round-trip__date-picker--input", state: isDateEmpty ? 'error' : undefined })] }), _jsx("div", { className: "round-trip__field round-trip__field--pickup-dropoff", children: _jsx(LocationDropdown, { label: "Pick up / Drop-off point", options: pickupDropoffOptions.options, groups: pickupDropoffOptions.groups, selectedValue: (internalPickupDropoffPoint === null || internalPickupDropoffPoint === void 0 ? void 0 : internalPickupDropoffPoint.id) || null, onSelectionChange: handlePickupDropoffChange, placeholder: "Select pick-up / drop-off point", direction: undefined, type: "airport-port", showGroupTitles: true, error: isPickupDropoffEmpty }) }), _jsx("div", { className: "round-trip__field round-trip__field--accommodation", children: _jsx(LocationDropdown, { label: "Accommodation", options: accommodationOptions.options, groups: accommodationOptions.groups, selectedValue: (internalAccommodation === null || internalAccommodation === void 0 ? void 0 : internalAccommodation.id) || null, onSelectionChange: handleAccommodationChange, placeholder: "Select accommodation", direction: "dropoff", type: "accommodation", showGroupTitles: false, error: isAccommodationEmpty }) })] }) }));
|
|
187
|
+
return (_jsx("div", { className: "round-trip ".concat(className), "data-round-trip-id": id, children: _jsxs("div", { className: "round-trip__content", children: [_jsx("div", { className: "round-trip__field round-trip__field--pax ".concat(isPaxEmpty ? 'round-trip__field--error' : ''), children: _jsx(PaxSelector, { label: "Number of pax", value: internalPaxData, onChange: handlePaxChange, placeholder: "2 pax", className: isPaxEmpty ? 'pax-selector--error' : '', scrollOnOpen: scrollOnOpen }) }), _jsxs("div", { className: "round-trip__field round-trip__field--dates", children: [_jsx(Text, { size: "sm", variant: "regular", className: "round-trip__field-label", children: "Arrival date - Departure date" }), _jsx(DateTimePicker, { placeholder: "DD/MM/YYYY - DD/MM/YYYY", mode: "calendar", iconPosition: "left", numberOfMonths: 2, iconBGFull: false, showChevron: true, onValueChange: handleDateRangeChange, selectionMode: "range", defaultValue: internalArrivalDate && internalDepartureDate ? [internalArrivalDate, internalDepartureDate] : undefined, inputClassName: "round-trip__date-picker--input", state: isDateEmpty ? 'error' : undefined, scrollOnOpen: scrollOnOpen })] }), _jsx("div", { className: "round-trip__field round-trip__field--pickup-dropoff", children: _jsx(LocationDropdown, { label: "Pick up / Drop-off point", options: pickupDropoffOptions.options, groups: pickupDropoffOptions.groups, selectedValue: (internalPickupDropoffPoint === null || internalPickupDropoffPoint === void 0 ? void 0 : internalPickupDropoffPoint.id) || null, onSelectionChange: handlePickupDropoffChange, placeholder: "Select pick-up / drop-off point", direction: undefined, type: "airport-port", showGroupTitles: true, error: isPickupDropoffEmpty, scrollOnOpen: scrollOnOpen }) }), _jsx("div", { className: "round-trip__field round-trip__field--accommodation", children: _jsx(LocationDropdown, { label: "Accommodation", options: accommodationOptions.options, groups: accommodationOptions.groups, selectedValue: (internalAccommodation === null || internalAccommodation === void 0 ? void 0 : internalAccommodation.id) || null, onSelectionChange: handleAccommodationChange, placeholder: "Select accommodation", direction: "dropoff", type: "accommodation", showGroupTitles: false, error: isAccommodationEmpty, scrollOnOpen: scrollOnOpen }) })] }) }));
|
|
188
188
|
};
|
|
189
189
|
export default RoundTrip;
|
|
@@ -28,8 +28,12 @@ export interface SearchBarTransferProps {
|
|
|
28
28
|
onSearch?: (data: SearchBarTransferData) => void;
|
|
29
29
|
/** Callback when data changes */
|
|
30
30
|
onChange?: (data: SearchBarTransferData) => void;
|
|
31
|
+
/** Callback when a transfer line is removed */
|
|
32
|
+
onRemove?: (index: number, transferLine: TransferLineData) => void;
|
|
31
33
|
/** Additional CSS classes */
|
|
32
34
|
className?: string;
|
|
35
|
+
/** Whether to scroll to the input when the calendar opens */
|
|
36
|
+
scrollOnOpen?: boolean;
|
|
33
37
|
}
|
|
34
38
|
declare const SearchBarTransfer: React.FC<SearchBarTransferProps>;
|
|
35
39
|
export default SearchBarTransfer;
|
|
@@ -32,7 +32,7 @@ import TransferLine from "../TransferLine/TransferLine";
|
|
|
32
32
|
var transferIdCounter = 0;
|
|
33
33
|
var SearchBarTransfer = function (_a) {
|
|
34
34
|
var _b, _c;
|
|
35
|
-
var _d = _a.mode, initialMode = _d === void 0 ? "roundtrip" : _d, _e = _a.locations, locations = _e === void 0 ? { options: [], groups: [] } : _e, defaultRoundTripData = _a.defaultRoundTripData, defaultTransferLines = _a.defaultTransferLines, _f = _a.defaultSameVehicle, defaultSameVehicle = _f === void 0 ? false : _f, onSearch = _a.onSearch, onChange = _a.onChange, _g = _a.className, className = _g === void 0 ? "" : _g;
|
|
35
|
+
var _d = _a.mode, initialMode = _d === void 0 ? "roundtrip" : _d, _e = _a.locations, locations = _e === void 0 ? { options: [], groups: [] } : _e, defaultRoundTripData = _a.defaultRoundTripData, defaultTransferLines = _a.defaultTransferLines, _f = _a.defaultSameVehicle, defaultSameVehicle = _f === void 0 ? false : _f, onSearch = _a.onSearch, onChange = _a.onChange, onRemove = _a.onRemove, _g = _a.className, className = _g === void 0 ? "" : _g, _h = _a.scrollOnOpen, scrollOnOpen = _h === void 0 ? false : _h;
|
|
36
36
|
// Generate unique ID for transfer lines
|
|
37
37
|
var generateTransferId = function () {
|
|
38
38
|
transferIdCounter += 1;
|
|
@@ -44,11 +44,11 @@ var SearchBarTransfer = function (_a) {
|
|
|
44
44
|
return [];
|
|
45
45
|
return lines.map(function (line) { return (__assign(__assign({}, line), { id: line.id || generateTransferId() })); });
|
|
46
46
|
};
|
|
47
|
-
var
|
|
48
|
-
var
|
|
49
|
-
var
|
|
50
|
-
var
|
|
51
|
-
var
|
|
47
|
+
var _j = useState(initialMode), mode = _j[0], setMode = _j[1];
|
|
48
|
+
var _k = useState(defaultSameVehicle), sameVehicle = _k[0], setSameVehicle = _k[1];
|
|
49
|
+
var _l = useState(defaultRoundTripData), roundTripData = _l[0], setRoundTripData = _l[1];
|
|
50
|
+
var _m = useState(initializeTransferLines(defaultTransferLines)), transferLines = _m[0], setTransferLines = _m[1];
|
|
51
|
+
var _o = useState(null), error = _o[0], setError = _o[1];
|
|
52
52
|
// Notify parent of changes
|
|
53
53
|
useEffect(function () {
|
|
54
54
|
var data = {
|
|
@@ -69,25 +69,9 @@ var SearchBarTransfer = function (_a) {
|
|
|
69
69
|
var transferMode = newMode;
|
|
70
70
|
if (transferMode === mode)
|
|
71
71
|
return;
|
|
72
|
-
if (transferMode === "custom" && mode === "roundtrip"
|
|
73
|
-
//
|
|
74
|
-
|
|
75
|
-
id: generateTransferId(),
|
|
76
|
-
type: "arrival",
|
|
77
|
-
paxData: roundTripData.paxData,
|
|
78
|
-
transferDate: roundTripData.arrivalDate,
|
|
79
|
-
pickupPoint: roundTripData.pickupDropoffPoint,
|
|
80
|
-
dropoffPoint: roundTripData.accommodation,
|
|
81
|
-
};
|
|
82
|
-
var departureTransfer = {
|
|
83
|
-
id: generateTransferId(),
|
|
84
|
-
type: "departure",
|
|
85
|
-
paxData: roundTripData.paxData,
|
|
86
|
-
transferDate: roundTripData.departureDate,
|
|
87
|
-
pickupPoint: roundTripData.accommodation,
|
|
88
|
-
dropoffPoint: roundTripData.pickupDropoffPoint,
|
|
89
|
-
};
|
|
90
|
-
setTransferLines([arrivalTransfer, departureTransfer]);
|
|
72
|
+
if (transferMode === "custom" && mode === "roundtrip") {
|
|
73
|
+
// When switching to custom mode, reset transfer lines (will show placeholder)
|
|
74
|
+
setTransferLines([]);
|
|
91
75
|
setRoundTripData(undefined);
|
|
92
76
|
}
|
|
93
77
|
else if (transferMode === "roundtrip" && mode === "custom") {
|
|
@@ -108,42 +92,15 @@ var SearchBarTransfer = function (_a) {
|
|
|
108
92
|
};
|
|
109
93
|
// Render transfer type buttons
|
|
110
94
|
var renderTransferTypeButtons = function (onClick) { return (_jsxs("div", { className: "search-bar-transfer__add-buttons", children: [_jsx(Button, { variant: "outline-secondary", size: "sm", leadingIcon: "plus", onClick: function () { return onClick("arrival"); }, children: "Add Arrival" }), _jsx(Button, { variant: "outline-secondary", size: "sm", leadingIcon: "plus", onClick: function () { return onClick("departure"); }, children: "Add Departure" }), _jsx(Button, { variant: "outline-secondary", size: "sm", leadingIcon: "plus", onClick: function () { return onClick("inter-hotel"); }, children: "Add Inter-Hotel" })] })); };
|
|
111
|
-
// Handle adding transfer from round-trip mode (
|
|
95
|
+
// Handle adding transfer from round-trip mode (switches to custom and adds new transfer)
|
|
112
96
|
var handleAddTransferFromRoundTrip = function (type) {
|
|
113
|
-
if (!roundTripData) {
|
|
114
|
-
// If no round trip data, just add a new transfer and switch to custom
|
|
115
|
-
var newTransfer_1 = {
|
|
116
|
-
id: generateTransferId(),
|
|
117
|
-
type: type,
|
|
118
|
-
};
|
|
119
|
-
setTransferLines([newTransfer_1]);
|
|
120
|
-
setMode("custom");
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
// Convert roundtrip to two transfer lines
|
|
124
|
-
var arrivalTransfer = {
|
|
125
|
-
id: generateTransferId(),
|
|
126
|
-
type: "arrival",
|
|
127
|
-
paxData: roundTripData.paxData,
|
|
128
|
-
transferDate: roundTripData.arrivalDate,
|
|
129
|
-
pickupPoint: roundTripData.pickupDropoffPoint,
|
|
130
|
-
dropoffPoint: roundTripData.accommodation,
|
|
131
|
-
};
|
|
132
|
-
var departureTransfer = {
|
|
133
|
-
id: generateTransferId(),
|
|
134
|
-
type: "departure",
|
|
135
|
-
paxData: roundTripData.paxData,
|
|
136
|
-
transferDate: roundTripData.departureDate,
|
|
137
|
-
pickupPoint: roundTripData.accommodation,
|
|
138
|
-
dropoffPoint: roundTripData.pickupDropoffPoint,
|
|
139
|
-
};
|
|
140
97
|
// Add the new transfer of the clicked type
|
|
141
98
|
var newTransfer = {
|
|
142
99
|
id: generateTransferId(),
|
|
143
100
|
type: type,
|
|
144
101
|
};
|
|
145
|
-
// Set
|
|
146
|
-
setTransferLines([
|
|
102
|
+
// Set the transfer and switch to custom mode
|
|
103
|
+
setTransferLines([newTransfer]);
|
|
147
104
|
setRoundTripData(undefined);
|
|
148
105
|
setMode("custom");
|
|
149
106
|
setError(null);
|
|
@@ -156,6 +113,11 @@ var SearchBarTransfer = function (_a) {
|
|
|
156
113
|
};
|
|
157
114
|
// Handle transfer line deletion
|
|
158
115
|
var handleDeleteTransferLine = function (id) {
|
|
116
|
+
var index = transferLines.findIndex(function (line) { return line.id === id; });
|
|
117
|
+
var transferLine = transferLines.find(function (line) { return line.id === id; });
|
|
118
|
+
if (index !== -1 && transferLine) {
|
|
119
|
+
onRemove === null || onRemove === void 0 ? void 0 : onRemove(index, transferLine);
|
|
120
|
+
}
|
|
159
121
|
setTransferLines(function (prevLines) { return prevLines.filter(function (line) { return line.id !== id; }); });
|
|
160
122
|
};
|
|
161
123
|
// Validate data
|
|
@@ -207,7 +169,7 @@ var SearchBarTransfer = function (_a) {
|
|
|
207
169
|
onSearch === null || onSearch === void 0 ? void 0 : onSearch(data);
|
|
208
170
|
}
|
|
209
171
|
};
|
|
210
|
-
return (_jsxs("div", { className: "search-bar-transfer ".concat(className), children: [_jsxs("div", { className: "search-bar-transfer__header", children: [_jsx(Heading, { level: 5, variant: "bold", color: "accent", children: "Select your transfer details" }), _jsx("div", { className: "search-bar-transfer__mode-selector", children: _jsx(SegmentedButton, { options: modeOptions, value: mode, onChange: handleModeChange, name: "transfer-mode" }) })] }), mode === "roundtrip" ? (_jsxs(_Fragment, { children: [_jsx(RoundTrip, { id: "roundtrip-main", locations: locations, paxData: roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.paxData, arrivalDate: roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.arrivalDate, departureDate: roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.departureDate, pickupDropoffPoint: (_b = roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.pickupDropoffPoint) === null || _b === void 0 ? void 0 : _b.id, accommodation: (_c = roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.accommodation) === null || _c === void 0 ? void 0 : _c.id, onChange: setRoundTripData, checkEmpty: error !== null }), _jsx("div", { className: "search-bar-transfer__transfer-type", children: renderTransferTypeButtons(handleAddTransferFromRoundTrip) })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "search-bar-transfer__transfer-type", children: [_jsx(Text, { size: "lg", variant: "bold", color: "subtle", as: "div", className: "search-bar-transfer__transfer-type-label", children: "Select a transfer type you want to add" }), renderTransferTypeButtons(handleAddTransfer)] }), transferLines.length > 0 && (_jsx("div", { className: "search-bar-transfer__transfer-lines", children: (function () {
|
|
172
|
+
return (_jsxs("div", { className: "search-bar-transfer ".concat(className), children: [_jsxs("div", { className: "search-bar-transfer__header", children: [_jsx(Heading, { level: 5, variant: "bold", color: "accent", children: "Select your transfer details" }), _jsx("div", { className: "search-bar-transfer__mode-selector", children: _jsx(SegmentedButton, { options: modeOptions, value: mode, onChange: handleModeChange, name: "transfer-mode" }) })] }), mode === "roundtrip" ? (_jsxs(_Fragment, { children: [_jsx(RoundTrip, { id: "roundtrip-main", locations: locations, paxData: roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.paxData, arrivalDate: roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.arrivalDate, departureDate: roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.departureDate, pickupDropoffPoint: (_b = roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.pickupDropoffPoint) === null || _b === void 0 ? void 0 : _b.id, accommodation: (_c = roundTripData === null || roundTripData === void 0 ? void 0 : roundTripData.accommodation) === null || _c === void 0 ? void 0 : _c.id, onChange: setRoundTripData, checkEmpty: error !== null, scrollOnOpen: scrollOnOpen }), _jsx("div", { className: "search-bar-transfer__transfer-type", children: renderTransferTypeButtons(handleAddTransferFromRoundTrip) })] })) : (_jsxs(_Fragment, { children: [_jsxs("div", { className: "search-bar-transfer__transfer-type", children: [_jsx(Text, { size: "lg", variant: "bold", color: "subtle", as: "div", className: "search-bar-transfer__transfer-type-label", children: "Select a transfer type you want to add" }), renderTransferTypeButtons(handleAddTransfer)] }), transferLines.length === 0 && (_jsx(TransferLine, { id: "placeholder-transfer", type: "inter-hotel", locations: locations, onDataChange: function () { }, showDelete: false, disabled: true, scrollOnOpen: scrollOnOpen })), transferLines.length > 0 && (_jsx("div", { className: "search-bar-transfer__transfer-lines", children: (function () {
|
|
211
173
|
// Group transfers by type
|
|
212
174
|
var groupedTransfers = {
|
|
213
175
|
arrival: [],
|
|
@@ -228,7 +190,7 @@ var SearchBarTransfer = function (_a) {
|
|
|
228
190
|
};
|
|
229
191
|
return nonEmptyGroups.map(function (type, groupIndex) { return (_jsxs(React.Fragment, { children: [_jsxs("div", { className: "search-bar-transfer__category-header", children: [_jsx(Icon, { name: categoryInfo[type].icon, size: "md" }), _jsx(Text, { size: "md", variant: "bold", color: "default", as: "span", children: categoryInfo[type].label })] }), groupedTransfers[type].map(function (line) {
|
|
230
192
|
var _a, _b;
|
|
231
|
-
return (_jsx(TransferLine, { id: line.id, type: line.type, paxData: line.paxData, transferDate: line.transferDate, pickupPoint: (_a = line.pickupPoint) === null || _a === void 0 ? void 0 : _a.id, dropoffPoint: (_b = line.dropoffPoint) === null || _b === void 0 ? void 0 : _b.id, locations: locations, onDataChange: function (data) { return handleTransferLineChange(line.id, data); }, onDelete: function () { return handleDeleteTransferLine(line.id); }, showDelete: transferLines.length > 1, checkEmpty: error !== null }, line.id));
|
|
193
|
+
return (_jsx(TransferLine, { id: line.id, type: line.type, paxData: line.paxData, transferDate: line.transferDate, pickupPoint: (_a = line.pickupPoint) === null || _a === void 0 ? void 0 : _a.id, dropoffPoint: (_b = line.dropoffPoint) === null || _b === void 0 ? void 0 : _b.id, locations: locations, onDataChange: function (data) { return handleTransferLineChange(line.id, data); }, onDelete: function () { return handleDeleteTransferLine(line.id); }, showDelete: transferLines.length > 1, checkEmpty: error !== null, scrollOnOpen: scrollOnOpen }, line.id));
|
|
232
194
|
}), groupIndex < nonEmptyGroups.length - 1 && (_jsx("svg", { className: "search-bar-transfer__divider", xmlns: "http://www.w3.org/2000/svg", width: "100%", height: "1", viewBox: "0 0 1076 1", fill: "none", preserveAspectRatio: "none", children: _jsx("path", { d: "M0 0.5L1076 0.499906", stroke: "var(--color-border-medium, #A3A3A3)", strokeWidth: "1", strokeDasharray: "10 10" }) }))] }, type)); });
|
|
233
195
|
})() }))] })), _jsxs("div", { className: "search-bar-transfer__actions", children: [_jsx(Checkbox, { checked: sameVehicle, onChange: setSameVehicle, label: "Use the same vehicle for all your transfers" }), _jsxs("div", { className: "search-bar-transfer__cta", children: [error && (_jsx(Toast, { text: error, type: "danger" })), _jsx(Button, { variant: "primary", size: "lg", onClick: handleSearch, children: "Search" })] })] })] }));
|
|
234
196
|
};
|
|
@@ -20,10 +20,14 @@
|
|
|
20
20
|
width: 100%;
|
|
21
21
|
border-collapse: collapse;
|
|
22
22
|
border-spacing: 0;
|
|
23
|
+
table-layout: fixed;
|
|
23
24
|
th,
|
|
24
25
|
td {
|
|
25
26
|
padding-inline: var(--spacing-padding-px-4);
|
|
26
27
|
}
|
|
28
|
+
.table__cell-highlighted {
|
|
29
|
+
padding: 0;
|
|
30
|
+
}
|
|
27
31
|
}
|
|
28
32
|
.table__header {
|
|
29
33
|
th {
|
|
@@ -50,61 +54,13 @@
|
|
|
50
54
|
&:hover:not(.table__no-hover) {
|
|
51
55
|
background-color: var(--color-elevation-state-hover-subtle);
|
|
52
56
|
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
56
|
-
&.table__row-yellow {
|
|
57
|
-
background-color: var(--color-yellow-50);
|
|
58
|
-
border: 1px solid transparent;
|
|
59
|
-
position: relative;
|
|
60
|
-
&::after {
|
|
61
|
-
content: '';
|
|
62
|
-
position: absolute;
|
|
63
|
-
inset: -1px;
|
|
64
|
-
pointer-events: none;
|
|
65
|
-
background-image:
|
|
66
|
-
repeating-linear-gradient(
|
|
67
|
-
to right,
|
|
68
|
-
var(--color-yellow-600) 0,
|
|
69
|
-
var(--color-yellow-600) 8px,
|
|
70
|
-
transparent 8px,
|
|
71
|
-
transparent 16px
|
|
72
|
-
),
|
|
73
|
-
repeating-linear-gradient(
|
|
74
|
-
to right,
|
|
75
|
-
var(--color-yellow-600) 0,
|
|
76
|
-
var(--color-yellow-600) 8px,
|
|
77
|
-
transparent 8px,
|
|
78
|
-
transparent 16px
|
|
79
|
-
),
|
|
80
|
-
repeating-linear-gradient(
|
|
81
|
-
to bottom,
|
|
82
|
-
var(--color-yellow-600) 0,
|
|
83
|
-
var(--color-yellow-600) 8px,
|
|
84
|
-
transparent 8px,
|
|
85
|
-
transparent 16px
|
|
86
|
-
),
|
|
87
|
-
repeating-linear-gradient(
|
|
88
|
-
to bottom,
|
|
89
|
-
var(--color-yellow-600) 0,
|
|
90
|
-
var(--color-yellow-600) 8px,
|
|
91
|
-
transparent 8px,
|
|
92
|
-
transparent 16px
|
|
93
|
-
);
|
|
94
|
-
background-size:
|
|
95
|
-
100% 1px,
|
|
96
|
-
100% 1px,
|
|
97
|
-
1px 100%,
|
|
98
|
-
1px 100%;
|
|
99
|
-
background-position: top, bottom, left, right;
|
|
100
|
-
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
|
|
101
|
-
}
|
|
102
|
-
&:hover {
|
|
57
|
+
&.table__row-highlighted:hover {
|
|
58
|
+
tr {
|
|
103
59
|
background-color: var(--color-yellow-100);
|
|
104
60
|
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
61
|
+
}
|
|
62
|
+
&:first-child {
|
|
63
|
+
border-top: none;
|
|
108
64
|
}
|
|
109
65
|
&.table__row-border-0 {
|
|
110
66
|
border-top: none;
|
|
@@ -281,4 +237,59 @@
|
|
|
281
237
|
border-bottom: solid 1px var(--color-surface-300);
|
|
282
238
|
}
|
|
283
239
|
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.table__row-div-highlighted {
|
|
243
|
+
background-color: var(--color-yellow-50);
|
|
244
|
+
border: 1px solid transparent;
|
|
245
|
+
position: relative;
|
|
246
|
+
|
|
247
|
+
&::after {
|
|
248
|
+
content: '';
|
|
249
|
+
position: absolute;
|
|
250
|
+
inset: -1px;
|
|
251
|
+
pointer-events: none;
|
|
252
|
+
background-image:
|
|
253
|
+
repeating-linear-gradient(
|
|
254
|
+
to right,
|
|
255
|
+
var(--color-yellow-600) 0,
|
|
256
|
+
var(--color-yellow-600) 8px,
|
|
257
|
+
transparent 8px,
|
|
258
|
+
transparent 16px
|
|
259
|
+
),
|
|
260
|
+
repeating-linear-gradient(
|
|
261
|
+
to right,
|
|
262
|
+
var(--color-yellow-600) 0,
|
|
263
|
+
var(--color-yellow-600) 8px,
|
|
264
|
+
transparent 8px,
|
|
265
|
+
transparent 16px
|
|
266
|
+
),
|
|
267
|
+
repeating-linear-gradient(
|
|
268
|
+
to bottom,
|
|
269
|
+
var(--color-yellow-600) 0,
|
|
270
|
+
var(--color-yellow-600) 8px,
|
|
271
|
+
transparent 8px,
|
|
272
|
+
transparent 16px
|
|
273
|
+
),
|
|
274
|
+
repeating-linear-gradient(
|
|
275
|
+
to bottom,
|
|
276
|
+
var(--color-yellow-600) 0,
|
|
277
|
+
var(--color-yellow-600) 8px,
|
|
278
|
+
transparent 8px,
|
|
279
|
+
transparent 16px
|
|
280
|
+
);
|
|
281
|
+
background-size:
|
|
282
|
+
100% 1px,
|
|
283
|
+
100% 1px,
|
|
284
|
+
1px 100%,
|
|
285
|
+
1px 100%;
|
|
286
|
+
background-position: top, bottom, left, right;
|
|
287
|
+
background-repeat: repeat-x, repeat-x, repeat-y, repeat-y;
|
|
288
|
+
}
|
|
289
|
+
&:hover {
|
|
290
|
+
background-color: var(--color-yellow-100);
|
|
291
|
+
}
|
|
292
|
+
& + tr {
|
|
293
|
+
border-top: none;
|
|
294
|
+
}
|
|
284
295
|
}
|
|
@@ -83,7 +83,8 @@ export function Table(props) {
|
|
|
83
83
|
var defaultTable = (_jsx("tr", { className: cn(row.className, {
|
|
84
84
|
'table__row-nested': (_b = row.children) === null || _b === void 0 ? void 0 : _b.length,
|
|
85
85
|
'table__row-clickable': onClickRow,
|
|
86
|
-
|
|
86
|
+
'table__row-highlighted': row.isHighlighted,
|
|
87
|
+
}), onClick: function (e) { return onClickRow === null || onClickRow === void 0 ? void 0 : onClickRow(e, row); }, children: row.isHighlighted ? (_jsx("td", { colSpan: columns.length, className: "table__cell-highlighted", children: _jsx("div", { className: "table__row-div-highlighted", children: _jsx("table", { className: "table", children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { columns: columns, row: row, rowIndex: rowIndex }) }) }) }) }) })) : (_jsx(TableCell, { columns: columns, row: row, rowIndex: rowIndex })) }));
|
|
87
88
|
return (_jsx(Fragment, { children: isGrouped ? (row.children && row.children.length > 0 ? (_jsx("tr", { className: "table__row-grouped", children: _jsx("td", { colSpan: columns.length, children: _jsx(NestedContent, { isGrouped: isGrouped, rowIndex: rowIndex, columns: columns, children: row.children || [], onClickRow: onClickRow }) }) })) : (defaultTable)) : !row.children ? (defaultTable) : (_jsx("tr", { className: "table__row-with-children", onClick: function (e) { return onClickRow === null || onClickRow === void 0 ? void 0 : onClickRow(e, row); }, children: _jsx("td", { colSpan: columns.length, className: cn({
|
|
88
89
|
'table__children--visible': hasVisibleChildren,
|
|
89
90
|
}), children: _jsx("table", { className: "table", children: _jsxs("tbody", { children: [defaultTable, _jsx(AnimatePresence, { initial: false, children: hasVisibleChildren && (_jsx("tr", { className: cn('table__no-hover', {
|
|
@@ -2,6 +2,6 @@ import { ActionDropdownType } from '@/src/types/table';
|
|
|
2
2
|
import { BookingListItem } from '@/src/types/table/booking.types';
|
|
3
3
|
import { ColumnType } from '../TableCell';
|
|
4
4
|
export declare const bookingColumns: (params: {
|
|
5
|
-
onAction?: (action: ActionDropdownType) => void;
|
|
5
|
+
onAction?: (data: BookingListItem) => (action: ActionDropdownType) => void;
|
|
6
6
|
keywords?: string;
|
|
7
7
|
}) => ColumnType<BookingListItem>[];
|
|
@@ -1,10 +1,22 @@
|
|
|
1
|
-
import { jsx as _jsx,
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import Button from '../../../atoms/Button/Button';
|
|
3
|
+
import Chip from '../../../atoms/Chip/Chip';
|
|
3
4
|
import { Text } from '../../../atoms/Typography/Typography';
|
|
4
5
|
import { ActionDropdown } from '../../../molecules/ActionDropdown/ActionDropdown';
|
|
5
6
|
import { DateDisplay } from '../../../molecules/DateDisplay/DateDisplay';
|
|
6
7
|
import { PaxChips } from '../../../molecules/PaxChips/PaxChips';
|
|
7
8
|
import { actionDropdownData } from '../constant';
|
|
9
|
+
var CHIP_WIDTH = 'w-[184px]';
|
|
10
|
+
var BUTTON_WIDTH = 'w-[89px]';
|
|
11
|
+
var renderStatusContent = function (status) {
|
|
12
|
+
if (status === 'PENDING') {
|
|
13
|
+
return (_jsx(Chip, { size: "sm", color: "yellow", className: CHIP_WIDTH, children: "On Request" }));
|
|
14
|
+
}
|
|
15
|
+
if (status === 'Cancelled') {
|
|
16
|
+
return (_jsx(Chip, { size: "sm", color: "red", className: CHIP_WIDTH, children: "Cancelled" }));
|
|
17
|
+
}
|
|
18
|
+
return (_jsxs("div", { className: "flex items-center gap-x-3", children: [_jsx(Button, { variant: "secondary", size: "sm", className: BUTTON_WIDTH, children: "Proforma" }), _jsx(Button, { variant: "outline-secondary", size: "sm", className: BUTTON_WIDTH, children: "Voucher" })] }));
|
|
19
|
+
};
|
|
8
20
|
export var bookingColumns = function (_a) {
|
|
9
21
|
var onAction = _a.onAction, _b = _a.keywords, keywords = _b === void 0 ? '' : _b;
|
|
10
22
|
return [
|
|
@@ -74,7 +86,10 @@ export var bookingColumns = function (_a) {
|
|
|
74
86
|
key: 'actions',
|
|
75
87
|
width: 232,
|
|
76
88
|
cell: function (_value, raw) {
|
|
77
|
-
|
|
89
|
+
var _a;
|
|
90
|
+
var handleAction = (_a = onAction === null || onAction === void 0 ? void 0 : onAction(raw)) !== null && _a !== void 0 ? _a : (function () { });
|
|
91
|
+
var actionData = actionDropdownData(handleAction);
|
|
92
|
+
return (_jsxs("div", { className: "flex items-center justify-between", children: [renderStatusContent(raw.status), _jsx(ActionDropdown, { data: actionData })] }));
|
|
78
93
|
},
|
|
79
94
|
},
|
|
80
95
|
];
|
|
@@ -11,7 +11,7 @@ declare const columns: {
|
|
|
11
11
|
onRemove?: (value: import("../../../..").DetailResumeItem, index?: number) => void;
|
|
12
12
|
}) => import("../TableCell").ColumnType<import("../../../..").DetailResumeItem>[];
|
|
13
13
|
booking: (params: {
|
|
14
|
-
onAction?: (action: import("../../../..").ActionDropdownType) => void;
|
|
14
|
+
onAction?: (data: import("../../../../types/table/booking.types").BookingListItem) => (action: import("../../../..").ActionDropdownType) => void;
|
|
15
15
|
keywords?: string;
|
|
16
16
|
}) => import("../TableCell").ColumnType<import("../../../../types/table/booking.types").BookingListItem>[];
|
|
17
17
|
bookingCancelService: (params?: {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import React from
|
|
2
|
-
import
|
|
3
|
-
import { LocationData, LocationGroup, LocationOption } from
|
|
4
|
-
import { PaxData } from
|
|
5
|
-
export type TransferType =
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import '../../../styles/components/organism/transfer-line.css';
|
|
3
|
+
import { LocationData, LocationGroup, LocationOption } from '../../molecules/LocationDropdown/LocationDropdown';
|
|
4
|
+
import { PaxData } from '../PaxSelector/PaxSelector';
|
|
5
|
+
export type TransferType = 'arrival' | 'departure' | 'inter-hotel';
|
|
6
6
|
export type { LocationData };
|
|
7
7
|
export interface TransferLineData {
|
|
8
8
|
id: string;
|
|
@@ -50,6 +50,10 @@ export interface TransferLineProps {
|
|
|
50
50
|
className?: string;
|
|
51
51
|
/** Whether to check if inputs are empty */
|
|
52
52
|
checkEmpty?: boolean;
|
|
53
|
+
/** Whether the transfer line is disabled (placeholder state) */
|
|
54
|
+
disabled?: boolean;
|
|
55
|
+
/** Whether to scroll to the input when the calendar opens */
|
|
56
|
+
scrollOnOpen?: boolean;
|
|
53
57
|
}
|
|
54
58
|
declare const TransferLine: React.FC<TransferLineProps>;
|
|
55
59
|
export default TransferLine;
|
|
@@ -19,19 +19,19 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
|
19
19
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
20
|
};
|
|
21
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
-
import React, { useState } from
|
|
23
|
-
import
|
|
24
|
-
import Icon from
|
|
25
|
-
import { Text } from
|
|
26
|
-
import LocationDropdown from
|
|
27
|
-
import DateTimePicker from
|
|
28
|
-
import PaxSelector from
|
|
22
|
+
import React, { useState } from 'react';
|
|
23
|
+
import '../../../styles/components/organism/transfer-line.css';
|
|
24
|
+
import Icon from '../../atoms/Icon/Icon';
|
|
25
|
+
import { Text } from '../../atoms/Typography/Typography';
|
|
26
|
+
import LocationDropdown from '../../molecules/LocationDropdown/LocationDropdown';
|
|
27
|
+
import DateTimePicker from '../DateTimePicker/DateTimePicker';
|
|
28
|
+
import PaxSelector from '../PaxSelector/PaxSelector';
|
|
29
29
|
var TransferLine = function (_a) {
|
|
30
|
-
var id = _a.id, type = _a.type, paxData = _a.paxData, transferDate = _a.transferDate, pickupPoint = _a.pickupPoint, dropoffPoint = _a.dropoffPoint, _b = _a.locations, locations = _b === void 0 ? { options: [], groups: [] } : _b, onPaxChange = _a.onPaxChange, onDateChange = _a.onDateChange, onPickupChange = _a.onPickupChange, onDropoffChange = _a.onDropoffChange, onDataChange = _a.onDataChange, onDelete = _a.onDelete, _c = _a.showDelete, showDelete = _c === void 0 ? true : _c, _d = _a.showTitle, showTitle = _d === void 0 ? false : _d, _e = _a.className, className = _e === void 0 ?
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
var
|
|
34
|
-
var
|
|
30
|
+
var id = _a.id, type = _a.type, paxData = _a.paxData, transferDate = _a.transferDate, pickupPoint = _a.pickupPoint, dropoffPoint = _a.dropoffPoint, _b = _a.locations, locations = _b === void 0 ? { options: [], groups: [] } : _b, onPaxChange = _a.onPaxChange, onDateChange = _a.onDateChange, onPickupChange = _a.onPickupChange, onDropoffChange = _a.onDropoffChange, onDataChange = _a.onDataChange, onDelete = _a.onDelete, _c = _a.showDelete, showDelete = _c === void 0 ? true : _c, _d = _a.showTitle, showTitle = _d === void 0 ? false : _d, _e = _a.className, className = _e === void 0 ? '' : _e, _f = _a.checkEmpty, checkEmpty = _f === void 0 ? false : _f, _g = _a.disabled, disabled = _g === void 0 ? false : _g, _h = _a.scrollOnOpen, scrollOnOpen = _h === void 0 ? false : _h;
|
|
31
|
+
var _j = useState(paxData), internalPaxData = _j[0], setInternalPaxData = _j[1];
|
|
32
|
+
var _k = useState(transferDate), internalTransferDate = _k[0], setInternalTransferDate = _k[1];
|
|
33
|
+
var _l = useState(null), internalPickupPoint = _l[0], setInternalPickupPoint = _l[1];
|
|
34
|
+
var _m = useState(null), internalDropoffPoint = _m[0], setInternalDropoffPoint = _m[1];
|
|
35
35
|
// Helper function to get all locations (from options and groups)
|
|
36
36
|
var getAllLocations = function (options, groups) {
|
|
37
37
|
var groupOptions = groups.flatMap(function (group) { return group.options; });
|
|
@@ -62,8 +62,9 @@ var TransferLine = function (_a) {
|
|
|
62
62
|
var _a = filterLocations(position), options = _a.options, groups = _a.groups;
|
|
63
63
|
var allLocations = getAllLocations(options, groups);
|
|
64
64
|
// For arrival pickup or departure dropoff, default to first airport
|
|
65
|
-
if ((type === 'arrival' && position === 'pickup') ||
|
|
66
|
-
|
|
65
|
+
if ((type === 'arrival' && position === 'pickup') ||
|
|
66
|
+
(type === 'departure' && position === 'dropoff')) {
|
|
67
|
+
return (allLocations.find(function (loc) { return loc.type === 'airport'; }) || allLocations[0] || null);
|
|
67
68
|
}
|
|
68
69
|
return null;
|
|
69
70
|
};
|
|
@@ -132,29 +133,36 @@ var TransferLine = function (_a) {
|
|
|
132
133
|
};
|
|
133
134
|
onDataChange === null || onDataChange === void 0 ? void 0 : onDataChange(completeData);
|
|
134
135
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
135
|
-
}, [
|
|
136
|
+
}, [
|
|
137
|
+
id,
|
|
138
|
+
type,
|
|
139
|
+
internalPaxData,
|
|
140
|
+
internalTransferDate,
|
|
141
|
+
internalPickupPoint,
|
|
142
|
+
internalDropoffPoint,
|
|
143
|
+
]);
|
|
136
144
|
var getTypeIcon = function () {
|
|
137
145
|
switch (type) {
|
|
138
|
-
case
|
|
139
|
-
return
|
|
140
|
-
case
|
|
141
|
-
return
|
|
142
|
-
case
|
|
143
|
-
return
|
|
146
|
+
case 'arrival':
|
|
147
|
+
return 'arrival';
|
|
148
|
+
case 'departure':
|
|
149
|
+
return 'departure';
|
|
150
|
+
case 'inter-hotel':
|
|
151
|
+
return 'building';
|
|
144
152
|
default:
|
|
145
|
-
return
|
|
153
|
+
return 'arrival';
|
|
146
154
|
}
|
|
147
155
|
};
|
|
148
156
|
var getTypeLabel = function () {
|
|
149
157
|
switch (type) {
|
|
150
|
-
case
|
|
151
|
-
return
|
|
152
|
-
case
|
|
153
|
-
return
|
|
154
|
-
case
|
|
155
|
-
return
|
|
158
|
+
case 'arrival':
|
|
159
|
+
return 'Arrival';
|
|
160
|
+
case 'departure':
|
|
161
|
+
return 'Departure';
|
|
162
|
+
case 'inter-hotel':
|
|
163
|
+
return 'Inter-Hotel';
|
|
156
164
|
default:
|
|
157
|
-
return
|
|
165
|
+
return 'Transfer';
|
|
158
166
|
}
|
|
159
167
|
};
|
|
160
168
|
var handlePaxChange = function (newPaxData) {
|
|
@@ -175,14 +183,23 @@ var TransferLine = function (_a) {
|
|
|
175
183
|
onDropoffChange === null || onDropoffChange === void 0 ? void 0 : onDropoffChange(location);
|
|
176
184
|
};
|
|
177
185
|
// Check if inputs are empty (when checkEmpty is true)
|
|
178
|
-
var isPaxEmpty = checkEmpty &&
|
|
179
|
-
(internalPaxData
|
|
180
|
-
internalPaxData.
|
|
181
|
-
|
|
182
|
-
|
|
186
|
+
var isPaxEmpty = checkEmpty &&
|
|
187
|
+
(!internalPaxData ||
|
|
188
|
+
(internalPaxData.adults === 0 &&
|
|
189
|
+
internalPaxData.teens === 0 &&
|
|
190
|
+
internalPaxData.children === 0 &&
|
|
191
|
+
(internalPaxData.infants === undefined || internalPaxData.infants === 0)));
|
|
183
192
|
var isDateEmpty = checkEmpty && (!internalTransferDate || internalTransferDate === '');
|
|
184
193
|
var isPickupEmpty = checkEmpty && !internalPickupPoint;
|
|
185
194
|
var isDropoffEmpty = checkEmpty && !internalDropoffPoint;
|
|
186
|
-
return (_jsxs("div", { className: "transfer-line transfer-line--".concat(type, " ").concat(className), "data-transfer-id": id, children: [showTitle && (_jsxs("div", { className: "transfer-line__header", children: [_jsx(Icon, { name: getTypeIcon(), size: "sm", className: "transfer-line__header-icon" }), _jsx(Text, { size: "sm", variant: "medium", className: "transfer-line__header-label", children: getTypeLabel() })] })), _jsxs("div", { className: "transfer-line__content-container", children: [_jsxs("div", { className: "transfer-line__content", children: [_jsx("div", { className: "transfer-line__field transfer-line__field--pax ".concat(isPaxEmpty ? 'transfer-line__field--error' : ''), children: _jsx(PaxSelector, { label: "Number of pax", value: internalPaxData, onChange: handlePaxChange, placeholder: "2 pax", className: isPaxEmpty ? 'pax-selector--error' : '' }) }), _jsxs("div", { className: "transfer-line__field transfer-line__field--date", children: [_jsx(Text, { size: "sm", variant: "regular", className: "transfer-line__field-label", children: "Transfer date" }), _jsx(DateTimePicker, { placeholder: "DD/MM/YYYY", mode: "calendar", iconPosition: "left", numberOfMonths: 1, iconBGFull: false, showChevron: true, onValueChange: handleDateChange, selectionMode: "single", defaultValue: internalTransferDate, inputClassName: "transfer-line__date-picker", state: isDateEmpty ? 'error' : undefined })] }), _jsx("div", { className: "transfer-line__field transfer-line__field--pickup", children: _jsx(LocationDropdown, { label: "Pick-up point", options: filterLocations('pickup').options, groups: filterLocations('pickup').groups, selectedValue: (internalPickupPoint === null || internalPickupPoint === void 0 ? void 0 : internalPickupPoint.id) || null, onSelectionChange: handlePickupChange, placeholder: "Select a pick-up point", direction: "pickup", type: type === 'inter-hotel'
|
|
195
|
+
return (_jsxs("div", { className: "transfer-line transfer-line--".concat(type, " ").concat(disabled ? 'transfer-line--disabled' : '', " ").concat(className), "data-transfer-id": id, children: [showTitle && (_jsxs("div", { className: "transfer-line__header", children: [_jsx(Icon, { name: getTypeIcon(), size: "sm", className: "transfer-line__header-icon" }), _jsx(Text, { size: "sm", variant: "medium", className: "transfer-line__header-label", children: getTypeLabel() })] })), _jsxs("div", { className: "transfer-line__content-container", children: [_jsxs("div", { className: "transfer-line__content", children: [_jsx("div", { className: "transfer-line__field transfer-line__field--pax ".concat(isPaxEmpty ? 'transfer-line__field--error' : ''), children: _jsx(PaxSelector, { label: "Number of pax", value: internalPaxData, onChange: handlePaxChange, placeholder: "2 pax", className: isPaxEmpty ? 'pax-selector--error' : '', disabled: disabled, scrollOnOpen: scrollOnOpen }) }), _jsxs("div", { className: "transfer-line__field transfer-line__field--date", children: [_jsx(Text, { size: "sm", variant: "regular", className: "transfer-line__field-label", children: "Transfer date" }), _jsx(DateTimePicker, { placeholder: "DD/MM/YYYY", mode: "calendar", iconPosition: "left", numberOfMonths: 1, iconBGFull: false, showChevron: true, onValueChange: handleDateChange, selectionMode: "single", defaultValue: internalTransferDate, inputClassName: "transfer-line__date-picker", state: isDateEmpty ? 'error' : undefined, disabled: disabled, scrollOnOpen: scrollOnOpen })] }), _jsx("div", { className: "transfer-line__field transfer-line__field--pickup", children: _jsx(LocationDropdown, { label: "Pick-up point", options: filterLocations('pickup').options, groups: filterLocations('pickup').groups, selectedValue: (internalPickupPoint === null || internalPickupPoint === void 0 ? void 0 : internalPickupPoint.id) || null, onSelectionChange: handlePickupChange, placeholder: "Select a pick-up point", direction: "pickup", type: type === 'inter-hotel'
|
|
196
|
+
? 'accommodation'
|
|
197
|
+
: type === 'arrival'
|
|
198
|
+
? 'airport-port'
|
|
199
|
+
: 'accommodation', showGroupTitles: false, error: isPickupEmpty, disabled: disabled, scrollOnOpen: scrollOnOpen }) }), _jsx("div", { className: "transfer-line__field transfer-line__field--dropoff", children: _jsx(LocationDropdown, { label: "Drop-off point", options: filterLocations('dropoff').options, groups: filterLocations('dropoff').groups, selectedValue: (internalDropoffPoint === null || internalDropoffPoint === void 0 ? void 0 : internalDropoffPoint.id) || null, onSelectionChange: handleDropoffChange, placeholder: "Select a drop-off point", direction: "dropoff", type: type === 'inter-hotel'
|
|
200
|
+
? 'accommodation'
|
|
201
|
+
: type === 'departure'
|
|
202
|
+
? 'airport-port'
|
|
203
|
+
: 'accommodation', showGroupTitles: false, error: isDropoffEmpty, disabled: disabled, scrollOnOpen: scrollOnOpen }) })] }), showDelete && !disabled && (_jsx("div", { className: "transfer-line__delete", children: _jsx("button", { type: "button", className: "transfer-line__delete-btn", onClick: onDelete, "aria-label": "Delete transfer line", children: _jsx(Icon, { name: "delete", size: "sm", className: "transfer-line__delete-icon" }) }) }))] })] }));
|
|
187
204
|
};
|
|
188
205
|
export default TransferLine;
|