Refeactor: Change the folder for pages for better organization

This commit is contained in:
Sallu9007
2025-04-20 21:47:27 +05:30
parent 9cb5cb80bd
commit 36d36df47b
27 changed files with 32 additions and 32 deletions

View File

@@ -0,0 +1,204 @@
@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 Activities Attended
</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.ActivitiesAttended.update', $response->id) : (request()->is('coordinator/*') ? route('coordinator.ActivitiesAttended.update', $response->id) : route('faculty.ActivitiesAttended.update', $response->id)) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Title -->
<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', $response->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">
</div>
<!-- Organising Institute -->
<div>
<label for="organising_institute" class="block text-sm font-medium text-gray-700">Organising Institute</label>
<select name="organising_institute" id="organising_institute" class="mt-1 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md select2" style="width: 100%;">
<option value="">Select or type...</option>
@foreach($organisingInstitutes as $institute)
<option value="{{ $institute }}" {{ old('organising_institute', $response->organising_institute) == $institute ? 'selected' : '' }}>{{ $institute }}</option>
@endforeach
</select>
</div>
<!-- Address -->
<div>
<label for="address" class="block text-sm font-medium text-gray-700">Address</label>
<textarea name="address" id="address" rows="3" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md">{{ old('address', $response->address) }}</textarea>
</div>
<!-- Department -->
<div>
<label for="department" class="block text-sm font-medium text-gray-700">Department</label>
<input type="text" id="department" value="{{ $response->department->name ?? 'Unknown' }}" class="mt-1 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
<!-- Faculty -->
<div>
<label for="faculty" class="block text-sm font-medium text-gray-700">Faculty</label>
<input type="text" id="faculty" value="{{ $response->user->name ?? 'Unknown' }}" class="mt-1 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
<!-- Start Date -->
<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($response->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">
</div>
<!-- Start Time -->
<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($response->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">
</div>
<!-- End Date -->
<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($response->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">
</div>
<!-- End Time -->
<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($response->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">
</div>
<!-- Number of Days -->
<div>
<label for="num_days" class="block text-sm font-medium text-gray-700">Number of Days</label>
<input type="number" name="num_days" id="num_days" value="{{ old('num_days', $response->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">
</div>
<!-- Activity Type -->
<div>
<label for="activity_type" class="block text-sm font-medium text-gray-700">Select Activity 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['activity_types']) && is_array($dropdowns['activity_types']))
@foreach($dropdowns['activity_types'] as $key => $label)
<option value="{{ $key }}" {{ old('activity_type', $response->activity_type ?? '') == $key ? 'selected' : '' }}>{{ $label }}</option>
@endforeach
@endif
</select>
</div>
<!-- Category -->
<div>
<label for="category" class="block text-sm font-medium text-gray-700">Select Category</label>
<select name="category" id="category" 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['categories']) && is_array($dropdowns['categories']))
@foreach($dropdowns['categories'] as $key => $label)
<option value="{{ $key }}" {{ old('category', $response->category ?? '') == $key ? 'selected' : '' }}>{{ $label }}</option>
@endforeach
@endif
</select>
</div>
<!-- Level -->
<div>
<label for="level" class="block text-sm font-medium text-gray-700">Select Level</label>
<select name="level" id="level" 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['levels']) && is_array($dropdowns['levels']))
@foreach($dropdowns['levels'] as $key => $label)
<option value="{{ $key }}" {{ old('level', $response->level ?? '') == $key ? 'selected' : '' }}>{{ $label }}</option>
@endforeach
@endif
</select>
</div>
<!-- Proof -->
<div class="col-span-1 md:col-span-2">
<label for="proof" class="block text-sm font-medium text-gray-700">Proof</label>
@if ($response->proof)
<div class="mb-2">
<span class="text-sm text-gray-600">Current file:</span>
<a href="{{ asset('storage/' . $response->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-sm text-gray-500">Upload new proof (JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP)</p>
</div>
</div>
<div class="mt-6 flex items-center justify-end">
<a href="{{ request()->is('admin/*') ? route('admin.ActivitiesAttendedResponses') : (request()->is('coordinator/*') ? route('coordinator.ActivitiesAttendedResponses') : route('faculty.ActivitiesAttendedResponses')) }}" 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
@section('scripts')
<script>
// Auto-calculate number of days when start and end dates change
document.addEventListener('DOMContentLoaded', function() {
const startDateField = document.getElementById('start_date');
const endDateField = document.getElementById('end_date');
const numDaysField = document.getElementById('num_days');
function calculateDays() {
if (startDateField.value && endDateField.value) {
const startDate = new Date(startDateField.value);
const endDate = new Date(endDateField.value);
// Calculate difference in days
const diffTime = Math.abs(endDate - startDate);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1; // +1 to include both start and end days
if (diffDays > 0) {
numDaysField.value = diffDays;
}
}
}
startDateField.addEventListener('change', calculateDays);
endDateField.addEventListener('change', calculateDays);
});
</script>
@parent
<script>
$(document).ready(function() {
$('#organising_institute').select2({
tags: true,
placeholder: "Select or type...",
allowClear: true
});
});
</script>
@endsection

View File

@@ -0,0 +1,453 @@
@extends('layouts.app')
@section('content')
<div class="container py-4">
<div class="row">
<div class="col-12">
<div class="card shadow-sm">
<div class="card-header d-flex justify-content-between align-items-center">
<h3 class="page-title m-0">
<i class="fas fa-list-alt me-2 text-primary"></i>All Responses
</h3>
@if(auth()->user()->role->name === 'Admin')
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#missingProofsModal">
<i class="fas fa-search me-1"></i> Check Missing Proofs
</button>
@endif
</div>
<div class="card-body">
<!-- Filter Controls -->
<div class="row mb-4">
<div class="col-md-4">
<div class="input-group">
<span class="input-group-text bg-light">Department</span>
<select id="department-filter" class="form-select">
<option value="">All Departments</option>
@foreach($departments as $department)
<option value="{{ $department->id }}">{{ $department->name }}</option>
@endforeach
</select>
</div>
</div>
<div class="col-md-4">
<div class="input-group">
<span class="input-group-text bg-light">Category</span>
<select id="category-filter" class="form-select">
<option value="">All Categories</option>
<!-- Category options would be populated dynamically -->
</select>
</div>
</div>
<div class="col-md-4">
<div class="input-group">
<span class="input-group-text bg-light">Date Range</span>
<input type="date" id="date-from" class="form-control">
<span class="input-group-text bg-light">to</span>
<input type="date" id="date-to" class="form-control">
</div>
</div>
</div>
<!-- Table -->
<div class="table-responsive">
<table id="responses-table" class="table table-striped table-hover">
<thead>
<tr>
<th>ID</th>
<th>Title</th>
<th>Organising Institute</th>
<th>Address</th>
<th>Department</th>
<th>Faculty</th>
<th>Start Date</th>
<th>End Date</th>
<th>Days</th>
<th>Activity Type</th>
<th>Category</th>
<th>Level</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<!-- Data will be loaded via AJAX -->
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Missing Proofs Modal -->
@if(auth()->user()->role->name === 'Admin')
<div class="modal fade" id="missingProofsModal" tabindex="-1" aria-labelledby="missingProofsModalLabel" aria-hidden="true">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content">
<div class="modal-header bg-light">
<h5 class="modal-title" id="missingProofsModalLabel">
<i class="fas fa-check-square me-2 text-primary"></i>Select Categories to Check
</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<form id="missingProofsForm" action="{{ route('missing-proofs.check') }}" method="POST">
@csrf
<div class="modal-body">
<div class="row">
<div class="col-md-6">
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" name="categories[]" value="activities_attended" id="checkActivitiesAttended">
<label class="form-check-label" for="checkActivitiesAttended">
1. Activities Attended
</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" name="categories[]" value="activities_organised" id="checkActivitiesOrganised">
<label class="form-check-label" for="checkActivitiesOrganised">
2. Activities Organised
</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" name="categories[]" value="iv_organised" id="checkIVOrganised">
<label class="form-check-label" for="checkIVOrganised">
3. IV Organised
</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" name="categories[]" value="publications" id="checkPublications">
<label class="form-check-label" for="checkPublications">
4. Publications
</label>
</div>
</div>
<div class="col-md-6">
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" name="categories[]" value="books_published" id="checkBooksPublished">
<label class="form-check-label" for="checkBooksPublished">
5. Books Published
</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" name="categories[]" value="external_engagement" id="checkExternalEngagement">
<label class="form-check-label" for="checkExternalEngagement">
6. External Engagement
</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" name="categories[]" value="online_courses" id="checkOnlineCourses">
<label class="form-check-label" for="checkOnlineCourses">
7. Online Courses
</label>
</div>
<div class="form-check mb-3">
<input class="form-check-input" type="checkbox" name="categories[]" value="patents_copyrights" id="checkPatentsCopyrights">
<label class="form-check-label" for="checkPatentsCopyrights">
8. Patents/Copyrights
</label>
</div>
</div>
</div>
<div class="form-check mb-2">
<input class="form-check-input" type="checkbox" id="selectAll">
<label class="form-check-label" for="selectAll">
<strong>Select All Categories</strong>
</label>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">
<i class="fas fa-times me-1"></i>Close
</button>
<button type="submit" class="btn btn-primary">
<i class="fas fa-paper-plane me-1"></i>Send Email
</button>
</div>
</form>
</div>
</div>
</div>
@endif
@endsection
@section('scripts')
<script src="https://kit.fontawesome.com/a076d05399.js" crossorigin="anonymous"></script>
<script>
$(document).ready(function() {
// Handle "Select All" checkbox
$('#selectAll').change(function() {
const isChecked = $(this).prop('checked');
$('input[name="categories[]"]').prop('checked', isChecked);
});
// Update "Select All" when individual checkboxes change
$('input[name="categories[]"]').change(function() {
const totalCheckboxes = $('input[name="categories[]"]').length;
const checkedCheckboxes = $('input[name="categories[]"]:checked').length;
$('#selectAll').prop('checked', totalCheckboxes === checkedCheckboxes);
});
// Form validation for the modal
const form = document.getElementById('missingProofsForm');
if (form) {
form.addEventListener('submit', function(e) {
const checkboxes = form.querySelectorAll('input[type="checkbox"]:checked');
if (checkboxes.length === 0) {
e.preventDefault();
alert('Please select at least one category before sending emails.');
}
});
}
const sheetName = "Responses Report";
var initAjaxRoute = function(route) {
table = $("#responses-table").DataTable({
fnDestroy: true,
processing: true,
serverSide: true,
responsive: true,
ajax: {
url: route,
data: function(d) {
d.department = $('#department-filter').val();
d.category = $('#category-filter').val();
d.dateFrom = $('#date-from').val();
d.dateTo = $('#date-to').val();
}
},
columns: [{
data: 'id',
name: 'id',
searchable: false
},
{
data: 'title',
name: 'title',
orderable: false
},
{
data: 'organising_institute',
name: 'organising_institute',
orderable: false
},
{
data: 'address',
name: 'address',
orderable: false
},
{
data: 'department_name',
name: 'department_name',
orderable: false,
searchable: false
},
{
data: 'user_name',
name: 'user_name',
orderable: false
},
{
data: 'start_date',
name: 'start_date',
orderable: false
},
// { data: 'start_time', name: 'start_time', orderable: false },
{
data: 'end_date',
name: 'end_date',
orderable: false
},
// { data: 'end_time', name: 'end_time', orderable: false },
{
data: 'num_days',
name: 'num_days',
orderable: false
},
{
data: 'activity_type',
name: 'activity_type',
orderable: false
},
{
data: 'category',
name: 'category',
orderable: false,
searchable: false
},
{
data: 'level',
name: 'level',
orderable: false
},
{
data: 'action',
name: 'proof',
orderable: false,
searchable: false
}
],
columnDefs: [{
targets: '_all',
className: 'text-center wrap-text'
},
{
targets: 12,
render: function(data, type, row) {
return '<div class="btn-group" role="group">' +
data +
'</div>';
}
}
],
dom: '<"d-flex justify-content-between align-items-center mb-3"<"d-flex align-items-center"l><"d-flex"f<"ms-2"B>>>rtip',
buttons: [{
extend: 'copy',
text: '<i class="fas fa-copy me-1"></i> Copy',
className: 'btn btn-sm btn-outline-white',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'csv',
text: '<i class="fas fa-file-csv me-1"></i> CSV',
className: 'btn btn-sm btn-outline-white',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'excel',
text: '<i class="fas fa-file-excel me-1"></i> Excel',
className: 'btn btn-sm btn-outline-white',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'pdf',
text: '<i class="fas fa-file-pdf me-1"></i> PDF',
className: 'btn btn-sm btn-outline-white',
title: sheetName,
exportOptions: exportOptions()
},
{
extend: 'print',
text: '<i class="fas fa-print me-1"></i> Print',
className: 'btn btn-sm btn-outline-white',
title: sheetName,
exportOptions: exportOptions()
}
],
language: {
search: "<i class='fas fa-search'></i> _INPUT_",
searchPlaceholder: "Search records...",
lengthMenu: "<i class='fas fa-list me-1'></i> _MENU_ records per page",
info: "Showing _START_ to _END_ of _TOTAL_ entries",
paginate: {
first: "<i class='fas fa-angle-double-left'></i>",
last: "<i class='fas fa-angle-double-right'></i>",
next: "<i class='fas fa-angle-right'></i>",
previous: "<i class='fas fa-angle-left'></i>"
}
}
});
// Apply filters when they change
$('#department-filter, #category-filter, #date-from, #date-to').change(function() {
table.ajax.reload();
});
};
// Delete button handler
$('#responses-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();
showToast('Record deleted successfully', 'success');
},
error: function(error) {
console.error(error);
showToast('Error deleting record', 'danger');
}
});
}
});
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();
}
}
};
}
// Toast notification function
function showToast(message, type) {
const toastContainer = document.createElement('div');
toastContainer.className = 'position-fixed bottom-0 start-0 p-3';
toastContainer.style.zIndex = '1050';
const toastEl = document.createElement('div');
toastEl.className = `toast align-items-center text-white bg-${type} border-0`;
toastEl.setAttribute('role', 'alert');
toastEl.setAttribute('aria-live', 'assertive');
toastEl.setAttribute('aria-atomic', 'true');
toastEl.innerHTML = `
<div class="d-flex">
<div class="toast-body">
${message}
</div>
<button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
</div>
`;
toastContainer.appendChild(toastEl);
document.body.appendChild(toastContainer);
const toast = new bootstrap.Toast(toastEl, {
autohide: true,
delay: 3000
});
toast.show();
toastEl.addEventListener('hidden.bs.toast', function() {
document.body.removeChild(toastContainer);
});
}
// Set the appropriate data route based on user role
const userRole = "{{ auth()->user()->role->name }}";
let dataRoute = "{{ route('admin.ActivitiesAttendedResponses.data') }}";
if (userRole === 'Coordinator') {
dataRoute = "{{ route('coordinator.ActivitiesAttendedResponses.data') }}";
}
if (userRole === 'Faculty') {
dataRoute = "{{ route('faculty.ActivitiesAttendedResponses.data') }}";
}
// Initialize the data table
initAjaxRoute(dataRoute);
});
</script>
@endsection

View File

@@ -0,0 +1,288 @@
@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 Activities Organised
</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.ActivitiesOrganised.update', $response->id) : (request()->is('coordinator/*') ? route('coordinator.ActivitiesOrganised.update', $response->id) : route('faculty.ActivitiesOrganised.update', $response->id)) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Title -->
<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', $response->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>
<!-- Resource Person Name -->
<div>
<label for="resource_person_name" class="block text-sm font-medium text-gray-700">Resource Person Name</label>
<select id="resource_person_name" name="resource_person_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" multiple="multiple"></select>
<input type="hidden" id="resource_person_name_hidden" name="resource_person_name" />
</div>
<!-- Resource Person Organization -->
<div>
<label for="resource_person_organization" class="block text-sm font-medium text-gray-700">Resource Person Organization</label>
<input type="text" name="resource_person_organization" id="resource_person_organization" value="{{ old('resource_person_organization', $response->resource_person_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>
<!-- Target Audience -->
<div>
<label for="target_audience" class="block text-sm font-medium text-gray-700">Target Audience</label>
<input type="text" name="target_audience" id="target_audience" value="{{ old('target_audience', $response->target_audience) }}" 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>
<!-- Number of Participants -->
<div>
<label for="number_of_participants" class="block text-sm font-medium text-gray-700">Number of Participants</label>
<input type="number" name="number_of_participants" id="number_of_participants" value="{{ old('number_of_participants', $response->number_of_participants) }}" 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 -->
<div>
<label for="department" class="block text-sm font-medium text-gray-700">Department</label>
<input type="text" id="department" value="{{ $response->department->name ?? 'Unknown' }}" class="mt-1 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
<!-- Faculty -->
<div>
<label for="faculty" class="block text-sm font-medium text-gray-700">Faculty</label>
<input type="text" id="faculty" value="{{ $response->user->name ?? 'Unknown' }}" class="mt-1 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
<!-- Venue -->
<div>
<label for="venue" class="block text-sm font-medium text-gray-700">Venue</label>
<input type="text" name="venue" id="venue" value="{{ old('venue', $response->venue) }}" 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>
<!-- Start Date -->
<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($response->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>
</div>
<!-- Start Time -->
<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($response->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>
<!-- End Date -->
<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($response->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>
</div>
<!-- End Time -->
<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($response->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>
<!-- Number of Days -->
<div>
<label for="num_days" class="block text-sm font-medium text-gray-700">Number of Days</label>
<input type="number" name="num_days" id="num_days" value="{{ old('num_days', $response->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" required>
</div>
<!-- Activity Type -->
<div>
<label for="activity_type" class="block text-sm font-medium text-gray-700">Select Activity 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['activity_types']) && is_array($dropdowns['activity_types']))
@foreach($dropdowns['activity_types'] as $key => $label)
<option value="{{ $key }}" {{ old('activity_type', $response->activity_type ?? '') == $key ? 'selected' : '' }}>{{ $label }}</option>
@endforeach
@endif
</select>
</div>
<!-- Category -->
<div>
<label for="category" class="block text-sm font-medium text-gray-700">Select Category</label>
<select name="category" id="category" 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['categories']) && is_array($dropdowns['categories']))
@foreach($dropdowns['categories'] as $key => $label)
<option value="{{ $key }}" {{ old('category', $response->category ?? '') == $key ? 'selected' : '' }}>{{ $label }}</option>
@endforeach
@endif
</select>
</div>
<!-- Level -->
<div>
<label for="level" class="block text-sm font-medium text-gray-700">Select Level</label>
<select name="level" id="level" 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['levels']) && is_array($dropdowns['levels']))
@foreach($dropdowns['levels'] as $key => $label)
<option value="{{ $key }}" {{ old('level', $response->level ?? '') == $key ? 'selected' : '' }}>{{ $label }}</option>
@endforeach
@endif
</select>
</div>
<!-- Objective -->
<div class="col-span-1 md:col-span-2">
<label for="objective" class="block text-sm font-medium text-gray-700">Objective</label>
<textarea name="objective" id="objective" rows="3" 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>{{ old('objective', $response->objective) }}</textarea>
</div>
<!-- Outcomes -->
<div class="col-span-1 md:col-span-2">
<label for="outcomes" class="block text-sm font-medium text-gray-700">Outcomes</label>
<textarea name="outcomes" id="outcomes" rows="3" 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>{{ old('outcomes', $response->outcomes) }}</textarea>
</div>
<!-- Proof -->
<div class="col-span-1 md:col-span-2">
<label for="proof" class="block text-sm font-medium text-gray-700">Proof</label>
@if ($response->proof)
<div class="mb-2">
<span class="text-sm text-gray-600">Current file:</span>
<a href="{{ asset('storage/' . $response->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-sm text-gray-500">Upload new proof (JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP)</p>
</div>
</div>
<div class="mt-6 flex items-center justify-end">
<a href="{{ request()->is('admin/*') ? route('admin.ActivitiesOrganisedResponses') : (request()->is('coordinator/*') ? route('coordinator.ActivitiesOrganisedResponses') : route('faculty.ActivitiesOrganisedResponses')) }}" 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
@section('scripts')
<script>
document.addEventListener('DOMContentLoaded', function () {
const oldData = {!! json_encode(explode(', ', old('resource_person_name', $response->resource_person_name))) !!};
$('#resource_person_name').select2({
tags: true,
tokenSeparators: [','],
ajax: {
url: '{{ route('api.users.index') }}',
dataType: 'json',
delay: 250,
processResults: function (data) {
return {
results: data.map(user => ({ id: user.name, text: user.name }))
};
},
cache: true
}
});
// Prepopulate with old data
oldData.forEach(function (item) {
const option = new Option(item, item, true, true);
$('#resource_person_name').append(option).trigger('change');
});
$('#resource_person_name').on('change', function () {
const selectedValues = $(this).val();
document.getElementById('resource_person_name_hidden').value = selectedValues.join(', ');
});
});
// Auto-calculate number of days when start and end dates change
document.addEventListener('DOMContentLoaded', function() {
const startDateField = document.getElementById('start_date');
const endDateField = document.getElementById('end_date');
const numDaysField = document.getElementById('num_days');
function calculateDays() {
if (startDateField.value && endDateField.value) {
const startDate = new Date(startDateField.value);
const endDate = new Date(endDateField.value);
// Calculate difference in days
const diffTime = Math.abs(endDate - startDate);
const diffDays = Math.ceil(diffTime / (1000 * 60 * 60 * 24)) + 1; // +1 to include both start and end days
if (diffDays > 0) {
numDaysField.value = diffDays;
}
}
}
startDateField.addEventListener('change', calculateDays);
endDateField.addEventListener('change', calculateDays);
// Initialize Select2 for activity_type, category, and level
$('#activity_type').select2({
tags: true,
placeholder: 'Select Activity Type',
allowClear: true
});
$('#category').select2({
placeholder: 'Select Category',
allowClear: true
});
$('#level').select2({
placeholder: 'Select Level',
allowClear: true
});
});
document.addEventListener('DOMContentLoaded', function () {
const resourcePersonNameSelect = document.getElementById('resource_person_name');
const resourcePersonNameHidden = document.getElementById('resource_person_name_hidden');
// Populate hidden input with existing values on page load
if (resourcePersonNameSelect) {
const existingValues = $(resourcePersonNameSelect).val();
resourcePersonNameHidden.value = existingValues ? existingValues.join(', ') : '';
// console.log('Existing values:', existingValues);
// console.log('Hidden input value:', resourcePersonNameHidden.value);
}
const form = document.querySelector('form');
form.addEventListener('submit', function () {
if (resourcePersonNameSelect) {
const selectedValues = $(resourcePersonNameSelect).val();
resourcePersonNameHidden.value = selectedValues ? selectedValues.join(', ') : '';
}
});
});
</script>
@endsection

View File

@@ -0,0 +1,231 @@
@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 Activities Organised
</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="responses-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-1 border border-gray-200">ID</th>
<th class="px-1 py-1 border border-gray-200">Title</th>
<th class="px-1 py-1 border border-gray-200">Resource Person</th>
<th class="px-1 py-1 border border-gray-200">Organisation</th>
<th class="px-1 py-1 border border-gray-200">Target Audience</th>
<th class="px-1 py-1 border border-gray-200">Department</th>
<th class="px-1 py-1 border border-gray-200">Faculty</th>
<th class="px-1 py-1 border border-gray-200">Venue</th>
<th class="px-1 py-1 border border-gray-200">Activity Type</th>
<th class="px-1 py-1 border border-gray-200">Category</th>
<th class="px-1 py-1 border border-gray-200">Level</th>
<th class="px-1 py-1 border border-gray-200">Participants</th>
<th class="px-5 py-1 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 = "Activities Organised";
var initAjaxRoute = function(route) {
table = $("#responses-table").DataTable({
fnDestroy: true,
processing: true,
serverSide: true,
responsive: true,
ajax: {
url: route,
},
columns: [{
data: 'id',
name: 'id'
},
{
data: 'title',
name: 'title',
orderable: false
},
{
data: 'resource_person_name',
name: 'resource_person_name',
orderable: false
},
{
data: 'resource_person_organization',
name: 'resource_person_organization',
orderable: false
},
{
data: 'target_audience',
name: 'target_audience',
orderable: false
},
{
data: 'department_name',
name: 'department',
orderable: false
},
{
data: 'user_name',
name: 'user_name',
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: 'venue',
name: 'venue',
orderable: false
},
{
data: 'activity_type',
name: 'activity_type',
orderable: false
},
{
data: 'category',
name: 'category',
orderable: false
},
{
data: 'level',
name: 'level',
orderable: false
},
{
data: 'number_of_participants',
name: 'number_of_participants',
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
$('#responses-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('Record deleted successfully');
},
error: function(error) {
console.error(error);
alert('Error deleting record');
}
});
}
});
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.ActivitiesOrganisedResponses.data') }}";
if (userRole === 'Coordinator') {
dataRoute = "{{ route('coordinator.ActivitiesOrganisedResponses.data') }}";
}
if (userRole === 'Faculty') {
dataRoute = "{{ route('faculty.ActivitiesOrganisedResponses.data') }}";
}
initAjaxRoute(dataRoute);
});
</script>
@endsection

View 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

View 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

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,180 @@
@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 Industrial Visit
</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.IvOrganised.update', $response->id) : (request()->is('coordinator/*') ? route('coordinator.IvOrganised.update', $response->id) : route('faculty.IvOrganised.update', $response->id)) }}" method="POST" enctype="multipart/form-data">
@csrf
@method('PUT')
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Company Name -->
<div>
<label for="company_name" class="block text-sm font-medium text-gray-700">Name of the Company/Field/Institute</label>
<input type="text" name="company_name" id="company_name" value="{{ old('company_name', $response->company_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>
<!-- Company Address -->
<div>
<label for="company_address" class="block text-sm font-medium text-gray-700">Address of the Company/Field/Institute</label>
<input type="text" name="company_address" id="company_address" value="{{ old('company_address', $response->company_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>
<!-- Resource Person Name -->
<div>
<label for="resource_person_name" class="block text-sm font-medium text-gray-700">Resource Person Name</label>
<input type="text" name="resource_person_name" id="resource_person_name" value="{{ old('resource_person_name', $response->resource_person_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>
<!-- Resource Person Contact Details -->
<div>
<label for="resource_person_contact_details" class="block text-sm font-medium text-gray-700">Resource Person Contact Details</label>
<input type="text" name="resource_person_contact_details" id="resource_person_contact_details" value="{{ old('resource_person_contact_details', $response->resource_person_contact_details) }}" 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>
<!-- Target Audience -->
<div>
<label for="target_audience" class="block text-sm font-medium text-gray-700">Target Audience</label>
<select name="target_audience" id="target_audience" 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="faculty" {{ old('target_audience', $response->target_audience) == 'faculty' ? 'selected' : '' }}>Faculty</option>
<option value="student" {{ old('target_audience', $response->target_audience) == 'student' ? 'selected' : '' }}>Student</option>
<option value="both" {{ old('target_audience', $response->target_audience) == 'both' ? 'selected' : '' }}>Both</option>
</select>
</div>
<!-- Student Year (conditionally displayed) -->
<div id="student_year_container" class="{{ old('target_audience', $response->target_audience) == 'faculty' ? 'hidden' : '' }}">
<label for="student_year" class="block text-sm font-medium text-gray-700">Year of Study</label>
<input type="text" name="student_year" id="student_year" value="{{ old('student_year', $response->student_year) }}" class="mt-1 focus:ring-indigo-500 focus:border-indigo-500 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md" {{ old('target_audience', $response->target_audience) == 'faculty' ? '' : 'required' }}>
</div>
<!-- Number of Participants -->
<div>
<label for="number_of_participants" class="block text-sm font-medium text-gray-700">Number of Participants</label>
<input type="number" name="number_of_participants" id="number_of_participants" value="{{ old('number_of_participants', $response->number_of_participants) }}" 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 -->
<div>
<label for="department" class="block text-sm font-medium text-gray-700">Department</label>
<input type="text" id="department" value="{{ $response->department->name ?? 'Unknown' }}" class="mt-1 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
<!-- Faculty -->
<div>
<label for="faculty" class="block text-sm font-medium text-gray-700">Organising Faculty (Convenor/Coordinator)</label>
<input type="text" id="faculty" value="{{ $response->faculty->name ?? 'Unknown' }}" class="mt-1 block w-full shadow-sm sm:text-sm border-gray-300 rounded-md bg-gray-100" disabled>
</div>
<!-- Start Date -->
<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($response->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>
</div>
<!-- Start Time -->
<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($response->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>
<!-- End Date -->
<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($response->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>
</div>
<!-- End Time -->
<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($response->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>
<!-- Objective -->
<div class="col-span-1 md:col-span-2">
<label for="objective" class="block text-sm font-medium text-gray-700">Objective of Activity</label>
<textarea name="objective" id="objective" rows="3" 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>{{ old('objective', $response->objective) }}</textarea>
</div>
<!-- Outcomes -->
<div class="col-span-1 md:col-span-2">
<label for="outcomes" class="block text-sm font-medium text-gray-700">Outcomes of Activity</label>
<textarea name="outcomes" id="outcomes" rows="3" 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>{{ old('outcomes', $response->outcomes) }}</textarea>
</div>
<!-- Proof -->
<div class="col-span-1 md:col-span-2">
<label for="proof" class="block text-sm font-medium text-gray-700">Proof</label>
@if ($response->proof)
<div class="mb-2">
<span class="text-sm text-gray-600">Current file:</span>
<a href="{{ asset('storage/' . $response->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-sm text-gray-500">Upload new proof (JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP)</p>
</div>
</div>
<div class="mt-6 flex items-center justify-end">
<a href="{{ request()->is('admin/*') ? route('admin.IvOrganisedResponses') : (request()->is('coordinator/*') ? route('coordinator.IvOrganisedResponses') : route('faculty.IvOrganisedResponses')) }}" 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
@section('scripts')
<script>
document.addEventListener('DOMContentLoaded', function() {
// Handle showing/hiding student year field based on target audience
const targetAudienceField = document.getElementById('target_audience');
const studentYearContainer = document.getElementById('student_year_container');
const studentYearField = document.getElementById('student_year');
function toggleStudentYear() {
if (targetAudienceField.value === 'faculty') {
studentYearContainer.classList.add('hidden');
studentYearField.required = false;
studentYearField.value = '';
} else {
studentYearContainer.classList.remove('hidden');
studentYearField.required = true;
}
}
targetAudienceField.addEventListener('change', toggleStudentYear);
// Initialize on page load
toggleStudentYear();
});
</script>
@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 Industrial Visits Organised
</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="responses-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">Company Name</th>
<th class="px-4 py-2 border border-gray-200">Resource Person</th>
<th class="px-4 py-2 border border-gray-200">Target Audience</th>
<th class="px-4 py-2 border border-gray-200">Department</th>
<th class="px-4 py-2 border border-gray-200">Faculty</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">Student Year</th>
<th class="px-4 py-2 border border-gray-200">Participants</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 = "Industrial Visits Organised";
var initAjaxRoute = function(route) {
table = $("#responses-table").DataTable({
fnDestroy: true,
processing: true,
serverSide: true,
responsive: true,
ajax: {
url: route,
},
columns: [{
data: 'id',
name: 'id'
},
{
data: 'company_name',
name: 'company_name',
orderable: false
},
{
data: 'resource_person_name',
name: 'resource_person_name',
orderable: false
},
{
data: 'target_audience',
name: 'target_audience',
orderable: false
},
{
data: 'department_name',
name: 'department',
orderable: false
},
{
data: 'user_name',
name: 'user_name',
orderable: false
},
{
data: 'start_date',
name: 'start_date',
orderable: false
},
{
data: 'end_date',
name: 'end_date',
orderable: false
},
{
data: 'student_year',
name: 'student_year',
orderable: false
},
{
data: 'number_of_participants',
name: 'number_of_participants',
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
$('#responses-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('Record deleted successfully');
},
error: function(error) {
console.error(error);
alert('Error deleting record');
}
});
}
});
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.IvOrganisedResponses.data') }}";
if (userRole === 'Coordinator') {
dataRoute = "{{ route('coordinator.IvOrganisedResponses.data') }}";
}
if (userRole === 'Faculty') {
dataRoute = "{{ route('faculty.IvOrganisedResponses.data') }}";
}
initAjaxRoute(dataRoute);
});
</script>
@endsection

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

@@ -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

View 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