@extends('backend.layouts.main')
@section('panel')
<div class="row">
    @if (Route::is('admin.website.provider.edit'))
    <div class="col-lg-4 mb-3">
        <div class="card">
            <div class="card-body">
                <h4 class="card-title">Input Banner</h4>
                <form class="form p-t-20" enctype="multipart/form-data" action="{{ route('admin.website.provider.update',$providers->id) }}"
                    method="POST">
                    @csrf
                    <div class="form-group">
                        <label>Gambar (Opsional Jika Ingin Mengubahnya)</label>
                        <img class="input-group mb-3" style="width: 100px" src="{{ $providers->banner }}">
                        <div class="input-group mb-3">
                            <input type="url" value="{{ $providers->banner }}" class="form-control" name="file">
                        </div>
                    </div>
                    <div class="form-group">
                        <label>Nama</label>
                        <div class="input-group mb-3">
                            <input type="text" class="form-control" name="provider" required="" value="{{ $providers->provider }}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label>Slug</label>
                        <div class="input-group mb-3">
                            <input type="url" class="form-control" name="slug" required="" value="{{ $providers->slug }}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label>Code</label>
                        <div class="input-group mb-3">
                            <input type="url" class="form-control" name="provider_code" required="" value="{{ $providers->provider_code }}">
                        </div>
                    </div>
                    <div class="form-group">
                        <label>Type</label>
                        <div class="input-group mb-3">
                            <input type="url" class="form-control" name="type" required=""value="{{ $providers->type }}">
                        </div>
                    </div>
                    <button type="submit" class="btn btn-primary m-r-10" name="upload">Submit</button>
                </form>
            </div>
        </div>
    </div>
    @else
    <div class="col-lg-4 mb-3">
        <div class="card">
            <div class="card-body">
                <h4 class="card-title">Select Provider</h4>
                <form class="form p-t-20" enctype="multipart/form-data" action="{{ route('admin.website.games.show') }}"
                    method="POST">
                    @csrf
                    <div class="form-group mb-3">
                        <label class="form-label">Provider :</label>
                        <select id="provider" name="provider" class="form-control select2" required>
                            <option value=""> Select Provider </option>
                            @foreach ($provider as $mem)
                            <option value="{{ $mem->slug }}"> {{ $mem->provider_name }} ( {{ $mem->game_type }} )
                            </option>
                            @endforeach
                        </select>
                    </div>
                    <button type="submit" class="btn btn-primary m-r-10" name="upload">Submit</button>
                </form>
            </div>
        </div>
    </div>
    @endif
    <div class="col-lg-8 mb-3">
        <div class="card">
            <div class="card-datatable table-responsive">
                <table id="default-datatable" class="table table-bordered table-sm">
                    <thead>
                        <tr>
                            <th class="text-center" style="vertical-align: middle;">#</th>
                            <th class="text-center" style="vertical-align: middle;">Banner</th>
                            <th class="text-center" style="vertical-align: middle;">Provider</th>
                            <th class="text-center" style="vertical-align: middle;">Nama</th>
                            <th class="text-center" style="vertical-align: middle;">Slug</th>
                            <th class="text-center" style="vertical-align: middle;">Code</th>
                            <th class="text-center" style="vertical-align: middle;">Type</th>
                            <th class="text-center" style="vertical-align: middle;">Status</th
                        </tr>
                    </thead>
                    @if (empty($games))
                    @else
                    <tbody>
                        @foreach ($games as $item)
                        <tr>
                            <th class="text-center" style="vertical-align: middle; font-size: 13px;">
                                {{ $loop->iteration }}
                            </th>
                            <td class="text-center" style="vertical-align: middle; white-space: normal; font-size: 13px;">
                                <img class="container-fluid" style="width: 100px;" src="{{ $item->game_image }}">
                            </td>
                            <td class="text-center"
                                style="vertical-align: middle; white-space: normal; font-size: 13px;">
                                {{ $item->provider_code }}
                            </td>
                            <td class="text-center"
                                style="vertical-align: middle; white-space: normal; font-size: 13px;">
                                {{ $item->game_name }}
                            </td>
                            <td class="text-center"
                                style="vertical-align: middle; white-space: normal; font-size: 13px;">
                                {{ $item->provider }}
                            </td>
                            <td class="text-center"
                                style="vertical-align: middle; white-space: normal; font-size: 13px;">
                                {{ $item->game_code }}
                            </td>
                            <td class="text-center"
                                style="vertical-align: middle; white-space: normal; font-size: 13px;">
                                {{ $item->game_type }}
                            </td>
                            <td class="text-center"
                                style="vertical-align: middle; white-space: normal; font-size: 13px;">
                                @if($item->status == 1)
                                Aktif
                                @else
                                Tidak Aktif
                                @endif
                            </td>
                        </tr>
                        @endforeach
                    </tbody>
                    @endif
                </table>
            </div>
        </div>
    </div>
</div>
@endsection
