@extends('layouts.app') @section('title', 'Edit Sale ' . $sale->invoice_no) @php $shiftClosed = (bool) optional($sale->register)->closed_at; $soldBy = $sale->user?->name ?? $sale->register?->user?->name ?? 'Unknown'; @endphp @section('content')
{{-- Header --}}

Edit Sale {{ $sale->invoice_no }}

{{ $shiftClosed ? 'Shift closed' : 'Shift open' }} @if($sale->is_edited) Edited before @endif
Cancel
{{-- Errors: one clear box --}} @if($errors->any() || session('error'))
The sale was not saved
    @if(session('error'))
  • {{ session('error') }}
  • @endif @foreach($errors->all() as $error)
  • {{ $error }}
  • @endforeach
@endif {{-- Sale details --}}
Sold on
{{ $sale->created_at->format('d M Y, H:i') }}
Sold by
{{ $soldBy }}
Customer
{{ $sale->customer_name ?: 'Walk-In Customer' }}
Original total
MWK {{ number_format($original->sum(fn ($i) => $i['quantity'] * $i['price'])) }}
@if($shiftClosed)
This shift was closed on {{ $sale->register->closed_at->format('d M Y H:i') }}. Changing this sale changes that shift's totals and is flagged in Loss Prevention.
@endif
@csrf @method('PUT') @if($returnTo)@endif
{{-- Items --}}
Items
@if($isSupervisor) You can change quantities and prices. @else Prices are fixed. Only a manager can change them. @endif
Product Unit price Was Now Subtotal
{{-- Add a product --}}
{{-- What will happen to stock --}}
{{-- Summary, payment, reason, save --}}
Original total
New total
Payment
Recorded with your name in Loss Prevention.
    @endsection @section('scripts') @endsection