Feat: Activites Organised

This commit is contained in:
Sallu9007
2025-03-24 01:54:58 +05:30
parent 4352abdbd1
commit 98522c4213
12 changed files with 1061 additions and 10 deletions

View File

@@ -236,8 +236,7 @@
});
};
// Replace this event handler in your script
$('#responses-table').on('click', '.delete-btn', function() {
console.log("hsjda");
$('#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'); // Use the data-url attribute instead of hardcoded path

View File

@@ -0,0 +1,219 @@
```blade
@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>
<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 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>
// 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>
@endsection
```

View File

@@ -0,0 +1,234 @@
@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-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">Resource Person</th>
<th class="px-4 py-2 border border-gray-200">Organisation</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">Num Days</th>
<th class="px-4 py-2 border border-gray-200">Venue</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">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 = "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,176 @@
@extends('layouts.app')
@section('content')
<div class="max-w-7xl mx-auto sm:px-6 lg:px-8">
<div class="bg-white overflow-hidden shadow sm:rounded-lg">
<div class="px-4 py-5 sm:px-6">
<h3 class="text-lg leading-6 font-medium text-gray-900">
Submit Activities Organised
</h3>
<p class="mt-1 max-w-2xl text-sm text-gray-500">
Fill in the details of the activity you organised.
</p>
</div>
<div class="border-t border-gray-200">
<form method="POST" action="{{ route('faculty.ActivitiesOrganisedFormResponse') }}" enctype="multipart/form-data">
@csrf
<div class="px-4 py-5 sm:px-6">
<div class="space-y-6">
<!-- Title -->
<div>
<label for="title" class="block text-sm font-medium text-gray-700">Title/Description</label>
<input type="text" name="title" id="title" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<!-- Resource Person Details -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<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" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<div>
<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" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
</div>
<!-- Target Audience and Participants -->
<div class="grid grid-cols-1 sm:grid-cols-2 gap-4">
<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" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<div>
<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" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
</div>
<!-- Venue -->
<div>
<label for="venue" class="block text-sm font-medium text-gray-700">Venue</label>
<input type="text" name="venue" id="venue" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<!-- Department and Faculty Name -->
<div class="grid grid-cols-2 sm:grid-cols-2 gap-4">
<div>
<label for="department" class="block text-sm font-medium text-gray-700">Department</label>
<input type="text" name="department" id="department" value="{{ auth()->user()->department->name }}" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-gray-100" disabled>
</div>
<div>
<label for="faculty_name" class="block text-sm font-medium text-gray-700">Faculty Name</label>
<input type="text" name="faculty_name" id="faculty_name" value="{{ auth()->user()->name }}" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-gray-100" disabled>
</div>
</div>
<!-- Start Date, End Date, Number of Days -->
<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" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required onchange="calculateDays()">
</div>
<div>
<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" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required onchange="calculateDays()">
</div>
<div>
<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" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm bg-gray-100" 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" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
<div>
<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" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" required>
</div>
</div>
<!-- Activity Type, Category, Level -->
<div class="grid grid-cols-2 sm:grid-cols-3 gap-4">
<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 }}">{{ $label }}</option>
@endforeach
@endif
</select>
</div>
<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 }}">{{ $label }}</option>
@endforeach
@endif
</select>
</div>
<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 }}">{{ $label }}</option>
@endforeach
@endif
</select>
</div>
</div>
<!-- Objective and Outcomes -->
<div>
<label for="objective" class="block text-sm font-medium text-gray-700">Objective</label>
<textarea name="objective" id="objective" rows="3" 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></textarea>
</div>
<div>
<label for="outcomes" class="block text-sm font-medium text-gray-700">Outcomes</label>
<textarea name="outcomes" id="outcomes" rows="3" 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></textarea>
</div>
<!-- Proof Document -->
<div>
<label for="proof" class="block text-sm font-medium text-gray-700">Upload Proof/Document</label>
<input type="file" name="proof" id="proof" class="block w-full mt-1 border-gray-300 rounded-md shadow-sm focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm" accept=".jpg,.jpeg,.png,.pdf,.doc,.docx,.zip" required>
<p class="mt-1 text-xs text-gray-500">Accepted formats: JPG, JPEG, PNG, PDF, DOC, DOCX, ZIP</p>
</div>
</div>
</div>
<!-- Submit Button -->
<div class="px-4 py-3 sm:px-6 text-center mt-4">
<button type="submit" class="inline-flex justify-center py-2 px-4 border border-transparent text-sm font-medium rounded-md text-white bg-black">
Submit Response
</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;
}
}
</script>
@endsection

View File

@@ -21,14 +21,23 @@
<x-nav-link :href="route('admin.ActivitiesAttendedResponses')" :active="request()->routeIs('admin.ActivitiesAttendedResponses')">
{{ __('Activities Attended') }}
</x-nav-link>
@elseif(auth()->user()->role->name === 'Coordinator')
<x-nav-link :href="route('admin.ActivitiesOrganisedResponses')" :active="request()->routeIs('admin.ActivitiesOrganisedResponses')">
{{ __('Activities Organised') }}
</x-nav-link>
@elseif(auth()->user()->role->name === 'Coordinator')
<x-nav-link :href="route('coordinator.ActivitiesAttendedResponses')" :active="request()->routeIs('coordinator.ActivitiesAttendedResponses')">
{{ __('Activities Attended') }}
</x-nav-link>
@elseif(auth()->user()->role->name === 'Faculty')
<x-nav-link :href="route('coordinator.ActivitiesOrganisedResponses')" :active="request()->routeIs('coordinator.ActivitiesOrganisedResponses')">
{{ __('Activities Organised') }}
</x-nav-link>
@elseif(auth()->user()->role->name === 'Faculty')
<x-nav-link :href="route('faculty.ActivitiesAttendedForm')" :active="request()->routeIs('faculty.ActivitiesAttendedForm')">
{{ __('Activities Attended') }}
</x-nav-link>
<x-nav-link :href="route('faculty.ActivitiesOrganisedForm')" :active="request()->routeIs('faculty.ActivitiesOrganisedForm')">
{{ __('Activities Organised') }}
</x-nav-link>
@endif
</div>
</div>