@extends('admin.layouts.main-layout')

@section('content')

<style>
    .page-title {
        font-size: 38px;
        font-weight: 300;
        color: #555;
        margin-bottom: 30px;
        text-transform: uppercase;
    }

    .report-box {
        background: #fff;
        border: 1px solid #e5e5e5;
        border-top: 3px solid #dfe6e9;
        margin-bottom: 30px;
        box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    }

    .report-header {
        padding: 20px;
        border-bottom: 1px solid #eee;
        font-size: 20px;
        font-weight: 700;
        color: #666;
    }

    .report-body {
        padding: 25px;
    }

    .report-table {
        width: 100%;
    }

    .report-table th {
        color: #666;
        font-size: 16px;
        padding-bottom: 15px;
        border-bottom: 1px solid #ddd;
    }

    .report-table td {
        padding-top: 15px;
        font-size: 18px;
        font-weight: 600;
        color: #444;
    }

    .icon-right {
        float: right;
        color: #bbb;
    }

    @media(max-width:768px){

        .page-title{
            font-size: 28px;
        }

        .report-header{
            font-size: 18px;
        }

        .report-body{
            padding: 20px;
        }
    }
</style>

<div class="container-fluid">

    <div class="row">
        <div class="col-md-12">
            
        <!--     <form action="" method="GET">-->

        <!--        <div class="row">-->
    
        <!--            <div class="col-md-4 mb-3">-->
        <!--                <label><strong>User</strong>(optional)</label>-->
        <!--                <select name="user_id" class="form-control select2">-->
        <!--                    <option value="">Select User</option>-->
    
        <!--                    @foreach($users as $game)-->
        <!--                        <option value="{{ $game->id }}">-->
        <!--                            {{ $game->name }} ({{$game->mobile_number}})-->
        <!--                        </option>-->
        <!--                    @endforeach-->
        <!--                </select>-->
        <!--            </div>-->
                    
        <!--            <div class="col-md-12 mt-2">-->
        <!--                <button type="submit" class="btn btn-primary px-4">-->
        <!--                    Apply Filters-->
        <!--                </button>-->
        <!--            </div>-->
    
    
        <!--        </div>-->
        <!--</form>-->

            <h1 class="page-title">COLLECTION REPORT</h1>

        </div>
    </div>

    <div class="row">

        <div class="col-md-4">

            <div class="report-box">

                <div class="report-header">
                    PAYMENT RECEIVING FROM (Lena He)

                    <!--<i class="fa fa-wrench icon-right"></i>-->
                    
                </div>

                <div class="report-body">

                    <table class="report-table">

                        <thead>
                            <tr>
                                <th>Client</th>
                                <th>Balance</th>
                            </tr>
                        </thead>

                        <tbody>
                            @foreach($lenaLists as $value)
                             <tr>
                                <td>{{$value['client']->name}} <sub>({{ strtoupper(substr($value['client']->type, 0, 1)) }})</sub></td>
                                <td>{{$value['amount']}}</td>
                                <td>
                                    <form method="POST" action="{{ url('admin/settlement') }}"
                                          onsubmit="return confirm('Are you sure you want to settle this amount?')">
                                        
                                        @csrf
                                    
                                        <input type="hidden" name="user_id" value="{{ $value['client']->id }}" />
                                    
                                        <button class="btn btn-sm btn-success icon-right"
                                                name="type"
                                                value="lena">
                                            Settle
                                        </button>
                                    
                                    </form>
                                </td>
                             </tr>
                            @endforeach
                            <tr>
                                <td>Total</td>
                                <td>{{$lenaAmount}}</td>
                            </tr>
                        </tbody>

                    </table>

                </div>

            </div>

        </div>

        <div class="col-md-4">

            <div class="report-box">

                <div class="report-header">
                    PAYMENT PAID TO (Dena He)

                    <!--<i class="fa fa-wrench icon-right"></i>-->
                    
                </div>

                <div class="report-body">

                    <table class="report-table">

                        <thead>
                            <tr>
                                <th>Client</th>
                                <th>Balance</th>
                            </tr>
                        </thead>

                        <tbody>
                             @foreach($denaLists as $value)
                             <tr>
                                <td>{{$value['client']->name}} <sub>({{ strtoupper(substr($value['client']->type, 0, 1)) }})</sub></td>
                                <td>{{$value['amount']}}</td>
                                <td>
                                    <form method="POST" action="{{ url('admin/settlement') }}"
                                          onsubmit="return confirm('Are you sure you want to settle this amount?')">
                                        
                                        @csrf
                                    
                                        <input type="hidden" name="user_id" value="{{ $value['client']->id }}" />
                                    
                                        <button class="btn btn-sm btn-success icon-right"
                                                name="type"
                                                value="dena">
                                            Settle
                                        </button>
                                    
                                    </form>
                                </td>
                             </tr>
                            @endforeach
                            <tr>
                                <td>Total</td>
                                <td>{{$denaAmount}}</td>
                            </tr>
                        </tbody>

                    </table>

                </div>

            </div>

        </div>

        <div class="col-md-4">

            <div class="report-box">

                <div class="report-header">
                    PAYMENT CLEAR (Clear Hai)

                    <!--<i class="fa fa-wrench icon-right"></i>-->
                </div>

                <div class="report-body">

                    <table class="report-table">

                        <thead>
                            <tr>
                                <th>Client</th>
                                <th>Balance</th>
                            </tr>
                        </thead>

                        <tbody>
                             @foreach($clearedLists as $value)
                             <tr>
                                <td>{{$value['client']->name}} <sub>({{ strtoupper(substr($value['client']->type, 0, 1)) }})</sub></td>
                                <td>{{$value['amount']}}</td>
                                
                             </tr>
                            @endforeach
                            <tr>
                                <td>Total</td>
                                <td>{{$cleared}}</td>
                            </tr>
                        </tbody>

                    </table>

                </div>

            </div>

        </div>

    </div>
    
   
    

</div>

@endsection