@extends('layouts.app') @section('title', 'Dashboard – Library MS') @section('page-title', 'Dashboard') @section('styles') @endsection @section('content')
{{ $totalBooks }}
Book Titles
Active
{{ number_format($totalTitles) }}
Total Copies
In stock
{{ number_format($totalAvailable) }}
Available
On shelf
{{ $activeIssues }}
Issued
Active
{{ $overdueIssues }}
Overdue
{{ $overdueIssues > 0 ? 'Needs action' : 'All good' }}
{{ $returnedToday }}
Returned Today
Today
Monthly Issue Trend
Last 6 months
Books by Category
{{ $categoryStats->count() }} categories
@php $maxCat = $categoryStats->max('total') ?: 1; @endphp @forelse($categoryStats as $cat)
{{ $cat->category ?: 'Uncategorised' }} {{ $cat->total }} titles  ·  {{ $cat->copies }} copies
@empty

No categories yet.

@endforelse
Recent Issues
View all
@if($recentIssues->isEmpty())
No issues recorded yet.
@else
@foreach($recentIssues as $issue) @php $isOverdue = $issue->status === 'issued' && \Carbon\Carbon::parse($issue->return_date)->isPast(); $statusLabel = $isOverdue ? 'overdue' : $issue->status; @endphp @endforeach
Book Student Issued Due Status
{{ $issue->book_title }}
{{ $issue->author }}
{{ $issue->student_name }}
@if($issue->student_email)
{{ $issue->student_email }}
@endif
{{ \Carbon\Carbon::parse($issue->issue_date)->format('d M Y') }} {{ \Carbon\Carbon::parse($issue->return_date)->format('d M Y') }} @if($isOverdue)
{{ \Carbon\Carbon::parse($issue->return_date)->diffForHumans() }}
@endif
{{ ucfirst($statusLabel) }} @if($issue->status === 'issued') Return @endif
@endif
Most Borrowed
View all
@forelse($topBooks as $i => $book)
{{ $i+1 }}
{{ $book->title }}
{{ $book->author }}  ·  {{ $book->category }}
{{ $book->borrow_count }}×
@empty

No borrowing data yet.

@endforelse
Recently Added
Add new
@forelse($recentBooks as $book)
{{ strtoupper(substr($book->title, 0, 2)) }}
{{ $book->title }}
{{ $book->author }}  ·  {{ $book->category }}
{{ $book->available_copies }}/{{ $book->quantity }}
@empty

No books added yet.

@endforelse
Quick Actions
Collection health @php $health = $totalTitles > 0 ? round(($totalAvailable / $totalTitles) * 100) : 0; @endphp {{ $health }}%
{{ number_format($totalAvailable) }} available {{ number_format($totalTitles - $totalAvailable) }} checked out
@endsection @section('scripts') @endsection