@extends('layouts.app') @php($editing = isset($item) && $item !== null) @php($selectedType = old('voucher_type', $item->voucher_type ?? $defaultType)) @php($formLines = old('lines', $item->form_lines ?? [])) @php($standardLines = $selectedType === 'contra' ? [] : ($formLines ?: ($selectedType === 'journal' ? [['account_id' => '', 'entry_type' => 'debit', 'amount' => ''], ['account_id' => '', 'entry_type' => 'credit', 'amount' => '']] : [['account_id' => '', 'amount' => '']]))) @php($contraLines = $selectedType === 'contra' ? ($formLines ?: [['debit_account_id' => '', 'debit_amount' => '', 'credit_account_id' => '', 'credit_amount' => '']]) : []) @php($selectedLabel = $selectedType === 'receipt' ? 'Receive' : ucfirst($selectedType)) @section('title', $selectedLabel . ' Voucher Create') @push('styles') @endpush @section('content') {{-- ✅ Header Section --}}

{{ $selectedLabel }} Voucher {{ $editing ? 'Edit' : 'Create' }}

Enter accounting details and ledger lines to save the voucher.

@can('viewAny', \App\Models\Voucher::class) Voucher List @endcan
{{-- ✅ Error Summary --}} @if ($errors->any()) @endif
@csrf @if ($editing) @method('PUT') @endif
{{-- ✅ Left Column: Voucher Entries --}}
{{ $selectedLabel }} Voucher Information
{{-- Standard Table --}}
S/L Account Head * Trnx Type * Amount * Details
Total Debit 0.00
Total Credit 0.00
Difference 0.00 Not balanced
{{-- Contra Table --}}
S/L Debit Account Head * Dr. Amount * Credit Account Head * Cr. Amount *
Total Debit 0.00 Total Credit 0.00
Difference Not balanced
{{-- Add Row Button --}}
Add Entry Line
{{-- ✅ Right Column: Basic Information --}}
Basic Information
{{-- Branch --}}
{{-- Voucher Date --}}
{{-- Payment Mode --}}
{{-- Payee --}}
{{-- Journal Party --}}
{{-- Reference --}}
{{-- Narration --}}
{{-- Attachment --}}
PDF, JPG or PNG (Max 5 MB). @if ($editing && $item->attachment_path) Download current @endif
{{-- ✅ Action Buttons --}}
Cancel {{ $editing ? 'Update Draft' : 'Save as Draft' }}
{{-- ✅ Templates (Updated with fixed remove button) --}} {{-- ✅ JavaScript Logic (Untouched, just formatted) --}} @endsection