@extends('layouts.layout-2')

@section('content')


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

    <h4 class="font-weight-bold py-3 mb-1">
        Feedback @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_feedback')}}" 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-sm-8">
                    <label class="form-label" for="feedback_title">{{ __('Title') }}*</label>
                    {{ Form::text('title', $feedback->title,  array('placeholder'=>__('Title'), 'class'=>'form-control', 'id'=>'feedback_title', 'required'=>true)) }}
                </div>
                <div class="form-group col-sm-4">
                        <label class="custom-control custom-checkbox float-right">
                            {!! Form::checkbox('status', 1, $feedback->status, ['class'=>'custom-control-input']) !!}
                            <span class="custom-control-label">{{__('aktiv')}}</span>
                        </label>
                    @if($feedback->lvl != 1)
                    <label for="feedback_parent" class="form-label">{{__('Parent')}}*</label>
                    <select class="selectpicker" data-style="btn-default" name="feedback_parent" required>
                        {!!  HTMLHelper::getParentBy($feedback->parent, $feedback->getParentsArray()) !!}
                    </select>
                    @else
                        <label for="feedback_parent" class="form-label">{{__('Parent')}}</label>
                        <div>NON</div>
                    @endif

                </div>
            </div>
            <div class="form-row">

                <div class="form-group col-sm-8">
                    <label class="form-label" for="feedback_slug">{{ __('slug') }}*</label>
                    {{ Form::text('slug', $feedback->slug,  array('placeholder'=>__('slug'), 'class'=>'form-control', 'id'=>'feedback_slug', 'required'=>true)) }}
                </div>
                <div class="form-group col-sm-4">
                    <label class="form-label" for="feedback_date">{{ __('Reisezeitraum') }}*</label>
                    {{ Form::text('date', $feedback->date,  array('placeholder'=>__('Reisezeitraum'), 'class'=>'form-control  datepicker-base', 'id'=>'feedback_date', 'required'=>true)) }}
                </div>

            </div>

            <div class="form-row">
                <div class="form-group col-sm-12">
                    <label class="form-label" for="feedback_slug">{{ __('Text') }}*</label>
                    {{ Form::textarea('content', HTMLHelper::filterHTML($feedback->content, ['src' => ['addHost']]) , ['class' => 'form-control summernote']) }}
                </div>
            </div>

            <div class="form-row">
                <div class="form-group col-md-12">
                    <label class="form-label" for="feedback_pagetitle">{{ __('META-Titel (optional)') }}</label>
                    {{ Form::text('pagetitle', $feedback->pagetitle,  array('placeholder'=>__('pagetitle'), 'class'=>'form-control', 'id'=>'feedback_pagetitle')) }}
                </div>
                <div class="form-group col-md-12">
                    <label class="form-label" for="feedback_description">{{ __('META-Beschreibung (optional)') }}</label>
                    {{ Form::text('description', $feedback->description,  array('placeholder'=>__('description'), 'class'=>'form-control', 'id'=>'feedback_description')) }}
                </div>
                <div class="form-group col-md-12">
                    <label class="form-label" for="feedback_keywords">{{ __('META-Keywords (optional)') }}</label>
                    {{ Form::text('keywords', $feedback->keywords,  array('placeholder'=>__('keywords'), 'class'=>'form-control', 'id'=>'feedback_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_feedback')}}" class="btn btn-default">{{ __('back') }}</a>
        <a href="{{ make_v2_url("/acp/") }}" class="btn btn-default float-right">{{ __('zurück ins v2 Programm') }}</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