@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">Nastavení pravidla pro upozornění</div>
                <div class="card-body">
                    <form method="POST" action="{{ route('emails-add') }}">
                        @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)
                                        <option id="{{$data->id}}" value="{{$data->id}}">{{$data->name}} ({{$data->id}})</option>
                                    @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)
                                        <option id="{{$data->idStanice}}" value="{{$data->idStanice}}">{{$data->nazev}} ({{$data->idStanice}})</option>
                                    @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') ?? $data->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
