diff --git a/frontend/src/pages/Doctors.jsx b/frontend/src/pages/Doctors.jsx
index 2788a72..7b67d73 100644
--- a/frontend/src/pages/Doctors.jsx
+++ b/frontend/src/pages/Doctors.jsx
@@ -43,21 +43,21 @@ const Doctors = () => {
const [selectedTime, setSelectedTime] = useState(null);
const modalRef = useRef(null);
- const [available, setAvailable] = useState({
- "08:00": true,
- "09:00": true,
- "10:00": true,
- "11:00": true,
- "12:00": true,
- "15:00": true,
- "16:00": true,
- "17:00": true,
- "18:00": true,
- });
+ const [available, setAvailable] = useState([
+ { time: "08:00", available: true },
+ { time: "09:00", available: true },
+ { time: "10:00", available: true },
+ { time: "11:00", available: true },
+ { time: "12:00", available: true },
+ { time: "15:00", available: true },
+ { time: "16:00", available: true },
+ { time: "17:00", available: true },
+ { time: "18:00", available: true },
+ ]);
const timings = Object.entries(available).map(([time, isAvailable]) => ({
time,
- available: isAvailable,
+ available: true,
}));
useEffect(() => {
@@ -73,6 +73,10 @@ const Doctors = () => {
handleTimings();
}, [isScheduleMeet, curDate]);
+ useEffect(() => {
+ console.log("available", available);
+ }, [available]);
+
useEffect(() => {
httpClient
.post("/get_wallet", {
@@ -155,10 +159,25 @@ const Doctors = () => {
.post("/set_appointment", { email: selectEmail })
.then((res) => {
const appointments = res.data.appointments;
- let times = { ...available };
+ let times = {
+ "08:00": true,
+ "09:00": true,
+ "10:00": true,
+ "11:00": true,
+ "12:00": true,
+ "15:00": true,
+ "16:00": true,
+ "17:00": true,
+ "18:00": true,
+ };
appointments
- .filter((item) => item.date === curDate)
+ .filter((item) => {
+ const itemDate = item.date.split("T")[0]; // Extract YYYY-MM-DD
+ const selectedDate = curDate.split("T")[0]; // Ensure same format
+ return itemDate === selectedDate;
+ })
.forEach((item) => {
+ console.log("item", item);
times[item.time] = false;
});
setAvailable(times);
@@ -362,7 +381,7 @@ const Doctors = () => {
);
setMeetModal(true);
}}
- className="px-4 py-2 bg-[#818CF8] text-white rounded hover:bg-[#6366F1]
+ className="px-4 py-2 bg-blue-3 text-white-1 rounded hover:bg-blue-7
transition-colors duration-200"
>
BOOK
@@ -411,18 +430,18 @@ const Doctors = () => {
};
return (
-
+
-
-
Doctor Details
+
+
Doctor Details
-
+
{
className="bg-white rounded-lg shadow-2xl w-full max-w-md p-6 relative bg-white-1"
ref={modalRef}
>
-
-
- Insufficient Balance
-
-
+ setMeetModal(false)}
/>
+
+ Insufficient Balance
+
- Doctor Fee
- ₹ {curFee}
+ Doctor Fee {`(${selectedDoc})`}
+ ₹ {curFee}
- Available Balance
- ₹ {balance}
+ Available Balance
+ ₹ {balance}
-
+
Required Amount
@@ -510,8 +531,7 @@ const Doctors = () => {