@extends('layouts.admin') @section('title', $product->exists ? 'Edit: '.$product->name : 'Add Bamboo Product') @section('actions') @if($product->exists) Preview Storefront @endif ← Products @endsection @php $highlightsInit = old('highlights', $product->highlights ?? ['']); if (empty($highlightsInit)) { $highlightsInit = ['']; } $specsInit = []; if (old('spec_keys')) { foreach (old('spec_keys') as $i => $k) { $specsInit[] = ['k' => $k, 'v' => old('spec_values')[$i] ?? '']; } } else { foreach (($product->specifications ?? []) as $k => $v) { $specsInit[] = ['k' => $k, 'v' => $v]; } } if (empty($specsInit)) { $specsInit[] = ['k' => '', 'v' => '']; } $variantsInit = old('variants'); if ($variantsInit === null) { $variantsInit = $product->exists ? $product->variants->map(function ($v) { $opts = collect($v->options ?? [])->map(fn ($val, $key) => "{$key}: {$val}")->implode(', '); return [ 'id' => $v->id, 'name' => $v->name, 'sku' => $v->sku, 'options_text' => $opts, 'price' => $v->price, 'compare_at_price' => $v->compare_at_price, 'stock' => $v->stock, 'is_active' => $v->is_active, ]; })->values()->all() : []; } @endphp @section('content')
@csrf @if($product->exists) @method('PUT') @endif
{{-- Main Left Column --}}

Product Basics

{{-- Pricing & Inventory --}}

Pricing & Inventory

{{-- Images --}}

Product Gallery

@if($product->exists && $product->images->isNotEmpty())
@foreach($product->images as $img)
@if($img->is_primary) Primary @else @endif
@endforeach
@endif
{{-- Variants --}}

Variants & Options

Sizes, finishes, bristle types or pack sizes.

{{-- Highlights & Specs --}}
{{-- Right Sidebar --}}

Visibility & Badges

Categories

@php $extraSelected = old('extra_categories', $product->exists ? $product->categories->pluck('id')->all() : []); @endphp
@foreach($categories as $c) @endforeach

Craft & Sustainability

@php $selectedBadges = old('eco_badges', $product->eco_badges ?? []); @endphp
@foreach($ecoBadges as $bKey => $bLabel) @endforeach

SEO

{{-- Detached Image Action Forms + Quick Stock Adjustment --}} @if($product->exists) @foreach($product->images as $img) @endforeach

Quick Inventory Adjustment

@csrf @if($product->variants->isNotEmpty())
@endif
@endif
@endsection