@php
$isEdit = isset($sale);
$oldItems = old('product_id');
$items = $isEdit ? $sale->items : collect();
$defaultAccount = old('account_id', '');
$allocated = $isEdit ? $sale->allocations->sum('amount') : 0;
$outstanding = $isEdit ? max($sale->amount - $allocated, 0) : 0;
@endphp