@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>
                            <button type="button" class="btn btn-sm btn-gradient-dark btn-icon-text" onclick="gamd_card()">{{ __('auto.新增兑换码配置') }}</button>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th>{{ __('auto.兑换码') }}ID</th>
                                    <th>{{ __('auto.兑换码价格') }}</th>
                                    <th>{{ __('auto.金豆数量') }}</th>
                                    <th>{{ __('auto.操作') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @foreach($list as $k=>$v)
                                    <tr>
                                        <td style="width: 15%">{{ $v->GameCardID}}</td>
                                        <td style="width: 10%">{{ $v->Price}}</td>
                                        <td style="width: 35%">{{ $v->Amount}}</td>
                                        <td style="width: 35%">
                                            <button type="button" class="btn btn-sm btn-gradient-danger btn-icon-text" onclick="del({{ $v->ID }})">
                                                {{ __('auto.删除') }}
                                            </button>
                                        </td>
                                    </tr>
                                @endforeach
                                </tbody>
                            </table>
                            <div class="box-footer clearfix">
                                {{ __('auto.总共') }} <b>{{ $list->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
                                {!! $list->links() !!}
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        function gamd_card(id){
            var page = layer.open({
                type: 2,
                title: '{{ __('auto.新增兑换码配置') }}',
                shadeClose: true,
                shade: 0.8,
                area: ['70%', '90%'],
                content: '/admin/recharge/game_card_config_add'
            });
        }
        function del(id){
            myConfirm("{{ __('auto.删除操作不可逆,是否继续') }}?",function(){
                myRequest("/admin/recharge/game_card_config_del/"+id,"post",{},function(res){
                    layer.msg(res.msg)
                    setTimeout(function(){
                        window.location.reload();
                    },1500)
                });
            });
        }
    </script>
@endsection
