{{ __('messages.invoice.invoice') }} # {{ $invoiceId = (isset($invoice) ? $invoice->invoice_id : \App\Models\Invoice::generateUniqueInvoiceId()) }} @if(!isset($invoice)) @endif

{{ Form::label('patient_id', __('messages.invoice.patient').(':'),['class' => 'form-label']) }} {{ Form::select('patient_id', $patients, isset($invoice) ? $invoice->patient_id : null, ['class' => 'form-select', 'id' => 'patient_id', 'placeholder' => __('messages.document.select_patient'),'required','data-control' =>'select2']) }}
@if(isset($invoice))
{{ Form::label('invoice_date', __('messages.invoice.invoice_date').(':'),['class' => 'form-label']) }} {{ Form::text('invoice_date', null, ['class' => (getLoggedInUser()->thememode ? 'bg-light form-control' : 'bg-white form-control'), 'id' => 'editInvoiceDate', 'autocomplete' => 'off','required']) }}
@else
{{ Form::label('invoice_date', __('messages.invoice.invoice_date').(':'),['class' => 'form-label']) }} {{ Form::text('invoice_date', null, ['class' => (getLoggedInUser()->thememode ? 'bg-light form-control' : 'bg-white form-control'), 'id' => 'invoice_date', 'autocomplete' => 'off','required']) }}
@endif

{{ Form::label('discount', __('messages.invoice.discount').(':'), ['class' => 'form-label']) }} (%) {{ Form::number('discount', isset($invoice) ? $invoice->discount : null, ['id'=>'discount','class' => 'form-control','placeholder' => __('messages.document.in_percentage'),'required', 'min' => 0, 'max' => 100, 'step' => '.01']) }}
{{ Form::label('status', __('messages.common.status').(':'), ['class' => 'form-label']) }} {{ Form::select('status', $statusArr, isset($invoice) ? $invoice->status : null, ['class' => 'form-select', 'id' => 'status','required','data-control' => 'select2']) }}
@if(isset($invoice)) @php $indexNumber = 1; @endphp @foreach($invoice->invoiceItems as $invoiceItem) @endforeach @else @endif
# {{ __('messages.account.account') }} {{ __('messages.invoice.description') }} {{ __('messages.invoice.qty') }} {{ __('messages.invoice.price') }} {{ __('messages.invoice.amount') }} {{ __('messages.common.action') }}
{{ $indexNumber++ }} {{ Form::select('account_id[]', $accounts, $invoiceItem->account_id, ['class' => 'form-select accountId', 'required', 'placeholder'=>'Select Account', 'data-control' => 'select2']) }} {{ Form::hidden('id[]', $invoiceItem->id) }} {{ Form::text('description[]', $invoiceItem->description, ['class' => 'form-control']) }} {{ Form::number('quantity[]', $invoiceItem->quantity, ['class' => 'form-control qty','required', 'type' => 'number', "min" => 1]) }} {{ Form::text('price[]', number_format($invoiceItem->price), ['class' => 'form-control decimal-number price','required']) }} {{-- {{ getCurrencySymbol() }}--}} {{ number_format($invoiceItem->total) }}
1 {{ Form::select('account_id[]', $accounts, null, ['class' => 'form-select accountId ','required','placeholder'=>'Select Account','data-control' => 'select2']) }} {{ Form::text('description[]', null, ['class' => 'form-control']) }} {{ Form::number('quantity[]', null, ['class' => 'form-control qty','required', 'type' => 'number', "min" => 1]) }} {{ Form::text('price[]', null, ['class' => 'form-control decimal-number price','required']) }} 0.00
{{ __('messages.invoice.sub_total').(':') }} {{ getCurrencySymbol() }} {{ isset($invoice) ? number_format($invoice->amount,2) : 0 }}
{{ __('messages.invoice.discount').(':') }} {{ getCurrencySymbol() }} {{ isset($invoice) ? number_format($invoice->amount * $invoice->discount / 100,2) : 0 }}
{{ __('messages.invoice.total').(':') }} {{ getCurrencySymbol() }} {{ isset($invoice) ? number_format($invoice->amount - ($invoice->amount * $invoice->discount / 100),2) : 0 }}
{{ Form::hidden('amount', isset($invoice) ? number_format($invoice->amount - ($invoice->amount * $invoice->discount / 100),2) : 0, ['class' => 'form-control', 'id' => 'total_amount']) }}
{{ Form::submit(__('messages.common.save'), ['class' => 'btn btn-primary me-3','id' => 'btnSave']) }} {{ __('messages.common.cancel') }}