@extends('layouts.main')
@section('title', 'Grobtechniken verwalten')
@section('headline', 'Grobtechniken verwalten')
@section('content')

    <div id="main-wrapper">
        <div class="row">
            <div class="col-md-12">
                {{--@if($alert == 'successDelete')
                    <div class="alert alert-success" role="alert">
                        Die Grobtechnik wurde erfolgreich gelöscht!
                    </div>
                @elseif($alert == 'errorDelete')
                    <div class="alert alert-danger" role="alert">
                        Beim Löschen der Grobtechnik ist ein Fehler aufgetreten!
                    </div>
                @elseif($alert == 'successCreate')
                    <div class="alert alert-success" role="alert">
                        Die Grobtechnik wurde erfolgreich angelegt!
                    </div>
                @elseif($alert == 'successUpdate')
                    <div class="alert alert-success" role="alert">
                        Die Grobtechnik wurde erfolgreich aktualisiert!
                    </div>
                @endif--}}
                <div class="panel panel-white">
                    {{--<div class="panel-heading clearfix">
                        <h4 class="panel-title">Benutzerübersicht</h4>
                    </div>--}}
                    <div class="panel-body">
                        <div class="table-responsive">
                            <div class="filter-container" id="filterContainer">
                                {!! Form::open(['action' => 'Medium\MediumCategoryOverviewController@index', 'class' => 'form-horizontal', 'id' => 'filterSourceTypesForm', 'method' => 'get', 'role' => 'form', 'files' => true]) !!}
                                    <input name="filtered" id="filtered" type="hidden" value="1">
                                    <input name="page" id="page" type="hidden" value="{{$page}}">
                                    <div id="pageLen" style="float: right; margin-left: 20px;">
                                        <input class="form-control" name="len" id="inputPageLen" type="text" max="999" maxlength="3" value="@if($pageLength){{$pageLength}}@else{{auth()->user()->table_page_length}}@endif" style="float: left; width: 50px;"> <label style="float: right; padding: 7px 5px 0;">Einträge anzeigen</label>
                                    </div>
                                {!! Form::close() !!}
                            </div>
                            <div class="button-line" id="buttonLine">
                                <a class="btn btn-primary" href="{{ route('create-medium-category') }}"><i class="menu-icon icon-plus"></i> Neue Grobtechnik</a>
                            </div>

                            {{$dataTable->table(['id' => 'data-table-medium-category'])}}

                            <script>
                                $(function() {
                                    $.ajaxSetup({
                                        headers: {
                                            'X-CSRF-TOKEN': '{{csrf_token()}}'
                                        }
                                    });

                                    var editor = new $.fn.dataTable.Editor({
                                        ajax: "/grobtechniken",
                                        table: "#data-table-medium-category",
                                        method: 'POST',
                                        //display: "bootstrap",
                                        idSrc:  'id',
                                        fields: [
                                            {label: "Name", name: "name"},
                                            //{label: "Domain", name: "url"}
                                        ]
                                    });

                                    $('#data-table-medium-category').on('click', 'tbody td:not(:first-child)', function (e) {
                                        editor.inline(this);
                                    });

                                    {{$dataTable->generateScripts()}}

                                })
                            </script>

                            {!! Form::open(['action' => 'Medium\MediumCategoryController@destroy', 'class' => 'form-horizontal', 'id' => 'deleteMediumCategoryForm', 'method' => 'post', 'role' => 'form', 'files' => true]) !!}
                                <input type="hidden" id="deleteMediumCategoryId" name="medium_category_id" value="">
                                <input type="hidden" id="deleteMediumCategoryPage" name="medium_category_page" value="">
                                <input type="hidden" id="deleteMediumCategoryLength" name="medium_category_length" value="">
                                <input type="hidden" id="deleteMediumCategorySortColumn" name="medium_category_sort_column" value="">
                                <input type="hidden" id="deleteMediumCategorySortDirection" name="medium_category_sort_direction" value="">
                            {!! Form::close() !!}
                        </div>
                    </div>

                    <p>* Spalte editierbar</p>
                </div>

            </div>
        </div><!-- Row -->
    </div><!-- Main Wrapper -->


@stop
