@php $entry = $entry ?? null; $selectedCurrencyId = old('currency_id', $entry?->currency_id ?? $defaultCurrencyId ?? null); $selectedDate = old('entry_date', optional($entry?->entry_date)->format('Y-m-d') ?? now()->toDateString()); $fxRate = old('fx_rate_to_base', $entry?->fx_rate_to_base ?? 1.0); $reference = old('reference', $entry?->reference ?? ''); $description = old('description', $entry?->description ?? ''); $autoPost = old('auto_post', false); $lineDefaults = collect(old('lines', $entry?->details?->map(function ($detail) { return [ 'account_id' => $detail->chart_of_account_id, 'debit' => number_format((float) $detail->debit, 2, '.', ''), 'credit' => number_format((float) $detail->credit, 2, '.', ''), 'description' => $detail->description, 'cost_center_id' => $detail->cost_center_id, ]; })->toArray() ?? []))->values(); while ($lineDefaults->count() < 2) { $lineDefaults->push([ 'account_id' => null, 'debit' => '0.00', 'credit' => '0.00', 'description' => null, 'cost_center_id' => null, ]); } @endphp
{{-- Header Fields --}}

Keep at 1.000000 for base currency.

{{-- Journal Lines Table --}}
@foreach ($lineDefaults as $index => $line) @endforeach
# Account * Description Debit Credit Cost Center
{{ $index + 1 }}
Totals 0.00 0.00
Diff: 0.00
{{-- Add Line Button --}}
{{ $submitLabel }}
{{-- Hidden template for dynamic line rows --}} @push('scripts') @once @endonce @endpush