@extends('layouts.app')
@section('title', 'Bank Book')
@section('page', 'bank-book')
@section('bankNav', 'entries')
@php
$typeVariant = fn ($t) => $t === 'In' ? 'success' : 'danger';
$statusVariant = fn ($s) => $s === 'Active' ? 'success' : 'danger';
$presetCategories = [
'Opening Balance',
'Deposit',
'Withdrawal',
'Cheque',
'Transfer',
'Interest',
'Sales',
];
$categoryOptions = collect($presetCategories)
->merge($expenseCategories ?? [])
->merge($categories ?? [])
->unique()
->sort()
->values();
$defaultAccountId = $selectedAccountId ?: ($bankAccounts->first()?->id);
@endphp
@section('content')
@include('partials.account-bank-nav')
@if (session('success'))
Opening Balance {{ money($openingBalance) }} Total In {{ money($totalIn) }} Total Out {{ money($totalOut) }} Closing Balance {{ money($currentBalance) }}
@empty
{{ $row->entry_date->format('Y-m-d') }}
{{ $row->bankAccount?->name ?? ($selectedAccountName ?? '—') }}
{{ $row->category }}
{{ preg_match('/^(Bill No\s+\d+)/i', (string) $row->notes, $m) ? $m[1] : ($row->notes ?: '—') }}
{{ $row->type === 'In' ? money((float) $row->amount) : '—' }}
{{ $row->type === 'Out' ? money((float) $row->amount) : '—' }}
{{ money((float) $row->running_balance) }}
@endforelse
@if ($bankAccounts->isEmpty())
Add a bank and bank account first, then record entries.
@else
No bank book entries yet. Add your first entry.
@endif