
{!! Form::open(['url' => route('cms_content_store'), 'class' => 'modal-content']) !!}

<input type="hidden" name="id" id="id" value="@if($value->id>0){{$value->id}}@else new @endif">


<div class="modal-header">
    <h5 class="modal-title">
        {{ __('Inhalt') }}
        <span class="font-weight-light">erstellen/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 for="name" class="form-label">{{ __('Name') }}</label>
            {{ Form::text('name', $value->name,  array('placeholder'=>__('Name'), 'class'=>'form-control', 'required')) }}
        </div>
    </div>

    <div class="form-row">
        <div class="form-group col">
            <label for="field" class="form-label">{{ __('Country') }}*</label>
            <select class="selectpicker" name="field"  data-style="btn-light" data-live-search="true" required>
                {!! \App\Models\CMSContent::getFieldsOptions($value->field) !!}
            </select>
        </div>
    </div>

    <div class="form-row show-content-text" style="display: ;">
        <div class="form-group col">
            <label for="text" class="form-label">{{ __('Text') }}</label>
            {{ Form::text('text', $value->text,  array('placeholder'=>__('Text'), 'class'=>'form-control')) }}
        </div>
    </div>

    <div class="form-row show-content-full_text" style="display: ;">
        <div class="form-group col">
            <label for="text" class="form-label">{{ __('Full Text') }}</label>
            {{ Form::textarea('full_text', $value->full_text,  array('placeholder'=>__('Full Text'), 'class'=>'form-control', 'rows'=>20)) }}
        </div>
    </div>

    <div class="form-row show-content-integer" style="display: ;">
        <div class="form-group col">
            <label for="integer" class="form-label">{{ __('Zahl') }}</label>
            {{ Form::text('integer', $value->integer,  array('placeholder'=>__('Zahl'), 'class'=>'form-control')) }}
        </div>
    </div>

    <div class="form-row show-content-decimal" style="display: ;">
        <div class="form-group col">
            <label for="decimal" class="form-label">{{ __('Kommazahl') }}</label>
            {{ Form::text('decimal', $value->decimal,  array('placeholder'=>__('Kommazahl'), 'class'=>'form-control')) }}
        </div>
    </div>

</div>
<div class="modal-footer">
    <button type="button" class="btn btn-default" data-dismiss="modal">schließen</button>
    <button type="submit" class="btn btn-primary">speichern</button>
</div>
{!! Form::close() !!}


<script>
    $( document ).ready(function() {

        $('div[class*="show-content"]').hide();
        $('.show-content-'+$('select[name="field"]').val()).show();

        $('select[name="field"]').on('change', function () {
            $('div[class*="show-content"]').hide();
            $('.show-content-'+$(this).val()).show();
        });
    });


</script>
