Feat: Publication
This commit is contained in:
@@ -30,5 +30,9 @@ class AdminController extends Controller
|
||||
{
|
||||
return view('iv-organised.index');
|
||||
}
|
||||
public function viewPublicationsResponses()
|
||||
{
|
||||
return view('publications.index');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -31,4 +31,9 @@ class CoordinatorController extends Controller
|
||||
return view('iv-organised.index');
|
||||
}
|
||||
|
||||
public function viewPublicationsResponses()
|
||||
{
|
||||
return view('publications.index');
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ use Illuminate\Http\Request;
|
||||
use App\Models\ActivitiesAttended;
|
||||
use App\Models\ActivitiesOrganised;
|
||||
use App\Models\IvOrganised;
|
||||
use App\Models\Publication;
|
||||
|
||||
class FacultyController extends Controller
|
||||
{
|
||||
@@ -48,9 +49,19 @@ class FacultyController extends Controller
|
||||
return view('iv-organised.index');
|
||||
}
|
||||
|
||||
public function PublicationsForm()
|
||||
{
|
||||
// Logic to show the response form
|
||||
return view('faculty.publications-form');
|
||||
}
|
||||
|
||||
public function viewPublicationsResponses()
|
||||
{
|
||||
return view('publications.index');
|
||||
}
|
||||
|
||||
public function ActivitiesAttendedFormResponse(Request $request)
|
||||
{
|
||||
// dd($request->all(),"hello");
|
||||
try {
|
||||
// Validate the request data
|
||||
$validated = $request->validate([
|
||||
@@ -257,4 +268,75 @@ class FacultyController extends Controller
|
||||
return back()->withErrors('An error occurred while submitting your response: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public function PublicationsFormResponse(Request $request)
|
||||
{
|
||||
try {
|
||||
// Validate the request data
|
||||
$validated = $request->validate([
|
||||
'first_author_name' => 'required|string',
|
||||
'co_authors' => 'nullable|string',
|
||||
'start_date' => 'required|date',
|
||||
'start_time' => 'required|date_format:H:i',
|
||||
'end_date' => 'required|date',
|
||||
'end_time' => 'required|date_format:H:i',
|
||||
'num_days' => 'required|integer',
|
||||
'activity_type' => 'required|string',
|
||||
'title' => 'required|string',
|
||||
'affiliation' => 'required|string',
|
||||
'organizing_institute' => 'required|string',
|
||||
'venue_address' => 'required|string',
|
||||
'is_peer_reviewed' => 'required|in:yes,no',
|
||||
'scopus_link' => 'nullable|url',
|
||||
'sci_link' => 'nullable|url',
|
||||
'paper_file' => 'nullable|mimes:jpg,jpeg,png,pdf,doc,docx,zip',
|
||||
]);
|
||||
|
||||
// Combine start date and time
|
||||
$startDateTime = date('Y-m-d H:i:s', strtotime("{$validated['start_date']} {$validated['start_time']}"));
|
||||
$endDateTime = date('Y-m-d H:i:s', strtotime("{$validated['end_date']} {$validated['end_time']}"));
|
||||
|
||||
// Handle the file upload
|
||||
$paperFilePath = null;
|
||||
if ($request->hasFile('paper_file')) {
|
||||
$originalName = $request->file('paper_file')->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 . '/Publications';
|
||||
|
||||
// Store file in the specified path
|
||||
$paperFilePath = $request->file('paper_file')->storeAs($folderPath, $fileName, 'public');
|
||||
}
|
||||
|
||||
// Save the response to the database
|
||||
Publication::create([
|
||||
'department_id' => auth()->user()->department->id,
|
||||
'first_author_name' => $validated['first_author_name'],
|
||||
'co_authors' => $validated['co_authors'],
|
||||
'start_date' => $startDateTime,
|
||||
'end_date' => $endDateTime,
|
||||
'num_days' => $validated['num_days'],
|
||||
'activity_type' => $validated['activity_type'],
|
||||
'title' => $validated['title'],
|
||||
'affiliation' => $validated['affiliation'],
|
||||
'organizing_institute' => $validated['organizing_institute'],
|
||||
'venue_address' => $validated['venue_address'],
|
||||
'is_peer_reviewed' => $validated['is_peer_reviewed'],
|
||||
'scopus_link' => $validated['scopus_link'],
|
||||
'sci_link' => $validated['sci_link'],
|
||||
'paper_file' => $paperFilePath,
|
||||
'faculty_id' => auth()->user()->id,
|
||||
]);
|
||||
|
||||
return redirect()->route('faculty.dashboard')->with('status', 'Publication details submitted successfully');
|
||||
} catch (\Exception $e) {
|
||||
// Handle the exception and provide an error message
|
||||
return back()->withErrors('An error occurred while submitting your publication: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
194
app/Http/Controllers/PublicationsController.php
Normal file
194
app/Http/Controllers/PublicationsController.php
Normal file
@@ -0,0 +1,194 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Yajra\DataTables\Facades\DataTables;
|
||||
use App\Models\Publication;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
|
||||
class PublicationsController extends Controller
|
||||
{
|
||||
public function edit($id)
|
||||
{
|
||||
$publication = Publication::findOrFail($id);
|
||||
|
||||
return view('publications.edit', compact('publication'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$publication = Publication::findOrFail($id);
|
||||
|
||||
// Validate the request data
|
||||
$validated = $request->validate([
|
||||
'first_author_name' => 'required|string',
|
||||
'co_authors' => 'nullable|string',
|
||||
'start_date' => 'required|date',
|
||||
'start_time' => 'required|date_format:H:i',
|
||||
'end_date' => 'required|date',
|
||||
'end_time' => 'required|date_format:H:i',
|
||||
'num_days' => 'required|integer',
|
||||
'activity_type' => 'required|string',
|
||||
'title' => 'required|string',
|
||||
'affiliation' => 'required|string',
|
||||
'organizing_institute' => 'required|string',
|
||||
'venue_address' => 'required|string',
|
||||
'is_peer_reviewed' => 'required|in:yes,no',
|
||||
'scopus_link' => 'nullable|url',
|
||||
'sci_link' => 'nullable|url',
|
||||
'paper_file' => 'nullable|mimes:jpg,jpeg,png,pdf,doc,docx,zip',
|
||||
]);
|
||||
|
||||
// Combine start date and time
|
||||
$startDateTime = date('Y-m-d H:i:s', strtotime("{$validated['start_date']} {$validated['start_time']}"));
|
||||
$endDateTime = date('Y-m-d H:i:s', strtotime("{$validated['end_date']} {$validated['end_time']}"));
|
||||
|
||||
// Handle the file upload if a new file is provided
|
||||
if ($request->hasFile('paper_file')) {
|
||||
// Delete old file if exists
|
||||
if ($publication->paper_file && Storage::disk('public')->exists($publication->paper_file)) {
|
||||
Storage::disk('public')->delete($publication->paper_file);
|
||||
}
|
||||
|
||||
// Extract year from start_date
|
||||
$year = date('Y', strtotime($validated['start_date']));
|
||||
$username = $publication->user->name;
|
||||
|
||||
$originalName = $request->file('paper_file')->getClientOriginalName();
|
||||
$fileName = $username . '_' . $originalName;
|
||||
|
||||
// Create path structure: year/faculty_name/Publications
|
||||
$folderPath = 'proofs/' . $year . '/' . $username . '/Publications';
|
||||
|
||||
// Store file in the specified path
|
||||
$paperFilePath = $request->file('paper_file')->storeAs($folderPath, $fileName, 'public');
|
||||
|
||||
$publication->paper_file = $paperFilePath;
|
||||
}
|
||||
|
||||
// Update other fields
|
||||
$publication->first_author_name = $validated['first_author_name'];
|
||||
$publication->co_authors = $validated['co_authors'];
|
||||
$publication->start_date = $startDateTime;
|
||||
$publication->end_date = $endDateTime;
|
||||
$publication->num_days = $validated['num_days'];
|
||||
$publication->activity_type = $validated['activity_type'];
|
||||
$publication->title = $validated['title'];
|
||||
$publication->affiliation = $validated['affiliation'];
|
||||
$publication->organizing_institute = $validated['organizing_institute'];
|
||||
$publication->venue_address = $validated['venue_address'];
|
||||
$publication->is_peer_reviewed = $validated['is_peer_reviewed'];
|
||||
$publication->scopus_link = $validated['scopus_link'];
|
||||
$publication->sci_link = $validated['sci_link'];
|
||||
|
||||
$publication->save();
|
||||
|
||||
$userRole = auth()->user()->role->name;
|
||||
|
||||
if ($userRole === 'Admin') {
|
||||
return redirect()->route('admin.PublicationsResponses')
|
||||
->with('status', 'Publication updated successfully');
|
||||
} elseif ($userRole === 'Coordinator') {
|
||||
return redirect()->route('coordinator.PublicationsResponses')
|
||||
->with('status', 'Publication updated successfully');
|
||||
} else {
|
||||
// For regular users
|
||||
return redirect()->route('faculty.PublicationsResponses')
|
||||
->with('status', 'Publication updated successfully');
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$publication = Publication::findOrFail($id);
|
||||
|
||||
// Delete the file if it exists
|
||||
if ($publication->paper_file && Storage::disk('public')->exists($publication->paper_file)) {
|
||||
Storage::disk('public')->delete($publication->paper_file);
|
||||
}
|
||||
|
||||
$publication->delete();
|
||||
|
||||
return response()->json(['success' => 'Publication deleted successfully']);
|
||||
}
|
||||
|
||||
public function getPublicationsResponses()
|
||||
{
|
||||
$user = auth()->user();
|
||||
$isAdmin = $user->role->name === 'Admin';
|
||||
$isCoordinator = $user->role->name === 'Coordinator';
|
||||
|
||||
// Query based on role
|
||||
if ($isAdmin) {
|
||||
// Admin sees all records
|
||||
$publications = Publication::with('user', 'department');
|
||||
} elseif ($isCoordinator) {
|
||||
// Coordinator sees only their department's records
|
||||
$publications = Publication::with('user', 'department')
|
||||
->whereHas('user', function ($query) use ($user) {
|
||||
$query->where('department_id', $user->department_id);
|
||||
});
|
||||
} else {
|
||||
// Regular users see only their own records
|
||||
$publications = Publication::with('user', 'department')
|
||||
->where('faculty_id', $user->id);
|
||||
}
|
||||
|
||||
return DataTables::of($publications)
|
||||
->addColumn('user_name', function ($publication) {
|
||||
return $publication->user->name ?? 'Unknown';
|
||||
})
|
||||
->addColumn('department_name', function ($publication) {
|
||||
return $publication->department->name ?? 'Unknown';
|
||||
})
|
||||
->addColumn('start_date', function ($publication) {
|
||||
return \Carbon\Carbon::parse($publication->start_date)->format('d-m-Y');
|
||||
})
|
||||
->addColumn('start_time', function ($publication) {
|
||||
return \Carbon\Carbon::parse($publication->start_date)->format('h:i A');
|
||||
})
|
||||
->addColumn('end_date', function ($publication) {
|
||||
return \Carbon\Carbon::parse($publication->end_date)->format('d-m-Y');
|
||||
})
|
||||
->addColumn('end_time', function ($publication) {
|
||||
return \Carbon\Carbon::parse($publication->end_date)->format('h:i A');
|
||||
})
|
||||
->addColumn('is_scopus_indexed', function ($publication) {
|
||||
return $publication->isScopusIndexed() ? 'Yes' : 'No';
|
||||
})
|
||||
->addColumn('is_sci_indexed', function ($publication) {
|
||||
return $publication->isSciIndexed() ? 'Yes' : 'No';
|
||||
})
|
||||
->addColumn('action', function ($publication) {
|
||||
$actions = [];
|
||||
|
||||
// View paper_file button for everyone
|
||||
if ($publication->paper_file) {
|
||||
$actions[] = '<a href="' . asset('storage/' . $publication->paper_file) . '" target="_blank" class="btn btn-sm btn-primary mr-1">View Paper</a>';
|
||||
} else {
|
||||
$actions[] = 'No Paper';
|
||||
}
|
||||
|
||||
// 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.Publications.edit', $publication->id);
|
||||
} elseif ($userRole === 'Coordinator') {
|
||||
$editRoute = route('coordinator.Publications.edit', $publication->id);
|
||||
} else {
|
||||
$editRoute = route('faculty.Publications.edit', $publication->id);
|
||||
}
|
||||
|
||||
$actions[] = '<a href="' . $editRoute . '" class="btn btn-sm btn-info mx-1">Edit</a>';
|
||||
|
||||
$deleteRoute = route('publications.destroy', $publication->id);
|
||||
$actions[] = '<button type="button" class="btn btn-sm btn-danger delete-btn" data-id="' . $publication->id . '" data-url="' . $deleteRoute . '">Delete</button>';
|
||||
|
||||
return implode(' ', $actions);
|
||||
})
|
||||
->rawColumns(['action'])
|
||||
->make(true);
|
||||
}
|
||||
}
|
||||
69
app/Models/Publication.php
Normal file
69
app/Models/Publication.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Publication extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'department_id',
|
||||
'first_author_name',
|
||||
'co_authors',
|
||||
'start_date',
|
||||
'end_date',
|
||||
'num_days',
|
||||
'activity_type',
|
||||
'title',
|
||||
'affiliation',
|
||||
'organizing_institute',
|
||||
'venue_address',
|
||||
'is_peer_reviewed',
|
||||
'scopus_link',
|
||||
'sci_link',
|
||||
'paper_file',
|
||||
'faculty_id'
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'start_date' => 'datetime',
|
||||
'end_date' => 'datetime',
|
||||
'num_days' => 'integer',
|
||||
'is_peer_reviewed' => 'string'
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the department that owns the publication.
|
||||
*/
|
||||
public function department()
|
||||
{
|
||||
return $this->belongsTo(Department::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the faculty user that owns the publication.
|
||||
*/
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class, 'faculty_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the publication is Scopus indexed.
|
||||
*/
|
||||
public function isScopusIndexed()
|
||||
{
|
||||
return !is_null($this->scopus_link);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the publication is SCI indexed.
|
||||
*/
|
||||
public function isSciIndexed()
|
||||
{
|
||||
return !is_null($this->sci_link);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<?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('publications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedBigInteger('department_id');
|
||||
$table->string('first_author_name');
|
||||
$table->text('co_authors')->nullable(); // For storing multiple co-author names
|
||||
$table->dateTime('start_date');
|
||||
$table->dateTime('end_date');
|
||||
$table->integer('num_days');
|
||||
$table->string('activity_type');
|
||||
$table->string('title');
|
||||
$table->text('affiliation'); // Name of conference/journal
|
||||
$table->string('organizing_institute');
|
||||
$table->text('venue_address');
|
||||
$table->enum('is_peer_reviewed', ['yes', 'no'])->default('no');
|
||||
$table->text('scopus_link')->nullable(); // Null means not Scopus indexed
|
||||
$table->text('sci_link')->nullable(); // Null means not SCI indexed
|
||||
$table->string('paper_file')->nullable(); // For file path
|
||||
$table->unsignedBigInteger('faculty_id'); // Faculty who uploaded the publication
|
||||
|
||||
// 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->index(['start_date', 'end_date']);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('publications');
|
||||
}
|
||||
};
|
||||
166
resources/views/faculty/publications-form.blade.php
Normal file
166
resources/views/faculty/publications-form.blade.php
Normal file
@@ -0,0 +1,166 @@
|
||||
@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 Publication Details
|
||||
</h3>
|
||||
<p class="mt-1 max-w-2xl text-sm text-gray-500">
|
||||
Fill in the details of your publication.
|
||||
</p>
|
||||
</div>
|
||||
<div class="border-t border-gray-200">
|
||||
<form method="POST" action="{{ route('faculty.PublicationsFormResponse') }}" 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="first_author_name" class="block text-sm font-medium text-gray-700">First Author Name</label>
|
||||
<input type="text" name="first_author_name" id="first_author_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" required>
|
||||
</div>
|
||||
<div>
|
||||
<label for="co_authors" class="block text-sm font-medium text-gray-700">Co-Authors (if any)</label>
|
||||
<input type="text" name="co_authors" id="co_authors" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" placeholder="Separate names with commas">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Publication Title -->
|
||||
<div>
|
||||
<label for="title" class="block text-sm font-medium text-gray-700">Publication 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>
|
||||
|
||||
<!-- Publication Venue Information -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label for="affiliation" class="block text-sm font-medium text-gray-700">Conference/Journal Name</label>
|
||||
<input type="text" name="affiliation" id="affiliation" 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="organizing_institute" class="block text-sm font-medium text-gray-700">Organizing Institute</label>
|
||||
<input type="text" name="organizing_institute" id="organizing_institute" 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>
|
||||
|
||||
<div>
|
||||
<label for="venue_address" class="block text-sm font-medium text-gray-700">Venue Address</label>
|
||||
<input type="text" name="venue_address" id="venue_address" 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>
|
||||
</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>
|
||||
|
||||
<!-- Time Fields -->
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label for="start_time" class="block text-sm font-medium text-gray-700">Start Time</label>
|
||||
<input type="time" name="start_time" id="start_time" 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="end_time" class="block text-sm font-medium text-gray-700">End Time</label>
|
||||
<input type="time" name="end_time" id="end_time" 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>
|
||||
|
||||
<!-- Publication Type -->
|
||||
<div>
|
||||
<label for="activity_type" class="block text-sm font-medium text-gray-700">Select Publication Type</label>
|
||||
<select name="activity_type" id="activity_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" required>
|
||||
<option value="">Select</option>
|
||||
@if(isset($dropdowns['publication_types']) && is_array($dropdowns['publication_types']))
|
||||
@foreach($dropdowns['publication_types'] as $key => $label)
|
||||
<option value="{{ $key }}">{{ $label }}</option>
|
||||
@endforeach
|
||||
@else
|
||||
<option value="journal">Journal Paper</option>
|
||||
<option value="conference">Conference Paper</option>
|
||||
<option value="book">Book/Book Chapter</option>
|
||||
<option value="magazine">Magazine Article</option>
|
||||
<option value="other">Other</option>
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Publication Quality -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4">
|
||||
<div>
|
||||
<label for="is_peer_reviewed" class="block text-sm font-medium text-gray-700">Peer Reviewed</label>
|
||||
<select name="is_peer_reviewed" id="is_peer_reviewed" 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>
|
||||
<option value="yes">Yes</option>
|
||||
<option value="no">No</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="scopus_link" class="block text-sm font-medium text-gray-700">Scopus Link (if indexed)</label>
|
||||
<input type="url" name="scopus_link" id="scopus_link" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" placeholder="https://www.scopus.com/...">
|
||||
</div>
|
||||
<div>
|
||||
<label for="sci_link" class="block text-sm font-medium text-gray-700">SCI Link (if indexed)</label>
|
||||
<input type="url" name="sci_link" id="sci_link" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" placeholder="https://www.webofscience.com/...">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Paper File -->
|
||||
<div>
|
||||
<label for="paper_file" class="block text-sm font-medium text-gray-700">Upload Paper</label>
|
||||
<input type="file" name="paper_file" id="paper_file" 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 Publication
|
||||
</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
|
||||
@@ -27,6 +27,9 @@
|
||||
<x-nav-link :href="route('admin.IvOrganisedResponses')" :active="request()->routeIs('admin.IvOrganisedResponses')">
|
||||
{{ __('IV Organised') }}
|
||||
</x-nav-link>
|
||||
<x-nav-link :href="route('admin.PublicationsResponses')" :active="request()->routeIs('admin.PublicationsResponses')">
|
||||
{{ __('Publications') }}
|
||||
</x-nav-link>
|
||||
|
||||
<!-- Coordinator Routes -->
|
||||
@elseif(auth()->user()->role->name === 'Coordinator')
|
||||
@@ -39,6 +42,9 @@
|
||||
<x-nav-link :href="route('coordinator.IvOrganisedResponses')" :active="request()->routeIs('coordinator.IvOrganisedResponses')">
|
||||
{{ __('IV Organised') }}
|
||||
</x-nav-link>
|
||||
<x-nav-link :href="route('coordinator.PublicationsResponses')" :active="request()->routeIs('coordinator.PublicationsResponses')">
|
||||
{{ __('Publications') }}
|
||||
</x-nav-link>
|
||||
|
||||
<!-- Faculty Routes with Dropdowns -->
|
||||
@elseif(auth()->user()->role->name === 'Faculty')
|
||||
@@ -91,6 +97,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Publications 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">
|
||||
{{ __('Publications') }}
|
||||
<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.PublicationsForm') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">{{ __('Submit Response') }}</a>
|
||||
<a href="{{ route('faculty.PublicationsResponses') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">{{ __('View Responses') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
189
resources/views/publications/edit.blade.php
Normal file
189
resources/views/publications/edit.blade.php
Normal file
@@ -0,0 +1,189 @@
|
||||
@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 Publication
|
||||
</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.Publications.update', $publication->id) : (request()->is('coordinator/*') ? route('coordinator.Publications.update', $publication->id) : route('faculty.Publications.update', $publication->id)) }}" method="POST" enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="space-y-6">
|
||||
<!-- Author Information -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label for="first_author_name" class="block text-sm font-medium text-gray-700">First Author Name</label>
|
||||
<input type="text" name="first_author_name" id="first_author_name" value="{{ old('first_author_name', $publication->first_author_name) }}" 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>
|
||||
<label for="co_authors" class="block text-sm font-medium text-gray-700">Co-Authors (if any)</label>
|
||||
<input type="text" name="co_authors" id="co_authors" value="{{ old('co_authors', $publication->co_authors) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" placeholder="Separate names with commas">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Publication Title -->
|
||||
<div>
|
||||
<label for="title" class="block text-sm font-medium text-gray-700">Publication Title</label>
|
||||
<input type="text" name="title" id="title" value="{{ old('title', $publication->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>
|
||||
|
||||
<!-- Publication Venue Information -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label for="affiliation" class="block text-sm font-medium text-gray-700">Conference/Journal Name</label>
|
||||
<input type="text" name="affiliation" id="affiliation" value="{{ old('affiliation', $publication->affiliation) }}" 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>
|
||||
<label for="organizing_institute" class="block text-sm font-medium text-gray-700">Organizing Institute</label>
|
||||
<input type="text" name="organizing_institute" id="organizing_institute" value="{{ old('organizing_institute', $publication->organizing_institute) }}" 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>
|
||||
<label for="venue_address" class="block text-sm font-medium text-gray-700">Venue Address</label>
|
||||
<input type="text" name="venue_address" id="venue_address" value="{{ old('venue_address', $publication->venue_address) }}" 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="{{ $publication->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="{{ $publication->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>
|
||||
|
||||
<!-- 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" value="{{ old('start_date', \Carbon\Carbon::parse($publication->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($publication->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', $publication->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>
|
||||
|
||||
<!-- Time Fields -->
|
||||
<div class="grid grid-cols-2 gap-4">
|
||||
<div>
|
||||
<label for="start_time" class="block text-sm font-medium text-gray-700">Start Time</label>
|
||||
<input type="time" name="start_time" id="start_time" value="{{ old('start_time', \Carbon\Carbon::parse($publication->start_date)->format('H:i')) }}" 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>
|
||||
<label for="end_time" class="block text-sm font-medium text-gray-700">End Time</label>
|
||||
<input type="time" name="end_time" id="end_time" value="{{ old('end_time', \Carbon\Carbon::parse($publication->end_date)->format('H:i')) }}" 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>
|
||||
|
||||
<!-- Publication Type -->
|
||||
<div>
|
||||
<label for="activity_type" class="block text-sm font-medium text-gray-700">Select Publication Type</label>
|
||||
<select name="activity_type" id="activity_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>
|
||||
<option value="">Select</option>
|
||||
@if(isset($dropdowns['publication_types']) && is_array($dropdowns['publication_types']))
|
||||
@foreach($dropdowns['publication_types'] as $key => $label)
|
||||
<option value="{{ $key }}" {{ old('activity_type', $publication->activity_type) == $key ? 'selected' : '' }}>{{ $label }}</option>
|
||||
@endforeach
|
||||
@else
|
||||
<option value="journal" {{ old('activity_type', $publication->activity_type) == 'journal' ? 'selected' : '' }}>Journal Paper</option>
|
||||
<option value="conference" {{ old('activity_type', $publication->activity_type) == 'conference' ? 'selected' : '' }}>Conference Paper</option>
|
||||
<option value="book" {{ old('activity_type', $publication->activity_type) == 'book' ? 'selected' : '' }}>Book/Book Chapter</option>
|
||||
<option value="magazine" {{ old('activity_type', $publication->activity_type) == 'magazine' ? 'selected' : '' }}>Magazine Article</option>
|
||||
<option value="other" {{ old('activity_type', $publication->activity_type) == 'other' ? 'selected' : '' }}>Other</option>
|
||||
@endif
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<!-- Publication Quality -->
|
||||
<div class="grid grid-cols-1 sm:grid-cols-3 gap-4">
|
||||
<div>
|
||||
<label for="is_peer_reviewed" class="block text-sm font-medium text-gray-700">Peer Reviewed</label>
|
||||
<select name="is_peer_reviewed" id="is_peer_reviewed" 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>
|
||||
<option value="yes" {{ old('is_peer_reviewed', $publication->is_peer_reviewed) == 'yes' ? 'selected' : '' }}>Yes</option>
|
||||
<option value="no" {{ old('is_peer_reviewed', $publication->is_peer_reviewed) == 'no' ? 'selected' : '' }}>No</option>
|
||||
</select>
|
||||
</div>
|
||||
<div>
|
||||
<label for="scopus_link" class="block text-sm font-medium text-gray-700">Scopus Link (if indexed)</label>
|
||||
<input type="url" name="scopus_link" id="scopus_link" value="{{ old('scopus_link', $publication->scopus_link) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" placeholder="https://www.scopus.com/...">
|
||||
</div>
|
||||
<div>
|
||||
<label for="sci_link" class="block text-sm font-medium text-gray-700">SCI Link (if indexed)</label>
|
||||
<input type="url" name="sci_link" id="sci_link" value="{{ old('sci_link', $publication->sci_link) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" placeholder="https://www.webofscience.com/...">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Paper File -->
|
||||
<div>
|
||||
<label for="paper_file" class="block text-sm font-medium text-gray-700">Upload Paper</label>
|
||||
@if ($publication->paper_file)
|
||||
<div class="mb-2">
|
||||
<span class="text-sm text-gray-600">Current file:</span>
|
||||
<a href="{{ asset('storage/' . $publication->paper_file) }}" target="_blank" class="ml-2 text-blue-600 hover:text-blue-800">View</a>
|
||||
</div>
|
||||
@endif
|
||||
<input type="file" name="paper_file" id="paper_file" 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.PublicationsResponses') : (request()->is('coordinator/*') ? route('coordinator.PublicationsResponses') : route('faculty.PublicationsResponses')) }}" 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
|
||||
216
resources/views/publications/index.blade.php
Normal file
216
resources/views/publications/index.blade.php
Normal file
@@ -0,0 +1,216 @@
|
||||
@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 Publications
|
||||
</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="publications-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">Title</th>
|
||||
<th class="px-4 py-2 border border-gray-200">First Author</th>
|
||||
<th class="px-4 py-2 border border-gray-200">Type</th>
|
||||
<th class="px-4 py-2 border border-gray-200">Journal/Conference</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">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">Peer Reviewed</th>
|
||||
<th class="px-4 py-2 border border-gray-200">Scopus</th>
|
||||
<th class="px-4 py-2 border border-gray-200">SCI</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 = $("#publications-table").DataTable({
|
||||
fnDestroy: true,
|
||||
processing: true,
|
||||
serverSide: true,
|
||||
responsive: true,
|
||||
ajax: {
|
||||
url: route,
|
||||
},
|
||||
columns: [{
|
||||
data: 'id',
|
||||
name: 'id'
|
||||
},
|
||||
{
|
||||
data: 'title',
|
||||
name: 'title',
|
||||
orderable: true
|
||||
},
|
||||
{
|
||||
data: 'first_author_name',
|
||||
name: 'first_author_name',
|
||||
orderable: true
|
||||
},
|
||||
{
|
||||
data: 'activity_type',
|
||||
name: 'activity_type',
|
||||
orderable: true
|
||||
},
|
||||
{
|
||||
data: 'affiliation',
|
||||
name: 'affiliation',
|
||||
orderable: true
|
||||
},
|
||||
{
|
||||
data: 'user_name',
|
||||
name: 'user_name',
|
||||
orderable: false
|
||||
},
|
||||
{
|
||||
data: 'department_name',
|
||||
name: 'department_name',
|
||||
orderable: false
|
||||
},
|
||||
{
|
||||
data: 'start_date',
|
||||
name: 'start_date',
|
||||
orderable: true
|
||||
},
|
||||
{
|
||||
data: 'end_date',
|
||||
name: 'end_date',
|
||||
orderable: true
|
||||
},
|
||||
{
|
||||
data: 'is_peer_reviewed',
|
||||
name: 'is_peer_reviewed',
|
||||
orderable: true
|
||||
},
|
||||
{
|
||||
data: 'is_scopus_indexed',
|
||||
name: 'is_scopus_indexed',
|
||||
orderable: false
|
||||
},
|
||||
{
|
||||
data: 'is_sci_indexed',
|
||||
name: 'is_sci_indexed',
|
||||
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
|
||||
$('#publications-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('Publication deleted successfully');
|
||||
},
|
||||
error: function(error) {
|
||||
console.error(error);
|
||||
alert('Error deleting publication');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
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.PublicationsResponses.data') }}";
|
||||
|
||||
if (userRole === 'Coordinator') {
|
||||
dataRoute = "{{ route('coordinator.PublicationsResponses.data') }}";
|
||||
}
|
||||
if (userRole === 'Faculty') {
|
||||
dataRoute = "{{ route('faculty.PublicationsResponses.data') }}";
|
||||
}
|
||||
|
||||
initAjaxRoute(dataRoute);
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
@@ -11,6 +11,7 @@ use App\Http\Controllers\AdminController;
|
||||
use App\Http\Controllers\CoordinatorController;
|
||||
use App\Http\Controllers\FacultyController;
|
||||
use App\Http\Controllers\IvOrganisedController;
|
||||
use App\Http\Controllers\PublicationsController;
|
||||
use App\Http\Middleware\CheckRole;
|
||||
|
||||
Route::get('/', function () {
|
||||
@@ -48,6 +49,9 @@ Route::delete('/activities-organised/{id}', [ActivitiesOrganisedController::clas
|
||||
// Iv Organised common routes
|
||||
Route::delete('/iv-organised/{id}', [IvOrganisedController::class, 'destroy'])->name('ivOrganised.destroy');
|
||||
|
||||
// Publications common routes
|
||||
Route::delete('/publication/{id}', [PublicationsController::class, 'destroy'])->name('publications.destroy');
|
||||
|
||||
// Admin routes
|
||||
Route::middleware(['auth', CheckRole::class . ':Admin'])->group(function () {
|
||||
Route::get('/admin', [AdminController::class, 'index'])->name('admin.dashboard');
|
||||
@@ -72,6 +76,13 @@ Route::middleware(['auth', CheckRole::class . ':Admin'])->group(function () {
|
||||
Route::get('/admin/iv-organised/{id}/edit', [IvOrganisedController::class, 'edit'])->name('admin.IvOrganised.edit');
|
||||
Route::put('/admin/iv-organised/{id}', [IvOrganisedController::class, 'update'])->name('admin.IvOrganised.update');
|
||||
Route::delete('/admin/iv-organised/{id}', [IvOrganisedController::class, 'destroy'])->name('admin.IvOrganised.destroy');
|
||||
|
||||
// Publications Routes
|
||||
Route::get('/admin/PublicationsResponses', [AdminController::class, 'viewPublicationsResponses'])->name('admin.PublicationsResponses');
|
||||
Route::get('/admin/PublicationsResponses/data', [PublicationsController::class, 'getPublicationsResponses'])->name('admin.PublicationsResponses.data');
|
||||
Route::get('/admin/publication/{id}/edit', [PublicationsController::class, 'edit'])->name('admin.Publications.edit');
|
||||
Route::put('/admin/publication/{id}', [PublicationsController::class, 'update'])->name('admin.Publications.update');
|
||||
Route::delete('/admin/publication/{id}', [PublicationsController::class, 'destroy'])->name('admin.Publications.destroy');
|
||||
});
|
||||
|
||||
// Coordinator routes
|
||||
@@ -98,6 +109,13 @@ Route::middleware(['auth', CheckRole::class . ':Coordinator'])->group(function (
|
||||
Route::get('/coordinator/iv-organised/{id}/edit', [IvOrganisedController::class, 'edit'])->name('coordinator.IvOrganised.edit');
|
||||
Route::put('/coordinator/iv-organised/{id}', [IvOrganisedController::class, 'update'])->name('coordinator.IvOrganised.update');
|
||||
Route::delete('/coordinator/iv-organised/{id}', [IvOrganisedController::class, 'destroy'])->name('coordinator.IvOrganised.destroy');
|
||||
|
||||
// Publications Routes
|
||||
Route::get('/coordinator/PublicationsResponses', [CoordinatorController::class, 'viewPublicationsResponses'])->name('coordinator.PublicationsResponses');
|
||||
Route::get('/coordinator/PublicationsResponses/data', [PublicationsController::class, 'getPublicationsResponses'])->name('coordinator.PublicationsResponses.data');
|
||||
Route::get('/coordinator/publication/{id}/edit', [PublicationsController::class, 'edit'])->name('coordinator.Publications.edit');
|
||||
Route::put('/coordinator/publication/{id}', [PublicationsController::class, 'update'])->name('coordinator.Publications.update');
|
||||
Route::delete('/coordinator/publication/{id}', [PublicationsController::class, 'destroy'])->name('coordinator.Publications.destroy');
|
||||
});
|
||||
|
||||
// Faculty routes
|
||||
@@ -127,6 +145,14 @@ Route::middleware(['auth', CheckRole::class . ':Faculty'])->group(function () {
|
||||
Route::get('/faculty/IvOrganisedResponses/data', [IvOrganisedController::class, 'getIvOrganisedResponses'])->name('faculty.IvOrganisedResponses.data');
|
||||
Route::get('/faculty/iv-organised/{id}/edit', [IvOrganisedController::class, 'edit'])->name('faculty.IvOrganised.edit');
|
||||
Route::put('/faculty/iv-organised/{id}', [IvOrganisedController::class, 'update'])->name('faculty.IvOrganised.update');
|
||||
|
||||
// Publications Routes
|
||||
Route::get('/faculty/PublicationsForm', [FacultyController::class, 'PublicationsForm'])->name('faculty.PublicationsForm');
|
||||
Route::post('/faculty/PublicationsFormResponse', [FacultyController::class, 'PublicationsFormResponse'])->name('faculty.PublicationsFormResponse');
|
||||
Route::get('/faculty/PublicationsResponses', [FacultyController::class, 'viewPublicationsResponses'])->name('faculty.PublicationsResponses');
|
||||
Route::get('/faculty/PublicationsResponses/data', [PublicationsController::class, 'getPublicationsResponses'])->name('faculty.PublicationsResponses.data');
|
||||
Route::get('/faculty/publication/{id}/edit', [PublicationsController::class, 'edit'])->name('faculty.Publications.edit');
|
||||
Route::put('/faculty/publication/{id}', [PublicationsController::class, 'update'])->name('faculty.Publications.update');
|
||||
});
|
||||
|
||||
// API Resources
|
||||
|
||||
Reference in New Issue
Block a user