@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-chart-line"></i>
                    </span>
                    支付通道成功率
                </h3>
                <nav aria-label="breadcrumb">
                    <ol class="breadcrumb">
                        <li class="breadcrumb-item"><a href="#">充值管理</a></li>
                        <li class="breadcrumb-item active" aria-current="page">支付通道成功率</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">支付通道成功率（近4日）</h4>
                            <div class="table-responsive">
                                <table class="table table-bordered table-hover">
                                    <thead>
                                    <tr class="bg-gradient-primary text-white">
                                        <th style="min-width: 180px">支付通道</th>
                                        @foreach($dateLabels as $label)
                                            <th style="min-width: 200px">{{ $label }}</th>
                                        @endforeach
                                    </tr>
                                    </thead>
                                    <tbody>
                                    @forelse($list as $item)
                                        <tr>
                                            <td><strong>{{ $item['channel_name'] }}</strong></td>
                                            @foreach($item['days'] as $day)
                                                <td>
                                                    @if($day['total'] > 0)
                                                        <span class="text-primary" style="font-weight: bold; font-size: 15px;">{{ $day['rate'] }}%</span>
                                                        <small class="text-muted">({{ $day['success'] }}/{{ $day['total'] }})</small>
                                                        @if($day['rate'] < 50)
                                                            <span class="badge badge-danger">低</span>
                                                        @elseif($day['rate'] < 80)
                                                            <span class="badge badge-warning">中</span>
                                                        @else
                                                            <span class="badge badge-success">高</span>
                                                        @endif
                                                    @else
                                                        <span class="text-muted">-</span>
                                                    @endif
                                                </td>
                                            @endforeach
                                        </tr>
                                    @empty
                                        <tr>
                                            <td colspan="4" class="text-center text-muted">暂无数据</td>
                                        </tr>
                                    @endforelse
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
@endsection
