clrghouz/resources/views/components/form/notes.blade.php

44 lines
1.6 KiB
PHP

<div class="form-group">
@if(isset($label))
<label {{ $attributes->only(['class'])->merge(['class'=>'form-label']) }} for="{{ $id ?? $name }}">{!! html_entity_decode($label) !!}</label>
@endisset
<div class="input-group has-validation">
@if(isset($icon) || isset($prepend))
<div class="input-group-prepend">
<span class="input-group-text">@isset($icon)<i class="fas fa-fw {{ $icon }}"></i>@endisset @isset($prepend){!! $prepend !!}@endisset</span>
</div>
@endif
<div class="w-100">
<textarea class="form-control {{ $class ?? ''}} @error((! empty($old)) ? $old : $name) is-invalid @enderror" rows="{{ (($l=count(explode("\n",$value ?? ''))) < ($rows ?? 5) ? $rows : (($l > ($y=($max ?? 25))) ? $y : $l)) }}" id="{{ $id ?? $name }}" name="{{ $name }}" @isset($placeholder)placeholder="{{ $placeholder }}"@endisset @readonly(isset($readonly) && $readonly) @required(isset($required) && $required) @disabled(isset($disabled) && $disabled)>{{ old($old ?? $name,$value ?? '') }}</textarea>
<span class="invalid-feedback">
@error($old ?? $name)
{{ $message }}
@elseif(isset($feedback))
{{ $feedback }}
@enderror
</span>
</div>
</div>
@isset($helper)
<span class="input-helper">{{ $helper }}</span>
@endif
</div>
@if(isset($simplemde) && $simplemde)
@pa(simplemde)
@section('page-scripts')
<script type="text/javascript">
$(document).ready(function() {
new SimpleMDE({
element: $('#{{ $id ?? $name }}')[0],
forceSync: true
});
@error($old ?? $name)
$('div.CodeMirror-wrap').addClass('form-control is-invalid');
@enderror
});
</script>
@append
@endif