@extends('layouts.header')

@section('content')
<main>
    <div class="container">
        <div class="row">
            <div class="col-md-6 offset-md-3">
                <div class="invoice mt-5">
                    <div class="invoice-header">
                        <h2 class="text-center">School Fees Invoice</h2>
                        <!-- Include school logo or name here -->
                    </div>
                    <div class="invoice-details mt-4">
                        <!-- Your invoice view content here -->
                        @foreach($payments as $key=>$payment)
                   
                            <p>Payment ID: {{ $payment->id }}</p>
                            @if($payment->sponsor) <!-- Check if sponsor exists for this payment -->
                                <p>Sponsor Name: {{ $payment->sponsor->fullName }}</p>
                            @endif
                            @if($payment->student) <!-- Check if student exists for this payment -->
                                <p>Student Name: {{ $payment->student->student_name }}</p>
                            @endif
                            <!-- Include other payment details here -->
                        @endforeach
                    </div>
                    <div class="text-center mt-4">
                        <!-- Download PDF button -->
                        <a href="{{ route('invoice.download', $payment->id) }}" class="btn btn-primary">Download PDF</a>
                    </div>
                </div>
            </div>
        </div>
    </div>
</main>
@endsection
