*/ public array $groupIds = []; public function mount(): void { $this->authorize('inventory.count'); } /** * @return list */ #[Computed] public function counts(): array { return app(InventoryCountQueries::class)->counts(); } /** * @return list */ #[Computed] public function groupOptions(): array { return array_map( fn ($group): array => ['value' => $group->id, 'label' => $group->name], app(StockQueries::class)->groups(includeInactive: false), ); } public function start(InventoryCounts $counts): void { $this->authorize('inventory.manage-counts'); try { $id = $counts->start(array_map('intval', $this->groupIds), (int) auth()->id()); } catch (InventoryCountAlreadyOpen) { $this->addError('groupIds', __('inventory.counts.errors.already_open')); return; } $this->redirectRoute('inventory.counts.show', $id, navigate: true); } public function render(): mixed { return $this->view()->title(__('inventory.counts.title')); } }; ?>

{{ __('inventory.counts.title') }}

{{ __('inventory.counts.intro') }}

@can('inventory.manage-counts')

{{ __('inventory.counts.start_title') }}

@if ($this->groupOptions !== []) @endif @error('groupIds') @enderror
@endcan

{{ __('inventory.counts.list') }}

@if ($this->counts === [])

{{ __('inventory.counts.none') }}

@else
    @foreach ($this->counts as $count)
  • {{ __('inventory.counts.name', ['date' => $this->dateLabel($count->countedOn)]) }}

    {{ $count->groupNames === [] ? __('inventory.counts.whole_stock') : implode(', ', $count->groupNames) }} ยท {{ trans_choice('inventory.counts.counted_items', $count->countedItems, ['count' => $count->countedItems]) }}

    @if ($count->isConfirmed) @can('inventory.manage-counts') @endcan @else @endif
  • @endforeach
@endif