medos-sdk 1.1.10 → 1.1.12
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.d.ts +1 -0
- package/dist/client/MedosClient.js +8 -1
- package/dist/components/AppointmentCalender.js +19 -22
- package/dist/components/AppointmentConfirmationStep.d.ts +1 -0
- package/dist/components/AppointmentConfirmationStep.js +34 -42
- package/dist/components/AppointmentDateTimeModal.d.ts +1 -0
- package/dist/components/AppointmentDateTimeModal.js +201 -168
- package/dist/components/AppointmentSummaryStep.d.ts +12 -0
- package/dist/components/AppointmentSummaryStep.js +168 -0
- package/dist/components/BookingOptionStep.d.ts +14 -0
- package/dist/components/BookingOptionStep.js +346 -0
- package/dist/components/ContactInformationStep.js +10 -4
- package/dist/components/ContactPreferenceStep.js +10 -1
- package/dist/components/DoctorSelectModal.js +105 -59
- package/dist/components/EnquiryForm.js +81 -69
- package/dist/components/Icons/CloseIcon.d.ts +9 -0
- package/dist/components/Icons/CloseIcon.js +5 -0
- package/dist/components/InquiryDetailsStep.js +5 -1
- package/dist/components/PatientDetailsStep.js +17 -12
- package/dist/components/PatientSelectionStep.d.ts +12 -0
- package/dist/components/PatientSelectionStep.js +254 -0
- package/dist/components/PhoneVerificationStep.js +1 -1
- package/dist/components/SuccessStep.js +1 -1
- package/dist/components/appointment-booking/AppointmentCalender.js +145 -67
- 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.d.ts +0 -1
- package/dist/components/appointment-booking/hooks/useAppointmentFlow.js +111 -25
- package/dist/components/appointment-booking/hooks/useAppointmentState.js +32 -0
- package/dist/components/appointment-booking/hooks/useInitializeAddresses.js +0 -1
- 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 +167 -0
- package/dist/components/appointment-booking/types.js +16 -0
- package/dist/components/appointment-modal-styles.d.ts +259 -0
- package/dist/components/appointment-modal-styles.js +395 -0
- package/dist/components/constant.d.ts +2 -0
- package/dist/components/constant.js +15 -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/custom-calendar.js +20 -11
- 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 -257
- package/dist/components/theme-styles.d.ts +5 -4
- package/dist/components/theme-styles.js +239 -125
- 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 -52
- package/dist/components/types.js +1 -23
- 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 -5
- package/dist/components/utils.js +1 -15
- package/dist/components/validation.d.ts +1 -2
- package/dist/components/validation.js +1 -7
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +1 -1
- package/dist/core/theme/index.d.ts +1 -0
- package/dist/core/theme/index.js +1 -0
- package/dist/core/theme/responsive.d.ts +15 -0
- package/dist/core/theme/responsive.js +113 -0
- package/dist/core/theme/themes.js +16 -4
- package/dist/core/theme/types.d.ts +8 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +2 -1
- package/dist/react/ThemeProvider.d.ts +2 -1
- package/dist/react/ThemeProvider.js +49 -10
- package/dist/react/index.d.ts +3 -3
- package/dist/react/index.js +1 -1
- package/dist/services/AppointmentService.d.ts +80 -2
- package/dist/services/AppointmentService.js +131 -5
- package/dist/services/AuthService.js +1 -1
- package/dist/services/WorkspaceService.d.ts +58 -3
- package/dist/services/WorkspaceService.js +10 -1
- package/dist/vanilla/AppointmentCalendarWidget.d.ts +17 -7
- package/dist/vanilla/AppointmentCalendarWidget.js +1401 -380
- package/dist/vanilla/EnquiryFormWidget.d.ts +1 -0
- package/dist/vanilla/EnquiryFormWidget.js +25 -43
- package/dist/vanilla/client/MedosClient.d.ts +1 -0
- package/dist/vanilla/components/AppointmentConfirmationStep.d.ts +1 -0
- package/dist/vanilla/components/AppointmentDateTimeModal.d.ts +1 -0
- package/dist/vanilla/components/AppointmentSummaryStep.d.ts +12 -0
- package/dist/vanilla/components/BookingOptionStep.d.ts +14 -0
- package/dist/vanilla/components/Icons/CloseIcon.d.ts +9 -0
- package/dist/vanilla/components/PatientSelectionStep.d.ts +12 -0
- package/dist/vanilla/components/VanillaCalendar.js +33 -18
- package/dist/vanilla/components/VanillaIcons.d.ts +5 -0
- package/dist/vanilla/components/VanillaIcons.js +92 -0
- package/dist/vanilla/components/VanillaSelect.d.ts +3 -0
- package/dist/vanilla/components/VanillaSelect.js +93 -5
- 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/hooks/useAppointmentFlow.d.ts +0 -1
- package/dist/vanilla/components/appointment-booking/index.d.ts +2 -4
- package/dist/vanilla/components/appointment-booking/types.d.ts +167 -0
- package/dist/vanilla/components/appointment-modal-styles.d.ts +259 -0
- package/dist/vanilla/components/constant.d.ts +2 -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/theme-styles.d.ts +5 -4
- 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 -52
- 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 -5
- package/dist/vanilla/components/validation.d.ts +1 -2
- package/dist/vanilla/constants/index.d.ts +1 -1
- package/dist/vanilla/core/theme/index.d.ts +1 -0
- package/dist/vanilla/core/theme/responsive.d.ts +15 -0
- package/dist/vanilla/core/theme/types.d.ts +8 -0
- package/dist/vanilla/enquiry-widget.js +3632 -90
- package/dist/vanilla/index.d.ts +4 -2
- package/dist/vanilla/react/ThemeProvider.d.ts +2 -1
- package/dist/vanilla/react/index.d.ts +3 -3
- package/dist/vanilla/services/AppointmentService.d.ts +80 -2
- package/dist/vanilla/services/WorkspaceService.d.ts +58 -3
- package/dist/vanilla/vanilla/AppointmentCalendarWidget.d.ts +17 -7
- package/dist/vanilla/vanilla/EnquiryFormWidget.d.ts +1 -0
- package/dist/vanilla/vanilla/components/VanillaIcons.d.ts +5 -0
- package/dist/vanilla/vanilla/components/VanillaSelect.d.ts +3 -0
- package/dist/vanilla/widget.css +1045 -205
- package/dist/vanilla/widget.js +10365 -5737
- package/package.json +2 -2
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { useTheme } from "../../../react/hooks/useTheme";
|
|
4
|
+
import { useBreakpoint } from "../../../core/theme/responsive";
|
|
5
|
+
export const BookingOptionStep = ({ userSessionPacks, availablePackages, showPackageExplorer, selectedNewPackage, onSelectOption, onSelectPackage, onBack, }) => {
|
|
6
|
+
const theme = useTheme();
|
|
7
|
+
const breakpoint = useBreakpoint(theme);
|
|
8
|
+
const styles = getStyles(theme, breakpoint);
|
|
9
|
+
const [tempSelectedOption, setTempSelectedOption] = React.useState(null);
|
|
10
|
+
const [tempSelectedPackage, setTempSelectedPackage] = React.useState(null);
|
|
11
|
+
const activePack = userSessionPacks.find((pack) => pack.remainingSessions > 0);
|
|
12
|
+
const hasAvailablePackages = availablePackages.length > 0;
|
|
13
|
+
const handleOptionClick = (optionType, sessionPack) => {
|
|
14
|
+
setTempSelectedOption({ type: optionType, sessionPack });
|
|
15
|
+
};
|
|
16
|
+
const handlePackageSelect = (pkg) => {
|
|
17
|
+
setTempSelectedPackage(pkg);
|
|
18
|
+
};
|
|
19
|
+
const handlePackageNext = () => {
|
|
20
|
+
if (tempSelectedPackage) {
|
|
21
|
+
onSelectPackage(tempSelectedPackage);
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
const handleNext = () => {
|
|
25
|
+
if (tempSelectedOption) {
|
|
26
|
+
onSelectOption(tempSelectedOption.type, tempSelectedOption.sessionPack, undefined);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
if (showPackageExplorer) {
|
|
30
|
+
return (_jsxs("div", { style: styles.container, children: [_jsx("div", { style: styles.header, children: _jsx("h3", { style: styles.title, children: "Explore Packages" }) }), _jsx("p", { style: styles.subtitle, children: "Choose a package that suits your needs" }), hasAvailablePackages ? (_jsx("div", { style: styles.packagesGrid, children: availablePackages.map((pkg) => (_jsxs("div", { style: {
|
|
31
|
+
...styles.packageCard,
|
|
32
|
+
...(tempSelectedPackage?.id === pkg.id
|
|
33
|
+
? styles.packageCardSelected
|
|
34
|
+
: {}),
|
|
35
|
+
}, onClick: () => handlePackageSelect(pkg), children: [_jsx("h4", { style: styles.packageName, children: pkg.name }), _jsx("p", { style: styles.packageDescription, children: pkg.description }), pkg.allowedDoctors && pkg.allowedDoctors.length > 0 && (_jsx("div", { style: styles.packageDoctors, children: pkg.allowedDoctors.map((doc) => (_jsx("span", { style: styles.doctorBadge, children: doc.fullName }, doc.id))) })), pkg.allowedConsultationModes &&
|
|
36
|
+
pkg.allowedConsultationModes.length > 0 && (_jsx("div", { style: styles.consultationModes, children: pkg.allowedConsultationModes.map((mode) => (_jsx("span", { style: styles.modeBadge, children: mode === "ONLINE" ? "🌐 Online" : "🏥 In-Person" }, mode))) })), _jsxs("div", { style: styles.packageDetails, children: [_jsxs("span", { style: styles.packageSessions, children: [pkg.totalSessions || pkg.sessions, " session", (pkg.totalSessions || pkg.sessions || 1) > 1 ? "s" : ""] }), _jsx("div", { style: styles.priceContainer, children: pkg.discountedPrice && pkg.discountedPrice < pkg.price ? (_jsxs(_Fragment, { children: [_jsxs("span", { style: styles.originalPrice, children: ["\u20B9", pkg.price.toLocaleString()] }), _jsxs("span", { style: styles.packagePrice, children: ["\u20B9", pkg.discountedPrice.toLocaleString()] }), _jsxs("span", { style: styles.perSessionPrice, children: ["\u20B9", Math.round(pkg.discountedPrice /
|
|
37
|
+
(pkg.totalSessions || pkg.sessions || 1)).toLocaleString(), "/session"] }), pkg.discount && (_jsx("span", { style: styles.discountBadge, children: pkg.discountType === "PERCENTAGE"
|
|
38
|
+
? `${pkg.discount}% OFF`
|
|
39
|
+
: `₹${pkg.discount} OFF` }))] })) : (_jsxs(_Fragment, { children: [_jsxs("span", { style: styles.packagePrice, children: ["\u20B9", pkg.price.toLocaleString()] }), _jsxs("span", { style: styles.perSessionPrice, children: ["\u20B9", Math.round(pkg.price / (pkg.totalSessions || pkg.sessions || 1)).toLocaleString(), "/session"] })] })) })] }), _jsxs("div", { style: styles.packageValidity, children: ["Valid for ", pkg.validityDays, " days"] })] }, pkg.id))) })) : (_jsx("div", { style: styles.emptyState, children: _jsx("p", { children: "No packages available at the moment." }) })), _jsxs("div", { style: styles.actions, children: [_jsx("button", { style: styles.backBtn, onClick: onBack, children: "Back" }), _jsx("button", { style: {
|
|
40
|
+
...styles.nextBtn,
|
|
41
|
+
...(tempSelectedPackage ? {} : styles.nextBtnDisabled),
|
|
42
|
+
}, onClick: handlePackageNext, disabled: !tempSelectedPackage, children: "Next" })] })] }));
|
|
43
|
+
}
|
|
44
|
+
return (_jsxs("div", { style: styles.container, children: [_jsx("h3", { style: styles.title, children: "Choose Booking Option" }), _jsx("p", { style: styles.subtitle, children: "How would you like to book your appointment?" }), userSessionPacks.filter((p) => p.remainingSessions > 0).length > 1 && (_jsxs("div", { style: styles.sessionPacksSection, children: [_jsx("h4", { style: styles.sectionTitle, children: "Your Active Session Packs" }), _jsx("div", { style: styles.sessionPacksList, children: userSessionPacks
|
|
45
|
+
.filter((pack) => pack.remainingSessions > 0)
|
|
46
|
+
.map((pack) => (_jsxs("div", { style: {
|
|
47
|
+
...styles.sessionPackCard,
|
|
48
|
+
...(tempSelectedOption?.type === "session-pack" &&
|
|
49
|
+
tempSelectedOption?.sessionPack?.id === pack.id
|
|
50
|
+
? styles.sessionPackCardSelected
|
|
51
|
+
: {}),
|
|
52
|
+
}, onClick: () => handleOptionClick("session-pack", pack), children: [_jsxs("div", { style: styles.sessionPackInfo, children: [_jsx("span", { style: styles.sessionPackName, children: pack.name }), _jsxs("span", { style: styles.sessionPackRemaining, children: [pack.remainingSessions, "/", pack.totalSessions, " sessions"] }), pack.doctorName && (_jsx("span", { style: styles.sessionPackDoctor, children: pack.doctorName }))] }), _jsxs("div", { style: styles.sessionPackExpiry, children: ["Expires: ", new Date(pack.expiryDate).toLocaleDateString()] })] }, pack.id))) })] })), userSessionPacks.length > 0 && _jsx("hr", { style: { margin: "6px 0 6px 0" } }), _jsxs("div", { style: styles.optionsGrid, children: [activePack && (_jsxs("div", { style: {
|
|
53
|
+
...styles.optionCard,
|
|
54
|
+
...(tempSelectedOption?.type === "session-pack" &&
|
|
55
|
+
tempSelectedOption?.sessionPack?.id === activePack.id
|
|
56
|
+
? styles.optionCardSelected
|
|
57
|
+
: {}),
|
|
58
|
+
}, onClick: () => handleOptionClick("session-pack", activePack), children: [_jsx("div", { style: styles.optionIcon, children: "\uD83D\uDCCB" }), _jsx("h4", { style: styles.optionTitle, children: "Use Session Pack" }), _jsxs("p", { style: styles.optionDescription, children: ["You have ", activePack.remainingSessions, " session", activePack.remainingSessions > 1 ? "s" : "", " remaining"] }), _jsx("div", { style: styles.sessionPackBadge, children: activePack.name })] })), _jsxs("div", { style: {
|
|
59
|
+
...styles.optionCard,
|
|
60
|
+
...(tempSelectedOption?.type === "new-appointment"
|
|
61
|
+
? styles.optionCardSelected
|
|
62
|
+
: {}),
|
|
63
|
+
}, onClick: () => handleOptionClick("new-appointment"), children: [_jsx("div", { style: styles.optionIcon, children: "\uD83D\uDCC5" }), _jsx("h4", { style: styles.optionTitle, children: "Book New Appointment" }), _jsx("p", { style: styles.optionDescription, children: "Schedule a single consultation visit" })] }), hasAvailablePackages && (_jsxs("div", { style: {
|
|
64
|
+
...styles.optionCard,
|
|
65
|
+
...(tempSelectedOption?.type === "explore-packages"
|
|
66
|
+
? styles.optionCardSelected
|
|
67
|
+
: {}),
|
|
68
|
+
}, onClick: () => handleOptionClick("explore-packages"), children: [_jsx("div", { style: styles.optionIcon, children: "\uD83C\uDF81" }), _jsx("h4", { style: styles.optionTitle, children: "Explore Packages" }), _jsx("p", { style: styles.optionDescription, children: "View and purchase consultation packages" })] }))] }), _jsxs("div", { style: styles.actions, children: [_jsx("button", { style: styles.backBtn, onClick: onBack, children: "Back" }), _jsx("button", { style: {
|
|
69
|
+
...styles.nextBtn,
|
|
70
|
+
...(tempSelectedOption ? {} : styles.nextBtnDisabled),
|
|
71
|
+
}, onClick: handleNext, disabled: !tempSelectedOption, children: "Next" })] })] }));
|
|
72
|
+
};
|
|
73
|
+
const getStyles = (theme, breakpoint) => {
|
|
74
|
+
const isMobile = breakpoint === "mobile";
|
|
75
|
+
const borderRadius = "12px";
|
|
76
|
+
const buttonRadius = "8px";
|
|
77
|
+
const cardBorder = `1px solid ${theme.colors.border}`;
|
|
78
|
+
return {
|
|
79
|
+
container: {
|
|
80
|
+
display: "flex",
|
|
81
|
+
flexDirection: "column",
|
|
82
|
+
gap: 20,
|
|
83
|
+
},
|
|
84
|
+
header: {
|
|
85
|
+
marginBottom: 4,
|
|
86
|
+
},
|
|
87
|
+
title: {
|
|
88
|
+
margin: 0,
|
|
89
|
+
fontSize: isMobile ? 18 : 20,
|
|
90
|
+
fontWeight: 600,
|
|
91
|
+
color: theme.colors.text,
|
|
92
|
+
},
|
|
93
|
+
subtitle: {
|
|
94
|
+
margin: 0,
|
|
95
|
+
fontSize: 14,
|
|
96
|
+
color: theme.colors.textSecondary,
|
|
97
|
+
lineHeight: 1.5,
|
|
98
|
+
},
|
|
99
|
+
optionsGrid: {
|
|
100
|
+
display: "grid",
|
|
101
|
+
gridTemplateColumns: isMobile
|
|
102
|
+
? "1fr"
|
|
103
|
+
: "repeat(auto-fit, minmax(200px, 1fr))",
|
|
104
|
+
gap: 16,
|
|
105
|
+
},
|
|
106
|
+
optionCard: {
|
|
107
|
+
display: "flex",
|
|
108
|
+
flexDirection: "column",
|
|
109
|
+
alignItems: "center",
|
|
110
|
+
padding: 24,
|
|
111
|
+
border: cardBorder,
|
|
112
|
+
borderRadius,
|
|
113
|
+
cursor: "pointer",
|
|
114
|
+
transition: "all 0.2s ease",
|
|
115
|
+
textAlign: "center",
|
|
116
|
+
backgroundColor: theme.colors.surface,
|
|
117
|
+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.04)",
|
|
118
|
+
},
|
|
119
|
+
optionCardSelected: {
|
|
120
|
+
borderColor: theme.colors.primary,
|
|
121
|
+
backgroundColor: `${theme.colors.primary}08`,
|
|
122
|
+
boxShadow: `0 0 0 1px ${theme.colors.primary}`,
|
|
123
|
+
},
|
|
124
|
+
optionIcon: {
|
|
125
|
+
fontSize: 32,
|
|
126
|
+
marginBottom: 12,
|
|
127
|
+
},
|
|
128
|
+
optionTitle: {
|
|
129
|
+
margin: "0 0 8px 0",
|
|
130
|
+
fontSize: 16,
|
|
131
|
+
fontWeight: 600,
|
|
132
|
+
color: theme.colors.text,
|
|
133
|
+
},
|
|
134
|
+
optionDescription: {
|
|
135
|
+
margin: 0,
|
|
136
|
+
fontSize: 14,
|
|
137
|
+
color: theme.colors.textSecondary,
|
|
138
|
+
lineHeight: 1.5,
|
|
139
|
+
},
|
|
140
|
+
sessionPackBadge: {
|
|
141
|
+
marginTop: 12,
|
|
142
|
+
padding: "6px 14px",
|
|
143
|
+
backgroundColor: theme.colors.successBackground || "#dcfce7",
|
|
144
|
+
color: theme.colors.success || "#166534",
|
|
145
|
+
borderRadius: 999,
|
|
146
|
+
fontSize: 12,
|
|
147
|
+
fontWeight: 500,
|
|
148
|
+
},
|
|
149
|
+
sessionPacksSection: {
|
|
150
|
+
marginBottom: 8,
|
|
151
|
+
},
|
|
152
|
+
sectionTitle: {
|
|
153
|
+
margin: "0 0 16px 0",
|
|
154
|
+
fontSize: 15,
|
|
155
|
+
fontWeight: 600,
|
|
156
|
+
color: theme.colors.text,
|
|
157
|
+
},
|
|
158
|
+
sessionPacksList: {
|
|
159
|
+
display: "flex",
|
|
160
|
+
flexDirection: "column",
|
|
161
|
+
gap: 12,
|
|
162
|
+
},
|
|
163
|
+
sessionPackCard: {
|
|
164
|
+
display: "flex",
|
|
165
|
+
justifyContent: "space-between",
|
|
166
|
+
alignItems: "center",
|
|
167
|
+
padding: 16,
|
|
168
|
+
border: cardBorder,
|
|
169
|
+
borderRadius,
|
|
170
|
+
cursor: "pointer",
|
|
171
|
+
transition: "all 0.2s ease",
|
|
172
|
+
backgroundColor: theme.colors.surface,
|
|
173
|
+
},
|
|
174
|
+
sessionPackCardSelected: {
|
|
175
|
+
borderColor: theme.colors.primary,
|
|
176
|
+
backgroundColor: `${theme.colors.primary}08`,
|
|
177
|
+
},
|
|
178
|
+
sessionPackInfo: {
|
|
179
|
+
display: "flex",
|
|
180
|
+
flexDirection: "column",
|
|
181
|
+
gap: 4,
|
|
182
|
+
},
|
|
183
|
+
sessionPackName: {
|
|
184
|
+
fontSize: 14,
|
|
185
|
+
fontWeight: 600,
|
|
186
|
+
color: theme.colors.text,
|
|
187
|
+
},
|
|
188
|
+
sessionPackRemaining: {
|
|
189
|
+
fontSize: 13,
|
|
190
|
+
color: theme.colors.textSecondary,
|
|
191
|
+
},
|
|
192
|
+
sessionPackDoctor: {
|
|
193
|
+
fontSize: 13,
|
|
194
|
+
color: theme.colors.textSecondary,
|
|
195
|
+
},
|
|
196
|
+
sessionPackExpiry: {
|
|
197
|
+
fontSize: 12,
|
|
198
|
+
color: theme.colors.error || "#dc2626",
|
|
199
|
+
fontWeight: 500,
|
|
200
|
+
},
|
|
201
|
+
packagesGrid: {
|
|
202
|
+
display: "grid",
|
|
203
|
+
gridTemplateColumns: isMobile
|
|
204
|
+
? "1fr"
|
|
205
|
+
: "repeat(auto-fit, minmax(250px, 1fr))",
|
|
206
|
+
gap: 16,
|
|
207
|
+
},
|
|
208
|
+
packageCard: {
|
|
209
|
+
display: "flex",
|
|
210
|
+
flexDirection: "column",
|
|
211
|
+
padding: 20,
|
|
212
|
+
border: cardBorder,
|
|
213
|
+
borderRadius,
|
|
214
|
+
cursor: "pointer",
|
|
215
|
+
transition: "all 0.2s ease",
|
|
216
|
+
backgroundColor: theme.colors.surface,
|
|
217
|
+
boxShadow: "0 1px 3px rgba(0, 0, 0, 0.04)",
|
|
218
|
+
},
|
|
219
|
+
packageCardSelected: {
|
|
220
|
+
borderColor: theme.colors.primary,
|
|
221
|
+
backgroundColor: `${theme.colors.primary}08`,
|
|
222
|
+
boxShadow: `0 0 0 1px ${theme.colors.primary}`,
|
|
223
|
+
},
|
|
224
|
+
packageName: {
|
|
225
|
+
margin: "0 0 8px 0",
|
|
226
|
+
fontSize: 16,
|
|
227
|
+
fontWeight: 600,
|
|
228
|
+
color: theme.colors.text,
|
|
229
|
+
},
|
|
230
|
+
packageDescription: {
|
|
231
|
+
margin: "0 0 16px 0",
|
|
232
|
+
fontSize: 14,
|
|
233
|
+
color: theme.colors.textSecondary,
|
|
234
|
+
lineHeight: 1.5,
|
|
235
|
+
flex: 1,
|
|
236
|
+
},
|
|
237
|
+
packageDetails: {
|
|
238
|
+
display: "flex",
|
|
239
|
+
justifyContent: "space-between",
|
|
240
|
+
alignItems: "center",
|
|
241
|
+
paddingTop: 16,
|
|
242
|
+
borderTop: cardBorder,
|
|
243
|
+
},
|
|
244
|
+
packageSessions: {
|
|
245
|
+
fontSize: 13,
|
|
246
|
+
color: theme.colors.textSecondary,
|
|
247
|
+
},
|
|
248
|
+
priceContainer: {
|
|
249
|
+
display: "flex",
|
|
250
|
+
flexDirection: "column",
|
|
251
|
+
alignItems: "flex-end",
|
|
252
|
+
gap: 4,
|
|
253
|
+
},
|
|
254
|
+
originalPrice: {
|
|
255
|
+
fontSize: 14,
|
|
256
|
+
color: theme.colors.textSecondary,
|
|
257
|
+
textDecoration: "line-through",
|
|
258
|
+
},
|
|
259
|
+
packagePrice: {
|
|
260
|
+
fontSize: 18,
|
|
261
|
+
fontWeight: 600,
|
|
262
|
+
color: theme.colors.primary,
|
|
263
|
+
},
|
|
264
|
+
perSessionPrice: {
|
|
265
|
+
fontSize: 12,
|
|
266
|
+
color: theme.colors.textSecondary,
|
|
267
|
+
fontWeight: 500,
|
|
268
|
+
},
|
|
269
|
+
discountBadge: {
|
|
270
|
+
fontSize: 11,
|
|
271
|
+
fontWeight: 600,
|
|
272
|
+
color: "#fff",
|
|
273
|
+
backgroundColor: theme.colors.success || "#16a34a",
|
|
274
|
+
padding: "2px 8px",
|
|
275
|
+
borderRadius: 999,
|
|
276
|
+
},
|
|
277
|
+
packageValidity: {
|
|
278
|
+
marginTop: 8,
|
|
279
|
+
fontSize: 12,
|
|
280
|
+
color: theme.colors.textSecondary,
|
|
281
|
+
},
|
|
282
|
+
packageDoctors: {
|
|
283
|
+
display: "flex",
|
|
284
|
+
flexWrap: "wrap",
|
|
285
|
+
gap: 6,
|
|
286
|
+
marginBottom: 12,
|
|
287
|
+
},
|
|
288
|
+
doctorBadge: {
|
|
289
|
+
fontSize: 12,
|
|
290
|
+
color: theme.colors.text,
|
|
291
|
+
backgroundColor: theme.colors.backgroundSecondary || "#f1f5f9",
|
|
292
|
+
padding: "4px 10px",
|
|
293
|
+
borderRadius: 999,
|
|
294
|
+
},
|
|
295
|
+
consultationModes: {
|
|
296
|
+
display: "flex",
|
|
297
|
+
gap: 8,
|
|
298
|
+
marginBottom: 12,
|
|
299
|
+
},
|
|
300
|
+
modeBadge: {
|
|
301
|
+
fontSize: 11,
|
|
302
|
+
color: theme.colors.textSecondary,
|
|
303
|
+
backgroundColor: theme.colors.backgroundSecondary || "#f1f5f9",
|
|
304
|
+
padding: "4px 8px",
|
|
305
|
+
borderRadius: 6,
|
|
306
|
+
},
|
|
307
|
+
emptyState: {
|
|
308
|
+
textAlign: "center",
|
|
309
|
+
padding: "40px 20px",
|
|
310
|
+
color: theme.colors.textSecondary,
|
|
311
|
+
fontSize: 14,
|
|
312
|
+
},
|
|
313
|
+
actions: {
|
|
314
|
+
display: "flex",
|
|
315
|
+
gap: 12,
|
|
316
|
+
paddingTop: 20,
|
|
317
|
+
justifyContent: "flex-end",
|
|
318
|
+
},
|
|
319
|
+
backBtn: {
|
|
320
|
+
padding: "10px 20px",
|
|
321
|
+
border: cardBorder,
|
|
322
|
+
borderRadius: buttonRadius,
|
|
323
|
+
backgroundColor: theme.colors.surface,
|
|
324
|
+
color: theme.colors.text,
|
|
325
|
+
cursor: "pointer",
|
|
326
|
+
fontSize: 14,
|
|
327
|
+
fontWeight: 600,
|
|
328
|
+
transition: "all 0.2s ease",
|
|
329
|
+
minHeight: 40,
|
|
330
|
+
},
|
|
331
|
+
nextBtn: {
|
|
332
|
+
padding: "10px 24px",
|
|
333
|
+
border: "none",
|
|
334
|
+
borderRadius: buttonRadius,
|
|
335
|
+
backgroundColor: theme.colors.primary,
|
|
336
|
+
color: "#fff",
|
|
337
|
+
cursor: "pointer",
|
|
338
|
+
fontSize: 14,
|
|
339
|
+
fontWeight: 600,
|
|
340
|
+
transition: "all 0.2s ease",
|
|
341
|
+
minHeight: 40,
|
|
342
|
+
},
|
|
343
|
+
nextBtnDisabled: {
|
|
344
|
+
backgroundColor: theme.colors.textSecondary || "#9ca3af",
|
|
345
|
+
cursor: "not-allowed",
|
|
346
|
+
opacity: 0.6,
|
|
347
|
+
},
|
|
348
|
+
};
|
|
349
|
+
};
|
|
350
|
+
export default BookingOptionStep;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Doctor, AddressItem } from "../../../services/AppointmentService";
|
|
3
|
+
import { AvailablePackage } from "../types";
|
|
4
|
+
type DoctorSelectModalProps = {
|
|
5
|
+
addresses?: AddressItem[];
|
|
6
|
+
addressDoctorsMap?: Record<number, Doctor[]>;
|
|
7
|
+
selectedAddressId?: number | null;
|
|
8
|
+
selectedDoctorId?: number | null;
|
|
9
|
+
selectedNewPackage?: AvailablePackage | null;
|
|
10
|
+
onCancel: () => void;
|
|
11
|
+
onContinue: (addressId: number, doctorId: number, notes?: string) => void;
|
|
12
|
+
};
|
|
13
|
+
export declare const DoctorSelectModal: React.FC<DoctorSelectModalProps>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { AppointmentService, } from "../../../services/AppointmentService";
|
|
4
|
+
import { Select, SelectTrigger, SelectContent, SelectItem, } from "../../shared/ui/SelectDropdown";
|
|
5
|
+
import { useTheme } from "../../../react/hooks/useTheme";
|
|
6
|
+
import { useBreakpoint } from "../../../core/theme/responsive";
|
|
7
|
+
const getFilteredAddresses = (addresses, selectedPackage) => {
|
|
8
|
+
if (!selectedPackage ||
|
|
9
|
+
!selectedPackage.doctorIds ||
|
|
10
|
+
selectedPackage.doctorIds.length === 0) {
|
|
11
|
+
return addresses;
|
|
12
|
+
}
|
|
13
|
+
return addresses.filter((address) => {
|
|
14
|
+
const doctors = address.doctors || [];
|
|
15
|
+
return doctors.some((doctor) => selectedPackage.doctorIds.includes(doctor.id));
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
const getFilteredDoctors = (doctors, selectedPackage) => {
|
|
19
|
+
if (!selectedPackage ||
|
|
20
|
+
!selectedPackage.doctorIds ||
|
|
21
|
+
selectedPackage.doctorIds.length === 0) {
|
|
22
|
+
return doctors;
|
|
23
|
+
}
|
|
24
|
+
return doctors.filter((doctor) => selectedPackage.doctorIds.includes(doctor.id));
|
|
25
|
+
};
|
|
26
|
+
export const DoctorSelectModal = ({ addresses: initialAddresses, addressDoctorsMap: initialAddressDoctorsMap, selectedAddressId: initialSelectedAddressId, selectedDoctorId: initialSelectedDoctorId, selectedNewPackage, onCancel, onContinue, }) => {
|
|
27
|
+
const theme = useTheme();
|
|
28
|
+
const breakpoint = useBreakpoint(theme);
|
|
29
|
+
const [addresses, setAddresses] = useState(initialAddresses || []);
|
|
30
|
+
const [addressDoctorsMap, setAddressDoctorsMap] = useState(initialAddressDoctorsMap || {});
|
|
31
|
+
const [selectedAddressId, setSelectedAddressId] = useState(initialSelectedAddressId ? String(initialSelectedAddressId) : "");
|
|
32
|
+
const [selectedDoctorId, setSelectedDoctorId] = useState(initialSelectedDoctorId ? String(initialSelectedDoctorId) : "");
|
|
33
|
+
const [appointmentNotes, setAppointmentNotes] = useState("");
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
if (initialAddresses && initialAddresses.length > 0) {
|
|
36
|
+
setAddresses(initialAddresses);
|
|
37
|
+
}
|
|
38
|
+
if (initialAddressDoctorsMap &&
|
|
39
|
+
Object.keys(initialAddressDoctorsMap).length > 0) {
|
|
40
|
+
setAddressDoctorsMap(initialAddressDoctorsMap);
|
|
41
|
+
}
|
|
42
|
+
if (initialSelectedAddressId !== undefined &&
|
|
43
|
+
initialSelectedAddressId !== null) {
|
|
44
|
+
setSelectedAddressId(String(initialSelectedAddressId));
|
|
45
|
+
}
|
|
46
|
+
if (initialSelectedDoctorId !== undefined &&
|
|
47
|
+
initialSelectedDoctorId !== null) {
|
|
48
|
+
setSelectedDoctorId(String(initialSelectedDoctorId));
|
|
49
|
+
}
|
|
50
|
+
}, [
|
|
51
|
+
initialAddresses,
|
|
52
|
+
initialAddressDoctorsMap,
|
|
53
|
+
initialSelectedAddressId,
|
|
54
|
+
initialSelectedDoctorId,
|
|
55
|
+
]);
|
|
56
|
+
useEffect(() => {
|
|
57
|
+
if (!initialAddresses || initialAddresses.length === 0) {
|
|
58
|
+
(async () => {
|
|
59
|
+
try {
|
|
60
|
+
const response = await AppointmentService.getAddresses();
|
|
61
|
+
if (response.addresses?.length > 0) {
|
|
62
|
+
setAddresses(response.addresses);
|
|
63
|
+
const doctorMap = {};
|
|
64
|
+
response.addresses.forEach((addr) => {
|
|
65
|
+
doctorMap[addr.id] = addr.doctors || [];
|
|
66
|
+
});
|
|
67
|
+
setAddressDoctorsMap(doctorMap);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
catch (error) {
|
|
71
|
+
console.error("Failed to fetch addresses:", error);
|
|
72
|
+
}
|
|
73
|
+
})();
|
|
74
|
+
}
|
|
75
|
+
}, []);
|
|
76
|
+
const filteredAddresses = getFilteredAddresses(addresses, selectedNewPackage || null);
|
|
77
|
+
const doctorsForAddress = selectedAddressId
|
|
78
|
+
? addressDoctorsMap[Number(selectedAddressId)] || []
|
|
79
|
+
: [];
|
|
80
|
+
const filteredDoctors = getFilteredDoctors(doctorsForAddress, selectedNewPackage || null);
|
|
81
|
+
const selectedAddressLabel = addresses.find((a) => String(a.id) === selectedAddressId)?.label ||
|
|
82
|
+
addresses.find((a) => String(a.id) === selectedAddressId)
|
|
83
|
+
?.completeAddress ||
|
|
84
|
+
"";
|
|
85
|
+
const selectedDoctorLabel = doctorsForAddress.find((d) => String(d.id) === selectedDoctorId)?.name ||
|
|
86
|
+
"";
|
|
87
|
+
const canContinue = !!selectedAddressId && !!selectedDoctorId;
|
|
88
|
+
const styles = getStyles(theme, breakpoint);
|
|
89
|
+
return (_jsx("div", { style: {
|
|
90
|
+
border: `1px solid ${theme.colors.border}`,
|
|
91
|
+
borderRadius: "2px",
|
|
92
|
+
}, children: _jsxs("div", { style: styles.modalWrapper, children: [_jsx("div", { style: styles.headerWrapper, children: _jsx("h3", { style: styles.title, children: "Location & Doctor" }) }), _jsx("div", { style: { borderBottom: `1px solid ${theme.colors.border}` } }), _jsxs("div", { style: styles.contentWrapper, children: [_jsxs("div", { style: styles.fieldGroup, children: [_jsxs("label", { style: styles.label, children: ["Preferred Location ", _jsx("span", { style: styles.mandatory, children: "*" })] }), filteredAddresses.length === 0 ? (_jsx("div", { style: {
|
|
93
|
+
padding: "12px 14px",
|
|
94
|
+
border: `1px solid ${theme.colors.border}`,
|
|
95
|
+
borderRadius: "8px",
|
|
96
|
+
backgroundColor: theme.colors.surface,
|
|
97
|
+
color: theme.colors.textSecondary,
|
|
98
|
+
fontSize: 14,
|
|
99
|
+
}, children: "No locations available for this package" })) : (_jsxs(Select, { value: selectedAddressId, onValueChange: (value) => {
|
|
100
|
+
setSelectedAddressId(value);
|
|
101
|
+
setSelectedDoctorId("");
|
|
102
|
+
}, children: [_jsx(SelectTrigger, { style: { width: "100%" }, children: _jsx("span", { style: {
|
|
103
|
+
color: selectedAddressId ? "#1e293b" : "#94a3b8",
|
|
104
|
+
overflow: "hidden",
|
|
105
|
+
textOverflow: "ellipsis",
|
|
106
|
+
whiteSpace: "nowrap",
|
|
107
|
+
flex: 1,
|
|
108
|
+
}, children: selectedAddressLabel || "Select Address" }) }), _jsx(SelectContent, { children: filteredAddresses.map((a) => (_jsx(SelectItem, { value: String(a.id), children: a.completeAddress || a.label || `Address ${a.id}` }, a.id))) })] }))] }), _jsxs("div", { style: styles.fieldGroup, children: [_jsxs("label", { style: styles.label, children: ["Preferred Doctor ", _jsx("span", { style: styles.mandatory, children: "*" })] }), _jsxs(Select, { value: selectedDoctorId, onValueChange: setSelectedDoctorId, disabled: !selectedAddressId, children: [_jsx(SelectTrigger, { style: { width: "100%" }, children: _jsx("span", { style: {
|
|
109
|
+
color: selectedDoctorId ? "#1e293b" : "#94a3b8",
|
|
110
|
+
overflow: "hidden",
|
|
111
|
+
textOverflow: "ellipsis",
|
|
112
|
+
whiteSpace: "nowrap",
|
|
113
|
+
flex: 1,
|
|
114
|
+
}, children: selectedDoctorLabel || "Select Doctor" }) }), _jsx(SelectContent, { children: filteredDoctors.length > 0 ? (filteredDoctors.map((d) => (_jsxs(SelectItem, { value: String(d.id), children: [d.name, " ", d.specialty ? `- ${d.specialty}` : ""] }, d.id)))) : (_jsx(SelectItem, { value: "no-doctors", disabled: true, children: "No doctors available" })) })] })] }), _jsxs("div", { style: styles.fieldGroup, children: [_jsxs("label", { style: styles.label, children: ["Chief Complaint ", _jsx("span", { style: styles.optional, children: "(optional)" })] }), _jsx("textarea", { style: styles.textarea, placeholder: "Enter Chief Complaint or Appointment Notes", value: appointmentNotes, onChange: (e) => setAppointmentNotes(e.target.value) })] }), _jsxs("div", { style: styles.footer, children: [_jsx("button", { style: styles.backBtn, onClick: onCancel, children: "Back" }), _jsx("button", { style: {
|
|
115
|
+
...styles.continueBtn,
|
|
116
|
+
opacity: canContinue ? 1 : 0.6,
|
|
117
|
+
}, disabled: !canContinue, onClick: () => onContinue(Number(selectedAddressId), Number(selectedDoctorId), appointmentNotes), children: "Next" })] })] })] }) }));
|
|
118
|
+
};
|
|
119
|
+
const getStyles = (theme, breakpoint) => {
|
|
120
|
+
const isMobile = breakpoint === "mobile";
|
|
121
|
+
const isTablet = breakpoint === "tablet";
|
|
122
|
+
const borderRadius = "12px";
|
|
123
|
+
const buttonRadius = "8px";
|
|
124
|
+
const cardBorder = `1px solid ${theme.colors.border}`;
|
|
125
|
+
return {
|
|
126
|
+
modalWrapper: {
|
|
127
|
+
borderRadius,
|
|
128
|
+
maxWidth: isMobile || isTablet ? "100%" : 840,
|
|
129
|
+
margin: "0 auto",
|
|
130
|
+
fontFamily: theme.typography.fontFamily,
|
|
131
|
+
color: theme.colors.text,
|
|
132
|
+
},
|
|
133
|
+
headerWrapper: {
|
|
134
|
+
padding: isMobile ? "16px 20px" : "18px 24px",
|
|
135
|
+
backgroundColor: theme.colors.primary,
|
|
136
|
+
color: theme.colors.textOnPrimary,
|
|
137
|
+
},
|
|
138
|
+
contentWrapper: {
|
|
139
|
+
padding: isMobile ? "20px" : "24px",
|
|
140
|
+
},
|
|
141
|
+
title: {
|
|
142
|
+
fontSize: isMobile ? 16 : 18,
|
|
143
|
+
fontWeight: 600,
|
|
144
|
+
margin: 0,
|
|
145
|
+
color: theme.colors.textOnPrimary,
|
|
146
|
+
},
|
|
147
|
+
fieldGroup: { marginBottom: isMobile ? 18 : 20 },
|
|
148
|
+
label: {
|
|
149
|
+
fontSize: 14,
|
|
150
|
+
fontWeight: 500,
|
|
151
|
+
marginBottom: 8,
|
|
152
|
+
display: "block",
|
|
153
|
+
color: theme.colors.text,
|
|
154
|
+
},
|
|
155
|
+
mandatory: { color: theme.colors.error, marginLeft: 4 },
|
|
156
|
+
optional: {
|
|
157
|
+
color: theme.colors.textSecondary,
|
|
158
|
+
fontWeight: 400,
|
|
159
|
+
marginLeft: 4,
|
|
160
|
+
fontSize: 13,
|
|
161
|
+
},
|
|
162
|
+
textarea: {
|
|
163
|
+
width: "100%",
|
|
164
|
+
border: cardBorder,
|
|
165
|
+
borderRadius: buttonRadius,
|
|
166
|
+
minHeight: 100,
|
|
167
|
+
padding: "12px 14px",
|
|
168
|
+
fontSize: 14,
|
|
169
|
+
resize: "vertical",
|
|
170
|
+
boxSizing: "border-box",
|
|
171
|
+
transition: "border-color 0.2s ease, box-shadow 0.2s ease",
|
|
172
|
+
outline: "none",
|
|
173
|
+
backgroundColor: theme.colors.surface,
|
|
174
|
+
color: theme.colors.text,
|
|
175
|
+
},
|
|
176
|
+
footer: {
|
|
177
|
+
marginTop: isMobile ? 20 : 24,
|
|
178
|
+
display: "flex",
|
|
179
|
+
justifyContent: isMobile ? "stretch" : "flex-end",
|
|
180
|
+
alignItems: "center",
|
|
181
|
+
gap: 12,
|
|
182
|
+
flexDirection: isMobile ? "column" : "row",
|
|
183
|
+
},
|
|
184
|
+
brand: { color: theme.colors.primary, fontWeight: 600 },
|
|
185
|
+
backBtn: {
|
|
186
|
+
background: theme.colors.surface,
|
|
187
|
+
color: theme.colors.text,
|
|
188
|
+
border: cardBorder,
|
|
189
|
+
borderRadius: buttonRadius,
|
|
190
|
+
fontWeight: 600,
|
|
191
|
+
padding: isMobile ? "12px 20px" : "10px 20px",
|
|
192
|
+
cursor: "pointer",
|
|
193
|
+
width: isMobile ? "100%" : "auto",
|
|
194
|
+
minHeight: isMobile ? "44px" : "40px",
|
|
195
|
+
fontSize: 14,
|
|
196
|
+
transition: "all 0.2s ease",
|
|
197
|
+
},
|
|
198
|
+
continueBtn: {
|
|
199
|
+
background: theme.colors.secondary,
|
|
200
|
+
color: theme.colors.textOnSecondary,
|
|
201
|
+
border: "none",
|
|
202
|
+
borderRadius: buttonRadius,
|
|
203
|
+
fontWeight: 600,
|
|
204
|
+
padding: isMobile ? "12px 20px" : "10px 20px",
|
|
205
|
+
cursor: "pointer",
|
|
206
|
+
width: isMobile ? "100%" : "auto",
|
|
207
|
+
minHeight: isMobile ? "44px" : "40px",
|
|
208
|
+
fontSize: 14,
|
|
209
|
+
transition: "all 0.2s ease",
|
|
210
|
+
boxShadow: "0 1px 2px rgba(0, 0, 0, 0.05)",
|
|
211
|
+
},
|
|
212
|
+
};
|
|
213
|
+
};
|