@include('festool-product-data::partials.tabs', ['active' => 'builder']) @php $fields = \Webkul\FestoolProductData\Services\BuilderFields::all(); $record = $this->record; $resolved = $this->resolved; $template = $this->currentTemplate; $missing = collect($resolved)->filter(fn ($r) => $r['missing'])->keys()->map(fn ($k) => $fields[$k]['label'])->all(); $imageMode = $tiers['images'][0]['value'] ?? 'all'; @endphp
{{-- Controls --}}
@if ($this->sku)
{{ $this->sku }} {{ ($record['kind'] ?? '') === 'spare_only' ? 'Spare part' : 'Product' }}
@else @if (mb_strlen($this->skuSearch) >= 2)
@forelse ($this->searchResults as $r)
{{ $r['sku'] }} · {{ \Illuminate\Support\Str::limit($r['name'], 50) }} {{ $r['kind'] === 'spare_only' ? 'Spare' : 'Product' }}
@empty
No Festool items match "{{ $this->skuSearch }}".
@endforelse
@endif @endif
{{-- 1. All Festool data (drag from here) --}}
1 · Festool datadrag onto a field →
@if (! $record)
Choose a SKU to see its values and its scraped festool.co.uk fields.
@endif @foreach ($this->availableData as $group => $items)
{{ $group }} ({{ count($items) }})
@foreach ($items as $item)
{{ $item['key'] }} @if ($record){{ \Illuminate\Support\Str::limit(strip_tags((string) $item['value']), 40) ?: '—' }}@endif
@endforeach @endforeach
{{-- 2. Cydekick fields (drop here, tiers in order) --}}
2 · Fields to fill in Tier 1 is used first; if empty, tier 2, and so on
@foreach (\Webkul\FestoolProductData\Services\BuilderFields::groups() as $group)
{{ $group }}
@foreach ($fields as $key => $f) @continue($f['group'] !== $group)
{{ $f['label'] }}@if ($f['required']) *@endif @if ($f['hint']) · {{ $f['hint'] }}@endif
@if ($f['type'] !== 'images')
@endif
@if ($f['type'] === 'images') @else @foreach (($tiers[$key] ?? []) as $i => $tier)
⋮⋮ Tier {{ $i + 1 }}
@if ($tier['type'] === 'festool') {{ $tier['value'] }} @if ($record) = {{ $this->sample($tier['value']) ?: 'empty' }}@endif @elseif ($tier['type'] === 'template') @else @endif
@endforeach
{{ empty($tiers[$key]) ? 'Drop a Festool field here' : 'Drop another field to add a lower tier' }}
@endif
@endforeach @endforeach
{{-- 3. Result --}}
3 · Result{{ $template?->name }}
@if (! $record)
Choose a Festool SKU above to see the product this template would build.
@else
@foreach ($fields as $key => $f) @php $res = $resolved[$key]; @endphp
{{ $f['label'] }}
@if ($f['type'] === 'images') @php $chosen = $imageMode === 'none' ? [] : ($imageMode === 'first' ? array_slice($record['images'], 0, 1) : $record['images']); $imageUrls = array_values(array_filter(array_map(fn ($img) => $this->imageUrl($img['r2_key'] ?? null), $chosen))); @endphp {{ count($chosen) ? count($chosen).' image(s) — click to enlarge' : 'none' }}
@include('festool-product-data::partials.image-lightbox', ['urls' => $imageUrls])
@elseif ($res['missing']) missing — required @elseif ($res['display'] !== '') {{ \Illuminate\Support\Str::limit($f['type'] === 'html' ? strip_tags($res['display']) : $res['display'], 120) }} tier {{ $res['tier'] }} · {{ $res['via'] }} @else empty @endif
@endforeach
@if ($this->createdProductId) @elseif ($this->existingProductId)
SKU {{ $resolved['sku']['display'] }} already exists in Cydekick (product #{{ $this->existingProductId }}). It can't be created again.
@elseif ($missing)
Required fields with no value: {{ implode(', ', $missing) }}.
@endif @if (! $this->supplierId)
No supplier chosen: the product will be created without a supplier price-list entry, so it can't be ordered from Nexmart.
@endif
@endif
{{ $this->content }}