Customers @can('customers.view') @endcan @can('customers.create') @endcan @can('customers.view') @php $retailers = \App\Http\Controllers\CustomerAgreementController::retailers(); $withDistributors = \App\Http\Controllers\CustomerAgreementController::retailers(true)->count() - $retailers->count(); $bulk = \App\Http\Controllers\CustomerAgreementController::BULK_DEFAULTS; @endphp @include('livewire.customers._agreement-form', [ 'action' => route('customers.agreements.pdf'), 'event' => 'open-bulk-agreements', 'bulk' => true, 'heading' => 'Agreements for all retailers', 'note' => 'An agreement for each customer below, all with the terms here: as a separate PDF per customer in a ZIP, or as one PDF. Nothing is saved to the customers: their own discount and BA salary settings are not changed.', 'who' => $retailers->count().' active retailers: '.$retailers->pluck('name')->implode(', ').($withDistributors > 0 ? ' (and '.$withDistributors.' distributors if ticked)' : ''), 'v' => ['discount' => $bulk['discount'], 'security' => 50000, 'ba' => $bulk['ba_amount'], 'target' => $bulk['ba_target'], 'cap' => $bulk['ba_cap'], 'place' => ''], ]) @include('livewire.customers._agreement-form', [ 'action' => route('customers.agreements.once'), 'event' => 'open-one-time-agreement', 'heading' => 'One-time agreement', 'note' => 'For a retailer who is not in the customer list: the same terms, with their details typed in here or left blank to write by hand. Nothing is saved.', 'party' => true, 'v' => ['discount' => $bulk['discount'], 'security' => 50000, 'ba' => $bulk['ba_amount'], 'target' => $bulk['ba_target'], 'cap' => $bulk['ba_cap'], 'place' => ''], ]) @endcan @if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif @php $filtersActive = $nameFilter || $typeFilter || $phoneFilter || $cityFilter || $statusFilter || $balanceFilter; @endphp @if ($filtersActive) @endif
CustomerTypeCityStatusBalance @forelse ($customers as $customer) @php $balance = (float) ($customer->sold_value ?? 0) - (float) ($customer->paid_value ?? 0); @endphp @empty @endforelse
Phone
{{ \Illuminate\Support\Str::upper(\Illuminate\Support\Str::substr($customer->name, 0, 1)) }}
{{ $customer->name }} @if ($customer->email)
{{ $customer->email }}
@endif
{{ str($customer->type)->title() }} {{ $customer->phone ?: '—' }} {{ $customer->city ?: '—' }} {{ $customer->is_active ? 'Active' : 'Inactive' }} $balance > 0, 'text-gray-500 dark:text-gray-400' => $balance <= 0, ])> {{ number_format($balance, 2) }} @can('customers.update') @endcan @can('customers.delete') @endcan
@if ($filtersActive) @else @endif
@if ($customers->isNotEmpty())
{{ $customers->links() }}
@endif
@if ($showForm)

{{ $editingId ? 'Edit Customer' : 'New Customer' }}

Pre-fills the discount box when billing this customer — still editable per sale.

A fixed Beauty Advisor salary earned once this customer bills the target amount in a month — scales down proportionally below target. Used for profit visibility, not billed to the customer.

@endif