@extends('layouts.admin') @section('title', 'Purchases') @section('page-title', 'Purchases') @section('content')

Purchases

add New Purchase
@if(request('search')) @endif
@if(request('per_page')) @endif @if(request('search')) close @endif
@forelse($purchases as $index => $purchase) @empty @endforelse
# PURCHASE NUMBER PURCHASE DATE SUPPLIER AMOUNT PAYMENT MODE CREATED ON STATUS ACTION
{{ ($purchases->currentPage() - 1) * $purchases->perPage() + $index + 1 }} {{ $purchase->purchase_number }} {{ $purchase->purchase_date ? $purchase->purchase_date->format('M d, Y') : 'Invalid Date' }} @if($purchase->supplier)
@if($purchase->supplier->image && \Illuminate\Support\Facades\Storage::disk('public')->exists($purchase->supplier->image)) {{ $purchase->supplier->name }} @else {{ strtoupper(substr($purchase->supplier->name ?? 'N', 0, 1)) }} @endif
{{ $purchase->supplier->name ?? 'N/A' }}
@else
?
Deleted User
@endif
{{ \App\Models\Currency::formatAmount($purchase->total, $purchase->currency ?? null) }} @php $paymentMethod = $purchase->payment_method ?? 'cash'; $paymentConfig = [ 'cash' => ['label' => 'Cash $', 'bg' => 'bg-green-100', 'text' => 'text-green-800'], 'bank_transfer' => ['label' => 'Bank Transfer', 'bg' => 'bg-blue-100', 'text' => 'text-blue-800'], 'credit_card' => ['label' => 'Credit Card', 'bg' => 'bg-purple-100', 'text' => 'text-purple-800'], 'cheque' => ['label' => 'Cheque', 'bg' => 'bg-yellow-100', 'text' => 'text-yellow-800'], ]; $config = $paymentConfig[$paymentMethod] ?? $paymentConfig['cash']; @endphp {{ $config['label'] }} {{ $purchase->created_at ? $purchase->created_at->format('M d, Y') : 'Invalid Date' }} @php $statusConfig = [ 'new' => ['label' => 'New', 'bg' => 'bg-sky-100', 'text' => 'text-sky-900', 'icon' => 'fiber_new'], 'pending' => ['label' => 'Pending', 'bg' => 'bg-amber-100', 'text' => 'text-amber-900', 'icon' => 'schedule'], 'partially_paid' => ['label' => 'Partially Paid', 'bg' => 'bg-blue-100', 'text' => 'text-blue-900', 'icon' => 'payments'], 'completed' => ['label' => 'Completed', 'bg' => 'bg-green-100', 'text' => 'text-blue-900', 'icon' => 'check_circle'], 'cancelled' => ['label' => 'Cancelled', 'bg' => 'bg-red-100', 'text' => 'text-red-900', 'icon' => 'cancel'], ]; $status = $purchase->status ?? 'new'; $config = $statusConfig[$status] ?? $statusConfig['new']; @endphp {{ $config['label'] }}
shopping_cart

No purchases found

@if($purchases->hasPages())

Showing {{ $purchases->firstItem() }} to {{ $purchases->lastItem() }} of {{ $purchases->total() }} entries

@if($purchases->onFirstPage()) @else < @endif @php $currentPage = $purchases->currentPage(); $lastPage = $purchases->lastPage(); $startPage = max(1, $currentPage - 1); $endPage = min($lastPage, $currentPage + 1); @endphp @if($startPage > 1) 1 @if($startPage > 2) ... @endif @endif @for($page = $startPage; $page <= $endPage; $page++) {{ $page }} @endfor @if($endPage < $lastPage) @if($endPage < $lastPage - 1) ... @endif {{ $lastPage }} @endif @if($purchases->hasMorePages()) > @else @endif
@endif
@endsection