Feat: books published
This commit is contained in:
107
resources/views/booksPublished/edit.blade.php
Normal file
107
resources/views/booksPublished/edit.blade.php
Normal file
@@ -0,0 +1,107 @@
|
||||
@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.BooksPublished.update', $booksPublished->id) : (request()->is('coordinator/*') ? route('coordinator.BooksPublished.update', $booksPublished->id) : route('faculty.BooksPublished.update', $booksPublished->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="author" class="block text-sm font-medium text-gray-700">Author Name</label>
|
||||
<input type="text" name="author" id="author" value="{{ old('author', $booksPublished->author) }}" 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 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', $booksPublished->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="publisher" class="block text-sm font-medium text-gray-700">Publisher Name</label>
|
||||
<input type="text" name="publisher" id="publisher" value="{{ old('publisher', $booksPublished->publisher) }}" 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="issn" class="block text-sm font-medium text-gray-700">ISSN/eISSN number</label>
|
||||
<input type="text" name="issn" id="issn" value="{{ old('issn', $booksPublished->issn) }}" 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="{{ $booksPublished->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="{{ $booksPublished->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="date_of_publication" class="block text-sm font-medium text-gray-700">Start Date</label>
|
||||
<input type="date" name="date_of_publication" id="date_of_publication" value="{{ old('date_of_publication', \Carbon\Carbon::parse($booksPublished->date_of_publication)->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>
|
||||
|
||||
<!-- Proof File -->
|
||||
<div>
|
||||
<label for="proof_file" class="block text-sm font-medium text-gray-700">Upload Proof</label>
|
||||
@if ($booksPublished->proof_file)
|
||||
<div class="mb-2">
|
||||
<span class="text-sm text-gray-600">Current file:</span>
|
||||
<a href="{{ asset('storage/' . $booksPublished->proof_file) }}" target="_blank" class="ml-2 text-blue-600 hover:text-blue-800">View</a>
|
||||
</div>
|
||||
@endif
|
||||
<input type="file" name="proof_file" id="proof_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.BooksPublishedResponses') : (request()->is('coordinator/*') ? route('coordinator.BooksPublishedResponses') : route('faculty.BooksPublishedResponses')) }}" 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
|
||||
186
resources/views/booksPublished/index.blade.php
Normal file
186
resources/views/booksPublished/index.blade.php
Normal file
@@ -0,0 +1,186 @@
|
||||
@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 Books Published
|
||||
</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="booksPublished-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">Author</th>
|
||||
<th class="px-4 py-2 border border-gray-200">Publisher</th>
|
||||
<th class="px-4 py-2 border border-gray-200">Date of Publication</th>
|
||||
<th class="px-4 py-2 border border-gray-200">ISSN/eISSN number</th>
|
||||
<th class="px-4 py-2 border border-gray-200">Department</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 = $("#booksPublished-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: 'author',
|
||||
name: 'author',
|
||||
orderable: true
|
||||
},
|
||||
{
|
||||
data: 'publisher',
|
||||
name: 'publisher',
|
||||
orderable: true
|
||||
},
|
||||
{
|
||||
data: 'date_of_publication',
|
||||
name: 'date_of_publication',
|
||||
orderable: true
|
||||
},
|
||||
{
|
||||
data: 'issn',
|
||||
name: 'issn',
|
||||
orderable: false
|
||||
},
|
||||
{
|
||||
data: 'department_name',
|
||||
name: 'department_name',
|
||||
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
|
||||
$('#booksPublished-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.BooksPublishedResponses.data') }}";
|
||||
|
||||
if (userRole === 'Coordinator') {
|
||||
dataRoute = "{{ route('coordinator.BooksPublishedResponses.data') }}";
|
||||
}
|
||||
if (userRole === 'Faculty') {
|
||||
dataRoute = "{{ route('faculty.BooksPublishedResponses.data') }}";
|
||||
}
|
||||
|
||||
initAjaxRoute(dataRoute);
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
98
resources/views/faculty/booksPublished-form.blade.php
Normal file
98
resources/views/faculty/booksPublished-form.blade.php
Normal file
@@ -0,0 +1,98 @@
|
||||
@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 Book Publication Details
|
||||
</h3>
|
||||
<p class="mt-1 max-w-2xl text-sm text-gray-500">
|
||||
Fill in the details of your publication.
|
||||
</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.BooksPublishedFormResponse') }}" 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="author" class="block text-sm font-medium text-gray-700">Author Name</label>
|
||||
<input type="text" name="author" id="author" 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 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="publisher" class="block text-sm font-medium text-gray-700">Publisher Name</label>
|
||||
<input type="text" name="publisher" id="publisher" 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="issn" class="block text-sm font-medium text-gray-700">ISSN/eISSN number</label>
|
||||
<input type="text" name="issn" id="issn" 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="date_of_publication" class="block text-sm font-medium text-gray-700">Date Of Publication</label>
|
||||
<input type="date" name="date_of_publication" id="date_of_publication" 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>
|
||||
|
||||
<!-- proof File -->
|
||||
<div>
|
||||
<label for="proof_file" class="block text-sm font-medium text-gray-700">Upload Proof</label>
|
||||
<input type="file" name="proof_file" id="proof_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>
|
||||
|
||||
@endsection
|
||||
@@ -30,6 +30,9 @@
|
||||
<x-nav-link :href="route('admin.PublicationsResponses')" :active="request()->routeIs('admin.PublicationsResponses')">
|
||||
{{ __('Publications') }}
|
||||
</x-nav-link>
|
||||
<x-nav-link :href="route('admin.BooksPublishedResponses')" :active="request()->routeIs('admin.BooksPublishedResponses')">
|
||||
{{ __('Books Published') }}
|
||||
</x-nav-link>
|
||||
|
||||
<!-- Coordinator Routes -->
|
||||
@elseif(auth()->user()->role->name === 'Coordinator')
|
||||
@@ -45,6 +48,9 @@
|
||||
<x-nav-link :href="route('coordinator.PublicationsResponses')" :active="request()->routeIs('coordinator.PublicationsResponses')">
|
||||
{{ __('Publications') }}
|
||||
</x-nav-link>
|
||||
<x-nav-link :href="route('coordinator.BooksPublishedResponses')" :active="request()->routeIs('coordinator.BooksPublishedResponses')">
|
||||
{{ __('Books Published') }}
|
||||
</x-nav-link>
|
||||
|
||||
<!-- Faculty Routes with Dropdowns -->
|
||||
@elseif(auth()->user()->role->name === 'Faculty')
|
||||
@@ -112,6 +118,21 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Books Published 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">
|
||||
{{ __('Books Published') }}
|
||||
<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.BooksPublishedForm') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">{{ __('Submit Response') }}</a>
|
||||
<a href="{{ route('faculty.BooksPublishedResponses') }}" class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">{{ __('View Responses') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user