@if ($invoice->status == \App\Models\Invoice::DRAFT) {{ Form::label('client_id', __('messages.invoice.client') . ':', ['class' => 'form-label required fs-6 fw-bolder text-gray-700 mb-3']) }} {{ Form::select('client_id', $clients, $client_id ?? null, ['class' => 'form-select io-select2', 'id' => 'client_id', 'placeholder' => __('messages.invoice.client'), 'required']) }} @else {{ Form::label('client_id', __('messages.invoice.client') . ':', ['class' => 'form-label mb-3']) }}
{{ $invoice->client->user->full_name }} @endif

{{ __('messages.invoice.invoice') }} # {{ $invoice->invoice_id }}

{{ Form::label('status', __('messages.common.status') . ':', ['class' => 'form-label required mb-3']) }} {{ Form::select('status', $statusArr, isset($invoice) ? $invoice->status : null, ['class' => 'form-select io-select2', 'id' => 'status', 'required']) }}
{{ Form::label('invoice_date', __('messages.invoice.invoice_date') . ':', ['class' => 'form-label required mb-3']) }} {{ Form::text('invoice_date', null, ['class' => 'form-select', 'id' => 'editInvoiceDate', 'autocomplete' => 'off', 'required']) }}
{{ Form::label('due_date', __('messages.invoice.due_date') . ':', ['class' => 'form-label required mb-3']) }} {{ Form::text('due_date', null, ['class' => 'form-select edit-due-date', 'autocomplete' => 'off', 'required']) }}
{{ Form::label('templateId', __('messages.setting.invoice_template') . ':', ['class' => 'form-label mb-3']) }} {{ Form::select('template_id', $template, isset($invoice) ? $invoice->template_id : null, ['class' => 'form-select io-select2', 'id' => 'templateId', 'required']) }}
{{ Form::label('payment_qr_code_id', __('messages.payment_qr_codes.payment_qr_code') . ':', ['class' => 'form-label mb-3']) }} {{ Form::select('payment_qr_code_id', $paymentQrCodes, isset($invoice) ? $invoice->paymentQrCodes?->id : null, ['class' => 'form-select io-select2 payment-qr-code', 'data-control' => 'select2', 'placeholder' => 'Select Payment QR Code']) }}
{{ Form::label('invoiceCurrencyType', __('messages.setting.currencies') . ':', ['class' => 'form-label mb-3']) }}
{{ Form::label('recurringCycle', __('messages.invoice.recurring_cycle') . ':', ['class' => 'form-label mb-3']) }} {{ Form::number('recurring_cycle', $invoice->recurring_cycle, ['class' => 'form-control', 'id' => 'recurringCycle', 'autocomplete' => 'off', 'placeholder' => __('messages.invoice.recurring_days'), 'oninput' => "validity.valid||(value=value.replace(/[e\+\-]/gi,''))"]) }}
@php $i = 1; @endphp @foreach ($invoice->invoiceItems as $invoiceItem) @endforeach
# {{ __('messages.product.product') }} {{ __('messages.invoice.qty') }} {{ __('messages.product.unit_price') }} {{ __('messages.invoice.tax') }} {{ __('messages.invoice.amount') }} {{ __('messages.common.action') }}
{{ $i++ }} {{ Form::select('product_id[]', $products, isset($invoiceItem->product_id) ? $invoiceItem->product_id : $invoiceItem->product_name ?? [], ['class' => 'form-select productId product io-select2', 'required', 'placeholder' => 'Select Product or Enter free text', 'data-control' => 'select2']) }} {{ Form::hidden('id[]', $invoiceItem->id) }} {{ Form::number('quantity[]', $invoiceItem->quantity, ['class' => 'form-control qty form-control-solid', 'id' => 'qty', 'required', 'type' => 'number', 'min' => '0', 'step' => '.01', 'oninput' => "validity.valid||(value=value.replace(/[e\+\-]/gi,''))"]) }} {{ Form::number('price[]', $invoiceItem->price, ['class' => 'form-control price-input price form-control-solid', 'oninput' => "validity.valid||(value=value.replace(/[e\+\-]/gi,''))", 'min' => '0', 'step' => '.01', 'required', 'onKeyPress' => 'if(this.value.length==8) return false;']) }} {{ number_format($invoiceItem->total, 2) }}
{{ Form::label('discount', __('messages.invoice.discount') . ':', ['class' => 'form-label mb-1']) }}
{{ Form::number('discount', isset($invoice) ? $invoice->discount : 0, ['id' => 'discount', 'class' => 'form-control ', 'oninput' => "validity.valid||(value=value.replace(/[e\+\-]/gi,''))", 'min' => '0', 'value' => '0', 'step' => '.01', 'pattern' => "^\d*(\.\d{0,2})?$"]) }}
{{ Form::select('discount_type', $discount_type, isset($invoice) ? $invoice->discount_type : 0, ['class' => 'form-select', 'id' => 'discountType', 'data-control' => 'select2']) }}
{{ Form::label('taxes', __('messages.invoice.tax') . ':', ['class' => 'form-label mb-1']) }}
{{ __('messages.invoice.sub_total') . ':' }} @if (!getSettingValue('currency_after_amount')) {{ getInvoiceCurrencySymbol($invoice->currency_id) }} @endif {{ isset($invoice) ? number_format($invoice->amount, 2) : 0 }} @if (getSettingValue('currency_after_amount')) {{ getInvoiceCurrencySymbol($invoice->currency_id) }} @endif
{{ __('messages.invoice.discount') . ':' }} @if (!getSettingValue('currency_after_amount')) {{ getInvoiceCurrencySymbol($invoice->currency_id) }} @endif @if (isset($invoice) && $invoice->discount_type == \App\Models\Invoice::FIXED) {{ $invoice->discount ?? 0 }} @else {{ isset($invoice) ? number_format(($invoice->amount * $invoice->discount) / 100, 2) : 0 }} @endif @if (getSettingValue('currency_after_amount')) {{ getInvoiceCurrencySymbol($invoice->currency_id) }} @endif
{{ __('messages.invoice.total_tax') . ':' }} @if (!getSettingValue('currency_after_amount')) {{ getInvoiceCurrencySymbol($invoice->currency_id) }} @endif 0 @if (getSettingValue('currency_after_amount')) {{ getInvoiceCurrencySymbol($invoice->currency_id) }} @endif
{{ __('messages.invoice.total') . ':' }} @if (!getSettingValue('currency_after_amount')) {{ getInvoiceCurrencySymbol($invoice->currency_id) }} @endif {{ isset($invoice) ? number_format($invoice->amount - ($invoice->amount * $invoice->discount) / 100, 2) : 0 }} @if (getSettingValue('currency_after_amount')) {{ getInvoiceCurrencySymbol($invoice->currency_id) }} @endif

{{ Form::label('note', __('messages.invoice.note') . ':', ['class' => 'form-label fs-6 fw-bolder text-gray-700 mb-3']) }} {{ Form::textarea('note', isset($invoice) ? $invoice->note : null, ['class' => 'form-control', 'id' => 'note']) }}
{{ Form::label('term', __('messages.invoice.terms') . ':', ['class' => 'form-label fs-6 fw-bolder text-gray-700 mb-3']) }} {{ Form::textarea('term', isset($invoice) ? $invoice->term : null, ['class' => 'form-control', 'id' => 'term']) }}
{{ Form::hidden('amount', isset($invoice) ? $invoice->amount : 0, ['class' => 'form-control', 'id' => 'total_amount']) }} {{ Form::hidden('final_amount', isset($invoice) ? $invoice->final_amount : 0, ['class' => 'form-control', 'id' => 'finalTotalAmt']) }}
@if ($invoice->status == \App\Models\Invoice::DRAFT) @endif {{ __('messages.common.cancel') }}