@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
    <h4 class="font-weight-bold py-3 mb-1">
        Reiseführer verwalten
    </h4>

    {!! Form::open(['url' => route('cms_travel_magazine_detail', [$id]), 'class' => 'form-horizontal']) !!}
    <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">
                        {!! Form::checkbox('active', 1, $travel_magazine->active, ['class'=>'custom-control-input']) !!}
                        <span class="custom-control-label">{{__('aktiv')}}</span>
                    </label>

                    <label class="form-label" for="travel_magazine_title">{{ __('Titel') }}*</label>
                    {{ Form::text('name', $travel_magazine->name,  array('placeholder'=>__('Title'), 'class'=>'form-control', 'id'=>'travel_magazine_name', 'required'=>true)) }}
                </div>
            </div>
            <div class="form-row">
                <div class="form-group col-sm-12">
                    <label class="form-label" for="travel_magazine_slug">{{ __('slug') }} (wird autmatisch aus dem Titel erstellt)</label>
                    {{ Form::text('slug', $travel_magazine->slug,  array('placeholder'=>__('slug'), 'class'=>'form-control', 'id'=>'travel_magazine_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_magazine->scope, ['class'=>'custom-control-input']) !!}
                        <span class="custom-control-label">{{__('Langer Text')}}</span>
                    </label>
                    <label class="form-label" for="travel_magazine_full_text">{{ __('Text') }}*</label>
                    <br clear="all">
                    {{ Form::textarea('full_text', $travel_magazine->full_text , ['class' => 'form-control summernote']) }}
                </div>
            </div>


            <div class="form-row">
                <div class="form-group col-md-12">
                    <label class="form-label" for="travel_magazine_meta_title">{{ __('META-Titel (optional)') }}</label>
                    {{ Form::text('meta_title', $travel_magazine->meta_title,  array('placeholder'=>__('meta_title'), 'class'=>'form-control', 'id'=>'travel_magazine_meta_title')) }}
                </div>
                <div class="form-group col-md-12">
                    <label class="form-label" for="travel_magazine_meta_description">{{ __('META-Beschreibung (optional)') }}</label>
                    {{ Form::text('meta_description', $travel_magazine->meta_description,  array('placeholder'=>__('meta_description'), 'class'=>'form-control', 'id'=>'travel_magazine_meta_description')) }}
                </div>
                <div class="form-group col-md-12">
                    <label class="form-label" for="travel_magazine_meta_keywords">{{ __('META-Keywords (optional)') }}</label>
                    {{ Form::text('meta_keywords', $travel_magazine->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_magazine')}}" 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