@extends('layouts.admin')

@section('page-title')
    Admin | Account Top Ups
@endsection

@section('page-css')
    <!-- third party css -->
    <link href="{{ url('public/assets/css/vendor/dataTables.bootstrap4.css')}}" rel="stylesheet" type="text/css" />
    <link href="{{ url('public/assets/css/vendor/responsive.bootstrap4.css')}}" rel="stylesheet" type="text/css" />
    <!-- third party css end -->
@endsection

@section('page-content')
    
<!-- start page title -->
<div class="row">
    <div class="col-12">
        <div class="page-title-box">
            <div class="page-title-right">
                <ol class="breadcrumb m-0">
                    <li class="breadcrumb-item"><a href="{{url('/')}}">Dashboard</a></li>
                    <li class="breadcrumb-item active">Top Ups</li>
                </ol>
            </div>
            <h4 class="page-title">Organisation Top Ups</h4>
        </div>
    </div>
</div>     
<!-- end page title --> 

<div class="row">
    <div class="col-md-12">
        {{-- Alert --}}
    @include('layouts.alert')
</div>
</div>

<div class="row">
    <div class="col-12">
        <div class="card">
            <div class="card-body">
                <div class="row mb-2">
                    <div class="col-sm-4">
                        <a href="{{url('admin/topups/create')}}" class="btn btn-success mb-2"><i class="mdi mdi-plus-circle mr-2"></i> Add Top Up</a>
                    </div>
                </div>

                <div class="table-responsive">
                    <table class="table table-centered table-borderless table-hover w-100 dt-responsive nowrap" id="products-datatable">
                        <thead class="thead-light">
                            <tr>
                                <th>Organisation Name</th>
                                <th>Balance Before Topup</th>
                                <th>Amount</th>
                                <th>Payment Method</th>
                                <th>Status</th>
                                <th>Admin Name</th>
                                <th>Date Created</th>
                            </tr>
                        </thead>
                        <tbody>

                            @forelse ($topups as $topup)
                            <tr>
                                <td class="table-user"><a href="javascript:void(0);" class="text-body font-weight-semibold">{{ $topup->orgInfo->name }}</a></td>
                                <td><span class="font-weight-semibold">K {{ $topup->current_balance }}</span></td>
                                <td><span class="font-weight-semibold">K {{ $topup->amount }}</span></td>
                                <td><span class="font-weight-semibold">{{ $topup->payment_method }}</span></td>
                                <td><span class="font-weight-semibold">{{ $topup->status }}</span></td>
                                <td><a href="javascript:void(0);" class="text-body font-weight-semibold"> {{ $topup->userInfo->name }}</a></td>
                                <td>{{ Carbon\Carbon::parse($topup->created_at)->format('F dS Y') }}</td>
                            </tr>
                            @empty
                            <td colspan="6">No Data</td>
                            @endforelse
                        </tbody>
                    </table>
                    {{ $topups->links() }}
                </div>
            </div> <!-- end card-body-->
        </div> <!-- end card-->
    </div> <!-- end col -->
</div>
<!-- end row -->

@endsection


@section('page-js')

@endsection