@assets @endassets
@php $displayPaidAmount = max((float) $paid_amount, 0); $displayExchangeCreditAmount = $isExchangeMode ? max((float) ($exchangeCreditAmount ?? 0), 0) : 0; if (! $selectedCustomer && ! $isExchangeMode && $displayPaidAmount < (float) $total) { $displayPaidAmount = (float) $total; } $displayCurrentInvoicePaid = min($displayPaidAmount + $displayExchangeCreditAmount, (float) $total); $displayExtraAmount = max(($displayPaidAmount + $displayExchangeCreditAmount) - (float) $total, 0); $displayDueAdjustmentAmount = $selectedCustomer && $adjust_due_with_payment ? min($displayExtraAmount, (float) ($selectedCustomerDue ?? 0)) : 0; $displayChangeAmount = $selectedCustomer ? max($displayExtraAmount - $displayDueAdjustmentAmount, 0) : $displayExtraAmount; $displayBalance = max((float) $total - $displayCurrentInvoicePaid, 0); $displayMinimumPaidAmount = $isExchangeMode && ! $selectedCustomer ? $displayBalance : (($isExchangeMode || $selectedCustomer) ? 0 : (float) $total); $displayCustomerDueAfterCheckout = $selectedCustomer ? max((float) ($selectedCustomerDue ?? 0) + $displayBalance - $displayDueAdjustmentAmount, 0) : 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

--}}
{{ date('d/m/Y') }}
{{-- --}}
@if($isExchangeMode)
{{ __('Exchange active:') }} {{ $exchangeScanMode === 'return' ? __('Scan returned products') : __('Add replacement products') }}
@endif @forelse($products as $product)
@php $productImageUrl = null; $currentStock = (float) ($product->quantity ?? 0); $alertQuantity = (float) ($product->alert_quantity ?? 0); $isLowStock = $alertQuantity > 0 && $currentStock > 0 && $currentStock <= $alertQuantity; if (! empty($product->product_image)) { if (\Illuminate\Support\Facades\Storage::disk('public')->exists($product->product_image)) { $productImageUrl = route('admin.products.image', [ 'productId' => $product->id, 'v' => $product->updated_at?->getTimestamp(), ]); } } @endphp
@if($productImageUrl) {{ $product->display_name }} @else {{ mb_substr($product->display_name, 0, 1) }} @endif
{{ $product->display_name }}
{{ __('Stock:') }} {{ $product->quantity ?? 0 }} {{-- @if((float) ($product->latest_batch_sale_rate ?? 0) > 0)
{{ __('Prv batch:') }} Rs. {{ number_format((float) $product->latest_batch_sale_rate, 0) }}
@endif
{{ __('Price:') }} Rs. {{ number_format((float) ($product->effective_sale_rate ?? $product->sale_rate ?? 0), 0) }}
--}}
@empty

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

@endforelse
{{ __('Current Order') }}
@if($isEditingInvoice) {{ __('Editing') }} @endif @if($isExchangeMode) {{ __('Exchange') }} @endif
{{-- --}}
{{ __('Quotations') }}
{{-- {{ count($cart) }} --}}
{{ count($cart) }}
@if($isExchangeMode)
{{ __('Exchange active:') }} {{ $exchangeScanMode === 'return' ? __('Return scan mode') : __('Sale scan mode') }}
@endif
@if($showHeldBillsPanel)
{{ __('Held Bills') }}
@forelse($heldBills as $bill)
{{ $bill['title'] ?? __('Customer') }}
{{ ($bill['items_count'] ?? 0) }} {{ __('items') }} | PKR {{ number_format((float) ($bill['total'] ?? 0), 2) }} | {{ $bill['saved_at'] ?? '' }}
@empty
{{ __('No held bills yet.') }}
@endforelse
@endif {{--
--}}
@forelse($cart as $id => $item) @empty @endforelse
{{ __('Product') }} {{ __('Price') }} {{ __('Unit') }} {{ __('Quantity') }} {{ __('Sub Total') }}
@php $cartDisplayName = trim((string) ($item['name'] ?? '')); $cartBaseName = $cartDisplayName; $cartVariantName = ''; if ($cartDisplayName !== '' && str_contains($cartDisplayName, ' - ')) { [$cartBaseName, $cartVariantName] = array_pad(explode(' - ', $cartDisplayName, 2), 2, ''); } @endphp
{{ $cartBaseName ?: $cartDisplayName }}
@if($cartVariantName !== '')
{{ $cartVariantName }}
@endif @if(($item['line_type'] ?? 'sale') === 'exchange_return')
{{ __('Exchange Return') }}
@endif @if(!empty($item['barcode_number']) && ($item['barcode_number'] !== ($item['master_barcode'] ?? null)))
{{ __('Barcode') }}: {{ $item['barcode_number'] }}
@endif @if(($item['line_type'] ?? 'sale') !== 'exchange_return')
@if(!empty($item['variation_group_id']) || !empty($item['variant_row_key']) || !empty($item['variation_type'])) {{ __('Variant Stock') }}: {{ rtrim(rtrim(number_format($item['stock'], 2), '0'), '.') }} {{ $item['unit_name'] }} @else {{ __('In Stock') }}: {{ rtrim(rtrim(number_format($item['stock'], 2), '0'), '.') }} {{ $item['unit_name'] }} @endif
@endif @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 = (float) $item['qty'] > 0 ? $lineTotal - $lineDisc : 0; @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
{{-- {{ $selectedCustomer ? __('Customer selected: partial payment is allowed.') : __('Walk-in customer: extra amount will be returned as change.') }} --}}
{{ __('Balance') }}
PKR {{ number_format($displayBalance, 2) }}
{{-- --}}
@unless($isExchangeMode) @endunless
@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 }}
{{ __('Date:') }} {{ now()->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
{{ __('Net Total:') }} PKR {{ number_format($total, 2) }}
@if($isExchangeMode)
{{ __('Previous Paid / Exchange Credit:') }} PKR {{ number_format($displayExchangeCreditAmount, 2) }}
{{ __('Pay Now:') }} PKR {{ number_format($displayPaidAmount, 2) }}
{{ __('Net Payable:') }} PKR {{ number_format($displayBalance, 2) }}
@endif
PKR
@if($isExchangeMode) {{ __('Old paid amount is being used as credit. This field is the extra amount to collect now.') }} @endif
{{ __('Current balance:') }} PKR {{ number_format($selectedAccount->current_balance ?? 0, 2) }}
{{ $selectedCustomer ? __('Customer Due Before Checkout') : __('Change') }} PKR {{ number_format($selectedCustomer ? (float) ($selectedCustomerDue ?? 0) : $displayChangeAmount, 2) }}
@if($selectedCustomer)
{{--
{{ __('If you pay extra, the extra amount can reduce the customer\'s previous due instead of becoming change.') }}
--}}
{{ __('This Invoice Balance') }} PKR {{ number_format($displayBalance, 2) }}
{{ __('Due Adjustment') }} PKR {{ number_format($displayDueAdjustmentAmount, 2) }}
@if($displayChangeAmount > 0)
{{ __('Change') }} PKR {{ number_format($displayChangeAmount, 2) }}
@endif
{{ __('Due After Checkout') }} PKR {{ number_format($displayCustomerDueAfterCheckout, 2) }}
@else {{--
{{ __('Extra amount entered here will be treated as change and will not be added to due.') }}
--}} @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 --}} @if($showVariationDrawer)
@endif
{{ __('Select Variation Types') }}
{{ $drawerProductName ?: __('Choose one or more types before adding to cart.') }}
@if(empty($drawerVariationConfigs))
{{ __('No variation types found for this product.') }}
@else @php $manualVariantRows = collect($drawerVariationConfigs ?? []) ->flatMap(function ($config) { if (! is_array($config) || empty($config['variant_rows'])) { return []; } return collect($config['variant_rows'])->map(function ($row) use ($config) { return [ 'config' => $config, 'row' => $row, ]; })->values(); }) ->values(); $hasManualVariantRows = $manualVariantRows->isNotEmpty(); @endphp @if($hasManualVariantRows)
{{ __('Variants') }}
{{ __('Tap a variant to add it directly.') }}
{{ $manualVariantRows->count() }} {{ __('variants') }}
@foreach($manualVariantRows as $item) @php $config = $item['config'] ?? []; $row = $item['row'] ?? []; $rowKey = (string) ($row['key'] ?? ''); $rowSelected = in_array($rowKey, $drawerSelectedVariantRowKeys ?? [], true); $rowStock = (float) ($row['current_stock'] ?? $row['opening_stock'] ?? 0); $rowOutOfStock = $rowStock <= 0; @endphp
@endforeach
@else @foreach($drawerVariationConfigs as $configIndex => $config)
{{ $config['variation_name'] ?? __('Variation Group') }}
{{ !empty($config['variant_rows']) ? __('Tap a variant to add it directly.') : __('Select one or more types from this group.') }}
{{ !empty($config['variant_rows']) ? count($config['variant_rows'] ?? []) : count($config['available_types'] ?? []) }} {{ !empty($config['variant_rows']) ? __('variants') : __('types') }}
@if(!empty($config['variant_rows']))
@foreach(($config['variant_rows'] ?? []) as $row) @php $rowStock = (float) ($row['current_stock'] ?? $row['opening_stock'] ?? 0); $rowOutOfStock = $rowStock <= 0; @endphp
@endforeach
@else
@foreach(($config['type_prices'] ?? []) as $row)
@endforeach
@endif
@endforeach @endif @endif
@if($showWhatsAppConfirmation)

{{ __('Review the customer message before queuing it.') }}

{{ $whatsAppPreview }}
@endif