@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-gift"></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>
                            <table class="table table-bordered">
                                <thead>
                                <tr>
                                    <th width="20%">{{ __('auto.签到天数') }}</th>
                                    <th width="20%">{{ __('auto.奖励积分(单位:分)') }}</th>
                                    <th width="30%">{{ __('auto.操作') }}</th>
                                </tr>
                                </thead>
                                <tbody>
                                @forelse($list as $item)
                                    <tr>
                                        <td>第 {{ $item->DayNumber }} 天</td>
                                        <td>{{ $item->RewardScore }}</td>
                                        <td>
                                            <button type="button" class="btn btn-sm btn-gradient-dark btn-icon-text" onclick="update({{ $item->DayNumber }})">
                                                {{ __('auto.修改') }}
                                                <i class="mdi mdi-file-check btn-icon-append"></i>
                                            </button>
                                        </td>
                                    </tr>
                                @empty
                                    <tr>
                                        <td colspan="3" class="text-center">{{ __('auto.暂无数据') }}</td>
                                    </tr>
                                @endforelse
                                </tbody>
                            </table>
                            <div class="box-footer clearfix">
                                @if($list->total() > 0)
                                    {{ __('auto.总共') }} <b>{{ $list->total() }}</b> {{ __('auto.条,分为') }}<b>{{ $list->lastPage() }}</b>{{ __('auto.页') }}
                                    {!! $list->links() !!}
                                @endif
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <script>
        function update(dayNumber){
            var page = layer.open({
                type: 2,
                title: '{{ __('auto.修改签到奖励配置') }}',
                shadeClose: true,
                shade: 0.8,
                area: ['50%', '70%'],
                content: '/admin/sign-in-reward/update/' + dayNumber
            });
        }
    </script>
@endsection
