- Dark indigo header and tinted page background; the mobile main menu gets its own row, in the same order as the keyboard reaches it. - Page titles with an icon chip (x-page-title, x-page, x-page-header) and card sections (x-panel, the card utility); x-table styled as a card with an indigo header row in AppServiceProvider::styleTables(). - Job and task statuses, late work, unapproved hours and stock states as badges with icon and text (x-status-badge, x-jobs.status, x-jobs.task-status), never colour alone. - Empty lists as x-empty-state; dashboard quick link tiles, week hour bars and trend arrows; Kanban columns and task cards edged by status; calendar today column and bar accents; quick sale, reports and machine console restyled; signed-out pages show the app name. - Focus rings use the primary colour in both themes (white in the header). - Document the components in CLAUDE.md; test the status badges. Co-Authored-By: Claude Opus 5.5 <[email protected]>
114 lines
3.7 KiB
PHP
114 lines
3.7 KiB
PHP
<?php
|
||
|
||
use App\Modules\Customers\Application\Contracts\CustomerQueries;
|
||
use App\Modules\Customers\Application\DTOs\CustomerSummary;
|
||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||
use Livewire\Attributes\Computed;
|
||
use Livewire\Attributes\Url;
|
||
use Livewire\Component;
|
||
use Livewire\WithPagination;
|
||
|
||
new class extends Component
|
||
{
|
||
use WithPagination;
|
||
|
||
#[Url(as: 'q', except: '')]
|
||
public string $search = '';
|
||
|
||
protected CustomerQueries $customerQueries;
|
||
|
||
public function boot(CustomerQueries $customerQueries): void
|
||
{
|
||
$this->customerQueries = $customerQueries;
|
||
}
|
||
|
||
public function mount(): void
|
||
{
|
||
$this->authorize('customers.use');
|
||
}
|
||
|
||
public function updatedSearch(): void
|
||
{
|
||
$this->resetPage();
|
||
}
|
||
|
||
/**
|
||
* @return LengthAwarePaginator<int, CustomerSummary>
|
||
*/
|
||
#[Computed]
|
||
public function customers(): LengthAwarePaginator
|
||
{
|
||
return $this->customerQueries->paginate($this->search);
|
||
}
|
||
|
||
/**
|
||
* @return list<array{index: string, label: string, sortable: bool, align?: string}>
|
||
*/
|
||
public function headers(): array
|
||
{
|
||
return [
|
||
['index' => 'name', 'label' => __('customers.fields.name'), 'sortable' => false],
|
||
['index' => 'type', 'label' => __('customers.fields.type'), 'sortable' => false],
|
||
['index' => 'businessId', 'label' => __('customers.fields.business_id'), 'sortable' => false],
|
||
['index' => 'action', 'label' => __('customers.actions'), 'sortable' => false, 'align' => 'right'],
|
||
];
|
||
}
|
||
|
||
public function render(): mixed
|
||
{
|
||
return $this->view()->title(__('customers.title'));
|
||
}
|
||
};
|
||
?>
|
||
|
||
<div class="mx-auto max-w-5xl space-y-6 p-4 sm:p-6">
|
||
<div class="flex flex-wrap items-center justify-between gap-4">
|
||
<x-page-title icon="user-group">{{ __('customers.title') }}</x-page-title>
|
||
|
||
<x-button :href="route('customers.create')" wire:navigate icon="plus" :text="__('customers.new')" />
|
||
</div>
|
||
|
||
@if (session('status'))
|
||
<x-alert role="status" color="green" light icon="check-circle" :text="session('status')" />
|
||
@endif
|
||
|
||
<x-input
|
||
wire:model.live.debounce.300ms="search"
|
||
type="search"
|
||
icon="magnifying-glass"
|
||
:label="__('customers.search')"
|
||
:hint="__('customers.search_description')"
|
||
/>
|
||
|
||
<p role="status" aria-live="polite" aria-atomic="true" class="text-sm text-zinc-600 dark:text-zinc-300">
|
||
{{ trans_choice('customers.result_count', $this->customers->total(), ['count' => $this->customers->total()]) }}
|
||
</p>
|
||
|
||
@if ($this->customers->total() === 0)
|
||
<x-empty-state icon="user-group">{{ __('customers.empty') }}</x-empty-state>
|
||
@else
|
||
<x-table :headers="$this->headers()" :rows="$this->customers" paginate>
|
||
@interact('column_name', $customer)
|
||
<x-link :href="route('customers.show', $customer->id)" navigate class="font-medium">{{ $customer->name }}</x-link>
|
||
@if ($customer->isInternal)
|
||
<span class="ml-1 text-sm">({{ __('customers.internal') }})</span>
|
||
@endif
|
||
@endinteract
|
||
|
||
@interact('column_type', $customer)
|
||
{{ __('customers.types.'.$customer->type->value) }}
|
||
@endinteract
|
||
|
||
@interact('column_businessId', $customer)
|
||
{{ $customer->businessId ?? '–' }}
|
||
@endinteract
|
||
|
||
@interact('column_action', $customer)
|
||
<x-link :href="route('customers.edit', $customer->id)" navigate>
|
||
{{ __('customers.edit') }}<span class="sr-only">: {{ $customer->name }}</span>
|
||
</x-link>
|
||
@endinteract
|
||
</x-table>
|
||
@endif
|
||
</div>
|