Refeactor: Change the folder for pages for better organization
This commit is contained in:
189
resources/views/pages/publications/edit.blade.php
Normal file
189
resources/views/pages/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/pages/publications/index.blade.php
Normal file
216
resources/views/pages/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
|
||||
Reference in New Issue
Block a user