diff --git a/client/package-lock.json b/client/package-lock.json index 673298f..7263c98 100644 --- a/client/package-lock.json +++ b/client/package-lock.json @@ -28149,4 +28149,4 @@ } } } -} +} \ No newline at end of file diff --git a/client/package.json b/client/package.json index 41251d4..1ef76c2 100644 --- a/client/package.json +++ b/client/package.json @@ -14,7 +14,7 @@ "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "@vercel/analytics": "^1.3.1", - "antd": "^5.21.2", + "antd": "^5.21.5", "aos": "^3.0.0-beta.6", "axios": "^1.7.7", "chart.js": "^4.4.4", diff --git a/client/src/components/Layout.jsx b/client/src/components/Layout.jsx index af4a210..6dcaf58 100644 --- a/client/src/components/Layout.jsx +++ b/client/src/components/Layout.jsx @@ -21,8 +21,8 @@ import Success from '../pages/Success'; import Home from '../pages/Home'; import HospitalDetails from '../pages/HospitalDetail'; import HospitalAppointments from '../pages/HospitalPanal'; -import BusinessContactForm from "./BusinessContactForm"; -import ForgotPassword from "./ForgotPassword"; +import BusinessContactForm from './BusinessContactForm'; +import ForgotPassword from './ForgotPassword'; import PrivateRoute from '../privateroute/privateroute'; import Newsletters from '../pages/Newsletters'; @@ -48,8 +48,10 @@ function Layout() { path === '/terms-and-conditions' || path === '/Labtest' || path === '/blog' || + path === '/business'|| path === '/forgot-password'|| + path === '/newsletter-dashboard' ) { showNavAndFooter = true; @@ -97,7 +99,9 @@ function Layout() { }> } /> } /> + } /> + diff --git a/client/src/pages/OPDRegistration.jsx b/client/src/pages/OPDRegistration.jsx index df649d3..1f0e594 100644 --- a/client/src/pages/OPDRegistration.jsx +++ b/client/src/pages/OPDRegistration.jsx @@ -11,6 +11,28 @@ import { TailSpin } from 'react-loader-spinner'; import { useRecoilValue } from 'recoil'; import { mode } from '../store/atom'; import { databaseUrls } from '../data/databaseUrls'; +import { + Form, + Input, + Button, + Select, + DatePicker, + Upload, + Steps, + message, +} from 'antd'; +import { UploadOutlined } from '@ant-design/icons'; + +// form with steps +import Box from '@mui/material/Box'; +import Stepper from '@mui/material/Stepper'; +import Step from '@mui/material/Step'; +import StepLabel from '@mui/material/StepLabel'; +// import Button from '@mui/material/Button'; +import Typography from '@mui/material/Typography'; + +//steps name +const steps = ['Personal information', 'Contact information', 'upload image']; function OPDRegistrationForm() { const dark = useRecoilValue(mode); // Using Recoil state for dark mode @@ -29,12 +51,44 @@ function OPDRegistrationForm() { report: [], }); + const [currentStep, setCurrentStep] = useState(0); + const [form] = Form.useForm(); + const [errors, setErrors] = useState({}); const [isSubmitting, setIsSubmitting] = useState(false); const [registrationDetails, setRegistrationDetails] = useState(null); const [appointmentDetails, setAppointmentDetails] = useState(null); const [showModal, setShowModal] = useState(false); + // steps state + const [activeStep, setActiveStep] = React.useState(0); + const [skipped, setSkipped] = React.useState(new Set()); + + // steps method + + const isStepSkipped = (step) => { + return skipped.has(step); + }; + + const handleNext = () => { + let newSkipped = skipped; + if (isStepSkipped(activeStep)) { + newSkipped = new Set(newSkipped.values()); + newSkipped.delete(activeStep); + } + + setActiveStep((prevActiveStep) => prevActiveStep + 1); + setSkipped(newSkipped); + }; + + const handleBack = () => { + setActiveStep((prevActiveStep) => prevActiveStep - 1); + }; + + const handleReset = () => { + setActiveStep(0); + }; + const validate = () => { const newErrors = {}; if (!formData.name.trim()) newErrors.name = 'Name is required'; @@ -237,209 +291,277 @@ function OPDRegistrationForm() { return ( <> -
-
-

- OPD Registration -

- -
-
- - - {errors.name && {errors.name}} -
- -
- - - {errors.email && {errors.email}} -
- -
- - - {errors.age && {errors.age}} -
- -
- - - {errors.gender && {errors.gender}} -
-
- - - {errors.contact && {errors.contact}} -
- -
- - - {errors.address && {errors.address}} -
- -
- - - {errors.pincode && {errors.pincode}} -
- -
- - - {errors.department && ( - {errors.department} - )} -
- -
- - - {errors.reason && {errors.reason}} -
+ {activeStep === 0 && ( + +
+ + + {errors.name && ( + {errors.name} + )} +
+ +
+ + + {errors.email && ( + {errors.email} + )} +
+ +
+ + + {errors.age && ( + {errors.age} + )} +
+ +
+ + + {errors.gender && ( + {errors.gender} + )} +
+
+ )} + {activeStep === 1 && ( + +
+ + + {errors.contact && ( + {errors.contact} + )} +
+ +
+ + + {errors.address && ( + {errors.address} + )} +
+ +
+ + + {errors.pincode && ( + {errors.pincode} + )} +
+ +
+ + + {errors.department && ( + {errors.department} + )} +
+
+ )} + {activeStep === 2 && ( + +
+ + + {errors.date && ( + {errors.date} + )} +
+ +
+ + + {errors.report && ( + {errors.report} + )} +
+
+ + + {errors.reason && ( + {errors.reason} + )} +
+
+ )} + +
+ + + {activeStep === steps.length - 1 ? ( +
+ + + {/* + Back to Home + */} +
+ ) : ( + + )} +
+
+ + +
+
-
- - - {errors.date && {errors.date}} -
- -
- - - {errors.report && {errors.report}} -
- -
- - - - Back to Home - -
- - - {showModal && (
diff --git a/client/src/styles/OPD.css b/client/src/styles/OPD.css index f94e456..fa2872e 100644 --- a/client/src/styles/OPD.css +++ b/client/src/styles/OPD.css @@ -5,8 +5,9 @@ border-radius: 12px; box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15); - transition: background-color 0.3s ease, color 0.3s ease; - + transition: + background-color 0.3s ease, + color 0.3s ease; } .dark .form-container { @@ -66,8 +67,10 @@ input[type='file'] { font-size: 1rem; background-color: #f9f9f9; - transition: border-color 0.3s ease, background-color 0.3s ease, color 0.3s ease; - + transition: + border-color 0.3s ease, + background-color 0.3s ease, + color 0.3s ease; } .dark input[type='text'], @@ -91,7 +94,6 @@ input[type='date'] { .form-buttons { grid-column-start: 1; grid-column-end: 3; - } input:focus, @@ -236,7 +238,6 @@ input[type='file'] { .back-home-container { text-align: center; - } .back-btn { @@ -270,8 +271,9 @@ input[type='file'] { text-align: center; position: relative; - transition: background-color 0.3s ease, color 0.3s ease; - + transition: + background-color 0.3s ease, + color 0.3s ease; } .dark .modal-content { @@ -329,17 +331,26 @@ input[type='file'] { color: #f1f1f1; } - /* Dark mode date picker styling */ -input[type="date"].input-dark { +input[type='date'].input-dark { background-color: #333; color: #fff; border: 1px solid #ccc; } /* Light mode date picker styling */ -input[type="date"] { +input[type='date'] { background-color: #fff; color: #000; border: 1px solid #ccc; } + +.MuiBox-root { + display: flex; + justify-content: center; + flex-direction: column; + align-items: center; +} +.css-0{ + flex-direction: row; +} \ No newline at end of file