@extends('layouts.master') @section('title', trans('messages.invoice_details')) @section('content') @php $storeName = \App\Models\Setting::get('store_name', 'Gestock Pro'); $storeLogo = \App\Models\Setting::get('store_logo'); $currency = currency_symbol(); $isRTL = app()->getLocale() === 'ar'; $showBarcode = \App\Models\Setting::get('invoice_show_barcode', '1') === '1'; $showLogo = \App\Models\Setting::get('invoice_show_logo', '1') === '1'; @endphp
@if($showLogo && $storeLogo) @else

{{ $storeName }}

@endif

{{ trans('messages.invoices') }}

{{ trans('messages.invoice_number') }}: {{ $invoice->invoice_number }}


{{ trans('messages.customer') }}: {{ $invoice->customer?->name ?? $invoice->customer_name }}

@if($invoice->customer)

{{ trans('messages.email') }}: {{ $invoice->customer->email ?? 'N/A' }}

{{ trans('messages.phone') }}: {{ $invoice->customer->phone ?? 'N/A' }}

@endif

{{ trans('messages.status') }}: @php $badgeClass = match($invoice->status) { 'paid' => 'success', 'partially_paid' => 'warning', 'draft' => 'secondary', 'returned' => 'danger', default => 'info' }; @endphp {{ trans('messages.' . $invoice->status) }}

{{ trans('messages.date') }}: {{ $invoice->created_at->format('Y-m-d H:i') }}

{{ trans('messages.created_by') }}: {{ $invoice->user->name }}

{{ trans('messages.items') }}
@if($showBarcode) @endif @foreach($invoice->items as $item) @if($showBarcode) @endif @endforeach @if($invoice->discount > 0) @endif
{{ trans('messages.products') }}{{ trans('messages.barcode') }}{{ trans('messages.quantity') }} {{ trans('messages.unit_price') }} {{ trans('messages.batch_number') }} {{ trans('messages.supplier') }} {{ trans('messages.tax') }} {{ trans('messages.discount') }} {{ trans('messages.total') }}
{{ $item->product->name }}{{ $item->product->barcode ?? '-' }}{{ $item->quantity }} {{ format_currency($item->unit_price) }} @if($item->batch) {{ $item->batch->batch_number }} @if($item->batch->expiry_date)
{{ trans('messages.expiry_date') }}: {{ $item->batch->expiry_date->format('Y-m-d') }} @endif @else - @endif
@if($item->batch && $item->batch->supplier) {{ $item->batch->supplier->name }} @else - @endif {{ $item->tax_rate }}% {{ format_currency($item->discount) }} {{ format_currency($item->total) }}
{{ trans('messages.subtotal') }}: {{ format_currency($invoice->subtotal) }}
{{ trans('messages.discount') }}: -{{ format_currency($invoice->discount) }}
{{ trans('messages.tax') }}: {{ format_currency($invoice->tax) }}
{{ trans('messages.total') }}: {{ format_currency($invoice->total) }}
{{ trans('messages.paid') }}: {{ format_currency($invoice->paid_amount) }}
{{ trans('messages.due') }}: {{ format_currency($invoice->due_amount) }}
@if($invoice->quotation_number)

{{ trans('messages.note') }}: {{ trans('messages.invoice_converted_from_quotation') }}: {{ $invoice->quotation_number }}

@endif
@if(!$invoice->isDraft() && $invoice->due_amount > 0)
{{ trans('messages.record_payment') }}
@csrf
@endif
{{ trans('messages.payment_history') }}
@if($invoice->payments->count() > 0)
@foreach($invoice->payments as $payment)
{{ format_currency($payment->amount) }}
{{ trans('messages.' . $payment->payment_method) }} - {{ $payment->created_at->format('Y-m-d H:i') }} @if($payment->payment_method === 'cheque' && $invoice->customer_id)
{{ trans('messages.add_cheque') }} @elseif($payment->payment_method === 'promissory_note' && $invoice->customer_id)
{{ trans('messages.add_promissory_note') }} @endif
@csrf @method('DELETE')
@endforeach
@else

{{ trans('messages.no_payments') }}

@endif
@if(auth()->user()->hasAnyRole(['Admin', 'Super Admin'])) @endif @push('scripts') @endpush @if($invoice->customer && $invoice->customer->email) @endif @endsection