@php $productOptions = $products->map(fn ($product) => (object) ['id' => $product->id, 'name' => "{$product->name} ({$product->sku})"]); @endphp
← Back to sales
@if (session('error'))
{{ session('error') }}
@endif

New Sale

Items

{{-- Deliberately not wrapped in overflow-x-auto: the per-row product picker below is an absolutely-positioned dropdown, and any ancestor with overflow-x set to anything but visible clips it (per the CSS spec, setting overflow-x forces overflow-y to auto too, even though only -x was set) - the dropdown was rendering cut off/cramped inside that container. This table's columns are narrow enough not to need horizontal scroll; if that changes, the picker needs to escape via a portal instead of restoring this. --}}
@foreach ($items as $index => $item) @endforeach
Product Quantity Unit Price Tax % Line Total
@if ($item['product_id'] && $warehouseId) @php $product = $products->firstWhere('id', (int) $item['product_id']) @endphp @if ($product?->track_batches) @else

In stock: {{ $this->availableStock($index) }}

@endif @endif
{{ number_format((float) ($item['quantity'] ?: 0) * (float) ($item['unit_price'] ?: 0), 2) }} @if (count($items) > 1) @endif
Subtotal {{ number_format($this->subtotal(), 2) }}
Tax {{ number_format($this->taxTotal(), 2) }}
Total {{ number_format($this->grandTotal(), 2) }}
Est. COGS {{ number_format($this->estimatedCost(), 2) }}
Est. Profit {{ number_format($this->estimatedProfit(), 2) }}
Cancel