@extends('base.base')
@section('base')
    <!-- Content Area -->
    <div class="main-panel">
        <div class="content-wrapper">
            <div class="page-header">
                <h3 class="page-title">
                     <span class="page-title-icon bg-gradient-primary text-white mr-2">
                        <i class="mdi mdi-file-document"></i>
                    </span>
                    Client Log
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">Log Management</a></li>
                        <li class="breadcrumb-item active" aria-current="page">Client Log</li>
                    </ol>
                </nav>
            </div>
            <div class="row">
                <div class="col-lg-12 grid-margin stretch-card">
                    <div class="card">
                        <div class="card-body">
                            <h4 class="card-title">Client Log List</h4>
                            <form class="well form-inline margin-top-20" method="get" action='/admin/client_log'>
                                <div>
                                    <span style="padding-left: 10px">Log Type:</span>
                                    <select class="form-control" name="log_type" style="color: black">
                                        <option value="">All</option>
                                        <option value="register" @if($log_type == 'register') selected @endif>Register</option>
                                        <option value="pay" @if($log_type == 'pay') selected @endif>Pay</option>
                                    </select>
                                    <span style="padding-left: 10px">Date:</span>
                                    <input type="date" name="log_date" class="form-control" value="{{$log_date}}" />
                                    <span style="padding-left: 10px">Channel:</span>
                                    <input class="form-control" type="text" name="Channel" style="width: 10%;" value="{{$Channel}}" placeholder="Channel">
                                </div>
                                <div style="margin-top: 10px;">
                                    <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="Search"/>&nbsp;&nbsp;
                                    <a href="/admin/client_log" class="btn btn-sm btn-gradient-warning btn-icon-text">Clear</a>
                                </div>
                            </form>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>Log Type</th>
                                    <th>UserID</th>
                                    <th>Channel</th>
                                    <th>Campaign ID</th>
                                    <th>Ad ID</th>
                                    <th>Pixel</th>
                                    <th>Pixel ID</th>
                                    <th>Log Date</th>
                                    <th>Created At</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td>{{ $v->id }}</td>
                                        <td>{{ $v->log_type }}</td>
                                        <td>{{ $v->userID ?? '-' }}</td>
                                        <td>{{ $v->Channel ?? '-' }}</td>
                                        <td>{{ $v->campaign_id ?? '-' }}</td>
                                        <td>{{ $v->ad_id ?? '-' }}</td>
                                        <td>{{ $v->pixel ?? '-' }}</td>
                                        <td>{{ $v->pixelID ?? '-' }}</td>
                                        <td>{{ $v->log_date }}</td>
                                        <td>{{ $v->created_at }}</td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            <div class="box-footer clearfix">
                                Total <b>{{ $list->appends(['log_type'=>$log_type,'log_date'=>$log_date,'Channel'=>$Channel])->total() }}</b> records, divided into <b>{{ $list->lastPage() }}</b> pages
                                {!! $list->links() !!}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
