@extends('layouts.app') @section('title', "Correct POS Sale #{$sale->sale_id}") @php $fmt = fn ($n) => rtrim(rtrim(number_format((float) $n, 2), '0'), '.'); // Rows to show: the sale's own lines (or what was typed, after a validation error). $oldQty = old('qty'); $rows = $sale->items->map(fn ($i) => ['item_id' => $i->item_id, 'name' => $i->item_name, 'price' => (float) $i->unit_price, 'qty' => $oldQty[$i->item_id] ?? (float) $i->quantity, 'original' => true]); if (is_array($oldQty)) { foreach ($oldQty as $id => $q) { if (!$rows->contains('item_id', (int) $id) && ($item = $catalog->firstWhere('item_id', (int) $id))) { $rows->push(['item_id' => $item->item_id, 'name' => $item->item_name, 'price' => (float) $item->price, 'qty' => $q, 'original' => false]); } } } @endphp @section('content')
{{ $sale->outlet_name }} · {{ $sale->sale_date?->format('M d, Y') }} · {{ $walkIn ? 'Walk-in, paid by ' . $sale->payment_method : 'Charged to Room ' . ($sale->booking?->room?->room_number ?? '?') . ' — ' . ($sale->booking?->guest_name ?? 'guest') }} · rung up by {{ $sale->created_by ?: '—' }}