@extends('layouts.app') @section('title', 'Suppliers') @section('page', 'suppliers') @php $statusVariant = fn ($s) => $s === 'Active' ? 'success' : 'danger'; $toneCycle = ['primary', 'success', 'warning', 'info', 'danger']; $totalSuppliers = $suppliers->count(); $activeSuppliers = $suppliers->where('status', 'Active')->count(); $inactiveSuppliers = $suppliers->where('status', 'Inactive')->count(); $totalOutstanding = $suppliers->sum(fn ($s) => (float) $s->outstanding_amount); @endphp @section('content') @if (session('success')) {{ session('success') }} @endif @if ($errors->any()) {{ $errors->first() }} @endif

Total Suppliers

{{ $totalSuppliers }}

All vendor records

Active

{{ $activeSuppliers }}

Currently in use

Inactive

{{ $inactiveSuppliers }}

Not available

Total Outstanding

{{ number_format($totalOutstanding, 2) }}

All supplier balances

@forelse ($suppliers as $row) @php $tone = $toneCycle[($loop->index) % count($toneCycle)]; @endphp {{ $row->name }} {{ $row->address ?: '—' }} {{ $row->phone ?: '—' }} {{ number_format((float) $row->outstanding_amount, 2) }} {{ $row->status }}
@empty No suppliers yet. Add your first supplier. @endforelse
@endsection @push('styles') @endpush @push('scripts') @endpush