@php // Staff users only see the actions that they are allowed to perform. $canCreatePurchase = \App\Support\AdminAccess::canAction('purchases', 'create'); $canEditPurchase = \App\Support\AdminAccess::canAction('purchases', 'edit'); $canDeletePurchase = \App\Support\AdminAccess::canAction('purchases', 'delete'); @endphp

{{ __('Purchases') }}

{{ __('Manage your stock procurement and vendor invoices') }}
@if($canCreatePurchase) @endif
@if (session()->has('message'))
{{ session('message') }}
@endif
{{-- --}} @forelse($purchases as $item) {{-- --}} @empty @endforelse
{{ __('Date / Invoice') }} {{ __('Supplier') }} {{ __('Batch / Expiry') }} {{ __('Total Amount') }}{{ __('Cut') }}{{ __('Purchase Status') }} {{ __('Payment Status') }} {{ __('Actions') }}
{{ $item->invoice_no }} @if($item->image_path) {{ __('View Image') }} @endif {{ \Carbon\Carbon::parse($item->purchase_date)->format('d M, Y') }}
{{ $item->supplier->display_name ?? __('N/A') }} @php($batchSummary = $this->purchaseBatchSummary($item))
@forelse($batchSummary['lines'] as $line) {{ $line }} @empty - @endforelse @if(($batchSummary['more'] ?? 0) > 0) +{{ $batchSummary['more'] }} {{ __('more') }} @endif
Rs. {{ number_format($item->grand_total) }} @if((float) ($item->cut_total ?? 0) > 0) Rs. {{ number_format((float) $item->cut_total, 2) }} @else - @endif {{ strtoupper($item->status) }} {{ strtoupper($item->payment_status) }} @if($canEditPurchase) {{-- --}} @endif @if($canDeletePurchase) @endif
{{ __('No purchases recorded yet.') }}
{{ $purchases->links() }}
{{-- --}}