forked from adrianhajdin/healthcare
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppointmentModal.tsx
63 lines (56 loc) · 1.49 KB
/
AppointmentModal.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
"use client";
import { useState } from "react";
import { Button } from "@/components/ui/button";
import {
Dialog,
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
DialogTrigger,
} from "@/components/ui/dialog";
import { Appointment } from "@/types/appwrite.types";
import { AppointmentForm } from "./forms/AppointmentForm";
import "react-datepicker/dist/react-datepicker.css";
export const AppointmentModal = ({
patientId,
userId,
appointment,
type,
}: {
patientId: string;
userId: string;
appointment?: Appointment;
type: "schedule" | "cancel";
title: string;
description: string;
}) => {
const [open, setOpen] = useState(false);
return (
<Dialog open={open} onOpenChange={setOpen}>
<DialogTrigger asChild>
<Button
variant="ghost"
className={`capitalize ${type === "schedule" && "text-green-500"}`}
>
{type}
</Button>
</DialogTrigger>
<DialogContent className="shad-dialog sm:max-w-md">
<DialogHeader className="mb-4 space-y-3">
<DialogTitle className="capitalize">{type} Appointment</DialogTitle>
<DialogDescription>
Please fill in the following details to {type} appointment
</DialogDescription>
</DialogHeader>
<AppointmentForm
userId={userId}
patientId={patientId}
type={type}
appointment={appointment}
setOpen={setOpen}
/>
</DialogContent>
</Dialog>
);
};