@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í veličin</h2>
    <div style=' width: 850px; 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('velicina-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 veličinu"/>
        </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" class="p-2 ">Název veličiny</th>
                <th scope="col" class="p-2">Jednota</th>
                <th scope="col" class="p-2">Poznámka</th>
                <th scope="col" style="width: 20px;" class="nosort"> </th>
                <th scope="col" style="width: 20px;" class="nosort"> </th>
            </tr>
            </thead>
            @foreach(\App\NazvosloviVelicin::getDataNazvoslovi() 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->idnazvoslovi_veliciny}}</th>
                    <td>{{$data->nazev}}</td>
                    <td>{{$data->jednotka}}</td>
                    <td>{{$data->poznamka}}</td>
                    <td style="width: 20px;" class="p-1 pb-2"> @if(!in_array($data->idnazvoslovi_veliciny,\App\Http\Controllers\VelicinyController::DEFAULT)) <a href="{{ route('velicina-edit',$data->idnazvoslovi_veliciny) }}"> <img src="{{URL::asset('/resources/images/btn-edit.png')}}" alt="Edit"/></a> @endif</td>
                    <td style="width: 20px;"> @if(!in_array($data->idnazvoslovi_veliciny,\App\Http\Controllers\VelicinyController::DEFAULT)) <a href="{{ route('velicina-delete',$data->idnazvoslovi_veliciny) }}"> <img src="{{URL::asset('/resources/images/btn-delete.png')}}" alt="Smazat"/></a> @endif</td>
                </tr>
            @endforeach
        </table>
    </div>
@endsection
