@assets @endassets
@php $rawPaidAmount = max((float) $paid_amount, 0); $displayPaidAmount = $selectedCustomer ? $rawPaidAmount : (float) $total; $displayBalance = max((float) $total - min($rawPaidAmount, (float) $total), 0); $displayWalkInChange = max($rawPaidAmount - (float) $total, 0); $walkInUnderpaid = ! $selectedCustomer && $rawPaidAmount < (float) $total; $displayBalanceLabel = (! $selectedCustomer && $displayWalkInChange > 0) ? __('Change') : __('Due'); $displayBalanceValue = (! $selectedCustomer && $displayWalkInChange > 0) ? $displayWalkInChange : $displayBalance; $hasCustomerDue = $selectedCustomer && (float) $selectedCustomerDue != 0; $openingBalanceAppliedPreview = ($selectedCustomer && $apply_opening_balance && $selectedCustomerDue > 0) ? min((float) $selectedCustomerDue, max($rawPaidAmount - (float) $total, 0)) : 0; $displayCustomerDueAfterAdjust = $selectedCustomer ? (float) $selectedCustomerDue - $openingBalanceAppliedPreview : 0; $displayChange = max(max($rawPaidAmount - (float) $total, 0) - $openingBalanceAppliedPreview, 0); $visibleInvoiceCharges = collect($invoiceCharges ?? []) ->filter(fn ($charge) => (float) data_get($charge, 'amount', 0) > 0) ->values(); $selectedChargeNames = collect($invoiceCharges ?? []) ->map(fn ($charge) => trim((string) data_get($charge, 'name', ''))) ->filter() ->values(); $selectedChargeLabel = $selectedChargeNames->isEmpty() ? __('Add charges') : $selectedChargeNames->take(2)->implode(', ') . ($selectedChargeNames->count() > 2 ? ' +' . ($selectedChargeNames->count() - 2) : ''); @endphp
@if (session()->has('success'))
{{ session('success') }}
@endif @if (session()->has('error'))
{{ session('error') }}
@endif
{{--

Mandi POS

--}}
{{-- --}}
{{-- --}}
@forelse($products as $product)
@php $productImageUrl = null; if (! empty($product->product_image)) { $productImagePath = public_path('storage/' . $product->product_image); if (file_exists($productImagePath)) { $productImageUrl = asset('storage/' . $product->product_image); } } @endphp
@if($productImageUrl) {{ $product->display_name }} @else {{ mb_substr($product->display_name, 0, 1) }} @endif
{{ $product->display_name }}
{{ __('Stock:') }} {{ $product->quantity ?? 0 }} {{ $product->unit?->display_name ?? __('Unit') }} Rs. {{ number_format($product->sale_rate ?? 0) }}
@empty

{{ __('No products found.') }}

@endforelse
{{ __('Current Order') }}
@if($isEditingInvoice) {{ __('Editing') }} @endif
{{ count($cart) }}
{{--
--}}
@forelse($cart as $id => $item) @empty @endforelse
{{ __('Product') }} {{ __('Price') }} {{ __('Unit') }} {{ __('Quantity') }} {{ __('Sub Total') }}
{{ $item['name'] }}
{{ __('In Stock:') }} {{ rtrim(rtrim(number_format($item['stock'], 2), '0'), '.') }} {{ $item['unit_name'] }}
@php $cartItemDiscount = (float) ($item['item_discount'] ?? 0); $cartItemDiscountType = $item['item_discount_type'] ?? 'fixed'; @endphp @if($cartItemDiscount > 0)
{{ __('Discount:') }} @if($cartItemDiscountType === 'percent') {{ rtrim(rtrim(number_format($cartItemDiscount, 2), '0'), '.') }}% @else Rs. {{ number_format($cartItemDiscount, 2) }} @endif
@endif
{{-- --}}
Rs. {{ number_format($item['price'], 2) }}
@if(count($item['unit_options']) > 1) @else {{ $item['unit_name'] }} @endif
@if(!empty($item['stock_error']))
{{ $item['stock_error'] }}
@endif
@php $lineTotal = $item['qty'] * $item['price']; $lineDisc = (float)($item['item_discount'] ?? 0); if(($item['item_discount_type'] ?? 'fixed') === 'percent') { $lineDisc = $lineTotal * ($lineDisc / 100); } $finalLineTotal = $lineTotal - $lineDisc; @endphp Rs. {{ number_format($finalLineTotal, 2) }}
{{ __('Cart is empty') }}
{{ __('Sub Total') }}
PKR {{ number_format($subtotal, 2) }}
{{ __('Cust Due') }}
PKR {{ number_format($selectedCustomerDue ?? 0, 2) }}
{{ __('Discount') }}
F
{{ __('Charges') }}
{{ __('Charges') }}
{{ __('Charges') }} @forelse($invoiceCharges as $index => $charge)
{{ $charge['name'] ?? __('Charge') }}
@empty
{{ __('No charges added yet.') }}
@endforelse
@error('quickChargeName') {{ $message }} @enderror
{{ __('Selected Charges') }}
PKR {{ number_format($visibleInvoiceCharges->sum(fn ($charge) => (float) data_get($charge, 'amount', 0)), 2) }}
{{ __('Amount Paid') }}
PKR
@if($walkInUnderpaid) {{ __('Amount is less than total.') }} @endif {{-- {{ $selectedCustomer ? __('Customer selected: you can edit the paid amount.') : __('Walk-in customer: enter the amount received.') }} --}}
{{ $displayBalanceLabel }}
PKR {{ number_format($displayBalanceValue, 2) }}
{{-- --}}
@if($showCheckoutModal)
@if($isEditingInvoice)
{{ __('Editing mode is active.') }} {{ __('This sale will update invoice') }} #{{ $invoice_number }}.
@endif
{{ $selectedCustomer ? __('Customer ID:') . ' ' . $selectedCustomer->id : __('Walk-in Customer') }}
{{ $selectedCustomer->display_name ?? __('Walk-in Customer') }}
{{ $selectedCustomer->phone ?? __('Phone not available') }}
@if(!empty($selectedCustomer?->address))
{{ $selectedCustomer->address }}
@endif
{{ __('Invoice #') }} {{ $invoice_number }}
@php $selectedInvoiceDate = ! empty($invoice_date) ? \Illuminate\Support\Carbon::parse($invoice_date) : now(); @endphp
{{ __('Date:') }} {{ $selectedInvoiceDate->format('d/m/Y') }}
{{ __('Time:') }} {{ now()->format('h:i A') }}
@foreach($cart as $item) @endforeach
{{ __('Product') }} {{ __('Qty') }} {{ __('Rate') }} {{ __('Total') }}
{{ $item['name'] }}
{{ $item['unit_name'] }}
{{ $item['qty'] }} PKR {{ number_format($item['price'], 2) }} PKR {{ number_format($item['qty'] * $item['price'], 2) }}
{{ __('Sub Total:') }} PKR {{ number_format($subtotal + $item_discounts_total, 2) }}
{{ __('Discount') }}: PKR {{ number_format($item_discounts_total + $discount, 2) }}
@if($visibleInvoiceCharges->isNotEmpty())
{{ __('Other Charges') }}: PKR {{ number_format($visibleInvoiceCharges->sum(fn ($charge) => (float) data_get($charge, 'amount', 0)), 2) }}
@endif @if($visibleInvoiceCharges->isNotEmpty())
{{ __('Charges Breakdown') }}
@foreach($visibleInvoiceCharges as $charge)
{{ $charge['name'] ?? __('Charge') }} PKR {{ number_format((float) ($charge['amount'] ?? 0), 2) }}
@endforeach
@endif
{{ __('Gross Total:') }} PKR {{ number_format($total, 2) }}

@if($selectedCustomer)
{{ __('Total+Previous Due:') }} PKR {{ number_format((float) $total + (float) $selectedCustomerDue, 2) }}
@endif
PKR
{{-- {{ __('Enter the amount received.') }} --}} @if($rawPaidAmount < (float) $total) {{ __('Short by:') }} PKR {{ number_format((float) $total - $rawPaidAmount, 2) }} @elseif($rawPaidAmount > (float) $total) {{ $selectedCustomer ? __('Change:') : __('Change:') }} PKR {{ number_format($selectedCustomer ? (float) $displayChange : ($rawPaidAmount - (float) $total), 2) }} @endif
{{ __('Current balance:') }} PKR {{ number_format($selectedAccount->current_balance ?? 0, 2) }}
@if($hasCustomerDue)
{{ __('Previous due') }} PKR {{ number_format((float) $selectedCustomerDue, 2) }}
{{--
{{ __('Opening balance applied') }} PKR {{ number_format((float) $openingBalanceAppliedPreview, 2) }}
--}}
{{ __('Due after invoice') }} PKR {{ number_format((float) $displayCustomerDueAfterAdjust, 2) }}
{{ __('Change') }} PKR {{ number_format((float) $displayChange, 2) }}
@endif
{{--
{{ __('Choose which language slip should print in.') }}
--}}
@endif @if($showCustomerModal)
@error('customer_name') {{ $message }} @enderror
@error('customer_phone') {{ $message }} @enderror
@error('customer_email') {{ $message }} @enderror
Rs
@error('customer_opening_balance') {{ $message }} @enderror
Rs
@error('customer_credit_limit') {{ $message }} @enderror
@endif @if($isProductModalOpen) @endif {{-- @if($showChargesModal)
{{ __('Current Charges Total') }}
PKR {{ number_format($other_charges_total, 2) }}
{{ __('Saved Charges') }}
{{ __('Tap a saved charge to add it. Amount will be entered below.') }}
@forelse($savedOtherCharges as $savedCharge) @empty {{ __('No saved charges yet.') }} @endforelse
{{ __('Quick Add New Charge') }}
@error('quickChargeName') {{ $message }} @enderror
{{ __('Charges List') }}
@forelse($invoiceCharges as $index => $charge)
{{ $charge['name'] ?? __('Charge') }}
@empty
{{ __('No charges added yet.') }}
@endforelse
@endif --}}