diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php index 5d3c59e..48c68af 100644 --- a/app/Http/Controllers/AdminController.php +++ b/app/Http/Controllers/AdminController.php @@ -38,4 +38,16 @@ class AdminController extends Controller { return view('booksPublished.index'); } + public function viewExternalEngagementResponses() + { + return view('externalEngagement.index'); + } + public function viewOnlineCoursesResponses() + { + return view('onlineCourses.index'); + } + public function viewPatentsResponses() + { + return view('patents.index'); + } } diff --git a/app/Http/Controllers/CoordinatorController.php b/app/Http/Controllers/CoordinatorController.php index 455774e..5feb1e6 100644 --- a/app/Http/Controllers/CoordinatorController.php +++ b/app/Http/Controllers/CoordinatorController.php @@ -41,4 +41,17 @@ class CoordinatorController extends Controller return view('booksPublished.index'); } + public function viewExternalEngagementResponses() + { + return view('externalEngagement.index'); + } + public function viewOnlineCoursesResponses() + { + return view('onlineCourses.index'); + } + public function viewPatentsResponses() + { + return view('patents.index'); + } + } diff --git a/app/Http/Controllers/ExternalEngagementController.php b/app/Http/Controllers/ExternalEngagementController.php new file mode 100644 index 0000000..f1f05e0 --- /dev/null +++ b/app/Http/Controllers/ExternalEngagementController.php @@ -0,0 +1,227 @@ +validate([ + 'activity' => 'required|string', + 'activity_description' => 'required|string', + 'inviting_organization' => 'required|string', + 'start_date' => 'required|date', + 'end_date' => 'required|date', + 'num_days' => 'required|integer', + 'proof' => 'nullable|mimes:jpg,jpeg,png,pdf,doc,docx,zip', + ]); + + // Handle the file upload if a new file is provided + if ($request->hasFile('proof')) { + // Delete old file if exists + if ($externalEngagement->proof && Storage::disk('public')->exists($externalEngagement->proof)) { + Storage::disk('public')->delete($externalEngagement->proof); + } + + // Extract year from start_date + $year = date('Y', strtotime($validated['start_date'])); + $username = $externalEngagement->user->name; + + $originalName = $request->file('proof')->getClientOriginalName(); + $fileName = $username . '_' . $originalName; + + // Create path structure: year/faculty_name + $folderPath = 'proofs/' . $year . '/' . $username . '/External Engagement'; + + // Store file in the specified path + $proofPath = $request->file('proof')->storeAs($folderPath, $fileName, 'public'); + + $externalEngagement->proof = $proofPath; + } + + + // Update other fields + $externalEngagement->activity = $validated['activity']; + $externalEngagement->activity_description = $validated['activity_description']; + $externalEngagement->inviting_organization = $validated['inviting_organization']; + $externalEngagement->start_date = $validated['start_date']; + $externalEngagement->end_date = $validated['end_date']; + $externalEngagement->num_days = $validated['num_days']; + + $externalEngagement->save(); + + $userRole = auth()->user()->role->name; + + if ($userRole === 'Admin') { + return redirect()->route('admin.ExternalEngagementResponses') + ->with('status', 'External Engagement updated successfully'); + } elseif ($userRole === 'Coordinator') { + return redirect()->route('coordinator.ExternalEngagementResponses') + ->with('status', 'External Engagement updated successfully'); + } else { + // For regular users + return redirect()->route('faculty.ExternalEngagementResponses') + ->with('status', 'External Engagement updated successfully'); + } + } + + public function destroy($id) + { + $externalEngagement = ExternalEngagement::findOrFail($id); + + // Delete the file if it exists + if ($externalEngagement->proof && Storage::disk('public')->exists($externalEngagement->proof)) { + Storage::disk('public')->delete($externalEngagement->proof); + } + + $externalEngagement->delete(); + + return response()->json(['success' => 'External Engagement record deleted successfully']); + } + + public function getExternalEngagementResponses() + { + $user = auth()->user(); + $isAdmin = $user->role->name === 'Admin'; + $isCoordinator = $user->role->name === 'Coordinator'; + + // Query based on role + if ($isAdmin) { + // Admin sees all records + $externalEngagements = ExternalEngagement::with('user', 'department'); + } elseif ($isCoordinator) { + // Coordinator sees only their department's records + $externalEngagements = ExternalEngagement::with('user', 'department') + ->whereHas('user', function ($query) use ($user) { + $query->where('department_id', $user->department_id); + }); + } else { + // Regular users see only their own records + $externalEngagements = ExternalEngagement::with('user', 'department') + ->where('faculty_id', $user->id); + } + + + return DataTables::of($externalEngagements) + ->addColumn('user_name', function ($externalEngagement) { + return $externalEngagement->user->name ?? 'Unknown'; + }) + ->addColumn('department_name', function ($externalEngagement) { + return $externalEngagement->department->name ?? 'Unknown'; + }) + ->addColumn('activity', function ($externalEngagement) { + return $externalEngagement->activity ?? 'Unknown'; + }) + ->addColumn('activity_description', function ($externalEngagement) { + return $externalEngagement->activity_description ?? 'Unknown'; + }) + ->addColumn('inviting_organization', function ($externalEngagement) { + return $externalEngagement->inviting_organization ?? 'Unknown'; + }) + ->addColumn('start_date', function ($externalEngagement) { + return \Carbon\Carbon::parse($externalEngagement->start_date)->format('d-m-Y'); + }) + ->addColumn('end_date', function ($externalEngagement) { + return \Carbon\Carbon::parse($externalEngagement->end_date)->format('d-m-Y'); + }) + ->addColumn('num_days', function ($externalEngagement) { + return $externalEngagement->num_days ?? 'Unknown'; + }) + ->addColumn('action', function ($externalEngagement) { + $actions = []; + + // View proof button for everyone + if ($externalEngagement->proof) { + $actions[] = 'View'; + } else { + $actions[] = 'No Proof'; + } + + // Edit button with role-appropriate route + $userRole = auth()->user()->role->name; + // Determine the appropriate route based on user role + if ($userRole === 'Admin') { + $editRoute = route('admin.ExternalEngagement.edit', $externalEngagement->id); + } elseif ($userRole === 'Coordinator') { + $editRoute = route('coordinator.ExternalEngagement.edit', $externalEngagement->id); + } else { + $editRoute = route('faculty.ExternalEngagement.edit', $externalEngagement->id); + } + + $actions[] = 'Edit'; + + $deleteRoute = route('externalEngagement.destroy', $externalEngagement->id); + $actions[] = ''; + + return implode(' ', $actions); + }) + ->rawColumns(['action']) + ->make(true); + } + + public function store(Request $request) + { + // Validate the request data + $validated = $request->validate([ + 'activity' => 'required|string', + 'activity_description' => 'required|string', + 'inviting_organization' => 'required|string', + 'start_date' => 'required|date', + 'end_date' => 'required|date', + 'num_days' => 'required|integer', + 'faculty_id' => 'required|exists:users,id', + 'department_id' => 'required|exists:departments,id', + 'proof' => 'nullable|mimes:jpg,jpeg,png,pdf,doc,docx,zip', + ]); + + // Create new record + $externalEngagement = new ExternalEngagement(); + $externalEngagement->activity = $validated['activity']; + $externalEngagement->activity_description = $validated['activity_description']; + $externalEngagement->inviting_organization = $validated['inviting_organization']; + $externalEngagement->start_date = $validated['start_date']; + $externalEngagement->end_date = $validated['end_date']; + $externalEngagement->num_days = $validated['num_days']; + $externalEngagement->faculty_id = $validated['faculty_id']; + $externalEngagement->department_id = $validated['department_id']; + + // Handle the file upload + if ($request->hasFile('proof')) { + $user = auth()->user(); + $year = date('Y', strtotime($validated['start_date'])); + $username = $user->name; + + $originalName = $request->file('proof')->getClientOriginalName(); + $fileName = $username . '_' . $originalName; + + // Create path structure: year/faculty_name + $folderPath = 'proofs/' . $year . '/' . $username . '/External Engagement'; + + // Store file in the specified path + $proofPath = $request->file('proof')->storeAs($folderPath, $fileName, 'public'); + + $externalEngagement->proof = $proofPath; + } + + $externalEngagement->save(); + + return redirect()->route('faculty.ExternalEngagementResponses') + ->with('status', 'External Engagement submitted successfully'); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/FacultyController.php b/app/Http/Controllers/FacultyController.php index b691e04..aa27aaf 100644 --- a/app/Http/Controllers/FacultyController.php +++ b/app/Http/Controllers/FacultyController.php @@ -6,7 +6,10 @@ use Illuminate\Http\Request; use App\Models\ActivitiesAttended; use App\Models\ActivitiesOrganised; use App\Models\BooksPublished; +use App\Models\ExternalEngagement; use App\Models\IvOrganised; +use App\Models\OnlineCourse; +use App\Models\Patent; use App\Models\Publication; class FacultyController extends Controller @@ -72,6 +75,41 @@ class FacultyController extends Controller return view('booksPublished.index'); } + public function ExternalEngagementForm() + { + // Logic to show the response form + return view('faculty.externalEngagement-form'); + } + + public function viewExternalEngagementResponses() + { + return view('externalEngagement.index'); + } + + public function OnlineCoursesForm() + { + // Logic to show the response form + return view('faculty.onlineCourses-form'); + } + + public function viewOnlineCoursesResponses() + { + return view('onlineCourses.index'); + } + + public function PatentsForm() + { + // Logic to show the response form + return view('faculty.patents-form'); + } + + public function viewPatentsResponses() + { + return view('patents.index'); + } + + + public function ActivitiesAttendedFormResponse(Request $request) { try { @@ -410,4 +448,170 @@ class FacultyController extends Controller return back()->withErrors(['error' => 'An error occurred: ' . $e->getMessage()])->withInput(); } } + public function ExternalEngagementFormResponse(Request $request) + { + // dd($request->all()); + try { + // Validate the request data + $validated = $request->validate([ + 'activity' => 'required|string', + 'activity_description' => 'required|string', + 'inviting_organization' => 'required|string', + 'start_date' => 'required|date', + 'end_date' => 'required|date', + 'num_days' => 'required|integer', + 'proof' => 'nullable|mimes:jpg,jpeg,png,pdf,doc,docx,zip' + ]); + + // Handle the file upload + $proofFilePath = null; + if ($request->hasFile('proof')) { + $originalName = $request->file('proof')->getClientOriginalName(); + $username = auth()->user()->name; + $fileName = $username . '_' . $originalName; + + // Extract year from start_date + $year = date('Y', strtotime($validated['start_date'])); + + // Create path structure: year/faculty_name/Publications + $folderPath = 'proofs/' . $year . '/' . $username . '/External Engagement'; + + // Store file in the specified path + $proofFilePath = $request->file('proof')->storeAs($folderPath, $fileName, 'public'); + } + // dd($proofFilePath); + + // Save the response to the database + ExternalEngagement::create([ + 'department_id' => auth()->user()->department->id, + 'activity' => $validated['activity'], + 'activity_description' => $validated['activity_description'], + 'inviting_organization' => $validated['inviting_organization'], + 'start_date' => $validated['start_date'], + 'end_date' => $validated['end_date'], + 'num_days' => $validated['num_days'], + 'proof' => $proofFilePath, + 'faculty_id' => auth()->user()->id, + ]); + + return redirect()->route('faculty.dashboard')->with('status', 'External Engagement details submitted successfully'); + } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) { + return back()->withErrors(['error' => 'External Engagement not found.']); + } catch (\Illuminate\Validation\ValidationException $e) { + return back()->withErrors($e->validator)->withInput(); + } catch (\Exception $e) { + return back()->withErrors(['error' => 'An error occurred: ' . $e->getMessage()])->withInput(); + } + } + public function OnlineCoursesFormResponse(Request $request) + { + // dd($request->all()); + try { + // Validate the request data + $validated = $request->validate([ + 'course' => 'required|string', + 'offered_by' => 'required|string', + 'start_date' => 'required|date', + 'end_date' => 'required|date', + 'num_days' => 'required|integer', + 'proof' => 'nullable|mimes:jpg,jpeg,png,pdf,doc,docx,zip', + ]); + + // Handle the file upload + $proofFilePath = null; + if ($request->hasFile('proof')) { + $originalName = $request->file('proof')->getClientOriginalName(); + $username = auth()->user()->name; + $fileName = $username . '_' . $originalName; + + // Extract year from start_date + $year = date('Y', strtotime($validated['start_date'])); + + // Create path structure: year/faculty_name/Publications + $folderPath = 'proofs/' . $year . '/' . $username . '/Online Course'; + + // Store file in the specified path + $proofFilePath = $request->file('proof')->storeAs($folderPath, $fileName, 'public'); + } + // dd($proofFilePath); + + // Save the response to the database + OnlineCourse::create([ + 'department_id' => auth()->user()->department->id, + 'course' => $validated['course'], + 'offered_by' => $validated['offered_by'], + 'start_date' => $validated['start_date'], + 'end_date' => $validated['end_date'], + 'num_days' => $validated['num_days'], + 'proof' => $proofFilePath, + 'faculty_id' => auth()->user()->id, + ]); + + return redirect()->route('faculty.dashboard')->with('status', 'Online Course details submitted successfully'); + } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) { + return back()->withErrors(['error' => 'Online Course not found.']); + } catch (\Illuminate\Validation\ValidationException $e) { + return back()->withErrors($e->validator)->withInput(); + } catch (\Exception $e) { + return back()->withErrors(['error' => 'An error occurred: ' . $e->getMessage()])->withInput(); + } + } + public function PatentsFormResponse(Request $request) + { + // dd($request->all()); + try { + // Validate the request data + $validated = $request->validate([ + 'title' => 'required|string', + 'investigator' => 'required|string', + 'application_no' => 'required|string', + 'type' => 'required|string', + 'date_of_submission' => 'required|date', + 'date_of_filling' => 'required|date', + 'status' => 'required|string', + 'proof' => 'nullable|mimes:jpg,jpeg,png,pdf,doc,docx,zip', + ]); + + // Handle the file upload + $proofFilePath = null; + if ($request->hasFile('proof')) { + $originalName = $request->file('proof')->getClientOriginalName(); + $username = auth()->user()->name; + $fileName = $username . '_' . $originalName; + + // Extract year from start_date + $year = date('Y', strtotime($validated['date_of_submission'])); + + // Create path structure: year/faculty_name/Publications + $folderPath = 'proofs/' . $year . '/' . $username . '/Patents'; + + // Store file in the specified path + $proofFilePath = $request->file('proof')->storeAs($folderPath, $fileName, 'public'); + } + // dd($proofFilePath); + + + // Save the response to the database + Patent::create([ + 'department_id' => auth()->user()->department->id, + 'title' => $validated['title'], + 'investigator' => $validated['investigator'], + 'application_no' => $validated['application_no'], + 'type' => $validated['type'], + 'date_of_submission' => $validated['date_of_submission'], + 'date_of_filling' => $validated['date_of_filling'], + 'status' => $validated['status'], + 'proof' => $proofFilePath, + 'faculty_id' => auth()->user()->id, + ]); + + return redirect()->route('faculty.dashboard')->with('status', 'Patent/Copyright details submitted successfully'); + } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $e) { + return back()->withErrors(['error' => 'Patent/Copyright not found.']); + } catch (\Illuminate\Validation\ValidationException $e) { + return back()->withErrors($e->validator)->withInput(); + } catch (\Exception $e) { + return back()->withErrors(['error' => 'An error occurred: ' . $e->getMessage()])->withInput(); + } + } } diff --git a/app/Http/Controllers/OnlineCoursesController.php b/app/Http/Controllers/OnlineCoursesController.php new file mode 100644 index 0000000..a36004c --- /dev/null +++ b/app/Http/Controllers/OnlineCoursesController.php @@ -0,0 +1,220 @@ +validate([ + 'course' => 'required|string', + 'offered_by' => 'required|string', + 'start_date' => 'required|date', + 'end_date' => 'required|date', + 'num_days' => 'required|integer', + 'proof' => 'nullable|mimes:jpg,jpeg,png,pdf,doc,docx,zip', + ]); + + // Handle the file upload if a new file is provided + if ($request->hasFile('proof')) { + // Delete old file if exists + if ($onlineCourse->proof && Storage::disk('public')->exists($onlineCourse->proof)) { + Storage::disk('public')->delete($onlineCourse->proof); + } + + // Extract year from start_date + $year = date('Y', strtotime($validated['start_date'])); + $username = $onlineCourse->user->name; + + $originalName = $request->file('proof')->getClientOriginalName(); + $fileName = $username . '_' . $originalName; + + // Create path structure: year/faculty_name + $folderPath = 'proofs/' . $year . '/' . $username . '/Online Courses'; + + // Store file in the specified path + $proofPath = $request->file('proof')->storeAs($folderPath, $fileName, 'public'); + + $onlineCourse->proof = $proofPath; + } + + + // Update other fields + $onlineCourse->course = $validated['course']; + $onlineCourse->offered_by = $validated['offered_by']; + $onlineCourse->start_date = $validated['start_date']; + $onlineCourse->end_date = $validated['end_date']; + $onlineCourse->num_days = $validated['num_days']; + + $onlineCourse->save(); + + $userRole = auth()->user()->role->name; + + if ($userRole === 'Admin') { + return redirect()->route('admin.OnlineCoursesResponses') + ->with('status', 'online Course updated successfully'); + } elseif ($userRole === 'Coordinator') { + return redirect()->route('coordinator.OnlineCoursesResponses') + ->with('status', 'online Course updated successfully'); + } else { + // For regular users + return redirect()->route('faculty.OnlineCoursesResponses') + ->with('status', 'online Course updated successfully'); + } + } + + public function destroy($id) + { + $onlineCourse = OnlineCourse::findOrFail($id); + + // Delete the file if it exists + if ($onlineCourse->proof && Storage::disk('public')->exists($onlineCourse->proof)) { + Storage::disk('public')->delete($onlineCourse->proof); + } + + $onlineCourse->delete(); + + return response()->json(['success' => 'online Course record deleted successfully']); + } + + public function getOnlineCoursesResponses() + { + $user = auth()->user(); + $isAdmin = $user->role->name === 'Admin'; + $isCoordinator = $user->role->name === 'Coordinator'; + + // Query based on role + if ($isAdmin) { + // Admin sees all records + $onlineCourses = OnlineCourse::with('user', 'department'); + } elseif ($isCoordinator) { + // Coordinator sees only their department's records + $onlineCourses = OnlineCourse::with('user', 'department') + ->whereHas('user', function ($query) use ($user) { + $query->where('department_id', $user->department_id); + }); + } else { + // Regular users see only their own records + $onlineCourses = OnlineCourse::with('user', 'department') + ->where('faculty_id', $user->id); + } + + + return DataTables::of($onlineCourses) + ->addColumn('user_name', function ($onlineCourse) { + return $onlineCourse->user->name ?? 'Unknown'; + }) + ->addColumn('department_name', function ($onlineCourse) { + return $onlineCourse->department->name ?? 'Unknown'; + }) + ->addColumn('course', function ($onlineCourse) { + return $onlineCourse->course ?? 'Unknown'; + }) + ->addColumn('offered_by', function ($onlineCourse) { + return $onlineCourse->offered_by ?? 'Unknown'; + }) + ->addColumn('start_date', function ($onlineCourse) { + return \Carbon\Carbon::parse($onlineCourse->start_date)->format('d-m-Y'); + }) + ->addColumn('end_date', function ($onlineCourse) { + return \Carbon\Carbon::parse($onlineCourse->end_date)->format('d-m-Y'); + }) + ->addColumn('num_days', function ($onlineCourse) { + return $onlineCourse->num_days ?? 'Unknown'; + }) + ->addColumn('action', function ($onlineCourse) { + $actions = []; + + // View proof button for everyone + if ($onlineCourse->proof) { + $actions[] = 'View'; + } else { + $actions[] = 'No Proof'; + } + + // Edit button with role-appropriate route + $userRole = auth()->user()->role->name; + // Determine the appropriate route based on user role + if ($userRole === 'Admin') { + $editRoute = route('admin.OnlineCourses.edit', $onlineCourse->id); + } elseif ($userRole === 'Coordinator') { + $editRoute = route('coordinator.OnlineCourses.edit', $onlineCourse->id); + } else { + $editRoute = route('faculty.OnlineCourses.edit', $onlineCourse->id); + } + + $actions[] = 'Edit'; + + $deleteRoute = route('onlineCourses.destroy', $onlineCourse->id); + $actions[] = ''; + + return implode(' ', $actions); + }) + ->rawColumns(['action']) + ->make(true); + } + + public function store(Request $request) + { + // Validate the request data + $validated = $request->validate([ + 'course' => 'required|string', + 'offered_by' => 'required|string', + 'start_date' => 'required|date', + 'end_date' => 'required|date', + 'num_days' => 'required|integer', + 'faculty_id' => 'required|exists:users,id', + 'department_id' => 'required|exists:departments,id', + 'proof' => 'nullable|mimes:jpg,jpeg,png,pdf,doc,docx,zip', + ]); + + // Create new record + $onlineCourse = new OnlineCourse(); + $onlineCourse->course = $validated['course']; + $onlineCourse->offered_by = $validated['offered_by']; + $onlineCourse->start_date = $validated['start_date']; + $onlineCourse->end_date = $validated['end_date']; + $onlineCourse->num_days = $validated['num_days']; + $onlineCourse->faculty_id = $validated['faculty_id']; + $onlineCourse->department_id = $validated['department_id']; + + // Handle the file upload + if ($request->hasFile('proof')) { + $user = auth()->user(); + $year = date('Y', strtotime($validated['start_date'])); + $username = $user->name; + + $originalName = $request->file('proof')->getClientOriginalName(); + $fileName = $username . '_' . $originalName; + + // Create path structure: year/faculty_name + $folderPath = 'proofs/' . $year . '/' . $username . '/Online Courses'; + + // Store file in the specified path + $proofPath = $request->file('proof')->storeAs($folderPath, $fileName, 'public'); + + $onlineCourse->proof = $proofPath; + } + + $onlineCourse->save(); + + return redirect()->route('faculty.OnlineCoursesResponses') + ->with('status', 'online Course submitted successfully'); + } + +} \ No newline at end of file diff --git a/app/Http/Controllers/PatentsController.php b/app/Http/Controllers/PatentsController.php new file mode 100644 index 0000000..3ed5b79 --- /dev/null +++ b/app/Http/Controllers/PatentsController.php @@ -0,0 +1,235 @@ +validate([ + 'title' => 'required|string', + 'investigator' => 'required|string', + 'application_no' => 'required|string', + 'type' => 'required|string', + 'date_of_submission' => 'required|date', + 'date_of_filling' => 'required|date', + 'status' => 'required|string', + 'proof' => 'nullable|mimes:jpg,jpeg,png,pdf,doc,docx,zip', + ]); + + // Handle the file upload if a new file is provided + if ($request->hasFile('proof')) { + // Delete old file if exists + if ($patent->proof && Storage::disk('public')->exists($patent->proof)) { + Storage::disk('public')->delete($patent->proof); + } + + // Extract year from start_date + $year = date('Y', strtotime($validated['date_of_submission'])); + $username = $patent->user->name; + + $originalName = $request->file('proof')->getClientOriginalName(); + $fileName = $username . '_' . $originalName; + + // Create path structure: year/faculty_name + $folderPath = 'proofs/' . $year . '/' . $username . '/Patents'; + + // Store file in the specified path + $proofPath = $request->file('proof')->storeAs($folderPath, $fileName, 'public'); + + $patent->proof = $proofPath; + } + + + // Update other fields + $patent->title = $validated['title']; + $patent->investigator = $validated['investigator']; + $patent->application_no = $validated['application_no']; + $patent->type = $validated['type']; + $patent->date_of_submission = $validated['date_of_submission']; + $patent->date_of_filling = $validated['date_of_filling']; + $patent->status = $validated['status']; + + $patent->save(); + + $userRole = auth()->user()->role->name; + + if ($userRole === 'Admin') { + return redirect()->route('admin.PatentsResponses') + ->with('status', 'patent updated successfully'); + } elseif ($userRole === 'Coordinator') { + return redirect()->route('coordinator.PatentsResponses') + ->with('status', 'patent updated successfully'); + } else { + // For regular users + return redirect()->route('faculty.PatentsResponses') + ->with('status', 'patent updated successfully'); + } + } + + public function destroy($id) + { + $patent = Patent::findOrFail($id); + + // Delete the file if it exists + if ($patent->proof && Storage::disk('public')->exists($patent->proof)) { + Storage::disk('public')->delete($patent->proof); + } + + $patent->delete(); + + return response()->json(['success' => 'patent record deleted successfully']); + } + + public function getPatentsResponses() + { + $user = auth()->user(); + $isAdmin = $user->role->name === 'Admin'; + $isCoordinator = $user->role->name === 'Coordinator'; + + // Query based on role + if ($isAdmin) { + // Admin sees all records + $patents = Patent::with('user', 'department'); + } elseif ($isCoordinator) { + // Coordinator sees only their department's records + $patents = Patent::with('user', 'department') + ->whereHas('user', function ($query) use ($user) { + $query->where('department_id', $user->department_id); + }); + } else { + // Regular users see only their own records + $patents = Patent::with('user', 'department') + ->where('faculty_id', $user->id); + } + + + return DataTables::of($patents) + ->addColumn('user_name', function ($patent) { + return $patent->user->name ?? 'Unknown'; + }) + ->addColumn('department_name', function ($patent) { + return $patent->department->name ?? 'Unknown'; + }) + ->addColumn('title', function ($patent) { + return $patent->title ?? 'Unknown'; + }) + ->addColumn('investigator', function ($patent) { + return $patent->investigator ?? 'Unknown'; + }) + ->addColumn('application_no', function ($patent) { + return $patent->application_no ?? 'Unknown'; + }) + ->addColumn('type', function ($patent) { + return $patent->type ?? 'Unknown'; + }) + ->addColumn('date_of_submission', function ($patent) { + return \Carbon\Carbon::parse($patent->date_of_submission)->format('d-m-Y'); + }) + ->addColumn('date_of_filling', function ($patent) { + return \Carbon\Carbon::parse($patent->date_of_filling)->format('d-m-Y'); + }) + ->addColumn('status', function ($patent) { + return $patent->status ?? 'Unknown'; + }) + ->addColumn('action', function ($patent) { + $actions = []; + + // View proof button for everyone + if ($patent->proof) { + $actions[] = 'View'; + } else { + $actions[] = 'No Proof'; + } + + // Edit button with role-appropriate route + $userRole = auth()->user()->role->name; + // Determine the appropriate route based on user role + if ($userRole === 'Admin') { + $editRoute = route('admin.Patents.edit', $patent->id); + } elseif ($userRole === 'Coordinator') { + $editRoute = route('coordinator.Patents.edit', $patent->id); + } else { + $editRoute = route('faculty.Patents.edit', $patent->id); + } + + $actions[] = 'Edit'; + + $deleteRoute = route('patents.destroy', $patent->id); + $actions[] = ''; + + return implode(' ', $actions); + }) + ->rawColumns(['action']) + ->make(true); + } + + public function store(Request $request) + { + // Validate the request data + $validated = $request->validate([ + 'title' => 'required|string', + 'investigator' => 'required|string', + 'application_no' => 'required|string', + 'type' => 'required|string', + 'date_of_submission' => 'required|date', + 'date_of_filling' => 'required|date', + 'status' => 'required|string', + 'faculty_id' => 'required|exists:users,id', + 'department_id' => 'required|exists:departments,id', + 'proof' => 'nullable|mimes:jpg,jpeg,png,pdf,doc,docx,zip', + ]); + + // Create new record + $patent = new Patent(); + $patent->title = $validated['title']; + $patent->investigator = $validated['investigator']; + $patent->application_no = $validated['application_no']; + $patent->type = $validated['type']; + $patent->date_of_submission = $validated['date_of_submission']; + $patent->date_of_filling = $validated['date_of_filling']; + $patent->status = $validated['status']; + $patent->faculty_id = $validated['faculty_id']; + $patent->department_id = $validated['department_id']; + + // Handle the file upload + if ($request->hasFile('proof')) { + $user = auth()->user(); + $year = date('Y', strtotime($validated['date_of_submission'])); + $username = $user->name; + + $originalName = $request->file('proof')->getClientOriginalName(); + $fileName = $username . '_' . $originalName; + + // Create path structure: year/faculty_name + $folderPath = 'proofs/' . $year . '/' . $username . '/Patents'; + + // Store file in the specified path + $proofPath = $request->file('proof')->storeAs($folderPath, $fileName, 'public'); + + $patent->proof = $proofPath; + } + + $patent->save(); + + return redirect()->route('faculty.PatentsResponses') + ->with('status', 'patent submitted successfully'); + } + +} \ No newline at end of file diff --git a/app/Models/ExternalEngagement.php b/app/Models/ExternalEngagement.php new file mode 100644 index 0000000..2609a18 --- /dev/null +++ b/app/Models/ExternalEngagement.php @@ -0,0 +1,40 @@ + 'date', + 'end_date' => 'date', + ]; + + // Relationship with User (Faculty) + public function user() + { + return $this->belongsTo(User::class, 'faculty_id'); + } + + // Relationship with Department + public function department() + { + return $this->belongsTo(Department::class, 'department_id'); + } +} \ No newline at end of file diff --git a/app/Models/OnlineCourse.php b/app/Models/OnlineCourse.php new file mode 100644 index 0000000..3a6c361 --- /dev/null +++ b/app/Models/OnlineCourse.php @@ -0,0 +1,39 @@ + 'date', + 'end_date' => 'date', + ]; + + // Relationship with User (Faculty) + public function user() + { + return $this->belongsTo(User::class, 'faculty_id'); + } + + // Relationship with Department + public function department() + { + return $this->belongsTo(Department::class, 'department_id'); + } +} \ No newline at end of file diff --git a/app/Models/Patent.php b/app/Models/Patent.php new file mode 100644 index 0000000..00fa675 --- /dev/null +++ b/app/Models/Patent.php @@ -0,0 +1,37 @@ +belongsTo(User::class, 'faculty_id'); + } + + // Relationship with Department + public function department() + { + return $this->belongsTo(Department::class, 'department_id'); + } +} \ No newline at end of file diff --git a/database/migrations/2025_04_01_181810_create_external_engagements_table.php b/database/migrations/2025_04_01_181810_create_external_engagements_table.php new file mode 100644 index 0000000..6f4be80 --- /dev/null +++ b/database/migrations/2025_04_01_181810_create_external_engagements_table.php @@ -0,0 +1,46 @@ +id(); + $table->unsignedBigInteger('department_id'); + $table->unsignedBigInteger('faculty_id'); // Faculty who uploaded the publication + + $table->string('activity'); + $table->text('activity_description'); + $table->string('inviting_organization'); + $table->date('start_date'); + $table->date('end_date'); + $table->integer('num_days'); + $table->string('proof')->nullable(); // For file path + + // Foreign keys + $table->foreign('department_id')->references('id')->on('departments')->onDelete('cascade'); + $table->foreign('faculty_id')->references('id')->on('users')->onDelete('cascade'); + + // Indexes for better performance + $table->index('department_id'); + $table->index('faculty_id'); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('external_engagements_'); + } +}; diff --git a/database/migrations/2025_04_01_182552_create_online_courses_table.php b/database/migrations/2025_04_01_182552_create_online_courses_table.php new file mode 100644 index 0000000..eb1e7ec --- /dev/null +++ b/database/migrations/2025_04_01_182552_create_online_courses_table.php @@ -0,0 +1,46 @@ +id(); + $table->unsignedBigInteger('department_id'); + $table->unsignedBigInteger('faculty_id'); // Faculty who uploaded the publication + + $table->string('course'); + $table->string('offered_by'); + $table->date('start_date'); + $table->date('end_date'); + $table->integer('num_days'); + $table->string('proof')->nullable(); // For file path + + + // Foreign keys + $table->foreign('department_id')->references('id')->on('departments')->onDelete('cascade'); + $table->foreign('faculty_id')->references('id')->on('users')->onDelete('cascade'); + + // Indexes for better performance + $table->index('department_id'); + $table->index('faculty_id'); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('online_courses'); + } +}; diff --git a/database/migrations/2025_04_01_182630_create_patents_table.php b/database/migrations/2025_04_01_182630_create_patents_table.php new file mode 100644 index 0000000..98e18d7 --- /dev/null +++ b/database/migrations/2025_04_01_182630_create_patents_table.php @@ -0,0 +1,47 @@ +id(); + $table->unsignedBigInteger('department_id'); + $table->unsignedBigInteger('faculty_id'); // Faculty who uploaded the publication + + $table->string('title'); + $table->string('investigator'); + $table->string('application_no'); + $table->string('type'); + $table->date('date_of_submission'); + $table->date('date_of_filling'); + $table->string('status'); + $table->string('proof')->nullable(); // For file path + + // Foreign keys + $table->foreign('department_id')->references('id')->on('departments')->onDelete('cascade'); + $table->foreign('faculty_id')->references('id')->on('users')->onDelete('cascade'); + + // Indexes for better performance + $table->index('department_id'); + $table->index('faculty_id'); + + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + */ + public function down(): void + { + Schema::dropIfExists('patents'); + } +}; diff --git a/resources/views/externalEngagement/edit.blade.php b/resources/views/externalEngagement/edit.blade.php new file mode 100644 index 0000000..9bdc7cd --- /dev/null +++ b/resources/views/externalEngagement/edit.blade.php @@ -0,0 +1,126 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

+ Edit External Engagement +

+
+ +
+ @if ($errors->any()) +
+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif + +
+ @csrf + @method('PUT') +
+ +
+
+ + +
+
+ + +
+ + +
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + @if ($externalEngagement->proof) +
+ Current file: + View +
+ @endif + +

Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP

+
+
+ + +
+ + Cancel + + +
+
+
+
+
+ + + +@endsection \ No newline at end of file diff --git a/resources/views/externalEngagement/index.blade.php b/resources/views/externalEngagement/index.blade.php new file mode 100644 index 0000000..8f9a0ff --- /dev/null +++ b/resources/views/externalEngagement/index.blade.php @@ -0,0 +1,198 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

+ All External Engagements +

+
+
+
+ + + + + + + + + + + + + + + + + +
IDFacultyDepartmentActivityActivity DescriptionInviting OrganizationStart DateEnd DateNum DaysActions
+
+
+
+
+@endsection + +@section('scripts') + + + + + + + + + + + +@endsection \ No newline at end of file diff --git a/resources/views/faculty/externalEngagement-form.blade.php b/resources/views/faculty/externalEngagement-form.blade.php new file mode 100644 index 0000000..ff9c40b --- /dev/null +++ b/resources/views/faculty/externalEngagement-form.blade.php @@ -0,0 +1,109 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

+ Submit External Engagement Details +

+

+ Fill in the details of your External Engagement. +

+
+ @if ($errors->any()) +
+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif +
+
+ @csrf +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +
+ + +
+
+ + + +
+
+ + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +

Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP

+
+
+
+ + +
+ +
+ +
+
+
+
+ + +@endsection \ No newline at end of file diff --git a/resources/views/faculty/onlineCourses-form.blade.php b/resources/views/faculty/onlineCourses-form.blade.php new file mode 100644 index 0000000..3d8075a --- /dev/null +++ b/resources/views/faculty/onlineCourses-form.blade.php @@ -0,0 +1,103 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

+ Submit Online Course Details +

+

+ Fill in the details of your Online Course. +

+
+ @if ($errors->any()) +
+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif +
+
+ @csrf +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +

Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP

+
+
+
+ + +
+ +
+ +
+
+
+
+ + +@endsection \ No newline at end of file diff --git a/resources/views/faculty/patents-form.blade.php b/resources/views/faculty/patents-form.blade.php new file mode 100644 index 0000000..8f7caad --- /dev/null +++ b/resources/views/faculty/patents-form.blade.php @@ -0,0 +1,103 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

+ Submit Patents Details +

+

+ Fill in the details of your Patents. +

+
+ @if ($errors->any()) +
+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif +
+
+ @csrf +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + + +
+
+ + + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + +

Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP

+
+
+
+ + +
+ +
+ +
+
+
+
+ +@endsection \ No newline at end of file diff --git a/resources/views/layouts/navigation.blade.php b/resources/views/layouts/navigation.blade.php index aa59707..f833a74 100644 --- a/resources/views/layouts/navigation.blade.php +++ b/resources/views/layouts/navigation.blade.php @@ -33,6 +33,15 @@ {{ __('Books Published') }} + + {{ __('External Engagement') }} + + + {{ __('Online Courses') }} + + + {{ __('Patents/Copyrights') }} + @elseif(auth()->user()->role->name === 'Coordinator') @@ -51,6 +60,15 @@ {{ __('Books Published') }} + + {{ __('External Engagement') }} + + + {{ __('Online Courses') }} + + + {{ __('Patents/Copyrights') }} + @elseif(auth()->user()->role->name === 'Faculty') @@ -133,6 +151,51 @@ + +
+ + +
+ +
+ + +
+ +
+ + +
@endif diff --git a/resources/views/onlineCourses/edit.blade.php b/resources/views/onlineCourses/edit.blade.php new file mode 100644 index 0000000..3dad137 --- /dev/null +++ b/resources/views/onlineCourses/edit.blade.php @@ -0,0 +1,119 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

+ Edit Online Courses +

+
+ +
+ @if ($errors->any()) +
+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif + +
+ @csrf + @method('PUT') +
+ +
+
+ + +
+
+ + +
+ + +
+ + + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + @if ($onlineCourse->proof) +
+ Current file: + View +
+ @endif + +

Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP

+
+
+ + +
+ + Cancel + + +
+
+
+
+
+ + + +@endsection \ No newline at end of file diff --git a/resources/views/onlineCourses/index.blade.php b/resources/views/onlineCourses/index.blade.php new file mode 100644 index 0000000..7682d1c --- /dev/null +++ b/resources/views/onlineCourses/index.blade.php @@ -0,0 +1,192 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

+ All Online Course +

+
+
+
+ + + + + + + + + + + + + + + + +
IDFacultyDepartmentCourseOffered ByStart DateEnd DateNum DaysActions
+
+
+
+
+@endsection + +@section('scripts') + + + + + + + + + + + +@endsection \ No newline at end of file diff --git a/resources/views/patents/edit.blade.php b/resources/views/patents/edit.blade.php new file mode 100644 index 0000000..345f4c4 --- /dev/null +++ b/resources/views/patents/edit.blade.php @@ -0,0 +1,114 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

+ Edit Patents/Copyrights +

+
+ +
+ @if ($errors->any()) +
+
    + @foreach ($errors->all() as $error) +
  • {{ $error }}
  • + @endforeach +
+
+ @endif + +
+ @csrf + @method('PUT') +
+ +
+
+ + +
+ +
+ + +
+
+ +
+
+ + +
+ +
+ + +
+
+ + + + +
+
+ + +
+
+ + +
+
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+ + @if ($patent->proof) +
+ Current file: + View +
+ @endif + +

Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP

+
+
+ + +
+ + Cancel + + +
+
+
+
+
+ +@endsection \ No newline at end of file diff --git a/resources/views/patents/index.blade.php b/resources/views/patents/index.blade.php new file mode 100644 index 0000000..0f6e729 --- /dev/null +++ b/resources/views/patents/index.blade.php @@ -0,0 +1,204 @@ +@extends('layouts.app') + +@section('content') +
+
+
+

+ All Patents +

+
+
+
+ + + + + + + + + + + + + + + + + + +
IDFacultyDepartmentTitleInvestigatorApplication NoTypeDate Of SubmissionDate Of FillingStatusActions
+
+
+
+
+@endsection + +@section('scripts') + + + + + + + + + + + +@endsection \ No newline at end of file diff --git a/routes/web.php b/routes/web.php index 6986b33..b2b1d7e 100644 --- a/routes/web.php +++ b/routes/web.php @@ -10,8 +10,11 @@ use App\Http\Controllers\UserController; use App\Http\Controllers\AdminController; use App\Http\Controllers\BooksPublishedController; use App\Http\Controllers\CoordinatorController; +use App\Http\Controllers\ExternalEngagementController; use App\Http\Controllers\FacultyController; use App\Http\Controllers\IvOrganisedController; +use App\Http\Controllers\OnlineCoursesController; +use App\Http\Controllers\PatentsController; use App\Http\Controllers\PublicationsController; use App\Http\Middleware\CheckRole; @@ -56,6 +59,15 @@ Route::delete('/publication/{id}', [PublicationsController::class, 'destroy'])-> // Books Published common routes Route::delete('/booksPublished/{id}', [BooksPublishedController::class, 'destroy'])->name('booksPublished.destroy'); +// Books Published common routes +Route::delete('/externalEngagement/{id}', [ExternalEngagementController::class, 'destroy'])->name('externalEngagement.destroy'); + +// Books Published common routes +Route::delete('/onlineCourses/{id}', [OnlineCoursesController::class, 'destroy'])->name('onlineCourses.destroy'); + +// Books Published common routes +Route::delete('/patents/{id}', [PatentsController::class, 'destroy'])->name('patents.destroy'); + // Admin routes Route::middleware(['auth', CheckRole::class . ':Admin'])->group(function () { Route::get('/admin', [AdminController::class, 'index'])->name('admin.dashboard'); @@ -66,80 +78,122 @@ Route::middleware(['auth', CheckRole::class . ':Admin'])->group(function () { Route::get('/admin/activities-attended/{id}/edit', [ActivitiesAttendedController::class, 'edit'])->name('admin.ActivitiesAttended.edit'); Route::put('/admin/activities-attended/{id}', [ActivitiesAttendedController::class, 'update'])->name('admin.ActivitiesAttended.update'); Route::delete('/admin/activities-attended/{id}', [ActivitiesAttendedController::class, 'destroy'])->name('admin.ActivitiesAttended.destroy'); - + // Activities Organised Routes Route::get('/admin/ActivitiesOrganisedResponses', [AdminController::class, 'viewActivitiesOrganisedResponses'])->name('admin.ActivitiesOrganisedResponses'); Route::get('/admin/ActivitiesOrganisedResponses/data', [ActivitiesOrganisedController::class, 'getActivitiesOrganisedResponses'])->name('admin.ActivitiesOrganisedResponses.data'); Route::get('/admin/activities-organised/{id}/edit', [ActivitiesOrganisedController::class, 'edit'])->name('admin.ActivitiesOrganised.edit'); Route::put('/admin/activities-organised/{id}', [ActivitiesOrganisedController::class, 'update'])->name('admin.ActivitiesOrganised.update'); Route::delete('/admin/activities-organised/{id}', [ActivitiesOrganisedController::class, 'destroy'])->name('admin.ActivitiesOrganised.destroy'); - + // IV Organised Routes Route::get('/admin/IvOrganisedResponses', [AdminController::class, 'viewIvOrganisedResponses'])->name('admin.IvOrganisedResponses'); Route::get('/admin/IvOrganisedResponses/data', [IvOrganisedController::class, 'getIvOrganisedResponses'])->name('admin.IvOrganisedResponses.data'); Route::get('/admin/iv-organised/{id}/edit', [IvOrganisedController::class, 'edit'])->name('admin.IvOrganised.edit'); Route::put('/admin/iv-organised/{id}', [IvOrganisedController::class, 'update'])->name('admin.IvOrganised.update'); Route::delete('/admin/iv-organised/{id}', [IvOrganisedController::class, 'destroy'])->name('admin.IvOrganised.destroy'); - + // Publications Routes Route::get('/admin/PublicationsResponses', [AdminController::class, 'viewPublicationsResponses'])->name('admin.PublicationsResponses'); Route::get('/admin/PublicationsResponses/data', [PublicationsController::class, 'getPublicationsResponses'])->name('admin.PublicationsResponses.data'); Route::get('/admin/publication/{id}/edit', [PublicationsController::class, 'edit'])->name('admin.Publications.edit'); Route::put('/admin/publication/{id}', [PublicationsController::class, 'update'])->name('admin.Publications.update'); Route::delete('/admin/publication/{id}', [PublicationsController::class, 'destroy'])->name('admin.Publications.destroy'); - + // Books Published Routes Route::get('/admin/BooksPublishedResponses', [AdminController::class, 'viewBooksPublishedResponses'])->name('admin.BooksPublishedResponses'); Route::get('/admin/BooksPublishedResponses/data', [BooksPublishedController::class, 'getBooksPublishedResponses'])->name('admin.BooksPublishedResponses.data'); Route::get('/admin/booksPublished/{id}/edit', [BooksPublishedController::class, 'edit'])->name('admin.BooksPublished.edit'); Route::put('/admin/booksPublished/{id}', [BooksPublishedController::class, 'update'])->name('admin.BooksPublished.update'); Route::delete('/admin/booksPublished/{id}', [BooksPublishedController::class, 'destroy'])->name('admin.BooksPublished.destroy'); + + // ExternalEngagement Routes + Route::get('/admin/ExternalEngagementResponses', [AdminController::class, 'viewExternalEngagementResponses'])->name('admin.ExternalEngagementResponses'); + Route::get('/admin/ExternalEngagementResponses/data', [ExternalEngagementController::class, 'getExternalEngagementResponses'])->name('admin.ExternalEngagementResponses.data'); + Route::get('/admin/ExternalEngagement/{id}/edit', [ExternalEngagementController::class, 'edit'])->name('admin.ExternalEngagement.edit'); + Route::put('/admin/ExternalEngagement/{id}', [ExternalEngagementController::class, 'update'])->name('admin.ExternalEngagement.update'); + Route::delete('/admin/ExternalEngagement/{id}', [ExternalEngagementController::class, 'destroy'])->name('admin.ExternalEngagement.destroy'); + + // OnlineCourses Routes + Route::get('/admin/OnlineCoursesResponses', [AdminController::class, 'viewOnlineCoursesResponses'])->name('admin.OnlineCoursesResponses'); + Route::get('/admin/OnlineCoursesResponses/data', [OnlineCoursesController::class, 'getOnlineCoursesResponses'])->name('admin.OnlineCoursesResponses.data'); + Route::get('/admin/OnlineCourses/{id}/edit', [OnlineCoursesController::class, 'edit'])->name('admin.OnlineCourses.edit'); + Route::put('/admin/OnlineCourses/{id}', [OnlineCoursesController::class, 'update'])->name('admin.OnlineCourses.update'); + Route::delete('/admin/OnlineCourses/{id}', [OnlineCoursesController::class, 'destroy'])->name('admin.OnlineCourses.destroy'); + + // Patents Routes + Route::get('/admin/PatentsResponses', [AdminController::class, 'viewPatentsResponses'])->name('admin.PatentsResponses'); + Route::get('/admin/PatentsResponses/data', [PatentsController::class, 'getPatentsResponses'])->name('admin.PatentsResponses.data'); + Route::get('/admin/Patents/{id}/edit', [PatentsController::class, 'edit'])->name('admin.Patents.edit'); + Route::put('/admin/Patents/{id}', [PatentsController::class, 'update'])->name('admin.Patents.update'); + Route::delete('/admin/Patents/{id}', [PatentsController::class, 'destroy'])->name('admin.Patents.destroy'); }); // Coordinator routes Route::middleware(['auth', CheckRole::class . ':Coordinator'])->group(function () { Route::get('/coordinator', [CoordinatorController::class, 'index'])->name('coordinator.dashboard'); - + // Activities Attended Routes Route::get('/coordinator/ActivitiesAttendedResponses', [CoordinatorController::class, 'viewActivitiesAttendedResponses'])->name('coordinator.ActivitiesAttendedResponses'); Route::get('/coordinator/ActivitiesAttendedResponses/data', [ActivitiesAttendedController::class, 'getActivitiesAttendedResponses'])->name('coordinator.ActivitiesAttendedResponses.data'); Route::get('/coordinator/activities-attended/{id}/edit', [ActivitiesAttendedController::class, 'edit'])->name('coordinator.ActivitiesAttended.edit'); Route::put('/coordinator/activities-attended/{id}', [ActivitiesAttendedController::class, 'update'])->name('coordinator.ActivitiesAttended.update'); Route::delete('/coordinator/activities-attended/{id}', [ActivitiesAttendedController::class, 'destroy'])->name('coordinator.ActivitiesAttended.destroy'); - + // Activities Organised Routes Route::get('/coordinator/ActivitiesOrganisedResponses', [CoordinatorController::class, 'viewActivitiesOrganisedResponses'])->name('coordinator.ActivitiesOrganisedResponses'); Route::get('/coordinator/ActivitiesOrganisedResponses/data', [ActivitiesOrganisedController::class, 'getActivitiesOrganisedResponses'])->name('coordinator.ActivitiesOrganisedResponses.data'); Route::get('/coordinator/activities-organised/{id}/edit', [ActivitiesOrganisedController::class, 'edit'])->name('coordinator.ActivitiesOrganised.edit'); Route::put('/coordinator/activities-organised/{id}', [ActivitiesOrganisedController::class, 'update'])->name('coordinator.ActivitiesOrganised.update'); Route::delete('/coordinator/activities-organised/{id}', [ActivitiesOrganisedController::class, 'destroy'])->name('coordinator.ActivitiesOrganised.destroy'); - + // Iv Organised Routes Route::get('/coordinator/IvOrganisedResponses', [CoordinatorController::class, 'viewIvOrganisedResponses'])->name('coordinator.IvOrganisedResponses'); Route::get('/coordinator/IvOrganisedResponses/data', [IvOrganisedController::class, 'getIvOrganisedResponses'])->name('coordinator.IvOrganisedResponses.data'); Route::get('/coordinator/iv-organised/{id}/edit', [IvOrganisedController::class, 'edit'])->name('coordinator.IvOrganised.edit'); Route::put('/coordinator/iv-organised/{id}', [IvOrganisedController::class, 'update'])->name('coordinator.IvOrganised.update'); Route::delete('/coordinator/iv-organised/{id}', [IvOrganisedController::class, 'destroy'])->name('coordinator.IvOrganised.destroy'); - + // Publications Routes Route::get('/coordinator/PublicationsResponses', [CoordinatorController::class, 'viewPublicationsResponses'])->name('coordinator.PublicationsResponses'); Route::get('/coordinator/PublicationsResponses/data', [PublicationsController::class, 'getPublicationsResponses'])->name('coordinator.PublicationsResponses.data'); Route::get('/coordinator/publication/{id}/edit', [PublicationsController::class, 'edit'])->name('coordinator.Publications.edit'); Route::put('/coordinator/publication/{id}', [PublicationsController::class, 'update'])->name('coordinator.Publications.update'); Route::delete('/coordinator/publication/{id}', [PublicationsController::class, 'destroy'])->name('coordinator.Publications.destroy'); - + // BooksPublished Routes Route::get('/coordinator/BooksPublishedResponses', [CoordinatorController::class, 'viewBooksPublishedResponses'])->name('coordinator.BooksPublishedResponses'); Route::get('/coordinator/BooksPublishedResponses/data', [BooksPublishedController::class, 'getBooksPublishedResponses'])->name('coordinator.BooksPublishedResponses.data'); Route::get('/coordinator/booksPublished/{id}/edit', [BooksPublishedController::class, 'edit'])->name('coordinator.BooksPublished.edit'); Route::put('/coordinator/booksPublished/{id}', [BooksPublishedController::class, 'update'])->name('coordinator.BooksPublished.update'); Route::delete('/coordinator/booksPublished/{id}', [BooksPublishedController::class, 'destroy'])->name('coordinator.BooksPublished.destroy'); + + // ExternalEngagement Routes + Route::get('/coordinator/ExternalEngagementResponses', [CoordinatorController::class, 'viewExternalEngagementResponses'])->name('coordinator.ExternalEngagementResponses'); + Route::get('/coordinator/ExternalEngagementResponses/data', [ExternalEngagementController::class, 'getExternalEngagementResponses'])->name('coordinator.ExternalEngagementResponses.data'); + Route::get('/coordinator/ExternalEngagement/{id}/edit', [ExternalEngagementController::class, 'edit'])->name('coordinator.ExternalEngagement.edit'); + Route::put('/coordinator/ExternalEngagement/{id}', [ExternalEngagementController::class, 'update'])->name('coordinator.ExternalEngagement.update'); + Route::delete('/coordinator/ExternalEngagement/{id}', [ExternalEngagementController::class, 'destroy'])->name('coordinator.ExternalEngagement.destroy'); + + // OnlineCourses Routes + Route::get('/coordinator/OnlineCoursesResponses', [CoordinatorController::class, 'viewOnlineCoursesResponses'])->name('coordinator.OnlineCoursesResponses'); + Route::get('/coordinator/OnlineCoursesResponses/data', [OnlineCoursesController::class, 'getOnlineCoursesResponses'])->name('coordinator.OnlineCoursesResponses.data'); + Route::get('/coordinator/OnlineCourses/{id}/edit', [OnlineCoursesController::class, 'edit'])->name('coordinator.OnlineCourses.edit'); + Route::put('/coordinator/OnlineCourses/{id}', [OnlineCoursesController::class, 'update'])->name('coordinator.OnlineCourses.update'); + Route::delete('/coordinator/OnlineCourses/{id}', [OnlineCoursesController::class, 'destroy'])->name('coordinator.OnlineCourses.destroy'); + + // Patents Routes + Route::get('/coordinator/PatentsResponses', [CoordinatorController::class, 'viewPatentsResponses'])->name('coordinator.PatentsResponses'); + Route::get('/coordinator/PatentsResponses/data', [PatentsController::class, 'getPatentsResponses'])->name('coordinator.PatentsResponses.data'); + Route::get('/coordinator/Patents/{id}/edit', [PatentsController::class, 'edit'])->name('coordinator.Patents.edit'); + Route::put('/coordinator/Patents/{id}', [PatentsController::class, 'update'])->name('coordinator.Patents.update'); + Route::delete('/coordinator/Patents/{id}', [PatentsController::class, 'destroy'])->name('coordinator.Patents.destroy'); }); // Faculty routes Route::middleware(['auth', CheckRole::class . ':Faculty'])->group(function () { Route::get('/faculty', [FacultyController::class, 'index'])->name('faculty.dashboard'); - + // Activities Attended Routes Route::get('/faculty/ActivitiesAttendedForm', [FacultyController::class, 'ActivitiesAttendedForm'])->name('faculty.ActivitiesAttendedForm'); Route::post('/faculty/ActivitiesAttendedFormResponse', [FacultyController::class, 'ActivitiesAttendedFormResponse'])->name('faculty.ActivitiesAttendedFormResponse'); @@ -147,7 +201,7 @@ Route::middleware(['auth', CheckRole::class . ':Faculty'])->group(function () { Route::get('/faculty/ActivitiesAttendedResponses/data', [ActivitiesAttendedController::class, 'getActivitiesAttendedResponses'])->name('faculty.ActivitiesAttendedResponses.data'); Route::get('/faculty/activities-attended/{id}/edit', [ActivitiesAttendedController::class, 'edit'])->name('faculty.ActivitiesAttended.edit'); Route::put('/faculty/activities-attended/{id}', [ActivitiesAttendedController::class, 'update'])->name('faculty.ActivitiesAttended.update'); - + // Activities Organised Routes Route::get('/faculty/ActivitiesOrganisedForm', [FacultyController::class, 'ActivitiesOrganisedForm'])->name('faculty.ActivitiesOrganisedForm'); Route::post('/faculty/ActivitiesOrganisedFormResponse', [FacultyController::class, 'ActivitiesOrganisedFormResponse'])->name('faculty.ActivitiesOrganisedFormResponse'); @@ -155,7 +209,7 @@ Route::middleware(['auth', CheckRole::class . ':Faculty'])->group(function () { Route::get('/faculty/ActivitiesOrganisedResponses/data', [ActivitiesOrganisedController::class, 'getActivitiesOrganisedResponses'])->name('faculty.ActivitiesOrganisedResponses.data'); Route::get('/faculty/activities-organised/{id}/edit', [ActivitiesOrganisedController::class, 'edit'])->name('faculty.ActivitiesOrganised.edit'); Route::put('/faculty/activities-organised/{id}', [ActivitiesOrganisedController::class, 'update'])->name('faculty.ActivitiesOrganised.update'); - + // Iv Organised Routes Route::get('/faculty/IvOrganisedForm', [FacultyController::class, 'IvOrganisedForm'])->name('faculty.IvOrganisedForm'); Route::post('/faculty/IvOrganisedFormResponse', [FacultyController::class, 'IvOrganisedFormResponse'])->name('faculty.IvOrganisedFormResponse'); @@ -163,7 +217,7 @@ Route::middleware(['auth', CheckRole::class . ':Faculty'])->group(function () { Route::get('/faculty/IvOrganisedResponses/data', [IvOrganisedController::class, 'getIvOrganisedResponses'])->name('faculty.IvOrganisedResponses.data'); Route::get('/faculty/iv-organised/{id}/edit', [IvOrganisedController::class, 'edit'])->name('faculty.IvOrganised.edit'); Route::put('/faculty/iv-organised/{id}', [IvOrganisedController::class, 'update'])->name('faculty.IvOrganised.update'); - + // Publications Routes Route::get('/faculty/PublicationsForm', [FacultyController::class, 'PublicationsForm'])->name('faculty.PublicationsForm'); Route::post('/faculty/PublicationsFormResponse', [FacultyController::class, 'PublicationsFormResponse'])->name('faculty.PublicationsFormResponse'); @@ -171,7 +225,7 @@ Route::middleware(['auth', CheckRole::class . ':Faculty'])->group(function () { Route::get('/faculty/PublicationsResponses/data', [PublicationsController::class, 'getPublicationsResponses'])->name('faculty.PublicationsResponses.data'); Route::get('/faculty/publication/{id}/edit', [PublicationsController::class, 'edit'])->name('faculty.Publications.edit'); Route::put('/faculty/publication/{id}', [PublicationsController::class, 'update'])->name('faculty.Publications.update'); - + // Books Published Routes Route::get('/faculty/BooksPublishedForm', [FacultyController::class, 'BooksPublishedForm'])->name('faculty.BooksPublishedForm'); Route::post('/faculty/BooksPublishedFormResponse', [FacultyController::class, 'BooksPublishedFormResponse'])->name('faculty.BooksPublishedFormResponse'); @@ -179,6 +233,30 @@ Route::middleware(['auth', CheckRole::class . ':Faculty'])->group(function () { Route::get('/faculty/BooksPublishedResponses/data', [BooksPublishedController::class, 'getBooksPublishedResponses'])->name('faculty.BooksPublishedResponses.data'); Route::get('/faculty/booksPublished/{id}/edit', [BooksPublishedController::class, 'edit'])->name('faculty.BooksPublished.edit'); Route::put('/faculty/booksPublished/{id}', [BooksPublishedController::class, 'update'])->name('faculty.BooksPublished.update'); + + // External Engagement Routes + Route::get('/faculty/ExternalEngagementForm', [FacultyController::class, 'ExternalEngagementForm'])->name('faculty.ExternalEngagementForm'); + Route::post('/faculty/ExternalEngagementFormResponse', [FacultyController::class, 'ExternalEngagementFormResponse'])->name('faculty.ExternalEngagementFormResponse'); + Route::get('/faculty/ExternalEngagementResponses', [FacultyController::class, 'viewExternalEngagementResponses'])->name('faculty.ExternalEngagementResponses'); + Route::get('/faculty/ExternalEngagementResponses/data', [ExternalEngagementController::class, 'getExternalEngagementResponses'])->name('faculty.ExternalEngagementResponses.data'); + Route::get('/faculty/ExternalEngagement/{id}/edit', [ExternalEngagementController::class, 'edit'])->name('faculty.ExternalEngagement.edit'); + Route::put('/faculty/ExternalEngagement/{id}', [ExternalEngagementController::class, 'update'])->name('faculty.ExternalEngagement.update'); + + // Online Courses Routes + Route::get('/faculty/OnlineCoursesForm', [FacultyController::class, 'OnlineCoursesForm'])->name('faculty.OnlineCoursesForm'); + Route::post('/faculty/OnlineCoursesFormResponse', [FacultyController::class, 'OnlineCoursesFormResponse'])->name('faculty.OnlineCoursesFormResponse'); + Route::get('/faculty/OnlineCoursesResponses', [FacultyController::class, 'viewOnlineCoursesResponses'])->name('faculty.OnlineCoursesResponses'); + Route::get('/faculty/OnlineCoursesResponses/data', [OnlineCoursesController::class, 'getOnlineCoursesResponses'])->name('faculty.OnlineCoursesResponses.data'); + Route::get('/faculty/OnlineCourses/{id}/edit', [OnlineCoursesController::class, 'edit'])->name('faculty.OnlineCourses.edit'); + Route::put('/faculty/OnlineCourses/{id}', [OnlineCoursesController::class, 'update'])->name('faculty.OnlineCourses.update'); + + // Patents Routes + Route::get('/faculty/PatentsForm', [FacultyController::class, 'PatentsForm'])->name('faculty.PatentsForm'); + Route::post('/faculty/PatentsFormResponse', [FacultyController::class, 'PatentsFormResponse'])->name('faculty.PatentsFormResponse'); + Route::get('/faculty/PatentsResponses', [FacultyController::class, 'viewPatentsResponses'])->name('faculty.PatentsResponses'); + Route::get('/faculty/PatentsResponses/data', [PatentsController::class, 'getPatentsResponses'])->name('faculty.PatentsResponses.data'); + Route::get('/faculty/Patents/{id}/edit', [PatentsController::class, 'edit'])->name('faculty.Patents.edit'); + Route::put('/faculty/Patents/{id}', [PatentsController::class, 'update'])->name('faculty.Patents.update'); }); // API Resources @@ -188,4 +266,4 @@ Route::apiResources([ 'users' => UserController::class, ]); -require __DIR__ . '/auth.php'; \ No newline at end of file +require __DIR__ . '/auth.php';