@extends('layouts.admin') {{ config('app.name', 'Laravel') }} | Student | Details @section('main-content') @php if (!function_exists('dateformatter')) { function dateformatter($date1) { $year1 = substr($date1, 0, 4); $month1 = substr($date1, 5, 2); $day1 = substr($date1, 8, 2); return $day1 . '-' . $month1 . '-' . $year1; } } if (!function_exists('calculate_age')) { function calculate_age($dateOfBirth) { return \Carbon\Carbon::parse($dateOfBirth)->age; } } @endphp @php use Illuminate\Support\Carbon; // GROUP INVOICES BY LAST 6 MONTHS $filteredInvoices = $fee_dates ->sortByDesc(function ($inv) { return $inv->payment_date ?? $inv->due_date; }) ->take(60); // take a safe limit $monthlySummary = []; $statusSummary = []; foreach ($filteredInvoices as $invoice) { $month = Carbon::parse($invoice->payment_date ?? $invoice->due_date)->format('M Y'); if (!isset($monthlySummary[$month])) { $monthlySummary[$month] = ['total_fee' => 0, 'paid' => 0, 'remaining' => 0]; $statusSummary[$month] = ['Completed' => 0, 'Pending' => 0, 'Partial' => 0, 'paid_amount' => 0]; } // Table 1 $monthlySummary[$month]['total_fee'] += (float) $invoice->total_fee; $monthlySummary[$month]['paid'] += (float) $invoice->amountpaid; $monthlySummary[$month]['remaining'] += (float) $invoice->remaining_fee; // Table 2 $status = ucfirst($invoice->payment_status); if (isset($statusSummary[$month][$status])) { $statusSummary[$month][$status]++; $statusSummary[$month]['paid_amount'] += (float) $invoice->amountpaid; } } // Take only latest 6 months $monthlySummary = array_slice($monthlySummary, 0, 6, true); $statusSummary = array_slice($statusSummary, 0, 6, true); @endphp
{{-- student Top Section --}}

{{ $student->first_name ?? 'Student' }} {{ $student->last_name }},

I am studying in {{ $child_add_info->student_class }}

More Details
Illustration
Fee Status Summary
@if (count($statusSummary)) @foreach ($statusSummary as $month => $data) @endforeach @else @endif
Month Completed Pending Partial
{{ $month }} {{ $data['Completed'] }} {{ $data['Pending'] }} {{ $data['Partial'] }}
No fee status summary data available.
{{-- Monthly Attendance --}}
Monthly Attendance Breakdown
@php $currentMonth = \Carbon\Carbon::now()->format('Y-m'); @endphp

Select a month to view breakdown.

{{-- Pie Chart for Selected Month --}}
Fee Payment Summary
@if (count($monthlyFeeStatus)) @else
No fee data available for the last 6 months.
@endif
{{-- Attendance --}}
Attendance Summary
@if (count($monthlyStats)) @else
No attendance data available for the last 6 months.
@endif
Monthly Fee Breakdown
@if (count($monthlySummary)) @foreach ($monthlySummary as $month => $data) @endforeach @else @endif
Month Total Fee Paid Remaining
{{ $month }} ₹{{ number_format($data['total_fee']) }} ₹{{ number_format($data['paid']) }} ₹{{ number_format($data['remaining']) }}
No monthly fee breakdown data available.
{{-- Documents --}}
Documents
  • Aadhar Card: @if (!empty($parent?->aadhar_card)) View @else Not Uploaded @endif
  • Birth Certificate: @if (!empty($child_add_info?->birth_certificate)) View @else Not Uploaded @endif
  • Vaccination: @if (!empty($child_add_info?->vaccination_certificate)) View @else Not Uploaded @endif
{{-- Student Info --}} @php $cardCount = 0; if ($student) { $cardCount++; } if ($parent) { $cardCount++; } if ($secondary_parent) { $cardCount++; } if (!empty($guardian_parent->first_name)) { $cardCount++; } @endphp @if ($student)

Student Information

Student Photo
{{ $student->first_name }} {{ $student->last_name }}

Class: {{ $child_add_info->student_class ?? 'N/A' }}


📞 Phone: {{ $student->emergency_contact ?? 'N/A' }}

{{--

📧 Email: {{ $student->email ?? 'N/A' }}

--}}

🎂 DOB: {{ !empty($student->dob) ? dateformatter($student->dob) . ' (' . calculate_age($student->dob) . ' y/o)' : 'N/A' }}

🚻 Gender: {{ ucfirst($student->gender ?? 'N/A') }}

@endif {{-- Primary Parent Info --}} @if ($parent)

Primary Parent

Parent Photo
{{ $parent->first_name }} {{ $parent->last_name }}

{{ $parents->occupation ?? 'Occupation not specified' }}


📞 Phone: {{ $parent->phone ?? 'N/A' }}

📧 Email: {{ $parent->email ?? 'N/A' }}

👪 Relation: {{ ucfirst($parents->relation ?? 'N/A') }}

🎂 DOB: {{ !empty($parent->dob) ? dateformatter($parent->dob) . ' (' . calculate_age($parent->dob) . ' y/o)' : 'N/A' }}

🚻 Gender: {{ ucfirst($parent->gender ?? 'N/A') }}

@endif {{-- Secondary Parent Info --}} @if (!empty($secondary_parent))

Secondary Parent

Parent Photo
{{ $secondary_parent->first_name }} {{ $secondary_parent->last_name }}

{{ $secondary_parent->occupation ?? 'Occupation not specified' }}


📞 Phone: {{ $secondary_parent->phone_number ?? 'N/A' }}

📧 Email: {{ $secondary_parent->email ?? 'N/A' }}

👪 Relation: {{ ucfirst($secondary_parent->relation ?? 'N/A') }}

🎂 DOB: {{ !empty($secondary_parent->dob) ? dateformatter($secondary_parent->dob) . ' (' . calculate_age($secondary_parent->dob) . ' y/o)' : 'N/A' }}

🚻 Gender: {{ ucfirst($secondary_parent->gender ?? 'N/A') }}

@endif {{-- Guardian Info --}} {{-- {{ dd($guardian_parent) }} --}} @if (!empty($guardian_parent->first_name))

Guardian

Guardian Photo
{{ $guardian_parent->first_name }} {{ $guardian_parent->last_name }}
{{--

{{ $guardian_parent->occupation ?? 'Occupation not specified' }}

--}}

📞 Phone: {{ $guardian_parent->phone_number ?? 'N/A' }}

📧 Email: {{ $guardian_parent->email ?? 'N/A' }}

👪 Relation: {{ ucfirst($guardian_parent->relation ?? 'N/A') }}

{{--

🎂 DOB: {{ !empty($guardian_parent->dob) ? dateformatter($guardian_parent->dob) . ' (' . calculate_age($guardian_parent->dob) . ' y/o)' : 'N/A' }}

--}} {{--

🚻 Gender: {{ ucfirst($guardian_parent->gender ?? 'N/A') }}

--}}
@endif
@endsection