@extends('layouts.layout-2')

@section('content')


    <h4 class="font-weight-bold py-3 mb-1">
        {{ __('Reiseführer Trees') }}
    </h4>

    <div class="card">
        <div class="card-datatable table-responsive py-2">
            <div class="ml-2 mb-2 text-left">
                <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modals-load-content"
                        data-id="add"
                        data-model="tree"
                        data-action="tree-content"
                        data-request=""
                        data-route="{{ route('iq_content_modal_load') }}"><i class="ion ion-ios-add-circle"></i> Add Tree</button>
            </div>
            <table class="datatables-travel_guide table table-striped table-bordered">
                <thead>
                <tr>
                    <th style="max-width: 60px;">#</th>
                    <th>Name</th>
                    <th>Identifier</th>
                    <th>Description</th>
                    <th>Nodes(s)</th>
                    <th>Updated</th>
                    <th>Status</th>
                </tr>
                </thead>
                <tbody>
                @foreach($models as $model)
                    <tr class="">
                        <td>
                            <a href="{{ route('iq_content_tree_detail', [$model->id]) }}" class="btn icon-btn btn-sm btn-primary">
                                <span class="fa fa-edit"></span>
                            </a>
                        </td>
                        <td><a href="{{ route('iq_content_tree_detail', [$model->id]) }}">{{ $model->name }}</a></td>
                        <td>{{ $model->identifier }}</td>
                        <td>{{ $model->description }}</td>
                        <td>{{ $model->iq_content_tree_nodes->count() }}</td>
                        <td>{{ $model->updated_at->format("d/m/Y") }}</td>
                        <td>{!! get_active_badge($model->active) !!}</td>
                    </tr>
                @endforeach
                </tbody>
            </table>
            <div class="mt-4 col">
                <button type="button" class="btn btn-primary btn-sm" data-toggle="modal" data-target="#modals-load-content"
                        data-id="add"
                        data-model="tree"
                        data-action="tree-content"
                        data-request=""
                        data-route="{{ route('iq_content_modal_load') }}"><i class="ion ion-ios-add-circle"></i> Add Tree</button>
            </div>
        </div>
        <script>
            $( document ).ready(function() {
                $('.datatables-travel_guide').dataTable({
                    "bLengthChange": false,
                    "iDisplayLength": 50,
                    "language": {
                        "url": "/js/German.json"
                    },
                });
            });
        </script>
    </div>

@endsection

