@extends('layouts.admin') @section('content')
<div class="card mb-3">
    <div class="card-header">
        <div class="row flex-between-end">
            <div class="col-auto align-self-center">

                <form class="form-material" method="POST" action="{{ url ('/search_cover_payment')}}">
                    @csrf
                    <select required name="search" class="form-control">
                        <option disabled selected>--Select Option--</option>
                        @foreach ($covers as $cover)
                        <option value="{{$cover->id}}">{{$cover->name}}</option>
                        @endforeach
                    </select>                   
                    <br><button type="submit" class="btn btn-primary btn-sm" aria-placeholder="Search"><i class="fas fa-search"></i> Search</button>
                    <br><br>
                    <h5 class="mb-0" data-anchor="data-anchor">List of payments</h5>
                </form>

            </div>

            <div class="col-auto align-self-center">

                Total Payment:
                @foreach ($totalpayments as $totalpayment)
                <h2 class="text-primary">{{$totalpayment->total}}</h2>
                @endforeach
            </div>
        </div>
    </div>
    <div class="card-body pt-0">

        <div id="tableExample2" data-list='{"valueNames":["id", "date", "member_id","name","amount", "method"],"page":10,"pagination":true}'>
            <div class="table-responsive scrollbar">
                <table class="table table-bordered table-striped fs--1 mb-0">
                    <thead class="bg-200 text-900">
                        <tr>
                            <th class="sort" data-sort="date">Payment ID</th>
                            <th class="sort" data-sort="date">Date</th>
                            <th class="sort" data-sort="member_id">Member ID</th>
                            <th class="sort" data-sort="amount">Amount</th>
                        </tr>
                    </thead>
                    <tbody class="list">
                        @foreach ($payments as $payment)
                        <tr>
                            <td class="id">{{$payment->id}}</td>
                            <td class="date">{{$payment->payment_date}}</td>
                            <td class="name">{{$payment->member_id}}</td>
                            <td class="amount">{{$payment->amount_paid}}</td>
                        </tr>
                        @endforeach
                    </tbody>
                </table>
            </div>
            <div class="d-flex justify-content-center mt-3"><button class="btn btn-sm btn-falcon-default me-1" type="button" title="Previous" data-list-pagination="prev"><span class="fas fa-chevron-left"></span></button>
                <ul class="pagination mb-0"></ul><button class="btn btn-sm btn-falcon-default ms-1" type="button" title="Next" data-list-pagination="next"><span class="fas fa-chevron-right"> </span></button>
            </div>
        </div>
    </div>

</div>
@endsection