@extends('layouts.app') @section('title', isset($item) ? 'Edit Item' : 'Add Item') @section('breadcrumb') @endsection @section('content') {{-- Determine which tab has errors for auto-activation --}} @php $tabWithError = 'tabBasic'; // default $accountFields = ['inventory_account_id','cogs_account_id','sales_account_id','purchase_account_id']; if ($errors->hasAny($accountFields)) $tabWithError = 'tabAccounts'; @endphp
@csrf @if(isset($item)) @method('PUT') @endif {{-- Scrollable tabs for mobile --}}
{{-- ── Tab 1: Basic Info ──────────────────────────────────────────────── --}}
{{-- Left: Item Details --}}
Item Details
@error('name')
{{ $message }}
@enderror
Unique identifier — auto-uppercased
@error('code')
{{ $message }}
@enderror
Controls how stock is tracked
@error('category_id')
{{ $message }}
@enderror
@error('uom_id')
{{ $message }}
@enderror
@error('default_warehouse_id')
{{ $message }}
@enderror
Optional — group this under a parent item
{{-- Right: Settings + Flags --}}
{{-- Inventory Settings --}}
Inventory Settings
Controls entry in transactions
Units
Units
For initial setup only
{{-- Item Flags --}}
Item Flags
is_sold ?? true) ? 'checked':'' }}>
Appears on sales documents
is_purchased ?? true) ? 'checked':'' }}>
Appears on purchase documents
@if(isset($item))
is_active) ? 'checked':'' }}>
Inactive items cannot be used in new transactions
@endif
Cancel
{{-- ── Tab 2: Accounts ────────────────────────────────────────────────── --}}
GL Account Mappings
These accounts are used when posting transactions. Leave blank to use the company default accounts configured in Settings.
@foreach([ ['inventory_account_id', 'Inventory Account', 'asset', 'Stock value debit/credit (inventory items only)'], ['cogs_account_id', 'Cost of Goods Sold', 'expense', 'Debited when item is sold (inventory items)'], ['sales_account_id', 'Sales Revenue Account', 'income', 'Credited when item is sold'], ['purchase_account_id', 'Purchase/Expense Account','expense','Used when purchasing (service/non-inventory items)'], ] as [$field, $label, $type, $hint])
{{ $hint }}
@error($field)
{{ $message }}
@enderror
@endforeach
Cancel
{{-- ── Tab 3: Pricing ─────────────────────────────────────────────────── --}} @if(count($priceLevels) > 0)
Price List by Level Leave blank to not set a price for that level
@foreach($priceLevels as $pl) @php $existing = isset($priceLevelData) ? $priceLevelData->get($pl->id) : null; @endphp @endforeach
Price Level Currency Unit Price Effective From
{{ $pl->name }}
@if($pl->is_default) Default @endif
id}.unit_price", $existing ? number_format((float)$existing->unit_price, 4, '.', '') : '') }}" step="0.0001" min="0" placeholder="0.0000"> id}.effective_date", $existing?->effective_date?->format('Y-m-d') ?? '') }}">
@endif
{{-- end tab-content --}}
@endsection @push('scripts') @endpush