@extends('base.base')
@section('base')
    <!-- 内容区域 -->
    <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-wrench"></i>
              </span>
                    {{ __('auto.邮件列表') }}
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">{{ __('auto.邮件管理') }}</a></li>
                        <li class="breadcrumb-item active" aria-current="page">{{ __('auto.邮件列表') }}</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">{{ __('auto.邮件列表') }}</h4>
                            <form class="well form-inline margin-top-20" method="get" action='/admin/mail/list'>
                                <select class="form-control" name="type" value="{{$type}}" style="color: black">
                                    @foreach($type_list as $k=>$v)
                                        <option value="{{$k}}" @if($k==$type) selected @endif>{{$v}}</option>
                                    @endforeach
                                </select>
                                <spen style="padding-left: 10px" >{{ __('auto.会员ID：') }}</spen>
                                <input class="form-control" type="text" name="GameID" id="GameID" value="{{$GameID}}" >

                                <spen style="padding-left: 10px" >{{ __('auto.额度查询：') }}</spen>
                                <input class="form-control" type="text" name="amount" id="GameID" value="{{$amount}}" >
                                <spen style="padding-left: 10px" >{{ __('auto.额度筛选：') }}</spen>
                                <select class="form-control" name="amount_search" value="" style="color: black">
                                    <option value="">{{ __('auto.全部') }}</option>

                                    <option value="100" @if ($amount_search == 100)
                                    selected
                                        @endif>100{{ __('auto.以下（不含100）') }}</option>

                                    <option value="500" @if ($amount_search == 500)
                                    selected
                                        @endif>100-500（{{ __('auto.含500）') }}</option>

                                    <option value="1000" @if ($amount_search == 1000)
                                    selected
                                        @endif>500-1000({{ __('auto.含1000）') }}</option>

                                    <option value="1001" @if ($amount_search == 1001)
                                    selected
                                        @endif>1000{{ __('auto.以上（不含') }}1000)</option>
                                </select>

                                <input type="submit" class="btn btn-sm btn-gradient-dark btn-icon-text" value="{{ __('auto.搜索') }}" />&nbsp;&nbsp;
                                <a href="/admin/mail/list" class="btn btn-sm btn-gradient-warning btn-icon-text">{{ __('auto.清空') }}</a>&nbsp;&nbsp;
                                <button type="button" class="btn btn-sm btn-gradient-dark btn-icon-text" onclick="mail()">{{ __('auto.发送邮件') }}</button>
                            </form>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>{{ __('auto.时间') }}</th>
                                    <th>{{ __('auto.邮件方式') }}</th>
                                    <th>{{ __('auto.收件人') }}ID</th>
                                    <th>{{ __('auto.标题') }}</th>
                                    <th>{{ __('auto.附件内容') }}</th>
                                    <th>{{ __('auto.文本内容') }}</th>
                                    <th>{{ __('auto.领取状态') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td style="width: 10%">{{ date('Y-m-d H:i:s',strtotime($v->CreateTime)) }}</td>
                                        <td style="width: 5%">@if($type==1){{ __('auto.系统@else私人') }}@endif</td>
                                        <td style="width: 5%">@if(isset($v->GameID)){{ $v->GameID }}@else @endif</td>
                                        <td style="width: 15%">{{ $v->TitleString}}</td>
                                        <td style="width: 10%">{{ $v->BonusString}}</td>
                                        <td style="width: 35%">{{ $v->TextString}}</td>
                                        <td style="width: 35%">{{ ['','','', __('auto.已领取') , __('auto.已删除')][$v->MailStatus]}}</td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            <div class="box-footer clearfix">
                                {{ __('auto.总共') }} <b>{{ $list->appends(["type"=>$type,'GameID'=>$GameID,'amount' => $amount,'amount_search' => $amount_search,'startTime' => $startTime, 'endTime' => $endTime,'admin_type' => $admin_type])->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
                                {!! $list->links() !!}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function mail(id){
            var page = layer.open({
                type: 2,
                title: '{{ __('auto.新增邮件') }}',
                shadeClose: true,
                shade: 0.8,
                area: ['70%', '90%'],
                content: '/admin/mail/add'
            });
        }
    </script>
@endsection
