{{-- Alpine manages expand/collapse only. Active state is PHP-rendered. --}}
@php
$flatCats = $this->allCategoriesFlat;
$initialExpanded = [];
$selectedNode = $this->selectedCategoryId
? collect($flatCats)->firstWhere('id', $this->selectedCategoryId)
: null;
$selectedAncestors = $selectedNode ? $selectedNode['ancestors'] : [];
@endphp
{{-- ── Right main area ──────────────────────────────────────────────── --}}
@if ($this->selectedCategoryId && !empty($this->toolsInCategory))
{{-- Tool grid --}}
@elseif ($this->selectedCategoryId && !empty($this->childCategories))
{{-- Sub-category message --}}
Select a sub-category from the left panel.
@elseif (!$this->selectedCategoryId)
Select a category to browse tools
@endif
{{-- Diagram viewer --}}
@if ($this->selectedToolId)
@php
$hotspotData = array_values(array_filter(
$this->partsForDiagram,
fn($p) => isset($p['hotspot_x'], $p['hotspot_y']) && $p['hotspot_x'] !== null
));
@endphp
@if ($this->selectedDiagramId)
{{-- Diagram image with hotspots --}}
@php $diagram = $this->selectedDiagram; @endphp
@if ($diagram?->diagram_r2_key || $diagram?->diagram_image_url)
@php
$imgUrl = $diagram->diagram_r2_key
? \Storage::disk('r2')->url($diagram->diagram_r2_key)
: $diagram->diagram_image_url;
@endphp

{{-- Hotspot overlay — rendered via Alpine x-for to avoid Blade comment spam --}}
@else
@endif
{{-- Parts list --}}
| Pos |
Part No. |
Description |
Price |
@forelse ($this->partsForDiagram as $part)
|
@if ($part['position'])
{{ $part['position'] }}
@endif
|
{{ $part['part_number'] }}
|
{{ $part['description'] }} |
@if ($part['price'] !== null)
{{ number_format((float) $part['price'], 2) }}
{{ $part['currency'] }}
@else
—
@endif
|
@empty
|
No parts data for this diagram.
|
@endforelse
@endif
@endif