Add: New Fields for the form

This commit is contained in:
Sallu9007
2025-01-27 01:05:01 +05:30
parent beb4adfaef
commit 5e04bf4afc
6 changed files with 326 additions and 80 deletions

View File

@@ -9,22 +9,32 @@
</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">
<!-- <div class="overflow-x-auto w-full"> -->
<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">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">Organising Institute</th>
<th class="px-4 py-2 border border-gray-200">Address</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">Start Time</th> -->
<th class="px-4 py-2 border border-gray-200">End Date</th>
<!-- <th class="px-4 py-2 border border-gray-200">End Time</th> -->
<th class="px-4 py-2 border border-gray-200">Num Days</th>
<th class="px-4 py-2 border border-gray-200">Activity Type</th>
<th class="px-4 py-2 border border-gray-200">Category</th>
<th class="px-4 py-2 border border-gray-200">Level</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>
@@ -33,12 +43,30 @@
@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>
<!-- <link rel="stylesheet" href="https://cdn.datatables.net/1.12.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.12.1/js/jquery.dataTables.min.js"></script> -->
<!-- <script src="https://cdn.datatables.net/1.12.1/js/dataTables.bootstrap5.min.js"></script> -->
<script>
$(document).ready(function() {
// let selectedDepartment = "";
const sheetName = "Provisional Sheet";
var initAjaxRoute = function(route) {
table = $("#responses-table").DataTable({
fnDestroy: true,
@@ -47,19 +75,115 @@
responsive: true,
ajax: {
url: route,
// data: function(d){
// d.department = selectedDepartment;
// }
},
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: 'id', name: 'id', },
{ 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' , orderable: 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 },
{ data: 'level', name: 'level', orderable: false },
{ data: 'action', name: 'proof', orderable: false, searchable: false }, // View button for proof
],
order: [[0, 'asc']],
columnDefs: [
{
targets: 0,
// width: '170px',
className: 'text-center wrap-text',
},
{
targets: 1,
// width: '150px',
className: 'text-center wrap-text',
},
{
targets: 2,
// maxWidth: '150px',
className: 'text-center wrap-text',
},
{
targets: 3,
// maxWidth: '100px',
className: 'text-center wrap-text',
},
{
targets: 4,
// maxWidth: '300px',
className: 'text-center wrap-text',
},
{
targets: 5,
// maxWidth: '150px',
className: 'text-center wrap-text',
},
{
targets: 6,
// maxWidth: '100px',
className: 'text-center wrap-text',
},
{
targets: 7,
// maxWidth: '100px',
className: 'text-center wrap-text',
},
{
targets: 8,
// width: '100px',
className: 'text-center wrap-text',
},
{
targets: 9,
// width: '50px',
className: 'text-center wrap-text',
},
{
targets: 10,
// width: '120px',
className: 'text-center wrap-text',
},
{
targets: 11,
// width: '120px',
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() }
]
// order: [[4, 'asc']],
});
};
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();
}
}
};
}
initAjaxRoute("{{ route('admin.responses.data') }}");
});
</script>