Feat: External Engegement, Online Course and Patents

This commit is contained in:
Sallu9007
2025-04-02 13:46:22 +05:30
parent 2aa0cf0449
commit 711d9727fd
23 changed files with 2590 additions and 15 deletions

View File

@@ -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');
}
}

View File

@@ -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');
}
}

View File

@@ -0,0 +1,227 @@
<?php
namespace App\Http\Controllers;
use App\Models\ExternalEngagement;
use Illuminate\Http\Request;
use Yajra\DataTables\Facades\DataTables;
use Illuminate\Support\Facades\Storage;
class ExternalEngagementController extends Controller
{
public function edit($id)
{
$externalEngagement = ExternalEngagement::findOrFail($id);
return view('externalEngagement.edit', compact('externalEngagement'));
}
public function update(Request $request, $id)
{
$externalEngagement = ExternalEngagement::findOrFail($id);
// 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 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[] = '<a href="' . asset('storage/' . $externalEngagement->proof) . '" target="_blank" class="btn btn-sm btn-primary mr-1">View</a>';
} 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[] = '<a href="' . $editRoute . '" class="btn btn-sm btn-info mx-1">Edit</a>';
$deleteRoute = route('externalEngagement.destroy', $externalEngagement->id);
$actions[] = '<button type="button" class="btn btn-sm btn-danger delete-btn" data-id="' . $externalEngagement->id . '" data-url="' . $deleteRoute . '">Delete</button>';
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');
}
}

View File

@@ -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();
}
}
}

View File

@@ -0,0 +1,220 @@
<?php
namespace App\Http\Controllers;
use App\Models\OnlineCourse;
use Illuminate\Http\Request;
use Yajra\DataTables\Facades\DataTables;
use Illuminate\Support\Facades\Storage;
class OnlineCoursesController extends Controller
{
public function edit($id)
{
$onlineCourse = OnlineCourse::findOrFail($id);
return view('onlineCourses.edit', compact('onlineCourse'));
}
public function update(Request $request, $id)
{
$onlineCourse = OnlineCourse::findOrFail($id);
// 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 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[] = '<a href="' . asset('storage/' . $onlineCourse->proof) . '" target="_blank" class="btn btn-sm btn-primary mr-1">View</a>';
} 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[] = '<a href="' . $editRoute . '" class="btn btn-sm btn-info mx-1">Edit</a>';
$deleteRoute = route('onlineCourses.destroy', $onlineCourse->id);
$actions[] = '<button type="button" class="btn btn-sm btn-danger delete-btn" data-id="' . $onlineCourse->id . '" data-url="' . $deleteRoute . '">Delete</button>';
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');
}
}

View File

@@ -0,0 +1,235 @@
<?php
namespace App\Http\Controllers;
use App\Models\OnlineCourse;
use App\Models\Patent;
use Illuminate\Http\Request;
use Yajra\DataTables\Facades\DataTables;
use Illuminate\Support\Facades\Storage;
class PatentsController extends Controller
{
public function edit($id)
{
$patent = Patent::findOrFail($id);
return view('patents.edit', compact('patent'));
}
public function update(Request $request, $id)
{
$patent = Patent::findOrFail($id);
// 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 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[] = '<a href="' . asset('storage/' . $patent->proof) . '" target="_blank" class="btn btn-sm btn-primary mr-1">View</a>';
} 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[] = '<a href="' . $editRoute . '" class="btn btn-sm btn-info mx-1">Edit</a>';
$deleteRoute = route('patents.destroy', $patent->id);
$actions[] = '<button type="button" class="btn btn-sm btn-danger delete-btn" data-id="' . $patent->id . '" data-url="' . $deleteRoute . '">Delete</button>';
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');
}
}

View File

@@ -0,0 +1,40 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class ExternalEngagement extends Model
{
use HasFactory;
protected $fillable = [
'department_id',
'faculty_id',
'activity',
'activity_description',
'inviting_organization',
'start_date',
'end_date',
'num_days',
'proof'
];
protected $casts = [
'start_date' => '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');
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class OnlineCourse extends Model
{
use HasFactory;
protected $fillable = [
'department_id',
'faculty_id',
'course',
'offered_by',
'start_date',
'end_date',
'num_days',
'proof'
];
protected $casts = [
'start_date' => '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');
}
}

37
app/Models/Patent.php Normal file
View File

@@ -0,0 +1,37 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Patent extends Model
{
use HasFactory;
protected $fillable = [
'department_id',
'faculty_id',
'title',
'investigator',
'application_no',
'type',
'date_of_submission',
'date_of_filling',
'status',
'proof'
];
// 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');
}
}

View File

@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('external_engagements', function (Blueprint $table) {
$table->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_');
}
};

View File

@@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('online_courses', function (Blueprint $table) {
$table->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');
}
};

View File

@@ -0,0 +1,47 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('patents', function (Blueprint $table) {
$table->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');
}
};

View File

@@ -0,0 +1,126 @@
@extends('layouts.app')
@section('content')
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
<div class="bg-white overflow-hidden shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-xl leading-6 font-semibold text-gray-900">
Edit External Engagement
</h3>
</div>
<div class="px-4 py-5 sm:p-6">
@if ($errors->any())
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ request()->is('admin/*') ? route('admin.ExternalEngagement.update', $externalEngagement->id) : (request()->is('coordinator/*') ? route('coordinator.ExternalEngagement.update', $externalEngagement->id) : route('faculty.ExternalEngagement.update', $externalEngagement->id)) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="space-y-6">
<!-- activity Information -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="activity" class="block text-sm font-medium text-gray-700">Activity Name</label>
<input type="text" name="activity" id="activity" value="{{ old('activity', $externalEngagement->activity) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required>
</div>
</div>
<!-- activity_description -->
<div>
<label for="activity_description" class="block text-sm font-medium text-gray-700">Activity Description</label>
<input type="text" name="activity_description" id="activity_description" value="{{ old('activity_description', $externalEngagement->activity_description) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required>
</div>
<!-- Publication Venue Information -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="inviting_organization" class="block text-sm font-medium text-gray-700">Inviting Organization Name</label>
<input type="text" name="inviting_organization" id="inviting_organization" value="{{ old('inviting_organization', $externalEngagement->inviting_organization) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required>
</div>
</div>
<!-- Department and Faculty Name -->
<div class="grid grid-cols-2 sm:grid-cols-2 gap-4">
<div>
<label for="department" class="block text-sm font-medium text-gray-700">Department</label>
<input type="text" name="department" id="department" value="{{ $externalEngagement->department->name ?? 'Unknown' }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
<div>
<label for="faculty_name" class="block text-sm font-medium text-gray-700">Faculty Name</label>
<input type="text" name="faculty_name" id="faculty_name" value="{{ $externalEngagement->user->name ?? 'Unknown' }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label for="start_date" class="block text-sm font-medium text-gray-700">Start Date</label>
<input type="date" name="start_date" id="start_date" value="{{ old('start_date', \Carbon\Carbon::parse($externalEngagement->start_date)->format('Y-m-d')) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required onchange="calculateDays()">
</div>
<div>
<label for="end_date" class="block text-sm font-medium text-gray-700">End Date</label>
<input type="date" name="end_date" id="end_date" value="{{ old('end_date', \Carbon\Carbon::parse($externalEngagement->end_date)->format('Y-m-d')) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required onchange="calculateDays()">
</div>
<div>
<label for="num_days" class="block text-sm font-medium text-gray-700">Number of Days</label>
<input type="text" name="num_days" id="num_days" value="{{ old('num_days', $externalEngagement->num_days) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" readonly>
</div>
</div>
<!-- Proof File -->
<div>
<label for="proof" class="block text-sm font-medium text-gray-700">Upload Proof</label>
@if ($externalEngagement->proof)
<div class="mb-2">
<span class="text-sm text-gray-600">Current file:</span>
<a href="{{ asset('storage/' . $externalEngagement->proof) }}" target="_blank" class="ml-2 text-blue-600 hover:text-blue-800">View</a>
</div>
@endif
<input type="file" name="proof" id="proof" class="mt-1 block w-full text-sm text-gray-500
file:mr-4 file:py-2 file:px-4
file:rounded-full file:border-0
file:text-sm file:font-semibold
file:bg-blue-50 file:text-blue-700
hover:file:bg-blue-100">
<p class="mt-1 text-xs text-gray-500">Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP</p>
</div>
</div>
<!-- Submit Button -->
<div class="mt-6 flex items-center justify-end">
<a href="{{ request()->is('admin/*') ? route('admin.ExternalEngagementResponses') : (request()->is('coordinator/*') ? route('coordinator.ExternalEngagementResponses') : route('faculty.ExternalEngagementResponses')) }}" class="bg-gray-200 py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 mr-3">
Cancel
</a>
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-black">
Update
</button>
</div>
</form>
</div>
</div>
</div>
<script>
function calculateDays() {
const startDate = new Date(document.getElementById('start_date').value);
const endDate = new Date(document.getElementById('end_date').value);
if (startDate && endDate) {
const diffTime = Math.abs(endDate - startDate);
const numDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1; // +1 to include both start and end days
document.getElementById('num_days').value = numDays;
}
}
// Calculate days on page load
document.addEventListener('DOMContentLoaded', function() {
calculateDays();
});
</script>
@endsection

View File

@@ -0,0 +1,198 @@
@extends('layouts.app')
@section('content')
<div class="max-w-full mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-xl leading-6 font-semibold text-gray-900">
All External Engagements
</h3>
</div>
<div class="px-4 py-5 sm:px-6">
<div class="overflow-x-auto w-full max-w-screen-lg mx-auto">
<table id="externalEngagement-table" class="table-auto w-full table-striped border-collapse border border-gray-200 rounded-lg">
<thead class="bg-gray-100">
<tr>
<th class="px-4 py-2 border border-gray-200">ID</th>
<th class="px-4 py-2 border border-gray-200">Faculty</th>
<th class="px-4 py-2 border border-gray-200">Department</th>
<th class="px-4 py-2 border border-gray-200">Activity</th>
<th class="px-4 py-2 border border-gray-200">Activity Description</th>
<th class="px-4 py-2 border border-gray-200">Inviting Organization</th>
<th class="px-4 py-2 border border-gray-200">Start Date</th>
<th class="px-4 py-2 border border-gray-200">End Date</th>
<th class="px-4 py-2 border border-gray-200">Num Days</th>
<th class="px-4 py-2 border border-gray-200">Actions</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
<!-- DataTables JS -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.1/css/dataTables.bootstrap5.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.1/js/dataTables.bootstrap5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script>
$(document).ready(function() {
const sheetName = "Publications";
var initAjaxRoute = function(route) {
table = $("#externalEngagement-table").DataTable({
fnDestroy: true,
processing: true,
serverSide: true,
responsive: true,
ajax: {
url: route,
},
columns: [{
data: 'id',
name: 'id'
},
{
data: 'user_name',
name: 'user_name',
orderable: true
},
{
data: 'department_name',
name: 'department_name',
orderable: true
},
{
data: 'activity',
name: 'activity',
orderable: true
},
{
data: 'activity_description',
name: 'activity_description',
orderable: true
},
{
data: 'inviting_organization',
name: 'inviting_organization',
orderable: false
},
{
data: 'start_date',
name: 'start_date',
orderable: false
},
{
data: 'end_date',
name: 'end_date',
orderable: false
},
{
data: 'num_days',
name: 'num_days',
orderable: false
},
{
data: 'action',
name: 'action',
orderable: false,
searchable: false
},
],
columnDefs: [{
targets: '_all',
className: 'text-center wrap-text'
}, ],
dom: 'Bfrtip',
buttons: [{
extend: 'copy',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'csv',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'excel',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'pdf',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'print',
title: sheetName,
exportOptions: exportOptions()
}
]
});
};
// Delete button event handler
$('#externalEngagement-table').on('click', '.delete-btn', function() {
if (confirm('Are you sure you want to delete this record?')) {
const id = $(this).data('id');
const url = $(this).data('url');
$.ajax({
url: url,
type: 'DELETE',
data: {
"_token": "{{ csrf_token() }}"
},
success: function(result) {
table.ajax.reload();
alert('External Engagement deleted successfully');
},
error: function(error) {
console.error(error);
alert('Error deleting External Engagement');
}
});
}
});
function exportOptions() {
return {
columns: ':visible',
format: {
body: function(data, row, column, node) {
if ($(node).find('select').length) {
return $(node).find("select option:selected").text();
}
return $(node).text();
}
}
};
}
// Set appropriate route based on user role
const userRole = "{{ auth()->user()->role->name }}";
let dataRoute = "{{ route('admin.ExternalEngagementResponses.data') }}";
if (userRole === 'Coordinator') {
dataRoute = "{{ route('coordinator.ExternalEngagementResponses.data') }}";
}
if (userRole === 'Faculty') {
dataRoute = "{{ route('faculty.ExternalEngagementResponses.data') }}";
}
initAjaxRoute(dataRoute);
});
</script>
@endsection

View File

@@ -0,0 +1,109 @@
@extends('layouts.app')
@section('content')
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-lg leading-6 font-medium text-gray-900">
Submit External Engagement Details
</h3>
<p class="mt-1 max-w-2xl text-sm text-gray-500">
Fill in the details of your External Engagement.
</p>
</div>
@if ($errors->any())
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="border-t border-gray-200">
<form method="POST" action="{{ route('faculty.ExternalEngagementFormResponse') }}" enctype="multipart/form-data">
@csrf
<div class="px-4 py-5 sm:px-6">
<div class="space-y-6">
<!-- Author Information -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="activity" class="block text-sm font-medium text-gray-700">Activity Name</label>
<input type="text" name="activity" id="activity" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<div>
<label for="activity_description" class="block text-sm font-medium text-gray-700">Activity Description</label>
<input type="text" name="activity_description" id="activity_description" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" >
</div>
</div>
<!-- Publication inviting_organization -->
<div>
<label for="inviting_organization" class="block text-sm font-medium text-gray-700">Inviting Organization</label>
<input type="text" name="inviting_organization" id="inviting_organization" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<!-- Department and Faculty Name -->
<div class="grid grid-cols-2 sm:grid-cols-2 gap-4">
<div>
<label for="department" class="block text-sm font-medium text-gray-700">Department</label>
<input type="text" name="department" id="department" value="{{ auth()->user()->department->name }}" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-gray-100" disabled>
<input type="hidden" name="department_id" value="{{ auth()->user()->department->id }}">
</div>
<div>
<label for="faculty_name" class="block text-sm font-medium text-gray-700">Faculty Name</label>
<input type="text" name="faculty_name" id="faculty_name" value="{{ auth()->user()->name }}" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-gray-100" disabled>
<input type="hidden" name="faculty_id" value="{{ auth()->user()->id }}">
</div>
</div>
<!-- Date Information -->
<div class="grid grid-cols-2 gap-4">
<div>
<label for="start_date" class="block text-sm font-medium text-gray-700">Start Date</label>
<input type="date" name="start_date" id="start_date" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required onchange="calculateDays()">
</div>
<div>
<label for="end_date" class="block text-sm font-medium text-gray-700">End Date</label>
<input type="date" name="end_date" id="end_date" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required onchange="calculateDays()">
</div>
<div>
<label for="num_days" class="block text-sm font-medium text-gray-700">Number of Days</label>
<input type="text" name="num_days" id="num_days" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-gray-100" readonly>
</div>
</div>
<!-- proof -->
<div>
<label for="proof" class="block text-sm font-medium text-gray-700">Upload Paper</label>
<input type="file" name="proof" id="proof" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" accept=".jpg,.jpeg,.png,.pdf,.doc,.docx,.zip" required>
<p class="mt-1 text-xs text-gray-500">Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP</p>
</div>
</div>
</div>
<!-- Submit Button -->
<div class="px-4 py-3 sm:px-6 text-center mt-4">
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-black">
Submit
</button>
</div>
</form>
</div>
</div>
</div>
<script>
function calculateDays() {
const startDate = new Date(document.getElementById('start_date').value);
const endDate = new Date(document.getElementById('end_date').value);
if (startDate && endDate) {
const diffTime = Math.abs(endDate - startDate);
const numDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1; // +1 to include both start and end days
document.getElementById('num_days').value = numDays;
}
}
</script>
@endsection

View File

@@ -0,0 +1,103 @@
@extends('layouts.app')
@section('content')
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-lg leading-6 font-medium text-gray-900">
Submit Online Course Details
</h3>
<p class="mt-1 max-w-2xl text-sm text-gray-500">
Fill in the details of your Online Course.
</p>
</div>
@if ($errors->any())
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="border-t border-gray-200">
<form method="POST" action="{{ route('faculty.OnlineCoursesFormResponse') }}" enctype="multipart/form-data">
@csrf
<div class="px-4 py-5 sm:px-6">
<div class="space-y-6">
<!-- Author Information -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="course" class="block text-sm font-medium text-gray-700">Course Name</label>
<input type="text" name="course" id="course" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<div>
<label for="offered_by" class="block text-sm font-medium text-gray-700">Offered By</label>
<input type="text" name="offered_by" id="offered_by" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" >
</div>
</div>
<!-- Department and Faculty Name -->
<div class="grid grid-cols-2 sm:grid-cols-2 gap-4">
<div>
<label for="department" class="block text-sm font-medium text-gray-700">Department</label>
<input type="text" name="department" id="department" value="{{ auth()->user()->department->name }}" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-gray-100" disabled>
<input type="hidden" name="department_id" value="{{ auth()->user()->department->id }}">
</div>
<div>
<label for="faculty_name" class="block text-sm font-medium text-gray-700">Faculty Name</label>
<input type="text" name="faculty_name" id="faculty_name" value="{{ auth()->user()->name }}" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-gray-100" disabled>
<input type="hidden" name="faculty_id" value="{{ auth()->user()->id }}">
</div>
</div>
<!-- Date Information -->
<div class="grid grid-cols-2 gap-4">
<div>
<label for="start_date" class="block text-sm font-medium text-gray-700">Start Date</label>
<input type="date" name="start_date" id="start_date" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required onchange="calculateDays()">
</div>
<div>
<label for="end_date" class="block text-sm font-medium text-gray-700">End Date</label>
<input type="date" name="end_date" id="end_date" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required onchange="calculateDays()">
</div>
<div>
<label for="num_days" class="block text-sm font-medium text-gray-700">Number of Days</label>
<input type="text" name="num_days" id="num_days" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-gray-100" readonly>
</div>
</div>
<!-- proof -->
<div>
<label for="proof" class="block text-sm font-medium text-gray-700">Upload Paper</label>
<input type="file" name="proof" id="proof" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" accept=".jpg,.jpeg,.png,.pdf,.doc,.docx,.zip" required>
<p class="mt-1 text-xs text-gray-500">Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP</p>
</div>
</div>
</div>
<!-- Submit Button -->
<div class="px-4 py-3 sm:px-6 text-center mt-4">
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-black">
Submit
</button>
</div>
</form>
</div>
</div>
</div>
<script>
function calculateDays() {
const startDate = new Date(document.getElementById('start_date').value);
const endDate = new Date(document.getElementById('end_date').value);
if (startDate && endDate) {
const diffTime = Math.abs(endDate - startDate);
const numDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1; // +1 to include both start and end days
document.getElementById('num_days').value = numDays;
}
}
</script>
@endsection

View File

@@ -0,0 +1,103 @@
@extends('layouts.app')
@section('content')
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-lg leading-6 font-medium text-gray-900">
Submit Patents Details
</h3>
<p class="mt-1 max-w-2xl text-sm text-gray-500">
Fill in the details of your Patents.
</p>
</div>
@if ($errors->any())
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<div class="border-t border-gray-200">
<form method="POST" action="{{ route('faculty.PatentsFormResponse') }}" enctype="multipart/form-data">
@csrf
<div class="px-4 py-5 sm:px-6">
<div class="space-y-6">
<!-- Author Information -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="title" class="block text-sm font-medium text-gray-700">Title</label>
<input type="text" name="title" id="title" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<div>
<label for="investigator" class="block text-sm font-medium text-gray-700">Investigator</label>
<input type="text" name="investigator" id="investigator" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" >
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="application_no" class="block text-sm font-medium text-gray-700">Application No</label>
<input type="text" name="application_no" id="application_no" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<div>
<label for="type" class="block text-sm font-medium text-gray-700">Type</label>
<input type="text" name="type" id="type" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" >
</div>
</div>
<!-- Department and Faculty Name -->
<div class="grid grid-cols-2 sm:grid-cols-2 gap-4">
<div>
<label for="department" class="block text-sm font-medium text-gray-700">Department</label>
<input type="text" name="department" id="department" value="{{ auth()->user()->department->name }}" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-gray-100" disabled>
<input type="hidden" name="department_id" value="{{ auth()->user()->department->id }}">
</div>
<div>
<label for="faculty_name" class="block text-sm font-medium text-gray-700">Faculty Name</label>
<input type="text" name="faculty_name" id="faculty_name" value="{{ auth()->user()->name }}" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-gray-100" disabled>
<input type="hidden" name="faculty_id" value="{{ auth()->user()->id }}">
</div>
</div>
<!-- Date Information -->
<div class="grid grid-cols-2 gap-4">
<div>
<label for="date_of_submission" class="block text-sm font-medium text-gray-700">Date Of Submission</label>
<input type="date" name="date_of_submission" id="date_of_submission" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<div>
<label for="date_of_filling" class="block text-sm font-medium text-gray-700">Date Of Filling</label>
<input type="date" name="date_of_filling" id="date_of_filling" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<div>
<label for="status" class="block text-sm font-medium text-gray-700">Status</label>
<input type="text" name="status" id="status" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm " >
</div>
</div>
<!-- proof -->
<div>
<label for="proof" class="block text-sm font-medium text-gray-700">Upload Proof</label>
<input type="file" name="proof" id="proof" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" accept=".jpg,.jpeg,.png,.pdf,.doc,.docx,.zip" required>
<p class="mt-1 text-xs text-gray-500">Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP</p>
</div>
</div>
</div>
<!-- Submit Button -->
<div class="px-4 py-3 sm:px-6 text-center mt-4">
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-black">
Submit
</button>
</div>
</form>
</div>
</div>
</div>
@endsection

View File

@@ -33,6 +33,15 @@
<x-nav-link :href="route('admin.BooksPublishedResponses')" :active="request()->routeIs('admin.BooksPublishedResponses')">
{{ __('Books Published') }}
</x-nav-link>
<x-nav-link :href="route('admin.ExternalEngagementResponses')" :active="request()->routeIs('admin.ExternalEngagementResponses')">
{{ __('External Engagement') }}
</x-nav-link>
<x-nav-link :href="route('admin.OnlineCoursesResponses')" :active="request()->routeIs('admin.OnlineCoursesResponses')">
{{ __('Online Courses') }}
</x-nav-link>
<x-nav-link :href="route('admin.PatentsResponses')" :active="request()->routeIs('admin.PatentsResponses')">
{{ __('Patents/Copyrights') }}
</x-nav-link>
<!-- Coordinator Routes -->
@elseif(auth()->user()->role->name === 'Coordinator')
@@ -51,6 +60,15 @@
<x-nav-link :href="route('coordinator.BooksPublishedResponses')" :active="request()->routeIs('coordinator.BooksPublishedResponses')">
{{ __('Books Published') }}
</x-nav-link>
<x-nav-link :href="route('coordinator.ExternalEngagementResponses')" :active="request()->routeIs('coordinator.ExternalEngagementResponses')">
{{ __('External Engagement') }}
</x-nav-link>
<x-nav-link :href="route('coordinator.OnlineCoursesResponses')" :active="request()->routeIs('coordinator.OnlineCoursesResponses')">
{{ __('Online Courses') }}
</x-nav-link>
<x-nav-link :href="route('coordinator.PatentsResponses')" :active="request()->routeIs('coordinator.PatentsResponses')">
{{ __('Patents/Copyrights') }}
</x-nav-link>
<!-- Faculty Routes with Dropdowns -->
@elseif(auth()->user()->role->name === 'Faculty')
@@ -133,6 +151,51 @@
</div>
</div>
</div>
<!-- External Engagement Dropdown -->
<div class="relative" x-data="{ open: false }">
<button @click="open = !open" @click.away="open = false" class="inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium leading-5 text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out">
{{ __('External Engagement') }}
<svg class="ml-1 -mr-0.5 h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</button>
<div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="absolute z-50 mt-2 w-48 rounded-md shadow-lg origin-top-right right-0" style="display: none;">
<div class="rounded-md ring-1 ring-black ring-opacity-5 py-1 bg-white">
<a href="{{ route('faculty.ExternalEngagementForm') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">{{ __('Submit Response') }}</a>
<a href="{{ route('faculty.ExternalEngagementResponses') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">{{ __('View Responses') }}</a>
</div>
</div>
</div>
<!-- Online Courses Dropdown -->
<div class="relative" x-data="{ open: false }">
<button @click="open = !open" @click.away="open = false" class="inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium leading-5 text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out">
{{ __('Online Courses') }}
<svg class="ml-1 -mr-0.5 h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</button>
<div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="absolute z-50 mt-2 w-48 rounded-md shadow-lg origin-top-right right-0" style="display: none;">
<div class="rounded-md ring-1 ring-black ring-opacity-5 py-1 bg-white">
<a href="{{ route('faculty.OnlineCoursesForm') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">{{ __('Submit Response') }}</a>
<a href="{{ route('faculty.OnlineCoursesResponses') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">{{ __('View Responses') }}</a>
</div>
</div>
</div>
<!-- Patents/Copyrights Dropdown -->
<div class="relative" x-data="{ open: false }">
<button @click="open = !open" @click.away="open = false" class="inline-flex items-center px-1 pt-1 border-b-2 border-transparent text-sm font-medium leading-5 text-gray-500 hover:text-gray-700 hover:border-gray-300 focus:outline-none focus:text-gray-700 focus:border-gray-300 transition duration-150 ease-in-out">
{{ __('Patents/Copyrights') }}
<svg class="ml-1 -mr-0.5 h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
</svg>
</button>
<div x-show="open" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="absolute z-50 mt-2 w-48 rounded-md shadow-lg origin-top-right right-0" style="display: none;">
<div class="rounded-md ring-1 ring-black ring-opacity-5 py-1 bg-white">
<a href="{{ route('faculty.PatentsForm') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">{{ __('Submit Response') }}</a>
<a href="{{ route('faculty.PatentsResponses') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">{{ __('View Responses') }}</a>
</div>
</div>
</div>
</div>
@endif
</div>

View File

@@ -0,0 +1,119 @@
@extends('layouts.app')
@section('content')
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
<div class="bg-white overflow-hidden shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-xl leading-6 font-semibold text-gray-900">
Edit Online Courses
</h3>
</div>
<div class="px-4 py-5 sm:p-6">
@if ($errors->any())
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ request()->is('admin/*') ? route('admin.OnlineCourses.update', $onlineCourse->id) : (request()->is('coordinator/*') ? route('coordinator.OnlineCourses.update', $onlineCourse->id) : route('faculty.OnlineCourses.update', $onlineCourse->id)) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="space-y-6">
<!-- course Information -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="course" class="block text-sm font-medium text-gray-700">Course Name</label>
<input type="text" name="course" id="course" value="{{ old('course', $onlineCourse->course) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required>
</div>
</div>
<!-- offered_by -->
<div>
<label for="offered_by" class="block text-sm font-medium text-gray-700">Offered By</label>
<input type="text" name="offered_by" id="offered_by" value="{{ old('offered_by', $onlineCourse->offered_by) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required>
</div>
<!-- Department and Faculty Name -->
<div class="grid grid-cols-2 sm:grid-cols-2 gap-4">
<div>
<label for="department" class="block text-sm font-medium text-gray-700">Department</label>
<input type="text" name="department" id="department" value="{{ $onlineCourse->department->name ?? 'Unknown' }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
<div>
<label for="faculty_name" class="block text-sm font-medium text-gray-700">Faculty Name</label>
<input type="text" name="faculty_name" id="faculty_name" value="{{ $onlineCourse->user->name ?? 'Unknown' }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label for="start_date" class="block text-sm font-medium text-gray-700">Start Date</label>
<input type="date" name="start_date" id="start_date" value="{{ old('start_date', \Carbon\Carbon::parse($onlineCourse->start_date)->format('Y-m-d')) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required onchange="calculateDays()">
</div>
<div>
<label for="end_date" class="block text-sm font-medium text-gray-700">End Date</label>
<input type="date" name="end_date" id="end_date" value="{{ old('end_date', \Carbon\Carbon::parse($onlineCourse->end_date)->format('Y-m-d')) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required onchange="calculateDays()">
</div>
<div>
<label for="num_days" class="block text-sm font-medium text-gray-700">Number of Days</label>
<input type="text" name="num_days" id="num_days" value="{{ old('num_days', $onlineCourse->num_days) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" readonly>
</div>
</div>
<!-- Proof File -->
<div>
<label for="proof" class="block text-sm font-medium text-gray-700">Upload Proof</label>
@if ($onlineCourse->proof)
<div class="mb-2">
<span class="text-sm text-gray-600">Current file:</span>
<a href="{{ asset('storage/' . $onlineCourse->proof) }}" target="_blank" class="ml-2 text-blue-600 hover:text-blue-800">View</a>
</div>
@endif
<input type="file" name="proof" id="proof" class="mt-1 block w-full text-sm text-gray-500
file:mr-4 file:py-2 file:px-4
file:rounded-full file:border-0
file:text-sm file:font-semibold
file:bg-blue-50 file:text-blue-700
hover:file:bg-blue-100">
<p class="mt-1 text-xs text-gray-500">Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP</p>
</div>
</div>
<!-- Submit Button -->
<div class="mt-6 flex items-center justify-end">
<a href="{{ request()->is('admin/*') ? route('admin.OnlineCoursesResponses') : (request()->is('coordinator/*') ? route('coordinator.OnlineCoursesResponses') : route('faculty.OnlineCoursesResponses')) }}" class="bg-gray-200 py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 mr-3">
Cancel
</a>
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-black">
Update
</button>
</div>
</form>
</div>
</div>
</div>
<script>
function calculateDays() {
const startDate = new Date(document.getElementById('start_date').value);
const endDate = new Date(document.getElementById('end_date').value);
if (startDate && endDate) {
const diffTime = Math.abs(endDate - startDate);
const numDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1; // +1 to include both start and end days
document.getElementById('num_days').value = numDays;
}
}
// Calculate days on page load
document.addEventListener('DOMContentLoaded', function() {
calculateDays();
});
</script>
@endsection

View File

@@ -0,0 +1,192 @@
@extends('layouts.app')
@section('content')
<div class="max-w-full mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-xl leading-6 font-semibold text-gray-900">
All Online Course
</h3>
</div>
<div class="px-4 py-5 sm:px-6">
<div class="overflow-x-auto w-full max-w-screen-lg mx-auto">
<table id="onlineCourse-table" class="table-auto w-full table-striped border-collapse border border-gray-200 rounded-lg">
<thead class="bg-gray-100">
<tr>
<th class="px-4 py-2 border border-gray-200">ID</th>
<th class="px-4 py-2 border border-gray-200">Faculty</th>
<th class="px-4 py-2 border border-gray-200">Department</th>
<th class="px-4 py-2 border border-gray-200">Course</th>
<th class="px-4 py-2 border border-gray-200">Offered By</th>
<th class="px-4 py-2 border border-gray-200">Start Date</th>
<th class="px-4 py-2 border border-gray-200">End Date</th>
<th class="px-4 py-2 border border-gray-200">Num Days</th>
<th class="px-4 py-2 border border-gray-200">Actions</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
<!-- DataTables JS -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.1/css/dataTables.bootstrap5.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.1/js/dataTables.bootstrap5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script>
$(document).ready(function() {
const sheetName = "Publications";
var initAjaxRoute = function(route) {
table = $("#onlineCourse-table").DataTable({
fnDestroy: true,
processing: true,
serverSide: true,
responsive: true,
ajax: {
url: route,
},
columns: [{
data: 'id',
name: 'id'
},
{
data: 'user_name',
name: 'user_name',
orderable: true
},
{
data: 'department_name',
name: 'department_name',
orderable: true
},
{
data: 'course',
name: 'course',
orderable: true
},
{
data: 'offered_by',
name: 'offered_by',
orderable: true
},
{
data: 'start_date',
name: 'start_date',
orderable: false
},
{
data: 'end_date',
name: 'end_date',
orderable: false
},
{
data: 'num_days',
name: 'num_days',
orderable: false
},
{
data: 'action',
name: 'action',
orderable: false,
searchable: false
},
],
columnDefs: [{
targets: '_all',
className: 'text-center wrap-text'
}, ],
dom: 'Bfrtip',
buttons: [{
extend: 'copy',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'csv',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'excel',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'pdf',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'print',
title: sheetName,
exportOptions: exportOptions()
}
]
});
};
// Delete button event handler
$('#onlineCourse-table').on('click', '.delete-btn', function() {
if (confirm('Are you sure you want to delete this record?')) {
const id = $(this).data('id');
const url = $(this).data('url');
$.ajax({
url: url,
type: 'DELETE',
data: {
"_token": "{{ csrf_token() }}"
},
success: function(result) {
table.ajax.reload();
alert('Online Course deleted successfully');
},
error: function(error) {
console.error(error);
alert('Error deleting Online Course');
}
});
}
});
function exportOptions() {
return {
columns: ':visible',
format: {
body: function(data, row, column, node) {
if ($(node).find('select').length) {
return $(node).find("select option:selected").text();
}
return $(node).text();
}
}
};
}
// Set appropriate route based on user role
const userRole = "{{ auth()->user()->role->name }}";
let dataRoute = "{{ route('admin.OnlineCoursesResponses.data') }}";
if (userRole === 'Coordinator') {
dataRoute = "{{ route('coordinator.OnlineCoursesResponses.data') }}";
}
if (userRole === 'Faculty') {
dataRoute = "{{ route('faculty.OnlineCoursesResponses.data') }}";
}
initAjaxRoute(dataRoute);
});
</script>
@endsection

View File

@@ -0,0 +1,114 @@
@extends('layouts.app')
@section('content')
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-6">
<div class="bg-white overflow-hidden shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-xl leading-6 font-semibold text-gray-900">
Edit Patents/Copyrights
</h3>
</div>
<div class="px-4 py-5 sm:p-6">
@if ($errors->any())
<div class="bg-red-100 border border-red-400 text-red-700 px-4 py-3 rounded mb-4">
<ul>
@foreach ($errors->all() as $error)
<li>{{ $error }}</li>
@endforeach
</ul>
</div>
@endif
<form action="{{ request()->is('admin/*') ? route('admin.Patents.update', $patent->id) : (request()->is('coordinator/*') ? route('coordinator.Patents.update', $patent->id) : route('faculty.Patents.update', $patent->id)) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="space-y-6">
<!-- title Information -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="title" class="block text-sm font-medium text-gray-700">Title</label>
<input type="text" name="title" id="title" value="{{ old('title', $patent->title) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required>
</div>
<!-- investigator -->
<div>
<label for="investigator" class="block text-sm font-medium text-gray-700">Investigator</label>
<input type="text" name="investigator" id="investigator" value="{{ old('investigator', $patent->investigator) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required>
</div>
</div>
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<div>
<label for="application_no" class="block text-sm font-medium text-gray-700">Application No</label>
<input type="text" name="application_no" id="application_no" value="{{ old('application_no', $patent->application_no) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required>
</div>
<!-- investigator -->
<div>
<label for="type" class="block text-sm font-medium text-gray-700">Type</label>
<input type="text" name="type" id="type" value="{{ old('type', $patent->type) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required>
</div>
</div>
<!-- Department and Faculty Name -->
<div class="grid grid-cols-2 sm:grid-cols-2 gap-4">
<div>
<label for="department" class="block text-sm font-medium text-gray-700">Department</label>
<input type="text" name="department" id="department" value="{{ $patent->department->name ?? 'Unknown' }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
<div>
<label for="faculty_name" class="block text-sm font-medium text-gray-700">Faculty Name</label>
<input type="text" name="faculty_name" id="faculty_name" value="{{ $patent->user->name ?? 'Unknown' }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
</div>
<div class="grid grid-cols-2 gap-4">
<div>
<label for="date_of_submission" class="block text-sm font-medium text-gray-700">Start Date</label>
<input type="date" name="date_of_submission" id="date_of_submission" value="{{ old('date_of_submission', \Carbon\Carbon::parse($patent->date_of_submission)->format('Y-m-d')) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required onchange="calculateDays()">
</div>
<div>
<label for="date_of_filling" class="block text-sm font-medium text-gray-700">End Date</label>
<input type="date" name="date_of_filling" id="date_of_filling" value="{{ old('date_of_filling', \Carbon\Carbon::parse($patent->date_of_filling)->format('Y-m-d')) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" required onchange="calculateDays()">
</div>
<div>
<label for="status" class="block text-sm font-medium text-gray-700">Number of Days</label>
<input type="text" name="status" id="status" value="{{ old('status', $patent->status) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100">
</div>
</div>
<!-- Proof File -->
<div>
<label for="proof" class="block text-sm font-medium text-gray-700">Upload Proof</label>
@if ($patent->proof)
<div class="mb-2">
<span class="text-sm text-gray-600">Current file:</span>
<a href="{{ asset('storage/' . $patent->proof) }}" target="_blank" class="ml-2 text-blue-600 hover:text-blue-800">View</a>
</div>
@endif
<input type="file" name="proof" id="proof" class="mt-1 block w-full text-sm text-gray-500
file:mr-4 file:py-2 file:px-4
file:rounded-full file:border-0
file:text-sm file:font-semibold
file:bg-blue-50 file:text-blue-700
hover:file:bg-blue-100">
<p class="mt-1 text-xs text-gray-500">Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP</p>
</div>
</div>
<!-- Submit Button -->
<div class="mt-6 flex items-center justify-end">
<a href="{{ request()->is('admin/*') ? route('admin.PatentsResponses') : (request()->is('coordinator/*') ? route('coordinator.PatentsResponses') : route('faculty.PatentsResponses')) }}" class="bg-gray-200 py-2 px-4 border border-gray-300 rounded-md shadow-sm text-sm font-medium text-gray-700 hover:bg-gray-300 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500 mr-3">
Cancel
</a>
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-black">
Update
</button>
</div>
</form>
</div>
</div>
</div>
@endsection

View File

@@ -0,0 +1,204 @@
@extends('layouts.app')
@section('content')
<div class="max-w-full mx-auto px-4 sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-xl leading-6 font-semibold text-gray-900">
All Patents
</h3>
</div>
<div class="px-4 py-5 sm:px-6">
<div class="overflow-x-auto w-full max-w-screen-lg mx-auto">
<table id="patents-table" class="table-auto w-full table-striped border-collapse border border-gray-200 rounded-lg">
<thead class="bg-gray-100">
<tr>
<th class="px-4 py-2 border border-gray-200">ID</th>
<th class="px-4 py-2 border border-gray-200">Faculty</th>
<th class="px-4 py-2 border border-gray-200">Department</th>
<th class="px-4 py-2 border border-gray-200">Title</th>
<th class="px-4 py-2 border border-gray-200">Investigator</th>
<th class="px-4 py-2 border border-gray-200">Application No</th>
<th class="px-4 py-2 border border-gray-200">Type</th>
<th class="px-4 py-2 border border-gray-200">Date Of Submission</th>
<th class="px-4 py-2 border border-gray-200">Date Of Filling</th>
<th class="px-4 py-2 border border-gray-200">Status</th>
<th class="px-4 py-2 border border-gray-200">Actions</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
<!-- DataTables JS -->
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.1/css/jquery.dataTables.min.css">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.13.1/css/dataTables.bootstrap5.min.css">
<script src="https://code.jquery.com/jquery-3.5.1.js"></script>
<script src="https://cdn.datatables.net/1.13.1/js/jquery.dataTables.min.js"></script>
<script src="https://cdn.datatables.net/1.13.1/js/dataTables.bootstrap5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/dataTables.buttons.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.html5.min.js"></script>
<script src="https://cdn.datatables.net/buttons/2.2.3/js/buttons.print.min.js"></script>
<script>
$(document).ready(function() {
const sheetName = "Publications";
var initAjaxRoute = function(route) {
table = $("#patents-table").DataTable({
fnDestroy: true,
processing: true,
serverSide: true,
responsive: true,
ajax: {
url: route,
},
columns: [{
data: 'id',
name: 'id'
},
{
data: 'user_name',
name: 'user_name',
orderable: true
},
{
data: 'department_name',
name: 'department_name',
orderable: true
},
{
data: 'title',
name: 'title',
orderable: true
},
{
data: 'investigator',
name: 'investigator',
orderable: true
},
{
data: 'application_no',
name: 'application_no',
orderable: false
},
{
data: 'type',
name: 'type',
orderable: false
},
{
data: 'date_of_submission',
name: 'date_of_submission',
orderable: false
},
{
data: 'date_of_filling',
name: 'date_of_filling',
orderable: false
},
{
data: 'status',
name: 'status',
orderable: false
},
{
data: 'action',
name: 'action',
orderable: false,
searchable: false
},
],
columnDefs: [{
targets: '_all',
className: 'text-center wrap-text'
}, ],
dom: 'Bfrtip',
buttons: [{
extend: 'copy',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'csv',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'excel',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'pdf',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'print',
title: sheetName,
exportOptions: exportOptions()
}
]
});
};
// Delete button event handler
$('#patents-table').on('click', '.delete-btn', function() {
if (confirm('Are you sure you want to delete this record?')) {
const id = $(this).data('id');
const url = $(this).data('url');
$.ajax({
url: url,
type: 'DELETE',
data: {
"_token": "{{ csrf_token() }}"
},
success: function(result) {
table.ajax.reload();
alert('Patent deleted successfully');
},
error: function(error) {
console.error(error);
alert('Error deleting Patent');
}
});
}
});
function exportOptions() {
return {
columns: ':visible',
format: {
body: function(data, row, column, node) {
if ($(node).find('select').length) {
return $(node).find("select option:selected").text();
}
return $(node).text();
}
}
};
}
// Set appropriate route based on user role
const userRole = "{{ auth()->user()->role->name }}";
let dataRoute = "{{ route('admin.PatentsResponses.data') }}";
if (userRole === 'Coordinator') {
dataRoute = "{{ route('coordinator.PatentsResponses.data') }}";
}
if (userRole === 'Faculty') {
dataRoute = "{{ route('faculty.PatentsResponses.data') }}";
}
initAjaxRoute(dataRoute);
});
</script>
@endsection

View File

@@ -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');
@@ -94,6 +106,27 @@ Route::middleware(['auth', CheckRole::class . ':Admin'])->group(function () {
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
@@ -134,6 +167,27 @@ Route::middleware(['auth', CheckRole::class . ':Coordinator'])->group(function (
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
@@ -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