@extends('admin.layouts.app') @section('title', $product->exists ? 'Edit product' : 'Add product') @section('crumbs') Products {{ $product->exists ? $product->name : 'New' }} @endsection @section('content')
@csrf @if ($product->exists) @method('PUT') @endif

Basic info

@include('admin.partials.field', ['name' => 'name', 'label' => 'Product name', 'value' => $product->name, 'required' => true, 'full' => true]) @include('admin.partials.slug-field', ['model' => $product, 'from' => 'f_name', 'source' => 'name']) @include('admin.partials.field', ['name' => 'sku', 'label' => 'SKU', 'value' => $product->sku, 'placeholder' => 'IZ-0001'])
@error('category_id')
{{ $message }}
@enderror
@error('brand_id')
{{ $message }}
@enderror
@include('admin.partials.field', ['name' => 'short_description', 'label' => 'Short description', 'type' => 'textarea', 'rows' => 2, 'value' => $product->short_description, 'full' => true]) @include('admin.partials.field', ['name' => 'description', 'label' => 'Full description', 'type' => 'textarea', 'rows' => 7, 'value' => $product->description, 'full' => true])

Price & stock

@include('admin.partials.field', ['name' => 'price', 'label' => 'Price (৳)', 'type' => 'number', 'value' => $product->price, 'required' => true, 'attrs' => 'step="0.01" min="0"']) @include('admin.partials.field', ['name' => 'old_price', 'label' => 'Old price (৳)', 'type' => 'number', 'value' => $product->old_price, 'hint' => 'Optional — must be higher than price (shows discount).', 'attrs' => 'step="0.01" min="0"']) @include('admin.partials.field', ['name' => 'stock', 'label' => 'Stock', 'type' => 'number', 'value' => $product->stock, 'required' => true, 'attrs' => 'min="0" step="1"']) @include('admin.partials.field', ['name' => 'badge', 'label' => 'Badge', 'value' => $product->badge, 'placeholder' => 'e.g. New, Hot, Best Seller'])

Variants & details

@include('admin.partials.field', ['name' => 'sizes', 'label' => 'Sizes', 'value' => implode(', ', $product->sizes ?? []), 'placeholder' => 'S, M, L, XL', 'hint' => 'Comma separated.']) @php // validation fail hole old() theke, na hole product theke $colorRows = old('color_names') ? collect(old('color_names'))->map(fn ($n, $i) => [$n, old("color_hex.$i", '#cccccc')])->values()->all() : collect($product->colors ?? [])->map(fn ($n) => [$n, $product->colorHex($n)])->all(); @endphp
@foreach ($colorRows as [$cName, $cHex])
@endforeach
Nam likho, ar bam pasher box e click kore asol rong select koro. @error('color_hex.*')
Color code thik nei.
@enderror
@include('admin.partials.field', ['name' => 'fabric', 'label' => 'Fabric / material', 'value' => $product->fabric]) @include('admin.partials.field', ['name' => 'weight', 'label' => 'Weight / size', 'value' => $product->weight, 'placeholder' => 'e.g. 500g'])

Media

@include('admin.partials.field', ['name' => 'icon', 'label' => 'Icon (emoji)', 'value' => $product->icon, 'placeholder' => '📦', 'hint' => 'Shown when no image is uploaded.', 'full' => true]) @include('admin.partials.image', ['name' => 'image', 'label' => 'Product image', 'path' => $product->image])

Visibility

@include('admin.partials.check', ['name' => 'is_active', 'label' => 'Active', 'checked' => $product->is_active, 'hint' => 'Visible on the storefront']) @include('admin.partials.check', ['name' => 'is_featured', 'label' => 'Featured', 'checked' => $product->is_featured, 'hint' => 'Show in featured section']) @include('admin.partials.check', ['name' => 'is_flash', 'label' => 'Flash sale', 'checked' => $product->is_flash, 'hint' => 'Show in flash sale strip'])
Cancel
@endsection @push('scripts') @endpush