@extends('layouts.app')

@section('content')
<div class="container-fluid py-4">
    <div class="row">
        @include('partials.sidebar-student')

        <div class="col-lg-10">
            <h2 class="mb-4 text-primary"><i class="fas fa-folder-open me-2"></i>Downloads</h2>

            @php
                $downloads = [
                    ['name' => 'Registration Form', 'url' => asset('downloads/registration_form.pdf')],
                    ['name' => 'Fee Structure 2025', 'url' => asset('downloads/fee_structure_2025.pdf')],
                    ['name' => 'Academic Calendar', 'url' => asset('downloads/academic_calendar.pdf')],
                    ['name' => 'Semester Timetable', 'url' => asset('downloads/timetable_semester1.pdf')],
                    ['name' => 'Deferment Application Letter', 'url' => asset('downloads/deferment_letter_sample.pdf')],
                    ['name' => 'Clearance Form', 'url' => asset('downloads/clearance_form.pdf')],
                ];
            @endphp

            <div class="table-responsive">
                <table class="table table-bordered table-hover shadow-sm bg-white">
                    <thead class="table-primary">
                        <tr>
                            <th>#</th>
                            <th>Document Name</th>
                            <th>Download Link</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($downloads as $index => $file)
                            <tr>
                                <td>{{ $index + 1 }}</td>
                                <td>{{ $file['name'] }}</td>
                                <td>
                                    <a href="{{ $file['url'] }}" class="btn btn-sm btn-success" target="_blank">
                                        <i class="fas fa-download"></i> Download
                                    </a>
                                </td>
                            </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>

            @if (empty($downloads))
                <div class="alert alert-info mt-4">No downloadable files available at this time.</div>
            @endif
        </div>
    </div>
</div>
@endsection
