modal.blade.php 3.6 KB
<style>

</style>
<div  id="pagination-ajax-box" class="card-body table-responsive no-padding">
    <table class="table table-hover">
        <thead>
        <tr>
            <th>#</th>
            @foreach($columns as $column)
                <th class="{{ Arr::get($column, 'class') }}">{{$column['name']}}</th>
            @endforeach
        </tr>
        </thead>

        <tbody>
        @if(!$items)
            <tr>
                <td colspan="{{ count($columns) + 1}}" style="padding: 100px;text-align: center;color: #999999">
                    <svg t="1562312016538" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg"
                         p-id="2076" width="128" height="128" style="fill: #e9e9e9;">
                        <path d="M512.8 198.5c12.2 0 22-9.8 22-22v-90c0-12.2-9.8-22-22-22s-22 9.8-22 22v90c0 12.2 9.9 22 22 22zM307 247.8c8.6 8.6 22.5 8.6 31.1 0 8.6-8.6 8.6-22.5 0-31.1L274.5 153c-8.6-8.6-22.5-8.6-31.1 0-8.6 8.6-8.6 22.5 0 31.1l63.6 63.7zM683.9 247.8c8.6 8.6 22.5 8.6 31.1 0l63.6-63.6c8.6-8.6 8.6-22.5 0-31.1-8.6-8.6-22.5-8.6-31.1 0l-63.6 63.6c-8.6 8.6-8.6 22.5 0 31.1zM927 679.9l-53.9-234.2c-2.8-9.9-4.9-20-6.9-30.1-3.7-18.2-19.9-31.9-39.2-31.9H197c-19.9 0-36.4 14.5-39.5 33.5-1 6.3-2.2 12.5-3.9 18.7L97 679.9v239.6c0 22.1 17.9 40 40 40h750c22.1 0 40-17.9 40-40V679.9z m-315-40c0 55.2-44.8 100-100 100s-100-44.8-100-100H149.6l42.5-193.3c2.4-8.5 3.8-16.7 4.8-22.9h630c2.2 11 4.5 21.8 7.6 32.7l39.8 183.5H612z"
                              p-id="2077"></path>
                    </svg>
                </td>
            </tr>
        @else
            @php
                $page = request('page', 1);
            @endphp
            @foreach($items as $key => $row)
                <tr>
                    <td>{{$key+1 + 10 * ($page-1)}}</td>
                    @foreach($columns as $column)
                        @php
                            $field = Arr::get($column, 'field');
                            $value = Arr::get($row, $field);
                            $type = Arr::get($column, 'type');
                            $url = str_replace('__USER_ID__', Arr::get($row, 'id'), Arr::get($column, 'url'));
                        @endphp
                        <td>
                            <!-- 如果是有关联 -->
                            @if ($relation = Arr::get($column, 'relation'))
                                @if(is_array($row))
                                    @php
                                        $value = Arr::get($row, "$relation.$field", '--');
                                    @endphp
                                @else
                                    @php
                                        $value = optional(optional($row)->$relation)->$field ? : '--';
                                    @endphp
                                @endif
                            @endif

                            @if ($url)
                                <a href="{{$url}}" class="btn grid-row-edit" style="border: 0!important;color: #0B61A4!important;padding:0!important;">{!! $value !!}</a>
                            @else
                                @if($type === 'image')
                                    <img src="{{ splice_file_path($value) }}"  style="width: 60px!important;" />
                                @else
                                    {!! $value !!}
                                @endif
                            @endif
                        </td>
                    @endforeach
                </tr>
            @endforeach
        @endif
        </tbody>
    </table>
    @include('admin::pagination-ajax')
</div>