@extends('admin')
@section('contentData')
    @if (session()->has('message'))
        <div class="alert alert-success">
            {{ session('message') }}
        </div>
    @endif
    @if (session()->has('message-fail'))
        <div class="alert alert-warning">
            {{ session('message-fail') }}
        </div>
    @endif
    <h2 style="color: #0095fe; font-family: Calibri,serif;">Nastavení automatického banování čidel</h2>
    <div style=' width: 700px; padding: 40px;background-image: url("{{URL::asset('/resources/images/bg-top1.png')}}"); background-repeat:no-repeat; background-size: 10px 100%; border-radius: 10px; background-color: whitesmoke;'>
        <a href="{{ route('ban-add') }}">
            <input type="button" style="width: 170px; height: 37px; background-color: darkorange; border: 0 darkorange; font-size: 20px; font-family: Calibri,serif; margin-bottom: 15px; color: whitesmoke; border-radius: 5px;" value="Přidat pravidlo"/>
        </a>
        <table width="100%" id="table">
            <thead style='background-image: url("{{URL::asset('/resources/images/bg-top1.png')}}"); background-repeat:no-repeat; background-size: 100%; color: white;'>
            <tr>
                <th scope="col" style="padding-left: 10px; width: 30px;">ID</th>
                <th scope="col">Čidlo</th>
                <th scope="col">Počet zpráv</th>
                <th scope="col">Za počet minut</th>
                <th scope="col" style="width: 20px;" class="nosort"> </th>
                <th scope="col" style="width: 20px;" class="nosort"> </th>
            </tr>
            </thead>
            @foreach(\App\AutomatickeBanovani::all() as $id => $data)
                @php
                    if ($id%2 == 1)
                    {
                      $rowColor = "#e5e5e5";
                    }
                    else
                    {
                        $rowColor = "whitesmoke";
                    }
                @endphp
                <tr style="background-color: {{$rowColor}};">
                    <th scope="row" style="padding-left: 10px;">{{$data->idban_automat}}</th>
                    <td>{{$data->id_stanice}}</td>
                    <td>{{$data->pocet_zprav}}</td>
                    <td>{{$data->pocet_minut}}</td>
                    <td style="width: 20px;"> <a href="{{ route('ban-edit',$data->idban_automat)}}"> <img src="{{URL::asset('/resources/images/btn-edit.png')}}" alt="Edit"/></a></td>
                    <td style="width: 20px;"><a href="{{ route('ban-delete',$data->idban_automat)}}"> <img src="{{URL::asset('/resources/images/btn-delete.png')}}" alt="Smazat"/></a></td>
                </tr>
            @endforeach
        </table>
    </div>
@endsection
