@extends('layouts.layout-2')

@section('content')
<style>
    .alert ul {
        margin-bottom: 0;
    }
    .note-video-clip {
        max-width: 100%;
        width: 600px;
        left: 0;
        right:0;
        margin:auto;

    }
</style>
    @if ($errors->any())
        <div class="row">
            <div class="col-sm-12">
                <div class="alert alert-danger">
                    <ul>
                        @foreach ($errors->all() as $error)
                            <li>{{ $error }}</li>
                        @endforeach
                    </ul>
                </div>
            </div>
        </div>
    @endif

    {!! Form::open(['url' => route('cms_travel_guide_detail', [$id]), 'class' => 'form-horizontal']) !!}

    <h4 class="font-weight-bold py-3 mb-1">
        Reiseführer Inhalt @if($id == "new") <span class="text-primary">anlegen</span> @else {{"(ID: ".$id.")"}} verwalten @endif
        <div class="float-right">
            <button type="submit" name="action" value="saveAll" class="btn btn-submit btn-sm">{{ __('save changes') }}</button>&nbsp;
            <a href="{{route('cms_travel_guide_content')}}" class="btn btn-default btn-sm">{{ __('back') }}</a>
        </div>
    </h4>
    <div class="clearfix"></div>

    <input type="hidden" name="id" id="id" value="{{$id}}">

    <!-- draft -->
    <div class="card mb-2">
        <div class="card-body">
            <h4 class="mb-0 bg-light p-1">Inhalte</h4>
            <hr class="mt-0">
            <div class="form-row">
                <div class="form-group col-12">

                    <label class="custom-control custom-checkbox float-right">
                        {!! Form::checkbox('active', 1, $travel_guide->active, ['class'=>'custom-control-input']) !!}
                        <span class="custom-control-label">{{__('aktiv')}}</span>
                    </label>

                    <label class="form-label" for="travel_guide_title">{{ __('Titel') }}*</label>
                    {{ Form::text('name', $travel_guide->name,  array('placeholder'=>__('Title'), 'class'=>'form-control', 'id'=>'travel_guide_name', 'required'=>true)) }}
                </div>
            </div>
            <div class="form-row">
                <div class="form-group col-sm-12">
                    <label class="form-label" for="travel_guide_slug">{{ __('slug') }} (wird autmatisch aus dem Titel erstellt)</label>
                    {{ Form::text('slug', $travel_guide->slug,  array('placeholder'=>__('slug'), 'class'=>'form-control', 'id'=>'travel_guide_slug')) }}
                </div>
            </div>
            <div class="form-row">
                <div class="form-group col-sm-12">
                    <label class="custom-control custom-checkbox float-right">
                        {!! Form::checkbox('scope', 1, $travel_guide->scope, ['class'=>'custom-control-input']) !!}
                        <span class="custom-control-label">{{__('Langer Text')}}</span>
                    </label>
                    <label class="form-label" for="travel_guide_full_text">{{ __('Text') }}* </label>
                    @if($response_clean === "true")
                        &nbsp; &nbsp;<a class="btn btn-primary btn-xs" href="?clean=">Clean Text on</a>
                    @else
                        &nbsp; &nbsp;<a class="btn btn-default btn-xs" href="?clean=true">Clean Text off</a>
                     @endif
                    <br clear="all">
                    {{ Form::textarea('full_text', $travel_guide->full_text , ['class' => 'form-control summernote', 'style'=>'height:600px']) }}
                </div>
            </div>
            <div class="form-row">
                <!--<div class="form-group col-sm-6">
                    <label class="form-label" for="preview_image">{{ __('Vorschau Bild:') }}</label>
                    {{ Form::text('preview_image', '',  array('placeholder'=>__('Vorschau Bild'), 'class'=>'form-control', 'id'=>'preview_image')) }}

                </div>-->
                <div class="form-group col-sm-6">
                    <label class="form-label" for="author_id">{{ __('Autor dieses Artikels:') }} <a href="{{route('cms_content_author')}}"><i class="fa fa-share-square"></i></a> </label>
                    <select class="custom-select" name="author_id">
                        <option value="">kein Autor</option>
                        {!!  HTMLHelper::getAuthorOptions($travel_guide->author_id) !!}
                    </select>
                </div>
            </div>
            <h4 class="mb-0 bg-light p-1">Tree / Navigation</h4>
            <hr class="mt-0">

            <button type="button" class="btn btn-primary btn-sm float-right mb-2" data-toggle="modal" data-target="#modals-load-content"
                    data-id="add"
                    data-model="guide"
                    data-action="guide-tree-site"
                    data-request="{!! array_to_json(['travel_guide_id'=>$travel_guide->id]) !!}"
                    data-route="{{ route('iq_content_modal_load') }}"><i class="ion ion-ios-add-circle"></i> Tree zuordnen</button>

            @if($travel_guide->iq_content_sites->count())
                <table class="table table-striped border-bottom">
                    <thead>
                    <tr>
                        <th style="max-width: 60px;">&nbsp;</th>
                        <th>{{__('Name')}}</th>
                        <th>{{__('url')}}</th>
                        <th>{{__('Zuordnung')}}</th>
                        <th>{{__('sichtbar')}}</th>
                        <th>#</th>
                    </tr>
                    </thead>
                    <tbody>
                    @foreach($travel_guide->iq_content_sites as $iq_content_site)
                        <tr>
                            <td style="width: 5%;">
                                <a href="{{ route('iq_content_tree_detail', [$iq_content_site->iq_content_tree_node->tree_id, $iq_content_site->iq_content_tree_node->id]) }}" class="btn icon-btn btn-sm btn-primary">
                                    <span class="fa fa-share"></span>
                                </a>
                            </td>
                            <td>{{$iq_content_site->iq_content_tree_node->name}}</td>
                            <td><a href="{{ $iq_content_site->iq_content_tree_node->getUrl() }}" class="btn icon-btn btn-sm btn-secondary" target="_blank">
                                    <span class="fa fa-external-link-alt"></span>
                                </a> {{$iq_content_site->iq_content_tree_node->getUri()}}
                            </td>
                            <td>
                                {{$iq_content_site->getTravelType()}}
                            </td>
                            <td>{!! get_active_badge($iq_content_site->iq_content_tree_node->active)  !!}</td>
                            <td>
                                <a class="text-danger" href="{{ route('iq_content_tree_detail_remove', ['guide', $iq_content_site->iq_content_tree_node->tree_id, $iq_content_site->tree_node_id, $iq_content_site->travel_guide->id, 'guide']) }}"  onclick="return confirm('{{__('Seite aus Tree entfernen?')}}');"><i class="fa fa-reply"></i></a>
                            </td>
                        </tr>
                    @endforeach
                    </tbody>
                </table>
                <hr>
            @endif

            <h4 class="mb-0 bg-light p-1">Meta</h4>
            <hr class="mt-0">

            <div class="form-row">
                <div class="form-group col-md-12">
                    <label class="form-label" for="travel_guide_keyword">{{ __('Keyword (optional | Verlinkung im Text)') }}</label>
                    {{ Form::text('keyword', $travel_guide->keyword,  array('placeholder'=>__('Keyword'), 'class'=>'form-control', 'id'=>'travel_guide_keyword')) }}
                </div>
                <div class="form-group col-md-12">
                    <label class="form-label" for="travel_guide_meta_title">{{ __('META-Titel (optional)') }}</label>
                    {{ Form::text('meta_title', $travel_guide->meta_title,  array('placeholder'=>__('meta_title'), 'class'=>'form-control', 'id'=>'travel_guide_meta_title')) }}
                </div>
                <div class="form-group col-md-12">
                    <label class="form-label" for="travel_guide_meta_description">{{ __('META-Beschreibung (optional)') }}</label>
                    {{ Form::text('meta_description', $travel_guide->meta_description,  array('placeholder'=>__('meta_description'), 'class'=>'form-control', 'id'=>'travel_guide_meta_description')) }}
                </div>
                <div class="form-group col-md-12">
                    <label class="form-label" for="travel_guide_meta_keywords">{{ __('META-Keywords (optional)') }}</label>
                    {{ Form::text('meta_keywords', $travel_guide->meta_keywords,  array('placeholder'=>__('meta_keywords'), 'class'=>'form-control', 'id'=>'feedback_meta_keywords')) }}
                </div>
            </div>

        </div>
    </div>


    <div class="text-left mt-3">
        <button type="submit" name="action" value="saveAll" class="btn btn-submit">{{ __('save changes') }}</button>&nbsp;
        <a href="{{route('cms_travel_guide_content')}}" class="btn btn-default">{{ __('back') }}</a>
    </div>

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




@endsection