48 lines
2.1 KiB
PHP
48 lines
2.1 KiB
PHP
|
|
<div class="responsive-table m-0">
|
||
|
|
<table class="table" id="datatable">
|
||
|
|
<thead>
|
||
|
|
<tr>
|
||
|
|
<th class="">{{ __('SL') }}.</th>
|
||
|
|
<th class="text-start">{{ __('Customer 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 Sales') }}</th>
|
||
|
|
<th class="text-end">{{ __('Total Amount') }}</th>
|
||
|
|
</tr>
|
||
|
|
</thead>
|
||
|
|
<tbody>
|
||
|
|
@foreach ($customers as $customer)
|
||
|
|
<tr>
|
||
|
|
<td class="">{{ $loop->iteration }}</td>
|
||
|
|
<td class="text-start">{{ $customer->name }}</td>
|
||
|
|
<td class="text-start">{{ $customer->phone }}</td>
|
||
|
|
<td class="text-start">{{ $customer->email }}</td>
|
||
|
|
@if ($customer->type == 'Retailer')
|
||
|
|
<td class="text-start d-print-none">{{ __('Customer') }}</td>
|
||
|
|
@else
|
||
|
|
<td class="text-start d-print-none">{{ $customer->type }}</td>
|
||
|
|
@endif
|
||
|
|
<td class="text-center">{{ $customer->sales?->count() }}</td>
|
||
|
|
<td class="text-end">{{ currency_format($customer->sales?->sum('totalAmount'), currency: business_currency()) }}</td>
|
||
|
|
</tr>
|
||
|
|
@endforeach
|
||
|
|
</tbody>
|
||
|
|
@if ($customers->count() > 0)
|
||
|
|
<tr class="table-footer">
|
||
|
|
<td>{{ __('Total') }}</td>
|
||
|
|
<td></td>
|
||
|
|
<td></td>
|
||
|
|
<td></td>
|
||
|
|
<td class="d-print-none"></td>
|
||
|
|
<td class="text-center">
|
||
|
|
{{ $customers->sum(fn($customer) => $customer->sales?->count() ?? 0) }}
|
||
|
|
</td>
|
||
|
|
<td class="text-end">
|
||
|
|
{{ currency_format($customers->sum(fn($customer) => $customer->sales?->sum('totalAmount') ?? 0), currency: business_currency()) }}
|
||
|
|
</td>
|
||
|
|
</tr>
|
||
|
|
@endif
|
||
|
|
</table>
|
||
|
|
</div>
|