diff --git a/app/Http/Controllers/ActivitiesOrganisedController.php b/app/Http/Controllers/ActivitiesOrganisedController.php
index 82ed73e..6b49ef0 100644
--- a/app/Http/Controllers/ActivitiesOrganisedController.php
+++ b/app/Http/Controllers/ActivitiesOrganisedController.php
@@ -115,7 +115,7 @@ class ActivitiesOrganisedController extends Controller
return response()->json(['success' => 'Record deleted successfully']);
}
- public function getActivitiesOrganisedResponses()
+ public function getActivitiesOrganisedResponses(Request $request)
{
$user = auth()->user();
$isAdmin = $user->role->name === 'Admin';
@@ -137,6 +137,25 @@ class ActivitiesOrganisedController extends Controller
->where('faculty_id', $user->id);
}
+ // Apply filters
+ if ($request->has('department') && !empty($request->department)) {
+ $responses->whereHas('department', function ($query) use ($request) {
+ $query->where('id', $request->department);
+ });
+ }
+
+ if ($request->has('category') && !empty($request->category)) {
+ $responses->where('category', $request->category);
+ }
+
+ if ($request->has('dateFrom') && !empty($request->dateFrom)) {
+ $responses->where('start_date', '>=', $request->dateFrom);
+ }
+
+ if ($request->has('dateTo') && !empty($request->dateTo)) {
+ $responses->where('end_date', '<=', $request->dateTo);
+ }
+
return DataTables::of($responses)
->addColumn('user_name', function ($response) {
return $response->user->name ?? 'Unknown';
@@ -161,9 +180,9 @@ class ActivitiesOrganisedController extends Controller
// View proof button for everyone
if ($response->proof) {
- $actions[] = 'View ';
+ $actions[] = ' ';
} else {
- $actions[] = 'No Proof';
+ $actions[] = ' ';
}
// Edit button with role-appropriate route
@@ -177,10 +196,10 @@ class ActivitiesOrganisedController extends Controller
$editRoute = route('faculty.ActivitiesOrganised.edit', $response->id);
}
- $actions[] = 'Edit ';
+ $actions[] = ' ';
$deleteRoute = route('activitiesOrganised.destroy', $response->id);
- $actions[] = 'Delete ';
+ $actions[] = ' ';
return implode(' ', $actions);
})
diff --git a/app/Http/Controllers/AdminController.php b/app/Http/Controllers/AdminController.php
index b5358e2..390ecdd 100644
--- a/app/Http/Controllers/AdminController.php
+++ b/app/Http/Controllers/AdminController.php
@@ -44,31 +44,38 @@ class AdminController extends Controller
}
public function viewActivitiesOrganisedResponses()
{
- return view('pages.activities-organised.index');
+ $departments = Department::all();
+ return view('pages.activities-organised.index', compact('departments'));
}
public function viewIvOrganisedResponses()
{
- return view('pages.iv-organised.index');
+ $departments = Department::all();
+ return view('pages.iv-organised.index', compact('departments'));
}
public function viewPublicationsResponses()
{
- return view('pages.publications.index');
+ $departments = Department::all();
+ return view('pages.publications.index', compact('departments'));
}
public function viewBooksPublishedResponses()
{
- return view('pages.booksPublished.index');
+ $departments = Department::all();
+ return view('pages.booksPublished.index', compact('departments'));
}
public function viewExternalEngagementResponses()
{
- return view('pages.externalEngagement.index');
+ $departments = Department::all();
+ return view('pages.externalEngagement.index', compact('departments'));
}
public function viewOnlineCoursesResponses()
{
- return view('pages.onlineCourses.index');
+ $departments = Department::all();
+ return view('pages.onlineCourses.index', compact('departments'));
}
public function viewPatentsResponses()
{
- return view('pages.patents.index');
+ $departments = Department::all();
+ return view('pages.patents.index', compact('departments'));
}
public function downloadProofs(Request $request, ProofDownloadService $proofDownloadService)
diff --git a/resources/views/components/column-selector.blade.php b/resources/views/components/column-selector.blade.php
new file mode 100644
index 0000000..3fa4c06
--- /dev/null
+++ b/resources/views/components/column-selector.blade.php
@@ -0,0 +1,29 @@
+@props(['columns' => []])
+
+
+ Customize Columns
+
+
+
+
+ @foreach($columns as $column)
+
+
+
+ {{ $column['label'] }}
+
+
+ @endforeach
+
+
+
+
+ Select All
+
+
+ Deselect All
+
+
+
+
+
diff --git a/resources/views/components/send-email.blade.php b/resources/views/components/send-email.blade.php
new file mode 100644
index 0000000..4ab7b73
--- /dev/null
+++ b/resources/views/components/send-email.blade.php
@@ -0,0 +1,94 @@
+@if(auth()->user()->role->name === 'Admin')
+
+ Check Missing Proofs
+
+@endif
+
+
+@if(auth()->user()->role->name === 'Admin')
+
+@endif
\ No newline at end of file
diff --git a/resources/views/pages/activities-attended/index.blade.php b/resources/views/pages/activities-attended/index.blade.php
index 40e42a4..deb8896 100644
--- a/resources/views/pages/activities-attended/index.blade.php
+++ b/resources/views/pages/activities-attended/index.blade.php
@@ -9,11 +9,8 @@
All Responses
- @if(auth()->user()->role->name === 'Admin')
-
- Check Missing Proofs
-
- @endif
+
+
@@ -35,6 +32,11 @@
Category
All Categories
+ @if(isset($dropdowns['categories']) && is_array($dropdowns['categories']))
+ @foreach($dropdowns['categories'] as $key => $label)
+ {{ $label }}
+ @endforeach
+ @endif
@@ -48,99 +50,37 @@
-
+
-
-
- Customize Columns
-
-
-
-
-
-
-
-
-
- Organising Institute
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- Select All
-
-
- Deselect All
-
-
-
-
+ @php
+ use Illuminate\Support\Str;
+ $labels = [
+ 'Title',
+ 'Organising Institute',
+ 'Address',
+ 'Department',
+ 'Faculty',
+ 'Start Date',
+ 'End Date',
+ 'Days',
+ 'Activity Type',
+ 'Category',
+ 'Level',
+ ];
+ $columns = [];
+ foreach ($labels as $i => $label) {
+ $columns[] = [
+ 'label' => $label,
+ 'id' => 'column-' . Str::slug($label, '-'),
+ 'value' => $i + 2,
+ 'checked' => $label !== 'Days',
+ ];
+ }
+ @endphp
+
@@ -175,94 +115,6 @@
-
-@if(auth()->user()->role->name === 'Admin')
-
-@endif
@endsection
@section('scripts')
@@ -272,368 +124,368 @@
const currentModel = "{{ isset($model) ? $model : 'ActivitiesAttended' }}";
const csrf_token = "{{ csrf_token() }}";
$(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.');
- }
+ // Handle "Select All" checkbox
+ $('#selectAll').change(function() {
+ const isChecked = $(this).prop('checked');
+ $('input[name="categories[]"]').prop('checked', isChecked);
});
- }
- const sheetName = "Responses Report";
- let table; // Declare table variable in the outer scope
+ // 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);
+ });
- 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();
+ // 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";
+ let table; // Declare table variable in the outer scope
+
+ 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();
+ }
+ }
+ };
+ }
+
+ // Function to toggle column visibility - FIXED to check if responsive is initialized
+ function toggleColumnVisibility() {
+ $('.column-checkbox').each(function() {
+ const columnIndex = $(this).val();
+ const isChecked = $(this).is(':checked');
+
+ // Show or hide the column based on checkbox state
+ if (table) {
+ table.column(columnIndex).visible(isChecked);
+ }
+ });
+
+ // Adjust table layout only if table and responsive are initialized
+ if (table && table.responsive) {
+ table.columns.adjust().responsive.recalc();
+ } else if (table) {
+ table.columns.adjust();
}
+ }
+
+ var initAjaxRoute = function(route) {
+ // If table already exists, destroy it before re-initializing
+ if ($.fn.DataTable.isDataTable('#responses-table')) {
+ $('#responses-table').DataTable().destroy();
+ }
+
+ table = $("#responses-table").DataTable({
+ 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: null,
+ defaultContent: '',
+ orderable: false,
+ searchable: false
+ },
+ {
+ 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: 'end_date',
+ name: 'end_date',
+ 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: 0,
+ orderable: false,
+ className: 'select-checkbox',
+ render: function(data, type, row) {
+ return row.proof ?
+ ' ' :
+ ' ';
+ }
+ },
+ {
+ targets: '_all',
+ className: 'text-center wrap-text'
+ },
+ {
+ targets: 13,
+ render: function(data, type, row) {
+ return '' +
+ data +
+ '
';
+ }
+ }
+ ],
+ 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: ' Copy',
+ className: 'btn btn-sm btn-outline-white',
+ title: sheetName,
+ exportOptions: exportOptions()
+ },
+ {
+ extend: 'csv',
+ text: ' CSV',
+ className: 'btn btn-sm btn-outline-white',
+ title: sheetName,
+ exportOptions: exportOptions()
+ },
+ {
+ extend: 'excel',
+ text: ' Excel',
+ className: 'btn btn-sm btn-outline-white',
+ title: sheetName,
+ exportOptions: exportOptions()
+ },
+ {
+ extend: 'pdf',
+ text: ' PDF',
+ className: 'btn btn-sm btn-outline-white',
+ title: sheetName,
+ exportOptions: exportOptions()
+ },
+ {
+ extend: 'print',
+ text: ' Print',
+ className: 'btn btn-sm btn-outline-white',
+ title: sheetName,
+ exportOptions: exportOptions()
+ }
+ ],
+ language: {
+ search: " _INPUT_",
+ searchPlaceholder: "Search records...",
+ lengthMenu: " _MENU_ records per page",
+ info: "Showing _START_ to _END_ of _TOTAL_ entries",
+ paginate: {
+ first: " ",
+ last: " ",
+ next: " ",
+ previous: " "
+ }
+ },
+ // Important: Initialize the column visibility after table is drawn
+ initComplete: function() {
+ // Now it's safe to set column visibility
+ toggleColumnVisibility();
+
+ // Add select-all checkbox
+ addSelectAllCheckbox();
+ },
+ drawCallback: function() {
+ // Ensure select-all checkbox is present on redraw
+ addSelectAllCheckbox();
+ }
+ });
+
+ // Apply filters when they change
+ $('#department-filter, #category-filter, #date-from, #date-to').change(function() {
+ table.ajax.reload();
+ });
+
+ return table;
};
- }
- // Function to toggle column visibility - FIXED to check if responsive is initialized
- function toggleColumnVisibility() {
- $('.column-checkbox').each(function() {
- const columnIndex = $(this).val();
- const isChecked = $(this).is(':checked');
+ // 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');
- // Show or hide the column based on checkbox state
- if (table) {
- table.column(columnIndex).visible(isChecked);
+ $.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');
+ }
+ });
}
});
- // Adjust table layout only if table and responsive are initialized
- if (table && table.responsive) {
- table.columns.adjust().responsive.recalc();
- } else if (table) {
- table.columns.adjust();
- }
- }
+ // Handle row selection and Download button state
+ $('#responses-table').on('change', '.row-checkbox', function() {
+ const selectedRows = $('.row-checkbox:checked').length;
+ $('#download-proofs').prop('disabled', selectedRows === 0);
+ });
- var initAjaxRoute = function(route) {
- // If table already exists, destroy it before re-initializing
- if ($.fn.DataTable.isDataTable('#responses-table')) {
- $('#responses-table').DataTable().destroy();
- }
+ // Download proofs button handler
+ $('#download-proofs').on('click', function() {
+ const selectedIds = [];
- table = $("#responses-table").DataTable({
- 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: null,
- defaultContent: '',
- orderable: false,
- searchable: false
- },
- {
- 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
+ $('.row-checkbox:checked').each(function() {
+ const id = $(this).data('id');
+ if (id) selectedIds.push(id);
+ });
- },
- {
- 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: '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: 0,
- orderable: false,
- className: 'select-checkbox',
- render: function(data, type, row) {
- return row.proof ?
- ' ' :
- ' ';
- }
- },
- {
- targets: '_all',
- className: 'text-center wrap-text'
- },
- {
- targets: 13,
- render: function(data, type, row) {
- return '' +
- data +
- '
';
- }
- }
- ],
- 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: ' Copy',
- className: 'btn btn-sm btn-outline-white',
- title: sheetName,
- exportOptions: exportOptions()
- },
- {
- extend: 'csv',
- text: ' CSV',
- className: 'btn btn-sm btn-outline-white',
- title: sheetName,
- exportOptions: exportOptions()
- },
- {
- extend: 'excel',
- text: ' Excel',
- className: 'btn btn-sm btn-outline-white',
- title: sheetName,
- exportOptions: exportOptions()
- },
- {
- extend: 'pdf',
- text: ' PDF',
- className: 'btn btn-sm btn-outline-white',
- title: sheetName,
- exportOptions: exportOptions()
- },
- {
- extend: 'print',
- text: ' Print',
- className: 'btn btn-sm btn-outline-white',
- title: sheetName,
- exportOptions: exportOptions()
- }
- ],
- language: {
- search: " _INPUT_",
- searchPlaceholder: "Search records...",
- lengthMenu: " _MENU_ records per page",
- info: "Showing _START_ to _END_ of _TOTAL_ entries",
- paginate: {
- first: " ",
- last: " ",
- next: " ",
- previous: " "
- }
- },
- // Important: Initialize the column visibility after table is drawn
- initComplete: function() {
- // Now it's safe to set column visibility
- toggleColumnVisibility();
-
- // Add select-all checkbox
- addSelectAllCheckbox();
- },
- drawCallback: function() {
- // Ensure select-all checkbox is present on redraw
- addSelectAllCheckbox();
+ if (selectedIds.length > 0) {
+ // Create a form to submit the request
+ const form = $('')
+ .attr('method', 'POST')
+ .attr('action', downloadProofsRoute)
+ .css('display', 'none');
+
+ // Add CSRF token
+ $(' ')
+ .attr('type', 'hidden')
+ .attr('name', '_token')
+ .attr('value', csrf_token)
+ .appendTo(form);
+
+ // Add selected IDs
+ $(' ')
+ .attr('type', 'hidden')
+ .attr('name', 'ids')
+ .attr('value', JSON.stringify(selectedIds))
+ .appendTo(form);
+
+ // Add model name
+ $(' ')
+ .attr('type', 'hidden')
+ .attr('name', 'model')
+ .attr('value', currentModel)
+ .appendTo(form);
+
+ $('body').append(form);
+ form.submit();
}
});
- // Apply filters when they change
- $('#department-filter, #category-filter, #date-from, #date-to').change(function() {
- table.ajax.reload();
- });
+ // Function to add select-all checkbox to the table header
+ function addSelectAllCheckbox() {
+ // Only add if it doesn't exist yet
+ if ($('#select-all-checkbox').length === 0) {
+ const selectAllCheckbox = $(' ', {
+ type: 'checkbox',
+ id: 'select-all-checkbox',
+ class: 'form-check-input'
+ });
- return table;
- };
+ // Add to the first header column
+ $('#responses-table thead th.select-checkbox').html(selectAllCheckbox);
- // 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');
+ // Handle the select all functionality
+ $('#select-all-checkbox').on('change', function() {
+ const isChecked = $(this).prop('checked');
+ $('.row-checkbox:not(:disabled)').prop('checked', isChecked);
- $.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');
- }
- });
+ // Update download button state
+ const selectedRows = $('.row-checkbox:checked').length;
+ $('#download-proofs').prop('disabled', selectedRows === 0);
+ });
+ }
}
- });
- // Handle row selection and Download button state
- $('#responses-table').on('change', '.row-checkbox', function() {
- const selectedRows = $('.row-checkbox:checked').length;
- $('#download-proofs').prop('disabled', selectedRows === 0);
- });
+ // 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';
- // Download proofs button handler
- $('#download-proofs').on('click', function() {
- const selectedIds = [];
+ 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');
- $('.row-checkbox:checked').each(function() {
- const id = $(this).data('id');
- if (id) selectedIds.push(id);
- });
-
- if (selectedIds.length > 0) {
- // Create a form to submit the request
- const form = $('')
- .attr('method', 'POST')
- .attr('action', downloadProofsRoute)
- .css('display', 'none');
-
- // Add CSRF token
- $(' ')
- .attr('type', 'hidden')
- .attr('name', '_token')
- .attr('value', csrf_token)
- .appendTo(form);
-
- // Add selected IDs
- $(' ')
- .attr('type', 'hidden')
- .attr('name', 'ids')
- .attr('value', JSON.stringify(selectedIds))
- .appendTo(form);
-
- // Add model name
- $(' ')
- .attr('type', 'hidden')
- .attr('name', 'model')
- .attr('value', currentModel)
- .appendTo(form);
-
- $('body').append(form);
- form.submit();
- }
- });
-
- // Function to add select-all checkbox to the table header
- function addSelectAllCheckbox() {
- // Only add if it doesn't exist yet
- if ($('#select-all-checkbox').length === 0) {
- const selectAllCheckbox = $(' ', {
- type: 'checkbox',
- id: 'select-all-checkbox',
- class: 'form-check-input'
- });
-
- // Add to the first header column
- $('#responses-table thead th.select-checkbox').html(selectAllCheckbox);
-
- // Handle the select all functionality
- $('#select-all-checkbox').on('change', function() {
- const isChecked = $(this).prop('checked');
- $('.row-checkbox:not(:disabled)').prop('checked', isChecked);
-
- // Update download button state
- const selectedRows = $('.row-checkbox:checked').length;
- $('#download-proofs').prop('disabled', selectedRows === 0);
- });
- }
- }
-
- // 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 = `
+ toastEl.innerHTML = `
${message}
@@ -642,67 +494,67 @@
`;
- toastContainer.appendChild(toastEl);
- document.body.appendChild(toastContainer);
+ toastContainer.appendChild(toastEl);
+ document.body.appendChild(toastContainer);
- const toast = new bootstrap.Toast(toastEl, {
- autohide: true,
- delay: 3000
- });
+ const toast = new bootstrap.Toast(toastEl, {
+ autohide: true,
+ delay: 3000
+ });
- toast.show();
+ 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
- table = initAjaxRoute(dataRoute);
-
- // Attach change event listener to column visibility checkboxes AFTER table is initialized
- $('.column-checkbox').on('change', function() {
- toggleColumnVisibility();
- });
-
- // Ensure "Actions" column is always visible
- $('#column-actions').prop('disabled', true);
-
- // Select all columns button
- $('#select-all-columns').click(function() {
- $('.column-checkbox').prop('checked', true).trigger('change');
- });
-
- // Deselect all columns button
- $('#deselect-all-columns').click(function() {
- $('.column-checkbox').prop('checked', false).trigger('change');
- });
-
- // Prevent dropdown from closing when clicking inside it
- $('.dropdown-menu').on('click', function(e) {
- e.stopPropagation();
- });
-
- // Set department filter from query string if present
- $(document).ready(function() {
- const urlParams = new URLSearchParams(window.location.search);
- const departmentId = urlParams.get('department_id');
- if (departmentId) {
- $('#department-filter').val(departmentId).trigger('change');
+ 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
+ table = initAjaxRoute(dataRoute);
+
+ // Attach change event listener to column visibility checkboxes AFTER table is initialized
+ $('.column-checkbox').on('change', function() {
+ toggleColumnVisibility();
+ });
+
+ // Ensure "Actions" column is always visible
+ $('#column-actions').prop('disabled', true);
+
+ // Select all columns button
+ $('#select-all-columns').click(function() {
+ $('.column-checkbox').prop('checked', true).trigger('change');
+ });
+
+ // Deselect all columns button
+ $('#deselect-all-columns').click(function() {
+ $('.column-checkbox').prop('checked', false).trigger('change');
+ });
+
+ // Prevent dropdown from closing when clicking inside it
+ $('.dropdown-menu').on('click', function(e) {
+ e.stopPropagation();
+ });
+
+ // Set department filter from query string if present
+ $(document).ready(function() {
+ const urlParams = new URLSearchParams(window.location.search);
+ const departmentId = urlParams.get('department_id');
+ if (departmentId) {
+ $('#department-filter').val(departmentId).trigger('change');
+ }
+ });
});
-});
@endsection
\ No newline at end of file