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

    <div id="main-wrapper">
        <div class="row">
            <div class="col-md-12">

                <div class="panel panel-white">
                    <div class="panel-heading clearfix">
                    </div>
                    <div class="panel-body">
                        <div class="table-responsive">
                            <div class="filter-container" id="filterContainer">

                            </div>
                            <div class="button-line" id="buttonLine">
                                <a class="btn btn-primary" href="{{ route('create-gender-lookup') }}"><i class="menu-icon icon-plus"></i> Neuer Vorname</a>
                            </div>

                            {!! Form::open(['action' => 'Simulator\ArtistSimulatorOverviewController@simulate', 'class' => 'form-horizontal', 'id' => 'artistSimulatorForm', 'method' => 'post', 'role' => 'form', 'files' => true]) !!}
                            <div class="panel-body" style="background: #eee; padding: 25px; margin-bottom: 25px;">
                                <div class="row">
                                    <div class="col-md-6">
                                        <div class="form-group {{ $errors->formErrors->has('bornDate') ? 'has-error' : '' }}">
                                            <label for="bornDate" class="col-sm-3 control-label">Geburtsdatum: </label>
                                            <div class="col-sm-9">
                                                <input name="bornDate" type="text" class="form-control" id="bornDate" value="{{ old('bornDate') }}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group {{ $errors->formErrors->has('diedDate') ? 'has-error' : '' }}">
                                            <label for="diedDate" class="col-sm-3 control-label">Sterbedatum:</label>
                                            <div class="col-sm-9">
                                                <input name="diedDate" type="text" class="form-control" id="diedDate" value="{{ old('diedDate') }}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group {{ $errors->formErrors->has('firstname') ? 'has-error' : '' }}">
                                            <label for="firstname" class="col-sm-3 control-label">Vorname: </label>
                                            <div class="col-sm-9">
                                                <input name="firstname" type="text" class="form-control" id="firstname" value="{{ old('firstname') }}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group {{ $errors->formErrors->has('lastname') ? 'has-error' : '' }}">
                                            <label for="lastname" class="col-sm-3 control-label">Nachname: </label>
                                            <div class="col-sm-9">
                                                <input name="lastname" type="text" class="form-control" id="lastname" value="{{ old('lastname') }}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group {{ $errors->formErrors->has('objectDate') ? 'has-error' : '' }}">
                                            <label for="objectDate" class="col-sm-3 control-label">Objektdatum: </label>
                                            <div class="col-sm-9">
                                                <input name="objectDate" type="text" class="form-control" id="objectDate" value="{{ old('objectDate') }}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group {{ $errors->formErrors->has('objectMedium') ? 'has-error' : '' }}">
                                            <label for="objectMedium" class="col-sm-3 control-label">Medium: </label>
                                            <div class="col-sm-9">
                                                <input name="objectMedium" type="text" class="form-control" id="objectMedium" value="{{ old('objectMedium') }}">
                                            </div>
                                        </div>
                                    </div>
                                    <div class="col-md-6">
                                        <div class="form-group {{ $errors->formErrors->has('sourceType') ? 'has-error' : '' }}">
                                            <label for="sourceType" class="col-sm-3 control-label">Auktionshaus: </label>
                                            <div class="col-sm-9">
                                                <input name="sourceType" type="text" class="form-control" id="sourceType" value="{{ old('sourceType') }}">
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <div class="row">
                                    <div class="col-md-12">
                                        <button class="btn btn-primary pull-right" type="submit"><i class="fa fa-floppy-o" aria-hidden="true"></i>&nbsp; Simulation starten</button>
                                    </div>
                                </div>
                            </div>
                            {!! Form::close() !!}

                            <h3>Künstler Matching</h3>
                            <p>
                                Status Nachricht: @if($statusMessage){{$statusMessage}}@else - @endif<br>
                                Status Nachricht Künstler: @if($statusMessageArtist){{$statusMessageArtist}}@else - @endif<br>
                            </p>

                            {{-- {!! Form::open(['action' => 'Ajax\AuctionObjectsStageOverviewController@bulkEditStatus', 'class' => 'form-horizontal', 'id' => 'frm-bulk-edit', 'method' => 'post', 'role' => 'form', 'files' => true]) !!} --}}
                            <table id="data-table-artist-simulator" class="cell-border data-table display table table-data-width nowrap hover">
                                <thead>
                                    <tr>
                                        <th>ID</th>
                                        <th>Geb.Datum</th>
                                        <th>Gest.Datum</th>
                                        <th>Vorname EN</th>
                                        <th>Nachname EN</th>
                                        <th>Vorname DE</th>
                                        <th>Nachname DE</th>
                                        <th>Vorname FR</th>
                                        <th>Nachname FR</th>
                                        <th>Geb.Ort EN</th>
                                        <th>Gest.Ort EN</th>
                                        <th>Geb.Ort DE</th>
                                        <th>Gest.Ort DE</th>
                                        <th>Geb.Ort FR</th>
                                        <th>Gest.Ort FR</th>
                                    </tr>
                                </thead>
                                <tbody>
                                @forelse($testDataArtists as $testDataArtist)
                                    <tr>
                                        <td>{{ $testDataArtist->id }}</td>
                                        <td>{{ $testDataArtist->born_date }}</td>
                                        <td>{{ $testDataArtist->died_date }}</td>
                                        <td>{{ $testDataArtist->firstname_en }}</td>
                                        <td>{{ $testDataArtist->lastname_en }}</td>
                                        <td>{{ $testDataArtist->firstname_de }}</td>
                                        <td>{{ $testDataArtist->lastname_de }}</td>
                                        <td>{{ $testDataArtist->firstname_fr }}</td>
                                        <td>{{ $testDataArtist->lastname_fr }}</td>
                                        <td>{{ $testDataArtist->born_location_en }}</td>
                                        <td>{{ $testDataArtist->died_location_en }}</td>
                                        <td>{{ $testDataArtist->born_location_de }}</td>
                                        <td>{{ $testDataArtist->died_location_de }}</td>
                                        <td>{{ $testDataArtist->born_location_fr }}</td>
                                        <td>{{ $testDataArtist->died_location_fr }}</td>
                                    </tr>
                                @empty
                                    <tr>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                    </tr>
                                @endforelse
                                </tbody>
                            </table>

                            <h3>Medium Matching</h3>
                            <p>
                                Status Nachricht Medium: @if($statusMessageMedium){{$statusMessageMedium}}@else - @endif<br>
                            </p>

                            <table id="data-table-medium-simulator" class="cell-border data-table display table table-data-width nowrap hover">
                                <thead>
                                <tr>
                                    <th>ID</th>
                                    <th>Suchwort DE</th>
                                    <th>Suchwort EN</th>
                                    <th>Suchwort FR</th>
                                    <th>Grobtechnik</th>
                                </tr>
                                </thead>
                                <tbody>
                                @forelse($testDataMediums as $testDataMedium)
                                    <tr>
                                        <td>{{ $testDataMedium->id }}</td>
                                        <td>{{ $testDataMedium->searchword_de }}</td>
                                        <td>{{ $testDataMedium->searchword_en }}</td>
                                        <td>{{ $testDataMedium->searchword_fr }}</td>
                                        <td>{{ $testDataMedium->name }}</td>
                                    </tr>
                                @empty
                                    <tr>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                        <td>-</td>
                                    </tr>
                                @endforelse
                                </tbody>
                            </table>

                            {{-- {!! Form::close() !!} --}}

                            <div class="clear"></div>

                            <script type="text/javascript">
                                $('#data-table-artist-simulator').DataTable({
                                    fixedHeader: {
                                        header: true,
                                        headerOffset: $('.page-header').outerHeight()
                                    },
                                    "pageLength": {{ $pageLength }},
                                    "lengthMenu": [ 10, 25, 50, 100 ],
                                    "lengthChange": false,
                                    "language": {
                                        "url": "/plugins/datatables/i18n/German.json"
                                    },
                                    "columnDefs": [
                                        { "orderable": false, "targets": 1 },
                                        { "orderable": false, "targets": 2 }
                                    ],
                                    "deferRender": true,
                                    "fnInitComplete": function (settings, json) {
                                        /*$('#filterContainer').insertAfter('#data-table-users_filter');
                                        $('#buttonLine').insertAfter('#data-table-users_filter');
                                        $('#filterContainer').show();
                                        $('#buttonLine').show();*/
                                    },
                                    "processing": true,
                                });

                                $('#data-table-medium-simulator').DataTable({
                                    fixedHeader: {
                                        header: true,
                                        headerOffset: $('.page-header').outerHeight()
                                    },
                                    "pageLength": {{ $pageLength }},
                                    "lengthMenu": [ 10, 25, 50, 100 ],
                                    "lengthChange": false,
                                    "language": {
                                        "url": "/plugins/datatables/i18n/German.json"
                                    },
                                    "columnDefs": [
                                        { "orderable": false, "targets": 1 },
                                        { "orderable": false, "targets": 2 }
                                    ],
                                    "deferRender": true,
                                    "fnInitComplete": function (settings, json) {
                                        /*$('#filterContainer').insertAfter('#data-table-users_filter');
                                        $('#buttonLine').insertAfter('#data-table-users_filter');
                                        $('#filterContainer').show();
                                        $('#buttonLine').show();*/
                                    },
                                    "processing": true,
                                });

                                $('.table-responsive').on('scroll', function(e) {
                                    var left = $(this).scrollLeft();
                                    var left = left - 17;
                                    $('.fixedHeader-floating').css('left', -left);
                                });
                            </script>

                        </div>
                    </div>
                </div>


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

    <style>
        .dataTables_wrapper {
            margin-bottom: 50px;
            min-height: initial;
        }
    </style>

@stop
