> For the complete documentation index, see [llms.txt](https://phitron.gitbook.io/django/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://phitron.gitbook.io/django/undefined-8/undefined-6.md).

# ১৮-৯ : এপয়নমেন্ট

গত মডিউলে আমরা মোডাল নিয়ে কাজ করেছি।মোডালের Take Appointment বাটনে ক্লিক করলে Appointment টি প্রসেস করার কাজটি এই মডিউলে করা হবে।

docDetails.js ফাইলে handleAppointment  ফাঙ্গশন নিচের মত করে  লিখে ফেলি-

<mark style="color:green;">**Code:: 18.9.1**</mark> \ <mark style="color:red;">docDetails.js</mark>

```javascript
...
...
...
    
const handleAppointment = () => {
  const param = new URLSearchParams(window.location.search).get("doctorId");
  const status = document.getElementsByName("status");
  const selected = Array.from(status).find((button) => button.checked);
  const symptom = document.getElementById("symptom").value;
  const time = document.getElementById("time-container");
  const selectedTime = time.options[time.selectedIndex];
  const patient_id = localStorage.getItem("patient_id");
  const info = {
    appointment_type: selected.value,
    appointment_status: "Pending",
    time: selectedTime.value,
    symptom: symptom,
    cancel: false,
    patient: patient_id,
    doctor: param,
  };

  console.log(info);
  fetch("https://testing-8az5.onrender.com/appointment/", {
    method: "POST",
    headers: { "content-type": "application/json" },
    body: JSON.stringify(info),
  })
    .then((res) => res.json())
    .then((data) => {
      window.location.href = `pdf.html?doctorId=${param}`;
      // handlePdf();
      // console.log(data);
    });
};

const loadPatientId = () => {
  const user_id = localStorage.getItem("user_id");

  fetch(`https://testing-8az5.onrender.com/patient/list/?user_id=${user_id}`)
    .then((res) => res.json())
    .then((data) => {
      localStorage.setItem("patient_id", data[0].id);
    });
};

 ...
 ...
 ...
 
 
```
