mautourco-components 0.2.18 → 0.2.20
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/atoms/Icon/icons/BookingIcon.d.ts +4 -0
- package/dist/components/atoms/Icon/icons/BookingIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/BusIcon.js +1 -1
- package/dist/components/atoms/Icon/icons/CarFront.d.ts +4 -0
- package/dist/components/atoms/Icon/icons/CarFront.js +36 -0
- package/dist/components/atoms/Icon/icons/CatamaranIcon.d.ts +4 -0
- package/dist/components/atoms/Icon/icons/CatamaranIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/ClockIcon.d.ts +4 -0
- package/dist/components/atoms/Icon/icons/ClockIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/CloseCircleIcon.d.ts +4 -0
- package/dist/components/atoms/Icon/icons/CloseCircleIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/Land.d.ts +4 -0
- package/dist/components/atoms/Icon/icons/Land.js +36 -0
- package/dist/components/atoms/Icon/icons/MapIcon.js +1 -1
- package/dist/components/atoms/Icon/icons/PlusCircleIcon.js +1 -1
- package/dist/components/atoms/Icon/icons/SeaIcon.d.ts +4 -0
- package/dist/components/atoms/Icon/icons/SeaIcon.js +36 -0
- package/dist/components/atoms/Icon/icons/registry.d.ts +7 -0
- package/dist/components/atoms/Icon/icons/registry.js +14 -0
- package/dist/components/atoms/Inputs/Input/Input.d.ts +2 -1
- package/dist/components/atoms/Inputs/Input/Input.js +1 -1
- package/dist/components/atoms/Inputs/Textarea/Textarea.d.ts +3 -1
- package/dist/components/atoms/Inputs/Textarea/Textarea.js +7 -5
- package/dist/components/molecules/BookingPax/BookingPax.d.ts +7 -0
- package/dist/components/molecules/BookingPax/BookingPax.js +21 -0
- package/dist/components/molecules/BookingPax/BookingPaxAccom.d.ts +22 -0
- package/dist/components/molecules/BookingPax/BookingPaxAccom.js +61 -0
- package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +2090 -0
- package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.d.ts +31 -0
- package/dist/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.js +96 -0
- package/dist/components/molecules/BookingPax/BookingPaxExcursion.d.ts +14 -0
- package/dist/components/molecules/BookingPax/BookingPaxExcursion.js +31 -0
- package/dist/components/molecules/BookingPax/BookingPaxHeader.d.ts +16 -0
- package/dist/components/molecules/BookingPax/BookingPaxHeader.js +28 -0
- package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.css +2103 -0
- package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.d.ts +11 -0
- package/dist/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.js +19 -0
- package/dist/components/molecules/BookingPax/BookingPaxRemarks.d.ts +5 -0
- package/dist/components/molecules/BookingPax/BookingPaxRemarks.js +37 -0
- package/dist/components/molecules/BookingPax/BookingPaxTransfer.d.ts +18 -0
- package/dist/components/molecules/BookingPax/BookingPaxTransfer.js +40 -0
- package/dist/components/molecules/BookingPax/index.d.ts +5 -0
- package/dist/components/molecules/BookingPax/index.js +1 -0
- package/dist/components/molecules/BookingResume/BookingResume.d.ts +9 -0
- package/dist/components/molecules/BookingResume/BookingResume.js +25 -0
- package/dist/components/molecules/BookingResume/BookingResumeLayout/BookingResumeLayout.css +2107 -0
- package/dist/components/molecules/BookingResume/BookingResumeLayout/BookingResumeLayout.d.ts +11 -0
- package/dist/components/molecules/BookingResume/BookingResumeLayout/BookingResumeLayout.js +19 -0
- package/dist/components/molecules/BookingResume/ResumeAccom/ResumeAccom.css +2094 -0
- package/dist/components/molecules/BookingResume/ResumeAccom/ResumeAccom.d.ts +13 -0
- package/dist/components/molecules/BookingResume/ResumeAccom/ResumeAccom.js +26 -0
- package/dist/components/molecules/BookingResume/ResumeExcursion/ResumeExcursion.css +2082 -0
- package/dist/components/molecules/BookingResume/ResumeExcursion/ResumeExcursion.d.ts +15 -0
- package/dist/components/molecules/BookingResume/ResumeExcursion/ResumeExcursion.js +28 -0
- package/dist/components/molecules/BookingResume/ResumeOtherService.d.ts +6 -0
- package/dist/components/molecules/BookingResume/ResumeOtherService.js +19 -0
- package/dist/components/molecules/BookingResume/ResumeTransfer.d.ts +12 -0
- package/dist/components/molecules/BookingResume/ResumeTransfer.js +23 -0
- package/dist/components/molecules/BookingResume/index.d.ts +6 -0
- package/dist/components/molecules/BookingResume/index.js +1 -0
- package/dist/components/molecules/Calendar/CalendarInput.d.ts +6 -3
- package/dist/components/molecules/Calendar/CalendarInput.js +10 -10
- package/dist/components/molecules/DateDisplay/DateDisplay.d.ts +2 -0
- package/dist/components/molecules/DateDisplay/DateDisplay.js +2 -2
- package/dist/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.css +2142 -0
- package/dist/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.d.ts +11 -0
- package/dist/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.js +19 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationAccom.d.ts +9 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationAccom.js +24 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationExcursion.d.ts +17 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationExcursion.js +20 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.d.ts +11 -0
- package/dist/components/molecules/DialogContentPolicy/DialogCancellationList.js +33 -0
- package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.d.ts +11 -0
- package/dist/components/molecules/DialogContentPolicy/DialogContentPolicy.js +27 -0
- package/dist/components/molecules/DialogContentPolicy/index.d.ts +4 -0
- package/dist/components/molecules/DialogContentPolicy/index.js +1 -0
- package/dist/components/molecules/PaxDisplay/PaxDisplay.css +2104 -0
- package/dist/components/molecules/PaxDisplay/PaxDisplay.d.ts +7 -0
- package/dist/components/molecules/PaxDisplay/PaxDisplay.js +32 -0
- package/dist/components/molecules/ServiceInfo/ServiceInfo.css +3 -7
- package/dist/components/molecules/ServiceInfo/ServiceInfo.d.ts +1 -0
- package/dist/components/molecules/ServiceInfo/ServiceInfo.js +5 -4
- package/dist/components/molecules/ServiceTitle/ServiceTitle.css +3 -0
- package/dist/components/molecules/ServiceTitle/ServiceTitle.d.ts +7 -1
- package/dist/components/molecules/ServiceTitle/ServiceTitle.js +4 -3
- package/dist/components/molecules/StepperTimeline/StepperTimeline.css +2151 -0
- package/dist/components/molecules/StepperTimeline/StepperTimeline.d.ts +23 -0
- package/dist/components/molecules/StepperTimeline/StepperTimeline.js +45 -0
- package/dist/components/organisms/Booking/Booking.css +2080 -0
- package/dist/components/organisms/Booking/Booking.d.ts +13 -0
- package/dist/components/organisms/Booking/Booking.js +37 -0
- package/dist/components/organisms/Booking/BookingDocket/BookingDocket.css +2159 -0
- package/dist/components/organisms/Booking/BookingDocket/BookingDocket.d.ts +13 -0
- package/dist/components/organisms/Booking/BookingDocket/BookingDocket.js +44 -0
- package/dist/components/organisms/Booking/BookingHeader.d.ts +8 -0
- package/dist/components/organisms/Booking/BookingHeader.js +17 -0
- package/dist/components/organisms/Booking/BookingPaxList.d.ts +25 -0
- package/dist/components/organisms/Booking/BookingPaxList.js +117 -0
- package/dist/components/organisms/Booking/BookingStep/BookingStep.css +2103 -0
- package/dist/components/organisms/Booking/BookingStep/BookingStep.d.ts +11 -0
- package/dist/components/organisms/Booking/BookingStep/BookingStep.js +30 -0
- package/dist/components/organisms/Booking/index.d.ts +3 -0
- package/dist/components/organisms/Booking/index.js +1 -0
- package/dist/components/organisms/DateTimePicker/DateTimePicker.d.ts +6 -3
- package/dist/components/organisms/DateTimePicker/DateTimePicker.js +28 -22
- package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.d.ts +10 -0
- package/dist/components/organisms/DialogBookingConfirm/DialogBookingConfirm.js +17 -0
- package/dist/components/organisms/TabCancellationPolicy/HeaderAccom.js +2 -8
- package/dist/components/ui/checkbox.d.ts +4 -0
- package/dist/components/ui/checkbox.js +31 -0
- package/dist/hooks/useBookingPax.d.ts +8 -0
- package/dist/hooks/useBookingPax.js +43 -0
- package/dist/hooks/useStays.d.ts +1 -0
- package/dist/hooks/useStays.js +11 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/types/table/booking.types.d.ts +12 -0
- package/dist/types/table/detail-resume.types.d.ts +3 -1
- package/package.json +4 -1
- package/src/components/atoms/Icon/icons/BookingIcon.tsx +40 -0
- package/src/components/atoms/Icon/icons/BusIcon.tsx +1 -1
- package/src/components/atoms/Icon/icons/CarFront.tsx +44 -0
- package/src/components/atoms/Icon/icons/CatamaranIcon.tsx +51 -0
- package/src/components/atoms/Icon/icons/ClockIcon.tsx +46 -0
- package/src/components/atoms/Icon/icons/CloseCircleIcon.tsx +55 -0
- package/src/components/atoms/Icon/icons/Land.tsx +40 -0
- package/src/components/atoms/Icon/icons/MapIcon.tsx +6 -2
- package/src/components/atoms/Icon/icons/PlusCircleIcon.tsx +1 -1
- package/src/components/atoms/Icon/icons/SeaIcon.tsx +47 -0
- package/src/components/atoms/Icon/icons/registry.tsx +14 -0
- package/src/components/atoms/Inputs/Input/Input.tsx +6 -5
- package/src/components/atoms/Inputs/Textarea/Textarea.tsx +18 -4
- package/src/components/molecules/BookingPax/BookingPax.tsx +12 -0
- package/src/components/molecules/BookingPax/BookingPaxAccom.tsx +120 -0
- package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.css +4 -0
- package/src/components/molecules/BookingPax/BookingPaxClient/BookingPaxClient.tsx +188 -0
- package/src/components/molecules/BookingPax/BookingPaxExcursion.tsx +77 -0
- package/src/components/molecules/BookingPax/BookingPaxHeader.tsx +47 -0
- package/src/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.css +15 -0
- package/src/components/molecules/BookingPax/BookingPaxLayout/BookingPaxLayout.tsx +25 -0
- package/src/components/molecules/BookingPax/BookingPaxRemarks.tsx +46 -0
- package/src/components/molecules/BookingPax/BookingPaxTransfer.tsx +121 -0
- package/src/components/molecules/BookingPax/index.ts +9 -0
- package/src/components/molecules/BookingResume/BookingResume.tsx +16 -0
- package/src/components/molecules/BookingResume/BookingResumeLayout/BookingResumeLayout.css +28 -0
- package/src/components/molecules/BookingResume/BookingResumeLayout/BookingResumeLayout.tsx +37 -0
- package/src/components/molecules/BookingResume/ResumeAccom/ResumeAccom.css +12 -0
- package/src/components/molecules/BookingResume/ResumeAccom/ResumeAccom.tsx +63 -0
- package/src/components/molecules/BookingResume/ResumeExcursion/ResumeExcursion.css +5 -0
- package/src/components/molecules/BookingResume/ResumeExcursion/ResumeExcursion.tsx +75 -0
- package/src/components/molecules/BookingResume/ResumeOtherService.tsx +21 -0
- package/src/components/molecules/BookingResume/ResumeTransfer.tsx +49 -0
- package/src/components/molecules/BookingResume/index.ts +6 -0
- package/src/components/molecules/Calendar/CalendarInput.tsx +26 -24
- package/src/components/molecules/DateDisplay/DateDisplay.tsx +9 -5
- package/src/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.css +37 -0
- package/src/components/molecules/DialogContentPolicy/CancellationLayout/CancellationLayout.tsx +28 -0
- package/src/components/molecules/DialogContentPolicy/DialogCancellationAccom.tsx +65 -0
- package/src/components/molecules/DialogContentPolicy/DialogCancellationExcursion.tsx +59 -0
- package/src/components/molecules/DialogContentPolicy/DialogCancellationList.tsx +49 -0
- package/src/components/molecules/DialogContentPolicy/DialogContentPolicy.tsx +45 -0
- package/src/components/molecules/DialogContentPolicy/index.ts +5 -0
- package/src/components/molecules/PaxDisplay/PaxDisplay.css +19 -0
- package/src/components/molecules/PaxDisplay/PaxDisplay.tsx +59 -0
- package/src/components/molecules/ServiceInfo/ServiceInfo.css +3 -5
- package/src/components/molecules/ServiceInfo/ServiceInfo.tsx +18 -3
- package/src/components/molecules/ServiceTitle/ServiceTitle.css +1 -1
- package/src/components/molecules/ServiceTitle/ServiceTitle.tsx +25 -7
- package/src/components/molecules/StepperTimeline/StepperTimeline.css +59 -0
- package/src/components/molecules/StepperTimeline/StepperTimeline.tsx +105 -0
- package/src/components/organisms/Booking/Booking.css +3 -0
- package/src/components/organisms/Booking/Booking.tsx +25 -0
- package/src/components/organisms/Booking/BookingDocket/BookingDocket.css +67 -0
- package/src/components/organisms/Booking/BookingDocket/BookingDocket.tsx +165 -0
- package/src/components/organisms/Booking/BookingHeader.tsx +24 -0
- package/src/components/organisms/Booking/BookingPaxList.tsx +224 -0
- package/src/components/organisms/Booking/BookingStep/BookingStep.css +12 -0
- package/src/components/organisms/Booking/BookingStep/BookingStep.tsx +51 -0
- package/src/components/organisms/Booking/index.ts +3 -0
- package/src/components/organisms/CarBookingCard/index.ts +1 -0
- package/src/components/organisms/DateTimePicker/DateTimePicker.tsx +69 -49
- package/src/components/organisms/DialogBookingConfirm/DialogBookingConfirm.tsx +25 -0
- package/src/components/organisms/TabCancellationPolicy/HeaderAccom.tsx +2 -8
- package/src/components/ui/checkbox.tsx +32 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { CheckboxProps } from '@radix-ui/react-checkbox';
|
|
3
|
+
import './BookingPaxClient.css';
|
|
4
|
+
export interface BookingPaxClientInfo {
|
|
5
|
+
firstName: string;
|
|
6
|
+
lastName: string;
|
|
7
|
+
age: number;
|
|
8
|
+
clientType: 'Adult' | 'Teen' | 'Child' | 'Infant';
|
|
9
|
+
clientId: string;
|
|
10
|
+
}
|
|
11
|
+
export interface BookingPaxClientOptions {
|
|
12
|
+
clientId: string;
|
|
13
|
+
checked: CheckboxProps['checked'];
|
|
14
|
+
selectedIndex: number;
|
|
15
|
+
selectedPaxIndex?: number;
|
|
16
|
+
paxCount?: number;
|
|
17
|
+
selectedClientsInfoIds?: Record<string | number, string[]>;
|
|
18
|
+
selectedClients?: Record<string | number, BookingPaxClientInfo[]>;
|
|
19
|
+
}
|
|
20
|
+
export interface BookingPaxClientProps {
|
|
21
|
+
clients: BookingPaxClientInfo[];
|
|
22
|
+
id: string;
|
|
23
|
+
selectedClientsInfoIds?: Record<string | number, string[]>;
|
|
24
|
+
selectedIndex: number;
|
|
25
|
+
selectedPaxIndex?: number;
|
|
26
|
+
paxCount?: number;
|
|
27
|
+
isSubmitted?: boolean;
|
|
28
|
+
onPaxChange?: (options: BookingPaxClientOptions) => void;
|
|
29
|
+
onError?: (hasError: boolean) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare const BookingPaxClient: React.FC<BookingPaxClientProps>;
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
13
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
14
|
+
if (ar || !(i in from)) {
|
|
15
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
16
|
+
ar[i] = from[i];
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
20
|
+
};
|
|
21
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
22
|
+
import { Text } from '@/src/components/atoms/Typography/Typography';
|
|
23
|
+
import { Checkbox } from '@/src/components/ui/checkbox';
|
|
24
|
+
import useBookingPax from '@/src/hooks/useBookingPax';
|
|
25
|
+
import { cn } from '@/src/lib/utils';
|
|
26
|
+
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
27
|
+
import './BookingPaxClient.css';
|
|
28
|
+
export var BookingPaxClient = function (props) {
|
|
29
|
+
var clients = props.clients, id = props.id, defaultSelectedClientsInfoIds = props.selectedClientsInfoIds, selectedIndex = props.selectedIndex, _a = props.paxCount, paxCount = _a === void 0 ? 0 : _a, isSubmitted = props.isSubmitted, onPaxChange = props.onPaxChange, onError = props.onError;
|
|
30
|
+
var _b = useState({}), selectedClientsInfoIds = _b[0], setSelectedClientsInfoIds = _b[1];
|
|
31
|
+
var isSelectedClient = useBookingPax(selectedClientsInfoIds).isSelectedClient;
|
|
32
|
+
// Calculate selected count for current index
|
|
33
|
+
var selectedCount = useMemo(function () { var _a, _b; return (_b = (_a = selectedClientsInfoIds[selectedIndex]) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0; }, [selectedClientsInfoIds, selectedIndex]);
|
|
34
|
+
// Calculate error state using useMemo for better performance
|
|
35
|
+
var hasError = useMemo(function () {
|
|
36
|
+
if (!isSubmitted || paxCount === 0) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
// Error if selected count is less than required pax count
|
|
40
|
+
var isInsufficientSelection = selectedCount < paxCount;
|
|
41
|
+
// Check if there are unselected clients
|
|
42
|
+
var hasUnselectedClients = clients.some(function (client) { return !isSelectedClient(selectedIndex, client.clientId); });
|
|
43
|
+
return isInsufficientSelection && hasUnselectedClients;
|
|
44
|
+
}, [isSubmitted, paxCount, selectedCount, clients, selectedIndex, isSelectedClient]);
|
|
45
|
+
var handlePaxChange = useCallback(function (options) {
|
|
46
|
+
setSelectedClientsInfoIds(function (prev) {
|
|
47
|
+
var _a, _b, _c;
|
|
48
|
+
var currentRoomSelection = prev[options.selectedIndex] || [];
|
|
49
|
+
var currentLength = currentRoomSelection.length;
|
|
50
|
+
var newState;
|
|
51
|
+
// If all pax are selected and trying to select another, clear and select only this one
|
|
52
|
+
if (options.checked && options.paxCount === currentLength) {
|
|
53
|
+
newState = __assign(__assign({}, prev), (_a = {}, _a[options.selectedIndex] = [options.clientId], _a));
|
|
54
|
+
}
|
|
55
|
+
else if (options.checked) {
|
|
56
|
+
// Add client if checked (prevent duplicate selection)
|
|
57
|
+
if (currentRoomSelection.includes(options.clientId)) {
|
|
58
|
+
return prev; // No change needed
|
|
59
|
+
}
|
|
60
|
+
newState = __assign(__assign({}, prev), (_b = {}, _b[options.selectedIndex] = __spreadArray(__spreadArray([], currentRoomSelection, true), [options.clientId], false), _b));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
// Remove client if unchecked
|
|
64
|
+
newState = __assign(__assign({}, prev), (_c = {}, _c[options.selectedIndex] = currentRoomSelection.filter(function (id) { return id !== options.clientId; }), _c));
|
|
65
|
+
}
|
|
66
|
+
// Call callback with updated state (not stale closure)
|
|
67
|
+
onPaxChange === null || onPaxChange === void 0 ? void 0 : onPaxChange(__assign(__assign({}, options), { selectedClientsInfoIds: newState }));
|
|
68
|
+
return newState;
|
|
69
|
+
});
|
|
70
|
+
}, [onPaxChange, selectedClientsInfoIds]);
|
|
71
|
+
// Sync external state prop to internal state
|
|
72
|
+
useEffect(function () {
|
|
73
|
+
if (defaultSelectedClientsInfoIds !== undefined) {
|
|
74
|
+
setSelectedClientsInfoIds(defaultSelectedClientsInfoIds);
|
|
75
|
+
}
|
|
76
|
+
}, [defaultSelectedClientsInfoIds]);
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
onError === null || onError === void 0 ? void 0 : onError(hasError);
|
|
79
|
+
}, [hasError, onError]);
|
|
80
|
+
return (_jsxs("div", __assign({ className: "space-y-2" }, { children: [_jsxs(Text, { children: ["Please confirm the pax which applies on this service (", paxCount, " Pax)", ' ', _jsx(Text, __assign({ color: "state-error", as: "span" }, { children: "*" }))] }), _jsx("div", __assign({ className: cn('booking-pax-client', {
|
|
81
|
+
'booking-pax-accom--error': hasError,
|
|
82
|
+
}) }, { children: clients.map(function (client) {
|
|
83
|
+
var isSelected = isSelectedClient(selectedIndex, client.clientId);
|
|
84
|
+
var showError = hasError && !isSelected && clients.length !== paxCount;
|
|
85
|
+
return (_jsx("div", { children: _jsxs("div", __assign({ className: "flex items-center gap-x-2" }, { children: [_jsx(Checkbox, { "data-error": showError, id: "pc-".concat(id, "-").concat(selectedIndex, "-").concat(client.clientId), checked: isSelected || clients.length === paxCount, disabled: clients.length === paxCount, onCheckedChange: function (checked) {
|
|
86
|
+
handlePaxChange({
|
|
87
|
+
clientId: client.clientId,
|
|
88
|
+
checked: checked,
|
|
89
|
+
paxCount: paxCount,
|
|
90
|
+
selectedIndex: selectedIndex,
|
|
91
|
+
});
|
|
92
|
+
} }), _jsx("label", __assign({ htmlFor: "pc-".concat(id, "-").concat(selectedIndex, "-").concat(client.clientId), className: cn('cursor-pointer', {
|
|
93
|
+
'pointer-events-none': clients.length === paxCount,
|
|
94
|
+
}) }, { children: _jsxs(Text, __assign({ size: "sm", leading: "4", as: "span", color: showError ? 'state-error' : undefined }, { children: [client.firstName, " ", client.lastName, " (", client.clientType, client.clientType !== 'Adult' && " - ".concat(client.age, " years old"), ")"] })) }))] })) }, client.clientId));
|
|
95
|
+
}) }))] })));
|
|
96
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { BookingPaxClientInfo, BookingPaxClientProps } from './BookingPaxClient/BookingPaxClient';
|
|
3
|
+
export type ExcursionType = 'sea' | 'land' | 'catamaran';
|
|
4
|
+
export interface BookingPaxExcursionProps extends Pick<BookingPaxClientProps, 'selectedClientsInfoIds' | 'onPaxChange'> {
|
|
5
|
+
clientsInfo: BookingPaxClientInfo[];
|
|
6
|
+
name: string;
|
|
7
|
+
type: ExcursionType;
|
|
8
|
+
isSubmitted?: boolean;
|
|
9
|
+
paxCount: number;
|
|
10
|
+
maxPaxCount?: number;
|
|
11
|
+
onRemarkChange?: (value: string) => void;
|
|
12
|
+
onError?: (hasError: boolean) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare const BookingPaxExcursion: React.FC<BookingPaxExcursionProps>;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import useBookingPax from '@/src/hooks/useBookingPax';
|
|
14
|
+
import { useEffect } from 'react';
|
|
15
|
+
import { BookingPaxClient, } from './BookingPaxClient/BookingPaxClient';
|
|
16
|
+
import { BookingPaxHeader } from './BookingPaxHeader';
|
|
17
|
+
import { BookingPaxLayout } from './BookingPaxLayout/BookingPaxLayout';
|
|
18
|
+
import { BookingPaxRemarks } from './BookingPaxRemarks';
|
|
19
|
+
var mapType = {
|
|
20
|
+
sea: 'Sea excursion',
|
|
21
|
+
land: 'Land excursion',
|
|
22
|
+
catamaran: 'Cruise excursion',
|
|
23
|
+
};
|
|
24
|
+
export var BookingPaxExcursion = function (props) {
|
|
25
|
+
var name = props.name, type = props.type, clientsInfo = props.clientsInfo, paxCount = props.paxCount, selectedClientsInfoIds = props.selectedClientsInfoIds, isSubmitted = props.isSubmitted, onPaxChange = props.onPaxChange, onRemarkChange = props.onRemarkChange, onError = props.onError;
|
|
26
|
+
var _a = useBookingPax(selectedClientsInfoIds), changeOptions = _a.changeOptions, onPaxOptionsChange = _a.onPaxOptionsChange, onSelectedClients = _a.onSelectedClients;
|
|
27
|
+
useEffect(function () {
|
|
28
|
+
onSelectedClients(clientsInfo, onPaxChange);
|
|
29
|
+
}, [changeOptions, onPaxChange]);
|
|
30
|
+
return (_jsxs(BookingPaxLayout, __assign({ title: "Excursion", icon: "map", className: "booking-pax-accom", header: _jsx(BookingPaxHeader, { children: _jsx(BookingPaxHeader.Name, { name: name, icon: type, location: mapType[type] }) }) }, { children: [_jsx(BookingPaxClient, { id: "excursion", clients: clientsInfo, selectedClientsInfoIds: selectedClientsInfoIds, selectedIndex: 0, paxCount: paxCount, onPaxChange: onPaxOptionsChange, isSubmitted: isSubmitted, onError: onError }), _jsx(BookingPaxRemarks, { onChange: onRemarkChange })] })));
|
|
31
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { IconName } from '../../atoms/Icon/Icon';
|
|
3
|
+
export interface BookingPaxWithNameProps {
|
|
4
|
+
name: string;
|
|
5
|
+
icon: IconName;
|
|
6
|
+
location: string;
|
|
7
|
+
}
|
|
8
|
+
export interface BookingPaxWithLocationProps {
|
|
9
|
+
from: string;
|
|
10
|
+
to: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const BookingPaxHeader: {
|
|
13
|
+
(props: React.PropsWithChildren): import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
Name: React.FC<BookingPaxWithNameProps>;
|
|
15
|
+
Location: React.FC<BookingPaxWithLocationProps>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import Icon from '../../atoms/Icon/Icon';
|
|
14
|
+
import { Text } from '../../atoms/Typography/Typography';
|
|
15
|
+
import TextWithIcon from '../TextWithIcon/TextWithIcon';
|
|
16
|
+
var BookingPaxWithName = function (props) {
|
|
17
|
+
var name = props.name, icon = props.icon, location = props.location;
|
|
18
|
+
return (_jsxs("div", __assign({ className: "space-y-1" }, { children: [_jsx(Text, __assign({ variant: "bold", size: "sm", leading: "4" }, { children: name })), _jsx(TextWithIcon, __assign({ icon: icon, textLeading: "4" }, { children: location }))] })));
|
|
19
|
+
};
|
|
20
|
+
var BookingPaxWithLocation = function (props) {
|
|
21
|
+
var from = props.from, to = props.to;
|
|
22
|
+
return (_jsxs("div", __assign({ className: "flex items-center gap-x-1" }, { children: [_jsx(Text, __assign({ size: "sm" }, { children: from })), _jsx(Icon, { name: "arrow-right-outline", size: "sm" }), _jsx(Text, __assign({ size: "sm" }, { children: to }))] })));
|
|
23
|
+
};
|
|
24
|
+
export var BookingPaxHeader = function (props) {
|
|
25
|
+
return _jsx("div", __assign({ className: "booking-pax-header" }, props));
|
|
26
|
+
};
|
|
27
|
+
BookingPaxHeader.Name = BookingPaxWithName;
|
|
28
|
+
BookingPaxHeader.Location = BookingPaxWithLocation;
|