diff --git a/src/api/api.js b/src/api/api.js index dc604a4..c8e0d9f 100644 --- a/src/api/api.js +++ b/src/api/api.js @@ -104,6 +104,16 @@ export const getDoctorAppointments = async (doctorId) => { } }; +export const verifyPaymentSuccess = async (orderId) => { + try { + const res = await API.get(`/payments/success/${orderId}`); + return res.data; + } catch (err) { + console.error("Error verifying payment:", err); + return null; + } +}; + /* ========================= ADMIN – APPOINTMENTS ========================= */ diff --git a/src/components/PatientPortal/AppointmentsCard.jsx b/src/components/PatientPortal/AppointmentsCard.jsx index 524c4f8..df5a2ad 100644 --- a/src/components/PatientPortal/AppointmentsCard.jsx +++ b/src/components/PatientPortal/AppointmentsCard.jsx @@ -1,6 +1,7 @@ import { useEffect, useState } from "react"; import { Activity, Video, User } from "lucide-react"; import BookingModal from "../../components/PatientPortal/bookings/BookingPage"; +import AppointmentsTable from "../../components/PatientPortal/bookings/AppointmentsTable"; import { getUserAppointments, getDoctorAppointments, confirmAppointmentDoctor } from "../../api/api.js"; const AppointmentsCard = ({ isDoctorView = false, doctorId = null }) => { @@ -117,6 +118,15 @@ const AppointmentsCard = ({ isDoctorView = false, doctorId = null }) => { {/* Body */} {loading ? (
Loading appointments...
+ ) : isDoctorView ? ( +No appointments found.
) : ( @@ -163,33 +173,6 @@ const AppointmentsCard = ({ isDoctorView = false, doctorId = null }) => { )} - - {/* Doctor Confirmation Input */} - {isDoctorView && - apt.appointmentStatus === "PENDING" && - apt.paymentStatus === "SUCCESS" && ( -Doctor: {a.doctorName}
-Specialty: {a.specialty}
-Type: {a.appointmentType}
-Date: {a.bookingDate}
-Time: {a.bookingTime}
-Status: {a.appointmentStatus}
-Payment: {a.paymentStatus}
-Location / Link: {a.locationOrLink}
- - {a.appointmentStatus === "PENDING" && - a.paymentStatus === "SUCCESS" && ( - <> - - setInput({ ...input, [a.id]: e.target.value }) - } - /> - - > - )} ++ Review all system bookings across all doctors and manually set locations or meeting links. +
+Loading system appointments...
+ ) : ( +When bookings are made, they will appear here.
+| # | +Patient Details | + {isAdminView &&Doctor | } +Date | +Time | +Type | +Status | +Link / Location | +Action | +
|---|---|---|---|---|---|---|---|---|
| {index + 1} | + + {/* Patient Info */} +
+
+
+
+
+
+
+ + {apt.patientName || "Unknown Patient"} + ++ {apt.reason || "No reason"} + + |
+
+ {/* Doctor Info (Admin View Only) */}
+ {isAdminView && (
+
+ {apt.doctorName || "—"} +{apt.specialty} + |
+ )}
+
+ {/* Date */}
+
+
+
+ |
+
+ {/* Time */}
+
+
+
+ |
+
+ {/* Type */}
+
+
+ {isOnline ? : |
+
+ {/* Status */}
+
+
+ {isPending ? |
+
+ {/* Link / Location Input */}
+
+ {apt.paymentStatus !== "SUCCESS" && isPending ? (
+ Waiting for Payment + ) : ( +
+ {!isPending && apt.locationOrLink && (
+
+ )}
+
+ )}
+
+ handleLinkChange(apt.appointmentId, e.target.value)}
+ className="flex-1 min-w-[180px] bg-gray-50 border border-gray-200 text-gray-700 text-xs rounded-lg px-3 py-2 focus:ring-2 focus:ring-blue-500 focus:border-transparent outline-none transition-all"
+ />
+
+
+ |
+
+ {/* Actions */}
+
+ {(isPending || apt.locationOrLink !== currentLinkValue) ? (
+
+ ) : (
+
+ |
+
- Specialty: {appointment.specialty} -
-- Type: {appointment.appointmentType} -
-- Consultation Fee: Rs.{appointment.consultationFee} -
-- Date: {appointment.bookingDate} -
-- Time: {appointment.bookingTime} -
-- Reason: {appointment.reason} -
-- Payment Status: {appointment.paymentStatus} -
-- Appointment Status: {appointment.appointmentStatus} -
+{appointment.specialty || "General"}
+- Location / Link: N/A -
- )} + {/* Footer: Actions */} +{error}
} + {appointment.locationOrLink ? ( + + ) : ( +{error}
}