@extends('layouts.layout-2')

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

    <h4 class="font-weight-bold py-3 mb-1">
        Frage &amp; Anwort @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_answer_question')}}" 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-12">
                        <label for="i_q_content_category_id" class="form-label">Kategorie*</label>
                        {{ Form::select('i_q_content_category_id', $identifier_options , $model->i_q_content_category_id, array('class'=>'custom-select', 'required'=>true)) }}
                    </div>


                <div class="form-group col-sm-12">
                    <label class="custom-control custom-checkbox float-right">
                        {!! Form::checkbox('active', 1, $model->active, ['class'=>'custom-control-input']) !!}
                        <span class="custom-control-label">{{__('aktiv')}}</span>
                    </label>

                    <label class="form-label" for="question">{{ __('Frage Titel') }} (Text)*</label>
                    {{ Form::text('question', $model->question,  array('placeholder'=>__('max 255 Zeichen'), 'class'=>'form-control', 'id'=>'question', 'required'=>true)) }}
                </div>

            </div>
            {{-- <div class="form-row">
                <div class="form-group col-sm-12">
                    <label class="form-label" for="question_text">{{ __('Frage Text') }} (Nur Text)</label>
                    {{ Form::textarea('question_text', $model->question_text , ['class' => 'form-control', 'id'=>'question_text']) }}
                </div>
            </div>

            <div class="form-row">
                <div class="form-group col-sm-12">
                    <label class="form-label" for="answer">{{ __('Antwort Titel') }}*</label>
                    {{ Form::text('answer', $model->answer,  array('placeholder'=>__('Antwort'), 'class'=>'form-control', 'id'=>'answer')) }}
                </div>
            </div>
            --}}
            <div class="form-row">
                <div class="form-group col-sm-12">
                    <label class="form-label" for="answer_text">{{ __('Antwort') }} (HTML)*</label>
                    {{ Form::textarea('answer_text', $model->answer_text , ['class' => 'form-control summernote', 'id'=>'answer_text']) }}
                </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_answer_question')}}" class="btn btn-default">{{ __('back') }}</a>
    </div>

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

@endsection


@section('scripts')
    <script>
        $(document).ready(function() {

            $('.summernote').summernote({
                height: 300,
                tabsize: 2,
                followingToolbar: true,
                imageTitle: {
                    specificAltField: true,
                },
                lang: 'de-DE',
                toolbar: [
                    ['style', ['style']],
                    ['font', ['bold', 'italic', 'clear']],
                    ['para', ['ul', 'ol']],
                    ['insert', ['link', 'hr']],
                    ['view', ['fullscreen', 'codeview']],
                    ['help', ['help']]
                ],
                styleTags: ['p', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6'],

                cleaner:{
                    action: 'both', // both|button|paste 'button' only cleans via toolbar button, 'paste' only clean when pasting content, both does both options.
                    newline: '<br>', // Summernote's default is to use '<p><br></p>'
                    notStyle: 'position:absolute;top:0;left:0;right:0', // Position of Notification
                    icon: '<i class="note-icon">[Your Button]</i>',
                    keepHtml: false, // Remove all Html formats
                    keepOnlyTags: ['<p>', '<br>', '<ul>', '<li>', '<b>', '<strong>','<i>', '<a>'], // If keepHtml is true, remove all tags except these
                    keepClasses: false, // Remove Classes
                    badTags: ['style', 'script', 'applet', 'embed', 'noframes', 'noscript', 'html'], // Remove full tags with contents
                    badAttributes: ['style', 'start'], // Remove attributes from remaining tags
                    limitChars: false, // 0/false|# 0/false disables option
                    limitDisplay: 'both', // text|html|both
                    limitStop: false // true/false
                }

            });
        });
    </script>
@endsection