@extends('admin.layouts.app')
@section('title','Dealer Ledger')
@section('content')
<div class="page-head"><div><h1 class="page-title">Dealer Ledger</h1><div class="page-subtitle">Dealer statement, bulk order and commission ledger</div></div></div>
<div class="card panel-tight"><h3 style="margin-top:0">{{ $dealer->name }}</h3><p>Balance: <strong>{{ number_format($balance,2) }}</strong></p></div><form method="POST" class="card panel-tight grid-3">@csrf<div><label>Date</label><input type="date" name="txn_date" value="{{ date('Y-m-d') }}"></div><div><label>Reference</label><input name="reference_no"></div><div><label>Type</label><input name="type" placeholder="Bulk Order / Payment / Commission"></div><div><label>Debit</label><input type="number" step="0.01" name="debit"></div><div><label>Credit</label><input type="number" step="0.01" name="credit"></div><div><label>Notes</label><input name="notes"></div><div class="form-actions" style="grid-column:1/-1"><button class="btn primary">Add Ledger Entry</button></div></form><div class="card panel-tight table-wrap"><table class="table"><thead><tr><th>Date</th><th>Ref</th><th>Type</th><th>Debit</th><th>Credit</th></tr></thead><tbody>@forelse($entries as $entry)<tr><td>{{ $entry->txn_date }}</td><td>{{ $entry->reference_no }}</td><td>{{ $entry->type }}</td><td>{{ $entry->debit }}</td><td>{{ $entry->credit }}</td></tr>@empty<tr><td colspan="5">No entries found.</td></tr>@endforelse</tbody></table></div>
@endsection
