medos-sdk 1.1.11 → 1.1.13
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/client/MedosClient.js +1 -1
- package/dist/components/appointment-booking/AppointmentCalender.js +10 -72
- package/dist/components/appointment-booking/appointment-modal-styles.d.ts +272 -0
- package/dist/components/appointment-booking/appointment-modal-styles.js +419 -0
- package/dist/components/appointment-booking/components/AppointmentConfirmationStep.d.ts +28 -0
- package/dist/components/appointment-booking/components/AppointmentConfirmationStep.js +107 -0
- package/dist/components/appointment-booking/components/AppointmentDateTimeModal.d.ts +18 -0
- package/dist/components/appointment-booking/components/AppointmentDateTimeModal.js +306 -0
- package/dist/components/appointment-booking/components/AppointmentSummaryStep.d.ts +12 -0
- package/dist/components/appointment-booking/components/AppointmentSummaryStep.js +194 -0
- package/dist/components/appointment-booking/components/BookingOptionStep.d.ts +14 -0
- package/dist/components/appointment-booking/components/BookingOptionStep.js +350 -0
- package/dist/components/appointment-booking/components/DoctorSelectModal.d.ts +14 -0
- package/dist/components/appointment-booking/components/DoctorSelectModal.js +213 -0
- package/dist/components/appointment-booking/components/PatientDetailsStep.d.ts +3 -0
- package/dist/components/appointment-booking/components/PatientDetailsStep.js +96 -0
- package/dist/components/appointment-booking/components/PatientSelectionStep.d.ts +12 -0
- package/dist/components/appointment-booking/components/PatientSelectionStep.js +254 -0
- package/dist/components/appointment-booking/components/PhoneVerificationStep.d.ts +3 -0
- package/dist/components/appointment-booking/components/PhoneVerificationStep.js +49 -0
- package/dist/components/appointment-booking/components/SuccessStep.d.ts +5 -0
- package/dist/components/appointment-booking/components/SuccessStep.js +9 -0
- package/dist/components/appointment-booking/components/index.d.ts +9 -0
- package/dist/components/appointment-booking/components/index.js +9 -0
- package/dist/components/appointment-booking/hooks/useAppointmentFlow.js +1 -0
- package/dist/components/appointment-booking/index.d.ts +2 -4
- package/dist/components/appointment-booking/index.js +2 -2
- package/dist/components/appointment-booking/types.d.ts +4 -0
- package/dist/components/constants/constant.d.ts +2 -0
- package/dist/components/constants/constant.js +15 -0
- package/dist/components/constants/index.d.ts +3 -0
- package/dist/components/constants/index.js +24 -0
- package/dist/components/constants/options.d.ts +13 -0
- package/dist/components/constants/options.js +35 -0
- package/dist/components/constants/validation.d.ts +6 -0
- package/dist/components/constants/validation.js +16 -0
- package/dist/components/enquiry-form/EnquiryForm.d.ts +7 -0
- package/dist/components/enquiry-form/EnquiryForm.js +238 -0
- package/dist/components/enquiry-form/components/ContactInformationStep.d.ts +13 -0
- package/dist/components/enquiry-form/components/ContactInformationStep.js +21 -0
- package/dist/components/enquiry-form/components/ContactPreferenceStep.d.ts +9 -0
- package/dist/components/enquiry-form/components/ContactPreferenceStep.js +20 -0
- package/dist/components/enquiry-form/components/InquiryDetailsStep.d.ts +10 -0
- package/dist/components/enquiry-form/components/InquiryDetailsStep.js +20 -0
- package/dist/components/enquiry-form/components/index.d.ts +3 -0
- package/dist/components/enquiry-form/components/index.js +3 -0
- package/dist/components/enquiry-form/index.d.ts +2 -0
- package/dist/components/enquiry-form/index.js +2 -0
- package/dist/components/index.d.ts +7 -0
- package/dist/components/index.js +7 -0
- package/dist/components/shared/icons/Check.d.ts +6 -0
- package/dist/components/shared/icons/Check.js +2 -0
- package/dist/components/shared/icons/ChevronDownIcon.d.ts +4 -0
- package/dist/components/shared/icons/ChevronDownIcon.js +2 -0
- package/dist/components/shared/icons/ChevronLeft.d.ts +3 -0
- package/dist/components/shared/icons/ChevronLeft.js +3 -0
- package/dist/components/shared/icons/ChevronRight.d.ts +3 -0
- package/dist/components/shared/icons/ChevronRight.js +3 -0
- package/dist/components/shared/icons/CloseIcon.d.ts +9 -0
- package/dist/components/shared/icons/CloseIcon.js +5 -0
- package/dist/components/shared/icons/ConfirmationCheck.d.ts +1 -0
- package/dist/components/shared/icons/ConfirmationCheck.js +9 -0
- package/dist/components/shared/icons/ConsultationType.d.ts +1 -0
- package/dist/components/shared/icons/ConsultationType.js +2 -0
- package/dist/components/shared/icons/Date&TimeIcon.d.ts +1 -0
- package/dist/components/shared/icons/Date&TimeIcon.js +2 -0
- package/dist/components/shared/icons/MapIcon.d.ts +1 -0
- package/dist/components/shared/icons/MapIcon.js +2 -0
- package/dist/components/shared/icons/MedosLogo.d.ts +3 -0
- package/dist/components/shared/icons/MedosLogo.js +3 -0
- package/dist/components/shared/icons/PaymentMethodIcon.d.ts +1 -0
- package/dist/components/shared/icons/PaymentMethodIcon.js +2 -0
- package/dist/components/shared/icons/SuccessIcon.d.ts +8 -0
- package/dist/components/shared/icons/SuccessIcon.js +14 -0
- package/dist/components/shared/icons/UserIcon.d.ts +1 -0
- package/dist/components/shared/icons/UserIcon.js +2 -0
- package/dist/components/shared/icons/index.d.ts +13 -0
- package/dist/components/shared/icons/index.js +13 -0
- package/dist/components/shared/index.d.ts +2 -0
- package/dist/components/shared/index.js +2 -0
- package/dist/components/shared/ui/Calendar.d.ts +5 -0
- package/dist/components/shared/ui/Calendar.js +167 -0
- package/dist/components/shared/ui/SelectDropdown.d.ts +41 -0
- package/dist/components/shared/ui/SelectDropdown.js +301 -0
- package/dist/components/shared/ui/index.d.ts +2 -0
- package/dist/components/shared/ui/index.js +2 -0
- package/dist/components/styles/appointment.d.ts +4 -0
- package/dist/components/styles/appointment.js +220 -0
- package/dist/components/styles/enquiry.d.ts +2 -0
- package/dist/components/styles/enquiry.js +3 -0
- package/dist/components/styles/index.d.ts +2 -0
- package/dist/components/styles/index.js +2 -0
- package/dist/components/styles/shared.d.ts +3 -0
- package/dist/components/styles/shared.js +78 -0
- package/dist/components/styles.d.ts +1 -6
- package/dist/components/styles.js +1 -298
- package/dist/components/theme-styles.js +18 -0
- package/dist/components/types/appointment.d.ts +42 -0
- package/dist/components/types/appointment.js +1 -0
- package/dist/components/types/common.d.ts +24 -0
- package/dist/components/types/common.js +1 -0
- package/dist/components/types/enquiry.d.ts +59 -0
- package/dist/components/types/enquiry.js +1 -0
- package/dist/components/types/index.d.ts +4 -0
- package/dist/components/types/index.js +4 -0
- package/dist/components/types.d.ts +1 -54
- package/dist/components/types.js +1 -38
- package/dist/components/utils/date.d.ts +4 -0
- package/dist/components/utils/date.js +65 -0
- package/dist/components/utils/formatting.d.ts +4 -0
- package/dist/components/utils/formatting.js +9 -0
- package/dist/components/utils/index.d.ts +3 -0
- package/dist/components/utils/index.js +3 -0
- package/dist/components/utils/validation.d.ts +4 -0
- package/dist/components/utils/validation.js +37 -0
- package/dist/components/utils.d.ts +1 -8
- package/dist/components/utils.js +1 -74
- package/dist/components/validation.d.ts +1 -4
- package/dist/components/validation.js +1 -48
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +1 -1
- package/dist/services/AppointmentService.js +26 -9
- package/dist/services/AuthService.js +1 -1
- package/dist/vanilla/AppointmentCalendarWidget.d.ts +8 -0
- package/dist/vanilla/AppointmentCalendarWidget.js +598 -20
- package/dist/vanilla/components/appointment-booking/appointment-modal-styles.d.ts +272 -0
- package/dist/vanilla/components/appointment-booking/components/AppointmentConfirmationStep.d.ts +28 -0
- package/dist/vanilla/components/appointment-booking/components/AppointmentDateTimeModal.d.ts +18 -0
- package/dist/vanilla/components/appointment-booking/components/AppointmentSummaryStep.d.ts +12 -0
- package/dist/vanilla/components/appointment-booking/components/BookingOptionStep.d.ts +14 -0
- package/dist/vanilla/components/appointment-booking/components/DoctorSelectModal.d.ts +14 -0
- package/dist/vanilla/components/appointment-booking/components/PatientDetailsStep.d.ts +3 -0
- package/dist/vanilla/components/appointment-booking/components/PatientSelectionStep.d.ts +12 -0
- package/dist/vanilla/components/appointment-booking/components/PhoneVerificationStep.d.ts +3 -0
- package/dist/vanilla/components/appointment-booking/components/SuccessStep.d.ts +5 -0
- package/dist/vanilla/components/appointment-booking/components/index.d.ts +9 -0
- package/dist/vanilla/components/appointment-booking/index.d.ts +2 -4
- package/dist/vanilla/components/appointment-booking/types.d.ts +4 -0
- package/dist/vanilla/components/constants/constant.d.ts +2 -0
- package/dist/vanilla/components/constants/index.d.ts +3 -0
- package/dist/vanilla/components/constants/options.d.ts +13 -0
- package/dist/vanilla/components/constants/validation.d.ts +6 -0
- package/dist/vanilla/components/enquiry-form/EnquiryForm.d.ts +7 -0
- package/dist/vanilla/components/enquiry-form/components/ContactInformationStep.d.ts +13 -0
- package/dist/vanilla/components/enquiry-form/components/ContactPreferenceStep.d.ts +9 -0
- package/dist/vanilla/components/enquiry-form/components/InquiryDetailsStep.d.ts +10 -0
- package/dist/vanilla/components/enquiry-form/components/index.d.ts +3 -0
- package/dist/vanilla/components/enquiry-form/index.d.ts +2 -0
- package/dist/vanilla/components/index.d.ts +7 -3
- package/dist/vanilla/components/shared/icons/Check.d.ts +6 -0
- package/dist/vanilla/components/shared/icons/ChevronDownIcon.d.ts +4 -0
- package/dist/vanilla/components/shared/icons/ChevronLeft.d.ts +3 -0
- package/dist/vanilla/components/shared/icons/ChevronRight.d.ts +3 -0
- package/dist/vanilla/components/shared/icons/CloseIcon.d.ts +9 -0
- package/dist/vanilla/components/shared/icons/ConfirmationCheck.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/ConsultationType.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/Date&TimeIcon.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/MapIcon.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/MedosLogo.d.ts +3 -0
- package/dist/vanilla/components/shared/icons/PaymentMethodIcon.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/SuccessIcon.d.ts +8 -0
- package/dist/vanilla/components/shared/icons/UserIcon.d.ts +1 -0
- package/dist/vanilla/components/shared/icons/index.d.ts +13 -0
- package/dist/vanilla/components/shared/index.d.ts +2 -0
- package/dist/vanilla/components/shared/ui/Calendar.d.ts +5 -0
- package/dist/vanilla/components/shared/ui/SelectDropdown.d.ts +41 -0
- package/dist/vanilla/components/shared/ui/index.d.ts +2 -0
- package/dist/vanilla/components/styles/appointment.d.ts +4 -0
- package/dist/vanilla/components/styles/enquiry.d.ts +2 -0
- package/dist/vanilla/components/styles/index.d.ts +2 -0
- package/dist/vanilla/components/styles/shared.d.ts +3 -0
- package/dist/vanilla/components/styles.d.ts +1 -6
- package/dist/vanilla/components/types/appointment.d.ts +42 -0
- package/dist/vanilla/components/types/common.d.ts +24 -0
- package/dist/vanilla/components/types/enquiry.d.ts +59 -0
- package/dist/vanilla/components/types/index.d.ts +4 -0
- package/dist/vanilla/components/types.d.ts +1 -54
- package/dist/vanilla/components/utils/date.d.ts +4 -0
- package/dist/vanilla/components/utils/formatting.d.ts +4 -0
- package/dist/vanilla/components/utils/index.d.ts +3 -0
- package/dist/vanilla/components/utils/validation.d.ts +4 -0
- package/dist/vanilla/components/utils.d.ts +1 -8
- package/dist/vanilla/components/validation.d.ts +1 -4
- package/dist/vanilla/constants/index.d.ts +1 -1
- package/dist/vanilla/enquiry-widget.js +3277 -56
- package/dist/vanilla/index.d.ts +2 -2
- package/dist/vanilla/react/index.d.ts +3 -3
- package/dist/vanilla/vanilla/AppointmentCalendarWidget.d.ts +8 -0
- package/dist/vanilla/widget.css +214 -0
- package/dist/vanilla/widget.js +4047 -187
- package/package.json +2 -2
|
@@ -0,0 +1,306 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState, useCallback, useMemo } from "react";
|
|
3
|
+
import { CustomCalendarWithDateSelector } from "../../shared/ui/Calendar";
|
|
4
|
+
import { PaymentMethodIcon, DateTimeIcon, ConsultationTypeIcon, ChevronLeft as ChevronLeftIcon, ChevronRight as ChevronRightIcon, } from "../../shared/icons";
|
|
5
|
+
import { useTheme } from "../../../react/hooks/useTheme";
|
|
6
|
+
import { useBreakpoint } from "../../../core/theme/responsive";
|
|
7
|
+
import { MONTHS, WEEKDAYS } from "../../constants";
|
|
8
|
+
import { getMobileStyles, getDesktopStyles } from "../appointment-modal-styles";
|
|
9
|
+
const formatDateCard = (date) => ({
|
|
10
|
+
month: MONTHS[date.getMonth()],
|
|
11
|
+
day: date.getDate(),
|
|
12
|
+
weekday: WEEKDAYS[date.getDay()],
|
|
13
|
+
});
|
|
14
|
+
const getOrdinalSuffix = (day) => {
|
|
15
|
+
if (day > 3 && day < 21)
|
|
16
|
+
return "th";
|
|
17
|
+
switch (day % 10) {
|
|
18
|
+
case 1:
|
|
19
|
+
return "st";
|
|
20
|
+
case 2:
|
|
21
|
+
return "nd";
|
|
22
|
+
case 3:
|
|
23
|
+
return "rd";
|
|
24
|
+
default:
|
|
25
|
+
return "th";
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
const formatDesktopDate = (date) => {
|
|
29
|
+
const day = date.getDate();
|
|
30
|
+
const month = MONTHS[date.getMonth()];
|
|
31
|
+
const year = date.getFullYear();
|
|
32
|
+
return `${day}${getOrdinalSuffix(day)} ${month} ${year}`;
|
|
33
|
+
};
|
|
34
|
+
const getSlotPeriod = (dateStr) => {
|
|
35
|
+
const date = new Date(dateStr);
|
|
36
|
+
const hours = date.getHours();
|
|
37
|
+
if (hours < 12)
|
|
38
|
+
return "Morning";
|
|
39
|
+
if (hours < 17)
|
|
40
|
+
return "Afternoon";
|
|
41
|
+
return "Evening";
|
|
42
|
+
};
|
|
43
|
+
export const AppointmentDateTimeModal = (props) => {
|
|
44
|
+
const theme = useTheme();
|
|
45
|
+
const breakpoint = useBreakpoint(theme);
|
|
46
|
+
const isMobile = breakpoint === "mobile";
|
|
47
|
+
if (isMobile) {
|
|
48
|
+
return _jsx(MobileAppointmentModal, { ...props });
|
|
49
|
+
}
|
|
50
|
+
return _jsx(DesktopAppointmentModal, { ...props });
|
|
51
|
+
};
|
|
52
|
+
const MobileAppointmentModal = ({ onlineFee, offlineFee, slots, selectedDate: initialSelectedDate, selectedSlot: initialSelectedSlot, consultationMode: initialConsultationMode, onCancel, onContinue, onDateChange, initialStep = "consultation", }) => {
|
|
53
|
+
const theme = useTheme();
|
|
54
|
+
const breakpoint = useBreakpoint(theme);
|
|
55
|
+
const [currentStep, setCurrentStep] = useState(initialStep);
|
|
56
|
+
const [mode, setMode] = useState(initialConsultationMode || "OFFLINE");
|
|
57
|
+
const [consultationCharge, setConsultationCharge] = useState("");
|
|
58
|
+
const [paymentMode, setPaymentMode] = useState("CASH");
|
|
59
|
+
const [selectedDate, setSelectedDate] = useState(initialSelectedDate || new Date());
|
|
60
|
+
const [selectedSlot, setSelectedSlot] = useState(initialSelectedSlot || null);
|
|
61
|
+
const [currentDateIndex, setCurrentDateIndex] = useState(0);
|
|
62
|
+
useEffect(() => {
|
|
63
|
+
if (!initialConsultationMode && initialStep === "consultation") {
|
|
64
|
+
setCurrentStep("consultation");
|
|
65
|
+
}
|
|
66
|
+
}, [initialConsultationMode, initialStep]);
|
|
67
|
+
const availableDates = useMemo(() => {
|
|
68
|
+
const dates = [];
|
|
69
|
+
const today = new Date();
|
|
70
|
+
for (let i = 0; i < 30; i++) {
|
|
71
|
+
const date = new Date(today);
|
|
72
|
+
date.setDate(today.getDate() + i);
|
|
73
|
+
dates.push(date);
|
|
74
|
+
}
|
|
75
|
+
return dates;
|
|
76
|
+
}, []);
|
|
77
|
+
const visibleCount = 4;
|
|
78
|
+
const visibleDates = useMemo(() => {
|
|
79
|
+
return availableDates.slice(currentDateIndex, currentDateIndex + visibleCount);
|
|
80
|
+
}, [availableDates, currentDateIndex, visibleCount]);
|
|
81
|
+
const canScrollLeft = currentDateIndex > 0;
|
|
82
|
+
const canScrollRight = currentDateIndex + visibleCount < availableDates.length;
|
|
83
|
+
const scrollLeft = () => {
|
|
84
|
+
if (canScrollLeft)
|
|
85
|
+
setCurrentDateIndex(Math.max(0, currentDateIndex - 1));
|
|
86
|
+
};
|
|
87
|
+
const scrollRight = () => {
|
|
88
|
+
if (canScrollRight) {
|
|
89
|
+
const maxIndex = availableDates.length - visibleCount;
|
|
90
|
+
setCurrentDateIndex(Math.min(maxIndex, currentDateIndex + 1));
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
useEffect(() => {
|
|
94
|
+
const charge = mode === "ONLINE" && onlineFee
|
|
95
|
+
? String(onlineFee)
|
|
96
|
+
: mode === "OFFLINE" && offlineFee
|
|
97
|
+
? String(offlineFee)
|
|
98
|
+
: "";
|
|
99
|
+
setConsultationCharge(charge);
|
|
100
|
+
}, [mode, onlineFee, offlineFee]);
|
|
101
|
+
const handleContinueFromConsultation = () => setCurrentStep("datetime");
|
|
102
|
+
const handleBackFromDateTime = () => setCurrentStep("consultation");
|
|
103
|
+
const handleDateSelect = useCallback((date) => {
|
|
104
|
+
const dateChanged = date.toDateString() !== selectedDate.toDateString();
|
|
105
|
+
setSelectedDate(date);
|
|
106
|
+
if (dateChanged)
|
|
107
|
+
setSelectedSlot(null);
|
|
108
|
+
onDateChange?.(date);
|
|
109
|
+
}, [selectedDate, onDateChange]);
|
|
110
|
+
const handleFinalContinue = useCallback(() => {
|
|
111
|
+
if (!selectedSlot)
|
|
112
|
+
return;
|
|
113
|
+
onContinue(mode, selectedDate, selectedSlot, consultationCharge, paymentMode);
|
|
114
|
+
}, [
|
|
115
|
+
mode,
|
|
116
|
+
selectedDate,
|
|
117
|
+
selectedSlot,
|
|
118
|
+
consultationCharge,
|
|
119
|
+
paymentMode,
|
|
120
|
+
onContinue,
|
|
121
|
+
]);
|
|
122
|
+
const isSlotSelected = useCallback((slot) => selectedSlot?.start === slot.start && selectedSlot?.end === slot.end, [selectedSlot]);
|
|
123
|
+
const slotsByPeriod = useMemo(() => {
|
|
124
|
+
const groups = {
|
|
125
|
+
Morning: [],
|
|
126
|
+
Afternoon: [],
|
|
127
|
+
Evening: [],
|
|
128
|
+
};
|
|
129
|
+
slots.forEach((slot) => {
|
|
130
|
+
const period = getSlotPeriod(slot.start);
|
|
131
|
+
if (groups[period])
|
|
132
|
+
groups[period].push(slot);
|
|
133
|
+
});
|
|
134
|
+
return groups;
|
|
135
|
+
}, [slots]);
|
|
136
|
+
const STYLES = getMobileStyles(theme, breakpoint);
|
|
137
|
+
if (currentStep === "consultation") {
|
|
138
|
+
return (_jsxs("div", { style: STYLES.container, children: [_jsx("div", { style: STYLES.header, children: _jsx("h2", { style: STYLES.title, children: "New Appointment" }) }), _jsxs("div", { style: STYLES.section, children: [_jsxs("h3", { style: STYLES.sectionTitle, children: ["Consultation Mode ", _jsx("span", { style: STYLES.required, children: "*" })] }), _jsx("div", { style: STYLES.modeContainer, children: ["ONLINE", "OFFLINE"].map((item) => {
|
|
139
|
+
const disabled = (item === "ONLINE" && (!onlineFee || onlineFee <= 0)) ||
|
|
140
|
+
(item === "OFFLINE" && (!offlineFee || offlineFee <= 0));
|
|
141
|
+
return (_jsxs("label", { style: STYLES.modeOption, children: [_jsx("input", { type: "radio", name: "mode", value: item, checked: mode === item, disabled: disabled, onChange: () => !disabled && setMode(item), style: STYLES.radioInput }), item === "ONLINE"
|
|
142
|
+
? "Online Consultation"
|
|
143
|
+
: "Offline Consultation"] }, item));
|
|
144
|
+
}) })] }), _jsxs("div", { style: STYLES.section, children: [_jsx("h3", { style: STYLES.sectionTitle, children: "Consultation Charges" }), _jsxs("div", { style: STYLES.chargeAmount, children: ["\u20B9", consultationCharge] })] }), _jsxs("div", { style: STYLES.section, children: [_jsxs("h3", { style: STYLES.sectionTitle, children: ["Preferred Mode of Payment ", _jsx("span", { style: STYLES.required, children: "*" })] }), _jsx("div", { style: STYLES.paymentOption, children: mode === "ONLINE" ? "Online Consultation" : "Offline Consultation" })] }), _jsxs("div", { style: STYLES.footer, children: [_jsx("button", { style: STYLES.backButton, onClick: onCancel, children: "Back" }), _jsx("button", { style: STYLES.nextButton, onClick: handleContinueFromConsultation, disabled: !consultationCharge, children: "Next" })] })] }));
|
|
145
|
+
}
|
|
146
|
+
return (_jsxs("div", { style: STYLES.container, children: [_jsx("div", { style: STYLES.header, children: _jsx("h2", { style: STYLES.title, children: "Date & Time" }) }), _jsxs("div", { style: STYLES.dateSection, children: [_jsxs("div", { style: STYLES.monthNavigationContainer, children: [_jsx("button", { onClick: scrollLeft, style: {
|
|
147
|
+
...STYLES.navButton,
|
|
148
|
+
opacity: canScrollLeft ? 1 : 0.3,
|
|
149
|
+
cursor: canScrollLeft ? "pointer" : "not-allowed",
|
|
150
|
+
}, children: _jsx(ChevronLeftIcon, {}) }), _jsx("div", { style: STYLES.monthYearDisplay, children: selectedDate.toLocaleDateString("en-US", {
|
|
151
|
+
month: "long",
|
|
152
|
+
year: "numeric",
|
|
153
|
+
}) }), _jsx("button", { onClick: scrollRight, style: {
|
|
154
|
+
...STYLES.navButton,
|
|
155
|
+
opacity: canScrollRight ? 1 : 0.3,
|
|
156
|
+
cursor: canScrollRight ? "pointer" : "not-allowed",
|
|
157
|
+
}, children: _jsx(ChevronRightIcon, {}) })] }), _jsx("div", { style: STYLES.dateCardsContainer, children: visibleDates.map((date, index) => {
|
|
158
|
+
const { month, day, weekday } = formatDateCard(date);
|
|
159
|
+
const isSelected = date.toDateString() === selectedDate.toDateString();
|
|
160
|
+
return (_jsxs("div", { style: {
|
|
161
|
+
...STYLES.dateCard,
|
|
162
|
+
...(isSelected ? STYLES.dateCardSelected : {}),
|
|
163
|
+
}, onClick: () => handleDateSelect(date), children: [_jsx("div", { style: STYLES.dateCardWeekday, children: weekday }), _jsx("div", { style: STYLES.dateCardDay, children: day })] }, `${date.getTime()}-${index}`));
|
|
164
|
+
}) })] }), _jsx("div", { style: STYLES.slotsContainer, children: slots.length === 0 ? (_jsx("p", { style: STYLES.noSlots, children: "No available slots" })) : (_jsx("div", { style: { display: 'flex', flexDirection: 'column', gap: '20px' }, children: ["Morning", "Afternoon", "Evening"].map((period) => {
|
|
165
|
+
const periodSlots = slotsByPeriod[period];
|
|
166
|
+
if (periodSlots.length === 0)
|
|
167
|
+
return null;
|
|
168
|
+
return (_jsxs("div", { children: [_jsx("h4", { style: {
|
|
169
|
+
fontSize: "13px",
|
|
170
|
+
fontWeight: 700,
|
|
171
|
+
color: theme.colors.textSecondary,
|
|
172
|
+
marginBottom: "12px",
|
|
173
|
+
marginTop: 0,
|
|
174
|
+
textTransform: 'uppercase',
|
|
175
|
+
letterSpacing: '0.5px'
|
|
176
|
+
}, children: period }), _jsx("div", { style: STYLES.slotGrid, children: periodSlots.map((slot) => {
|
|
177
|
+
const startTime = new Date(slot.start).toLocaleTimeString([], {
|
|
178
|
+
hour: "2-digit",
|
|
179
|
+
minute: "2-digit",
|
|
180
|
+
});
|
|
181
|
+
const selected = isSlotSelected(slot);
|
|
182
|
+
return (_jsx("button", { onClick: () => setSelectedSlot(slot), style: {
|
|
183
|
+
...STYLES.slotButton,
|
|
184
|
+
...(selected ? STYLES.slotButtonSelected : {}),
|
|
185
|
+
}, children: startTime }, slot.id));
|
|
186
|
+
}) })] }, period));
|
|
187
|
+
}) })) }), _jsxs("div", { style: STYLES.footer, children: [_jsx("button", { style: STYLES.backButton, onClick: handleBackFromDateTime, children: "Back" }), _jsx("button", { style: STYLES.nextButton, onClick: handleFinalContinue, disabled: !selectedSlot, children: "Next" })] })] }));
|
|
188
|
+
};
|
|
189
|
+
const DesktopAppointmentModal = ({ onlineFee, offlineFee, slots, selectedDate: initialSelectedDate, selectedSlot: initialSelectedSlot, consultationMode: initialConsultationMode, onCancel, onContinue, onDateChange, }) => {
|
|
190
|
+
const theme = useTheme();
|
|
191
|
+
const breakpoint = useBreakpoint(theme);
|
|
192
|
+
const [mode, setMode] = useState(initialConsultationMode || "OFFLINE");
|
|
193
|
+
const [consultationCharge, setConsultationCharge] = useState("");
|
|
194
|
+
const [paymentMode, setPaymentMode] = useState("CASH");
|
|
195
|
+
const [selectedDate, setSelectedDate] = useState(initialSelectedDate || new Date());
|
|
196
|
+
const [selectedSlot, setSelectedSlot] = useState(initialSelectedSlot || null);
|
|
197
|
+
useEffect(() => {
|
|
198
|
+
if (initialSelectedDate)
|
|
199
|
+
setSelectedDate(initialSelectedDate);
|
|
200
|
+
}, [initialSelectedDate]);
|
|
201
|
+
useEffect(() => {
|
|
202
|
+
if (initialSelectedSlot)
|
|
203
|
+
setSelectedSlot(initialSelectedSlot);
|
|
204
|
+
}, [initialSelectedSlot]);
|
|
205
|
+
useEffect(() => {
|
|
206
|
+
if (initialConsultationMode)
|
|
207
|
+
setMode(initialConsultationMode);
|
|
208
|
+
}, [initialConsultationMode]);
|
|
209
|
+
const handleDateSelect = useCallback((date) => {
|
|
210
|
+
const dateChanged = date.toDateString() !== selectedDate.toDateString();
|
|
211
|
+
setSelectedDate(date);
|
|
212
|
+
if (dateChanged)
|
|
213
|
+
setSelectedSlot(null);
|
|
214
|
+
onDateChange?.(date);
|
|
215
|
+
}, [selectedDate, onDateChange]);
|
|
216
|
+
useEffect(() => {
|
|
217
|
+
const charge = mode === "ONLINE" && onlineFee
|
|
218
|
+
? String(onlineFee)
|
|
219
|
+
: mode === "OFFLINE" && offlineFee
|
|
220
|
+
? String(offlineFee)
|
|
221
|
+
: "";
|
|
222
|
+
setConsultationCharge(charge);
|
|
223
|
+
}, [mode, onlineFee, offlineFee]);
|
|
224
|
+
const handleContinue = useCallback(() => {
|
|
225
|
+
if (!selectedSlot)
|
|
226
|
+
return;
|
|
227
|
+
onContinue(mode, selectedDate, selectedSlot, consultationCharge, paymentMode);
|
|
228
|
+
}, [
|
|
229
|
+
mode,
|
|
230
|
+
selectedDate,
|
|
231
|
+
selectedSlot,
|
|
232
|
+
consultationCharge,
|
|
233
|
+
paymentMode,
|
|
234
|
+
onContinue,
|
|
235
|
+
]);
|
|
236
|
+
const isSlotSelected = useCallback((slot) => selectedSlot?.start === slot.start && selectedSlot?.end === slot.end, [selectedSlot]);
|
|
237
|
+
const formattedDate = useMemo(() => formatDesktopDate(selectedDate), [selectedDate]);
|
|
238
|
+
const isFormValid = selectedDate && selectedSlot && consultationCharge;
|
|
239
|
+
const STYLES = getDesktopStyles(theme, breakpoint);
|
|
240
|
+
const slotsByPeriod = useMemo(() => {
|
|
241
|
+
const groups = {
|
|
242
|
+
Morning: [],
|
|
243
|
+
Afternoon: [],
|
|
244
|
+
Evening: [],
|
|
245
|
+
};
|
|
246
|
+
slots.forEach((slot) => {
|
|
247
|
+
const period = getSlotPeriod(slot.start);
|
|
248
|
+
if (groups[period])
|
|
249
|
+
groups[period].push(slot);
|
|
250
|
+
});
|
|
251
|
+
return groups;
|
|
252
|
+
}, [slots]);
|
|
253
|
+
return (_jsxs("div", { style: STYLES.modalWrapper, children: [_jsxs("div", { style: STYLES.sectionCard, children: [_jsxs("div", { style: STYLES.sectionHeader, children: [_jsx(ConsultationTypeIcon, {}), _jsx("span", { style: STYLES.sectionTitle, children: "Consultation Type" })] }), _jsxs("div", { style: STYLES.sectionBody, children: [_jsx("p", { style: STYLES.label, children: "Consultation Mode" }), _jsx("div", { style: STYLES.modeContainer, children: ["ONLINE", "OFFLINE"].map((item) => {
|
|
254
|
+
const disabled = (item === "ONLINE" && (!onlineFee || onlineFee <= 0)) ||
|
|
255
|
+
(item === "OFFLINE" && (!offlineFee || offlineFee <= 0));
|
|
256
|
+
return (_jsxs("label", { style: { ...STYLES.radioLabel, opacity: disabled ? 0.5 : 1 }, children: [_jsx("input", { type: "radio", name: "mode", value: item, checked: mode === item, disabled: disabled, onChange: () => !disabled && setMode(item), style: STYLES.radioInput }), item === "ONLINE" ? "Online" : "Offline"] }, item));
|
|
257
|
+
}) })] })] }), _jsxs("div", { style: STYLES.sectionCard, children: [_jsxs("div", { style: STYLES.sectionHeader, children: [_jsx(PaymentMethodIcon, {}), _jsx("span", { style: STYLES.sectionTitle, children: "Charges & Mode of Payment" })] }), _jsx("div", { style: STYLES.sectionBody, children: _jsxs("span", { style: STYLES.rupee, children: ["\u20B9 ", consultationCharge] }) })] }), _jsxs("div", { style: STYLES.sectionCard, children: [_jsxs("div", { style: STYLES.sectionHeader, children: [_jsx(DateTimeIcon, {}), _jsx("span", { style: STYLES.sectionTitle, children: "Date & Time" })] }), _jsx("div", { style: STYLES.sectionBody, children: _jsxs("div", { style: STYLES.dateTimeContainer, children: [_jsx("div", { style: STYLES.calendarBox, children: _jsx(CustomCalendarWithDateSelector, { selectedDate: selectedDate, onSelect: handleDateSelect, pastDisabled: true }) }), _jsxs("div", { style: STYLES.timesContainer, children: [_jsxs("p", { style: STYLES.timesLabel, children: ["Available times ", _jsx("br", {}), _jsx("span", { style: STYLES.dateLabel, children: formattedDate })] }), slots.length === 0 ? (_jsx("p", { style: STYLES.noSlots, children: "No available slots" })) : (_jsx("div", { style: { ...STYLES.slotGrid, display: 'flex', flexDirection: 'column', gap: '24px', overflowY: 'auto', maxHeight: '350px', paddingRight: '12px' }, children: ["Morning", "Afternoon", "Evening"].map((period) => {
|
|
258
|
+
const periodSlots = slotsByPeriod[period];
|
|
259
|
+
if (periodSlots.length === 0)
|
|
260
|
+
return null;
|
|
261
|
+
return (_jsxs("div", { children: [_jsxs("div", { style: {
|
|
262
|
+
display: 'flex',
|
|
263
|
+
alignItems: 'center',
|
|
264
|
+
gap: '8px',
|
|
265
|
+
marginBottom: '12px',
|
|
266
|
+
paddingBottom: '4px',
|
|
267
|
+
borderBottom: `1px dashed ${theme.colors.border}`
|
|
268
|
+
}, children: [_jsx("span", { style: {
|
|
269
|
+
fontSize: '12px',
|
|
270
|
+
fontWeight: 700,
|
|
271
|
+
color: theme.colors.primary,
|
|
272
|
+
textTransform: 'uppercase',
|
|
273
|
+
letterSpacing: '0.5px'
|
|
274
|
+
}, children: period }), _jsxs("span", { style: { fontSize: '12px', color: theme.colors.textSecondary }, children: [periodSlots.length, " slots"] })] }), _jsx("div", { style: {
|
|
275
|
+
display: 'grid',
|
|
276
|
+
gridTemplateColumns: 'repeat(auto-fill, minmax(90px, 1fr))',
|
|
277
|
+
gap: '10px'
|
|
278
|
+
}, children: periodSlots.map((slot) => {
|
|
279
|
+
const selected = isSlotSelected(slot);
|
|
280
|
+
return (_jsx("button", { onClick: () => setSelectedSlot(slot), style: {
|
|
281
|
+
...STYLES.slotButton,
|
|
282
|
+
background: selected
|
|
283
|
+
? theme.colors.primary
|
|
284
|
+
: theme.colors.surface,
|
|
285
|
+
color: selected
|
|
286
|
+
? theme.colors.textOnPrimary
|
|
287
|
+
: theme.colors.text,
|
|
288
|
+
borderColor: selected
|
|
289
|
+
? theme.colors.primary
|
|
290
|
+
: theme.colors.border,
|
|
291
|
+
boxShadow: selected
|
|
292
|
+
? `0 4px 12px ${theme.colors.primary}40`
|
|
293
|
+
: "0 1px 2px rgba(0,0,0,0.05)",
|
|
294
|
+
transform: selected
|
|
295
|
+
? "translateY(-1px)"
|
|
296
|
+
: "none",
|
|
297
|
+
minHeight: '38px',
|
|
298
|
+
fontSize: '13px',
|
|
299
|
+
padding: '8px 4px',
|
|
300
|
+
}, children: new Date(slot.start).toLocaleTimeString([], {
|
|
301
|
+
hour: "2-digit",
|
|
302
|
+
minute: "2-digit",
|
|
303
|
+
}) }, slot.id));
|
|
304
|
+
}) })] }, period));
|
|
305
|
+
}) }))] })] }) })] }), _jsxs("div", { style: STYLES.footer, children: [_jsx("button", { style: STYLES.backBtn, onClick: onCancel, children: "Back" }), _jsx("button", { style: { ...STYLES.continueBtn, opacity: isFormValid ? 1 : 0.6 }, onClick: handleContinue, disabled: !isFormValid, children: "Continue" })] })] }));
|
|
306
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { AppointmentState } from "../types";
|
|
3
|
+
import { Doctor, AddressItem } from "../../../services/AppointmentService";
|
|
4
|
+
export interface AppointmentSummaryStepProps {
|
|
5
|
+
state: AppointmentState;
|
|
6
|
+
selectedDoctor: Doctor | null;
|
|
7
|
+
selectedAddress: AddressItem | null;
|
|
8
|
+
onBack: () => void;
|
|
9
|
+
onConfirm: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare const AppointmentSummaryStep: React.FC<AppointmentSummaryStepProps>;
|
|
12
|
+
export default AppointmentSummaryStep;
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useTheme } from "../../../react/hooks/useTheme";
|
|
3
|
+
import { useBreakpoint } from "../../../core/theme/responsive";
|
|
4
|
+
import { formatDate, formatTime, calculateDuration } from "../../utils/date";
|
|
5
|
+
export const AppointmentSummaryStep = ({ state, selectedDoctor, selectedAddress, onBack, onConfirm, }) => {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
const breakpoint = useBreakpoint(theme);
|
|
8
|
+
const styles = getStyles(theme, breakpoint);
|
|
9
|
+
const usingSessionPack = state.bookingOptionType === "session-pack" && state.selectedSessionPack;
|
|
10
|
+
const usingNewPackage = state.bookingOptionType === "explore-packages" && state.selectedNewPackage;
|
|
11
|
+
const getDuration = () => {
|
|
12
|
+
if (state.selectedSlot) {
|
|
13
|
+
return calculateDuration(state.selectedSlot.start, state.selectedSlot.end);
|
|
14
|
+
}
|
|
15
|
+
return 60;
|
|
16
|
+
};
|
|
17
|
+
const isPackageBooking = state.bookingType === "PACKAGE_PURCHASE" ||
|
|
18
|
+
state.bookingType === "USE_ACTIVE_PACKAGE";
|
|
19
|
+
const getPaymentInfo = () => {
|
|
20
|
+
if (usingSessionPack) {
|
|
21
|
+
return {
|
|
22
|
+
type: "Session Pack",
|
|
23
|
+
name: state.selectedSessionPack?.name || "Session Pack",
|
|
24
|
+
amount: "Prepaid",
|
|
25
|
+
remaining: `${(state.selectedSessionPack?.remainingSessions || 1) - 1} sessions remaining after this appointment`,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
else if (usingNewPackage) {
|
|
29
|
+
return {
|
|
30
|
+
type: "New Package",
|
|
31
|
+
name: state.selectedNewPackage?.name || "Package",
|
|
32
|
+
amount: `₹${state.selectedNewPackage?.price?.toLocaleString() || 0}`,
|
|
33
|
+
remaining: `${state.selectedNewPackage?.totalSessions ||
|
|
34
|
+
state.selectedNewPackage?.sessions ||
|
|
35
|
+
1} sessions included`,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
return {
|
|
40
|
+
type: "Single Appointment",
|
|
41
|
+
name: state.consultationMode === "ONLINE"
|
|
42
|
+
? "Online Consultation"
|
|
43
|
+
: "In-Person Visit",
|
|
44
|
+
amount: state.consultationCharge
|
|
45
|
+
? `₹${state.consultationCharge}`
|
|
46
|
+
: "Pay at clinic",
|
|
47
|
+
remaining: null,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
const paymentInfo = getPaymentInfo();
|
|
52
|
+
const patient = state.selectedPatient;
|
|
53
|
+
return (_jsxs("div", { style: styles.container, children: [_jsx("h3", { style: styles.title, children: "Appointment Summary" }), _jsx("p", { style: styles.subtitle, children: "Please review your appointment details before confirming" }), _jsxs("div", { style: styles.section, children: [_jsx("h4", { style: styles.sectionTitle, children: "\uD83D\uDC64 Patient Information" }), _jsxs("div", { style: styles.summaryCard, children: [_jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Name" }), _jsx("span", { style: styles.value, children: patient
|
|
54
|
+
? `${patient.firstName} ${patient.lastName}`
|
|
55
|
+
: state.patientName || "New Patient" })] }), (patient?.email || state.patientEmail) && (_jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Email" }), _jsx("span", { style: styles.value, children: patient?.email || state.patientEmail })] })), _jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Phone" }), _jsxs("span", { style: styles.value, children: [state.countryCode, " ", state.patientPhone] })] }), (patient?.age || state.patientAge) && (_jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Age" }), _jsxs("span", { style: styles.value, children: [patient?.age || state.patientAge, " years"] })] })), (patient?.bloodGroup || state.bloodGroup) && (_jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Blood Group" }), _jsx("span", { style: styles.value, children: patient?.bloodGroup || state.bloodGroup })] }))] })] }), _jsxs("div", { style: styles.section, children: [_jsx("h4", { style: styles.sectionTitle, children: "\uD83D\uDCC5 Appointment Details" }), _jsxs("div", { style: styles.summaryCard, children: [_jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Date" }), _jsx("span", { style: styles.value, children: formatDate(state.selectedDate) })] }), _jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Time" }), _jsx("span", { style: styles.value, children: state.selectedSlot
|
|
56
|
+
? `${formatTime(state.selectedSlot.start)} - ${formatTime(state.selectedSlot.end)}`
|
|
57
|
+
: "Not selected" })] }), _jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Duration" }), _jsxs("span", { style: styles.value, children: ["~", getDuration(), " minutes"] })] }), _jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Type" }), _jsx("span", { style: styles.value, children: state.consultationMode === "ONLINE"
|
|
58
|
+
? "Online Consultation"
|
|
59
|
+
: "In-Person Visit" })] })] })] }), _jsxs("div", { style: styles.section, children: [_jsx("h4", { style: styles.sectionTitle, children: "\uD83C\uDFE5 Doctor & Location" }), _jsxs("div", { style: styles.summaryCard, children: [selectedDoctor && (_jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Doctor" }), _jsxs("span", { style: styles.value, children: [selectedDoctor.name, selectedDoctor.specialty && ` • ${selectedDoctor.specialty}`] })] })), selectedAddress && (_jsxs(_Fragment, { children: [_jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Location" }), _jsx("span", { style: styles.value, children: selectedAddress.completeAddress || "Unknown Location" })] }), selectedAddress.address && (_jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Address" }), _jsx("span", { style: styles.value, children: selectedAddress.address })] }))] }))] })] }), _jsxs("div", { style: styles.section, children: [_jsx("h4", { style: styles.sectionTitle, children: "\uD83D\uDCB3 Payment" }), _jsxs("div", { style: styles.summaryCard, children: [_jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: "Booking Type" }), _jsx("span", { style: styles.value, children: paymentInfo.type })] }), _jsxs("div", { style: styles.summaryRow, children: [_jsx("span", { style: styles.label, children: usingSessionPack ? "Pack" : "Service" }), _jsx("span", { style: styles.value, children: paymentInfo.name })] }), isPackageBooking && state.selectedNewPackage ? (_jsxs("div", { style: { ...styles.summaryRow, ...styles.totalRow }, children: [_jsx("span", { style: styles.totalLabel, children: "Amount" }), _jsx("div", { style: styles.priceContainer, children: state.selectedNewPackage.discountedPrice &&
|
|
60
|
+
state.selectedNewPackage.discountedPrice <
|
|
61
|
+
state.selectedNewPackage.price ? (_jsxs(_Fragment, { children: [_jsxs("span", { style: styles.strikethroughPrice, children: ["\u20B9", state.selectedNewPackage.price.toLocaleString()] }), _jsxs("span", { style: styles.totalValue, children: ["\u20B9", state.selectedNewPackage.discountedPrice.toLocaleString()] }), state.selectedNewPackage.discount && (_jsx("span", { style: styles.discountBadge, children: state.selectedNewPackage.discountType === "PERCENTAGE"
|
|
62
|
+
? `${state.selectedNewPackage.discount}% OFF`
|
|
63
|
+
: `₹${state.selectedNewPackage.discount} OFF` }))] })) : (_jsxs("span", { style: styles.totalValue, children: ["\u20B9", state.selectedNewPackage.price.toLocaleString()] })) })] })) : (!usingSessionPack && (_jsxs("div", { style: { ...styles.summaryRow, ...styles.totalRow }, children: [_jsx("span", { style: styles.totalLabel, children: "Amount" }), _jsx("span", { style: styles.totalValue, children: paymentInfo.amount })] }))), usingSessionPack && (_jsxs("div", { style: { ...styles.summaryRow, ...styles.totalRow }, children: [_jsx("span", { style: styles.totalLabel, children: "Amount" }), _jsx("span", { style: styles.totalValue, children: paymentInfo.amount })] })), paymentInfo.remaining && (_jsx("div", { style: styles.remainingInfo, children: paymentInfo.remaining }))] })] }), _jsxs("div", { style: styles.actions, children: [_jsx("button", { style: styles.backBtn, onClick: onBack, children: "Back" }), _jsx("button", { style: styles.confirmBtn, onClick: onConfirm, disabled: state.loading, children: state.loading ? "Confirming..." : "Confirm Appointment" })] })] }));
|
|
64
|
+
};
|
|
65
|
+
const getStyles = (theme, breakpoint) => {
|
|
66
|
+
const isMobile = breakpoint === "mobile";
|
|
67
|
+
return {
|
|
68
|
+
container: {
|
|
69
|
+
display: "flex",
|
|
70
|
+
flexDirection: "column",
|
|
71
|
+
gap: 20,
|
|
72
|
+
},
|
|
73
|
+
title: {
|
|
74
|
+
margin: 0,
|
|
75
|
+
fontSize: isMobile ? 18 : 20,
|
|
76
|
+
fontWeight: 600,
|
|
77
|
+
color: theme.colors.text,
|
|
78
|
+
},
|
|
79
|
+
subtitle: {
|
|
80
|
+
margin: 0,
|
|
81
|
+
fontSize: 14,
|
|
82
|
+
color: theme.colors.textSecondary,
|
|
83
|
+
},
|
|
84
|
+
section: {
|
|
85
|
+
display: "flex",
|
|
86
|
+
flexDirection: "column",
|
|
87
|
+
gap: 12,
|
|
88
|
+
},
|
|
89
|
+
sectionTitle: {
|
|
90
|
+
margin: 0,
|
|
91
|
+
fontSize: 16,
|
|
92
|
+
fontWeight: 600,
|
|
93
|
+
color: theme.colors.text,
|
|
94
|
+
display: "flex",
|
|
95
|
+
alignItems: "center",
|
|
96
|
+
gap: 8,
|
|
97
|
+
},
|
|
98
|
+
summaryCard: {
|
|
99
|
+
display: "flex",
|
|
100
|
+
flexDirection: "column",
|
|
101
|
+
gap: 12,
|
|
102
|
+
padding: 16,
|
|
103
|
+
backgroundColor: theme.colors.backgroundSecondary || "#f9fafb",
|
|
104
|
+
borderRadius: theme.radii.md,
|
|
105
|
+
border: `1px solid ${theme.colors.border}`,
|
|
106
|
+
},
|
|
107
|
+
summaryRow: {
|
|
108
|
+
display: "flex",
|
|
109
|
+
justifyContent: "space-between",
|
|
110
|
+
alignItems: "center",
|
|
111
|
+
},
|
|
112
|
+
label: {
|
|
113
|
+
fontSize: 14,
|
|
114
|
+
color: theme.colors.textSecondary,
|
|
115
|
+
},
|
|
116
|
+
value: {
|
|
117
|
+
fontSize: 14,
|
|
118
|
+
fontWeight: 500,
|
|
119
|
+
color: theme.colors.text,
|
|
120
|
+
textAlign: "right",
|
|
121
|
+
},
|
|
122
|
+
totalRow: {
|
|
123
|
+
paddingTop: 12,
|
|
124
|
+
borderTop: `1px solid ${theme.colors.border}`,
|
|
125
|
+
marginTop: 4,
|
|
126
|
+
},
|
|
127
|
+
totalLabel: {
|
|
128
|
+
fontSize: 16,
|
|
129
|
+
fontWeight: 600,
|
|
130
|
+
color: theme.colors.text,
|
|
131
|
+
},
|
|
132
|
+
totalValue: {
|
|
133
|
+
fontSize: 18,
|
|
134
|
+
fontWeight: 600,
|
|
135
|
+
color: theme.colors.primary,
|
|
136
|
+
},
|
|
137
|
+
priceContainer: {
|
|
138
|
+
display: "flex",
|
|
139
|
+
alignItems: "center",
|
|
140
|
+
gap: 8,
|
|
141
|
+
flexWrap: "wrap",
|
|
142
|
+
justifyContent: "flex-end",
|
|
143
|
+
},
|
|
144
|
+
strikethroughPrice: {
|
|
145
|
+
fontSize: 14,
|
|
146
|
+
color: theme.colors.textSecondary,
|
|
147
|
+
textDecoration: "line-through",
|
|
148
|
+
},
|
|
149
|
+
discountBadge: {
|
|
150
|
+
padding: "4px 8px",
|
|
151
|
+
backgroundColor: "#dcfce7",
|
|
152
|
+
color: "#166534",
|
|
153
|
+
borderRadius: theme.radii.sm,
|
|
154
|
+
fontSize: 12,
|
|
155
|
+
fontWeight: 600,
|
|
156
|
+
},
|
|
157
|
+
remainingInfo: {
|
|
158
|
+
padding: "8px 12px",
|
|
159
|
+
backgroundColor: "#fef3c7",
|
|
160
|
+
color: "#92400e",
|
|
161
|
+
borderRadius: theme.radii.sm,
|
|
162
|
+
fontSize: 13,
|
|
163
|
+
textAlign: "center",
|
|
164
|
+
},
|
|
165
|
+
actions: {
|
|
166
|
+
display: "flex",
|
|
167
|
+
gap: 12,
|
|
168
|
+
marginTop: 24,
|
|
169
|
+
},
|
|
170
|
+
backBtn: {
|
|
171
|
+
flex: 1,
|
|
172
|
+
padding: "14px 24px",
|
|
173
|
+
border: `1px solid ${theme.colors.border}`,
|
|
174
|
+
borderRadius: theme.radii.md,
|
|
175
|
+
backgroundColor: "transparent",
|
|
176
|
+
color: theme.colors.text,
|
|
177
|
+
cursor: "pointer",
|
|
178
|
+
fontSize: 14,
|
|
179
|
+
fontWeight: 500,
|
|
180
|
+
},
|
|
181
|
+
confirmBtn: {
|
|
182
|
+
flex: 1,
|
|
183
|
+
padding: "14px 24px",
|
|
184
|
+
border: "none",
|
|
185
|
+
borderRadius: theme.radii.md,
|
|
186
|
+
backgroundColor: theme.colors.primary,
|
|
187
|
+
color: "#ffffff",
|
|
188
|
+
cursor: "pointer",
|
|
189
|
+
fontSize: 14,
|
|
190
|
+
fontWeight: 600,
|
|
191
|
+
},
|
|
192
|
+
};
|
|
193
|
+
};
|
|
194
|
+
export default AppointmentSummaryStep;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { SessionPack, AvailablePackage } from "../types";
|
|
3
|
+
export interface BookingOptionStepProps {
|
|
4
|
+
userSessionPacks: SessionPack[];
|
|
5
|
+
availablePackages: AvailablePackage[];
|
|
6
|
+
showPackageExplorer: boolean;
|
|
7
|
+
selectedSessionPack: SessionPack | null;
|
|
8
|
+
selectedNewPackage: AvailablePackage | null;
|
|
9
|
+
onSelectOption: (optionType: "session-pack" | "new-appointment" | "explore-packages", sessionPack?: SessionPack, newPackage?: AvailablePackage) => void;
|
|
10
|
+
onSelectPackage: (pkg: AvailablePackage) => void;
|
|
11
|
+
onBack: () => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const BookingOptionStep: React.FC<BookingOptionStepProps>;
|
|
14
|
+
export default BookingOptionStep;
|