@php $truncate = function ($text, $max = 30) { if (! $text) { return ''; } $text = (string) $text; return mb_strlen($text) > $max ? mb_substr($text, 0, $max).'…' : $text; }; $pagesToShow = []; if ($totalPages <= 5) { for ($i = 1; $i <= $totalPages; $i++) { $pagesToShow[] = $i; } } elseif ($currentPage <= 3) { $pagesToShow = [1, 2, 3, 4, 5]; } elseif ($currentPage >= $totalPages - 2) { for ($i = $totalPages - 4; $i <= $totalPages; $i++) { $pagesToShow[] = $i; } } else { for ($i = $currentPage - 2; $i <= $currentPage + 2; $i++) { $pagesToShow[] = $i; } } @endphp

{{ __('suppliers.title') }}

@if ($flashMessage)

{{ $flashMessage }}

@endif @if ($showForm)

{{ $editingId ? __('suppliers.edit_supplier') : __('suppliers.add_new_supplier') }}

@endif
@forelse ($pageRows as $index => $supplier) @php $serial = $startIndex + $index + 1; @endphp @empty @endforelse
# {{ __('common.code') }} {{ __('common.name') }} {{ __('suppliers.company') }} {{ __('suppliers.contact') }} {{ __('common.phone') }} {{ __('common.email') }} {{ __('common.address') }} {{ __('suppliers.tax') }} {{ __('common.status') }} {{ __('common.remarks') }} {{ __('suppliers.created') }} {{ __('suppliers.updated') }} {{ __('common.actions') }}
{{ $serial }} {{ $supplier->supplier_code }} {{ $supplier->supplier_name }} {{ $supplier->company_name ?: '—' }} {{ $supplier->contact_person ?: '—' }} {{ $supplier->phone ?: '—' }} {{ $supplier->email ?: '—' }} {{ $truncate($supplier->address, 25) }} {{ $supplier->tax_number ?: '—' }} {{ $supplier->status }} {{ $truncate($supplier->remarks, 25) }} {{ $supplier->created_at ? \Carbon\Carbon::parse($supplier->created_at)->format('n/j/Y') : '—' }} {{ $supplier->updated_at ? \Carbon\Carbon::parse($supplier->updated_at)->format('n/j/Y') : '—' }}
{{ $searchTerm ? __('suppliers.no_suppliers_match_your_search') : __('suppliers.no_suppliers_found_click_add_new_supplier_to_create_one') }}
@if ($filteredCount > 0)
Showing {{ $startIndex + 1 }}–{{ min($startIndex + $itemsPerPage, $filteredCount) }} of {{ $filteredCount }}
@foreach ($pagesToShow as $pageNum) @endforeach
@endif