From 2257ad0222274275fe4d7ce28fbfd2220d11b548 Mon Sep 17 00:00:00 2001 From: yeasin2002 Date: Thu, 22 Aug 2024 17:54:46 +0600 Subject: [PATCH] feat: added doctors list --- global.d.ts | 4 +- src/Internationalization/languages/bn.json | 13 ++- src/Internationalization/languages/en.json | 17 ++-- .../{ => auth.actions}/doctor-auth.action.ts | 0 src/actions/auth.actions/index.ts | 2 + .../patient-auth.actions.ts | 0 .../doctor-mutations.actions.ts | 3 + .../doctors.actions/doctor-queries.actions.ts | 25 ++++++ src/actions/doctors.actions/index.ts | 2 + src/actions/index.ts | 2 - .../(user-auth)/login/logInForm.tsx | 2 +- src/app/[lang]/(front-end)/layout.tsx | 8 +- .../[doctorId]/DoctorIdNav.tsx | 0 .../[doctorId]/DoctorsProfile.tsx | 0 .../[doctorId]/page.tsx | 0 .../{doctors => our-doctors}/page.tsx | 4 +- .../(dashboard)/doctors/ShowDoctorList.tsx | 50 ++++++++++++ .../doctors/ShowPendingDoctors.tsx | 33 ++++++++ .../[lang]/admin/(dashboard)/doctors/page.tsx | 18 +++++ src/app/[lang]/admin/(dashboard)/page.tsx | 2 +- .../admin/(doctors-auth)/login/page.tsx | 2 +- .../admin/(doctors-auth)/register/page.tsx | 2 +- src/assets/images/VirusDisinfection.gif | Bin 0 -> 3512586 bytes src/components/Cards/TeamCard.tsx | 7 +- src/components/dashboard/DashboardNav.tsx | 2 +- src/components/dashboard/DoctorsCards.tsx | 27 +++++-- src/components/sections/Nav/LargeNav.tsx | 76 +++++++++++------- src/components/sections/Nav/index.tsx | 8 +- src/components/sections/OurTeam.tsx | 10 ++- src/model/Doctors.model.ts | 49 +++++------ src/model/index.ts | 11 ++- src/types/base.types.ts | 18 +++++ src/types/index.ts | 1 + 33 files changed, 307 insertions(+), 91 deletions(-) rename src/actions/{ => auth.actions}/doctor-auth.action.ts (100%) create mode 100644 src/actions/auth.actions/index.ts rename src/actions/{ => auth.actions}/patient-auth.actions.ts (100%) create mode 100644 src/actions/doctors.actions/doctor-mutations.actions.ts create mode 100644 src/actions/doctors.actions/doctor-queries.actions.ts create mode 100644 src/actions/doctors.actions/index.ts rename src/app/[lang]/(front-end)/{doctors => our-doctors}/[doctorId]/DoctorIdNav.tsx (100%) rename src/app/[lang]/(front-end)/{doctors => our-doctors}/[doctorId]/DoctorsProfile.tsx (100%) rename src/app/[lang]/(front-end)/{doctors => our-doctors}/[doctorId]/page.tsx (100%) rename src/app/[lang]/(front-end)/{doctors => our-doctors}/page.tsx (79%) create mode 100644 src/app/[lang]/admin/(dashboard)/doctors/ShowDoctorList.tsx create mode 100644 src/app/[lang]/admin/(dashboard)/doctors/ShowPendingDoctors.tsx create mode 100644 src/app/[lang]/admin/(dashboard)/doctors/page.tsx create mode 100644 src/assets/images/VirusDisinfection.gif create mode 100644 src/types/base.types.ts diff --git a/global.d.ts b/global.d.ts index 389b750..d88ac7f 100644 --- a/global.d.ts +++ b/global.d.ts @@ -5,8 +5,8 @@ import mongoose from "mongoose"; import globalThisType from "globalthis"; declare global { - var mongoose: typeof mongoose; - var globalThis: globalThisType; + const mongoose: typeof mongoose; + const globalThis: globalThisType; type InternationalizationType = | typeof bdLanguage diff --git a/src/Internationalization/languages/bn.json b/src/Internationalization/languages/bn.json index 1bcf3d8..dc67508 100644 --- a/src/Internationalization/languages/bn.json +++ b/src/Internationalization/languages/bn.json @@ -1,6 +1,6 @@ { "global": { - "name": "Rima's Dental", + "name": "রিমা'স ডেন্টাল", "login": "লগইন", "register": "রেজিস্টার" }, @@ -23,7 +23,8 @@ "home": "হোম", "about_us": "আমাদের সম্পর্কে", "services": "সার্ভিসসমূহ", - "login": "লগইন" + "login": "লগইন", + "dashboard": "ড্যাশবোর্ড" }, "home": { "hero": { @@ -62,7 +63,11 @@ "footerInfo": { "contact": { "title": "যোগাযোগ", - "value": ["০১৭৩১-৫১৯০২৫", "০১৫৩৩-৮৮১১০২", "০১৬৭৯-১১২৭২৫"] + "value": [ + "০১৭৩১-৫১৯০২৫", + "০১৫৩৩-৮৮১১০২", + "০১৬৭৯-১১২৭২৫" + ] }, "address": { "title": "ঠিকানা", @@ -136,4 +141,4 @@ "bookAppointment3": "ডাক্তারদের সাথে চিকিৎসা নিতে " } } -} +} \ No newline at end of file diff --git a/src/Internationalization/languages/en.json b/src/Internationalization/languages/en.json index 3d43fd4..b958d7e 100644 --- a/src/Internationalization/languages/en.json +++ b/src/Internationalization/languages/en.json @@ -1,8 +1,8 @@ { "global": { - "name": "রিমা'স ডেন্টাল", - "login": "লগইন", - "register": "রেজিস্টার" + "name": "Rima's Dental", + "login": "Login", + "register": "Register" }, "shared": { "appointment": { @@ -23,7 +23,8 @@ "home": "Home", "about_us": "About us", "services": "Services", - "login": "Login" + "login": "Login", + "dashboard": "Dashboard" }, "home": { "hero": { @@ -62,7 +63,11 @@ "footerInfo": { "contact": { "title": "Contact", - "value": ["01731-519025", "01533-881102", "01679-112725"] + "value": [ + "01731-519025", + "01533-881102", + "01679-112725" + ] }, "address": { "title": "Address", @@ -135,4 +140,4 @@ "bookAppointment3": "with doctor and get treatment." } } -} +} \ No newline at end of file diff --git a/src/actions/doctor-auth.action.ts b/src/actions/auth.actions/doctor-auth.action.ts similarity index 100% rename from src/actions/doctor-auth.action.ts rename to src/actions/auth.actions/doctor-auth.action.ts diff --git a/src/actions/auth.actions/index.ts b/src/actions/auth.actions/index.ts new file mode 100644 index 0000000..7609e0f --- /dev/null +++ b/src/actions/auth.actions/index.ts @@ -0,0 +1,2 @@ +export * from "./doctor-auth.action"; +export * from "./patient-auth.actions"; diff --git a/src/actions/patient-auth.actions.ts b/src/actions/auth.actions/patient-auth.actions.ts similarity index 100% rename from src/actions/patient-auth.actions.ts rename to src/actions/auth.actions/patient-auth.actions.ts diff --git a/src/actions/doctors.actions/doctor-mutations.actions.ts b/src/actions/doctors.actions/doctor-mutations.actions.ts new file mode 100644 index 0000000..11a3350 --- /dev/null +++ b/src/actions/doctors.actions/doctor-mutations.actions.ts @@ -0,0 +1,3 @@ +"use server"; + +export const updatePendingDoctors = () => {}; diff --git a/src/actions/doctors.actions/doctor-queries.actions.ts b/src/actions/doctors.actions/doctor-queries.actions.ts new file mode 100644 index 0000000..bec37c4 --- /dev/null +++ b/src/actions/doctors.actions/doctor-queries.actions.ts @@ -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, + }; + } +}; diff --git a/src/actions/doctors.actions/index.ts b/src/actions/doctors.actions/index.ts new file mode 100644 index 0000000..acd7ad5 --- /dev/null +++ b/src/actions/doctors.actions/index.ts @@ -0,0 +1,2 @@ +export * from "./doctor-queries.actions"; +export * from "./doctor-mutations.actions"; diff --git a/src/actions/index.ts b/src/actions/index.ts index 3fb907e..5c7f564 100644 --- a/src/actions/index.ts +++ b/src/actions/index.ts @@ -1,4 +1,2 @@ -export * from "./patient-auth.actions"; export * from "./sendingEmail.action"; export * from "./utils.actions"; -export * from "./doctor-auth.action"; diff --git a/src/app/[lang]/(front-end)/(user-auth)/login/logInForm.tsx b/src/app/[lang]/(front-end)/(user-auth)/login/logInForm.tsx index c362c33..c682b86 100644 --- a/src/app/[lang]/(front-end)/(user-auth)/login/logInForm.tsx +++ b/src/app/[lang]/(front-end)/(user-auth)/login/logInForm.tsx @@ -5,7 +5,7 @@ import { useForm } from "react-hook-form"; import Swal from "sweetalert2"; import toast from "react-hot-toast"; -import { loginPatient_server } from "@/actions"; +import { loginPatient_server } from "@/actions/auth.actions"; import { Email, InputCombo, InputComboForPassword, Lock } from "@/components"; import { loginFormSchema } from "@/schema"; import { loginFormData } from "@/types"; diff --git a/src/app/[lang]/(front-end)/layout.tsx b/src/app/[lang]/(front-end)/layout.tsx index b9d6bb8..9dacaac 100644 --- a/src/app/[lang]/(front-end)/layout.tsx +++ b/src/app/[lang]/(front-end)/layout.tsx @@ -2,6 +2,7 @@ import { Nav } from "@/components"; import { getDictionary } from "@/Internationalization"; import { authSession } from "@/lib/auth"; import React from "react"; +import { auth } from "@/auth"; const FrontEndLayout = async ({ children, @@ -11,12 +12,15 @@ const FrontEndLayout = async ({ params: { lang: string }; }>) => { const dic = await getDictionary(params.lang, "root_menu"); + const doctorSession = await auth(); const session = await authSession.getSession(); - console.log("🚀 ~ Patient Session:", session); + + // console.log("🚀 ~ doctor session:", doctorSession); + // console.log("🚀 ~Patient session:", session); return ( <> -