From 7079591f842edf9cadc8d2cb710d4a871804b532 Mon Sep 17 00:00:00 2001 From: Harshitha Shetty <141444342+HarshithaShetty27@users.noreply.github.com> Date: Sat, 4 Jan 2025 23:50:59 +0530 Subject: [PATCH] Fixed backend issue, update course status working --- client/src/Pages/CourseForm.jsx | 7 +- client/src/Pages/CourseForm1.jsx | 392 ------------------------------- client/src/Pages/CourseTable.jsx | 83 ++----- client/src/api.js | 17 ++ server/models/Appointment.js | 9 + server/routes/courseRoutes.js | 35 +++ server/server.js | 34 +++ 7 files changed, 123 insertions(+), 454 deletions(-) delete mode 100644 client/src/Pages/CourseForm1.jsx diff --git a/client/src/Pages/CourseForm.jsx b/client/src/Pages/CourseForm.jsx index a78f3bb..d593359 100644 --- a/client/src/Pages/CourseForm.jsx +++ b/client/src/Pages/CourseForm.jsx @@ -1,6 +1,6 @@ import React, { useState, useEffect } from "react"; import { useLocation, useParams, useNavigate } from "react-router-dom"; -import { fetchFaculties, saveAppointment } from "../api"; +import { fetchFaculties, saveAppointment, updateCourseStatus } from "../api"; import "./CourseForm.css"; const CourseForm = () => { @@ -85,7 +85,7 @@ const CourseForm = () => { if (!groupedTasks[assignedFaculty.facultyId]) { groupedTasks[assignedFaculty.facultyId] = { facultyId: assignedFaculty.facultyId, - courseId: course?.id || id, + courseId: course?.courseId || id, tasks: [], }; } @@ -96,6 +96,7 @@ const CourseForm = () => { const payload = Object.values(groupedTasks); // Convert the grouped tasks into an array console.log("Saving appointment with payload:", payload); await saveAppointment(payload); // Save to backend + await updateCourseStatus(course?.courseId || id); console.log("Form submitted successfully:", payload); // Redirect to courses page after successful submission @@ -119,7 +120,7 @@ const CourseForm = () => {