Feat: Yajra tables for response view

This commit is contained in:
Sallu9007
2025-01-26 20:56:11 +05:30
parent ec028d3f6f
commit dac2090e5c
6 changed files with 1156 additions and 7 deletions

View File

@@ -0,0 +1,67 @@
@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 Responses
</h3>
</div>
<div class="px-4 py-5 sm:px-6">
<div class="overflow-x-auto">
<table id="responses-table" class="table-auto w-full text-left border-collapse border border-gray-200 rounded-lg">
<thead class="bg-gray-100">
<tr>
<th class="px-4 py-2 border border-gray-200">Title</th>
<th class="px-4 py-2 border border-gray-200">Activity Type</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">Faculty</th>
<th class="px-4 py-2 border border-gray-200">Proof</th>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
</div>
@endsection
@section('scripts')
<!-- DataTables JS -->
<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>
$(document).ready(function() {
var initAjaxRoute = function(route) {
table = $("#responses-table").DataTable({
fnDestroy: true,
processing: true,
serverSide: true,
responsive: true,
ajax: {
url: route,
},
columns: [
{ data: 'title', name: 'title' },
{ data: 'activity_type', name: 'activity_type' },
{ data: 'start_date', name: 'start_date' },
{ data: 'end_date', name: 'end_date' },
{ data: 'user_name', name: 'user_name' },
{ data: 'action', name: 'proof', orderable: false, searchable: false }, // View button for proof
],
order: [[0, 'asc']],
});
};
initAjaxRoute("{{ route('admin.responses.data') }}");
});
</script>
@endsection

View File

@@ -33,4 +33,5 @@
</main>
</div>
</body>
@yield('scripts')
</html>