@extends('layouts.app')
@section('title','Reconcile '.$bank->bank_name)
@section('page_title','Create Bank Reconciliation')
@section('content')
<div class="page-head"><div><h1>Reconcile {{ $bank->bank_name }}</h1><p>Book balance as at {{ $date }}: AED {{ number_format((float)$bookBalance,2) }}</p></div><a class="btn btn-secondary" href="{{ route('bank.show',$bank) }}">Back</a></div>
<form method="get" class="card"><div class="card-body"><div class="actions"><div class="field"><label>Statement Date</label><input class="control" type="date" name="statement_date" value="{{ $date }}"></div><button class="btn btn-secondary" style="align-self:end">Load Lines</button></div></div></form>
<form method="post" action="{{ route('bank.reconcile.store',$bank) }}">@csrf<input type="hidden" name="statement_date" value="{{ $date }}"><div class="card" style="margin-top:18px"><div class="card-head"><strong>Statement Transactions to Clear</strong><label><input type="checkbox" data-check-all="transaction_ids[]"> Select all</label></div><div class="table-wrap"><table class="table"><thead><tr><th></th><th>Date</th><th>Reference</th><th>Description</th><th>Debit</th><th>Credit</th><th>Status</th></tr></thead><tbody>@foreach($transactions as $t)<tr><td><input type="checkbox" name="transaction_ids[]" value="{{ $t->id }}" @checked($t->match_status==='cleared')></td><td>{{ $t->transaction_date->format('d M Y') }}</td><td>{{ $t->reference }}</td><td>{{ $t->description }}</td><td>{{ number_format((float)$t->debit,2) }}</td><td>{{ number_format((float)$t->credit,2) }}</td><td>{{ $t->match_status }}</td></tr>@endforeach</tbody></table></div><div class="card-body"><div class="form-grid"><div class="field"><label>Book Ending Balance</label><input class="control" value="{{ $bookBalance }}" readonly></div><div class="field"><label>Statement Ending Balance *</label><input class="control" type="number" step="0.0001" name="statement_ending_balance" required></div></div></div><div class="card-head" style="justify-content:flex-end"><button class="btn btn-primary">Create Reconciliation</button></div></div></form>
@endsection
