@extends('admin')
@section('contentData')
    @if (session()->has('message'))
        <div class="alert alert-success">
            {{ session('message') }}
        </div>
    @endif
    <h2 style="color: #0095fe; font-family: Calibri,serif;">Nastavení exportu na Weather Underground</h2>
    <div class="alert-info p-2 mb-3" style="width: 900px; border-radius: 5px; border: 1px rgba(142,194,236,0.65) solid; font-family: Calibri,serif; color: #1b1e21; font-size: 17px;">
        Je nutná registrace na portálu <a href="https://www.wunderground.com/" target="_blank">https://www.wunderground.com/</a> a poté zde přidat přihlašovací údaje k jednotlivým stanicím.
    </div>
    <div style=' width: 900px; 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('nastaveniWu-add') }}">
            <input type="button" style="width: 150px; 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 čidlo"/>
        </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">ID stanice</th>
                <th scope="col">ID WU stanice</th>
                <th scope="col">Heslo</th>
                <th scope="col">Poslední export</th>
                <th scope="col" class="nosort">Odkaz</th>
                <th scope="col" style="width: 20px;" class="nosort"> </th>
                <th scope="col" style="width: 20px;" class="nosort"> </th>
                <th scope="col" style="width: 20px;" class="nosort"> </th>
            </tr>
            </thead>
            @foreach($dataC 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->idwu_definice_pristupu}}</th>
                    <td>{{$data->id_stanice}}</td>
                    <td>{{$data->id_wu_station}}</td>
                    <td>{{$data->pass}}</td>
                    <td>{{$data->last_export}}</td>
                    <td><a href="https://www.wunderground.com/dashboard/pws/{{$data->id_wu_station}}" target="_blank">Link</a></td>
                    <td><a  href="{{ route('nastaveniWu-export',$data->id_stanice) }}"> <img src="{{URL::asset('/resources/images/btn-export.png')}}" alt="export"/></a></td>
                    <td style="width: 20px;"> <a href="{{ route('nastaveniWu-edit',$data) }}"> <img src="{{URL::asset('/resources/images/btn-edit.png')}}" alt="Edit"/></a></td>
                    <td style="width: 20px;"><a href="{{ route('nastaveniWu-delete',$data->idwu_definice_pristupu) }}"> <img src="{{URL::asset('/resources/images/btn-delete.png')}}" alt="Smazat"/></a></td>
                </tr>
            @endforeach
        </table>
    </div>
@endsection
