-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
46be3b2
commit 2257ad0
Showing
33 changed files
with
307 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./doctor-auth.action"; | ||
export * from "./patient-auth.actions"; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
"use server"; | ||
|
||
export const updatePendingDoctors = () => {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"use server"; | ||
|
||
import { db } from "@/model"; | ||
import { Doctor } from "@/types"; | ||
|
||
export const getAllDoctors = async () => { | ||
try { | ||
await db.connectDB(); | ||
const doctors: Doctor[] = | ||
(await db.Doctors.find({ isPending: false }).lean()) || []; | ||
const pendingDoctors: Doctor[] = | ||
(await db.Doctors.find({ isPending: true }).lean()) || []; | ||
|
||
return { | ||
success: true, | ||
message: "success", | ||
data: { doctors, pendingDoctors }, | ||
}; | ||
} catch (error: any) { | ||
return { | ||
success: false, | ||
message: error.message, | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./doctor-queries.actions"; | ||
export * from "./doctor-mutations.actions"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,2 @@ | ||
export * from "./patient-auth.actions"; | ||
export * from "./sendingEmail.action"; | ||
export * from "./utils.actions"; | ||
export * from "./doctor-auth.action"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
src/app/[lang]/admin/(dashboard)/doctors/ShowDoctorList.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import React from "react"; | ||
import { Button, DoctorsCards } from "@/components"; | ||
import { Doctor } from "@/types"; | ||
|
||
import virusDisinfection from "@/assets/images/VirusDisinfection.gif"; | ||
import Image from "next/image"; | ||
|
||
interface Props extends React.ComponentProps<"div"> { | ||
doctors: Doctor[]; | ||
} | ||
|
||
export const ShowDoctorList = ({ doctors, ...props }: Props) => { | ||
return ( | ||
<section className="p-4" {...props}> | ||
<div className="mt-2"> | ||
<div> | ||
<h1 className="font-grotesk text-4xl font-bold text-main-400 sm:text-5xl md:text-6xl lg:text-7xl"> | ||
Doctors | ||
</h1> | ||
<p> Your Devoted and Knowledgeable Doctors</p> | ||
</div> | ||
</div> | ||
<div> | ||
{doctors.length === 0 ? ( | ||
<div className="flex flex-col items-center justify-center"> | ||
<Image | ||
src={virusDisinfection} | ||
alt="No Doctor" | ||
className="size-72" | ||
/> | ||
<p className="font-grotesk text-xl font-bold text-zinc-800 sm:text-2xl md:text-3xl lg:text-4xl"> | ||
No doctors found | ||
</p> | ||
</div> | ||
) : ( | ||
<div className="grid grid-cols-2 gap-x-4"> | ||
{doctors.map((doctor) => ( | ||
<DoctorsCards | ||
className="max-w-full" | ||
imageClassName={"h-96"} | ||
key={doctor._id} | ||
data= {doctor} | ||
/> | ||
))} | ||
</div> | ||
)} | ||
</div> | ||
</section> | ||
); | ||
}; |
33 changes: 33 additions & 0 deletions
33
src/app/[lang]/admin/(dashboard)/doctors/ShowPendingDoctors.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import React from "react"; | ||
import { Button, DoctorsCards } from "@/components"; | ||
import { Doctor } from "@/types"; | ||
|
||
interface Props extends React.ComponentProps<"div"> { | ||
doctors: Doctor[]; | ||
} | ||
|
||
export const ShowPendingDoctorList = ({ doctors, ...props }: Props) => { | ||
if (doctors.length == 0) return ""; | ||
return ( | ||
<section className="p-4" {...props}> | ||
<div className="mt-2"> | ||
<div> | ||
<h1 className="font-grotesk text-4xl font-bold text-main-400 sm:text-5xl md:text-6xl lg:text-7xl"> | ||
Pending Doctors | ||
</h1> | ||
<p>Who registered as a doctor</p> | ||
</div> | ||
</div> | ||
<div className="mt-10 grid grid-cols-2 gap-x-4"> | ||
{doctors.map((doctor) => ( | ||
<DoctorsCards | ||
className="max-w-full" | ||
imageClassName={"h-96"} | ||
key={doctor._id} | ||
data= {doctor} | ||
/> | ||
))} | ||
</div> | ||
</section> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import { getAllDoctors } from "@/actions/doctors.actions/doctor-queries.actions"; | ||
|
||
import React from "react"; | ||
import { ShowDoctorList } from "./ShowDoctorList"; | ||
import { ShowPendingDoctorList } from "./ShowPendingDoctors"; | ||
|
||
const Doctors = async () => { | ||
const data = await getAllDoctors(); | ||
|
||
return ( | ||
<div> | ||
<ShowDoctorList doctors={data?.data?.doctors!} /> | ||
<ShowPendingDoctorList doctors={data?.data?.pendingDoctors!} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Doctors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.