@extends('layouts.layout-2')

@section('content')
<style>
    .alert ul {
        margin-bottom: 0;
    }
</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_page_detail', [$id]), 'class' => 'form-horizontal']) !!}

    <h4 class="font-weight-bold py-3 mb-1">
        Reiseführer Page @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_page')}}" 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">
            <div class="form-row">
                <div class="form-group col-12">

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

                    <label class="custom-control custom-checkbox float-right ml-2">
                        {!! Form::checkbox('show_in_navi', 1, $travel_guide_page->show_in_navi, ['class'=>'custom-control-input']) !!}
                        <span class="custom-control-label">{{__('show in navi')}}</span>
                    </label>
                    <label class="form-label" for="title">{{ __('Titel') }}*</label>
                    {{ Form::text('title', $travel_guide_page->title,  array('placeholder'=>__('Title'), 'class'=>'form-control', 'id'=>'title', 'required'=>true)) }}
                </div>
            </div>
            <div class="form-row">
                <div class="form-group col-sm-10">
                    <label class="form-label" for="slug">{{ __('slug') }}</label>
                    {{ Form::text('slug', $travel_guide_page->slug,  array('placeholder'=>__('slug'), 'class'=>'form-control', 'id'=>'slug')) }}
                </div>
                <div class="form-group col-sm-2">
                    <label class="form-label" for="order">{{ __('order') }}</label>
                    {{ Form::text('order', $travel_guide_page->order,  array('placeholder'=>__('order'), 'class'=>'form-control', 'id'=>'order')) }}
                </div>

                <div class="form-group col-sm-12">
                    <label class="form-label" for="keyword">{{ __('Keyword') }} (Autoverlinkung im Text)</label>
                    {{ Form::text('keyword', $travel_guide_page->keyword,  array('placeholder'=>__('keyword'), 'class'=>'form-control', 'id'=>'keyword')) }}
                </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_page->scope, ['class'=>'custom-control-input']) !!}
                        <span class="custom-control-label">{{__('Langer Text')}}</span>
                    </label>
                    --}}
                    <label class="form-label" for="content_new">{{ __('Text') }}*</label>
                    <br clear="all">
                    {{ Form::textarea('content_new', $travel_guide_page->content_new , ['class' => 'form-control summernote']) }}
                </div>
            </div>


            <div class="form-row">
                <div class="form-group col-md-12">
                    <label class="form-label" for="pagetitle">{{ __('Meta-Titel (optional)') }}</label>
                    {{ Form::text('pagetitle', $travel_guide_page->pagetitle,  array('placeholder'=>__('pagetitle'), 'class'=>'form-control', 'id'=>'description')) }}
                </div>
                <div class="form-group col-md-12">
                    <label class="form-label" for="description">{{ __('META-Beschreibung (optional)') }}</label>
                    {{ Form::text('description', $travel_guide_page->description,  array('placeholder'=>__('description'), 'class'=>'form-control', 'id'=>'description')) }}
                </div>
                <div class="form-group col-md-12">
                    <label class="form-label" for="keywords">{{ __('META-Keywords (optional)') }}</label>
                    {{ Form::text('keywords', $travel_guide_page->keywords,  array('placeholder'=>__('meta_keywords'), 'class'=>'form-control', 'id'=>'keywords')) }}
                </div>
            </div>

            <div class="form-row">
                <div class="form-group col-sm-12">
                    <hr>
                    <label class="form-label" for="travel_guide_content_id">{{ __('Reiseführer Inhalt') }} (langer Text)</label>
                    <select class="selectpicker" name="travel_guide_content_id" id="travel_guide_content_id"  data-style="btn-light" data-live-search="true">
                        {!!  HTMLHelper::getTravelGuideOptions($travel_guide_page->travel_guide_content_id) !!}
                    </select>
                </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_page')}}" class="btn btn-default">{{ __('back') }}</a>
    </div>

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

    {{--
    <!-- Modal template -->
    <div class="modal fade" id="modals-class">
        <div class="modal-dialog">
            <form class="modal-content" action="{{ route('travel_program_class_update') }}" method="post">
                @csrf
                <input type="hidden" class="form-control" name="id">
                <input type="hidden" class="form-control" name="program_id" value="{{$feedback->id}}">


                <div class="modal-header">
                    <h5 class="modal-title">Programm Katagorie/Klassen <span class="font-weight-light">anlegen/bearbeiten</span></h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
                </div>
                <div class="modal-body">
                    <div class="form-row">
                        <div class="form-group col">
                            <label class="custom-control custom-checkbox float-right">
                                <input type="checkbox" class="custom-control-input" name="standard" checked>
                                <span class="custom-control-label">{{__('Standard')}}</span>
                            </label>
                            <label for="name" class="form-label">Name*</label>
                            <input type="text" class="form-control" name="name" placeholder="{{__('Description')}}" required>
                        </div>
                    </div>

                    <div class="form-row">
                        <div class="form-group col">
                            <label for="description" class="form-label">Beschreibung</label>
                            <input type="text" class="form-control" name="description" placeholder="{{__('Description')}}">
                        </div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">{{__('close')}}</button>
                    <button type="submit" class="btn btn-primary">{{__('save')}}</button>
                </div>
            </form>
        </div>
    </div>


    <!-- Modal template -->
    <div class="modal fade" id="modals-draft">
        <div class="modal-dialog">
            <form class="modal-content" action="{{ route('travel_program_draft_update') }}" method="post">
                @csrf
                <input type="hidden" class="form-control" name="id">
                <input type="hidden" class="form-control" name="travel_program_id" value="{{$feedback->id}}">

                <div class="modal-header">
                    <h5 class="modal-title">Vorlage Reiseprogramm <span class="font-weight-light">zuordnen</span></h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">×</button>
                </div>
                <div class="modal-body">

                    <div class="form-row">
                        <div class="form-group col">
                            <label for="draft_id" class="form-label">{{__('Vorlage')}}</label>
                            <select class="selectpicker" data-style="btn-default" name="draft_id" data-live-search="true" required>
                                {!!  HTMLHelper::getDraftOptions() !!}
                            </select>
                        </div>
                    </div>


                </div>

                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">{{__('close')}}</button>
                    <button type="submit" class="btn btn-primary">{{__('save')}}</button>
                </div>
            </form>
        </div>
    </div>

    <script>
        $( document ).ready(function() {
            $('#modals-class').on('show.bs.modal', function (event) {
                var button = $(event.relatedTarget);
                $(this).find(".modal-content input[name='id']").val(button.data('id'));
                $(this).find(".modal-body input[name='name']").val(button.data('name'));
                $(this).find(".modal-body input[name='description']").val(button.data('description'));
                $(this).find(".modal-body input[name='standard']").prop( "checked", button.data('standard'));
            });

            $('#modals-draft').on('show.bs.modal', function (event) {
                var button = $(event.relatedTarget);
                $(this).find(".modal-content input[name='id']").val(button.data('id'));
                $(this).find(".modal-body select[name='draft_id']").val(button.data('draft_id'));
                $(this).find(".modal-body select[name='travel_class_id']").val(button.data('travel_class_id'));
                $(this).find(".modal-body select[name='weekdays[]']").val(button.data('weekdays'));

                $('.selectpicker').selectpicker('refresh');
            });
        });
    </script>
    --}}


@endsection