{{ csrf_field() }}
<div class="box box-primary">
    <div class="box-header with-border">
        <h3 class="box-title"></h3>
    </div>

    <div class="box-body">
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label for="name">Nome:</label>
                    <input type="text" name="name" id="name" class="form-control title"
                           value="{{ old('name', isset($category) ? $category->name : '') }}"
                           required>
                </div>
            </div>
            <div class="col-md-6">
                <div class="form-group">
                    <label for="type">Tipologia:</label>
                    <select name="type" id="type" class="form-control" required>
                        <option value="">Seleziona tipologia</option>
                        <option value="nation" {{ old('type', isset($category) ? $category->type : '') == 'nation' ? 'selected' : '' }}>Nazionale</option>
                        <option value="region" {{ old('type', isset($category) ? $category->type : '') == 'region' ? 'selected' : '' }}>Regionale</option>
                    </select>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-md-6">
                <div class="form-group">
                    <label for="grp">Raggruppamento:</label>
                    <input type="text" name="grp" id="grp" class="form-control"
                           value="{{ old('grp', isset($category) ? $category->grp : '') }}">
                </div>
            </div>
        </div>
        <input name="position" type="hidden" value="{{isset($category) ? $category->position : '0'}}">
    </div>

    <div class="box-footer">
        @if(Auth::user()->only_read == false)
            <button type="submit" class="btn btn-success">{{ $submit_text }}</button>
        @endif
        <a href="{{ route('categories.index') }}" class="btn btn-info">Annulla</a>
    </div>
</div>
