44 lines
2.0 KiB
PHP
44 lines
2.0 KiB
PHP
<div class="responsive-table m-0">
|
|
<table class="table" id="datatable">
|
|
<thead>
|
|
<tr>
|
|
<th class="">{{ __('SL') }}.</th>
|
|
<th class="text-start">{{ __('Supplier Name') }}</th>
|
|
<th class="text-start">{{ __('Phone') }}</th>
|
|
<th class="text-start">{{ __('Email') }}</th>
|
|
<th class="text-start d-print-none">{{ __('Type') }}</th>
|
|
<th class="text-center">{{ __('Total Purchases') }}</th>
|
|
<th class="text-end">{{ __('Total Amount') }}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
@foreach ($suppliers as $supplier)
|
|
<tr>
|
|
<td class="">{{ $loop->iteration }}</td>
|
|
<td class="text-start">{{ $supplier->name }}</td>
|
|
<td class="text-start">{{ $supplier->phone }}</td>
|
|
<td class="text-start">{{ $supplier->email }}</td>
|
|
<td class="text-start d-print-none">{{ $supplier->type }}</td>
|
|
<td class="text-center">{{ $supplier->purchases?->count() }}</td>
|
|
<td class="text-end">{{ currency_format($supplier->purchases?->sum('totalAmount'), currency: business_currency()) }}</td>
|
|
</tr>
|
|
@endforeach
|
|
</tbody>
|
|
@if ($suppliers->count() > 0)
|
|
<tr class="table-footer">
|
|
<td class="">{{ __('Total') }}</td>
|
|
<td></td>
|
|
<td></td>
|
|
<td></td>
|
|
<td class="d-print-none"></td>
|
|
<td class="text-center">
|
|
{{ $suppliers->sum(fn($supplier) => $supplier->purchases?->count() ?? 0) }}
|
|
</td>
|
|
<td class="text-end">
|
|
{{ currency_format($suppliers->sum(fn($supplier) => $supplier->purchases?->sum('totalAmount') ?? 0), currency: business_currency()) }}
|
|
</td>
|
|
</tr>
|
|
@endif
|
|
</table>
|
|
</div>
|