@extends('admin')
@section('contentData')
    @if (session()->has('message-fail'))
        <div class="alert alert-warning">
            {{ session('message-fail') }}
        </div>
    @endif

    <div class="container">
        <div class="row" style="width: 650px;">
            <div class="card" style="width: 600px;">
                <div class="card-header">Editace pravidla: {{$dataC->idemails_notify}}</div>
                <div class="card-body">
                    <form method="POST" action="{{ route('emails-edit',$dataC->idemails_notify)}}">
                        @csrf

                        <div class="form-group row">
                            <label for="id_user" class="col-md-4 col-form-label text-md-right">{{ __('Pro uživatele: ') }}</label>
                            <div class="col-md-6">
                                <label for="user"></label><select id="user" name="komu">
                                    @foreach(\App\User::all() as $poradi => $data)
                                        @if($data->id == $dataC->komu)
                                            <option id="{{$data->id}}" value="{{$data->id}}" selected>{{$data->name}} ({{$data->id}})</option>
                                        @else
                                            <option id="{{$data->id}}" value="{{$data->id}}">{{$data->name}} ({{$data->id}})</option>
                                        @endif
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="id_stanice" class="col-md-4 col-form-label text-md-right">{{ __('Čidlo: ') }}</label>
                            <div class="col-md-6">
                                <label for="stanice"></label><select id="stanice" name="id_stanice">
                                    @foreach(\App\Stanice::getStaniceProWu() as $poradi => $data)
                                        @if($data->idStanice == $dataC->id_stanice)
                                            <option id="{{$data->idStanice}}" value="{{$data->idStanice}}" selected>{{$data->nazev}} ({{$data->idStanice}})</option>
                                        @else
                                            <option id="{{$data->idStanice}}" value="{{$data->idStanice}}">{{$data->nazev}} ({{$data->idStanice}})</option>
                                        @endif
                                    @endforeach
                                </select>
                            </div>
                        </div>
                        <div class="form-group row">
                            <label for="delka_odezvy_v_minutach" class="col-md-4 col-form-label text-md-right">{{ __('Informovat po (min)') }}</label>

                            <div class="col-md-6">
                                <input id="delka_odezvy_v_minutach" type="text" class="form-control" name="delka_odezvy_v_minutach" value="{{ old('delka_odezvy_v_minutach') ?? $dataC->delka_odezvy_v_minutach }}">
                            </div>
                        </div>

                        <div class="form-group row mb-0">
                            <div class="col-md-6 offset-md-4">
                                <button type="submit" class="btn btn-primary">
                                    {{ __('Uložit') }}
                                </button>
                            </div>
                        </div>
                    </form>
                </div>
            </div>
        </div>
    </div>
@endsection
