@extends('backend.layout.main')

@section('content')
<section>
    <div class="container-fluid">
        <div class="card">
            <div class="card-header">
                <h4>{{trans('file.Account Statement')}}: {{$lims_account_data->name}}</h4>
            </div>
            <div class="table-responsive">
                <table class="table mb-0">
                    <thead>
                        <tr>
                            <th>{{trans('file.Date')}}</th>
                            <th>{{trans('file.reference')}}</th>
                            <th>{{trans('file.Transaction Type')}}</th>
                            <th>{{trans('file.Cash In')}}</th>
                            <th>{{trans('file.Cash Out')}}</th>
                            <th>{{trans('file.Balance')}}</th>
                            <th>{{trans('file.Note')}}</th>
                        </tr>
                    </thead>
                    <tbody>
                        @forelse($all_transaction_list as $transaction)
                            <tr>
                                <td>{{$transaction->transaction_date->format(config('date_format'))}}</td>
                                <td>{{$transaction->reference_no ?: '-'}}</td>
                                <td>{{trans('file.' . $transaction->category)}}</td>
                                <td>{{$transaction->direction === 'in' ? number_format($transaction->amount, 2) : '-'}}</td>
                                <td>{{$transaction->direction === 'out' ? number_format($transaction->amount, 2) : '-'}}</td>
                                <td>{{number_format($transaction->balance_after, 2)}}</td>
                                <td>{{$transaction->description}}</td>
                            </tr>
                        @empty
                            <tr><td colspan="7" class="text-center">{{trans('file.No transactions recorded')}}</td></tr>
                        @endforelse
                    </tbody>
                </table>
            </div>
        </div>
    </div>
</section>
@endsection
