@extends('store.layout.main') @section('title', isset($product) ? 'Edit Product' : 'Add Product') @section('page-header') @php $headerIsEdit = isset($product); @endphp @endsection @section('main-container') @php $isEdit = isset($product); $currencySym = config('constants.CURRENCY_SYMBOL', '$'); if (! isset($bizInv)) { $bizInv = [ 'manage_stock' => true, 'manage_tax' => false, 'manage_product_cost' => false, 'default_profit_percent' => 25.0, ]; } if (! isset($businessPresetTaxesForProduct)) { $businessPresetTaxesForProduct = (new \App\Models\Business)->defaultBusinessTaxPresets(); } $showProductCostSection = ($bizInv['manage_product_cost'] ?? false) || ($isEdit && isset($product) && ( ($product->cost_seller_name ?? '') !== '' || (float) ($product->buying_cost ?? 0) > 0 || (float) ($product->shipping_cost ?? 0) > 0 || (float) ($product->buying_tax ?? 0) > 0 )); @endphp
@csrf @if ($isEdit) @endif @if (! $isEdit && ! empty($bizInv['manage_tax'])) @endif @if(!empty($bizInv['manage_tax'])) @endif

Photos

{{-- main image LEFT --}}
Main Image
Main preview
{{-- sub images RIGHT --}}

Letters, numbers, spaces and dashes only. e.g. New Arrival, Featured
{{-- ── 1. Basics ── --}} @php $secNum = 2; @endphp
1

Basics

Product name, branch availability and optional expiry date.

@include('store.product._branch-selector')
@if ($showProductCostSection) {{-- ── 2. Cost & Supplier ── --}}
{{ $secNum++ }}

Cost & Supplier

Purchase cost and supplier for margin tracking.

cost_seller_name ?? '') !== '' || (float) ($product->buying_cost ?? 0) > 0 || (float) ($product->shipping_cost ?? 0) > 0 || (float) ($product->buying_tax ?? 0) > 0)) checked @elseif (! $isEdit && ! empty($bizInv['manage_product_cost'])) checked @endif>
Searches your customer list. You can also type any name directly.
{{ $currencySym }}
{{ $currencySym }}
%
@else @endif {{-- ── Variants & Stock ── --}}
{{ $secNum++ }}

Variants & Stock

Sizes, colors, or track plain stock.

{{-- Variant info block — shown when variants are active --}}
{{ $isEdit && $product->variants->count() > 0 ? $product->variants->count() . ' variant' . ($product->variants->count() === 1 ? '' : 's') . ' configured — stock is tracked per variant.' : 'Variants configured — stock is tracked per variant.' }}
@if (!empty($bizInv['manage_stock'])) {{-- Stock card — full width, hidden when variants are active --}}
Stock
Track on-hand quantity, SKU and shelf location.
is_manage_basic_stock ? 'checked' : '') : 'checked' }}>
@include('store.product.stock-manage') @else @endif
@include('store.product.add-variants-popup') {{-- ── Price & Tax ── --}}
{{ $secNum++ }}

Price & Tax

Set the selling price and applicable taxes.

{{ $currencySym }}
@if (!empty($bizInv['manage_tax'])) @php $ptaxes = $businessPresetTaxesForProduct ?? []; $existingTaxNames = $isEdit ? $product->taxes->pluck('tax_name')->toArray() : []; @endphp
{{-- Label row: same margin-bottom as .form-label (0.5rem) so inputs align --}} @if(empty($ptaxes))

No taxes configured. Set up taxes →

@else
@endif
@else @endif
{{-- ── Product details ── --}}
{{ $secNum++ }}

Product details

Category-specific attributes and product description.

product_attributes) && count($product->product_attributes) > 0 ? 'checked' : '' }}>
{{-- ══ RIGHT: Sticky Live Preview ══ --}}
{{-- Status dropdown --}}
{{-- header --}}
Product Preview Live
{{-- image --}}
Preview Variants In stock
{{-- Section: Category & unit — only shown when populated --}}
{{-- Section: Name --}}
Product Name
{{-- Section: Branches --}} @if(($businessBranches ?? collect())->count() > 1)
@endif {{-- Section: Price & tax (customer pays prominently) --}}
{{ $currencySym }}0.00
{{-- Tags --}}
{{-- Meta: stock / sku / rack / cost --}}
{{-- Basic stock only (single line); hidden when variants — stock shown under each option --}}
Stock
SKU
Rack
Buy cost
{{-- Variants --}}
{{-- Supplier --}}
{{-- compat --}}
{{-- Description --}}
{{-- empty-state hint --}}
Fill the form to see
your product preview
@unless($isEdit)
@endunless
{{-- ══ end preview ══ --}}
{{-- Floating save — centered over the middle column --}}
@endsection @section('style') @endsection @section('script') @if ($isEdit) @endif @endsection